From a3b706a62157c8ccda132cfa71759cfdff3e3bfa Mon Sep 17 00:00:00 2001 From: Kirill Vasin Date: Mon, 21 Oct 2024 08:58:40 +0200 Subject: [PATCH 01/26] fix dataset --- src/StandardForm.wl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/StandardForm.wl b/src/StandardForm.wl index 07897dd..4e7be88 100644 --- a/src/StandardForm.wl +++ b/src/StandardForm.wl @@ -4,8 +4,7 @@ RowBoxFlatten[x_List, y___] := StringJoin @@ (ToString[#] & /@ x) Begin["Notebook`Editor`StandardForm`"] -System`DatasetWrapper; -System`VideoWrapper; + System`ByteArrayWrapper; System`TreeWrapper; @@ -13,7 +12,6 @@ System`TreeWrapper; (* FIXME *) ExpressionReplacements = { b_ByteArray :> ByteArrayWrapper[b], - d_Dataset :> DatasetWrapper[d], t_Tree :> TreeWrapper[t], TreeForm[expr_] :> (ExpressionTree[Unevaluated[expr] ] /. t_Tree :> TreeWrapper[t]) } // Quiet From 27930153fdea1994154070b7728ab047aa349d85 Mon Sep 17 00:00:00 2001 From: Kirill Vasin Date: Wed, 23 Oct 2024 19:18:14 +0200 Subject: [PATCH 02/26] fix diffs --- src/AutocompleteDefaults.wl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AutocompleteDefaults.wl b/src/AutocompleteDefaults.wl index e5814a3..a58b0cd 100644 --- a/src/AutocompleteDefaults.wl +++ b/src/AutocompleteDefaults.wl @@ -1,4 +1,4 @@ -{<|"label"->"Drop", "type"->"keyword", "info"->"Drop[list, n] gives list with its first n elements dropped."|>, <|"label"->"NotebookDirectory", "type"->"keyword", "info"->"NotebookDirectory[] returns a path to a directory of the current notebook"|>, <|"label"->"EvaluationCell", "type"->"keyword", "info"->"EvaluationCell[] returns a reference to the current input cell"|>, <|"label"->"SystemOpen", "type"->"keyword", "info"->"SystemOpen[path_String | _File | _URL] opens a path using system call"|>, <|"label" -> "Annotation", "type" -> "keyword", +{<|"label"->"Differences", "type"->"keyword", "info"->"Differences[list] gives the successive differences, Differences[list, n], Differences[list, n, s]"|>, <|"label"->"Drop", "type"->"keyword", "info"->"Drop[list, n] gives list with its first n elements dropped."|>, <|"label"->"NotebookDirectory", "type"->"keyword", "info"->"NotebookDirectory[] returns a path to a directory of the current notebook"|>, <|"label"->"EvaluationCell", "type"->"keyword", "info"->"EvaluationCell[] returns a reference to the current input cell"|>, <|"label"->"SystemOpen", "type"->"keyword", "info"->"SystemOpen[path_String | _File | _URL] opens a path using system call"|>, <|"label" -> "Annotation", "type" -> "keyword", "info" -> "Annotation[expr, data] annotates arbitary expression with data (invisible on output). Annotation[edge_, key_->value_] annotates edge of a graph"|>, <|"label" -> "Integrate", "type" -> "keyword", "info" -> "Integrate[f[x], x] gives the indefinite integral. Integrate[f[x], {x, min, max}] gives the definite integral..."|>, <|"label" -> "TableForm", "type" -> "keyword", "info" -> "TableForm[expr_List] formats list of lists as table"|>, <|"label" -> "Item", "type" -> "keyword", "info" -> "Use it inside Grid, TableForm to color or stylize font of expression. Accepts the same options as Style[]"|>, <|"label" -> "ToExpression", "type" -> "keyword", "info" -> "gives the expression obtained by interpreting strings as Wolfram \ Language input"|>, <|"label" -> "MakeBoxes", "type" -> "keyword", From f0c0bff4bf0a7116987bd46e9a203929be7eb6d0 Mon Sep 17 00:00:00 2001 From: Kirill Vasin Date: Fri, 25 Oct 2024 18:28:21 +0200 Subject: [PATCH 03/26] Tab autocomplete --- .DS_Store | Bin 8196 -> 10244 bytes dist/kernel.js | 20 ++++++++++++-------- dist/kernel.min.js | 2 +- package.json | 2 +- src/kernel.js | 18 +++++++++++++++--- 5 files changed, 29 insertions(+), 13 deletions(-) diff --git a/.DS_Store b/.DS_Store index 681ac40aa6bf3fdccb0c1aa147b132b80999a3dd..2fed01c6a5d4fe61e5f5b7674237b080947a6ef6 100644 GIT binary patch literal 10244 zcmeGhTWl0n^qgsd83*XJ6bnm>D^-e6%N7c@D6oBrP@uIB+VU#9JJT{UJ5zUNTd<4HJaduJk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8VWxJDe~B~@;doGiQ-Vn=iM?nEJ+G*F^#3o zBE^y-US}u&63)W+Z~-oolV8O=6tM(@xD2bX7B}EVa_dHH#_iaO50Y~;*WQc!FoH2O zFi!40hzT6QNAWRy9G}Q=@fYw#dv1^#Hv=@22;t<@T%KAFtgvq$nu8lcX76a$@nhk@JY}P z%}@_bu#I39y~ow;nFN*9^qleLYw`jK=_QpmzblHi { doc: args.doc, extensions: [ keymap.of([ + { key: "Tab", run: function (editor, key) { + return acceptCompletion(editor); + } }, { key: "Enter", preventDefault: true, run: function (editor, key) { return true; } } @@ -40133,6 +40129,9 @@ compactWLEditor.state = (args) => { doc: args.doc, extensions: [ keymap.of([ + { key: "Tab", run: function (editor, key) { + return acceptCompletion(editor); + } }, { key: "Enter", preventDefault: true, run: function (editor, key) { return true; } } @@ -40355,7 +40354,12 @@ const EditorExtensions = [ () => search(), - (self, initialLang) => keymap.of([indentWithTab, + (self, initialLang) => keymap.of([ + { key: "Tab", run: function (editor, key) { + const res = acceptCompletion(editor); + if (!res) return indentMore(editor); + return res; + }, shift: indentLess }, { key: "Backspace", run: function (editor, key) { if(editor.state.doc.length === 0) { self.origin.remove(); return true; } } }, diff --git a/dist/kernel.min.js b/dist/kernel.min.js index 218088e..f6e4f0a 100644 --- a/dist/kernel.min.js +++ b/dist/kernel.min.js @@ -1 +1 @@ -class t{constructor(){}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 a(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}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 l(n,o,i,r);n=o+1,i++}}decompose(t,i,r,o){let a=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(a.text,t.text.slice(),0,a.length);if(i.length<=32)r.push(new e(i,t.length+a.length));else{let t=i.length>>1;r.push(new e(i.slice(0,t)),new e(i.slice(t)))}}else r.push(a)}replace(t,r,o){if(!(o instanceof e))return super.replace(t,r,o);let a=n(this.text,n(o.text,s(this.text,0,t)),r),l=this.length+o.length-(r-t);return a.length<=32?new e(a,l):i.from(e.split(a,[]),l)}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=a+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,a=i+r.lines-1;if((e?a:o)>=t)return r.lineInner(t,e,i,n);n=o+1,i=a+1}}decompose(t,e,i,n){for(let s=0,r=0;r<=e&&s=r){let s=n&((r<=t?1:0)|(a>=e?2:0));r>=t&&a<=e&&!s?i.push(o):o.decompose(t-r,e-r,i,s)}r=a+1}}replace(t,e,n){if(n.lines=r&&e<=a){let l=o.replace(t-r,e-r,n),h=this.lines-o.lines+l.lines;if(l.lines>4&&l.lines>h>>6){let r=this.children.slice();return r[s]=l,new i(r,this.length-(e-t)+n.length)}return super.replace(r,a,l)}r=a+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=a+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,a]=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==a)return n;let i=this.children[s],l=t.children[r];if(i!=l)return n+i.scanIdentical(l,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,a=r>>1,l=[],h=0,c=-1,u=[];function d(t){let n;if(t.lines>o&&t instanceof i)for(let e of t.children)d(e);else t.lines>a&&(h>a||!h)?(f(),l.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&&f(),h+=t.lines,c+=t.length+1,u.push(t))}function f(){0!=h&&(l.push(1==u.length?u[0]:i.from(u,c)),c=-1,h=u.length=0)}for(let e of t)d(e);return f(),1==l.length?l[0]:new i(l,n)}}function n(t,e,i=0,n=1e9){for(let s=0,r=0,o=!0;r=i&&(l>n&&(a=a.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,a=s instanceof e?s.text.length:s.children.length;if(o==(i>0?a: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 a{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]=a.prototype[Symbol.iterator]=function(){return this});let l=class{constructor(t,e,i,n){this.from=t,this.to=e,this.number=i,this.text=n}get length(){return this.to-this.from}},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 d=8205;function f(t,e,i=!0,n=!0){return(i?p:O)(t,e,n)}function p(t,e,i){if(e==t.length)return e;e&&g(t.charCodeAt(e))&&m(t.charCodeAt(e-1))&&e--;let n=b(t,e);for(e+=v(n);e=0&&u(b(t,n));)i++,n-=2;if(i%2==0)break;e+=2}}}return e}function O(t,e,i){for(;e>0;){let n=p(t,e-2,i);if(n=56320&&t<57344}function m(t){return t>=55296&&t<56320}function b(t,e){let i=t.charCodeAt(e);if(!m(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return g(n)?n-56320+(i-55296<<10)+65536:i}function w(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function v(t){return t<65536?1:2}const S=/\r\n?|\n/;var y=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(y||(y={}));class x{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;et)return s+(t-n);s+=o}else{if(i!=y.Simple&&l>=t&&(i==y.TrackDel&&nt||i==y.TrackBefore&&nt))return null;if(l>t||l==t&&e<0&&!o)return t==n||e<0?s:s+a;s+=a}n=l}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 x(t)}static create(t){return new x(t)}}class k extends x{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 P(this,((e,i,n,s,r)=>t=t.replace(n,n+(i-e),r)),!1),t}mapDesc(t,e=!1){return C(this,t,e,!0)}invert(e){let i=this.sections.slice(),n=[];for(let s=0,r=0;s=0){i[s]=a,i[s+1]=o;let l=s>>1;for(;n.length0&&$(i,e,s.text),s.forward(t),o+=t}let l=t[r++];for(;o>1].toJSON()))}return t}static of(e,i,n){let s=[],r=[],o=0,a=null;function l(t=!1){if(!t&&!s.length)return;oa||e<0||a>i)throw new RangeError(`Invalid change range ${e} to ${a} (in doc of length ${i})`);let u=c?"string"==typeof c?t.of(c.split(n||S)):c:t.empty,d=u.length;if(e==a&&0==d)return;eo&&Q(s,e-o,-1),Q(s,a-e,d),$(r,s,u),o=a}}(e),l(!a),a}static empty(t){return new k(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 $(e,i,n){if(0==n.length)return;let s=i.length-2>>1;if(s>1])),!(n||a==e.sections.length||e.sections[a+1]<0);)l=e.sections[a++],h=e.sections[a++];i(r,c,o,u,d),r=c,o=u}}}function C(t,e,i,n=!1){let s=[],r=n?[]:null,o=new X(t),a=new X(e);for(let t=-1;;)if(-1==o.ins&&-1==a.ins){let t=Math.min(o.len,a.len);Q(s,t,-1),o.forward(t),a.forward(t)}else if(a.ins>=0&&(o.ins<0||t==o.i||0==o.off&&(a.len=0&&t=0)){if(o.done&&a.done)return r?k.createSet(s,r):x.create(s);throw new Error("Mismatched change set lengths")}{let e=0,i=o.len;for(;i;)if(-1==a.ins){let t=Math.min(i,a.len);e+=t,i-=t,a.forward(t)}else{if(!(0==a.ins&&a.lene||o.ins>=0&&o.len>e)&&(t||n.length>i),r.forward2(e),o.forward(e)}}else Q(n,0,o.ins,t),s&&$(s,n,o.text),o.next()}}class X{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 Z{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 Z(i,n,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return A.range(t,e);let i=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return A.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 A.range(t.anchor,t.head)}static create(t,e,i){return new Z(t,e,i)}}class A{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:A.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 A(t.ranges.map((t=>Z.fromJSON(t))),t.main)}static single(t,e=t){return new A([A.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?A.range(o,r):A.range(r,o))}}return new A(t,e)}}function T(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let R=0;class E{constructor(t,e,i,n,s){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=n,this.id=R++,this.default=t([]),this.extensions="function"==typeof s?s(this):s}static define(t={}){return new E(t.combine||(t=>t),t.compareInput||((t,e)=>t===e),t.compare||(t.combine?(t,e)=>t===e:V),!!t.static,t.enables)}of(t){return new M([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,2,e)}from(t,e){return e||(e=t=>t),this.compute([t],(i=>e(i.field(t))))}}function V(t,e){return t==e||t.length==e.length&&t.every(((t,i)=>t===e[i]))}class M{constructor(t,e,i,n){this.dependencies=t,this.facet=e,this.type=i,this.value=n,this.id=R++}dynamicSlot(t){var e;let i=this.value,n=this.facet.compareInput,s=this.id,r=t[s]>>1,o=2==this.type,a=!1,l=!1,h=[];for(let i of this.dependencies)"doc"==i?a=!0:"selection"==i?l=!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(a&&e.docChanged||l&&(e.docChanged||e.selection)||W(t,h)){let e=i(t);if(o?!D(e,t.values[r],n):!n(e,t.values[r]))return t.values[r]=e,1}return 0},reconfigure:(t,e)=>{let a,l=e.config.address[s];if(null!=l){let s=tt(e,l);if(this.dependencies.every((i=>i instanceof E?e.facet(i)===t.facet(i):!(i instanceof q)||e.field(i,!1)==t.field(i,!1)))||(o?D(a=i(t),s,n):n(a=i(t),s)))return t.values[r]=s,0}else a=i(t);return t.values[r]=a,1}}}}function D(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 a(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(Y).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,Y.of({field:this,create:t})]}get extension(){return this}}const L=4,z=3,I=2,B=1;function j(t){return e=>new G(e,t)}const N={highest:j(0),high:j(B),default:j(I),low:j(z),lowest:j(L)};class G{constructor(t,e){this.inner=t,this.prec=e}}class F{of(t){return new H(this,t)}reconfigure(t){return F.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class H{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;function r(t,o){let a=s.get(t);if(null!=a){if(a<=o)return;let e=n[a].indexOf(t);e>-1&&n[a].splice(e,1),t instanceof H&&i.delete(t.compartment)}if(s.set(t,o),Array.isArray(t))for(let e of t)r(e,o);else if(t instanceof H){if(i.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");let n=e.get(t.compartment)||t.inner;i.set(t.compartment,n),r(n,o)}else if(t instanceof G)r(t.inner,t.prec);else if(t instanceof q)n[o].push(t),t.provides&&r(t.provides,o);else if(t instanceof M)n[o].push(t),t.facet.extensions&&r(t.facet.extensions,I);else{let e=t.extension;if(!e)throw new Error(`Unrecognized extension value in extension set (${t}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(e,o)}}return r(t,I),n.reduce(((t,e)=>t.concat(e)))}(t,e,r))i instanceof q?n.push(i):(s[i.facet.id]||(s[i.facet.id]=[])).push(i);let o=Object.create(null),a=[],l=[];for(let t of n)o[t.id]=l.length<<1,l.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]=a.length<<1|1,V(r,e))a.push(i.facet(n));else{let t=n.combine(e.map((t=>t.value)));a.push(i&&n.compare(t,i.facet(n))?i.facet(n):t)}else{for(let t of e)0==t.type?(o[t.id]=a.length<<1|1,a.push(t.value)):(o[t.id]=l.length<<1,l.push((e=>t.dynamicSlot(e))));o[n.id]=l.length<<1,l.push((t=>U(t,n,e)))}}let c=l.map((t=>t(o)));return new J(t,r,c,o,a,s)}}function K(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 tt(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}const et=E.define(),it=E.define({combine:t=>t.some((t=>t)),static:!0}),nt=E.define({combine:t=>t.length?t[0]:void 0,static:!0}),st=E.define(),rt=E.define(),ot=E.define(),at=E.define({combine:t=>!!t.length&&t[0]});class lt{constructor(t,e){this.type=t,this.value=e}static define(){return new ht}}class ht{of(t){return new lt(this,t)}}class ct{constructor(t){this.map=t}of(t){return new ut(this,t)}}class ut{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 ut(this.type,e)}is(t){return this.type==t}static define(t={}){return new ct(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}}ut.reconfigure=ut.define(),ut.appendConfig=ut.define();class dt{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&&T(i,e.newLength),s.some((t=>t.type==dt.time))||(this.annotations=s.concat(dt.time.of(Date.now())))}static create(t,e,i,n,s,r){return new dt(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(dt.userEvent);return!(!e||!(e==t||e.length>t.length&&e.slice(0,t.length)==t&&"."==e[t.length]))}}function ft(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=pt(n,Ot(e,r,t.changes.newLength),!0))}return n==t?t:dt.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(st)){let e=n(t);if(!1===e){i=!1;break}Array.isArray(e)&&(i=!0===i?e:ft(i,e))}if(!0!==i){let n,s;if(!1===i)s=t.changes.invertedDesc,n=k.empty(e.doc.length);else{let e=t.changes.filter(i);n=e.changes,s=e.filtered.mapDesc(e.changes).invertedDesc}t=dt.create(e,n,t.selection&&t.selection.map(s),ut.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let n=e.facet(rt);for(let i=n.length-1;i>=0;i--){let s=n[i](t);t=s instanceof dt?s:Array.isArray(s)&&1==s.length&&s[0]instanceof dt?s[0]:gt(e,bt(s),!1)}return t}(s):s)}dt.time=lt.define(),dt.userEvent=lt.define(),dt.addToHistory=lt.define(),dt.remote=lt.define();const mt=[];function bt(t){return null==t?mt:Array.isArray(t)?t:[t]}var wt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(wt||(wt={}));const vt=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let St;try{St=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(t){}function yt(t){return e=>{if(!/\S/.test(e))return wt.Space;if(function(t){if(St)return St.test(t);for(let e=0;e"€"&&(i.toUpperCase()!=i.toLowerCase()||vt.test(i)))return!0}return!1}(e))return wt.Word;for(let i=0;i-1)return wt.Word;return wt.Other}}class xt{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(ut.reconfigure)?(i=null,n=e.value):e.is(ut.appendConfig)&&(i=null,n=bt(n).concat(e.value));if(i)e=t.startState.values.slice();else{i=J.resolve(n,s,this),e=new xt(i,this.doc,this.selection,i.dynamicSlots.map((()=>null)),((t,e)=>e.reconfigure(t,this)),null).values}new xt(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:A.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=bt(i.effects);for(let i=1;is.spec.fromJSON(r,t))))}return xt.create({doc:t.doc,selection:A.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(xt.lineSeparator)||S)),s=e.selection?e.selection instanceof A?e.selection:A.single(e.selection.anchor,e.selection.head):A.single(0);return T(s,n.length),i.staticFacet(it)||(s=s.asSingle()),new xt(i,n,s,i.dynamicSlots.map((()=>null)),((t,e)=>e.create(t)),null)}get tabSize(){return this.facet(xt.tabSize)}get lineBreak(){return this.facet(xt.lineSeparator)||"\n"}get readOnly(){return this.facet(at)}phrase(t,...e){for(let e of this.facet(xt.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(et))for(let r of s(this,e,i))Object.prototype.hasOwnProperty.call(r,t)&&n.push(r[t]);return n}charCategorizer(t){return yt(this.languageDataAt("wordChars",t).join(""))}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=f(e,r,!1);if(s(e.slice(t,r))!=wt.Word)break;r=t}for(;ot.length?t[0]:4}),xt.lineSeparator=nt,xt.readOnly=at,xt.phrases=E.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]))}}),xt.languageData=et,xt.changeFilter=st,xt.transactionFilter=rt,xt.transactionExtender=ot,F.reconfigure=ut.define();class Qt{eq(t){return this==t}range(t,e=t){return $t.create(t,e,this)}}Qt.prototype.startSide=Qt.prototype.endSide=0,Qt.prototype.point=!1,Qt.prototype.mapMode=y.TrackDel;let $t=class t{constructor(t,e,i){this.from=t,this.to=e,this.value=i}static create(e,i,n){return new t(e,i,n)}};function Pt(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Ct{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,a=s[n]-t||(i?this.value[n].endSide:this.value[n].startSide)-e;if(n==r)return a>=0?r:o;a>=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||l==h&&c.startSide>0&&c.endSide<=0)continue;(h-l||c.endSide-c.startSide)<0||(r<0&&(r=l),c.point&&(o=Math.max(o,h-l)),i.push(c),n.push(l-r),s.push(h-r))}return{mapped:i.length?new Ct(n,s,i,o):null,pos:r}}}class _t{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 _t(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(Pt)),this.isEmpty)return e.length?_t.of(e):this;let o=new At(this,null,-1).goto(0),a=0,l=[],h=new Xt;for(;o.value||a=0){let t=e[a++];h.addInner(t.from,t.to,t.value)||l.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 Tt.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return Tt.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)),a=Zt(r,o,i),l=new Et(r,a,s),h=new Et(o,a,s);i.iterGaps(((t,e,i)=>Vt(l,t,h,e,i,n))),i.empty&&0==i.length&&Vt(l,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=Zt(s,r),a=new Et(s,o,0).goto(i),l=new Et(r,o,0).goto(i);for(;;){if(a.to!=l.to||!Mt(a.active,l.active)||a.point&&(!l.point||!a.point.eq(l.point)))return!1;if(a.to>n)return!0;a.next(),l.next()}}static spans(t,e,i,n,s=-1){let r=new Et(t,null,s).goto(e),o=e,a=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,a),a=r.openEnd(t));if(r.to>i)return a+(r.point&&r.to>i?1:0);o=r.to,r.next()}}static of(t,e=!1){let i=new Xt;for(let n of t instanceof $t?[t]:e?function(t){if(t.length>1)for(let e=t[0],i=1;i0)return t.slice().sort(Pt);e=n}return t}(t):t)i.add(n.from,n.to,n.value);return i.finish()}}_t.empty=new _t([],[],null,-1),_t.empty.nextLayer=_t.empty;class Xt{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}finishChunk(t){this.chunks.push(new Ct(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=[])}add(t,e,i){this.addInner(t,e,i)||(this.nextLayer||(this.nextLayer=new Xt)).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(_t.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;let e=_t.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function Zt(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 At(r,e,i,s));return 1==n.length?n[0]:new Tt(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--)Rt(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--)Rt(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(),Rt(this.heap,0)}}}function Rt(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 Et{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=Tt.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){Dt(this.active,t),Dt(this.activeTo,t),Dt(this.activeRank,t),this.minActive=Ut(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&&Dt(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 Vt(t,e,i,n,s,r){t.goto(e),i.goto(n);let o=n+s,a=n,l=n-e;for(;;){let e=t.to+l-i.to||t.endSide-i.endSide,n=e<0?t.to+l: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))&&Mt(t.activeForPoint(t.to+l),i.activeForPoint(i.to))||r.comparePoint(a,s,t.point,i.point):s>a&&!Mt(t.active,i.active)&&r.compareRange(a,s,t.active,i.active),n>o)break;a=n,e<=0&&t.next(),e>=0&&i.next()}}function Mt(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 Ut(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(!l)throw new RangeError("The value of a property ("+i+") should be a primitive value.");s(n(i),o,a,h)}else null!=o&&a.push(i.replace(/_.*/,"").replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))+": "+o+";")}(a.length||h)&&r.push((!i||l||o?t:t.map(i)).join(", ")+" {"+a.join(" ")+"}")}for(let e in t)s(n(e),t[e],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let t=zt[qt]||1;return zt[qt]=t+1,"ͼ"+t.toString(36)}static mount(t,e){(t[Lt]||new jt(t)).mount(Array.isArray(e)?e:[e])}}let Bt=new Map;class jt{constructor(t){let e=t.ownerDocument||t,i=e.defaultView;if(!t.head&&t.adoptedStyleSheets&&i.CSSStyleSheet){let n=Bt.get(e);if(n)return t.adoptedStyleSheets=[n.sheet,...t.adoptedStyleSheets],t[Lt]=n;this.sheet=new i.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets],Bt.set(e,this)}else{this.styleTag=e.createElement("style");let i=t.head||t;i.insertBefore(this.styleTag,i.firstChild)}this.modules=[],t[Lt]=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:'"'},Ft="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),Ht="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Jt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Kt=Ht||Ft&&+Ft[1]<57,te=0;te<10;te++)Nt[48+te]=Nt[96+te]=String(te);for(te=1;te<=24;te++)Nt[te+111]="F"+te;for(te=65;te<=90;te++)Nt[te]=String.fromCharCode(te+32),Gt[te]=String.fromCharCode(te);for(var ee in Nt)Gt.hasOwnProperty(ee)||(Gt[ee]=Nt[ee]);function ie(t){let e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection()}function ne(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function se(t,e){if(!e.anchorNode)return!1;try{return ne(t,e.anchorNode)}catch(t){return!1}}function re(t){return 3==t.nodeType?me(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function oe(t,e,i,n){return!!i&&(le(t,e,i,n,-1)||le(t,e,i,n,1))}function ae(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function le(t,e,i,n,s){for(;;){if(t==i&&e==n)return!0;if(e==(s<0?0:he(t))){if("DIV"==t.nodeName)return!1;let i=t.parentNode;if(!i||1!=i.nodeType)return!1;e=ae(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?he(t):0}}}function he(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}const ce={left:0,right:0,top:0,bottom:0};function ue(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function de(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}class fe{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){this.set(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset)}set(t,e,i,n){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=n}}let pe,Oe=null;function ge(t){if(t.setActive)return t.setActive();if(Oe)return t.focus(Oe);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==Oe?{get preventScroll(){return Oe={preventScroll:!0},!0}}:void 0),!Oe){Oe=!1;for(let t=0;te)return i.domBoundsAround(t,e,l);if(c>=t&&-1==n&&(n=a,s=l),l>e&&i.dom.parentNode==this.dom){r=a,o=h;break}h=c,l=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.dirty|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.dirty|=2),1&e.dirty)return;e.dirty|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,this.dirty&&this.markParentsDirty(!0))}setDOM(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=Se){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 Qe(t,e,i,n,s,r,o,a,l){let{children:h}=t,c=h.length?h[e]:null,u=r.length?r[r.length-1]:null,d=u?u.breakAfter:o;if(!(e==n&&c&&!o&&!d&&r.length<2&&c.merge(i,s,r.length?u:null,0==i,a,l))){if(n0&&(!o&&r.length&&c.merge(i,c.length,r[0],!1,a,0)?c.breakAfter=r.shift().breakAfter:(i2);var De={mac:Me||/Mac/.test(Pe.platform),windows:/Win/.test(Pe.platform),linux:/Linux|X11/.test(Pe.platform),ie:Ae,ie_version:Xe?Ce.documentMode||6:Ze?+Ze[1]:_e?+_e[1]:0,gecko:Te,gecko_version:Te?+(/Firefox\/(\d+)/.exec(Pe.userAgent)||[0,0])[1]:0,chrome:!!Re,chrome_version:Re?+Re[1]:0,ios:Me,android:/Android\b/.test(Pe.userAgent),webkit:Ee,safari:Ve,webkit_version:Ee?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Ce.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class We extends ye{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(!i||i instanceof We&&!(this.length-(e-t)+i.length>256))&&(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),!0)}split(t){let e=new We(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new ve(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 Ye(this.dom,t,e)}}class Ue extends ye{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(we(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}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.dirty|=6)}sync(t,e){this.dom?4&this.dirty&&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 Ue&&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 Ue(this.mark,e,r)}domAtPos(t){return Ge(this,t)}coordsAt(t,e){return He(this,t,e)}}function Ye(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?De.chrome||De.gecko||(e?(s--,o=1):r=0)?0:a.length-1];return De.safari&&!o&&0==l.width&&(l=Array.prototype.find.call(a,(t=>t.width))||l),o?ue(l,o<0):l||null}class qe extends ye{constructor(t,e,i){super(),this.widget=t,this.length=e,this.side=i,this.prevWidget=null}static create(t,e,i){return new(t.customView||qe)(t,e,i)}split(t){let e=qe.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 qe&&this.widget.compare(i.widget))||t>0&&s<=0||e0)?ve.before(this.dom):ve.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let i=this.dom.getClientRects(),n=null;if(!i.length)return ce;for(let e=t>0?i.length-1:0;n=i[e],!(t>0?0==e:e==i.length-1||n.top0?-1:1);return this.length?n:ue(n,this.side>0)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class Le extends qe{domAtPos(t){let{topView:e,text:i}=this.widget;return e?ze(t,0,e,i,this.length-e.length,((t,e)=>t.domAtPos(e)),((t,e)=>new ve(t,Math.min(e,t.nodeValue.length)))):new ve(i,Math.min(t,i.nodeValue.length))}sync(){this.setDOM(this.widget.toDOM())}localPosFromDOM(t,e){let{topView:i,text:n}=this.widget;return i?Be(t,e,i,n,this.length-i.length):Math.min(e,this.length)}ignoreMutation(){return!1}get overrideDOMText(){return null}coordsAt(t,e){let{topView:i,text:n}=this.widget;return i?ze(t,e,i,n,this.length-i.length,((t,e,i)=>t.coordsAt(e,i)),((t,e,i)=>Ye(t,e,i))):Ye(n,t,e)}destroy(){var t;super.destroy(),null===(t=this.widget.topView)||void 0===t||t.destroy()}get isEditable(){return!0}canReuseDOM(){return!0}}function ze(t,e,i,n,s,r,o){if(i instanceof Ue){for(let a=i.dom.firstChild;a;a=a.nextSibling){let i=ye.get(a);if(i){let l=ne(a,n),h=i.length+(l?s:0);if(t0?ve.before(this.dom):ve.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){let e=this.dom.getBoundingClientRect(),i=function(t,e){let i=t.parent,n=i?i.children.indexOf(t):-1;for(;i&&n>=0;)if(e<0?n>0:n0?-1:1);return i&&i.tope.top?{left:e.left,right:e.right,top:i.top,bottom:i.bottom}:e}get overrideDOMText(){return t.empty}get isHidden(){return!0}}function Ge(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 Ue&&s.length&&(n=s[s.length-1])instanceof Ue&&n.mark.eq(e.mark)?Fe(n,e.children[0],i-1):(s.push(e),e.setParent(t)),t.length+=e.length}function He(t,e,i){let n=null,s=-1,r=null,o=-1;!function t(e,a){for(let l=0,h=0;l=a&&(c.children.length?t(c,a-h):(!r||r instanceof Ne&&i>0)&&(u>a||h==u&&c.getSide()>0)?(r=c,o=a-h):(h0?3e8:-4e8:e>0?1e8:-1e8,new oi(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}=ai(t,n);e=(s?n?-3e8:-1:5e8)-1,i=1+(r?n?2e8:1:-6e8)}return new oi(t,e,i,n,t.widget||null,!0)}static line(t){return new ri(t)}static set(t,e=!1){return _t.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}ni.none=_t.empty;class si extends ni{constructor(t){let{start:e,end:i}=ai(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){return this==t||t instanceof si&&this.tagName==t.tagName&&this.class==t.class&&Ke(this.attrs,t.attrs)}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}si.prototype.point=!1;class ri extends ni{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof ri&&this.spec.class==t.spec.class&&Ke(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)}}ri.prototype.mapMode=y.TrackBefore,ri.prototype.point=!0;class oi extends ni{constructor(t,e,i,n,s,r){super(e,i,s,t),this.block=n,this.isReplace=r,this.mapMode=n?e<=0?y.TrackBefore:y.TrackAfter:y.TrackDel}get type(){return this.startSide=5}eq(t){return t instanceof oi&&(e=this.widget,i=t.widget,e==i||!!(e&&i&&e.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var e,i}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 ai(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 li(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)}oi.prototype.point=!0;class hi extends ye{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 hi))return!1;this.dom||i.transferDOM(this)}return n&&this.setDeco(i?i.attrs:null),$e(this,t,e,i?i.children:[],s,r),!0}split(t){let e=new hi;if(e.breakAfter=this.breakAfter,0==this.length)return e;let{i: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){Ke(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){Fe(this,t,e)}addLineDeco(t){let e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=Je(e,this.attrs||{})),i&&(this.attrs=Je({class:i},this.attrs||{}))}domAtPos(t){return Ge(this,t)}reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.dirty|=6)}sync(t,e){var i;this.dom?4&this.dirty&&(we(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&&(ti(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&&ye.get(n)instanceof Ue;)n=n.lastChild;if(!(n&&this.length&&("BR"==n.nodeName||0!=(null===(i=ye.get(n))||void 0===i?void 0:i.isEditable)||De.ios&&this.children.some((t=>t instanceof We))))){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 We)||/[^ -~]/.test(i.text))return null;let n=re(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=He(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 hi)return s;if(r>e)break}n=r+s.breakAfter}return null}}class ci extends ye{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 ci&&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(di(new We(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 oi){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let o=e-t;if(i instanceof oi)if(i.block){let{type:t}=i;t!=ii.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new ci(i.widget||new fi("div"),o,t))}else{let r=qe.create(i.widget||new fi("span"),o,o?0:i.startSide),a=this.atCursorPos&&!r.isEditable&&s<=n.length&&(t0),l=!r.isEditable&&(tn.length||i.startSide<=0),h=this.getLine();2!=this.pendingBuffer||a||r.isEditable||(this.pendingBuffer=0),this.flushBuffer(n),a&&(h.append(di(new Ne(1),n),s),s=n.length+Math.max(0,s-n.length)),h.append(di(r,n),s),this.atCursorPos=l,this.pendingBuffer=l?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 ui(t,e,i,s);return r.openEnd=_t.spans(n,e,i,r),r.openStart<0&&(r.openStart=r.openEnd),r.finish(r.openEnd),r}}function di(t,e){for(let i of e)t=new Ue(i,[t],t.length);return t}class fi extends ei{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 pi=E.define(),Oi=E.define(),gi=E.define(),mi=E.define(),bi=E.define(),wi=E.define(),vi=E.define(),Si=E.define({combine:t=>t.some((t=>t))}),yi=E.define({combine:t=>t.some((t=>t))});class xi{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 xi(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin)}}const ki=ut.define({map:(t,e)=>t.map(e)});function Qi(t,e,i){let n=t.facet(mi);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 $i=E.define({combine:t=>!t.length||t[0]});let Pi=0;const Ci=E.define();class _i{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 _i(Pi++,t,i,(t=>{let e=[Ci.of(t)];return s&&e.push(Ti.of((e=>{let i=e.plugin(t);return i?s(i):ni.none}))),n&&e.push(n(t)),e}))}static fromClass(t,e){return _i.define((e=>new t(e)),e)}}class Xi{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(Qi(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){Qi(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){Qi(t.state,e,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Zi=E.define(),Ai=E.define(),Ti=E.define(),Ri=E.define(),Ei=E.define(),Vi=E.define();class Mi{constructor(t,e,i,n){this.fromA=t,this.toA=e,this.fromB=i,this.toB=n}join(t){return new Mi(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(!a)return i;new Mi(a.fromA,a.toA,a.fromB,a.toB).addToSet(i),r=a.toA,o=a.toB}}}class Di{constructor(t,e,i){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=k.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 Mi(t,e,i,s)))),this.changedRanges=n}static create(t,e,i){return new Di(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 Wi=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Wi||(Wi={}));const Ui=Wi.LTR,Yi=Wi.RTL;function qi(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}}const Gi=[];function Fi(t){return[new Ni(0,t,0)]}let Hi="";function Ji(t,e,i,n,s){var r;let o=n.head-t.from,a=-1;if(0==o){if(!s||!t.length)return null;e[0].level!=i&&(o=e[0].side(!1,i),a=0)}else if(o==t.length){if(s)return null;let t=e[e.length-1];t.level!=i&&(o=t.side(!0,i),a=e.length-1)}a<0&&(a=Ni.find(e,o,null!==(r=n.bidiLevel)&&void 0!==r?r:-1,n.assoc));let l=e[a];o==l.side(s,i)&&(l=e[a+=s?1:-1],o=l.side(!s,i));let h=s==(l.dir==i),c=f(t.text,o,h);if(Hi=t.text.slice(Math.min(o,c),Math.max(o,c)),c!=l.side(s,i))return A.cursor(c+t.from,h?-1:1,l.level);let u=a==(s?e.length-1:0)?null:e[a+(s?1:-1)];return u||l.level==i?u&&u.level1)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=ye.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 en(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}class nn{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class sn extends ye{constructor(t){super(),this.view=t,this.compositionDeco=ni.none,this.decorations=[],this.dynamicDecorationMap=[],this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(t.contentDOM),this.children=[new hi],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Mi(0,0,0,t.state.doc.length)],0)}get length(){return this.view.state.doc.length}update(t){let e=t.changedRanges;this.minWidth>0&&e.length&&(e.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),this.view.inputState.composing<0?this.compositionDeco=ni.none:(t.transactions.length||this.dirty)&&(this.compositionDeco=function(t,e){let i=on(t);if(!i)return ni.none;let{from:n,to:s,node:r,text:o}=i,a=e.mapPos(n,1),l=Math.max(a,e.mapPos(s,-1)),{state:h}=t,c=3==r.nodeType?r.nodeValue:new tn([],h).readRange(r.firstChild,null).text;if(l-a{this.dom.style.height=this.view.viewState.contentHeight+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let t=De.chrome||De.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,t),this.dirty=0,t&&(t.written||i.selectionRange.focusNode!=t.node)&&(this.forceSelection=!0),this.dom.style.height=""}));let n=[];if(this.view.viewport.from||this.view.viewport.to=0?t[e]:null;if(!n)break;let{fromA:s,toA:r,fromB:o,toB:a}=n,{content:l,breakAtStart:h,openStart:c,openEnd:u}=ui.build(this.view.state.doc,o,a,this.decorations,this.dynamicDecorationMap),{i:d,off:f}=i.findPos(r,1),{i:p,off:O}=i.findPos(s,-1);Qe(this,p,O,d,f,l,h,c,u)}}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&&se(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,a=this.domAtPos(o.anchor),l=o.empty?a:this.domAtPos(o.head);if(De.gecko&&o.empty&&!this.compositionDeco.size&&(1==(h=a).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((()=>a.node.insertBefore(t,a.node.childNodes[a.offset]||null))),a=l=new ve(t,0),r=!0}var h;let c=this.view.observer.selectionRange;!r&&c.focusNode&&oe(a.node,a.offset,c.anchorNode,c.anchorOffset)&&oe(l.node,l.offset,c.focusNode,c.focusOffset)||(this.view.observer.ignore((()=>{De.android&&De.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=ie(this.view.root);if(t)if(o.empty){if(De.gecko){let t=(e=a.node,n=a.offset,1!=e.nodeType?0:(n&&"false"==e.childNodes[n-1].contentEditable?1:0)|(no.head&&([a,l]=[l,a]),e.setEnd(l.node,l.offset),e.setStart(a.node,a.offset),t.removeAllRanges(),t.addRange(e)}else;var e,n;s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())})),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new ve(c.anchorNode,c.anchorOffset),this.impreciseHead=l.precise?null:new ve(c.focusNode,c.focusOffset)}enforceCursorAssoc(){if(this.compositionDeco.size)return;let{view:t}=this,e=t.state.selection.main,i=ie(t.root),{anchorNode:n,anchorOffset:s}=t.observer.selectionRange;if(!(i&&e.empty&&e.assoc&&i.modify))return;let r=hi.find(this,e.head);if(!r)return;let o=r.posAtStart;if(e.head==o||e.head==o+r.length)return;let a=this.coordsAt(e.head,-1),l=this.coordsAt(e.head,1);if(!a||!l||a.bottom>l.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)}nearest(t){for(let e=t;e;){let t=ye.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!=ii.WidgetBefore&&s.type!=ii.WidgetAfter&&(!n||2==e||this.children[n-1].breakAfter||this.children[n-1].type==ii.WidgetBefore&&e>-2))return s.coordsAt(t-r,e);i=r}}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,a=this.view.textDirection==Wi.LTR;for(let t=0,l=0;ln)break;if(t>=i){let i=h.dom.getBoundingClientRect();if(e.push(i.height),r){let e=h.dom.lastChild,n=e?re(e):[];if(n.length){let e=n[n.length-1],r=a?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?Wi.RTL:Wi.LTR}measureTextSize(){for(let t of this.children)if(t instanceof hi){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.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(n);let s=re(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 ke(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;t.push(ni.replace({widget:new rn(n),block:!0,inclusive:!0,isBlockGap:!0}).range(i,r))}if(!s)break;i=s.to+1}return ni.set(t)}updateDeco(){let t=this.view.state.facet(Ti).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=0,r=0,o=0,a=0;for(let t of this.view.state.facet(Ei).map((t=>t(this.view))))if(t){let{left:e,right:i,top:n,bottom:l}=t;null!=e&&(s=Math.max(s,e)),null!=i&&(r=Math.max(r,i)),null!=n&&(o=Math.max(o,n)),null!=l&&(a=Math.max(a,l))}let l={left:n.left-s,top:n.top-o,right:n.right+r,bottom:n.bottom+a};!function(t,e,i,n,s,r,o,a){let l=t.ownerDocument,h=l.defaultView||window;for(let c=t;c;)if(1==c.nodeType){let t,u=c==l.body;if(u)t=de(h);else{if(c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let e=c.getBoundingClientRect();t={left:e.left,right:e.left+c.clientWidth,top:e.top,bottom:e.top+c.clientHeight}}let d=0,f=0;if("nearest"==s)e.top0&&e.bottom>t.bottom+f&&(f=e.bottom-t.bottom+f+o)):e.bottom>t.bottom&&(f=e.bottom-t.bottom+o,i<0&&e.top-f0&&e.right>t.right+d&&(d=e.right-t.right+d+r)):e.right>t.right&&(d=e.right-t.right+r,i<0&&e.left0))break;i=i.childNodes[n-1],n=he(i)}if(i>=0)for(let n=t,s=e;;){if(3==n.nodeType)return n;if(!(1==n.nodeType&&s=0))break;n=n.childNodes[s],s=0}return null}class hn{constructor(){this.changes=[]}compareRange(t,e){li(t,e,this.changes)}comparePoint(t,e){li(t,e,this.changes)}}function cn(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function un(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function dn(t,e){return t.tope.top+1}function fn(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,a,l,h,c,u=!1;for(let d=t.firstChild;d;d=d.nextSibling){let t=re(d);for(let f=0;fg||o==g&&r>O){n=d,s=p,r=O,o=g;let a=g?i0?f0)}0==O?i>p.bottom&&(!h||h.bottomp.top)&&(l=d,c=p):h&&dn(h,p)?h=pn(h,p.bottom):c&&dn(c,p)&&(c=fn(c,p.top))}}if(h&&h.bottom>=i?(n=a,s=h):c&&c.top<=i&&(n=l,s=c),!n)return{node:t,offset:0};let d=Math.max(s.left,Math.min(s.right,e));return 3==n.nodeType?gn(n,d,i):u&&"false"!=n.contentEditable?On(n,d,i):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,n)+(e>=(s.left+s.right)/2?1:0)}}function gn(t,e,i){let n=t.nodeValue.length,s=-1,r=1e9,o=0;for(let a=0;ai?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(De.chrome||De.gecko){me(t,a).getBoundingClientRect().left==h.right&&(n=!i)}if(c<=0)return{node:t,offset:a+(n?1:0)};s=a+(n?1:0),r=c}}}return{node:t,offset:s>-1?s:o>0?t.nodeValue.length:0}}function mn(t,e,i,n=-1){var s,r;let o,a=t.contentDOM.getBoundingClientRect(),l=a.top+t.viewState.paddingTop,{docHeight:h}=t.viewState,{x:c,y:u}=e,d=u-l;if(d<0)return 0;if(d>h)return t.state.doc.length;for(let e=t.defaultLineHeight/2,s=!1;o=t.elementAtHeight(d),o.type!=ii.Text;)for(;d=n>0?o.bottom+e:o.top-e,!(d>=0&&d<=h);){if(s)return i?null:0;s=!0,n=-n}u=l+d;let f=o.from;if(ft.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:bn(t,a,o,c,u);let p=t.dom.ownerDocument,O=t.root.elementFromPoint?t.root:p,g=O.elementFromPoint(c,u);g&&!t.contentDOM.contains(g)&&(g=null),g||(c=Math.max(a.left+1,Math.min(a.right-1,c)),g=O.elementFromPoint(c,u),g&&!t.contentDOM.contains(g)&&(g=null));let m,b=-1;if(g&&0!=(null===(s=t.docView.nearest(g))||void 0===s?void 0:s.isEditable))if(p.caretPositionFromPoint){let t=p.caretPositionFromPoint(c,u);t&&({offsetNode:m,offset:b}=t)}else if(p.caretRangeFromPoint){let e=p.caretRangeFromPoint(c,u);e&&(({startContainer:m,startOffset:b}=e),(!t.contentDOM.contains(m)||De.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 me(t,n-1,n).getBoundingClientRect().left>i}(m,b,c)||De.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}let n=1==t.nodeType?t.getBoundingClientRect():me(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return i-n.left>5}(m,b,c))&&(m=void 0))}if(!m||!t.docView.dom.contains(m)){let e=hi.find(t.docView,f);if(!e)return d>o.top+o.height/2?o.to:o.from;({node:m,offset:b}=On(e.dom,c,u))}let w=t.docView.nearest(m);if(!w)return null;if(w.isWidget&&1==(null===(r=w.dom)||void 0===r?void 0:r.nodeType)){let t=w.dom.getBoundingClientRect();return e.y1.5*t.defaultLineHeight){r+=Math.floor((s-i.top)/t.defaultLineHeight)*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=f(t,n)}return!0===n?-1:t.length}(o,r,t.state.tabSize)}function wn(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=t.bidiSpans(s),o=t.textDirectionAt(s.from);for(let a=e,l=null;;){let e=Ji(s,r,o,a,i),h=Hi;if(!e){if(s.number==(i?t.state.doc.lines:1))return a;h="\n",s=t.state.doc.line(s.number+(i?1:-1)),r=t.bidiSpans(s),e=A.cursor(i?s.from:s.to)}if(l){if(!l(h))return a}else{if(!n)return e;l=n(h)}a=e}}function vn(t,e,i,n){let s=t.state.facet(Ri).map((e=>e(t)));for(;;){let t=!1;for(let r of s)r.between(i.from-1,i.from+1,((s,r,o)=>{i.from>s&&i.fromi.from?A.cursor(s,1):A.cursor(r,-1),t=!0,o.widget.skipPosition&&(i=o.widget.skipPosition(i,e,n)))}));if(!t)return i}}class Sn{constructor(t){this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null;let e=(e,i)=>{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 Cn){let n=Cn[i];t.contentDOM.addEventListener(i,(i=>{Pn(t,i)&&e(n,i)}),_n[i]),this.registeredEvents.push(i)}t.scrollDOM.addEventListener("mousedown",(i=>{if(i.target==t.scrollDOM&&i.clientY>t.contentDOM.getBoundingClientRect().bottom&&(e(Cn.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)}})),De.chrome&&102==De.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,De.safari&&t.contentDOM.addEventListener("input",(()=>null))}setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}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=>{Pn(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){Qi(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){Qi(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||xn.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,be(t.contentDOM,e.key,e.keyCode))}ignoreDuringComposition(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(De.safari&&!De.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 yn=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],xn="dthko",kn=[16,17,18,20,91,92,224,225];function Qn(t){return.7*Math.max(0,t)+8}class $n{constructor(t,e,i,n){this.view=t,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);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(xt.allowMultipleSelections)&&function(t,e){let i=t.state.facet(pi);return i.length?i[0](e):(De.mac,e.altKey)}(t,e),this.dragMove=function(t,e){let i=t.state.facet(Oi);return i.length?i[0](e):De.mac?!e.altKey:!e.ctrlKey}(t,e),this.dragging=!(!function(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let n=ie(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!=Yn(e))&&null}start(t){!1===this.dragging&&(t.preventDefault(),this.select(t))}move(t){var e;if(0==t.buttons)return this.destroy();if(!1!==this.dragging)return;this.select(this.lastEvent=t);let i=0,n=0,s=(null===(e=this.scrollParent)||void 0===e?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight};t.clientX<=s.left+6?i=-Qn(s.left-t.clientX):t.clientX>=s.right-6&&(i=Qn(t.clientX-s.right)),t.clientY<=s.top+6?n=-Qn(s.top-t.clientY):t.clientY>=s.bottom-6&&(n=Qn(t.clientY-s.bottom)),this.setScrollSpeed(i,n)}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)}select(t){let e=this.style.get(t,this.extend,this.multiple);!this.mustSelect&&e.eq(this.view.state.selection)&&e.main.assoc==this.view.state.selection.main.assoc||this.view.dispatch({selection:e,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.docChanged&&this.dragging&&(this.dragging=this.dragging.map(t.changes)),this.style.update(t)&&setTimeout((()=>this.select(this.lastEvent)),20)}}function Pn(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=ye.get(n))&&i.ignoreEvent(e))return!1;return!0}const Cn=Object.create(null),_n=Object.create(null),Xn=De.ie&&De.ie_version<15||De.ios&&De.webkit_version<604;function Zn(t,e){let i,{state:n}=t,s=1,r=n.toText(e),o=r.lines==n.selection.ranges.length;if(null!=Ln&&n.selection.ranges.every((t=>t.empty))&&Ln==r.toString()){let t=-1;i=n.changeByRange((i=>{let a=n.doc.lineAt(i.from);if(a.from==t)return{range:i};t=a.from;let l=n.toText((o?r.line(s++).text:e)+n.lineBreak);return{changes:{from:a.from,insert:l},range:A.cursor(i.from+l.length)}}))}else i=o?n.changeByRange((t=>{let e=r.line(s++);return{changes:{from:t.from,to:t.to,insert:e.text},range:A.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 A.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 A.cursor(e);0==r?i=1:r==s.length&&(i=-1);let o=r,a=r;i<0?o=f(s.text,r,!1):a=f(s.text,r);let l=n(s.text.slice(o,a));for(;o>0;){let t=f(s.text,o,!1);if(n(s.text.slice(t,o))!=l)break;o=t}for(;a{t.inputState.setSelectionOrigin("select"),27==e.keyCode&&(t.inputState.lastEscPress=Date.now())},Cn.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},Cn.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},_n.touchstart=_n.touchmove={passive:!0},Cn.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return;let i=null;for(let n of t.state.facet(gi))if(i=n(t,e),i)break;if(i||0!=e.button||(i=function(t,e){let i=Vn(t,e),n=Yn(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 a,l=Vn(t,e),h=An(t,l.pos,l.bias,n);if(i.pos!=l.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&&(a=function(t,e){for(let i=0;i=e)return A.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,l.pos))?a:o?s.addRange(h):A.create([h])}}}(t,e)),i){let n=t.root.activeElement!=t.contentDOM;t.inputState.startMouseSelection(new $n(t,e,i,n)),n&&t.observer.ignore((()=>ge(t.contentDOM))),t.inputState.mouseSelection&&t.inputState.mouseSelection.start(e)}};let Tn=(t,e)=>t>=e.top&&t<=e.bottom,Rn=(t,e,i)=>Tn(e,i)&&t>=i.left&&t<=i.right;function En(t,e,i,n){let s=hi.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&&Rn(i,n,o))return-1;let a=s.coordsAt(r,1);return a&&Rn(i,n,a)?1:o&&Tn(n,o)?-1:1}function Vn(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:En(t,i,e.clientX,e.clientY)}}const Mn=De.ie&&De.ie_version<=11;let Dn=null,Wn=0,Un=0;function Yn(t){if(!Mn)return t.detail;let e=Dn,i=Un;return Dn=t,Un=Date.now(),Wn=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Wn+1)%3:1}function qn(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&&r.dragMove?{from:r.dragging.from,to:r.dragging.to}:null,a={from:s,insert:i},l=t.state.changes(o?[o,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(s,-1),head:l.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"})}Cn.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")},Cn.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&&qn(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 qn(t,e,e.dataTransfer.getData("Text"),!0)},Cn.paste=(t,e)=>{if(t.state.readOnly)return e.preventDefault();t.observer.flush();let i=Xn?null:e.clipboardData;i?(Zn(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(),Zn(t,i.value)}),50)}(t)};let Ln=null;Cn.copy=Cn.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;Ln=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 zn=lt.define();function In(t,e){let i=[];for(let n of t.facet(vi)){let s=n(t,e);s&&i.push(s)}return i?t.update({effects:i,annotations:zn.of(!0)}):null}function Bn(t){setTimeout((()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=In(t.state,e);i?t.dispatch(i):t.update([])}}),10)}Cn.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),Bn(t)},Cn.blur=t=>{t.observer.clearSelectionRange(),Bn(t)},Cn.compositionstart=Cn.compositionupdate=t=>{null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},Cn.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,De.chrome&&De.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then((()=>t.observer.flush())):setTimeout((()=>{t.inputState.composing<0&&t.docView.compositionDeco.size&&t.update([])}),50)},Cn.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},Cn.beforeinput=(t,e)=>{var i;let n;if(De.chrome&&De.android&&(n=yn.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 jn=["pre-wrap","normal","pre-line","break-spaces"];class Nn{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){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return jn.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i-1,a=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,a){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)>Jn&&(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:a,toA:l,fromB:h,toB:c}=n[o],u=s.lineAt(a,Hn.ByPosNoHeight,i.setDoc(e),0,0),d=u.to>=l?u:s.lineAt(l,Hn.ByPosNoHeight,i,0,0);for(c+=d.to-l,l=d.to;o>0&&u.from<=n[o-1].toA;)a=n[o-1].fromA,h=n[o-1].fromB,o--,a2*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 es extends ts{constructor(t,e){super(t,e,ii.Text),this.collapsed=0,this.widgetHeight=0}replace(t,e,i){let n=i[0];return 1==i.length&&(n instanceof es||n instanceof is&&4&n.flags)&&Math.abs(this.length-n.length)<10?(n instanceof is?n=new es(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.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class is 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:a}=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),l=o+r.length*a,h=Math.max(i,t-l/2);return new Fn(r.from,r.length,h,l,ii.Text)}{let n=Math.max(0,Math.min(r-s,Math.floor((t-i)/o))),{from:a,length:l}=e.doc.line(s+n);return new Fn(a,l,i+o*n,o,ii.Text)}}lineAt(t,e,i,n,s){if(e==Hn.ByHeight)return this.blockAt(t,i,n,s);if(e==Hn.ByPosNoHeight){let{from:e,to:n}=i.doc.lineAt(t);return new Fn(e,n-e,0,0,ii.Text)}let{firstLine:r,perLine:o,perChar:a}=this.heightMetrics(i,s),l=i.doc.lineAt(t),h=o+l.length*a,c=l.number-r,u=n+o*c+a*(l.from-s-c);return new Fn(l.from,l.length,Math.max(n,Math.min(u,n+this.height-h)),h,ii.Text)}forEachLine(t,e,i,n,s,r){t=Math.max(t,s),e=Math.min(e,s+this.length);let{firstLine:o,perLine:a,perChar:l}=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+=a*i+l*(t-s-i)}let n=a+l*e.length;r(new Fn(e.from,e.length,c,n,ii.Text)),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 is?i[i.length-1]=new is(t.length+n):i.push(null,new is(n-1))}if(t>0){let e=i[0];e instanceof is?i[0]=new is(t+e.length):i.unshift(new is(t-1),null)}return Kn.of(i)}decomposeLeft(t,e){e.push(new is(t-1),null)}decomposeRight(t,e){e.push(null,new is(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 is(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)>=Jn&&(o=-2);let a=new es(e,s);a.outdated=!1,i.push(a),r+=e+1}r<=s&&i.push(null,new is(s-r).updateHeight(t,r));let a=Kn.of(i);return(o<0||Math.abs(a.height-this.height)>=Jn||Math.abs(o-this.heightMetrics(t,e).perLine)>=Jn)&&(t.heightChanged=!0),a}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class ns 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 l;let h=e==Hn.ByPosNoHeight?Hn.ByPosNoHeight:Hn.ByPos;return a?l.join(this.right.lineAt(o,h,i,r,o)):this.left.lineAt(o,h,i,n,s).join(l)}forEachLine(t,e,i,n,s,r){let o=n+this.left.height,a=s+this.left.length+this.break;if(this.break)t=a&&this.right.forEachLine(t,e,i,o,a,r);else{let l=this.lineAt(a,Hn.ByPos,i,n,s);t=t&&l.from<=e&&r(l),e>l.to&&this.right.forEachLine(l.to+1,e,i,o,a,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&&ss(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,a=null;return n&&n.from<=e+s.length&&n.more?a=s=s.updateHeight(t,e,i,n):s.updateHeight(t,e,i),n&&n.from<=o+r.length&&n.more?a=r=r.updateHeight(t,o,i,n):r.updateHeight(t,o,i),a?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 ss(t,e){let i,n;null==t[e]&&(i=t[e-1])instanceof is&&(n=t[e+1])instanceof is&&t.splice(e-1,3,new is(i.length+1+n.length))}class rs{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 es?i.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new es(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)}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 es(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let i=new is(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 es)return t;let e=new es(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine(),t.type!=ii.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,t.type!=ii.WidgetBefore&&(this.covering=t)}addLineDeco(t,e){let i=this.ensureLine();i.length+=e,i.collapsed+=e,i.widgetHeight=Math.max(i.widgetHeight,t),this.writtenTo=this.pos=this.pos+e}finish(t){let e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof es||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),a=Math.max(a,n.top),l=e==t.parentNode?n.bottom:Math.min(l,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:a-(i.top+e),bottom:Math.max(a,l)-(i.top+e)}}function ls(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class hs{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 Nn(i),this.stateDeco=e.facet(Ti).filter((t=>"function"!=typeof t)),this.heightMap=Kn.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle.setDoc(e.doc),[new Mi(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ni.set(this.lineGaps.map((t=>t.draw(!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 ds(e,i))}}this.viewports=t.sort(((t,e)=>t.from-e.from)),this.scaler=this.heightMap.height<=7e6?gs:new ms(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:bs(t,this.scaler))}))}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=this.state.facet(Ti).filter((t=>"function"!=typeof t));let n=t.changedRanges,s=Mi.extendWithRanges(n,function(t,e,i){let n=new os;return _t.compare(t,e,i,n,0),n.changes}(i,this.stateDeco,t?t.changes:k.empty(this.state.doc.length))),r=this.heightMap.height;this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),s),this.heightMap.height!=r&&(t.flags|=2);let o=s.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.heado.to)||!this.viewportIsAppropriate(o))&&(o=this.getViewport(0,e));let a=!t.changes.empty||2&t.flags||o.from!=this.viewport.from||o.to!=this.viewport.to;this.viewport=o,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(yi)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let i=e.contentDOM,n=window.getComputedStyle(i),s=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Wi.RTL:Wi.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),a=i.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let h=0,c=0,u=parseInt(n.paddingTop)||0,d=parseInt(n.paddingBottom)||0;this.paddingTop==u&&this.paddingBottom==d||(this.paddingTop=u,this.paddingBottom=d,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let f=(this.printing?ls:as)(i,this.paddingTop),p=f.top-this.pixelViewport.top,O=f.bottom-this.pixelViewport.bottom;this.pixelViewport=f;let g=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(g!=this.inView&&(this.inView=g,g&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let m=a.width;if(this.contentDOMWidth==m&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,h|=8),l){let i=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(i)&&(o=!0),o||s.lineWrapping&&Math.abs(m-this.contentDOMWidth)>s.charWidth){let{lineHeight:t,charWidth:n,textHeight:a}=e.docView.measureTextSize();o=t>0&&s.refresh(r,t,n,a,m/n,i),o&&(e.docView.minWidth=0,h|=8)}p>0&&O>0?c=Math.max(p,O):p<0&&O<0&&(c=Math.min(p,O)),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 Mi(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new Gn(n.from,r))}s.heightChanged&&(h|=2)}let b=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return b&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(2&h||b)&&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,a=new ds(n.lineAt(r-1e3*i,Hn.ByHeight,s,0,0).from,n.lineAt(o+1e3*(1-i),Hn.ByHeight,s,0,0).to);if(e){let{head:t}=e.range;if(ta.to){let i,r=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=n.lineAt(t,Hn.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!=Wi.LTR&&!i)return[];let o=[],a=(n,r,l,h)=>{if(r-nn&&tt.from>=l.from&&t.to<=l.to&&Math.abs(t.from-n)t.frome))));if(!d){if(rt.from<=r&&t.to>=r))){let t=e.moveToLineBoundary(A.cursor(r),!1,!0).head;t>n&&(r=t)}d=new hs(n,r,this.gapSize(l,n,r,h))}o.push(d)};for(let t of this.viewportLines){if(t.lengtht.from&&a(t.from,s,t,e),ot.draw(this.heightOracle.lineWrapping)))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];_t.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))||bs(this.heightMap.lineAt(t,Hn.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return bs(this.heightMap.lineAt(this.scaler.fromDOM(t),Hn.ByHeight,this.heightOracle,0,0),this.scaler)}elementAtHeight(t){return bs(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 ds{constructor(t,e){this.from=t,this.to=e}}function fs(t,e,i){let n=[],s=t,r=0;return _t.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 Os(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 gs={toDOM:t=>t,fromDOM:t=>t,scale:1};class ms{constructor(t,e,i){let n=0,s=0,r=0;this.viewports=i.map((({from:i,to:s})=>{let r=e.lineAt(i,Hn.ByPos,t,0,0).top,o=e.lineAt(s,Hn.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=ebs(t,e))):t.type)}const ws=E.define({combine:t=>t.join(" ")}),vs=E.define({combine:t=>t.indexOf(!0)>-1}),Ss=It.newName(),ys=It.newName(),xs=It.newName(),ks={"&light":"."+ys,"&dark":"."+xs};function Qs(t,e,i){return new It(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 $s=Qs("."+Ss,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",borderRadius:"4px",marginTop:"0.5rem",width:"30%",minWidth:"190px",marginLeft:"auto",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&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:"#333338",fontSize:"70%",padding:".2em 1em",borderRadius:"4px"},"&light .cm-button":{background:"#eee"},"&dark .cm-button":{background:"#eee"},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",borderRadius:"0.25rem",border:"1px solid silver",padding:".0em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},ks);class Ps{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;i&&(e.push(new nn(i,n)),s==i&&r==n||e.push(new nn(s,r)));return e}(t),i=new tn(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?A.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||!ne(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||!ne(t.contentDOM,e.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(e.anchorNode,e.anchorOffset);this.newSel=A.single(n,i)}}}function Cs(e,i){let n,{newSel:s}=i,r=e.state.selection.main;if(i.bounds){let{from:s,to:o}=i.bounds,a=r.from,l=null;(8===e.inputState.lastKeyCode&&e.inputState.lastKeyTime>Date.now()-100||De.android&&i.text.length0&&a>0&&t.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if("end"==n){i-=o+Math.max(0,r-Math.min(o,a))-r}if(o=o?r-i:0,a=r+(a-o),o=r}else if(a=a?r-i:0,o=r+(o-a),a=r}return{from:r,toA:o,toB:a}}(e.state.doc.sliceString(s,o,Ki),i.text,a-s,l);h&&(De.chrome&&13==e.inputState.lastKeyCode&&h.toB==h.from+2&&i.text.slice(h.from,h.toB)==Ki+Ki&&h.toB--,n={from:s+h.from,to:s+h.toA,insert:t.of(i.text.slice(h.from,h.toB).split(Ki))})}else s&&(!e.hasFocus&&e.state.facet($i)||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))}:(De.mac||De.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=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}):De.chrome&&n&&n.from==n.to&&n.from==r.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(s&&(s=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}),n){let t=e.state;if(De.ios&&e.inputState.flushIOSKey(e))return!0;if(De.android&&(n.from==r.from&&n.to==r.to&&1==n.insert.length&&2==n.insert.lines&&be(e.contentDOM,"Enter",13)||n.from==r.from-1&&n.to==r.to&&0==n.insert.length&&be(e.contentDOM,"Backspace",8)||n.from==r.from&&n.to==r.to+1&&0==n.insert.length&&be(e.contentDOM,"Delete",46)))return!0;let i,o=n.insert.toString();if(e.state.facet(wi).some((t=>t(e,n.from,n.to,o))))return!0;if(e.inputState.composing>=0&&e.inputState.composing++,n.from>=r.from&&n.to<=r.to&&n.to-n.from>=(r.to-r.from)/3&&(!s||s.main.empty&&s.main.from==n.from+n.insert.length)&&e.inputState.composing<0){let s=r.fromn.to?t.sliceDoc(n.to,r.to):"";i=t.replaceSelection(e.state.toText(s+n.insert.sliceString(0,void 0,e.state.lineBreak)+o))}else{let o=t.changes(n),a=s&&s.main.to<=o.newLength?s.main:void 0;if(t.selection.ranges.length>1&&e.inputState.composing>=0&&n.to<=r.to&&n.to>=r.to-10){let s=e.state.sliceDoc(n.from,n.to),l=on(e)||e.state.doc.lineAt(r.head),h=r.to-n.to,c=r.to-r.from;i=t.changeByRange((i=>{if(i.from==r.from&&i.to==r.to)return{changes:o,range:a||i.map(o)};let u=i.to-h,d=u-s.length;if(i.to-i.from!=c||e.state.sliceDoc(d,u)!=s||l&&i.to>=l.from&&i.from<=l.to)return{range:i};let f=t.changes({from:d,to:u,insert:n.insert}),p=i.to-r.to;return{changes:f,range:a?A.range(Math.max(0,a.anchor+p),Math.max(0,a.head+p)):i.map(f)}}))}else i={changes:o,selection:a&&t.selection.replaceRange(a)}}let a="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,a+=".compose",e.inputState.compositionFirstChange&&(a+=".start",e.inputState.compositionFirstChange=!1)),e.dispatch(i,{scrollIntoView:!0,userEvent:a}),!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 _s={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Xs=De.ie&&De.ie_version<=11;class Zs{constructor(t){this.view=t,this.active=!1,this.selectionRange=new fe,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);(De.ie&&De.ie_version<=11||De.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()})),Xs&&(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")))}),{}),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($i)?i.root.activeElement!=this.dom:!se(i.dom,n))return;let s=n.anchorNode&&i.docView.nearest(n.anchorNode);s&&s.ignoreEvent(t)?e||(this.selectionChanged=!1):(De.ie&&De.ie_version<=11||De.android&&De.chrome)&&!i.state.selection.main.empty&&n.focusNode&&oe(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=De.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,a=t.docView.domAtPos(t.state.selection.main.anchor);oe(a.node,a.offset,r,o)&&([n,s,r,o]=[r,o,n,s]);return{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:o}}(this.view)||ie(t.root);if(!e||this.selectionRange.eq(e))return!1;let i=se(this.dom,e);return i&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let t=this.delayedAndroidKey;t&&(this.clearDelayedAndroidKey(),!this.flush()&&t.force&&be(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&&se(this.dom,this.selectionRange);return t<0&&!n?null:(t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new Ps(this.view,t,e,i))}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=Cs(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.dirty|=4),"childList"==t.type){let i=As(e,t.previousSibling||t.target.previousSibling,-1),n=As(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 As(t,e,i){for(;e;){let n=ye.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 Ts{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),this._dispatch=t.dispatch||(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 us(t.state||xt.create(t)),this.plugins=this.state.facet(Ci).map((t=>new Xi(t)));for(let t of this.plugins)t.update(this);this.observer=new Zs(this),this.inputState=new Sn(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new sn(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),t.parent&&t.parent.appendChild(this.dom)}get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}dispatch(...t){this._dispatch(1==t.length&&t[0]instanceof dt?t[0]:this.state.update(...t))}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,a=null;t.some((t=>t.annotation(zn)))?(this.inputState.notifiedFocused=r,o=1):r!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=r,a=In(s,r),a||(o=1));let l=this.observer.delayedAndroidKey,h=null;if(l?(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(xt.phrases)!=this.state.facet(xt.phrases))return this.setState(s);e=Di.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 xi(t.empty?t:A.cursor(t.head,t.head>t.anchor?-1:1))}for(let t of e.effects)t.is(ki)&&(c=t.value)}this.viewState.update(e,c),this.bidiCache=Vs.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),i=this.docView.update(e),this.state.facet(Vi)!=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(ws)!=e.state.facet(ws)&&(this.viewState.mustMeasureContent=!0),(i||n||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!e.empty)for(let t of this.state.facet(bi))t(e);(a||h)&&Promise.resolve().then((()=>{a&&this.state==a.startState&&this.dispatch(a),h&&!Cs(this,h)&&l.force&&be(this.contentDOM,l.key,l.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 us(t),this.plugins=t.facet(Ci).map((t=>new Xi(t))),this.pluginMap.clear();for(let t of this.plugins)t.update(this);this.docView=new sn(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(Ci),i=t.state.facet(Ci);if(e!=i){let n=[];for(let s of i){let i=e.indexOf(s);if(i<0)n.push(new Xi(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.measureScheduled=0,t&&this.observer.forceFlush();let e=null,{scrollHeight:i,scrollTop:n,clientHeight:s}=this.scrollDOM,r=n>i-s-4?i:n;try{for(let t=0;;t++){this.updateState=1;let i=this.viewport,n=this.viewState.lineBlockAtHeight(r),s=this.viewState.measure(this);if(!s&&!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 o=[];4&s||([this.measureRequests,o]=[o,this.measureRequests]);let a=o.map((t=>{try{return t.read(this)}catch(t){return Qi(this.state,t),Es}})),l=Di.create(this,this.state,[]),h=!1,c=!1;l.flags|=s,e?e.flags|=s:e=l,this.updateState=2,l.empty||(this.updatePlugins(l),this.inputState.update(l),this.updateAttrs(),h=this.docView.update(l));for(let t=0;t1||t<-1)&&(this.scrollDOM.scrollTop+=t,c=!0)}if(h&&this.docView.updateSelection(!0),this.viewport.from==i.from&&this.viewport.to==i.to&&!c&&0==this.measureRequests.length)break}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let t of this.state.facet(bi))t(e)}get themeClasses(){return Ss+" "+(this.state.facet(vs)?xs:ys)+" "+this.state.facet(ws)}updateAttrs(){let t=Ms(this,Zi,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet($i)?"true":"false",class:"cm-content",style:`${De.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Ms(this,Ai,e);let i=this.observer.ignore((()=>{let i=ti(this.contentDOM,this.contentAttrs,e),n=ti(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)if(t.is(Ts.announce)){e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(Vi),It.mount(this.root,this.styleModules.concat($s).reverse())}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}}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 vn(this,t,wn(this,t,e,i))}moveByCharSelected(t,e,i){return vn(this,t,wn(this,t,e,i),!0)}moveByGroup(t,e){return vn(this,t,wn(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==wt.Space&&(s=e),s==e}}(this,t.head,e))))}moveToLineBoundary(t,e,i=!0){return function(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=n&&t.lineWrapping?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==Wi.LTR)?e.right-1:e.left+1,y:(r.top+r.bottom)/2});if(null!=o)return A.cursor(o,i?-1:1)}let o=hi.find(t.docView,e.head),a=o?i?o.posAtEnd:o.posAtStart:i?s.to:s.from;return A.cursor(a,i?-1:1)}(this,t,e,i)}moveVertically(t,e,i){return vn(this,t,function(t,e,i,n){let s=e.head,r=i?1:-1;if(s==(i?t.state.doc.length:0))return A.cursor(s,e.assoc);let o,a=e.goalColumn,l=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s),c=t.documentTop;if(h)null==a&&(a=h.left-l.left),o=r<0?h.top:h.bottom;else{let e=t.viewState.lineBlockAt(s);null==a&&(a=Math.min(l.right-l.left,t.defaultCharacterWidth*(s-e.from))),o=(r<0?e.top:e.bottom)+c}let u=l.left+a,d=null!=n?n:t.defaultLineHeight>>1;for(let i=0;;i+=10){let n=o+(d+i)*r,h=mn(t,{x:u,y:n},!1,r);if(nl.bottom||(r<0?hs))return A.cursor(h,e.assoc,void 0,a)}}(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(),mn(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 ue(i,s[Ni.find(s,t-n.from,-1,e)].dir==Wi.LTR==e>0)}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(Si)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Rs)return Fi(t.length);let e=this.textDirectionAt(t.from);for(let i of this.bidiCache)if(i.from==t.from&&i.dir==e)return i.order;let i=function(t,e){let i=t.length,n=e==Ui?1:2,s=e==Ui?2:1;if(!t||1==n&&!ji.test(t))return Fi(i);for(let e=0,s=n,o=n;e=0;t-=3)if(Bi[t+1]==-r){let e=Bi[t+2],i=2&e?n:4&e?1&e?s:n:0;i&&(Gi[a]=Gi[Bi[t]]=i),l=t;break}}else{if(189==Bi.length)break;Bi[l++]=a,Bi[l++]=e,Bi[l++]=h}else if(2==(o=Gi[a])||1==o){let t=o==n;h=t?0:1;for(let e=l-3;e>=0;e-=3){let i=Bi[e+2];if(2&i)break;if(t)Bi[e+2]|=2;else{if(4&i)break;Bi[e+2]|=4}}}for(let t=0;te;){let t=i,n=2!=Gi[--i];for(;i>e&&n==(2!=Gi[i-1]);)i--;o.push(new Ni(i,t,n?2:1))}else o.push(new Ni(e,t,0))}else for(let t=0;tDate.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{ge(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 ki.of(new xi("number"==typeof t?A.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}static domEventHandlers(t){return _i.define((()=>({})),{eventHandlers:t})}static theme(t,e){let i=It.newName(),n=[ws.of(i),Vi.of(Qs(`.${i}`,t))];return e&&e.dark&&n.push(vs.of(!0)),n}static baseTheme(t){return N.lowest(Vi.of(Qs("."+Ss,t,ks)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),n=i&&ye.get(i)||ye.get(t);return(null===(e=null==n?void 0:n.rootView)||void 0===e?void 0:e.view)||null}}Ts.styleModule=Vi,Ts.inputHandler=wi,Ts.focusChangeEffect=vi,Ts.perLineTextDirection=Si,Ts.exceptionSink=mi,Ts.updateListener=bi,Ts.editable=$i,Ts.mouseSelectionStyle=gi,Ts.dragMovesSelection=Oi,Ts.clickAddsSelectionRange=pi,Ts.decorations=Ti,Ts.atomicRanges=Ri,Ts.scrollMargins=Ei,Ts.darkTheme=vs,Ts.contentAttributes=Ai,Ts.editorAttributes=Zi,Ts.lineWrapping=Ts.contentAttributes.of({class:"cm-lineWrapping"}),Ts.announce=ut.define();const Rs=4096,Es={};class Vs{constructor(t,e,i,n){this.from=t,this.to=e,this.dir=i,this.order=n}static update(t,e){if(e.empty)return t;let i=[],n=t.length?t[t.length-1].dir:Wi.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&&Je(r,i)}return i}const Ds=De.mac?"mac":De.windows?"win":De.linux?"linux":"key";function Ws(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 Us=N.default(Ts.domEventHandlers({keydown:(t,e)=>Bs(Ls(e.state),t,e,"editor")})),Ys=E.define({enables:Us}),qs=new WeakMap;function Ls(t){let e=t.facet(Ys),i=qs.get(e);return i||qs.set(e,i=function(t,e=Ds){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)=>{var a,l;let h=i[t]||(i[t]=Object.create(null)),c=n.split(/ (?!$)/).map((t=>function(t,e){const i=t.split(/-(?!$)/);let n,s,r,o,a=i[i.length-1];"Space"==a&&(a=" ");for(let t=0;t{let n=zs={view:e,prefix:i,scope:t};return setTimeout((()=>{zs==n&&(zs=null)}),Is),!0}]})}let u=c.join(" ");s(u,!1);let d=h[u]||(h[u]={preventDefault:!1,run:(null===(l=null===(a=h._any)||void 0===a?void 0:a.run)||void 0===l?void 0:l.slice())||[]});r&&d.run.push(r),o&&(d.preventDefault=!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,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.shift&&r(e,"Shift-"+s,n.shift,n.preventDefault)}return i}(e.reduce(((t,e)=>t.concat(e)),[]))),i}let zs=null;const Is=4e3;function Bs(t,e,i,n){let s=function(t){var e=!(Kt&&(t.ctrlKey||t.altKey||t.metaKey)||Jt&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?Gt:Nt)[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=v(b(s,0))==s.length&&" "!=s,o="",a=!1;zs&&zs.view==i&&zs.scope==n&&(o=zs.prefix+" ",(a=kn.indexOf(e.keyCode)<0)&&(zs=null));let l,h,c=new Set,u=t=>{if(t){for(let n of t.run)if(!c.has(n)&&(c.add(n),n(i,e)))return!0;t.preventDefault&&(a=!0)}return!1},d=t[n];if(d){if(u(d[o+Ws(s,e,!r)]))return!0;if(r&&(e.altKey||e.metaKey||e.ctrlKey)&&!(De.windows&&e.ctrlKey&&e.altKey)&&(l=Nt[e.keyCode])&&l!=s){if(u(d[o+Ws(l,e,!0)]))return!0;if(e.shiftKey&&(h=Gt[e.keyCode])!=s&&h!=l&&u(d[o+Ws(h,e,!1)]))return!0}else if(r&&e.shiftKey&&u(d[o+Ws(s,e,!0)]))return!0;if(u(d._any))return!0}return a}class js{constructor(t,e,i,n,s){this.className=t,this.left=e,this.top=i,this.width=n,this.height=s}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className==this.className&&(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",null!=this.width&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,i){if(i.empty){let n=t.coordsAtPos(i.head,i.assoc||1);if(!n)return[];let s=Ns(t);return[new js(e,n.left-s.left,n.top-s.top,null,n.bottom-n.top)]}return function(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];let n=Math.max(i.from,t.viewport.from),s=Math.min(i.to,t.viewport.to),r=t.textDirection==Wi.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=Ns(t),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),u=a.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),d=a.right-(c?parseInt(c.paddingRight):0),f=Fs(t,n),p=Fs(t,s),O=f.type==ii.Text?f:null,g=p.type==ii.Text?p:null;t.lineWrapping&&(O&&(O=Gs(t,n,O)),g&&(g=Gs(t,s,g)));if(O&&g&&O.from==g.from)return b(w(i.from,i.to,O));{let e=O?w(i.from,null,O):v(f,!1),n=g?w(null,i.to,g):v(p,!0),s=[];return(O||f).to<(g||p).from-1?s.push(m(u,e.bottom,d,n.top)):e.bottomh&&n.from=r)break;a>s&&l(Math.max(t,s),null==e&&t<=h,Math.min(a,r),null==i&&a>=c,o.dir)}if(s=n.to+1,s>=r)break}return 0==a.length&&l(h,null==e,c,null==i,t.textDirection),{top:s,bottom:o,horizontal:a}}function v(t,e){let i=a.top+(e?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]}}}(t,e,i)}}function Ns(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Wi.LTR?e.left:e.right-t.scrollDOM.clientWidth)-t.scrollDOM.scrollLeft,top:e.top-t.scrollDOM.scrollTop}}function Gs(t,e,i){let n=A.cursor(e);return{from:Math.max(i.from,t.moveToLineBoundary(n,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(n,!0,!0).from),type:ii.Text}}function Fs(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==ii.Text))return t;return i}class Hs{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),e.above&&this.dom.classList.add("cm-layer-above"),e.class&&this.dom.classList.add(e.class),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(Js)!=t.state.facet(Js)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&t.view.requestMeasure(this.measureReq)}setOrder(t){let e=0,i=t.facet(Js);for(;e{return i=t,n=this.drawn[e],!(i.constructor==n.constructor&&i.eq(n));var i,n}))){let e=this.dom.firstChild,i=0;for(let n of t)n.update&&e&&n.constructor&&this.drawn[i].constructor&&n.update(e,this.drawn[i])?(e=e.nextSibling,i++):this.dom.insertBefore(n.draw(),e);for(;e;){let t=e.nextSibling;e.remove(),e=t}this.drawn=t}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Js=E.define();function Ks(t){return[_i.define((e=>new Hs(e,t))),Js.of(t)]}const tr=!De.ios,er=E.define({combine:t=>kt(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})});function ir(t={}){return[er.of(t),sr,or,lr,yi.of(!0)]}function nr(t){return t.startState.facet(er)!=t.state.facet(er)}const sr=Ks({above:!0,markers(t){let{state:e}=t,i=e.facet(er),n=[];for(let s of e.selection.ranges){let r=s==e.selection.main;if(s.empty?!r||tr:i.drawRangeCursor){let e=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",i=s.empty?s:A.cursor(s.head,s.head>s.anchor?-1:1);for(let s of js.forRange(t,e,i))n.push(s)}}return n},update(t,e){t.transactions.some((t=>t.selection))&&(e.style.animationName="cm-blink"==e.style.animationName?"cm-blink2":"cm-blink");let i=nr(t);return i&&rr(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){rr(e.state,t)},class:"cm-cursorLayer"});function rr(t,e){e.style.animationDuration=t.facet(er).cursorBlinkRate+"ms"}const or=Ks({above:!1,markers:t=>t.state.selection.ranges.map((e=>e.empty?[]:js.forRange(t,"cm-selectionBackground",e))).reduce(((t,e)=>t.concat(e))),update:(t,e)=>t.docChanged||t.selectionSet||t.viewportChanged||nr(t),class:"cm-selectionLayer"}),ar={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};tr&&(ar[".cm-line"].caretColor="transparent !important");const lr=N.highest(Ts.theme(ar)),hr=ut.define({map:(t,e)=>null==t?null:e.mapPos(t)}),cr=q.define({create:()=>null,update:(t,e)=>(null!=t&&(t=e.changes.mapPos(t)),e.effects.reduce(((t,e)=>e.is(hr)?e.value:t),t))}),ur=_i.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let i=t.state.field(cr);null==i?null!=this.cursor&&(null===(e=this.cursor)||void 0===e||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(cr)!=i||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let t=this.view.state.field(cr),e=null!=t&&this.view.coordsAtPos(t);if(!e)return null;let i=this.view.scrollDOM.getBoundingClientRect();return{left:e.left-i.left+this.view.scrollDOM.scrollLeft,top:e.top-i.top+this.view.scrollDOM.scrollTop,height:e.bottom-e.top}}drawCursor(t){this.cursor&&(t?(this.cursor.style.left=t.left+"px",this.cursor.style.top=t.top+"px",this.cursor.style.height=t.height+"px"):this.cursor.style.left="-100000px")}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(cr)!=t&&this.view.dispatch({effects:hr.of(t)})}},{eventHandlers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){t.target!=this.view.contentDOM&&this.view.contentDOM.contains(t.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function dr(){return[cr,ur]}function fr(t,e,i,n,s){e.lastIndex=0;for(let r,o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)if(!o.lineBreak)for(;r=e.exec(o.value);)s(a+r.index,r)}class pr{constructor(t){const{regexp:e,decoration:i,decorate:n,boundary:s,maxLength:r=1e3}=t;if(!e.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=e,n)this.addMatch=(t,e,i,s)=>n(s,i,i+t[0].length,t,e);else if("function"==typeof i)this.addMatch=(t,e,n,s)=>{let r=i(t,e,n);r&&s(n,n+t[0].length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(t,e,n,s)=>s(n,n+t[0].length,i)}this.boundary=s,this.maxLength=r}createDeco(t){let e=new Xt,i=e.add.bind(e);for(let{from:e,to:n}of function(t,e){let i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;let n=[];for(let{from:s,to:r}of i)s=Math.max(t.state.doc.lineAt(s).from,s-e),r=Math.min(t.state.doc.lineAt(r).to,r+e),n.length&&n[n.length-1].to>=s?n[n.length-1].to=r:n.push({from:s,to:r});return n}(t,this.maxLength))fr(t.state.doc,this.regexp,e,n,((e,n)=>this.addMatch(n,t,e,i)));return e.finish()}updateDeco(t,e){let i=1e9,n=-1;return t.docChanged&&t.changes.iterChanges(((e,s,r,o)=>{o>t.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e}updateRange(t,e,i,n){for(let s of t.visibleRanges){let r=Math.max(s.from,i),o=Math.min(s.to,n);if(o>r){let i=t.state.doc.lineAt(r),n=i.toi.from;r--)if(this.boundary.test(i.text[r-1-i.from])){a=r;break}for(;oc.push(i.range(t,e));if(i==n)for(this.regexp.lastIndex=a-i.from;(h=this.regexp.exec(i.text))&&h.indexthis.addMatch(i,t,e,u)));e=e.update({filterFrom:a,filterTo:l,filter:(t,e)=>tl,add:c})}}return e}}const Or=null!=/x/.unicode?"gu":"g",gr=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",Or),mr={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let br=null;const wr=E.define({combine(t){let e=kt(t,{render:null,specialChars:gr,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==br&&"undefined"!=typeof document&&document.body){let e=document.body.style;br=null!=(null!==(t=e.tabSize)&&void 0!==t?t:e.MozTabSize)}return br||!1}())&&(e.specialChars=new RegExp("\t|"+e.specialChars.source,Or)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Or)),e}});function vr(t={}){return[wr.of(t),Sr||(Sr=_i.fromClass(class{constructor(t){this.view=t,this.decorations=ni.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(wr)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new pr({regexp:t.specialChars,decoration:(e,i,n)=>{let{doc:s}=i.state,r=b(e[0],0);if(9==r){let t=s.lineAt(n),e=i.state.tabSize,r=Yt(t.text,e,n-t.from);return ni.replace({widget:new xr((e-r%e)*this.view.defaultCharacterWidth)})}return this.decorationCache[r]||(this.decorationCache[r]=ni.replace({widget:new yr(t,r)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(wr);t.startState.facet(wr)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))]}let Sr=null;class yr extends ei{constructor(t,e){super(),this.options=t,this.code=e}eq(t){return t.code==this.code}toDOM(t){let e=function(t){return t>=32?"•":10==t?"␤":String.fromCharCode(9216+t)}(this.code),i=t.state.phrase("Control character")+" "+(mr[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,i,e);if(n)return n;let s=document.createElement("span");return s.textContent=e,s.title=i,s.setAttribute("aria-label",i),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class xr extends ei{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent="\t",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}class kr extends ei{constructor(t){super(),this.content=t}toDOM(){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):this.content),"string"==typeof this.content?t.setAttribute("aria-label","placeholder "+this.content):t.setAttribute("aria-hidden","true"),t}ignoreEvent(){return!1}}const Qr="-10000px";class $r{constructor(t,e,i){this.facet=e,this.createTooltipView=i,this.input=t.state.facet(e),this.tooltips=this.input.filter((t=>t)),this.tooltipViews=this.tooltips.map(i)}update(t){var e;let i=t.state.facet(this.facet),n=i.filter((t=>t));if(i===this.input){for(let e of this.tooltipViews)e.update&&e.update(t);return!1}let s=[];for(let e=0;e{var e,i,n;return{position:De.ios?"absolute":(null===(e=t.find((t=>t.position)))||void 0===e?void 0:e.position)||"fixed",parent:(null===(i=t.find((t=>t.parent)))||void 0===i?void 0:i.parent)||null,tooltipSpace:(null===(n=t.find((t=>t.tooltipSpace)))||void 0===n?void 0:n.tooltipSpace)||Pr}}}),_r=new WeakMap,Xr=_i.fromClass(class{constructor(t){this.view=t,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(Cr);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new $r(t,Tr,(t=>this.createTooltip(t))),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout((()=>{this.measureTimeout=-1,this.maybeMeasure()}),50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t);e&&this.observeIntersection();let i=e||t.geometryChanged,n=t.state.facet(Cr);if(n.position!=this.position){this.position=n.position;for(let t of this.manager.tooltipViews)t.dom.style.position=this.position;i=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let t of this.manager.tooltipViews)this.container.appendChild(t.dom);i=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure()}createTooltip(t){let e=t.create(this.view);if(e.dom.classList.add("cm-tooltip"),t.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",e.dom.appendChild(t)}return e.dom.style.position=this.position,e.dom.style.top=Qr,this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var t,e;this.view.win.removeEventListener("resize",this.measureSoon);for(let e of this.manager.tooltipViews)e.dom.remove(),null===(t=e.destroy)||void 0===t||t.call(e);null===(e=this.intersectionObserver)||void 0===e||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=this.view.dom.getBoundingClientRect();return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map(((t,e)=>{let i=this.manager.tooltipViews[e];return i.getCoords?i.getCoords(t.pos):this.view.coordsAtPos(t.pos)})),size:this.manager.tooltipViews.map((({dom:t})=>t.getBoundingClientRect())),space:this.view.state.facet(Cr).tooltipSpace(this.view)}}writeMeasure(t){var e;let{editor:i,space:n}=t,s=[];for(let r=0;r=Math.min(i.bottom,n.bottom)||h.rightMath.min(i.right,n.right)+.1){l.style.top=Qr;continue}let u=o.arrow?a.dom.querySelector(".cm-tooltip-arrow"):null,d=u?7:0,f=c.right-c.left,p=null!==(e=_r.get(a))&&void 0!==e?e:c.bottom-c.top,O=a.offset||Ar,g=this.view.textDirection==Wi.LTR,m=c.width>n.right-n.left?g?n.left:n.right-c.width:g?Math.min(h.left-(u?14:0)+O.x,n.right-f):Math.max(n.left,h.left-f+(u?14:0)-O.x),b=!!o.above;!o.strictSide&&(b?h.top-(c.bottom-c.top)-O.yn.bottom)&&b==n.bottom-h.bottom>h.top-n.top&&(b=!b);let w=(b?h.top-n.top:n.bottom-h.bottom)-d;if(wm&&t.topv&&(v=b?t.top-p-2-d:t.bottom+d+2);"absolute"==this.position?(l.style.top=v-t.parent.top+"px",l.style.left=m-t.parent.left+"px"):(l.style.top=v+"px",l.style.left=m+"px"),u&&(u.style.left=h.left+(g?O.x:-O.x)-(m+14-7)+"px"),!0!==a.overlap&&s.push({left:m,top:v,right:S,bottom:v+p}),l.classList.toggle("cm-tooltip-above",b),l.classList.toggle("cm-tooltip-below",!b),a.positioned&&a.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=Qr}},{eventHandlers:{scroll(){this.maybeMeasure()}}}),Zr=Ts.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Ar={x:0,y:0},Tr=E.define({enables:[Xr,Zr]});function Rr(t,e){let i=t.plugin(Xr);if(!i)return null;let n=i.manager.tooltips.indexOf(e);return n<0?null:i.manager.tooltipViews[n]}const Er=E.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 Vr(t,e){let i=t.plugin(Mr),n=i?i.specs.indexOf(e):-1;return n>-1?i.panels[n]:null}const Mr=_i.fromClass(class{constructor(t){this.input=t.state.facet(Ur),this.specs=this.input.filter((t=>t)),this.panels=this.specs.map((e=>e(t)));let e=t.state.facet(Er);this.top=new Dr(t,!0,e.topContainer),this.bottom=new Dr(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(Er);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Dr(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Dr(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(Ur);if(i!=this.input){let e=i.filter((t=>t)),n=[],s=[],r=[],o=[];for(let i of e){let e,a=this.specs.indexOf(i);a<0?(e=i(t.view),o.push(e)):(e=this.panels[a],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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}}))});class Dr{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=Wr(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=Wr(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 Wr(t){let e=t.nextSibling;return t.remove(),e}const Ur=E.define({enables:Mr});class Yr extends Qt{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Yr.prototype.elementClass="",Yr.prototype.toDOM=void 0,Yr.prototype.mapMode=y.TrackBefore,Yr.prototype.startSide=Yr.prototype.endSide=-1,Yr.prototype.point=!0;const qr=E.define(),Lr={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>_t.empty,lineMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},zr=E.define();function Ir(t){return[jr(),zr.of(Object.assign(Object.assign({},Lr),t))]}const Br=E.define({combine:t=>t.some((t=>t))});function jr(t){let e=[Nr];return t&&!1===t.fixed&&e.push(Br.of(!0)),e}const Nr=_i.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+"px",this.gutters=t.state.facet(zr).map((e=>new Jr(t,e)));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!t.state.facet(Br),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(Br)!=!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=_t.iter(this.view.state.facet(qr),this.view.viewport.from),n=[],s=this.gutters.map((t=>new Hr(t,this.view.viewport,-this.view.documentPadding.top)));for(let t of this.view.viewportLineBlocks){let e;if(Array.isArray(t.type)){for(let i of t.type)if(i.type==ii.Text){e=i;break}}else e=t.type==ii.Text?t:void 0;if(e){n.length&&(n=[]),Fr(i,n,t.from);for(let t of s)t.line(this.view,e,n)}}for(let t of s)t.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(zr),i=t.state.facet(zr),n=t.docChanged||t.heightChanged||t.viewportChanged||!_t.eq(t.startState.facet(qr),t.state.facet(qr),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 Jr(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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&0!=i.gutters.length&&i.fixed?e.textDirection==Wi.LTR?{left:i.dom.offsetWidth}:{right:i.dom.offsetWidth}:null}))});function Gr(t){return Array.isArray(t)?t:[t]}function Fr(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class Hr{constructor(t,e,i){this.gutter=t,this.height=i,this.i=0,this.cursor=_t.iter(t.markers,e.from)}line(t,e,i){let n=[];Fr(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;if(0==n.length&&!r.config.renderEmptyElements)return;let o=e.top-this.height;if(this.i==r.elements.length){let i=new Kr(t,e.height,o,n);r.elements.push(i),r.dom.appendChild(i.dom)}else r.elements[this.i].update(t,e.height,o,n);this.height=e.bottom,this.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 Jr{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=Gr(e.markers(t)),e.initialSpacer&&(this.spacer=new Kr(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=Gr(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!_t.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 Kr{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.dom.style.height=(this.height=e)+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),function(t,e){if(t.length!=e.length)return!1;for(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 io extends Yr{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function no(t,e){return t.state.facet(eo).formatNumber(e,t.state)}const so=zr.compute([eo],(t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:t=>t.state.facet(to),lineMarker:(t,e,i)=>i.some((t=>t.toDOM))?null:new io(no(t,t.state.doc.lineAt(e.from).number)),lineMarkerChange:t=>t.startState.facet(eo)!=t.state.facet(eo),initialSpacer:t=>new io(no(t,ro(t.state.doc.lines))),updateSpacer(t,e){let i=no(e.view,ro(e.view.state.doc.lines));return i==t.number?t:new io(i)},domEventHandlers:t.facet(eo).domEventHandlers})));function ro(t){let e=9;for(;e{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=fo.match(t)),e=>{let i=t(e);return void 0===i?null:[this,i]}}}ho.closedBy=new ho({deserialize:t=>t.split(" ")}),ho.openedBy=new ho({deserialize:t=>t.split(" ")}),ho.group=new ho({deserialize:t=>t.split(" ")}),ho.contextHash=new ho({perNode:!0}),ho.lookAhead=new ho({perNode:!0}),ho.mounted=new ho({perNode:!0});class co{constructor(t,e,i){this.tree=t,this.overlay=e,this.parser=i}}const uo=Object.create(null);class fo{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):uo,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),n=new fo(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(ho.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(ho.group),n=-1;n<(i?i.length:0);n++){let s=e[n<0?t.name:i[n]];if(s)return s}}}}fo.none=new fo("",Object.create(null),0,8);class po{constructor(t){this.types=t;for(let e=0;e=n&&(r.type.isAnonymous||!1!==e(r))){if(r.firstChild())continue;t=!0}for(;t&&i&&!r.type.isAnonymous&&i(r),!r.nextSibling();){if(!r.parent())return;t=!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:To(fo.none,this.children,this.positions,0,this.children.length,0,this.length,((t,e,i)=>new bo(this.type,t,e,i,this.propValues)),t.makeTree||((t,e,i)=>new bo(fo.none,t,e,i)))}static build(t){return function(t){var e;let{buffer:i,nodeSet:n,maxBufferLength:s=oo,reused:r=[],minRepeatType:o=n.types.length}=t,a=Array.isArray(i)?new wo(i,i.length):i,l=n.types,h=0,c=0;function u(t,e,i,m,b){let{id:w,start:v,end:S,size:y}=a,x=c;for(;y<0;){if(a.next(),-1==y){let e=r[w];return i.push(e),void m.push(v-t)}if(-3==y)return void(h=w);if(-4==y)return void(c=w);throw new RangeError(`Unrecognized record size: ${y}`)}let k,Q,$=l[w],P=v-t;if(S-v<=s&&(Q=O(a.pos-e,b))){let e=new Uint16Array(Q.size-Q.skip),i=a.pos-Q.size,s=e.length;for(;a.pos>i;)s=g(Q.start,e,s);k=new vo(e,S-Q.start,n),P=Q.start-t}else{let t=a.pos-y;a.next();let e=[],i=[],n=w>=o?w:-1,r=0,l=S;for(;a.pos>t;)n>=0&&a.id==n&&a.size>=0?(a.end<=l-s&&(f(e,i,v,r,a.end,l,n,x),r=e.length,l=a.end),a.next()):u(v,t,e,i,n);if(n>=0&&r>0&&r-1&&r>0){let t=d($);k=To($,e,i,0,e.length,0,S-v,t,t)}else k=p($,e,i,S-v,x-S)}i.push(k),m.push(P)}function d(t){return(e,i,n)=>{let s,r,o=0,a=e.length-1;if(a>=0&&(s=e[a])instanceof bo){if(!a&&s.type==t&&s.length==n)return s;(r=s.prop(ho.lookAhead))&&(o=i[a]+s.length+r)}return p(t,e,i,n,o)}}function f(t,e,i,s,r,o,a,l){let h=[],c=[];for(;t.length>s;)h.push(t.pop()),c.push(e.pop()+i-r);t.push(p(n.types[a],h,c,o-r,l-o)),e.push(r-i)}function p(t,e,i,n,s=0,r){if(h){let t=[ho.contextHash,h];r=r?[t].concat(r):[t]}if(s>25){let t=[ho.lookAhead,s];r=r?[t].concat(r):[t]}return new bo(t,e,i,n,r)}function O(t,e){let i=a.fork(),n=0,r=0,l=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=l,l+=4,n+=4,i.next();continue}let a=i.pos-t;if(t<0||a=o?4:0,d=i.start;for(i.next();i.pos>a;){if(i.size<0){if(-3!=i.size)break t;u+=4}else i.id>=o&&(u+=4);i.next()}r=d,n+=t,l+=u}return(e<0||n==t)&&(c.size=n,c.start=r,c.skip=l),c.size>4?c:void 0}function g(t,e,i){let{id:n,start:s,end:r,size:l}=a;if(a.next(),l>=0&&n4){let n=a.pos-(l-4);for(;a.pos>n;)i=g(t,e,i)}e[--i]=o,e[--i]=r-t,e[--i]=s-t,e[--i]=n}else-3==l?h=n:-4==l&&(c=n);return i}let m=[],b=[];for(;a.pos>0;)u(t.start||0,t.bufferStart||0,m,b,-1);let w=null!==(e=t.length)&&void 0!==e?e:m.length?b[0]+m[0].length:0;return new bo(l[t.topID],m.reverse(),b.reverse(),w)}(t)}}bo.empty=new bo(fo.none,[],[],0);class wo{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 wo(this.buffer,this.index)}}class vo{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return fo.none}toString(){let t=[];for(let e=0;e0));a=r[a+3]);return o}slice(t,e,i){let n=this.buffer,s=new Uint16Array(e-t),r=0;for(let o=t,a=0;o=e&&ie;case 1:return i<=e&&n>e;case 2:return n>e;case 4:return!0}}function yo(t,e){let i=t.childBefore(e);for(;i;){let e=i.lastChild;if(!e||e.to!=i.to)break;e.type.isError&&e.from==e.to?(t=i,i=e.prevSibling):i=e}return t}function xo(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!=l;t+=e){let l=o[t],h=a[t]+r.from;if(So(n,i,h,h+l.length))if(l instanceof vo){if(s&mo.ExcludeBuffers)continue;let o=l.findChild(0,l.buffer.length,e,i-h,n);if(o>-1)return new Co(new Po(r,l,t,h),null,o)}else if(s&mo.IncludeAnonymous||!l.type.isAnonymous||Xo(l)){let o;if(!(s&mo.IgnoreMounts)&&l.props&&(o=l.prop(ho.mounted))&&!o.overlay)return new ko(o.tree,h,t,r);let a=new ko(l,h,t,r);return s&mo.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(e<0?l.children.length-1:0,e,i,n)}}if(s&mo.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&mo.IgnoreOverlays)&&(n=this._tree.prop(ho.mounted))&&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 ko(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}cursor(t=0){return new _o(this,t)}get tree(){return this._tree}toTree(){return this._tree}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return yo(this,t)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}toString(){return this._tree.toString()}get node(){return this}matchContext(t){return $o(this,t)}}function Qo(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 $o(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 Po{constructor(t,e,i,n){this.parent=t,this.buffer=e,this.index=i,this.start=n}}class Co{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){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 Co(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&mo.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 Co(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 Co(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 Co(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}cursor(t=0){return new _o(this,t)}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 bo(this.type,t,e,this.to-this.from)}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return yo(this,t)}toString(){return this.context.buffer.childString(this.index)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}get node(){return this}matchContext(t){return $o(this,t)}}class _o{get name(){return this.type.name}constructor(t,e=0){if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof ko)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let e=t._parent;e;e=e._parent)this.stack.unshift(e.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return!!t&&(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0)}yieldBuf(t,e){this.index=t;let{start:i,buffer:n}=this.buffer;return this.type=e||n.set.types[n.buffer[t]],this.from=i+n.buffer[t+1],this.to=i+n.buffer[t+2],!0}yield(t){return!!t&&(t instanceof ko?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,i){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,i,this.mode));let{buffer:n}=this.buffer,s=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.buffer.start,i);return!(s<0)&&(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,i=this.mode){return this.buffer?!(i&mo.ExcludeBuffers)&&this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&mo.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&mo.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode));let{buffer:e}=this.buffer,i=this.stack.length-1;if(t<0){let t=i<0?0:this.stack[i]+4;if(this.index!=t)return this.yieldBuf(e.findChild(t,this.index,-1,0,4))}else{let t=e.buffer[this.index+3];if(t<(i<0?e.buffer.length:e.buffer[this.stack[i]+3]))return this.yieldBuf(t)}return i<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,i,{buffer:n}=this;if(n){if(t>0){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&mo.IncludeAnonymous||t instanceof vo||!t.type.isAnonymous||Xo(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 $o(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 Xo(t){return t.children.some((t=>t instanceof vo||!t.type.isAnonymous||Xo(t)))}const Zo=new WeakMap;function Ao(t,e){if(!t.isAnonymous||e instanceof vo||e.type!=t)return 1;let i=Zo.get(e);if(null==i){i=1;for(let n of e.children){if(n.type!=t||!(n instanceof bo)){i=1;break}i+=Ao(t,n)}Zo.set(e,i)}return i}function To(t,e,i,n,s,r,o,a,l){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]+a);continue}u.push(i[s])}else{let e=n[h-1]+i[h-1].length-f;u.push(To(t,i,n,s,h,f,e,null,l))}d.push(f+a-r)}}(e,i,n,s,0),(a||l)(u,d,o)}class Ro{constructor(){this.map=new WeakMap}setBuffer(t,e,i){let n=this.map.get(t);n||this.map.set(t,n=new Map),n.set(e,i)}getBuffer(t,e){let i=this.map.get(t);return i&&i.get(e)}set(t,e){t instanceof Co?this.setBuffer(t.context.buffer,t.index,e):t instanceof ko&&this.map.set(t.tree,e)}get(t){return t instanceof Co?this.getBuffer(t.context.buffer,t.index):t instanceof ko?this.map.get(t.tree):void 0}cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}}class Eo{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 Eo(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,a=0,l=0;;o++){let h=o=i)for(;r&&r.from=e.from||c<=e.to||l){let t=Math.max(e.from,a)-l,i=Math.min(e.to,c)-l;e=t>=i?null:new Eo(t,i,e.tree,e.offset+l,o>0,!!h)}if(e&&n.push(e),r.to>c)break;r=snew lo(t.from,t.to))):[new lo(0,0)]:[new lo(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 Mo{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)}}function Do(t){return(e,i,n,s)=>new qo(e,t,i,n,s)}class Wo{constructor(t,e,i,n,s){this.parser=t,this.parse=e,this.overlay=i,this.target=n,this.ranges=s}}class Uo{constructor(t,e,i,n,s,r,o){this.parser=t,this.predicate=e,this.mounts=i,this.index=n,this.start=s,this.target=r,this.prev=o,this.depth=0,this.ranges=[]}}const Yo=new ho({perNode:!0});class qo{constructor(t,e,i,n,s){this.nest=e,this.input=i,this.fragments=n,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=t}advance(){if(this.baseParse){let t=this.baseParse.advance();if(!t)return null;if(this.baseParse=null,this.baseTree=t,this.startInner(),null!=this.stoppedAt)for(let t of this.inner)t.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let t=this.baseTree;return null!=this.stoppedAt&&(t=new bo(t.type,t.children,t.positions,t.length,t.propValues.concat([[Yo,this.stoppedAt]]))),t}let t=this.inner[this.innerDone],e=t.parse.advance();if(e){this.innerDone++;let i=Object.assign(Object.create(null),t.target.props);i[ho.mounted.id]=new co(e,t.overlay,t.parser),t.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let t=this.input.length;for(let e=this.innerDone;et.frag.from<=n.from&&t.frag.to>=n.to&&t.mount.overlay));if(t)for(let i of t.mount.overlay){let s=i.from+t.pos,r=i.to+t.pos;s>=n.from&&r<=n.to&&!e.ranges.some((t=>t.froms))&&e.ranges.push({from:s,to:r})}}a=!1}else if(i&&(r=Lo(i.ranges,n.from,n.to)))a=2!=r;else if(!n.type.isAnonymous&&n.fromnew lo(t.from-n.from,t.to-n.from))):null,n.tree,t)),s.overlay?t.length&&(i={ranges:t,depth:0,prev:i}):a=!1}}else e&&(o=e.predicate(n))&&(!0===o&&(o=new lo(n.from,n.to)),o.fromnew lo(t.from-e.start,t.to-e.start))),e.target,t)),e=e.prev}i&&! --i.depth&&(i=i.prev)}}}}function Lo(t,e,i){for(let n of t){if(n.from>=i)break;if(n.to>e)return n.from<=e&&n.to>=i?2:1}return 0}function zo(t,e,i,n,s,r){if(e=e.to);n++);let o=s.children[n],a=o.buffer;s.children[n]=function t(i,n,s,l,h){let c=i;for(;a[c+2]+r<=e.from;)c=a[c+3];let u=[],d=[];zo(o,i,c,u,d,l);let f=a[c+1],p=a[c+2],O=f+r==e.from&&p+r==e.to&&a[c]==e.type.id;return u.push(O?e.toTree():t(c+4,a[c+3],o.set.types[a[c]],f,p-f)),d.push(f-l),zo(o,a[c+3],n,u,d,l),new bo(s,u,d,h)}(0,a.length,fo.none,0,o.length);for(let n=0;n<=i;n++)t.childAfter(e.from)}class Bo{constructor(t,e){this.offset=e,this.done=!1,this.cursor=t.cursor(mo.IncludeAnonymous|mo.IgnoreMounts)}moveTo(t){let{cursor:e}=this,i=t-this.offset;for(;!this.done&&e.from=t&&e.enter(i,1,mo.IgnoreOverlays|mo.ExcludeBuffers)||e.next(!1)||(this.done=!0)}hasNode(t){if(this.moveTo(t.from),!this.done&&this.cursor.from+this.offset==t.from&&this.cursor.tree)for(let e=this.cursor.tree;;){if(e==t.tree)return!0;if(!(e.children.length&&0==e.positions[0]&&e.children[0]instanceof bo))break;e=e.children[0]}return!1}}let jo=class{constructor(t){var e;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){let i=this.curFrag=t[0];this.curTo=null!==(e=i.tree.prop(Yo))&&void 0!==e?e:i.to,this.inner=new Bo(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t)}nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=null!==(t=e.tree.prop(Yo))&&void 0!==t?t:e.to,this.inner=new Bo(e.tree,-e.offset)}}findMounts(t,e){var i;let n=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let t=this.inner.cursor.node;t;t=t.parent){let s=null===(i=t.tree)||void 0===i?void 0:i.prop(ho.mounted);if(s&&s.parser==e)for(let e=this.fragI;e=t.to)break;i.tree==this.curFrag.tree&&n.push({frag:i,pos:t.from-i.offset,mount:s})}}}return n}};function No(t,e){let i=null,n=e;for(let s=1,r=0;s=a)break;t.to<=o||(i||(n=i=e.slice()),t.froma&&i.splice(r+1,0,new lo(a,t.to))):t.to>a?i[r--]=new lo(a,t.to):i.splice(r--,1))}}return n}function Go(t,e,i,n){let s=0,r=0,o=!1,a=!1,l=-1e9,h=[];for(;;){let c=s==t.length?1e9:o?t[s].to:t[s].from,u=r==e.length?1e9:a?e[r].to:e[r].from;if(o!=a){let t=Math.max(l,i),e=Math.min(c,u,n);tnew lo(t.from+n,t.to+n))),a,l);for(let e=0,n=a;;e++){let a=e==o.length,h=a?l:o[e].from;if(h>n&&i.push(new Eo(n,h,s.tree,-t,r.from>=n||r.openStart,r.to<=h||r.openEnd)),a)break;n=o[e].to}}else i.push(new Eo(a,l,s.tree,-t,r.from>=t||r.openStart,r.to<=o||r.openEnd))}return i}let Ho=0;class Jo{constructor(t,e,i){this.set=t,this.base=e,this.modified=i,this.id=Ho++}static define(t){if(null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let e=new Jo([],null,[]);if(e.set.push(e),t)for(let i of t.set)e.set.push(i);return e}static defineModifier(){let t=new ta;return e=>e.modified.indexOf(t)>-1?e:ta.get(e.base||e,e.modified.concat(t).sort(((t,e)=>t.id-e.id)))}}let Ko=0;class ta{constructor(){this.instances=[],this.id=Ko++}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 Jo(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(ta.get(e,t));return s}}function ea(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,a=i[o];if(!a)throw new RangeError("Invalid path: "+t);let l=new na(n,s,o>0?i.slice(0,o):null);e[a]=l.sort(e[a])}}return ia.add(e)}const ia=new ho;class na{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 ra(t,e,i,n=0,s=t.length){let r=new oa(n,Array.isArray(e)?e:[e],i);r.highlightRange(t.cursor(),n,s,"",r.highlighters),r.flush(s)}na.empty=new na([],2,null);class oa{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:a}=t;if(o>=i||a<=e)return;r.isTop&&(s=this.highlighters.filter((t=>!t.scope||t.scope(r))));let l=n,h=function(t){let e=t.type.prop(ia);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}(t)||na.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&&(l&&(l+=" "),l+=c,1==h.mode&&(n+=(n?" ":"")+c)),this.startSpan(t.from,l),h.opaque)return;let u=t.tree&&t.tree.prop(ho.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 d=0,f=o;;d++){let p=d=O)&&t.nextSibling()););if(!p||O>i)break;f=p.to+o,f>e&&(this.highlightRange(r.cursor(),Math.max(e,p.from+o),Math.min(i,f),n,h),this.startSpan(f,l))}c&&t.parent()}else if(t.firstChild()){do{if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,n,s),this.startSpan(Math.min(i,t.to),l)}}while(t.nextSibling());t.parent()}}}const aa=Jo.define,la=aa(),ha=aa(),ca=aa(ha),ua=aa(ha),da=aa(),fa=aa(da),pa=aa(da),Oa=aa(),ga=aa(Oa),ma=aa(),ba=aa(),wa=aa(),va=aa(wa),Sa=aa(),ya={comment:la,lineComment:aa(la),blockComment:aa(la),docComment:aa(la),name:ha,variableName:aa(ha),typeName:ca,tagName:aa(ca),propertyName:ua,attributeName:aa(ua),className:aa(ha),labelName:aa(ha),namespace:aa(ha),macroName:aa(ha),literal:da,string:fa,docString:aa(fa),character:aa(fa),attributeValue:aa(fa),number:pa,integer:aa(pa),float:aa(pa),bool:aa(da),regexp:aa(da),escape:aa(da),color:aa(da),url:aa(da),keyword:ma,self:aa(ma),null:aa(ma),atom:aa(ma),unit:aa(ma),modifier:aa(ma),operatorKeyword:aa(ma),controlKeyword:aa(ma),definitionKeyword:aa(ma),moduleKeyword:aa(ma),operator:ba,derefOperator:aa(ba),arithmeticOperator:aa(ba),logicOperator:aa(ba),bitwiseOperator:aa(ba),compareOperator:aa(ba),updateOperator:aa(ba),definitionOperator:aa(ba),typeOperator:aa(ba),controlOperator:aa(ba),punctuation:wa,separator:aa(wa),bracket:va,angleBracket:aa(va),squareBracket:aa(va),paren:aa(va),brace:aa(va),content:Oa,heading:ga,heading1:aa(ga),heading2:aa(ga),heading3:aa(ga),heading4:aa(ga),heading5:aa(ga),heading6:aa(ga),contentSeparator:aa(Oa),list:aa(Oa),quote:aa(Oa),emphasis:aa(Oa),strong:aa(Oa),link:aa(Oa),monospace:aa(Oa),strikethrough:aa(Oa),inserted:aa(),deleted:aa(),changed:aa(),invalid:aa(),meta:Sa,documentMeta:aa(Sa),annotation:aa(Sa),processingInstruction:aa(Sa),definition:Jo.defineModifier(),constant:Jo.defineModifier(),function:Jo.defineModifier(),standard:Jo.defineModifier(),local:Jo.defineModifier(),special:Jo.defineModifier()};var xa;sa([{tag:ya.link,class:"tok-link"},{tag:ya.heading,class:"tok-heading"},{tag:ya.emphasis,class:"tok-emphasis"},{tag:ya.strong,class:"tok-strong"},{tag:ya.keyword,class:"tok-keyword"},{tag:ya.atom,class:"tok-atom"},{tag:ya.bool,class:"tok-bool"},{tag:ya.url,class:"tok-url"},{tag:ya.labelName,class:"tok-labelName"},{tag:ya.inserted,class:"tok-inserted"},{tag:ya.deleted,class:"tok-deleted"},{tag:ya.literal,class:"tok-literal"},{tag:ya.string,class:"tok-string"},{tag:ya.number,class:"tok-number"},{tag:[ya.regexp,ya.escape,ya.special(ya.string)],class:"tok-string2"},{tag:ya.variableName,class:"tok-variableName"},{tag:ya.local(ya.variableName),class:"tok-variableName tok-local"},{tag:ya.definition(ya.variableName),class:"tok-variableName tok-definition"},{tag:ya.special(ya.variableName),class:"tok-variableName2"},{tag:ya.definition(ya.propertyName),class:"tok-propertyName tok-definition"},{tag:ya.typeName,class:"tok-typeName"},{tag:ya.namespace,class:"tok-namespace"},{tag:ya.className,class:"tok-className"},{tag:ya.macroName,class:"tok-macroName"},{tag:ya.propertyName,class:"tok-propertyName"},{tag:ya.operator,class:"tok-operator"},{tag:ya.comment,class:"tok-comment"},{tag:ya.meta,class:"tok-meta"},{tag:ya.invalid,class:"tok-invalid"},{tag:ya.punctuation,class:"tok-punctuation"}]);const ka=new ho;function Qa(t){return E.define({combine:t?e=>e.concat(t):void 0})}const $a=new ho;class Pa{constructor(t,e,i=[],n=""){this.data=t,this.name=n,xt.prototype.hasOwnProperty("tree")||Object.defineProperty(xt.prototype,"tree",{get(){return Xa(this)}}),this.parser=e,this.extension=[Wa.of(this),xt.languageData.of(((t,e,i)=>{let n=Ca(t,e,i),s=n.type.prop(ka);if(!s)return[];let r=t.facet(s),o=n.type.prop($a);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 Ca(t,e,i).type.prop(ka)==this.data}findRegions(t){let e=t.facet(Wa);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(ka)==this.data)return void i.push({from:e,to:e+t.length});let s=t.prop(ho.mounted);if(s){if(s.tree.prop(ka)==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;it.isTop?e:void 0))]}),t.name)}configure(t,e){return new _a(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Xa(t){let e=t.field(Pa.state,!1);return e?e.tree:bo.empty}class Za{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let i=this.cursorPos-this.string.length;return t=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i)}}let Aa=null;class Ta{constructor(t,e,i=[],n,s,r,o,a){this.parser=t,this.state=e,this.fragments=i,this.tree=n,this.treeLen=s,this.viewport=r,this.skipped=o,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(t,e,i){return new Ta(t,e,[],bo.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Za(this.state.doc),this.fragments)}work(t,e){return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=bo.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(Eo.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Aa;Aa=this;try{return t()}finally{Aa=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=Ra(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=Eo.applyChanges(i,e),n=bo.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=Ra(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 Vo{createParse(e,i,n){let s=n[0].from,r=n[n.length-1].to;return{parsedPos:s,advance(){let e=Aa;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 bo(fo.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 Aa}}function Ra(t,e,i){return Eo.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class Ea{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 Ea(e)}static init(t){let e=Math.min(3e3,t.doc.length),i=Ta.create(t.facet(Wa).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new Ea(i)}}Pa.state=q.define({create:Ea.init,update(t,e){for(let t of e.effects)if(t.is(Pa.setState))return t.value;return e.startState.facet(Wa)!=e.state.facet(Wa)?Ea.init(e.state):t.apply(e)}});let Va=t=>{let e=setTimeout((()=>t()),500);return()=>clearTimeout(e)};"undefined"!=typeof requestIdleCallback&&(Va=t=>{let e=-1,i=setTimeout((()=>{e=requestIdleCallback(t,{timeout:400})}),100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const Ma="undefined"!=typeof navigator&&(null===(xa=navigator.scheduling)||void 0===xa?void 0:xa.isInputPending)?()=>navigator.scheduling.isInputPending():null,Da=_i.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(Pa.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),t.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(Pa.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=Va(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEndn+1e3,a=s.context.work((()=>Ma&&Ma()||Date.now()>r),n+(o?0:1e5));this.chunkBudget-=Date.now()-e,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Pa.setState.of(new Ea(s.context))})),this.chunkBudget>0&&(!a||o)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then((()=>this.scheduleWork())).catch((t=>Qi(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()}}}),Wa=E.define({combine:t=>t.length?t[0]:null,enables:t=>[Pa.state,Da,Ts.contentAttributes.compute([t],(e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}}))]});class Ua{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}class Ya{constructor(t,e,i,n,s,r=void 0){this.name=t,this.alias=e,this.extensions=i,this.filename=n,this.loadFunc=s,this.support=r,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then((t=>this.support=t),(t=>{throw this.loading=null,t})))}static of(t){let{load:e,support:i}=t;if(!e){if(!i)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");e=()=>Promise.resolve(i)}return new Ya(t.name,(t.alias||[]).concat(t.name).map((t=>t.toLowerCase())),t.extensions||[],t.filename,e,i)}static matchFilename(t,e){for(let i of t)if(i.filename&&i.filename.test(e))return i;let i=/\.([^.]+)$/.exec(e);if(i)for(let e of t)if(e.extensions.indexOf(i[1])>-1)return e;return null}static matchLanguageName(t,e,i=!0){e=e.toLowerCase();for(let i of t)if(i.alias.some((t=>t==e)))return i;if(i)for(let i of t)for(let t of i.alias){let n=e.indexOf(t);if(n>-1&&(t.length>2||!/\w/.test(e[n-1])&&!/\w/.test(e[n+t.length])))return i}return null}}const qa=E.define(),La=E.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 za(t){let e=t.facet(La);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function Ia(t,e){let i="",n=t.tabSize,s=t.facet(La)[0];if("\t"==s){for(;e>=n;)i+="\t",e-=n;s=" "}for(let t=0;t=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 Yt(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 Na=new ho;function Ga(t){let e=t.type.prop(Na);if(e)return e;let i,n=t.firstChild;if(n&&(i=n.type.prop(ho.closedBy))){let e=t.lastChild,n=e&&i.indexOf(e.name)>-1;return t=>el(t,!0,1,void 0,n&&!function(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}(t)?e.from:void 0)}return null==t.parent?Ha:null}function Fa(t,e,i){for(;t;t=t.parent){let n=Ga(t);if(n)return n(Ja.create(i,e,t))}return null}function Ha(){return 0}class Ja extends ja{constructor(t,e,i){super(t.state,t.options),this.base=t,this.pos=e,this.node=i}static create(t,e,i){return new Ja(t,e,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){let t=this.state.doc.lineAt(this.node.from);for(;;){let e=this.node.resolve(t.from);for(;e.parent&&e.parent.from==e.from;)e=e.parent;if(Ka(e,this.node))break;t=this.state.doc.lineAt(e.from)}return this.lineIndent(t.from)}continue(){let t=this.node.parent;return t?Fa(t,this.pos,this.base):0}}function Ka(t,e){for(let i=e;i;i=i.parent)if(t==i)return!0;return!1}function tl({closing:t,align:e=!0,units:i=1}){return n=>el(n,e,i,t)}function el(t,e,i,n,s){let r=t.textAfter,o=r.match(/^\s*/)[0].length,a=n&&r.slice(o,o+n.length)==n||s==t.pos+o,l=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.from{let n=t&&t.test(i.textAfter);return i.baseIndent+(n?0:e*i.unit)}}function nl(){return xt.transactionFilter.of((t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let i=t.newDoc,{head:n}=t.newSelection.main,s=i.lineAt(n);if(n>s.from+200)return t;let r=i.sliceString(s.from,n);if(!e.some((t=>t.test(r))))return t;let{state:o}=t,a=-1,l=[];for(let{head:t}of o.selection.ranges){let e=o.doc.lineAt(t);if(e.from==a)continue;a=e.from;let i=Ba(o,e.from);if(null==i)continue;let n=/^\s*/.exec(e.text)[0],s=Ia(o,i);n!=s&&l.push({from:e.from,to:e.from+n.length,insert:s})}return l.length?[t,{changes:l,sequential:!0}]:t}))}const sl=E.define(),rl=new ho;function ol(t){let e=t.firstChild,i=t.lastChild;return e&&e.toi)continue;if(s&&r.from=e&&n.to>i&&(s=n)}}return s}(t,e,i)}function hl(t,e){let i=e.mapPos(t.from,1),n=e.mapPos(t.to,-1);return i>=n?void 0:{from:i,to:n}}const cl=ut.define({map:hl}),ul=ut.define({map:hl}),dl=q.define({create:()=>ni.none,update(t,e){t=t.map(e.changes);for(let i of e.effects)i.is(cl)&&!pl(t,i.value.from,i.value.to)?t=t.update({add:[bl.range(i.value.from,i.value.to)]}):i.is(ul)&&(t=t.update({filter:(t,e)=>i.value.from!=t||i.value.to!=e,filterFrom:i.value.from,filterTo:i.value.to}));if(e.selection){let i=!1,{head:n}=e.selection.main;t.between(n,n,((t,e)=>{tn&&(i=!0)})),i&&(t=t.update({filterFrom:n,filterTo:n,filter:(t,e)=>e<=n||t>=n}))}return t},provide:t=>Ts.decorations.from(t),toJSON(t,e){let i=[];return t.between(0,e.doc.length,((t,e)=>{i.push(t,e)})),i},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let i=0;i{(!s||s.from>t)&&(s={from:t,to:e})})),s}function pl(t,e,i){let n=!1;return t.between(e,e,((t,s)=>{t==e&&s==i&&(n=!0)})),n}const Ol={placeholderDOM:null,placeholderText:"…"},gl=E.define({combine:t=>kt(t,Ol)});function ml(t){let e=[dl,Sl];return t&&e.push(gl.of(t)),e}const bl=ni.replace({widget:new class extends ei{toDOM(t){let{state:e}=t,i=e.facet(gl),n=e=>{let i=t.lineBlockAt(t.posAtDOM(e.target)),n=fl(t.state,i.from,i.to);n&&t.dispatch({effects:ul.of(n)}),e.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(t,n);let s=document.createElement("span");return s.textContent=i.placeholderText,s.setAttribute("aria-label",e.phrase("folded code")),s.title=e.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=n,s}}}),wl={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class vl extends Yr{constructor(t,e){super(),this.config=t,this.open=e}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let e=document.createElement("span");return e.textContent=this.open?this.config.openText:this.config.closedText,e.title=t.state.phrase(this.open?"Fold line":"Unfold line"),e}}const Sl=Ts.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class yl{constructor(t,e){let i;function n(t){let e=It.newName();return(i||(i=Object.create(null)))["."+e]=t,e}this.specs=t;const s="string"==typeof e.all?e.all:e.all?n(e.all):void 0,r=e.scope;this.scope=r instanceof Pa?t=>t.prop(ka)==r.data:r?t=>t==r:void 0,this.style=sa(t.map((t=>({tag:t.tag,class:t.class||n(Object.assign({},t,{tag:null}))}))),{all:s}).style,this.module=i?new It(i):null,this.themeType=e.themeType}static define(t,e){return new yl(t,e||{})}}const xl=E.define(),kl=E.define({combine:t=>t.length?[t[0]]:null});function Ql(t){let e=t.facet(xl);return e.length?e:t.facet(kl)}function $l(t,e){let i,n=[Cl];return t instanceof yl&&(t.module&&n.push(Ts.styleModule.of(t.module)),i=t.themeType),(null==e?void 0:e.fallback)?n.push(kl.of(t)):i?n.push(xl.computeN([Ts.darkTheme],(e=>e.facet(Ts.darkTheme)==("dark"==i)?[t]:[]))):n.push(xl.of(t)),n}class Pl{constructor(t){this.markCache=Object.create(null),this.tree=Xa(t.state),this.decorations=this.buildDeco(t,Ql(t.state))}update(t){let e=Xa(t.state),i=Ql(t.state),n=i!=Ql(t.startState);e.length{i.add(t,e,this.markCache[n]||(this.markCache[n]=ni.mark({class:n})))}),n,s);return i.finish()}}const Cl=N.high(_i.fromClass(Pl,{decorations:t=>t.decorations})),_l=yl.define([{tag:ya.meta,color:"#404740"},{tag:ya.link,textDecoration:"underline"},{tag:ya.heading,textDecoration:"underline",fontWeight:"bold"},{tag:ya.emphasis,fontStyle:"italic"},{tag:ya.strong,fontWeight:"bold"},{tag:ya.strikethrough,textDecoration:"line-through"},{tag:ya.keyword,color:"#708"},{tag:[ya.atom,ya.bool,ya.url,ya.contentSeparator,ya.labelName],color:"#219"},{tag:[ya.literal,ya.inserted],color:"#164"},{tag:[ya.string,ya.deleted],color:"#a11"},{tag:[ya.regexp,ya.escape,ya.special(ya.string)],color:"#e40"},{tag:ya.definition(ya.variableName),color:"#00f"},{tag:ya.local(ya.variableName),color:"#30a"},{tag:[ya.typeName,ya.namespace],color:"#085"},{tag:ya.className,color:"#167"},{tag:[ya.special(ya.variableName),ya.macroName],color:"#256"},{tag:ya.definition(ya.propertyName),color:"#00c"},{tag:ya.comment,color:"#940"},{tag:ya.invalid,color:"#f00"}]),Xl=Ts.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Zl=1e4,Al="()[]{}",Tl=E.define({combine:t=>kt(t,{afterCursor:!0,brackets:Al,maxScanDistance:Zl,renderMatch:Vl})}),Rl=ni.mark({class:"cm-matchingBracket"}),El=ni.mark({class:"cm-nonmatchingBracket"});function Vl(t){let e=[],i=t.matched?Rl:El;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 Ml=q.define({create:()=>ni.none,update(t,e){if(!e.docChanged&&!e.selection)return t;let i=[],n=e.state.facet(Tl);for(let t of e.state.selection.ranges){if(!t.empty)continue;let s=Ll(e.state,t.head,-1,n)||t.head>0&&Ll(e.state,t.head-1,1,n)||n.afterCursor&&(Ll(e.state,t.head,1,n)||t.headTs.decorations.from(t)}),Dl=[Ml,Xl];function Wl(t={}){return[Tl.of(t),Dl]}const Ul=new ho;function Yl(t,e,i){let n=t.prop(e<0?ho.openedBy:ho.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 ql(t){let e=t.type.prop(Ul);return e?e(t.node):t}function Ll(t,e,i,n={}){let s=n.maxScanDistance||Zl,r=n.brackets||Al,o=Xa(t),a=o.resolveInner(e,i);for(let n=a;n;n=n.parent){let s=Yl(n.type,i,r);if(s&&n.from0?e>=o.from&&eo.from&&e<=o.to))return zl(t,e,i,n,o,s,r)}}return function(t,e,i,n,s,r,o){let a=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%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 a=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(a+t,1).type!=s))if(e%2==0==i>0)u++;else{if(1==u)return{start:h,end:{from:a+t,to:a+t+1},matched:e>>1==l>>1};u--}}i>0&&(t+=r.length)}return c.done?{start:h,matched:!1}:null}(t,e,i,o,a.type,s,r)}function zl(t,e,i,n,s,r,o){let a=n.parent,l={from:s.from,to:s.to},h=0,c=null==a?void 0:a.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 jl(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 Nl=new WeakMap;class Gl extends Pa{constructor(t){let e,i=Qa(t.languageData),n={name:(s=t).name||"",token:s.token,blankLine:s.blankLine||(()=>{}),startState:s.startState||(()=>!0),copyState:s.copyState||jl,indent:s.indent||(()=>null),languageData:s.languageData||{},tokenTable:s.tokenTable||th};var s;super(i,new class extends Vo{createParse(t,i,n){return new Jl(e,t,i,n)}},[qa.of(((t,e)=>this.getIndent(t,e)))],t.name),this.topNode=function(t){let e=fo.define({id:eh.length,name:"Document",props:[ka.add((()=>t))]});return eh.push(e),e}(i),e=this,this.streamParser=n,this.stateAfter=new ho({perNode:!0}),this.tokenTable=t.tokenTable?new rh(n.tokenTable):oh}static define(t){return new Gl(t)}getIndent(t,e){let i,n=Xa(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=Nl.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],a=i+e.positions[r],l=o instanceof bo&&a=e.length)return e;s||e.type!=t.topNode||(s=!0);for(let r=e.children.length-1;r>=0;r--){let o,a=e.positions[r],l=e.children[r];if(ai&&Fl(t,n.tree,0-n.offset,i,r);if(o&&(e=Hl(t,n.tree,i+n.offset,o.pos+n.offset,!1)))return{state:o.state,tree:e}}return{state:t.streamParser.startState(n?za(n):4),tree:bo.empty}}(t,i,r,null==s?void 0:s.state);this.state=o,this.parsedPos=this.chunkStart=r+a.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 Bl(e,t?t.state.tabSize:4,t?za(t.state):2);if(r.eol())s.blankLine(this.state,r.indentUnit);else for(;!r.eol();){let t=Kl(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 th=Object.create(null),eh=[fo.none],ih=new po(eh),nh=[],sh=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"]])sh[t]=lh(th,e);class rh{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),sh)}resolve(t){return t?this.table[t]||(this.table[t]=lh(this.extra,t)):0}}const oh=new rh(th);function ah(t,e){nh.indexOf(t)>-1||(nh.push(t),console.warn(e))}function lh(t,e){let i=null;for(let n of e.split(".")){let e=t[n]||ya[n];e?"function"==typeof e?i?i=e(i):ah(n,`Modifier ${n} used at start of tag`):i?ah(n,`Tag ${n} used as modifier`):i=e:ah(n,`Unknown highlighting tag ${n}`)}if(!i)return 0;let n=e.replace(/ /g,"_"),s=fo.define({id:eh.length,name:n,props:[ea({[n]:i})]});return eh.push(s),s.id}function hh(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 ch=hh(gh,0),uh=hh(Oh,0),dh=hh(((t,e)=>Oh(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 fh(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}const ph=50;function Oh(t,e,i=e.selection.ranges){let n=i.map((t=>fh(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,a=t.sliceDoc(n-ph,n),l=t.sliceDoc(s,s+ph),h=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(l)[0].length,u=a.length-h;if(a.slice(u-e.length,u)==e&&l.slice(c,c+i.length)==i)return{open:{pos:n-h,margin:h&&1},close:{pos:s+c,margin:c&&1}};s-n<=2*ph?r=o=t.sliceDoc(n,s):(r=t.sliceDoc(n,n+ph),o=t.sliceDoc(s-ph,s));let d=/^\s*/.exec(r)[0].length,f=/\s*$/.exec(o)[0].length,p=o.length-f-i.length;return r.slice(d,d+e.length)==e&&o.slice(p,p+i.length)==i?{open:{pos:n+d+e.length,margin:/\s/.test(r.charAt(d+e.length))?1:0},close:{pos:s-f-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>l.from)){s=l.from;let t=/^\s*/.exec(l.text)[0].length,e=t==l.length,i=l.text.slice(t,t+a.length)==a?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 mh=lt.define(),bh=lt.define(),wh=E.define(),vh=E.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)})});const Sh=q.define({create:()=>Dh.empty,update(t,e){let i=e.state.facet(vh),n=e.annotation(mh);if(n){let s=e.docChanged?A.single(function(t){let e=0;return t.iterChangedRanges(((t,i)=>e=i)),e}(e.changes)):void 0,r=Ch.fromTransaction(e,s),o=n.side,a=0==o?t.undone:t.done;return a=r?_h(a,a.length,i.minDepth,r):Th(a,e.startState.selection),new Dh(0==o?n.rest:a,0==o?a:n.rest)}let s=e.annotation(bh);if("full"!=s&&"before"!=s||(t=t.isolate()),!1===e.annotation(dt.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);let r=Ch.fromTransaction(e),o=e.annotation(dt.time),a=e.annotation(dt.userEvent);return r?t=t.addChanges(r,o,a,i,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,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 Dh(t.done.map(Ch.fromJSON),t.undone.map(Ch.fromJSON))});function yh(t={}){return[Sh,vh.of(t),Ts.domEventHandlers({beforeinput(t,e){let i="historyUndo"==t.inputType?kh:"historyRedo"==t.inputType?Qh:null;return!!i&&(t.preventDefault(),i(e))}})]}function xh(t,e){return function({state:i,dispatch:n}){if(!e&&i.readOnly)return!1;let s=i.field(Sh,!1);if(!s)return!1;let r=s.pop(t,i,e);return!!r&&(n(r),!0)}}const kh=xh(0,!1),Qh=xh(1,!1),$h=xh(0,!0),Ph=xh(1,!0);class Ch{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 Ch(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 Ch(t.changes&&k.fromJSON(t.changes),[],t.mapped&&x.fromJSON(t.mapped),t.startSelection&&A.fromJSON(t.startSelection),t.selectionsAfter.map(A.fromJSON))}static fromTransaction(t,e){let i=Zh;for(let e of t.startState.facet(wh)){let n=e(t);n.length&&(i=i.concat(n))}return!i.length&&t.changes.empty?null:new Ch(t.changes.invert(t.startState.doc),i,void 0,e||t.startState.selection,Zh)}static selection(t){return new Ch(void 0,Zh,void 0,void 0,t)}}function _h(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 Xh(t,e){return t.length?e.length?t.concat(e):t:e}const Zh=[],Ah=200;function Th(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-Ah));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),_h(t,t.length-1,1e9,i.setSelAfter(n)))}return[Ch.selection([e])]}function Rh(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 Eh(t,e){if(!t.length)return t;let i=t.length,n=Zh;for(;i;){let s=Vh(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?[Ch.selection(n)]:Zh}function Vh(t,e,i){let n=Xh(t.selectionsAfter.length?t.selectionsAfter.map((t=>t.map(e))):Zh,i);if(!t.changes)return Ch.selection(n);let s=t.changes.map(e),r=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(r):r;return new Ch(s,ut.mapEffects(t.effects,e),o,t.startSelection.map(r),n)}const Mh=/^(input\.type|delete)($|\.)/;class Dh{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 Dh(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||Mh.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)?_h(r,r.length-1,n.minDepth,new Ch(t.changes.compose(o.changes),Xh(t.effects,o.effects),o.mapped,o.startSelection,Zh)):_h(r,r.length,n.minDepth,t),new Dh(r,Zh,e,i)}addSelection(t,e,i,n){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Zh;return s.length>0&&e-this.prevTimet.empty!=o.ranges[e].empty)).length)?this:new Dh(Th(this.done,t),this.undone,e,i);var r,o}addMapping(t){return new Dh(Eh(this.done,t),Eh(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:mh.of({side:t,rest:Rh(n)}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let i=1==n.length?Zh:n.slice(0,n.length-1);return s.mapped&&(i=Eh(i,s.mapped)),e.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:mh.of({side:t,rest:i}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}}Dh.empty=new Dh(Zh,Zh);const Wh=[{key:"Mod-z",run:kh,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Qh,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Qh,preventDefault:!0},{key:"Mod-u",run:$h,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Ph,preventDefault:!0}];function Uh(t,e){return A.create(t.ranges.map(e),t.mainIndex)}function Yh(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function qh({state:t,dispatch:e},i){let n=Uh(t.selection,i);return!n.eq(t.selection)&&(e(Yh(t,n)),!0)}function Lh(t,e){return A.cursor(e?t.to:t.from)}function zh(t,e){return qh(t,(i=>i.empty?t.moveByChar(i,e):Lh(i,e)))}function Ih(t){return t.textDirectionAt(t.state.selection.main.head)==Wi.LTR}const Bh=t=>zh(t,!Ih(t)),jh=t=>zh(t,Ih(t));function Nh(t,e){return qh(t,(i=>i.empty?t.moveByGroup(i,e):Lh(i,e)))}function Gh(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 Fh(t,e,i){let n,s,r=Xa(t).resolveInner(e.head),o=i?ho.closedBy:ho.openedBy;for(let n=e.head;;){let e=i?r.childAfter(n):r.childBefore(n);if(!e)break;Gh(t,e,o)?r=e:n=i?e.to:e.from}return s=r.type.prop(o)&&(n=i?Ll(t,r.from,1):Ll(t,r.to,-1))&&n.matched?i?n.end.to:n.end.from:i?r.to:r.from,A.cursor(s,i?-1:1)}function Hh(t,e){return qh(t,(i=>{if(!i.empty)return Lh(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)}))}const Jh=t=>Hh(t,!1),Kh=t=>Hh(t,!0);function tc(t){let e,i=t.scrollDOM.clientHeighti.empty?t.moveVertically(i,e,n.height):Lh(i,e)));if(r.eq(s.selection))return!1;if(n.selfScroll){let e=t.coordsAtPos(s.selection.main.head),o=t.scrollDOM.getBoundingClientRect(),a=o.top+n.marginTop,l=o.bottom-n.marginBottom;e&&e.top>a&&e.bottomec(t,!1),nc=t=>ec(t,!0);function sc(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=A.cursor(n.from+i))}return s}function rc(t,e){let i=Uh(t.state.selection,(t=>{let i=e(t);return A.range(t.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)}));return!i.eq(t.state.selection)&&(t.dispatch(Yh(t.state,i)),!0)}function oc(t,e){return console.log("Select!"),rc(t,(i=>t.moveByCharSelected(i,e)))}const ac=t=>oc(t,!Ih(t)),lc=t=>oc(t,Ih(t));function hc(t,e){return rc(t,(i=>t.moveByGroup(i,e)))}function cc(t,e){return rc(t,(i=>t.moveVertically(i,e)))}const uc=t=>cc(t,!1),dc=t=>cc(t,!0);function fc(t,e){return rc(t,(i=>t.moveVertically(i,e,tc(t).height)))}const pc=t=>fc(t,!1),Oc=t=>fc(t,!0),gc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:0})),!0),mc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.doc.length})),!0),bc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:0})),!0),wc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0);function vc(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=Sc(t,n,!0)),s=Math.min(s,n),r=Math.max(r,n)}else s=Sc(t,s,!1),r=Sc(t,r,!0);return s==r?{range:n}:{changes:{from:s,to:r},range:A.cursor(s)}}));return!s.changes.empty&&(t.dispatch(n.update(s,{scrollIntoView:!0,userEvent:i,effects:"delete.selection"==i?Ts.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function Sc(t,e,i){if(t instanceof Ts)for(let n of t.state.facet(Ts.atomicRanges).map((e=>e(t))))n.between(e,e,((t,n)=>{te&&(e=i?n:t)}));return e}const yc=(t,e)=>vc(t,(i=>{let n,s,{state:r}=t,o=r.doc.lineAt(i);if(!e&&i>o.from&&iyc(t,!1),kc=t=>yc(t,!0),Qc=(t,e)=>vc(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 a=f(r.text,n-r.from,e)+r.from,l=r.text.slice(Math.min(n,a)-r.from,Math.max(n,a)-r.from),h=o(l);if(null!=t&&h!=t)break;" "==l&&n==i||(t=h),n=a}return n})),$c=t=>Qc(t,!1),Pc=t=>vc(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 _c(t,e,i){if(t.readOnly)return!1;let n=[],s=[];for(let e of Cc(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(A.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(A.range(t.anchor-o,t.head-o))}}return!!n.length&&(e(t.update({changes:n,scrollIntoView:!0,selection:A.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0)}function Xc(t,e,i){if(t.readOnly)return!1;let n=[];for(let e of Cc(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 Zc=Ac(!1);function Ac(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),a=!e&&s==r&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i,n=Xa(t).resolveInner(e),s=n.childBefore(e),r=n.childAfter(e);return s&&r&&s.to<=e&&r.from>=e&&(i=s.type.prop(ho.closedBy))&&i.indexOf(r.name)>-1&&t.doc.lineAt(s.to).from==t.doc.lineAt(r.from).from?{from:s.to,to:r.from}:null}(i,s);e&&(s=r=(r<=o.to?o:i.doc.lineAt(r)).to);let l=new ja(i,{simulateBreak:s,simulateDoubleBreak:!!a}),h=Ba(l,s);for(null==h&&(h=/^\s*/.exec(i.doc.lineAt(s).text)[0].length);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:A.range(r.mapPos(n.anchor,1),r.mapPos(n.head,1))}}))}const Rc=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{i.push({from:e.from,insert:t.facet(La)})})),{userEvent:"input.indent"})),!0),Ec=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{let n=/^\s*/.exec(e.text)[0];if(!n)return;let s=Yt(n,t.tabSize),r=0,o=Ia(t,Math.max(0,s-za(t)));for(;rqh(t,(e=>Fh(t.state,e,!Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,!Ih(t))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:t=>qh(t,(e=>Fh(t.state,e,Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,Ih(t))))},{key:"Alt-ArrowUp",run:({state:t,dispatch:e})=>_c(t,e,!1)},{key:"Shift-Alt-ArrowUp",run:({state:t,dispatch:e})=>Xc(t,e,!1)},{key:"Alt-ArrowDown",run:({state:t,dispatch:e})=>_c(t,e,!0)},{key:"Shift-Alt-ArrowDown",run:({state:t,dispatch:e})=>Xc(t,e,!0)},{key:"Escape",run:({state:t,dispatch:e})=>{let i=t.selection,n=null;return i.ranges.length>1?n=A.create([i.main]):i.main.empty||(n=A.create([A.cursor(i.main.head)])),!!n&&(e(Yh(t,n)),!0)}},{key:"Mod-Enter",run:Ac(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:t,dispatch:e})=>{let i=Cc(t).map((({from:e,to:i})=>A.range(e,Math.min(i+1,t.doc.length))));return e(t.update({selection:A.create(i),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:t,dispatch:e})=>{let i=Uh(t.selection,(e=>{var i;let n=Xa(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 A.range(n.to,n.from)}));return e(Yh(t,i)),!0},preventDefault:!0},{key:"Mod-[",run:Ec},{key:"Mod-]",run:Rc},{key:"Mod-Alt-\\",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new ja(t,{overrideIndentation:t=>{let e=i[t];return null==e?-1:e}}),s=Tc(t,((e,s,r)=>{let o=Ba(n,e.from);if(null==o)return;/\S/.test(e.text)||(o=0);let a=/^\s*/.exec(e.text)[0],l=Ia(t,o);(a!=l||r.from{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(Cc(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=Uh(t.selection,(e=>{let s=Ll(t,e.head,-1)||Ll(t,e.head,1)||e.head>0&&Ll(t,e.head-1,1)||e.head{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=fh(t.state,i.from);return n.line?ch(t):!!n.block&&dh(t)}},{key:"Alt-A",run:uh}].concat([{key:"ArrowLeft",run:Bh,shift:ac,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:t=>Nh(t,!Ih(t)),shift:t=>hc(t,!Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:t=>qh(t,(e=>sc(t,e,!Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,!Ih(t)))),preventDefault:!0},{key:"ArrowRight",run:jh,shift:lc,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:t=>Nh(t,Ih(t)),shift:t=>hc(t,Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:t=>qh(t,(e=>sc(t,e,Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,Ih(t)))),preventDefault:!0},{key:"ArrowUp",run:Jh,shift:uc,preventDefault:!0},{mac:"Cmd-ArrowUp",run:gc,shift:bc},{mac:"Ctrl-ArrowUp",run:ic,shift:pc},{key:"ArrowDown",run:Kh,shift:dc,preventDefault:!0},{mac:"Cmd-ArrowDown",run:mc,shift:wc},{mac:"Ctrl-ArrowDown",run:nc,shift:Oc},{key:"PageUp",run:ic,shift:pc},{key:"PageDown",run:nc,shift:Oc},{key:"Home",run:t=>qh(t,(e=>sc(t,e,!1))),shift:t=>rc(t,(e=>sc(t,e,!1))),preventDefault:!0},{key:"Mod-Home",run:gc,shift:bc},{key:"End",run:t=>qh(t,(e=>sc(t,e,!0))),shift:t=>rc(t,(e=>sc(t,e,!0))),preventDefault:!0},{key:"Mod-End",run:mc,shift:wc},{key:"Enter",run:Zc},{key:"Mod-a",run:({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:xc,shift:xc},{key:"Delete",run:kc},{key:"Mod-Backspace",mac:"Alt-Backspace",run:$c},{key:"Mod-Delete",mac:"Alt-Delete",run:t=>Qc(t,!0)},{mac:"Mod-Backspace",run:t=>vc(t,(e=>{let i=t.lineBlockAt(e).from;return e>i?i:Math.max(0,e-1)}))},{mac:"Mod-Delete",run:Pc}].concat([{key:"Ctrl-b",run:Bh,shift:ac,preventDefault:!0},{key:"Ctrl-f",run:jh,shift:lc},{key:"Ctrl-p",run:Jh,shift:uc},{key:"Ctrl-n",run:Kh,shift:dc},{key:"Ctrl-a",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).from,1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).from)))},{key:"Ctrl-e",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).to,-1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).to)))},{key:"Ctrl-d",run:kc},{key:"Ctrl-h",run:xc},{key:"Ctrl-k",run:Pc},{key:"Ctrl-Alt-h",run:$c},{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:A.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:f(n.text,i-n.from,!1)+n.from,r=i==n.to?i+1:f(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:A.cursor(r)}}));return!i.changes.empty&&(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:nc}].map((t=>({mac:t.key,run:t.run,shift:t.shift}))))),Mc={key:"Tab",run:Rc,shift:Ec};function Dc(){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 Yc{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(Uc(t)):Uc,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 b(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=w(t),i=this.bufferStart+this.bufferPos;this.bufferPos+=v(t);let n=this.normalize(e);for(let t=0,s=i;;t++){let r=n.charCodeAt(t),o=this.match(r,s);if(o)return this.value=o,this;if(t==n.length-1)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=Nc(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 Bc(e,t.sliceString(e,i));return Ic.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=Nc(this.text,i+(t==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Bc.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function Nc(t,e){if(e>=t.length)return e;let i,n=t.lineAt(e);for(;e=56320&&i<57344;)e++;return e}function Gc(t){let e=Dc("input",{class:"cm-textfield",name:"line"});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,a,l]=i,h=a?+a.slice(1):0,c=o?+o:s.number;if(o&&l){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)));t.dispatch({effects:Fc.of(!1),selection:A.cursor(u.from+Math.max(0,Math.min(h,u.length))),scrollIntoView:!0}),t.focus()}return{dom:Dc("form",{class:"cm-gotoLine",onkeydown:e=>{27==e.keyCode?(e.preventDefault(),t.dispatch({effects:Fc.of(!1)}),t.focus()):13==e.keyCode&&(e.preventDefault(),i())},onsubmit:t=>{t.preventDefault(),i()}},Dc("label",t.state.phrase("Go to line"),": ",e)," ",Dc("button",{class:"cm-button",type:"submit"},t.state.phrase("go")))}}"undefined"!=typeof Symbol&&(zc.prototype[Symbol.iterator]=jc.prototype[Symbol.iterator]=function(){return this});const Fc=ut.define(),Hc=q.define({create:()=>!0,update(t,e){for(let i of e.effects)i.is(Fc)&&(t=i.value);return t},provide:t=>Ur.from(t,(t=>t?Gc:null))}),Jc=Ts.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),Kc={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},tu=E.define({combine:t=>kt(t,Kc,{highlightWordAroundCursor:(t,e)=>t||e,minSelectionLength:Math.min,maxMatches:Math.min})});function eu(t){let e=[ou,ru];return t&&e.push(tu.of(t)),e}const iu=ni.mark({class:"cm-selectionMatch"}),nu=ni.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function su(t,e,i,n){return!(0!=i&&t(e.sliceDoc(i-1,i))==wt.Word||n!=e.doc.length&&t(e.sliceDoc(n,n+1))==wt.Word)}const ru=_i.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(tu),{state:i}=t,n=i.selection;if(n.ranges.length>1)return ni.none;let s,r=n.main,o=null;if(r.empty){if(!e.highlightWordAroundCursor)return ni.none;let t=i.wordAt(r.head);if(!t)return ni.none;o=i.charCategorizer(r.head),s=i.sliceDoc(t.from,t.to)}else{let t=r.to-r.from;if(t200)return ni.none;if(e.wholeWords){if(s=i.sliceDoc(r.from,r.to),o=i.charCategorizer(r.head),!su(o,i,r.from,r.to)||!function(t,e,i,n){return t(e.sliceDoc(i,i+1))==wt.Word&&t(e.sliceDoc(n-1,n))==wt.Word}(o,i,r.from,r.to))return ni.none}else if(s=i.sliceDoc(r.from,r.to).trim(),!s)return ni.none}let a=[];for(let n of t.visibleRanges){let t=new Yc(i.doc,s,n.from,n.to);for(;!t.next().done;){let{from:n,to:s}=t.value;if((!o||su(o,i,n,s))&&(r.empty&&n<=r.from&&s>=r.to?a.push(nu.range(n,s)):(n>=r.to||s<=r.from)&&a.push(iu.range(n,s)),a.length>e.maxMatches))return ni.none}}return ni.set(a)}},{decorations:t=>t.decorations}),ou=Ts.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});const au=E.define({combine:t=>kt(t,{top:!1,caseSensitive:!1,literal:!1,wholeWord:!1,createPanel:t=>new Vu(t),scrollToMatch:t=>Ts.scrollIntoView(t)})});class lu{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,Lc),!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 Ou(this):new uu(this)}getCursor(t,e=0,i){let n=t.doc?t:xt.create({doc:t});return null==i&&(i=n.doc.length),this.regexp?du(this,n,e,i):cu(this,n,e,i)}}class hu{constructor(t){this.spec=t}}function cu(t,e,i,n){return new Yc(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=cu(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 du(t,e,i,n){return new zc(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?(s=e.charCategorizer(e.selection.main.head),(t,e,i)=>!i[0].length||(s(fu(i.input,i.index))!=wt.Word||s(pu(i.input,i.index))!=wt.Word)&&(s(pu(i.input,i.index+i[0].length))!=wt.Word||s(fu(i.input,i.index+i[0].length))!=wt.Word)):void 0},i,n);var s}function fu(t,e){return t.slice(f(t,e,!1),e)}function pu(t,e){return t.slice(e,f(t,e))}class Ou extends hu{nextMatch(t,e,i){let n=du(this.spec,t,i,t.doc.length).next();return n.done&&(n=du(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=du(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=du(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 gu=ut.define(),mu=ut.define(),bu=q.define({create:t=>new wu(Xu(t).create(),null),update(t,e){for(let i of e.effects)i.is(gu)?t=new wu(i.value.create(),t.panel):i.is(mu)&&(t=new wu(t.query,i.value?_u:null));return t},provide:t=>Ur.from(t,(t=>t.panel))});class wu{constructor(t,e){this.query=t,this.panel=e}}const vu=ni.mark({class:"cm-searchMatch"}),Su=ni.mark({class:"cm-searchMatch cm-searchMatch-selected"}),yu=_i.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(bu))}update(t){let e=t.state.field(bu);(e!=t.startState.field(bu)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ni.none;let{view:i}=this,n=new Xt;for(let e=0,s=i.visibleRanges,r=s.length;es[e+1].from-500;)a=s[++e].to;t.highlight(i.state,o,a,((t,e)=>{let s=i.state.selection.ranges.some((i=>i.from==t&&i.to==e));n.add(t,e,s?Su:vu)}))}return n.finish()}},{decorations:t=>t.decorations});function xu(t){return e=>{let i=e.state.field(bu,!1);return i&&i.query.spec.valid?t(e,i):Tu(e)}}const ku=xu(((t,{query:e})=>{let{to:i}=t.state.selection.main,n=e.nextMatch(t.state,i,i);if(!n)return!1;let s=A.single(n.from,n.to),r=t.state.facet(au);return t.dispatch({selection:s,effects:[Uu(t,n),r.scrollToMatch(s.main,t)],userEvent:"select.search"}),Au(t),!0})),Qu=xu(((t,{query:e})=>{let{state:i}=t,{from:n}=i.selection.main,s=e.prevMatch(i,n,n);if(!s)return!1;let r=A.single(s.from,s.to),o=t.state.facet(au);return t.dispatch({selection:r,effects:[Uu(t,s),o.scrollToMatch(r.main,t)],userEvent:"select.search"}),Au(t),!0})),$u=xu(((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!(!i||!i.length)&&(t.dispatch({selection:A.create(i.map((t=>A.range(t.from,t.to)))),userEvent:"select.search.matches"}),!0)})),Pu=xu(((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,a,l=[],h=[];if(r.from==n&&r.to==s&&(a=i.toText(e.getReplacement(r)),l.push({from:r.from,to:r.to,insert:a}),r=e.nextMatch(i,r.from,r.to),h.push(Ts.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(n).number)+"."))),r){let e=0==l.length||l[0].from>=r.to?0:r.to-r.from-a.length;o=A.single(r.from-e,r.to-e),h.push(Uu(t,r)),h.push(i.facet(au).scrollToMatch(o.main,t))}return t.dispatch({changes:l,selection:o,effects:h,userEvent:"input.replace"}),!0})),Cu=xu(((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:Ts.announce.of(n),userEvent:"input.replace.all"}),!0}));function _u(t){return t.state.facet(au).createPanel(t)}function Xu(t,e){var i,n,s,r;let o=t.selection.main,a=o.empty||o.to>o.from+100?"":t.sliceDoc(o.from,o.to);if(e&&!a)return e;let l=t.facet(au);return new lu({search:(null!==(i=null==e?void 0:e.literal)&&void 0!==i?i:l.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:null!==(n=null==e?void 0:e.caseSensitive)&&void 0!==n?n:l.caseSensitive,literal:null!==(s=null==e?void 0:e.literal)&&void 0!==s?s:l.literal,wholeWord:null!==(r=null==e?void 0:e.wholeWord)&&void 0!==r?r:l.wholeWord})}function Zu(t){let e=Vr(t,_u);return e&&e.dom.querySelector("[main-field]")}function Au(t){let e=Zu(t);e&&e==t.root.activeElement&&e.select()}const Tu=t=>{let e=t.state.field(bu,!1);if(e&&e.panel){let i=Zu(t);if(i&&i!=t.root.activeElement){let n=Xu(t.state,e.query.spec);n.valid&&t.dispatch({effects:gu.of(n)}),i.focus(),i.select()}}else t.dispatch({effects:[mu.of(!0),e?gu.of(Xu(t.state,e.query.spec)):ut.appendConfig.of(qu)]});return!0},Ru=t=>{let e=t.state.field(bu,!1);if(!e||!e.panel)return!1;let i=Vr(t,_u);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:mu.of(!1)}),!0},Eu=[{key:"Mod-f",run:Tu,scope:"editor search-panel"},{key:"F3",run:ku,shift:Qu,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:ku,shift:Qu,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Ru,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 Yc(t.doc,t.sliceDoc(n,s));!e.next().done;){if(r.length>1e3)return!1;e.value.from==n&&(o=r.length),r.push(A.range(e.value.from,e.value.to))}return e(t.update({selection:A.create(r,o),userEvent:"select.search.matches"})),!0}},{key:"Alt-g",run:t=>{let e=Vr(t,Gc);if(!e){let i=[Fc.of(!0)];null==t.state.field(Hc,!1)&&i.push(ut.appendConfig.of([Hc,Jc])),t.dispatch({effects:i}),e=Vr(t,Gc)}return e&&e.dom.querySelector("input").focus(),!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=A.create(i.ranges.map((e=>t.wordAt(e.head)||A.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 Yc(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 Yc(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(A.range(s.from,s.to),!1),effects:Ts.scrollIntoView(s.to)})),!0)},preventDefault:!0}];class Vu{constructor(t){this.view=t;let e=this.query=t.state.field(bu).query.spec;function i(t,e,i){return Dc("button",{class:"cm-button",name:t,onclick:e,type:"button"},i)}this.commit=this.commit.bind(this),this.searchField=Dc("input",{value:e.search,placeholder:Mu(t,"Find"),"aria-label":Mu(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Dc("input",{value:e.replace,placeholder:Mu(t,"Replace"),"aria-label":Mu(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Dc("input",{type:"checkbox",name:"case",form:"",checked:e.caseSensitive,onchange:this.commit}),this.reField=Dc("input",{type:"checkbox",name:"re",form:"",checked:e.regexp,onchange:this.commit}),this.wordField=Dc("input",{type:"checkbox",name:"word",form:"",checked:e.wholeWord,onchange:this.commit}),this.dom=Dc("div",{onkeydown:t=>this.keydown(t),class:"cm-search"},[this.searchField,i("next",(()=>ku(t)),[Mu(t,"next")]),i("prev",(()=>Qu(t)),[Mu(t,"previous")]),i("select",(()=>$u(t)),[Mu(t,"all")]),...t.state.readOnly?[]:[Dc("br"),this.replaceField,i("replace",(()=>Pu(t)),[Mu(t,"replace")]),i("replaceAll",(()=>Cu(t)),[Mu(t,"replace all")])],Dc("button",{name:"close",onclick:()=>Ru(t),"aria-label":Mu(t,"close"),type:"button"},["×"])])}commit(){let t=new lu({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:gu.of(t)}))}keydown(t){var e,i,n;e=this.view,i=t,n="search-panel",Bs(Ls(e.state),i,e,n)?t.preventDefault():13==t.keyCode&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?Qu:ku)(this.view)):13==t.keyCode&&t.target==this.replaceField&&(t.preventDefault(),Pu(this.view))}update(t){for(let e of t.transactions)for(let t of e.effects)t.is(gu)&&!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(au).top}}function Mu(t,e){return t.state.phrase(e)}const Du=30,Wu=/[\s\.,:;?!]/;function Uu(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-Du),o=Math.min(s,i+Du),a=t.state.sliceDoc(r,o);if(r!=n.from)for(let t=0;ta.length-Du;t--)if(!Wu.test(a[t-1])&&Wu.test(a[t])){a=a.slice(0,t);break}return Ts.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${n.number}.`)}const Yu=Ts.baseTheme({".cm-panel.cm-search":{padding:"0.25rem 0.5rem 0.25rem 0.5rem",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"0.5rem",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"}}),qu=[bu,N.lowest(yu),Yu];class Lu{constructor(t,e,i){this.state=t,this.pos=e,this.explicit=i,this.abortListeners=[]}tokenBefore(t){let e=Xa(this.state).resolveInner(this.pos,-1);for(;e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null}matchBefore(t){let e=this.state.doc.lineAt(this.pos),i=Math.max(e.from,this.pos-250),n=e.text.slice(i-e.from,this.pos-e.from),s=n.search(Nu(t,!1));return s<0?null:{from:i+s,to:this.pos,text:n.slice(s)}}get aborted(){return null==this.abortListeners}addEventListener(t,e){"abort"==t&&this.abortListeners&&this.abortListeners.push(e)}}function zu(t){let e=Object.keys(t).join(""),i=/\w/.test(e);return i&&(e=e.replace(/\w/g,"")),`[${i?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function Iu(t){let e=t.map((t=>"string"==typeof t?{label:t}:t)),[i,n]=e.every((t=>/^\w+$/.test(t.label)))?[/\w*$/,/\w+$/]:function(t){let e=Object.create(null),i=Object.create(null);for(let{label:n}of t){e[n[0]]=!0;for(let t=1;t{let s=t.matchBefore(n);return s||t.explicit?{from:s?s.from:t.pos,options:e,validFor:i}:null}}class Bu{constructor(t,e,i,n){this.completion=t,this.source=e,this.match=i,this.score=n}}function ju(t){return t.selection.main.from}function Nu(t,e){var i;let{source:n}=t,s=e&&"^"!=n[0],r="$"!=n[n.length-1];return s||r?new RegExp(`${s?"^":""}(?:${n})${r?"$":""}`,null!==(i=t.flags)&&void 0!==i?i:t.ignoreCase?"i":""):t}const Gu=lt.define();const Fu=new WeakMap;function Hu(t){if(!Array.isArray(t))return t;let e=Fu.get(t);return e||Fu.set(t,e=Iu(t)),e}const Ju=ut.define(),Ku=ut.define();class td{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[];for(let e=0;e=48&&l<=57||l>=97&&l<=122?2:l>=65&&l<=90?1:0:(S=w(l))!=S.toLowerCase()?1:S!=S.toUpperCase()?2:0;(!n||1==y&&O||0==m&&0!=y)&&(e[c]==l||i[c]==l&&(u=!0)?r[c++]=n:r.length&&(g=!1)),m=y,n+=v(l)}return c==a&&0==r[0]&&g?this.result((u?-200:0)-100,r,t):d==a&&0==f?[-200-t.length+(p==t.length?0:-100),0,p]:o>-1?[-700-t.length,o,o+this.pattern.length]:d==a?[-900-t.length,f,p]:c==a?this.result((u?-200:0)-100-700+(g?0:-1100),r,t):2==e.length?null:this.result((n[0]?-700:0)-200-1100,n,t)}result(t,e,i){let n=[t-i.length],s=1;for(let t of e){let e=t+(this.astral?v(b(i,t)):1);s>1&&n[s-1]==t?n[s-1]=e:(n[s++]=t,n[s++]=e)}return n}}const ed=E.define({combine:t=>kt(t,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:nd,compareCompletions:(t,e)=>t.label.localeCompare(e.label),interactionDelay:75},{defaultKeymap:(t,e)=>t&&e,closeOnBlur:(t,e)=>t&&e,icons:(t,e)=>t&&e,tooltipClass:(t,e)=>i=>id(t(i),e(i)),optionClass:(t,e)=>i=>id(t(i),e(i)),addToOptions:(t,e)=>t.concat(e)})});function id(t,e){return t?e?t+" "+e:t:e}function nd(t,e,i,n,s){let r,o,a=t.textDirection==Wi.RTL,l=a,h=!1,c="top",u=e.left-s.left,d=s.right-e.right,f=n.right-n.left,p=n.bottom-n.top;if(l&&u=p||t>e.top?r=i.bottom-e.top:(c="bottom",r=e.bottom-i.top)}return{style:`${c}: ${r}px; max-width: ${o}px`,class:"cm-completionInfo-"+(h?a?"left-narrow":"right-narrow":l?"left":"right")}}function sd(t,e="option"){return i=>{let n=i.state.field(Sd,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp-1?n.open.selected+r*(t?1:-1):t?0:o-1;return a<0?a="page"==e?0:o-1:a>=o&&(a="page"==e?o-1:0),i.dispatch({effects:vd.of(a)}),!0}}class rd{constructor(t,e){this.active=t,this.context=e,this.time=Date.now(),this.updates=[],this.done=void 0}}const od=_i.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.composing=0;for(let e of t.state.field(Sd).active)1==e.state&&this.startQuery(e)}update(t){let e=t.state.field(Sd);if(!t.selectionSet&&!t.docChanged&&t.startState.field(Sd)==e)return;let i=t.transactions.some((t=>(t.selection||t.docChanged)&&!gd(t)));for(let e=0;e50&&Date.now()-n.time>1e3){for(let t of n.context.abortListeners)try{t()}catch(t){Qi(this.view.state,t)}n.context.abortListeners=null,this.running.splice(e--,1)}else n.updates.push(...t.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some((t=>1==t.state&&!this.running.some((e=>e.active.source==t.source))))?setTimeout((()=>this.startUpdate()),50):-1,0!=this.composing)for(let e of t.transactions)"input"==gd(e)?this.composing=2:2==this.composing&&e.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:t}=this.view,e=t.field(Sd);for(let t of e.active)1!=t.state||this.running.some((e=>e.active.source==t.source))||this.startQuery(t)}startQuery(t){let{state:e}=this.view,i=ju(e),n=new Lu(e,i,t.explicitPos==i),s=new rd(t,n);this.running.push(s),Promise.resolve(t.source(n)).then((t=>{s.context.aborted||(s.done=t||null,this.scheduleAccept())}),(t=>{this.view.dispatch({effects:Ku.of(null)}),Qi(this.view.state,t)}))}scheduleAccept(){this.running.every((t=>void 0!==t.done))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((()=>this.accept()),50))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],i=this.view.state.facet(ed);for(let n=0;nt.source==s.active.source));if(r&&1==r.state)if(null==s.done){let t=new md(s.active.source,0);for(let e of s.updates)t=t.update(e,i);1!=t.state&&e.push(t)}else this.startQuery(r)}e.length&&this.view.dispatch({effects:wd.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(Sd,!1);if(e&&e.tooltip&&this.view.state.facet(ed).closeOnBlur){let i=e.open&&Rr(this.view,e.open.tooltip);i&&i.dom.contains(t.relatedTarget)||this.view.dispatch({effects:Ku.of(null)})}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout((()=>this.view.dispatch({effects:Ju.of(!1)})),20),this.composing=0}}});function ad(t,e){const i=e.completion.apply||e.completion.label;let n=t.state.field(Sd).active.find((t=>t.source==e.source));return n instanceof bd&&("string"==typeof i?t.dispatch(Object.assign(Object.assign({},function(t,e,i,n){let{main:s}=t.selection,r=i-s.from,o=n-s.from;return Object.assign(Object.assign({},t.changeByRange((a=>a!=s&&i!=n&&t.sliceDoc(a.from+r,a.from+o)!=t.sliceDoc(i,n)?{range:a}:{changes:{from:a.from+r,to:n==s.from?a.to:a.from+o,insert:e},range:A.cursor(a.from+r+e.length)}))),{userEvent:"input.complete"})}(t.state,i,n.from,n.to)),{annotations:Gu.of(e.completion)})):i(t,e.completion,n.from,n.to),!0)}function ld(t,e,i){if(t<=i)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let t=Math.floor(e/i);return{from:t*i,to:(t+1)*i}}let n=Math.floor((t-e)/i);return{from:t-(n+1)*i,to:t-n*i}}class hd{constructor(t,e){this.view=t,this.stateField=e,this.info=null,this.placeInfoReq={read:()=>this.measureInfo(),write:t=>this.placeInfo(t),key:this},this.space=null,this.currentClass="";let i=t.state.field(e),{options:n,selected:s}=i.open,r=t.state.facet(ed);this.optionContent=function(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(t){let e=document.createElement("div");return e.classList.add("cm-completionIcon"),t.type&&e.classList.add(...t.type.split(/\s+/g).map((t=>"cm-completionIcon-"+t))),e.setAttribute("aria-hidden","true"),e},position:20}),e.push({render(t,e,i){let n=document.createElement("span");n.className="cm-completionLabel";let{label:s}=t,r=0;for(let t=1;tr&&n.appendChild(document.createTextNode(s.slice(r,e)));let a=n.appendChild(document.createElement("span"));a.appendChild(document.createTextNode(s.slice(e,o))),a.className="cm-completionMatchedText",r=o}return rt.position-e.position)).map((t=>t.render))}(r),this.optionClass=r.optionClass,this.tooltipClass=r.tooltipClass,this.range=ld(n.length,s,r.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",(e=>{for(let i,s=e.target;s&&s!=this.dom;s=s.parentNode)if("LI"==s.nodeName&&(i=/-(\d+)$/.exec(s.id))&&+i[1]{let i=t.state.field(this.stateField,!1);i&&i.tooltip&&t.state.facet(ed).closeOnBlur&&e.relatedTarget!=t.contentDOM&&t.dispatch({effects:Ku.of(null)})})),this.list=this.dom.appendChild(this.createListBox(n,i.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))}mount(){this.updateSel()}update(t){var e,i,n;let s=t.state.field(this.stateField),r=t.startState.field(this.stateField);this.updateTooltipClass(t.state),s!=r&&(this.updateSel(),(null===(e=s.open)||void 0===e?void 0:e.disabled)!=(null===(i=r.open)||void 0===i?void 0:i.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!(null===(n=s.open)||void 0===n?void 0:n.disabled)))}updateTooltipClass(t){let e=this.tooltipClass(t);if(e!=this.currentClass){for(let t of this.currentClass.split(" "))t&&this.dom.classList.remove(t);for(let t of e.split(" "))t&&this.dom.classList.add(t);this.currentClass=e}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),e=t.open;if((e.selected>-1&&e.selected=this.range.to)&&(this.range=ld(e.options.length,e.selected,this.view.state.facet(ed).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e.options,t.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))),this.updateSelectedOption(e.selected)){this.info&&(this.info.remove(),this.info=null);let{completion:i}=e.options[e.selected],{info:n,label:s,c:r}=i;if(!n)return;let o="string"==typeof n?document.createTextNode(n+" "):n(i);if(!o)return;if(!r){const t=document.createElement("span");t.appendChild(o),o=t;const e=document.createElement("a");e.innerText="🔎",e.href="/docFind/"+s,e.target="blank",o.appendChild(e)}if(!o)return;"then"in o?o.then((e=>{e&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(e)})).catch((t=>Qi(this.view.state,t,"completion info"))):this.addInfoPane(o)}}addInfoPane(t){let e=this.info=document.createElement("div");e.className="cm-tooltip cm-completionInfo",e.appendChild(t),this.dom.appendChild(e),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let e=null;for(let i=this.list.firstChild,n=this.range.from;i;i=i.nextSibling,n++)"LI"==i.nodeName&&i.id?n==t?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),e=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected"):n--;return e&&function(t,e){let i=t.getBoundingClientRect(),n=e.getBoundingClientRect();n.topi.bottom&&(t.scrollTop+=n.bottom-i.bottom)}(this.list,e),e}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let e=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),n=t.getBoundingClientRect(),s=this.space;if(!s){let t=this.dom.ownerDocument.defaultView||window;s={left:0,top:0,right:t.innerWidth,bottom:t.innerHeight}}return n.top>Math.min(s.bottom,e.bottom)-10||n.bottomi.from||0==i.from))if(s=t,"string"!=typeof l&&l.header)n.appendChild(l.header(l));else{n.appendChild(document.createElement("completion-section")).textContent=t}}const h=n.appendChild(document.createElement("li"));h.id=e+"-"+r,h.setAttribute("role","option");let c=this.optionClass(o);c&&(h.className=c);for(let t of this.optionContent){let e=t(o,this.view.state,a);e&&h.appendChild(e)}}return i.from&&n.classList.add("cm-completionListIncompleteTop"),i.to=this.options.length?this:new ud(this.options,pd(e,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,e,i,n,s){let r=function(t,e){let i=[],n=null,s=t=>{i.push(t);let{section:e}=t.completion;if(e){n||(n=[]);let t="string"==typeof e?e:e.name;n.some((e=>e.name==t))||n.push("string"==typeof e?{name:t}:e)}};for(let n of t)if(n.hasResult())if(!1===n.result.filter){let t=n.result.getMatch;for(let e of n.result.options){let r=[1e9-i.length];if(t)for(let i of t(e))r.push(i);s(new Bu(e,n.source,r,r[0]))}}else{let t,i=new td(e.sliceDoc(n.from,n.to));for(let e of n.result.options)(t=i.match(e.label))&&s(new Bu(e,n.source,t,t[0]+(e.boost||0)))}if(n){let t=Object.create(null),e=0,s=(t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:1e9)-(null!==(n=e.rank)&&void 0!==n?n:1e9)||(t.namee.score-t.score||a(t.completion,e.completion))))!o||o.label!=t.completion.label||o.detail!=t.completion.detail||null!=o.type&&null!=t.completion.type&&o.type!=t.completion.type||o.apply!=t.completion.apply?r.push(t):cd(t.completion)>cd(o)&&(r[r.length-1]=t),o=t.completion;return r}(t,e);if(!r.length)return n&&t.some((t=>1==t.state))?new ud(n.options,n.attrs,n.tooltip,n.timestamp,n.selected,!0):null;let o=e.facet(ed).selectOnOpen?0:-1;if(n&&n.selected!=o&&-1!=n.selected){let t=n.options[n.selected].completion;for(let e=0;ee.hasResult()?Math.min(t,e.from):t),1e8),create:(a=Sd,t=>new hd(t,a)),above:s.aboveCursor},n?n.timestamp:Date.now(),o,!1);var a}map(t){return new ud(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class dd{constructor(t,e,i){this.active=t,this.id=e,this.open=i}static start(){return new dd(Od,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(t){let{state:e}=t,i=e.facet(ed),n=(i.override||e.languageDataAt("autocomplete",ju(e)).map(Hu)).map((e=>(this.active.find((t=>t.source==e))||new md(e,this.active.some((t=>0!=t.state))?1:0)).update(t,i)));n.length==this.active.length&&n.every(((t,e)=>t==this.active[e]))&&(n=this.active);let s=this.open;s&&t.docChanged&&(s=s.map(t.changes)),t.selection||n.some((e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to)))||!function(t,e){if(t==e)return!0;for(let i=0,n=0;;){for(;i1==t.state))&&(s=null),!s&&n.every((t=>1!=t.state))&&n.some((t=>t.hasResult()))&&(n=n.map((t=>t.hasResult()?new md(t.source,0):t)));for(let e of t.effects)e.is(vd)&&(s=s&&s.setSelected(e.value,this.id));return n==this.active&&s==this.open?this:new dd(n,this.id,s)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:fd}}const fd={"aria-autocomplete":"list"};function pd(t,e){let i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(i["aria-activedescendant"]=t+"-"+e),i}const Od=[];function gd(t){return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null}class md{constructor(t,e,i=-1){this.source=t,this.state=e,this.explicitPos=i}hasResult(){return!1}update(t,e){let i=gd(t),n=this;i?n=n.handleUserEvent(t,i,e):t.docChanged?n=n.handleChange(t):t.selection&&0!=n.state&&(n=new md(n.source,0));for(let e of t.effects)if(e.is(Ju))n=new md(n.source,1,e.value?ju(t.state):-1);else if(e.is(Ku))n=new md(n.source,0);else if(e.is(wd))for(let t of e.value)t.source==n.source&&(n=t);return n}handleUserEvent(t,e,i){return"delete"!=e&&i.activateOnTyping?new md(this.source,1):this.map(t.changes)}handleChange(t){return t.changes.touchesRange(ju(t.startState))?new md(this.source,0):this.map(t.changes)}map(t){return t.empty||this.explicitPos<0?this:new md(this.source,this.state,t.mapPos(this.explicitPos))}}class bd extends md{constructor(t,e,i,n,s){super(t,2,e),this.result=i,this.from=n,this.to=s}hasResult(){return!0}handleUserEvent(t,e,i){var n;let s=t.changes.mapPos(this.from),r=t.changes.mapPos(this.to,1),o=ju(t.state);if((this.explicitPos<0?o<=s:or||"delete"==e&&ju(t.startState)==this.from)return new md(this.source,"input"==e&&i.activateOnTyping?1:0);let a,l=this.explicitPos<0?-1:t.changes.mapPos(this.explicitPos);return function(t,e,i,n){if(!t)return!1;let s=e.sliceDoc(i,n);return"function"==typeof t?t(s,i,n,e):Nu(t,!0).test(s)}(this.result.validFor,t.state,s,r)?new bd(this.source,l,this.result,s,r):this.result.update&&(a=this.result.update(this.result,s,r,new Lu(t.state,o,l>=0)))?new bd(this.source,l,a,a.from,null!==(n=a.to)&&void 0!==n?n:ju(t.state)):new md(this.source,1,l)}handleChange(t){return t.changes.touchesRange(this.from,this.to)?new md(this.source,0):this.map(t.changes)}map(t){return t.empty?this:new bd(this.source,this.explicitPos<0?-1:t.mapPos(this.explicitPos),this.result,t.mapPos(this.from),t.mapPos(this.to,1))}}const wd=ut.define({map:(t,e)=>t.map((t=>t.map(e)))}),vd=ut.define(),Sd=q.define({create:()=>dd.start(),update:(t,e)=>t.update(e),provide:t=>[Tr.from(t,(t=>t.tooltip)),Ts.contentAttributes.from(t,(t=>t.attrs))]}),yd=Ts.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class xd{constructor(t,e,i,n){this.field=t,this.line=e,this.from=i,this.to=n}}class kd{constructor(t,e,i){this.field=t,this.from=e,this.to=i}map(t){let e=t.mapPos(this.from,-1,y.TrackDel),i=t.mapPos(this.to,1,y.TrackDel);return null==e||null==i?null:new kd(this.field,e,i)}}class Qd{constructor(t,e){this.lines=t,this.fieldPositions=e}instantiate(t,e){let i=[],n=[e],s=t.doc.lineAt(e),r=/^\s*/.exec(s.text)[0];for(let s of this.lines){if(i.length){let i=r,o=/^\t*/.exec(s)[0].length;for(let e=0;enew kd(t.field,n[t.line]+t.from,n[t.line]+t.to)));return{text:i,ranges:o}}static parse(t){let e,i=[],n=[],s=[];for(let r of t.split(/\r\n?|\n/)){for(;e=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(r);){let t=e[1]?+e[1]:null,o=e[2]||e[3]||"",a=-1;for(let e=0;e=a&&t.field++}s.push(new xd(a,n.length,e.index,e.index+o.length)),r=r.slice(0,e.index)+o+r.slice(e.index+e[0].length)}for(let t;t=/\\([{}])/.exec(r);){r=r.slice(0,t.index)+t[1]+r.slice(t.index+t[0].length);for(let e of s)e.line==n.length&&e.from>t.index&&(e.from--,e.to--)}n.push(r)}return new Qd(n,s)}}let $d=ni.widget({widget:new class extends ei{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),Pd=ni.mark({class:"cm-snippetField"});class Cd{constructor(t,e){this.ranges=t,this.active=e,this.deco=ni.set(t.map((t=>(t.from==t.to?$d:Pd).range(t.from,t.to))))}map(t){let e=[];for(let i of this.ranges){let n=i.map(t);if(!n)return null;e.push(n)}return new Cd(e,this.active)}selectionInsideField(t){return t.ranges.every((t=>this.ranges.some((e=>e.field==this.active&&e.from<=t.from&&e.to>=t.to))))}}const _d=ut.define({map:(t,e)=>t&&t.map(e)}),Xd=ut.define(),Zd=q.define({create:()=>null,update(t,e){for(let i of e.effects){if(i.is(_d))return i.value;if(i.is(Xd)&&t)return new Cd(t.ranges,i.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>Ts.decorations.from(t,(t=>t?t.deco:ni.none))});function Ad(t,e){return A.create(t.filter((t=>t.field==e)).map((t=>A.range(t.from,t.to))))}function Td(e){let i=Qd.parse(e);return(e,n,s,r)=>{let{text:o,ranges:a}=i.instantiate(e.state,s),l={changes:{from:s,to:r,insert:t.of(o)},scrollIntoView:!0,annotations:n?Gu.of(n):void 0};if(a.length&&(l.selection=Ad(a,0)),a.length>1){let t=new Cd(a,0),i=l.effects=[_d.of(t)];void 0===e.state.field(Zd,!1)&&i.push(ut.appendConfig.of([Zd,Md,Wd,yd]))}e.dispatch(e.state.update(l))}}function Rd(t){return({state:e,dispatch:i})=>{let n=e.field(Zd,!1);if(!n||t<0&&0==n.active)return!1;let s=n.active+t,r=t>0&&!n.ranges.some((e=>e.field==s+t));return i(e.update({selection:Ad(n.ranges,s),effects:_d.of(r?null:new Cd(n.ranges,s))})),!0}}const Ed=[{key:"Tab",run:Rd(1),shift:Rd(-1)},{key:"Escape",run:({state:t,dispatch:e})=>!!t.field(Zd,!1)&&(e(t.update({effects:_d.of(null)})),!0)}],Vd=E.define({combine:t=>t.length?t[0]:Ed}),Md=N.highest(Ys.compute([Vd],(t=>t.facet(Vd))));function Dd(t,e){return Object.assign(Object.assign({},e),{apply:Td(t)})}const Wd=Ts.domEventHandlers({mousedown(t,e){let i,n=e.state.field(Zd,!1);if(!n||null==(i=e.posAtCoords({x:t.clientX,y:t.clientY})))return!1;let s=n.ranges.find((t=>t.from<=i&&t.to>=i));return!(!s||s.field==n.active)&&(e.dispatch({selection:Ad(n.ranges,s.field),effects:_d.of(n.ranges.some((t=>t.field>s.field))?new Cd(n.ranges,s.field):null)}),!0)}}),Ud=new class extends Qt{};function Yd(t={}){return[Sd,ed.of(t),od,Ld,yd]}Ud.startSide=1,Ud.endSide=-1;const qd=[{key:"Ctrl-Space",run:t=>!!t.state.field(Sd,!1)&&(t.dispatch({effects:Ju.of(!0)}),!0)},{key:"Escape",run:t=>{let e=t.state.field(Sd,!1);return!(!e||!e.active.some((t=>0!=t.state)))&&(t.dispatch({effects:Ku.of(null)}),!0)}},{key:"ArrowDown",run:sd(!0)},{key:"ArrowUp",run:sd(!1)},{key:"PageDown",run:sd(!0,"page")},{key:"PageUp",run:sd(!1,"page")},{key:"Enter",run:t=>{let e=t.state.field(Sd,!1);return!(t.state.readOnly||!e||!e.open||e.open.selected<0||Date.now()-e.open.timestampt.facet(ed).defaultKeymap?[qd]:[]))),zd=(()=>[vr(),yh(),ir(),$l(_l,{fallback:!0}),Ys.of([...Vc,...Wh])])();class Id{constructor(t,e,i,n,s,r,o,a,l,h=0,c){this.p=t,this.stack=e,this.state=i,this.reducePos=n,this.pos=s,this.score=r,this.buffer=o,this.bufferBase=a,this.curContext=l,this.lookAhead=h,this.parent=c}toString(){return`[${this.stack.filter(((t,e)=>e%3==0)).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,i=0){let n=t.parser.context;return new Id(t,[],e,i,i,0,[],0,n?new Bd(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let i=t>>19,n=65535&t,{parser:s}=this.p,r=s.dynamicPrecedence(n);if(r&&(this.score+=r),0==i)return this.pushState(s.getGoto(this.state,n,!0),this.reducePos),n=2e3&&!(null===(e=this.p.parser.nodeSet.types[n])||void 0===e?void 0:e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=l):this.p.lastBigReductionSizeo;)this.stack.pop();this.reduceContext(n,a)}storeNode(t,e,i,n=4,s=!1){if(0==t&&(!this.stack.length||this.stack[this.stack.length-1]0&&0==t.buffer[n-4]&&t.buffer[n-1]>-1){if(e==i)return;if(t.buffer[n-2]>=e)return void(t.buffer[n-2]=i)}}if(s&&this.pos!=i){let s=this.buffer.length;if(s>0&&0!=this.buffer[s-4])for(;s>0&&this.buffer[s-2]>i;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,n>4&&(n-=4);this.buffer[s]=t,this.buffer[s+1]=e,this.buffer[s+2]=i,this.buffer[s+3]=n}else this.buffer.push(t,e,i,n)}shift(t,e,i){let n=this.pos;if(131072&t)this.pushState(65535&t,this.pos);else if(0==(262144&t)){let s=t,{parser:r}=this.p;(i>this.pos||e<=r.maxNode)&&(this.pos=i,r.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,n),this.shiftContext(e,n),e<=r.maxNode&&this.buffer.push(e,n,i,4)}else this.pos=i,this.shiftContext(e,n),e<=this.p.parser.maxNode&&this.buffer.push(e,n,i,4)}apply(t,e,i){65536&t?this.reduce(t):this.shift(t,e,i)}useNode(t,e){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=t)&&(this.p.reused.push(t),i++);let n=this.pos;this.reducePos=this.pos=n+t.length,this.pushState(e,n),this.buffer.push(i,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let i=t.buffer.slice(e),n=t.bufferBase+e;for(;t&&n==t.bufferBase;)t=t.parent;return new Id(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,n,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let i=t<=this.p.parser.maxNode;i&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,i?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new Nd(this);;){let i=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(0==i)return!1;if(0==(65536&i))return!0;e.reduce(i)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let n,s=0;s1&e&&t==n))||i.push(e[t],n)}e=i}let i=[];for(let t=0;t>19,n=65535&t,s=this.stack.length-3*i;if(s<0||e.getGoto(this.stack[s],n,!1)<0)return!1;this.storeNode(0,this.reducePos,this.reducePos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:t}=this.p;return 65535==t.data[t.stateSlot(this.state,1)]&&!t.stateSlot(this.state,4)}restart(){this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;ethis.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Bd{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}var jd;!function(t){t[t.Insert=200]="Insert",t[t.Delete=190]="Delete",t[t.Reduce=100]="Reduce",t[t.MaxNext=4]="MaxNext",t[t.MaxInsertStackDepth=300]="MaxInsertStackDepth",t[t.DampenInsertStackDepth=120]="DampenInsertStackDepth",t[t.MinBigReduction=2e3]="MinBigReduction"}(jd||(jd={}));class Nd{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=65535&t,i=t>>19;0==i?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(i-1);let n=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=n}}class Gd{constructor(t,e,i){this.stack=t,this.pos=e,this.index=i,this.buffer=t.buffer,0==this.index&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new Gd(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;null!=t&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new Gd(this.stack,this.pos,this.index)}}function Fd(t,e=Uint16Array){if("string"!=typeof t)return t;let i=null;for(let n=0,s=0;n=92&&e--,e>=34&&e--;let s=e-32;if(s>=46&&(s-=46,i=!0),r+=s,i)break;r*=46}i?i[s++]=r:i=new e(r)}return i}class Hd{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Jd=new Hd;class Kd{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Jd,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let i=this.range,n=this.rangeIndex,s=this.pos+t;for(;si.to:s>=i.to;){if(n==this.ranges.length-1)return null;let t=this.ranges[++n];s+=t.from-i.to,i=t}return s}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,e.from);return this.end}peek(t){let e,i,n=this.chunkOff+t;if(n>=0&&n=this.chunk2Pos&&en.to&&(this.chunk2=this.chunk2.slice(0,n.to-e)),i=this.chunk2.charCodeAt(0)}}return e>=this.token.lookAhead&&(this.token.lookAhead=e+1),i}acceptToken(t,e=0){let i=e?this.resolveOffset(e,-1):this.pos;if(null==i||i=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=Jd,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let i="";for(let n of this.ranges){if(n.from>=e)break;n.to>t&&(i+=this.input.read(Math.max(n.from,t),Math.min(n.to,e)))}return i}}class tf{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:i}=e.p;sf(this.data,t,e,this.id,i.data,i.tokenPrecTable)}}tf.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class ef{constructor(t,e,i){this.precTable=e,this.elseToken=i,this.data="string"==typeof t?Fd(t):t}token(t,e){let i=t.pos,n=0;for(;sf(this.data,t,e,0,this.data,this.precTable),!(t.token.value>-1);){if(null==this.elseToken)return;if(t.next<0)break;t.advance(),t.reset(t.pos,t.token),n++}n&&(t.reset(i,t.token),t.acceptToken(this.elseToken,n))}}ef.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class nf{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function sf(t,e,i,n,s,r){let o=0,a=1<0){let i=t[n];if(l.allows(i)&&(-1==e.token.value||e.token.value==i||of(i,e.token.value,s,r))){e.acceptToken(i);break}}let n=e.next,h=0,c=t[o+2];if(!(e.next<0&&c>h&&65535==t[i+3*c-3]&&65535==t[i+3*c-3])){for(;h>1,r=i+s+(s<<1),a=t[r],l=t[r+1]||65536;if(n=l)){o=t[r+2],e.advance();continue t}h=s+1}}break}o=t[i+3*c-1]}}function rf(t,e,i){for(let n,s=e;65535!=(n=t[s]);s++)if(n==i)return s-e;return-1}function of(t,e,i,n){let s=rf(i,n,e);return s<0||rf(i,n,t)e)&&!n.type.isError)return i<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(t.length,Math.max(n.from+1,e+25));if(i<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return i<0?0:t.length}}!function(t){t[t.Margin=25]="Margin"}(hf||(hf={}));let uf=class{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?cf(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?cf(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=r,null;if(s instanceof bo){if(r==t){if(r=Math.max(this.safeFrom,t)&&(this.trees.push(s),this.start.push(r),this.index.push(0))}else this.index[e]++,this.nextStart=r+s.length}}};class df{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map((t=>new Hd))}getActions(t){let e=0,i=null,{parser:n}=t.p,{tokenizers:s}=n,r=n.stateSlot(t.state,3),o=t.curContext?t.curContext.hash:0,a=0;for(let n=0;nh.end+25&&(a=Math.max(h.lookAhead,a)),0!=h.value)){let n=e;if(h.extended>-1&&(e=this.addActions(t,h.extended,h.end,e)),e=this.addActions(t,h.value,h.end,e),!l.extend&&(i=h,e>n))break}}for(;this.actions.length>e;)this.actions.pop();return a&&t.setLookAhead(a),i||t.pos!=this.stream.end||(i=new Hd,i.value=t.p.parser.eofTerm,i.start=i.end=t.pos,e=this.addActions(t,i.value,i.end,e)),this.mainToken=i,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new Hd,{pos:i,p:n}=t;return e.start=i,e.end=Math.min(i+1,n.stream.end),e.value=i==n.stream.end?n.parser.eofTerm:0,e}updateCachedToken(t,e,i){let n=this.stream.clipPos(i.pos);if(e.token(this.stream.reset(n,t),i),t.value>-1){let{parser:e}=i.p;for(let n=0;n=0&&i.p.parser.dialect.allows(s>>1)){0==(1&s)?t.value=s>>1:t.extended=s>>1;break}}}else t.value=0,t.end=this.stream.clipPos(n+1)}putAction(t,e,i,n){for(let e=0;e4*t.bufferLength?new uf(i,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t,e,i=this.stacks,n=this.minStackPos,s=this.stacks=[];if(this.bigReductionCount>300&&1==i.length){let[t]=i;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;rn)s.push(o);else{if(this.advanceStack(o,s,i))continue;{t||(t=[],e=[]),t.push(o);let i=this.tokens.getMainToken(o);e.push(i.value,i.end)}}break}}if(!s.length){let e=t&&function(t){let e=null;for(let i of t){let t=i.p.stoppedAt;(i.pos==i.p.stream.end||null!=t&&i.pos>t)&&i.p.parser.stateFlag(i.state,2)&&(!e||e.scorethis.stoppedAt?t[0]:this.runRecovery(t,e,s);if(i)return this.stackToTree(i.forceAll())}if(this.recovering){let t=1==this.recovering?1:3*this.recovering;if(s.length>t)for(s.sort(((t,e)=>e.score-t.score));s.length>t;)s.pop();s.some((t=>t.reducePos>n))&&this.recovering--}else if(s.length>1){t:for(let t=0;t500&&n.buffer.length>500){if(!((e.score-n.score||e.buffer.length-n.buffer.length)>0)){s.splice(t--,1);continue t}s.splice(i--,1)}}}s.length>12&&s.splice(12,s.length-12)}this.minStackPos=s[0].pos;for(let t=1;t ":"";if(null!=this.stoppedAt&&n>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let e=t.curContext&&t.curContext.tracker.strict,i=e?t.curContext.hash:0;for(let o=this.fragments.nodeAt(n);o;){let n=this.parser.nodeSet.types[o.type.id]==o.type?s.getGoto(t.state,o.type.id):-1;if(n>-1&&o.length&&(!e||(o.prop(ho.contextHash)||0)==i))return t.useNode(o,n),af&&console.log(r+this.stackID(t)+` (via reuse of ${s.getName(o.type.id)})`),!0;if(!(o instanceof bo)||0==o.children.length||o.positions[0]>0)break;let a=o.children[0];if(!(a instanceof bo&&0==o.positions[0]))break;o=a}}let o=s.stateSlot(t.state,4);if(o>0)return t.reduce(o),af&&console.log(r+this.stackID(t)+` (via always-reduce ${s.getName(65535&o)})`),!0;if(t.stack.length>=15e3)for(;t.stack.length>9e3&&t.forceReduce(););let a=this.tokens.getActions(t);for(let o=0;on?e.push(d):i.push(d)}return!1}advanceFully(t,e){let i=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>i)return Of(t,e),!0}}runRecovery(t,e,i){let n=null,s=!1;for(let r=0;r ":"";if(o.deadEnd){if(s)continue;if(s=!0,o.restart(),af&&console.log(h+this.stackID(o)+" (restarted)"),this.advanceFully(o,i))continue}let c=o.split(),u=h;for(let t=0;c.forceReduce()&&t<10;t++){if(af&&console.log(u+this.stackID(c)+" (via force-reduce)"),this.advanceFully(c,i))break;af&&(u=this.stackID(c)+" -> ")}for(let t of o.recoverByInsert(a))af&&console.log(h+this.stackID(t)+" (via recover-insert)"),this.advanceFully(t,i);this.stream.end>o.pos?(l==o.pos&&(l++,a=0),o.recoverByDelete(a,l),af&&console.log(h+this.stackID(o)+` (via recover-delete ${this.parser.getName(a)})`),Of(o,i)):(!n||n.scoret;class bf{constructor(t){this.start=t.start,this.shift=t.shift||mf,this.reduce=t.reduce||mf,this.reuse=t.reuse||mf,this.hash=t.hash||(()=>0),this.strict=!1!==t.strict}}class wf extends Vo{constructor(t){if(super(),this.wrappers=[],14!=t.version)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let i=0;it.topRules[e][1])),n=[];for(let t=0;t=0)s(n,t,e[i++]);else{let r=e[i+-n];for(let o=-n;o>0;o--)s(e[i++],t,r);i++}}}this.nodeSet=new po(e.map(((e,s)=>fo.define({name:s>=this.minRepeatTerm?void 0:e,id:s,props:n[s],top:i.indexOf(s)>-1,error:0==s,skipped:t.skippedNodes&&t.skippedNodes.indexOf(s)>-1})))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=oo;let r=Fd(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let t=0;t"number"==typeof t?new tf(r,t):t)),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,i){let n=new pf(this,t,e,i);for(let s of this.wrappers)n=s(n,t,e,i);return n}getGoto(t,e,i=!1){let n=this.goto;if(e>=n[0])return-1;for(let s=n[e+1];;){let e=n[s++],r=1&e,o=n[s++];if(r&&i)return o;for(let i=s+(e>>1);s0}validAction(t,e){if(e==this.stateSlot(t,4))return!0;for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])return!1;i=vf(this.data,i+2)}if(e==vf(this.data,i+1))return!0}}nextStates(t){let e=[];for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])break;i=vf(this.data,i+2)}if(0==(1&this.data[i+2])){let t=this.data[i+1];e.some(((e,i)=>1&i&&e==t))||e.push(this.data[i],t)}}return e}configure(t){let e=Object.assign(Object.create(wf.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let i=this.topRules[t.top];if(!i)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=i}return t.tokenizers&&(e.tokenizers=this.tokenizers.map((e=>{let i=t.tokenizers.find((t=>t.from==e));return i?i.to:e}))),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map(((i,n)=>{let s=t.specializers.find((t=>t.from==i.external));if(!s)return i;let r=Object.assign(Object.assign({},i),{external:s.to});return e.specializers[n]=Sf(r),r}))),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),null!=t.strict&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),null!=t.bufferLength&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return null==e?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),i=e.map((()=>!1));if(t)for(let n of t.split(" ")){let t=e.indexOf(n);t>=0&&(i[t]=!0)}let n=null;for(let t=0;tt.external(i,n)<<1|e}return t.get}const yf=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],xf=new bf({start:!1,shift:(t,e)=>3==e||4==e||305==e?t:306==e,strict:!1}),kf=new nf(((t,e)=>{let{next:i}=t;(125==i||-1==i||e.context)&&e.canShift(303)&&t.acceptToken(303)}),{contextual:!0,fallback:!0}),Qf=new nf(((t,e)=>{let i,{next:n}=t;yf.indexOf(n)>-1||(47!=n||47!=(i=t.peek(1))&&42!=i)&&125!=n&&59!=n&&-1!=n&&!e.context&&e.canShift(302)&&t.acceptToken(302)}),{contextual:!0}),$f=new nf(((t,e)=>{let{next:i}=t;if((43==i||45==i)&&(t.advance(),i==t.next)){t.advance();let i=!e.context&&e.canShift(1);t.acceptToken(i?1:2)}}),{contextual:!0}),Pf=ea({"get set async static":ya.modifier,"for while do if else switch try catch finally return throw break continue default case":ya.controlKeyword,"in of await yield void typeof delete instanceof":ya.operatorKeyword,"let var const function class extends":ya.definitionKeyword,"import export from":ya.moduleKeyword,"with debugger as new":ya.keyword,TemplateString:ya.special(ya.string),super:ya.atom,BooleanLiteral:ya.bool,this:ya.self,null:ya.null,Star:ya.modifier,VariableName:ya.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":ya.function(ya.variableName),VariableDefinition:ya.definition(ya.variableName),Label:ya.labelName,PropertyName:ya.propertyName,PrivatePropertyName:ya.special(ya.propertyName),"CallExpression/MemberExpression/PropertyName":ya.function(ya.propertyName),"FunctionDeclaration/VariableDefinition":ya.function(ya.definition(ya.variableName)),"ClassDeclaration/VariableDefinition":ya.definition(ya.className),PropertyDefinition:ya.definition(ya.propertyName),PrivatePropertyDefinition:ya.definition(ya.special(ya.propertyName)),UpdateOp:ya.updateOperator,LineComment:ya.lineComment,BlockComment:ya.blockComment,Number:ya.number,String:ya.string,Escape:ya.escape,ArithOp:ya.arithmeticOperator,LogicOp:ya.logicOperator,BitOp:ya.bitwiseOperator,CompareOp:ya.compareOperator,RegExp:ya.regexp,Equals:ya.definitionOperator,Arrow:ya.function(ya.punctuation),": Spread":ya.punctuation,"( )":ya.paren,"[ ]":ya.squareBracket,"{ }":ya.brace,"InterpolationStart InterpolationEnd":ya.special(ya.brace),".":ya.derefOperator,", ;":ya.separator,"@":ya.meta,TypeName:ya.typeName,TypeDefinition:ya.definition(ya.typeName),"type enum interface implements namespace module declare":ya.definitionKeyword,"abstract global Privacy readonly override":ya.modifier,"is keyof unique infer":ya.operatorKeyword,JSXAttributeValue:ya.attributeValue,JSXText:ya.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":ya.angleBracket,"JSXIdentifier JSXNameSpacedName":ya.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":ya.attributeName,"JSXBuiltin/JSXIdentifier":ya.standard(ya.tagName)}),Cf={__proto__:null,export:14,as:19,from:27,default:30,async:35,function:36,extends:46,this:50,true:58,false:58,null:70,void:74,typeof:78,super:96,new:130,delete:146,yield:155,await:159,class:164,public:221,private:221,protected:221,readonly:223,instanceof:242,satisfies:245,in:246,const:248,import:280,keyof:335,unique:339,infer:345,is:381,abstract:401,implements:403,type:405,let:408,var:410,interface:417,enum:421,namespace:427,module:429,declare:433,global:437,for:456,of:465,while:468,with:472,do:476,if:480,else:482,switch:486,case:492,try:498,catch:502,finally:506,return:510,throw:514,break:518,continue:522,debugger:526},_f={__proto__:null,async:117,get:119,set:121,declare:181,public:183,private:183,protected:183,static:185,abstract:187,override:189,readonly:195,accessor:197,new:385},Xf={__proto__:null,"<":137},Zf=wf.deserialize({version:14,states:"$6[O`QUOOO%QQUOOO'TQWOOP(bOSOOO*pQ(CjO'#CfO*wOpO'#CgO+VO!bO'#CgO+eO07`O'#DZO-vQUO'#DaO.WQUO'#DlO%QQUO'#DvO0[QUO'#EOOOQ(CY'#EW'#EWO0uQSO'#ETOOQO'#Ei'#EiOOQO'#Ib'#IbO0}QSO'#GkO1YQSO'#EhO1_QSO'#EhO3aQ(CjO'#JcO6QQ(CjO'#JdO6nQSO'#FWO6sQ#tO'#FoOOQ(CY'#F`'#F`O7OO&jO'#F`O7^Q,UO'#FvO8tQSO'#FuOOQ(CY'#Jd'#JdOOQ(CW'#Jc'#JcOOQQ'#KO'#KOO8yQSO'#IOO9OQ(C[O'#IPOOQQ'#JP'#JPOOQQ'#IT'#ITQ`QUOOO%QQUO'#DnO9WQUO'#DzO%QQUO'#D|O9_QSO'#GkO9dQ,UO'#ClO9rQSO'#EgO9}QSO'#ErO:SQ,UO'#F_O:qQSO'#GkO:vQSO'#GoO;RQSO'#GoO;aQSO'#GrO;aQSO'#GsO;aQSO'#GuO9_QSO'#GxOQQSO'#HnO>VQ(C]O'#HtO%QQUO'#H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9xQ2{9yQ2|9zQ2}9{Q3O9|Q3P9}Q3Q:OQ3R:PQ3S.dQ3V:UQ3W:_Q3]:QQ4O/zQ4V0XQ5i:`Q5o2WQ5t2^Q6Q2rQ6R:aQ6W:cQ6X:jQ7P4kQ7n5gQ7r5pQ7{:kQ8P:pQ8Q:qQ8v7tQ9U8cQ9]8tQ9n#OR;Q;^R#WWR&{!cY!qQ'Q,}0u4pS&w!c,uQ']!oS'g!r!uS'i!v4rS,r&x'PS-^'^'_Q-`'`Q1{,{R2Z-_R(k#tR(n#uQ!dQT,|'Q,}]!nQ!o'Q,}0u4pQ#l]R'Z9mT#gZ%ZS#fZ%ZU%y|},ZU(W#d#e#hS-r(X(YQ-v(ZQ0h+hQ2`-sU2a-t-u-wS5v2b2cR7u5w`#YW#S#V%v't'}+e-mt#cZ|}#d#e#h%Z(X(Y(Z+h-s-t-u-w2b2c5wQ1_,ZQ1r,oQ5e1jQ7m5fT:x&y+fT#]W%vS#[W%vS'u#S'}S'z#V+eS,t&y+fT-h't-mT'O!c%wQ$hfR)j$mT)_$h)`R3Z.kT*O$u*QR*W$xQ/}*zQ2e.OQ4s0wQ5{2iQ7X4vQ7x5zQ8e7WQ8w7wQ9W8gQ9`8yQ9e9XR9h9alpOXr!X#`%]&d&f&g&i,],b1b1eQ&^!TR,Q&ZV%z|},ZR0q+qR,P&XQ%szR+c%tR+X%nT&b!U&eT&c!U&eT1d,b1e",nodeNames:"⚠ ArithOp ArithOp LineComment BlockComment Script ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXStartTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:364,context:xf,nodeProps:[["group",-26,6,14,16,62,199,203,206,207,209,212,215,225,227,233,235,237,239,242,248,254,256,258,260,262,264,265,"Statement",-32,10,11,25,28,29,35,45,48,49,51,56,64,72,76,78,80,81,103,104,113,114,131,134,136,137,138,139,141,142,162,163,165,"Expression",-23,24,26,30,34,36,38,166,168,170,171,173,174,175,177,178,179,181,182,183,193,195,197,198,"Type",-3,84,96,102,"ClassItem"],["openedBy",31,"InterpolationStart",50,"[",54,"{",69,"(",143,"JSXStartTag",155,"JSXStartTag JSXStartCloseTag"],["closedBy",33,"InterpolationEnd",44,"]",55,"}",70,")",144,"JSXSelfCloseEndTag JSXEndTag",160,"JSXEndTag"]],propSources:[Pf],skippedNodes:[0,3,4,268],repeatNodeCount:33,tokenData:"$>y(CSR!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tu>PuvBavwDxwxGgxyMvyz! Qz{!![{|!%O|}!&]}!O!%O!O!P!'g!P!Q!1w!Q!R#0t!R![#3T![!]#@T!]!^#Aa!^!_#Bk!_!`#GS!`!a#In!a!b#N{!b!c$$z!c!}>P!}#O$&U#O#P$'`#P#Q$,w#Q#R$.R#R#S>P#S#T$/`#T#o$0j#o#p$4z#p#q$5p#q#r$7Q#r#s$8^#s$f%Z$f$g+g$g#BY>P#BY#BZ$9h#BZ$IS>P$IS$I_$9h$I_$I|>P$I|$I}$P$JT$JU$9h$JU$KV>P$KV$KW$9h$KW&FU>P&FU&FV$9h&FV;'S>P;'S;=`BZ<%l?HT>P?HT?HU$9h?HUO>P(n%d_$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$d&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$d&j'z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU'z!bO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enizers:[Qf,$f,2,3,4,5,6,7,8,9,10,11,12,13,kf,new ef("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOq~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!O~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(T~~",141,326),new ef("j~RQYZXz{^~^O'q~~aP!P!Qd~iO'r~~",25,308)],topRules:{Script:[0,5],SingleExpression:[1,266],SingleClassItem:[2,267]},dialects:{jsx:12686,ts:12688},dynamicPrecedences:{76:1,78:1,163:1,191:1},specialized:[{term:312,get:t=>Cf[t]||-1},{term:328,get:t=>_f[t]||-1},{term:67,get:t=>Xf[t]||-1}],tokenPrec:12712}),Af=[Dd("function ${name}(${params}) {\n\t${}\n}",{label:"function",detail:"definition",type:"keyword"}),Dd("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n\t${}\n}",{label:"for",detail:"loop",type:"keyword"}),Dd("for (let ${name} of ${collection}) {\n\t${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Dd("do {\n\t${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),Dd("while (${}) {\n\t${}\n}",{label:"while",detail:"loop",type:"keyword"}),Dd("try {\n\t${}\n} catch (${error}) {\n\t${}\n}",{label:"try",detail:"/ catch block",type:"keyword"}),Dd("if (${}) {\n\t${}\n}",{label:"if",detail:"block",type:"keyword"}),Dd("if (${}) {\n\t${}\n} else {\n\t${}\n}",{label:"if",detail:"/ else block",type:"keyword"}),Dd("class ${name} {\n\tconstructor(${params}) {\n\t\t${}\n\t}\n}",{label:"class",detail:"definition",type:"keyword"}),Dd('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Dd('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Tf=new Ro,Rf=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Ef(t){return(e,i)=>{let n=e.node.getChild("VariableDefinition");return n&&i(n,t),!0}}const Vf=["FunctionDeclaration"],Mf={FunctionDeclaration:Ef("function"),ClassDeclaration:Ef("class"),ClassExpression:()=>!0,EnumDeclaration:Ef("constant"),TypeAliasDeclaration:Ef("type"),NamespaceDeclaration:Ef("namespace"),VariableDefinition(t,e){t.matchContext(Vf)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function Df(t,e){let i=Tf.get(e);if(i)return i;let n=[],s=!0;function r(e,i){let s=t.sliceString(e.from,e.to);n.push({label:s,type:i})}return e.cursor(mo.IncludeAnonymous).iterate((e=>{if(s)s=!1;else if(e.name){let t=Mf[e.name];if(t&&t(e,r)||Rf.has(e.name))return!1}else if(e.to-e.from>8192){for(let i of Df(t,e.node))n.push(i);return!1}})),Tf.set(e,n),n}const Wf=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Uf=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName"];function Yf(t){let e=Xa(t.state).resolveInner(t.pos,-1);if(Uf.indexOf(e.name)>-1)return null;let i="VariableName"==e.name||e.to-e.from<20&&Wf.test(t.state.sliceDoc(e.from,e.to));if(!i&&!t.explicit)return null;let n=[];for(let i=e;i;i=i.parent)Rf.has(i.name)&&(n=n.concat(Df(t.state.doc,i)));return{options:n,from:i?e.from:t.pos,validFor:Wf}}const qf=_a.define({name:"javascript",parser:Zf.configure({props:[Na.add({IfStatement:il({except:/^\s*({|else\b)/}),TryStatement:il({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:t=>t.baseIndent,SwitchBody:t=>{let e=t.textAfter,i=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return t.baseIndent+(i?0:n?1:2)*t.unit},Block:tl({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":il({except:/^{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag":t=>t.column(t.node.from)+t.unit}),rl.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression":ol,BlockComment:t=>({from:t.from+2,to:t.to-2})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Lf={test:t=>/^JSX/.test(t.name),facet:Qa({commentTokens:{block:{open:"{/*",close:"*/}"}}})},zf=qf.configure({dialect:"ts"},"typescript"),If=qf.configure({dialect:"jsx",props:[$a.add((t=>t.isTop?[Lf]:void 0))]}),Bf=qf.configure({dialect:"jsx ts",props:[$a.add((t=>t.isTop?[Lf]:void 0))]},"typescript"),jf="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map((t=>({label:t,type:"keyword"})));function Nf(t={}){let e=t.jsx?t.typescript?Bf:If:t.typescript?zf:qf;return new Ua(e,[qf.data.of({autocomplete:(i=Uf,n=Iu(Af.concat(jf)),t=>{for(let e=Xa(t.state).resolveInner(t.pos,-1);e;e=e.parent){if(i.indexOf(e.name)>-1)return null;if(e.type.isTop)break}return n(t)})}),qf.data.of({autocomplete:Yf}),t.jsx?Hf:[]]);var i,n}function Gf(t,e,i=t.length){for(let n=null==e?void 0:e.firstChild;n;n=n.nextSibling)if("JSXIdentifier"==n.name||"JSXBuiltin"==n.name||"JSXNamespacedName"==n.name||"JSXMemberExpression"==n.name)return t.sliceString(n.from,Math.min(n.to,i));return""}const Ff="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),Hf=Ts.inputHandler.of(((t,e,i,n)=>{if((Ff?t.composing:t.compositionStarted)||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!qf.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((t=>{var e,i;let r,{head:o}=t,a=Xa(s).resolveInner(o,-1);if("JSXStartTag"==a.name&&(a=a.parent),">"==n&&"JSXFragmentTag"==a.name)return{range:A.cursor(o+1),changes:{from:o,insert:">"}};if("/"==n&&"JSXFragmentTag"==a.name){let t=a.parent,i=null==t?void 0:t.parent;if(t.from==o-1&&"JSXEndTag"!=(null===(e=i.lastChild)||void 0===e?void 0:e.name)&&(r=Gf(s.doc,null==i?void 0:i.firstChild,o))){let t=`/${r}>`;return{range:A.cursor(o+t.length),changes:{from:o,insert:t}}}}else if(">"==n){let t=function(t){for(;;){if("JSXOpenTag"==t.name||"JSXSelfClosingTag"==t.name||"JSXFragmentTag"==t.name)return t;if(!t.parent)return null;t=t.parent}}(a);if(t&&"JSXEndTag"!=(null===(i=t.lastChild)||void 0===i?void 0:i.name)&&"`}}}return{range:t}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)}));class Jf{constructor(t,e,i,n,s,r,o){this.type=t,this.value=e,this.from=i,this.hash=n,this.end=s,this.children=r,this.positions=o,this.hashProp=[[ho.contextHash,n]]}static create(t,e,i,n,s){return new Jf(t,e,i,n+(n<<8)+t+(e<<4)|0,s,[],[])}addChild(t,e){t.prop(ho.contextHash)!=this.hash&&(t=new bo(t.type,t.children,t.positions,t.length,this.hashProp)),this.children.push(t),this.positions.push(e)}toTree(t,e=this.end){let i=this.children.length-1;return i>=0&&(e=Math.max(e,this.positions[i]+this.children[i].length+this.from)),new bo(t.types[this.type],this.children,this.positions,e-this.from).balance({makeTree:(t,e,i)=>new bo(fo.none,t,e,i,this.hashProp)})}}var Kf;!function(t){t[t.Document=1]="Document",t[t.CodeBlock=2]="CodeBlock",t[t.FencedCode=3]="FencedCode",t[t.Blockquote=4]="Blockquote",t[t.HorizontalRule=5]="HorizontalRule",t[t.BulletList=6]="BulletList",t[t.OrderedList=7]="OrderedList",t[t.ListItem=8]="ListItem",t[t.ATXHeading1=9]="ATXHeading1",t[t.ATXHeading2=10]="ATXHeading2",t[t.ATXHeading3=11]="ATXHeading3",t[t.ATXHeading4=12]="ATXHeading4",t[t.ATXHeading5=13]="ATXHeading5",t[t.ATXHeading6=14]="ATXHeading6",t[t.SetextHeading1=15]="SetextHeading1",t[t.SetextHeading2=16]="SetextHeading2",t[t.HTMLBlock=17]="HTMLBlock",t[t.LinkReference=18]="LinkReference",t[t.Paragraph=19]="Paragraph",t[t.CommentBlock=20]="CommentBlock",t[t.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",t[t.Escape=22]="Escape",t[t.Entity=23]="Entity",t[t.HardBreak=24]="HardBreak",t[t.Emphasis=25]="Emphasis",t[t.StrongEmphasis=26]="StrongEmphasis",t[t.Link=27]="Link",t[t.Image=28]="Image",t[t.InlineCode=29]="InlineCode",t[t.HTMLTag=30]="HTMLTag",t[t.Comment=31]="Comment",t[t.ProcessingInstruction=32]="ProcessingInstruction",t[t.URL=33]="URL",t[t.HeaderMark=34]="HeaderMark",t[t.QuoteMark=35]="QuoteMark",t[t.ListMark=36]="ListMark",t[t.LinkMark=37]="LinkMark",t[t.EmphasisMark=38]="EmphasisMark",t[t.CodeMark=39]="CodeMark",t[t.CodeText=40]="CodeText",t[t.CodeInfo=41]="CodeInfo",t[t.LinkTitle=42]="LinkTitle",t[t.LinkLabel=43]="LinkLabel"}(Kf||(Kf={}));class tp{constructor(t,e){this.start=t,this.content=e,this.marks=[],this.parsers=[]}}class ep{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let t=this.skipSpace(this.basePos);this.indent=this.countIndent(t,this.pos,this.indent),this.pos=t,this.next=t==this.text.length?-1:this.text.charCodeAt(t)}skipSpace(t){return rp(this.text,t)}reset(t){for(this.text=t,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(t){this.basePos=t,this.baseIndent=this.countIndent(t,this.pos,this.indent)}moveBaseColumn(t){this.baseIndent=t,this.basePos=this.findColumn(t)}addMarker(t){this.markers.push(t)}countIndent(t,e=0,i=0){for(let n=e;n=e.stack[i.depth+1].value+i.baseIndent)return!0;if(i.indent>=i.baseIndent+4)return!1;let n=(t.type==Kf.OrderedList?dp:up)(i,e,!1);return n>0&&(t.type!=Kf.BulletList||hp(i,e,!1)<0)&&i.text.charCodeAt(i.pos+n-1)==t.value}const np={[Kf.Blockquote]:(t,e,i)=>62==i.next&&(i.markers.push(Up(Kf.QuoteMark,e.lineStart+i.pos,e.lineStart+i.pos+1)),i.moveBase(i.pos+(sp(i.text.charCodeAt(i.pos+1))?2:1)),t.end=e.lineStart+i.text.length,!0),[Kf.ListItem]:(t,e,i)=>!(i.indent-1)&&(i.moveBaseColumn(i.baseIndent+t.value),!0),[Kf.OrderedList]:ip,[Kf.BulletList]:ip,[Kf.Document]:()=>!0};function sp(t){return 32==t||9==t||10==t||13==t}function rp(t,e=0){for(;ei&&sp(t.charCodeAt(e-1));)e--;return e}function ap(t){if(96!=t.next&&126!=t.next)return-1;let e=t.pos+1;for(;e-1&&t.depth==e.stack.length||n<3?-1:1}function cp(t,e){for(let i=t.stack.length-1;i>=0;i--)if(t.stack[i].type==e)return!0;return!1}function up(t,e,i){return 45!=t.next&&43!=t.next&&42!=t.next||t.pos!=t.text.length-1&&!sp(t.text.charCodeAt(t.pos+1))||!(!i||cp(e,Kf.BulletList)||t.skipSpace(t.pos+2)=48&&s<=57;){if(n++,n==t.text.length)return-1;s=t.text.charCodeAt(n)}return n==t.pos||n>t.pos+9||46!=s&&41!=s||nt.pos+1||49!=t.next)?-1:n+1-t.pos}function fp(t){if(35!=t.next)return-1;let e=t.pos+1;for(;e6?-1:i}function pp(t){if(45!=t.next&&61!=t.next||t.indent>=t.baseIndent+4)return-1;let e=t.pos+1;for(;e/,mp=/\?>/,bp=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*/i.exec(n);if(r)return t.append(Up(Kf.Comment,i,i+1+r[0].length));let o=/^\?[^]*?\?>/.exec(n);if(o)return t.append(Up(Kf.ProcessingInstruction,i,i+1+o[0].length));let a=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(n);return a?t.append(Up(Kf.HTMLTag,i,i+1+a[0].length)):-1},Emphasis(t,e,i){if(95!=e&&42!=e)return-1;let n=i+1;for(;t.char(n)==e;)n++;let s=t.slice(i-1,i),r=t.slice(n,n+1),o=jp.test(s),a=jp.test(r),l=/\s|^$/.test(s),h=/\s|^$/.test(r),c=!h&&(!a||l||o),u=!l&&(!o||h||a),d=c&&(42==e||!u||o),f=u&&(42==e||!c||a);return t.append(new Ip(95==e?Yp:qp,i,n,(d?1:0)|(f?2:0)))},HardBreak(t,e,i){if(92==e&&10==t.char(i+1))return t.append(Up(Kf.HardBreak,i,i+2));if(32==e){let e=i+1;for(;32==t.char(e);)e++;if(10==t.char(e)&&e>=i+2)return t.append(Up(Kf.HardBreak,i,e+1))}return-1},Link:(t,e,i)=>91==e?t.append(new Ip(Lp,i,i+1,1)):-1,Image:(t,e,i)=>33==e&&91==t.char(i+1)?t.append(new Ip(zp,i,i+2,1)):-1,LinkEnd(t,e,i){if(93!=e)return-1;for(let e=t.parts.length-1;e>=0;e--){let n=t.parts[e];if(n instanceof Ip&&(n.type==Lp||n.type==zp)){if(!n.side||t.skipSpace(n.to)==i&&!/[(\[]/.test(t.slice(i+1,i+2)))return t.parts[e]=null,-1;let s=t.takeContent(e),r=t.parts[e]=Gp(t,s,n.type==Lp?Kf.Link:Kf.Image,n.from,i+1);if(n.type==Lp)for(let i=0;ie?Up(Kf.URL,e+i,s+i):s==t.length&&null}}function Hp(t,e,i){let n=t.charCodeAt(e);if(39!=n&&34!=n&&40!=n)return!1;let s=40==n?41:n;for(let n=e+1,r=!1;n=this.end?-1:this.text.charCodeAt(t-this.offset)}get end(){return this.offset+this.text.length}slice(t,e){return this.text.slice(t-this.offset,e-this.offset)}append(t){return this.parts.push(t),t.to}addDelimiter(t,e,i,n,s){return this.append(new Ip(t,e,i,(n?1:0)|(s?2:0)))}addElement(t){return this.append(t)}resolveMarkers(t){for(let e=t;e=t;o--){let t=this.parts[o];if(t instanceof Ip&&1&t.side&&t.type==i.type&&!(s&&(1&i.side||2&t.side)&&(t.to-t.from+r)%3==0&&((t.to-t.from)%3||r%3))){n=t;break}}if(!n)continue;let a=i.type.resolve,l=[],h=n.from,c=i.to;if(s){let t=Math.min(2,n.to-n.from,r);h=n.to-t,c=i.from+t,a=1==t?"Emphasis":"StrongEmphasis"}n.type.mark&&l.push(this.elt(n.type.mark,h,n.to));for(let t=o+1;t=0;e--){let i=this.parts[e];if(i instanceof Ip&&i.type==t)return e}return null}takeContent(t){let e=this.resolveMarkers(t);return this.parts.length=t,e}skipSpace(t){return rp(this.text,t-this.offset)+this.offset}elt(t,e,i,n){return"string"==typeof t?Up(this.parser.getNodeType(t),e,i,n):new Wp(t,e)}}function tO(t,e){if(!e.length)return t;if(!t.length)return e;let i=t.slice(),n=0;for(let t of e){for(;n(t?t-1:0))return!1;if(this.fragmentEnd<0){let t=this.fragment.to;for(;t>0&&"\n"!=this.input.read(t-1,t);)t--;this.fragmentEnd=t?t-1:0}let i=this.cursor;i||(i=this.cursor=this.fragment.tree.cursor(),i.firstChild());let n=t+this.fragment.offset;for(;i.to<=n;)if(!i.parent())return!1;for(;;){if(i.from>=n)return this.fragment.from<=e;if(!i.childAfter(n))return!1}}matches(t){let e=this.cursor.tree;return e&&e.prop(ho.contextHash)==t}takeNodes(t){let e=this.cursor,i=this.fragment.offset,n=this.fragmentEnd-(this.fragment.openEnd?1:0),s=t.absoluteLineStart,r=s,o=t.block.children.length,a=r,l=o;for(;;){if(e.to-i>n){if(e.type.isAnonymous&&e.firstChild())continue;break}if(t.dontInject.add(e.tree),t.addNode(e.tree,e.from-i),e.type.is("Block")&&(eO.indexOf(e.type.id)<0?(r=e.to-i,o=t.block.children.length):(r=a,o=l,a=e.to-i,l=t.block.children.length)),!e.nextSibling())break}for(;t.block.children.length>o;)t.block.children.pop(),t.block.positions.pop();return r-s}}const nO=ea({"Blockquote/...":ya.quote,HorizontalRule:ya.contentSeparator,"ATXHeading1/... SetextHeading1/...":ya.heading1,"ATXHeading2/... SetextHeading2/...":ya.heading2,"ATXHeading3/...":ya.heading3,"ATXHeading4/...":ya.heading4,"ATXHeading5/...":ya.heading5,"ATXHeading6/...":ya.heading6,"Comment CommentBlock":ya.comment,Escape:ya.escape,Entity:ya.character,"Emphasis/...":ya.emphasis,"StrongEmphasis/...":ya.strong,"Link/... Image/...":ya.link,"OrderedList/... BulletList/...":ya.list,"BlockQuote/...":ya.quote,"InlineCode CodeText":ya.monospace,URL:ya.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":ya.processingInstruction,"CodeInfo LinkLabel":ya.labelName,LinkTitle:ya.string,Paragraph:ya.content}),sO=new Zp(new po(Ep).extend(nO),Object.keys(yp).map((t=>yp[t])),Object.keys(yp).map((t=>$p[t])),Object.keys(yp),Pp,np,Object.keys(Np).map((t=>Np[t])),Object.keys(Np),[]);function rO(t,e,i){let n=[];for(let s=t.firstChild,r=e;;s=s.nextSibling){let t=s?s.from:i;if(t>r&&n.push({from:r,to:t}),!s)break;r=s.to}return n}const oO={resolve:"Strikethrough",mark:"StrikethroughMark"},aO={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":ya.strikethrough}},{name:"StrikethroughMark",style:ya.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,i){if(126!=e||126!=t.char(i+1)||126==t.char(i+2))return-1;let n=t.slice(i-1,i),s=t.slice(i+2,i+3),r=/\s|^$/.test(n),o=/\s|^$/.test(s),a=jp.test(n),l=jp.test(s);return t.addDelimiter(oO,i,i+2,!o&&(!l||r||a),!r&&(!a||o||l))},after:"Emphasis"}]};function lO(t,e,i=0,n,s=0){let r=0,o=!0,a=-1,l=-1,h=!1,c=()=>{n.push(t.elt("TableCell",s+a,s+l,t.parser.parseInline(e.slice(a,l),s+a)))};for(let u=i;u-1)&&r++,o=!1,n&&(a>-1&&c(),n.push(t.elt("TableDelimiter",u+s,u+s+1))),a=l=-1),h=!h&&92==i}return a>-1&&(r++,n&&c()),r}function hO(t,e){for(let i=e;ihO(e.content,0)?new uO:null,endLeaf(t,e,i){if(i.parsers.some((t=>t instanceof uO))||!hO(e.text,e.basePos))return!1;let n=t.scanLine(t.absoluteLineEnd+1).text;return cO.test(n)&&lO(t,e.text,e.basePos)==lO(t,n,e.basePos)},before:"SetextHeading"}]};class fO{nextLine(){return!1}finish(t,e){return t.addLeafElement(e,t.elt("Task",e.start,e.start+e.content.length,[t.elt("TaskMarker",e.start,e.start+3),...t.parser.parseInline(e.content.slice(3),e.start+3)])),!0}}const pO=[dO,{defineNodes:[{name:"Task",block:!0,style:ya.list},{name:"TaskMarker",style:ya.atom}],parseBlock:[{name:"TaskList",leaf:(t,e)=>/^\[[ xX]\]/.test(e.content)&&"ListItem"==t.parentType().name?new fO:null,after:"SetextHeading"}]},aO];function OO(t,e,i){return(n,s,r)=>{if(s!=t||n.char(r+1)==t)return-1;let o=[n.elt(i,r,r+1)];for(let s=r+1;s=65&&r<=90||95==r||r>=97&&r<=122||r>=161;)s+=String.fromCharCode(n),n=t.peek(++e);var r;return RO=t,EO=i,TO=s?s.toLowerCase():n==MO||n==DO?void 0:null}const MO=63,DO=33;function WO(t,e){this.name=t,this.parent=e,this.hash=e?e.hash:0;for(let e=0;eUO.indexOf(e)>-1?new WO(VO(n,1)||"",t):t,reduce:(t,e)=>e==wO&&t?t.parent:t,reuse(t,e,i,n){let s=e.type.id;return 6==s||36==s?new WO(VO(n,1)||"",t):t},hash:t=>t?t.hash:0,strict:!1}),qO=new nf(((t,e)=>{if(60!=t.next)return void(t.next<0&&e.context&&t.acceptToken(57));t.advance();let i=47==t.next;i&&t.advance();let n=VO(t,0);if(void 0===n)return;if(!n)return t.acceptToken(i?14:6);let s=e.context?e.context.name:null;if(i){if(n==s)return t.acceptToken(11);if(s&&XO[s])return t.acceptToken(57,-2);if(e.dialectEnabled(0))return t.acceptToken(12);for(let t=e.context;t;t=t.parent)if(t.name==n)return;t.acceptToken(13)}else{if("script"==n)return t.acceptToken(7);if("style"==n)return t.acceptToken(8);if("textarea"==n)return t.acceptToken(9);if(_O.hasOwnProperty(n))return t.acceptToken(10);s&&ZO[s]&&ZO[s][n]?t.acceptToken(57,-1):t.acceptToken(6)}}),{contextual:!0}),LO=new nf((t=>{for(let e=0,i=0;;i++){if(t.next<0){i&&t.acceptToken(58);break}if(45==t.next)e++;else{if(62==t.next&&e>=2){i>3&&t.acceptToken(58,-2);break}e=0}t.advance()}}));const zO=new nf(((t,e)=>{if(47==t.next&&62==t.peek(1)){let i=e.dialectEnabled(1)||function(t){for(;t;t=t.parent)if("svg"==t.name||"math"==t.name)return!0;return!1}(e.context);t.acceptToken(i?5:4,2)}else 62==t.next&&t.acceptToken(4,1)}));function IO(t,e,i){let n=2+t.length;return new nf((s=>{for(let r=0,o=0,a=0;;a++){if(s.next<0){a&&s.acceptToken(e);break}if(0==r&&60==s.next||1==r&&47==s.next||r>=2&&ro?s.acceptToken(e,-o):s.acceptToken(i,-(o-2));break}if((10==s.next||13==s.next)&&a){s.acceptToken(e,1);break}r=o=0}else o++;s.advance()}}))}const BO=IO("script",54,1),jO=IO("style",55,2),NO=IO("textarea",56,3),GO=ea({"Text RawText":ya.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":ya.angleBracket,TagName:ya.tagName,"MismatchedCloseTag/TagName":[ya.tagName,ya.invalid],AttributeName:ya.attributeName,"AttributeValue UnquotedAttributeValue":ya.attributeValue,Is:ya.definitionOperator,"EntityReference CharacterReference":ya.character,Comment:ya.blockComment,ProcessingInst:ya.processingInstruction,DoctypeDecl:ya.documentMeta}),FO=wf.deserialize({version:14,states:",xOVO!rOOO!WQ#tO'#CqO!]Q#tO'#CzO!bQ#tO'#C}O!gQ#tO'#DQO!lQ#tO'#DSO!qOaO'#CpO!|ObO'#CpO#XOdO'#CpO$eO!rO'#CpOOO`'#Cp'#CpO$lO$fO'#DTO$tQ#tO'#DVO$yQ#tO'#DWOOO`'#Dk'#DkOOO`'#DY'#DYQVO!rOOO%OQ&rO,59]O%WQ&rO,59fO%`Q&rO,59iO%hQ&rO,59lO%sQ&rO,59nOOOa'#D^'#D^O%{OaO'#CxO&WOaO,59[OOOb'#D_'#D_O&`ObO'#C{O&kObO,59[OOOd'#D`'#D`O&sOdO'#DOO'OOdO,59[OOO`'#Da'#DaO'WO!rO,59[O'_Q#tO'#DROOO`,59[,59[OOOp'#Db'#DbO'dO$fO,59oOOO`,59o,59oO'lQ#|O,59qO'qQ#|O,59rOOO`-E7W-E7WO'vQ&rO'#CsOOQW'#DZ'#DZO(UQ&rO1G.wOOOa1G.w1G.wO(^Q&rO1G/QOOOb1G/Q1G/QO(fQ&rO1G/TOOOd1G/T1G/TO(nQ&rO1G/WOOO`1G/W1G/WOOO`1G/Y1G/YO(yQ&rO1G/YOOOa-E7[-E7[O)RQ#tO'#CyOOO`1G.v1G.vOOOb-E7]-E7]O)WQ#tO'#C|OOOd-E7^-E7^O)]Q#tO'#DPOOO`-E7_-E7_O)bQ#|O,59mOOOp-E7`-E7`OOO`1G/Z1G/ZOOO`1G/]1G/]OOO`1G/^1G/^O)gQ,UO,59_OOQW-E7X-E7XOOOa7+$c7+$cOOOb7+$l7+$lOOOd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XYOX`pQ`ORx`Q{aQ}bQ!PcQ!RdQ!UeZ!e{}!P!R!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:67,context:YO,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,21,30,33,36,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,29,32,35,37,"OpenTag"],["group",-9,14,17,18,19,20,39,40,41,42,"Entity",16,"Entity TextContent",-3,28,31,34,"TextContent Entity"]],propSources:[GO],skippedNodes:[0],repeatNodeCount:9,tokenData:"#%g!aR!YOX$qXY,QYZ,QZ[$q[]&X]^,Q^p$qpq,Qqr-_rs4ysv-_vw5iwxJ^x}-_}!OKP!O!P-_!P!Q$q!Q![-_![!]!!O!]!^-_!^!_!&W!_!`#$o!`!a&X!a!c-_!c!}!!O!}#R-_#R#S!!O#S#T3V#T#o!!O#o#s-_#s$f$q$f%W-_%W%o!!O%o%p-_%p&a!!O&a&b-_&b1p!!O1p4U-_4U4d!!O4d4e-_4e$IS!!O$IS$I`-_$I`$Ib!!O$Ib$Kh-_$Kh%#t!!O%#t&/x-_&/x&Et!!O&Et&FV-_&FV;'S!!O;'S;:j!&Q;:j;=`4s<%l?&r-_?&r?Ah!!O?Ah?BY$q?BY?Mn!!O?MnO$q!Z$|c`PkW!a`!cpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr$qrs&}sv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O&X",tokenizers:[BO,jO,NO,zO,qO,LO,0,1,2,3,4,5],topRules:{Document:[0,15]},dialects:{noMatch:0,selfClosing:485},tokenPrec:487});function HO(t,e){let i=Object.create(null);for(let n of t.getChildren(SO)){let t=n.getChild(yO),s=n.getChild(xO)||n.getChild(kO);t&&(i[e.read(t.from,t.to)]=s?s.type.id==xO?e.read(s.from+1,s.to-1):e.read(s.from,s.to):"")}return i}function JO(t,e){let i=t.getChild(vO);return i?e.read(i.from,i.to):" "}function KO(t,e,i){let n;for(let s of i)if(!s.attrs||s.attrs(n||(n=HO(t.node.parent.firstChild,e))))return{parser:s.parser};return null}function tg(t=[],e=[]){let i=[],n=[],s=[],r=[];for(let e of t){("script"==e.tag?i:"style"==e.tag?n:"textarea"==e.tag?s:r).push(e)}let o=e.length?Object.create(null):null;for(let t of e)(o[t.name]||(o[t.name]=[])).push(t);return Do(((t,e)=>{let a=t.type.id;if(a==QO)return KO(t,e,i);if(a==$O)return KO(t,e,n);if(a==PO)return KO(t,e,s);if(a==wO&&r.length){let i,n=t.node,s=n.firstChild,o=s&&JO(s,e);if(o)for(let t of r)if(t.tag==o&&(!t.attrs||t.attrs(i||(i=HO(n,e))))){let e=n.lastChild;return{parser:t.parser,overlay:[{from:s.to,to:e.type.id==CO?e.from:n.to}]}}}if(o&&a==SO){let i,n=t.node;if(i=n.firstChild){let t=o[e.read(i.from,i.to)];if(t)for(let i of t){if(i.tagName&&i.tagName!=JO(n.parent,e))continue;let t=n.lastChild;if(t.type.id==xO){let e=t.from+1,n=t.lastChild,s=t.to-(n&&n.isError?0:1);if(s>e)return{parser:i.parser,overlay:[{from:e,to:s}]}}else if(t.type.id==kO)return{parser:i.parser,overlay:[{from:t.from,to:t.to}]}}}}return null}))}const eg=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288];function ig(t){return t>=65&&t<=90||t>=97&&t<=122||t>=161}const ng=new nf(((t,e)=>{for(let n=!1,s=0,r=0;;r++){let{next:o}=t;if(!(ig(o)||45==o||95==o||n&&(i=o,i>=48&&i<=57))){n&&t.acceptToken(40==o?95:2==s&&e.canShift(2)?2:96);break}!n&&(45!=o||r>0)&&(n=!0),s===r&&45==o&&s++,t.advance()}var i})),sg=new nf((t=>{if(eg.includes(t.peek(-1))){let{next:e}=t;(ig(e)||95==e||35==e||46==e||91==e||58==e||45==e)&&t.acceptToken(94)}})),rg=new nf((t=>{if(!eg.includes(t.peek(-1))){let{next:e}=t;if(37==e&&(t.advance(),t.acceptToken(1)),ig(e)){do{t.advance()}while(ig(t.next));t.acceptToken(1)}}})),og=ea({"AtKeyword import charset namespace keyframes media supports":ya.definitionKeyword,"from to selector":ya.keyword,NamespaceName:ya.namespace,KeyframeName:ya.labelName,TagName:ya.tagName,ClassName:ya.className,PseudoClassName:ya.constant(ya.className),IdName:ya.labelName,"FeatureName PropertyName":ya.propertyName,AttributeName:ya.attributeName,NumberLiteral:ya.number,KeywordQuery:ya.keyword,UnaryQueryOp:ya.operatorKeyword,"CallTag ValueName":ya.atom,VariableName:ya.variableName,Callee:ya.operatorKeyword,Unit:ya.unit,"UniversalSelector NestingSelector":ya.definitionOperator,MatchOp:ya.compareOperator,"ChildOp SiblingOp, LogicOp":ya.logicOperator,BinOp:ya.arithmeticOperator,Important:ya.modifier,Comment:ya.blockComment,ParenthesizedContent:ya.special(ya.name),ColorLiteral:ya.color,StringLiteral:ya.string,":":ya.punctuation,"PseudoOp #":ya.derefOperator,"; ,":ya.separator,"( )":ya.paren,"[ ]":ya.squareBracket,"{ }":ya.brace}),ag={__proto__:null,lang:32,"nth-child":32,"nth-last-child":32,"nth-of-type":32,"nth-last-of-type":32,dir:32,"host-context":32,url:60,"url-prefix":60,domain:60,regexp:60,selector:134},lg={__proto__:null,"@import":114,"@media":138,"@charset":142,"@namespace":146,"@keyframes":152,"@supports":164},hg={__proto__:null,not:128,only:128,from:158,to:160},cg=wf.deserialize({version:14,states:"7WQYQ[OOO#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-1}],tokenPrec:1123});let ug=null;function dg(){if(!ug&&"object"==typeof document&&document.body){let{style:t}=document.body,e=[],i=new Set;for(let n in t)"cssText"!=n&&"cssFloat"!=n&&"string"==typeof t[n]&&(/[A-Z]/.test(n)&&(n=n.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))),i.has(n)||(e.push(n),i.add(n)));ug=e.sort().map((t=>({type:"property",label:t})))}return ug||[]}const fg=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map((t=>({type:"class",label:t}))),pg=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map((t=>({type:"keyword",label:t}))).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map((t=>({type:"constant",label:t})))),Og=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map((t=>({type:"type",label:t}))),gg=/^(\w[\w-]*|-\w[\w-]*|)$/,mg=/^-(-[\w-]*)?$/;const bg=new Ro,wg=["Declaration"];function vg(t){for(let e=t;;){if(e.type.isTop)return e;if(!(e=e.parent))return t}}function Sg(t,e,i){if(e.to-e.from>4096){let n=bg.get(e);if(n)return n;let s=[],r=new Set,o=e.cursor(mo.IncludeAnonymous);if(o.firstChild())do{for(let e of Sg(t,o.node,i))r.has(e.label)||(r.add(e.label),s.push(e))}while(o.nextSibling());return bg.set(e,s),s}{let n=[],s=new Set;return e.cursor().iterate((e=>{var r;if(i(e)&&e.matchContext(wg)&&":"==(null===(r=e.node.nextSibling)||void 0===r?void 0:r.name)){let i=t.sliceString(e.from,e.to);s.has(i)||(s.add(i),n.push({label:i,type:"variable"}))}})),n}}const yg=t=>e=>{let{state:i,pos:n}=e,s=Xa(i).resolveInner(n,-1),r=s.type.isError&&s.from==s.to-1&&"-"==i.doc.sliceString(s.from,s.to);if("PropertyName"==s.name||(r||"TagName"==s.name)&&/^(Block|Styles)$/.test(s.resolve(s.to).name))return{from:s.from,options:dg(),validFor:gg};if("ValueName"==s.name)return{from:s.from,options:pg,validFor:gg};if("PseudoClassName"==s.name)return{from:s.from,options:fg,validFor:gg};if(t(s)||(e.explicit||r)&&function(t,e){var i;if(("("==t.name||t.type.isError)&&(t=t.parent||t),"ArgList"!=t.name)return!1;let n=null===(i=t.parent)||void 0===i?void 0:i.firstChild;return"Callee"==(null==n?void 0:n.name)&&"var"==e.sliceString(n.from,n.to)}(s,i.doc))return{from:t(s)||r?s.from:n,options:Sg(i.doc,vg(s),t),validFor:mg};if("TagName"==s.name){for(let{parent:t}=s;t;t=t.parent)if("Block"==t.name)return{from:s.from,options:dg(),validFor:gg};return{from:s.from,options:Og,validFor:gg}}if(!e.explicit)return null;let o=s.resolve(n),a=o.childBefore(n);return a&&":"==a.name&&"PseudoClassSelector"==o.name?{from:n,options:fg,validFor:gg}:a&&":"==a.name&&"Declaration"==o.name||"ArgList"==o.name?{from:n,options:pg,validFor:gg}:"Block"==o.name||"Styles"==o.name?{from:n,options:dg(),validFor:gg}:null},xg=yg((t=>"VariableName"==t.name)),kg=_a.define({name:"css",parser:cg.configure({props:[Na.add({Declaration:il()}),rl.add({"Block KeyframeList":ol})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function Qg(){return new Ua(kg,kg.data.of({autocomplete:xg}))}const $g=["_blank","_self","_top","_parent"],Pg=["ascii","utf-8","utf-16","latin1","latin1"],Cg=["get","post","put","delete"],_g=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Xg=["true","false"],Zg={},Ag={a:{attrs:{href:null,ping:null,type:null,media:null,target:$g,hreflang:null}},abbr:Zg,address:Zg,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Zg,aside:Zg,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Zg,base:{attrs:{href:null,target:$g}},bdi:Zg,bdo:Zg,blockquote:{attrs:{cite:null}},body:Zg,br:Zg,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Zg,center:Zg,cite:Zg,code:Zg,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:Zg,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Zg,div:Zg,dl:Zg,dt:Zg,em:Zg,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Zg,figure:Zg,footer:Zg,form:{attrs:{action:null,name:null,"accept-charset":Pg,autocomplete:["on","off"],enctype:_g,method:Cg,novalidate:["novalidate"],target:$g}},h1:Zg,h2:Zg,h3:Zg,h4:Zg,h5:Zg,h6:Zg,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Zg,hgroup:Zg,hr:Zg,html:{attrs:{manifest:null}},i:Zg,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:Zg,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Zg,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:Zg,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Pg,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:Zg,noscript:Zg,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:Zg,param:{attrs:{name:null,value:null}},pre:Zg,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Zg,rt:Zg,ruby:Zg,samp:Zg,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Pg}},section:Zg,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Zg,source:{attrs:{src:null,type:null,media:null}},span:Zg,strong:Zg,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Zg,summary:Zg,sup:Zg,table:Zg,tbody:Zg,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Zg,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:Zg,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Zg,time:{attrs:{datetime:null}},title:Zg,tr:Zg,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Zg,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:Zg},Tg={accesskey:null,class:null,contenteditable:Xg,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Xg,autocorrect:Xg,autocapitalize:Xg,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Xg,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Xg,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Xg,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Xg,"aria-hidden":Xg,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Xg,"aria-multiselectable":Xg,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Xg,"aria-relevant":null,"aria-required":Xg,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},Rg="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map((t=>"on"+t));for(let t of Rg)Tg[t]=null;class Eg{constructor(t,e){this.tags=Object.assign(Object.assign({},Ag),t),this.globalAttrs=Object.assign(Object.assign({},Tg),e),this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}function Vg(t,e,i=t.length){if(!e)return"";let n=e.firstChild,s=n&&n.getChild("TagName");return s?t.sliceString(s.from,Math.min(s.to,i)):""}function Mg(t,e=!1){for(let i=t.parent;i;i=i.parent)if("Element"==i.name){if(!e)return i;e=!1}return null}function Dg(t,e,i){let n=i.tags[Vg(t,Mg(e,!0))];return(null==n?void 0:n.children)||i.allTags}function Wg(t,e){let i=[];for(let n=e;n=Mg(n);){let s=Vg(t,n);if(s&&"CloseTag"==n.lastChild.name)break;s&&i.indexOf(s)<0&&("EndTag"==e.name||e.from>=n.firstChild.to)&&i.push(s)}return i}Eg.default=new Eg;const Ug=/^[:\-\.\w\u00b7-\uffff]*$/;function Yg(t,e,i,n,s){let r=/\s*>/.test(t.sliceDoc(s,s+5))?"":">";return{from:n,to:s,options:Dg(t.doc,i,e).map((t=>({label:t,type:"type"}))).concat(Wg(t.doc,i).map(((t,e)=>({label:"/"+t,apply:"/"+t+r,type:"type",boost:99-e})))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function qg(t,e,i,n){let s=/\s*>/.test(t.sliceDoc(n,n+5))?"":">";return{from:i,to:n,options:Wg(t.doc,e).map(((t,e)=>({label:t,apply:t+s,type:"type",boost:99-e}))),validFor:Ug}}function Lg(t,e){let{state:i,pos:n}=e,s=Xa(i).resolveInner(n),r=s.resolve(n,-1);for(let t,e=n;s==r&&(t=r.childBefore(e));){let i=t.lastChild;if(!i||!i.type.isError||i.from({label:t,type:"property"}))),validFor:Ug}}(i,t,r,"AttributeName"==r.name?r.from:n,n):"Is"==r.name||"AttributeValue"==r.name||"UnquotedAttributeValue"==r.name?function(t,e,i,n,s){var r;let o,a=null===(r=i.parent)||void 0===r?void 0:r.getChild("AttributeName"),l=[];if(a){let r=t.sliceDoc(a.from,a.to),h=e.globalAttrs[r];if(!h){let n=Mg(i),s=n?e.tags[Vg(t.doc,n)]:null;h=(null==s?void 0:s.attrs)&&s.attrs[r]}if(h){let e=t.sliceDoc(n,s).toLowerCase(),i='"',r='"';/^['"]/.test(e)?(o='"'==e[0]?/^[^"]*$/:/^[^']*$/,i="",r=t.sliceDoc(s,s+1)==e[0]?"":e[0],e=e.slice(1),n++):o=/^[^\s<>='"]*$/;for(let t of h)l.push({label:t,apply:i+t+r,type:"constant"})}}return{from:n,to:s,options:l,validFor:o}}(i,t,r,"Is"==r.name?n:r.from,n):!e.explicit||"Element"!=s.name&&"Text"!=s.name&&"Document"!=s.name?null:function(t,e,i,n){let s=[],r=0;for(let n of Dg(t.doc,i,e))s.push({label:"<"+n,type:"type"});for(let e of Wg(t.doc,i))s.push({label:"",type:"type",boost:99-r++});return{from:n,to:n,options:s,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}(i,t,r,n)}function zg(t){let{extraTags:e,extraGlobalAttributes:i}=t,n=i||e?new Eg(e,i):Eg.default;return t=>Lg(n,t)}const Ig=[{tag:"script",attrs:t=>"text/typescript"==t.type||"ts"==t.lang,parser:zf.parser},{tag:"script",attrs:t=>"text/babel"==t.type||"text/jsx"==t.type,parser:If.parser},{tag:"script",attrs:t=>"text/typescript-jsx"==t.type,parser:Bf.parser},{tag:"script",attrs:t=>!t.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(t.type),parser:qf.parser},{tag:"style",attrs:t=>(!t.lang||"css"==t.lang)&&(!t.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(t.type)),parser:kg.parser}],Bg=[{name:"style",parser:kg.parser.configure({top:"Styles"})}].concat(Rg.map((t=>({name:t,parser:qf.parser})))),jg=_a.define({name:"html",parser:FO.configure({props:[Na.add({Element(t){let e=/^(\s*)(<\/)?/.exec(t.textAfter);return t.node.to<=t.pos+e[0].length?t.continue():t.lineIndent(t.node.from)+(e[2]?0:t.unit)},"OpenTag CloseTag SelfClosingTag":t=>t.column(t.node.from)+t.unit,Document(t){if(t.pos+/\s*/.exec(t.textAfter)[0].lengtht.getChild("TagName")})],wrap:tg(Ig,Bg)}),languageData:{commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-._"}});function Ng(t={}){let e,i="";!1===t.matchClosingTags&&(i="noMatch"),!0===t.selfClosingTags&&(i=(i?i+" ":"")+"selfClosing"),(t.nestedLanguages&&t.nestedLanguages.length||t.nestedAttributes&&t.nestedAttributes.length)&&(e=tg((t.nestedLanguages||[]).concat(Ig),(t.nestedAttributes||[]).concat(Bg)));let n=e||i?jg.configure({dialect:i,wrap:e}):jg;return new Ua(n,[jg.data.of({autocomplete:zg(t)}),!1!==t.autoCloseTags?Fg:[],Nf().support,Qg().support])}const Gg=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),Fg=Ts.inputHandler.of(((t,e,i,n)=>{if(t.composing||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!jg.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((e=>{var i,r,o;let a,{head:l}=e,h=Xa(s).resolveInner(l,-1);if("TagName"!=h.name&&"StartTag"!=h.name||(h=h.parent),">"==n&&"OpenTag"==h.name){if("CloseTag"!=(null===(r=null===(i=h.parent)||void 0===i?void 0:i.lastChild)||void 0===r?void 0:r.name)&&(a=Vg(s.doc,h.parent,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`${e?"":">"}`;return{range:A.cursor(l+1),changes:{from:l+(e?1:0),insert:i}}}}else if("/"==n&&"OpenTag"==h.name){let e=h.parent,i=null==e?void 0:e.parent;if(e.from==l-1&&"CloseTag"!=(null===(o=i.lastChild)||void 0===o?void 0:o.name)&&(a=Vg(s.doc,i,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`/${a}${e?"":">"}`,n=l+i.length+(e?1:0);return{range:A.cursor(n),changes:{from:l,insert:i}}}}return{range:e}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)})),Hg=Qa({commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}}}),Jg=new ho,Kg=sO.configure({props:[rl.add((t=>!t.is("Block")||t.is("Document")||null!=tm(t)?void 0:(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to}))),Jg.add(tm),Na.add({Document:()=>null}),ka.add({Document:Hg})]});function tm(t){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(t.name);return e?+e[1]:void 0}function em(t,e){let i=t;for(;;){let t,n=i.nextSibling;if(!n||null!=(t=tm(n.type))&&t<=e)break;i=n}return i.to}const im=sl.of(((t,e,i)=>{for(let n=Xa(t).resolveInner(i,-1);n&&!(n.fromi)return{from:i,to:e}}return null}));function nm(t){return new Pa(Hg,t,[im],"markdown")}const sm=nm(Kg),rm=nm(Kg.configure([pO,mO,gO,bO]));class om{constructor(t,e,i,n,s,r,o){this.node=t,this.from=e,this.to=i,this.spaceBefore=n,this.spaceAfter=s,this.type=r,this.item=o}blank(t,e=!0){let i=this.spaceBefore+("Blockquote"==this.node.name?">":"");if(null!=t){for(;i.length0;t--)i+=" ";return i+(e?this.spaceAfter:"")}marker(t,e){let i="OrderedList"==this.node.name?String(+lm(this.item,t)[2]+e):"";return this.spaceBefore+i+this.type+this.spaceAfter}}function am(t,e){let i=[];for(let e=t;e&&"Document"!=e.name;e=e.parent)"ListItem"!=e.name&&"Blockquote"!=e.name&&"FencedCode"!=e.name||i.push(e);let n=[];for(let t=i.length-1;t>=0;t--){let s,r=i[t],o=e.lineAt(r.from),a=r.from-o.from;if("FencedCode"==r.name)n.push(new om(r,a,a,"","","",null));else if("Blockquote"==r.name&&(s=/^[ \t]*>( ?)/.exec(o.text.slice(a))))n.push(new om(r,a,a+s[0].length,"",s[1],">",null));else if("ListItem"==r.name&&"OrderedList"==r.parent.name&&(s=/^([ \t]*)\d+([.)])([ \t]*)/.exec(o.text.slice(a)))){let t=s[3],e=s[0].length;t.length>=4&&(t=t.slice(0,t.length-4),e-=4),n.push(new om(r.parent,a,a+e,s[1],t,s[2],r))}else if("ListItem"==r.name&&"BulletList"==r.parent.name&&(s=/^([ \t]*)([-+*])([ \t]{1,4}\[[ xX]\])?([ \t]+)/.exec(o.text.slice(a)))){let t=s[4],e=s[0].length;t.length>4&&(t=t.slice(0,t.length-4),e-=4);let i=s[2];s[3]&&(i+=s[3].replace(/[xX]/," ")),n.push(new om(r.parent,a,a+e,s[1],t,i,r))}}return n}function lm(t,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(t.from,t.from+10))}function hm(t,e,i,n=0){for(let s=-1,r=t;;){if("ListItem"==r.name){let t=lm(r,e),o=+t[2];if(s>=0){if(o!=s+1)return;i.push({from:r.from+t[1].length,to:r.from+t[0].length,insert:String(s+2+n)})}s=o}let t=r.nextSibling;if(!t)break;r=t}}function cm(t){return"QuoteMark"==t.name||"ListMark"==t.name}const um=[{key:"Enter",run:({state:t,dispatch:e})=>{let i=Xa(t),{doc:n}=t,s=null,r=t.changeByRange((e=>{if(!e.empty||!rm.isActiveAt(t,e.from))return s={range:e};let r=e.from,o=n.lineAt(r),a=am(i.resolveInner(r,-1),n);for(;a.length&&a[a.length-1].from>r-o.from;)a.pop();if(!a.length)return s={range:e};let l=a[a.length-1];if(l.to-l.spaceAfter.length>r-o.from)return s={range:e};let h=r>=l.to-l.spaceAfter.length&&!/\S/.test(o.text.slice(l.to));if(l.item&&h){if(l.node.firstChild.to>=r||o.from>0&&!/[^\s>]/.test(n.lineAt(o.from-1).text)){let t,e=a.length>1?a[a.length-2]:null,i="";e&&e.item?(t=o.from+e.from,i=e.marker(n,1)):t=o.from+(e?e.to:0);let s=[{from:t,to:r,insert:i}];return"OrderedList"==l.node.name&&hm(l.item,n,s,-2),e&&"OrderedList"==e.node.name&&hm(e.item,n,s),{range:A.cursor(t+i.length),changes:s}}{let e="";for(let t=0,i=a.length-2;t<=i;t++)e+=a[t].blank(t\s*$/.exec(i.text);if(s&&s.index==l.from){let n=t.changes([{from:i.from+s.index,to:i.to},{from:o.from+l.from,to:o.to}]);return{range:e.map(n),changes:n}}}let c=[];"OrderedList"==l.node.name&&hm(l.item,n,c);let u=l.item&&l.item.from]*/.exec(o.text)[0].length>=l.to)for(let t=0,e=a.length-1;t<=e;t++)d+=t!=e||u?a[t].blank(to.from&&/\s/.test(o.text.charAt(f-o.from-1));)f--;return d=t.lineBreak+d,c.push({from:f,to:r,insert:d}),{range:A.cursor(f+d.length),changes:c}}));return!s&&(e(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0)}},{key:"Backspace",run:({state:t,dispatch:e})=>{let i=Xa(t),n=null,s=t.changeByRange((e=>{let s=e.from,{doc:r}=t;if(e.empty&&rm.isActiveAt(t,e.from)){let t=r.lineAt(s),n=am(function(t,e){let i=t.resolveInner(e,-1),n=e;cm(i)&&(n=i.from,i=i.parent);for(let t;t=i.childBefore(n);)if(cm(t))n=t.from;else{if("OrderedList"!=t.name&&"BulletList"!=t.name)break;i=t.lastChild,n=i.to}return i}(i,s),r);if(n.length){let i=n[n.length-1],r=i.to-i.spaceAfter.length+(i.spaceAfter?1:0);if(s-t.from>r&&!/\S/.test(t.text.slice(r,s-t.from)))return{range:A.cursor(t.from+r),changes:{from:t.from+r,to:s}};if(s-t.from==r&&(!i.item||t.from<=i.item.from||!/\S/.test(t.text.slice(0,i.to)))){let n=t.from+i.from;if(i.item&&i.node.fromt.from-e.from||t.startSide-e.startSide)),ni.set(i)}getMatchingBracket(t){switch(t){case")":return"(";case"]":return"[";case"}":return"{";default:return null}}},{decorations:t=>t.decorations});var fm="[a-zA-Z\\$][a-zA-Z0-9\\$]*",pm="(?:\\.\\d+|\\d+\\.\\d*|\\d+)",Om="(?:`(?:`?"+pm+")?)",gm=new RegExp("(?:(?:\\d+)(?:\\^\\^(?:\\.\\w+|\\w+\\.\\w*|\\w+)"+Om+"?(?:\\*\\^[+-]?\\d+)?))"),mm=new RegExp("(?:"+pm+Om+"?(?:\\*\\^[+-]?\\d+)?)"),bm=new RegExp("(?:`?)(?:"+fm+")(?:`(?:"+fm+"))*(?:`?)");let wm=[];const vm=["True","False","All","None","Null","Full","$Failed","$Aborted"];function Sm(t,e){var i;return'"'===(i=t.next())?(e.tokenize=ym,e.tokenize(t,e)):"("===i&&t.eat("*")?(e.commentLevel++,e.tokenize=xm,e.tokenize(t,e)):(t.backUp(1),t.match(gm,!0,!1)||t.match(mm,!0,!1)?"number":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::usage)/,!0,!1)?"meta":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::[a-zA-Z\$][a-zA-Z0-9\$]*):?/,!0,!1)?"string.special":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*\s*:)(?:(?:[a-zA-Z\$][a-zA-Z0-9\$]*)|(?:[^:=>~@\^\&\*\)\[\]'\?,\|])).*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+/,!0,!1)||t.match(/_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)?"variableName.special":t.match(/\\\[[a-zA-Z\$][a-zA-Z0-9\$]*\]/,!0,!1)?"character":t.match(/(?:\[|\]|{|}|\(|\))/,!0,!1)?"bracket":t.match(/(?:#[a-zA-Z\$][a-zA-Z0-9\$]*|#+[0-9]?)/,!0,!1)?"variableName.constant":t.match(bm,!0,!1)?vm.indexOf(t.current())>-1?"number":wm.indexOf(t.current())>-1||0==wm.length?"keyword":t.current()in e.localVars?"atom":(e.localVars[t.current()]=!0,"function"):t.match(/(?:\\|\+|\-|\*|\/|,|;|\.|:|@|~|=|>|<|&|\||_|`|'|\^|\?|!|%)/,!0,!1)?"operator":(t.next(),"error"))}function ym(t,e){for(var i,n=!1,s=!1;null!=(i=t.next());){if('"'===i&&!s){n=!0;break}s=!s&&"\\"===i}return n&&!s&&(e.tokenize=Sm),"string"}function xm(t,e){for(var i,n;e.commentLevel>0&&null!=(n=t.next());)"("===i&&"*"===n&&e.commentLevel++,"*"===i&&")"===n&&e.commentLevel--,i=n;return e.commentLevel<=0&&(e.tokenize=Sm),"comment"}const km={name:"mathematica",extendVariables:function(t){},startState:function(){return{tokenize:Sm,commentLevel:0,localVars:{}}},token:function(t,e){return t.eatSpace()?null:e.tokenize(t,e)},languageData:{commentTokens:{block:{open:"(*",close:"*)"}}}};let Qm={of:t=>[Gl.define(km),Yd({override:[async e=>function(t,e){let i=t.matchBefore(/\w*/);return i.from!==i.to||t.explicit?{from:i.from,options:e.data}:null}(e,t)]}),Ys.of([{key:"Escape",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((t=>{let{from:e,to:i}=t;return{changes:{from:e,to:i,insert:"EC"},range:A.cursor(e+2)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])],reBuild:t=>{wm=t.map((t=>t.label))}};const $m=(t,e,i,n)=>{if(0==t.length)return;const s=(new Date).valueOf();n.transaction(e,i,s,t.length);for(const r of t)Pm(r,((t,r)=>{n.file(e,i,s,t,r)}))};function Pm(t,e){const i=new FileReader;i.addEventListener("load",(i=>{let n=base64ArrayBuffer(i.target.result);e(t.name,n)})),i.addEventListener("progress",(t=>{if(t.loaded&&t.total){const e=t.loaded/t.total*100;console.log(e)}})),i.readAsArrayBuffer(t)}const Cm=(t,e)=>Ts.domEventHandlers({drop(e,i){e.preventDefault();const n=[];e.dataTransfer.items?[...e.dataTransfer.items].forEach(((t,e)=>{if("file"===t.kind){const i=t.getAsFile();console.log(`… file[${e}].name = ${i.name}`),n.push(i)}})):[...e.dataTransfer.files].forEach(((t,e)=>{console.log(`… file[${e}].name = ${t.name}`),n.push(t)})),$m(n,e,i,t)},paste(t,i){let n=t.clipboardData||window.clipboardData;for(const s of n.items)if("string"===s.kind)switch(s.type){case"text/plain":break;case"image/png":t.preventDefault(),$m([s.getAsFile()],t,i,e)}else t.preventDefault(),$m([s.getAsFile()],t,i,e)}}),_m=new pr({regexp:/\\\[(\w+)\]/g,decoration:t=>ni.replace({widget:new Zm(t[1])})}),Xm=_i.fromClass(class{constructor(t){this.Greekholder=_m.createDeco(t)}update(t){this.Greekholder=_m.updateDeco(t,this.Greekholder)}},{decorations:t=>t.Greekholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Greekholder||ni.none))});class Zm extends ei{constructor(t){super(),this.name=t}eq(t){return this.name===t.name}toDOM(){let t=document.createElement("span");return t.innerHTML="&"+this.name.toLowerCase().replace("sqrt","radic").replace("undirectededge","harr").replace("directededge","rarr").replace(/capital(.*)/,((t,e)=>e.charAt(0).toUpperCase()+e.slice(1))).replace(/curly(.*)/,((t,e)=>e)).replace(/script(.*)/,((t,e)=>"el"+e.toLowerCase())).replace("transpose","#7488").replace("degree","deg")+";",t}ignoreEvent(){return!1}}const Am=new pr({regexp:/(->|<-)/g,decoration:t=>ni.replace({widget:new Tm(t[1])})});_i.fromClass(class{constructor(t){this.Arrowholder=Am.createDeco(t)}update(t){this.Arrowholder=Am.updateDeco(t,this.Arrowholder)}},{decorations:t=>t.Arrowholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Arrowholder||ni.none))});class Tm extends ei{constructor(t){super(),this.dir=t}eq(t){return this.dir===t.dir}toDOM(){let t=document.createElement("span");return"->"===this.dir?t.innerText="→":t.innerText="←",t}ignoreEvent(){return!1}}function Rm(t){if(!(t=t||{}).open)throw new Error('Balanced: please provide a "open" property');if(!t.close)throw new Error('Balanced: please provide a "close" property');if(this.balance=t.balance||!1,this.exceptions=t.exceptions||!1,this.caseInsensitive=t.caseInsensitive,this.head=t.head||t.open,this.head=Array.isArray(this.head)?this.head:[this.head],this.open=Array.isArray(t.open)?t.open:[t.open],this.close=Array.isArray(t.close)?t.close:[t.close],!Array.isArray(this.head)||!Array.isArray(this.open)||!Array.isArray(this.close)||this.head.length!==this.open.length||this.open.length!==this.close.length)throw new Error('Balanced: if you use arrays for a "head,open,close" you must use matching arrays for all options');var e=Dm(this.head.map(this.regExpFromArrayGroupedMap,this)),i=Dm(this.open.map(this.regExpFromArrayGroupedMap,this)),n=Dm(this.close.map(this.regExpFromArrayGroupedMap,this));this.regExp=Dm([e,i,n],"g"+(this.caseInsensitive?"i":"")),this.regExpGroupLength=this.head.length}function Em(t,e,i){for(var n=Mm(e.substr(0,i+1),/^.*\n?$/gim),s=Mm(e,/^.*\n?$/gim),r=n.length-1,o=i+1-(n.length?n[n.length-1].index:0),a="",l=2;l>=0;l--)r-l>=0&&s[r-l]&&(a+=e.substr(s[r-l].index,s[r-l].length)+"\n");for(l=0;l=0&&s[r+l]&&(a+=e.substr(s[r+l].index,s[r+l].length)+"\n");a=a.replace(/\t/g," ").replace(/\n$/,"");var h=new Error(t+" at "+(r+1)+":"+o+"\n\n"+a);return h.line=r+1,h.column=o,h.index=i,h}function Vm(t,e){return t>=e.index&&t<=e.index+e.length-1}function Mm(t,e){var i,n=new RegExp(e),s=[];if(t)for(;i=n.exec(t);)s.push({index:i.index,length:i[0].length,match:i[0]}),i[0].length||n.lastIndex++;return s}function Dm(t,e,i){var n=t.map((function(t){return t instanceof RegExp?t.source:function(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}(t)}),this).join("|");return n=i?"("+n+")":"(?:"+n+")",new RegExp(n,e||void 0)}Rm.prototype={regExpFromArrayGroupedMap:function(t){return Dm([t],null,!0)},matchContentsInBetweenBrackets:function(t,e){for(var i,n=new RegExp(this.regExp),s=[],r=[],o=null,a=!0;i=n.exec(t);){if(e){for(var l=!1,h=0;h{const i=((t,e,i)=>{var n,s=new RegExp(t),r=[];if(e)for(;n=s.exec(e);){if(i){for(var o=!1,a=0;a{new qm({open:"(*"+t+"[*)",close:"(*]"+t+"*)",balance:!1}).matchContentsInBetweenBrackets(e.value,[]).forEach((function(t){const s=e.value.slice(t.index+t.head.length,t.index+t.length-t.tail.length);n(i+t.index,{length:t.length,pos:i+t.index,argsPos:i+t.index+t.head.length,str:s})}))})(e,t,i,s)},o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)r(o,a)}var Im,Bm=function(){function t(t){var e=t.tag,i=t.decoration,n=t.decorate,s=t.boundary,r=t.maxLength,o=void 0===r?1e3:r;if(this.tag=e,n)this.addMatch=function(t,e,i,s){return n(s,i,i+t.length,t,e)};else if("function"==typeof i)this.addMatch=function(t,e,n,s){var r=i(t,e,n);r&&s(n,n+t.length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=function(t,e,n,s){return s(n,n+t.length,i)}}this.boundary=s,this.maxLength=o}return t.prototype.createDeco=function(t){for(var e=this,i=new Xt,n=i.add.bind(i),s=0,r=function(t,e){var i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;for(var n=[],s=0,r=i;s=a?n[n.length-1].to=l:n.push({from:a,to:l})}return n}(t,this.maxLength);st.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e},t.prototype.updateRange=function(t,e,i,n){for(var s=this,r=function(r){var a=Math.max(r.from,i),l=Math.min(r.to,n);if(l>a){var h=t.state.doc.lineAt(a),c=h.toh.from;a--)if(o.boundary.test(h.text[a-1-h.from])){u=a;break}for(;ld},add:f})}},o=this,a=0,l=t.visibleRanges;a{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*FB[*)((_)(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*FB[*)(("+s+")(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let Nm=class{constructor(t,e,i,n,s,r){this.view=e,this.visibleValue=t,this.placeholder=r,console.log(r),this.args=Lm(t.str,/\(\*,\*\)/gm);const o=this;let a,l;console.log("creating InstanceWidget"),a=Im({doc:o.args[0].body.slice(2,-1),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(o.visibleValue.pos),e.dispatch({selection:{anchor:o.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return l.dispatch({selection:{anchor:0}}),l.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){l.focus(),t.editorLastCursor=void 0}}])]}),l=Im({doc:o.args[2].body.slice(1,-2),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:a.state.doc.length}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:o.visibleValue.pos+o.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus(),t.editorLastCursor=void 0}}])]}),o.args[0].length=o.args[0].body.length,o.args[2].length=o.args[2].body.length,delete o.args[2].body,delete o.args[1].body,delete o.args[0].body,this.topEditor=a,this.bottomEditor=l}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="(("+t+")",s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length));const r=e.length-i[0].length;i[0].to=i[0].to+r,i[2].from=i[2].from+r,i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e="("+t+"))",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length));const r=e.length-i[2].length;i[2].to=i[2].to+r,i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t,e){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm),console.log("recreating InstanceWidget"),n=Im.state({doc:e.args[0].body.slice(2,-1),update:t=>e.applyChanges(t,0),eval:()=>{i.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(e.visibleValue.pos),i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus(),t.editorLastCursor=void 0}}])]}),s=Im.state({doc:e.args[2].body.slice(1,-2),update:t=>e.applyChanges(t,2),eval:()=>{e.view.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus(),t.editorLastCursor=void 0}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),console.log(e),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.placeholder=e,this.visibleValue.argsPos=t.argsPos}destroy(){this.topEditor.destroy(),this.bottomEditor.destroy()}},Gm=class extends ei{constructor(t,e,i,n){super(),this.view=i,this.visibleValue=t,this.reference=e,this.placeholder=n}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue,this),!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("fraction");const i=document.createElement("table");i.classList.add("container"),e.appendChild(i);const n=document.createElement("tbody");i.appendChild(n);const s=document.createElement("tr"),r=document.createElement("tr");n.appendChild(s),n.appendChild(r);const o=document.createElement("td");o.classList.add("enumenator"),s.appendChild(o);const a=document.createElement("td");r.appendChild(a);const l=this;return e.EditorWidget=new Nm(this.visibleValue,t,o,a,[],this),this.DOMElement=e,this.reference.push({destroy:()=>{l.destroy(e)}}),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const Fm=(t,e,i)=>new Bm({tag:"FB",decoration:n=>ni.replace({widget:new Gm(n,t,e,i)})}),Hm=t=>_i.fromClass(class{constructor(e){this.disposable=[],this.placeholder=Fm(this.disposable,e,this).createDeco(e),t.placeholder=this}update(t){this.placeholder=Fm(this.disposable,t,this).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var Jm;function Km(t){return Jm=t,[nb,Ys.of([{key:"Ctrl-2",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt[_](*]SqB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt["+s+"](*]SqB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let tb=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;this.sliceRanges=n,this.length=t.str.length,console.log("creating InstanceWidget"),this.editor=Jm({doc:t.str.slice(...n),parent:i,update:t=>r.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]})}applyChanges(t){const e=t,i={from:this.visibleValue.argsPos+5,to:this.visibleValue.argsPos+this.length-1,insert:e};console.log(this.visibleValue);const n=e.length+6-this.length;this.length=this.length+n,this.visibleValue.length=this.visibleValue.length+n,this.visibleValue.str="Sqrt["+e+"]",this.view.dispatch({changes:i})}update(t){if(this.visibleValue.str==t.str)this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos;else{console.warn("Out of sync"),this.visibleValue=t;const e=this.sliceRanges,i=this.editor,n=this,s=this.view;this.length=t.str.length;const r=Jm.state({doc:t.str.slice(...e),update:t=>n.applyChanges(t),eval:()=>{s.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos+n.visibleValue.length}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]});i.setState(r)}}destroy(){console.warn("destroy Instance of Widget!"),this.editor.destroy()}},eb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("sqroot");const i=this,n=document.createElement("span");return n.classList.add("radicand"),e.EditorWidget=new tb(this.visibleValue,t,n,[5,-1],[]),e.appendChild(n),this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const ib=(t,e)=>new Bm({tag:"SqB",decoration:i=>ni.replace({widget:new eb(i,t,e)})}),nb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=ib(this.disposable,t).createDeco(t)}update(t){this.placeholder=ib(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var sb;function rb(t){return sb=t,[hb,Ys.of([{key:"Ctrl--",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SbB[*)Subscript[_(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SbB[*)Subscript["+s+"(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let ob=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),console.log(r.visibleValue),o=sb({doc:r.args[0].body.slice(10),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){a.focus()}}])]}),a=sb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Subscript["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),console.log(e.visibleValue),n=sb.state({doc:e.args[0].body.slice(10),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus()}}])]}),s=sb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},ab=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sub");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new ob(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const lb=(t,e)=>new Bm({tag:"SbB",decoration:i=>ni.replace({widget:new ab(i,t,e)})}),hb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=lb(this.disposable,t).createDeco(t)}update(t){this.placeholder=lb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var cb;function ub(t){return cb=t,[Ob,Ys.of([{key:"Ctrl-6",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SpB[*)Power[_(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SpB[*)Power["+s+"(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let db=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),o=cb({doc:r.args[0].body.slice(6),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus()}}])]}),a=cb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Power["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),n=cb.state({doc:e.args[0].body.slice(6),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.bottomEditor.focus()}}])]}),s=cb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},fb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sup");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new db(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}destroy(t){t.EditorWidget.destroy()}};const pb=(t,e)=>new Bm({tag:"SpB",decoration:i=>ni.replace({widget:new fb(i,t,e)})}),Ob=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=pb(this.disposable,t).createDeco(t)}update(t){this.placeholder=pb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var gb={},mb={},bb={},wb={};function vb(t){let e=t.length;for(;--e>=0;)t[e]=0}const Sb=256,yb=286,xb=30,kb=15,Qb=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),$b=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Pb=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Cb=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_b=new Array(576);vb(_b);const Xb=new Array(60);vb(Xb);const Zb=new Array(512);vb(Zb);const Ab=new Array(256);vb(Ab);const Tb=new Array(29);vb(Tb);const Rb=new Array(xb);function Eb(t,e,i,n,s){this.static_tree=t,this.extra_bits=e,this.extra_base=i,this.elems=n,this.max_length=s,this.has_stree=t&&t.length}let Vb,Mb,Db;function Wb(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}vb(Rb);const Ub=t=>t<256?Zb[t]:Zb[256+(t>>>7)],Yb=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},qb=(t,e,i)=>{t.bi_valid>16-i?(t.bi_buf|=e<>16-t.bi_valid,t.bi_valid+=i-16):(t.bi_buf|=e<{qb(t,i[2*e],i[2*e+1])},zb=(t,e)=>{let i=0;do{i|=1&t,t>>>=1,i<<=1}while(--e>0);return i>>>1},Ib=(t,e,i)=>{const n=new Array(16);let s,r,o=0;for(s=1;s<=kb;s++)o=o+i[s-1]<<1,n[s]=o;for(r=0;r<=e;r++){let e=t[2*r+1];0!==e&&(t[2*r]=zb(n[e]++,e))}},Bb=t=>{let e;for(e=0;e{t.bi_valid>8?Yb(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},Nb=(t,e,i,n)=>{const s=2*e,r=2*i;return t[s]{const n=t.heap[i];let s=i<<1;for(;s<=t.heap_len&&(s{let n,s,r,o,a=0;if(0!==t.sym_next)do{n=255&t.pending_buf[t.sym_buf+a++],n+=(255&t.pending_buf[t.sym_buf+a++])<<8,s=t.pending_buf[t.sym_buf+a++],0===n?Lb(t,s,e):(r=Ab[s],Lb(t,r+Sb+1,e),o=Qb[r],0!==o&&(s-=Tb[r],qb(t,s,o)),n--,r=Ub(n),Lb(t,r,i),o=$b[r],0!==o&&(n-=Rb[r],qb(t,n,o)))}while(a{const i=e.dyn_tree,n=e.stat_desc.static_tree,s=e.stat_desc.has_stree,r=e.stat_desc.elems;let o,a,l,h=-1;for(t.heap_len=0,t.heap_max=573,o=0;o>1;o>=1;o--)Gb(t,i,o);l=r;do{o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Gb(t,i,1),a=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=a,i[2*l]=i[2*o]+i[2*a],t.depth[l]=(t.depth[o]>=t.depth[a]?t.depth[o]:t.depth[a])+1,i[2*o+1]=i[2*a+1]=l,t.heap[1]=l++,Gb(t,i,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const i=e.dyn_tree,n=e.max_code,s=e.stat_desc.static_tree,r=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,l=e.stat_desc.max_length;let h,c,u,d,f,p,O=0;for(d=0;d<=kb;d++)t.bl_count[d]=0;for(i[2*t.heap[t.heap_max]+1]=0,h=t.heap_max+1;h<573;h++)c=t.heap[h],d=i[2*i[2*c+1]+1]+1,d>l&&(d=l,O++),i[2*c+1]=d,c>n||(t.bl_count[d]++,f=0,c>=a&&(f=o[c-a]),p=i[2*c],t.opt_len+=p*(d+f),r&&(t.static_len+=p*(s[2*c+1]+f)));if(0!==O){do{for(d=l-1;0===t.bl_count[d];)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[l]--,O-=2}while(O>0);for(d=l;0!==d;d--)for(c=t.bl_count[d];0!==c;)u=t.heap[--h],u>n||(i[2*u+1]!==d&&(t.opt_len+=(d-i[2*u+1])*i[2*u],i[2*u+1]=d),c--)}})(t,e),Ib(i,h,t.bl_count)},Jb=(t,e,i)=>{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),e[2*(i+1)+1]=65535,n=0;n<=i;n++)s=o,o=e[2*(n+1)+1],++a{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),n=0;n<=i;n++)if(s=o,o=e[2*(n+1)+1],!(++a{qb(t,0+(n?1:0),3),jb(t),Yb(t,i),Yb(t,~i),i&&t.pending_buf.set(t.window.subarray(e,e+i),t.pending),t.pending+=i};wb._tr_init=t=>{tw||((()=>{let t,e,i,n,s;const r=new Array(16);for(i=0,n=0;n<28;n++)for(Tb[n]=i,t=0;t<1<>=7;n{let s,r,o=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e{let e;for(Jb(t,t.dyn_ltree,t.l_desc.max_code),Jb(t,t.dyn_dtree,t.d_desc.max_code),Hb(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*Cb[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=i+5,i+4<=s&&-1!==e?ew(t,e,i,n):4===t.strategy||r===s?(qb(t,2+(n?1:0),3),Fb(t,_b,Xb)):(qb(t,4+(n?1:0),3),((t,e,i,n)=>{let s;for(qb(t,e-257,5),qb(t,i-1,5),qb(t,n-4,4),s=0;s(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=i,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(Ab[i]+Sb+1)]++,t.dyn_dtree[2*Ub(e)]++),t.sym_next===t.sym_end),wb._tr_align=t=>{qb(t,2,3),Lb(t,256,_b),(t=>{16===t.bi_valid?(Yb(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)};var iw=(t,e,i,n)=>{let s=65535&t|0,r=t>>>16&65535|0,o=0;for(;0!==i;){o=i>2e3?2e3:i,i-=o;do{s=s+e[n++]|0,r=r+s|0}while(--o);s%=65521,r%=65521}return s|r<<16|0};const nw=new Uint32Array((()=>{let t,e=[];for(var i=0;i<256;i++){t=i;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e})());var sw=(t,e,i,n)=>{const s=nw,r=n+i;t^=-1;for(let i=n;i>>8^s[255&(t^e[i])];return-1^t},rw={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},ow={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:aw,_tr_stored_block:lw,_tr_flush_block:hw,_tr_tally:cw,_tr_align:uw}=wb,dw=iw,fw=sw,pw=rw,{Z_NO_FLUSH:Ow,Z_PARTIAL_FLUSH:gw,Z_FULL_FLUSH:mw,Z_FINISH:bw,Z_BLOCK:ww,Z_OK:vw,Z_STREAM_END:Sw,Z_STREAM_ERROR:yw,Z_DATA_ERROR:xw,Z_BUF_ERROR:kw,Z_DEFAULT_COMPRESSION:Qw,Z_FILTERED:$w,Z_HUFFMAN_ONLY:Pw,Z_RLE:Cw,Z_FIXED:_w,Z_DEFAULT_STRATEGY:Xw,Z_UNKNOWN:Zw,Z_DEFLATED:Aw}=ow,Tw=258,Rw=262,Ew=42,Vw=113,Mw=666,Dw=(t,e)=>(t.msg=pw[e],e),Ww=t=>2*t-(t>4?9:0),Uw=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Yw=t=>{let e,i,n,s=t.w_size;e=t.hash_size,n=e;do{i=t.head[--n],t.head[n]=i>=s?i-s:0}while(--e);e=s,n=e;do{i=t.prev[--n],t.prev[n]=i>=s?i-s:0}while(--e)};let qw=(t,e,i)=>(e<{const e=t.state;let i=e.pending;i>t.avail_out&&(i=t.avail_out),0!==i&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+i),t.next_out),t.next_out+=i,e.pending_out+=i,t.total_out+=i,t.avail_out-=i,e.pending-=i,0===e.pending&&(e.pending_out=0))},zw=(t,e)=>{hw(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Lw(t.strm)},Iw=(t,e)=>{t.pending_buf[t.pending++]=e},Bw=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},jw=(t,e,i,n)=>{let s=t.avail_in;return s>n&&(s=n),0===s?0:(t.avail_in-=s,e.set(t.input.subarray(t.next_in,t.next_in+s),i),1===t.state.wrap?t.adler=dw(t.adler,e,s,i):2===t.state.wrap&&(t.adler=fw(t.adler,e,s,i)),t.next_in+=s,t.total_in+=s,s)},Nw=(t,e)=>{let i,n,s=t.max_chain_length,r=t.strstart,o=t.prev_length,a=t.nice_match;const l=t.strstart>t.w_size-Rw?t.strstart-(t.w_size-Rw):0,h=t.window,c=t.w_mask,u=t.prev,d=t.strstart+Tw;let f=h[r+o-1],p=h[r+o];t.prev_length>=t.good_match&&(s>>=2),a>t.lookahead&&(a=t.lookahead);do{if(i=e,h[i+o]===p&&h[i+o-1]===f&&h[i]===h[r]&&h[++i]===h[r+1]){r+=2,i++;do{}while(h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&ro){if(t.match_start=e,o=n,n>=a)break;f=h[r+o-1],p=h[r+o]}}}while((e=u[e&c])>l&&0!=--s);return o<=t.lookahead?o:t.lookahead},Gw=t=>{const e=t.w_size;let i,n,s;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Rw)&&(t.window.set(t.window.subarray(e,e+e-n),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Yw(t),n+=e),0===t.strm.avail_in)break;if(i=jw(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=i,t.lookahead+t.insert>=3)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=qw(t,t.ins_h,t.window[s+1]);t.insert&&(t.ins_h=qw(t,t.ins_h,t.window[s+3-1]),t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead{let i,n,s,r=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,o=0,a=t.strm.avail_in;do{if(i=65535,s=t.bi_valid+42>>3,t.strm.avail_outn+t.strm.avail_in&&(i=n+t.strm.avail_in),i>s&&(i=s),i>8,t.pending_buf[t.pending-2]=~i,t.pending_buf[t.pending-1]=~i>>8,Lw(t.strm),n&&(n>i&&(n=i),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+n),t.strm.next_out),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n,t.block_start+=n,i-=n),i&&(jw(t.strm,t.strm.output,t.strm.next_out,i),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i)}while(0===o);return a-=t.strm.avail_in,a&&(a>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=a&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-a,t.strm.next_in),t.strstart),t.strstart+=a,t.insert+=a>t.w_size-t.insert?t.w_size-t.insert:a),t.block_start=t.strstart),t.high_waters&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,s+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),s>t.strm.avail_in&&(s=t.strm.avail_in),s&&(jw(t.strm,t.window,t.strstart,s),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.high_water>3,s=t.pending_buf_size-s>65535?65535:t.pending_buf_size-s,r=s>t.w_size?t.w_size:s,n=t.strstart-t.block_start,(n>=r||(n||e===bw)&&e!==Ow&&0===t.strm.avail_in&&n<=s)&&(i=n>s?s:n,o=e===bw&&0===t.strm.avail_in&&i===n?1:0,lw(t,t.block_start,i,o),t.block_start+=i,Lw(t.strm)),o?3:1)},Hw=(t,e)=>{let i,n;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==i&&t.strstart-i<=t.w_size-Rw&&(t.match_length=Nw(t,i)),t.match_length>=3)if(n=cw(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=qw(t,t.ins_h,t.window[t.strstart+1]);else n=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2},Jw=(t,e)=>{let i,n,s;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==i&&t.prev_length4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){s=t.strstart+t.lookahead-3,n=cw(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=s&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(zw(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(n=cw(t,0,t.window[t.strstart-1]),n&&zw(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=cw(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2};function Kw(t,e,i,n,s){this.good_length=t,this.max_lazy=e,this.nice_length=i,this.max_chain=n,this.func=s}const tv=[new Kw(0,0,0,0,Fw),new Kw(4,4,8,4,Hw),new Kw(4,5,16,8,Hw),new Kw(4,6,32,32,Hw),new Kw(4,4,16,16,Jw),new Kw(8,16,32,32,Jw),new Kw(8,16,128,128,Jw),new Kw(8,32,128,256,Jw),new Kw(32,128,258,1024,Jw),new Kw(32,258,258,4096,Jw)];function ev(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Aw,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Uw(this.dyn_ltree),Uw(this.dyn_dtree),Uw(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Uw(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Uw(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const iv=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==Ew&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==Vw&&e.status!==Mw?1:0},nv=t=>{if(iv(t))return Dw(t,yw);t.total_in=t.total_out=0,t.data_type=Zw;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?Ew:Vw,t.adler=2===e.wrap?0:1,e.last_flush=-2,aw(e),vw},sv=t=>{const e=nv(t);var i;return e===vw&&((i=t.state).window_size=2*i.w_size,Uw(i.head),i.max_lazy_match=tv[i.level].max_lazy,i.good_match=tv[i.level].good_length,i.nice_match=tv[i.level].nice_length,i.max_chain_length=tv[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=2,i.match_available=0,i.ins_h=0),e},rv=(t,e,i,n,s,r)=>{if(!t)return yw;let o=1;if(e===Qw&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),s<1||s>9||i!==Aw||n<8||n>15||e<0||e>9||r<0||r>_w||8===n&&1!==o)return Dw(t,yw);8===n&&(n=9);const a=new ev;return t.state=a,a.strm=t,a.status=Ew,a.wrap=o,a.gzhead=null,a.w_bits=n,a.w_size=1<rv(t,e,Aw,15,8,Xw),bb.deflateInit2=rv,bb.deflateReset=sv,bb.deflateResetKeep=nv,bb.deflateSetHeader=(t,e)=>iv(t)||2!==t.state.wrap?yw:(t.state.gzhead=e,vw),bb.deflate=(t,e)=>{if(iv(t)||e>ww||e<0)return t?Dw(t,yw):yw;const i=t.state;if(!t.output||0!==t.avail_in&&!t.input||i.status===Mw&&e!==bw)return Dw(t,0===t.avail_out?kw:yw);const n=i.last_flush;if(i.last_flush=e,0!==i.pending){if(Lw(t),0===t.avail_out)return i.last_flush=-1,vw}else if(0===t.avail_in&&Ww(e)<=Ww(n)&&e!==bw)return Dw(t,kw);if(i.status===Mw&&0!==t.avail_in)return Dw(t,kw);if(i.status===Ew&&0===i.wrap&&(i.status=Vw),i.status===Ew){let e=Aw+(i.w_bits-8<<4)<<8,n=-1;if(n=i.strategy>=Pw||i.level<2?0:i.level<6?1:6===i.level?2:3,e|=n<<6,0!==i.strstart&&(e|=32),e+=31-e%31,Bw(i,e),0!==i.strstart&&(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),t.adler=1,i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(57===i.status)if(t.adler=0,Iw(i,31),Iw(i,139),Iw(i,8),i.gzhead)Iw(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),Iw(i,255&i.gzhead.time),Iw(i,i.gzhead.time>>8&255),Iw(i,i.gzhead.time>>16&255),Iw(i,i.gzhead.time>>24&255),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(Iw(i,255&i.gzhead.extra.length),Iw(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=fw(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if(Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,3),i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw;if(69===i.status){if(i.gzhead.extra){let e=i.pending,n=(65535&i.gzhead.extra.length)-i.gzindex;for(;i.pending+n>i.pending_buf_size;){let s=i.pending_buf_size-i.pending;if(i.pending_buf.set(i.gzhead.extra.subarray(i.gzindex,i.gzindex+s),i.pending),i.pending=i.pending_buf_size,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex+=s,Lw(t),0!==i.pending)return i.last_flush=-1,vw;e=0,n-=s}let s=new Uint8Array(i.gzhead.extra);i.pending_buf.set(s.subarray(i.gzindex,i.gzindex+n),i.pending),i.pending+=n,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex=0}i.status=73}if(73===i.status){if(i.gzhead.name){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),i.gzindex=0}i.status=91}if(91===i.status){if(i.gzhead.comment){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n))}i.status=103}if(103===i.status){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size&&(Lw(t),0!==i.pending))return i.last_flush=-1,vw;Iw(i,255&t.adler),Iw(i,t.adler>>8&255),t.adler=0}if(i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(0!==t.avail_in||0!==i.lookahead||e!==Ow&&i.status!==Mw){let n=0===i.level?Fw(i,e):i.strategy===Pw?((t,e)=>{let i;for(;;){if(0===t.lookahead&&(Gw(t),0===t.lookahead)){if(e===Ow)return 1;break}if(t.match_length=0,i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):i.strategy===Cw?((t,e)=>{let i,n,s,r;const o=t.window;for(;;){if(t.lookahead<=Tw){if(Gw(t),t.lookahead<=Tw&&e===Ow)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(s=t.strstart-1,n=o[s],n===o[++s]&&n===o[++s]&&n===o[++s])){r=t.strstart+Tw;do{}while(n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&st.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(i=cw(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):tv[i.level].func(i,e);if(3!==n&&4!==n||(i.status=Mw),1===n||3===n)return 0===t.avail_out&&(i.last_flush=-1),vw;if(2===n&&(e===gw?uw(i):e!==ww&&(lw(i,0,0,!1),e===mw&&(Uw(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),Lw(t),0===t.avail_out))return i.last_flush=-1,vw}return e!==bw?vw:i.wrap<=0?Sw:(2===i.wrap?(Iw(i,255&t.adler),Iw(i,t.adler>>8&255),Iw(i,t.adler>>16&255),Iw(i,t.adler>>24&255),Iw(i,255&t.total_in),Iw(i,t.total_in>>8&255),Iw(i,t.total_in>>16&255),Iw(i,t.total_in>>24&255)):(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),Lw(t),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?vw:Sw)},bb.deflateEnd=t=>{if(iv(t))return yw;const e=t.state.status;return t.state=null,e===Vw?Dw(t,xw):vw},bb.deflateSetDictionary=(t,e)=>{let i=e.length;if(iv(t))return yw;const n=t.state,s=n.wrap;if(2===s||1===s&&n.status!==Ew||n.lookahead)return yw;if(1===s&&(t.adler=dw(t.adler,e,i,0)),n.wrap=0,i>=n.w_size){0===s&&(Uw(n.head),n.strstart=0,n.block_start=0,n.insert=0);let t=new Uint8Array(n.w_size);t.set(e.subarray(i-n.w_size,i),0),e=t,i=n.w_size}const r=t.avail_in,o=t.next_in,a=t.input;for(t.avail_in=i,t.next_in=0,t.input=e,Gw(n);n.lookahead>=3;){let t=n.strstart,e=n.lookahead-2;do{n.ins_h=qw(n,n.ins_h,n.window[t+3-1]),n.prev[t&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=t,t++}while(--e);n.strstart=t,n.lookahead=2,Gw(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,t.next_in=o,t.input=a,t.avail_in=r,n.wrap=s,vw},bb.deflateInfo="pako deflate (from Nodeca project)";var ov={};const av=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);ov.assign=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const e in i)av(i,e)&&(t[e]=i[e])}}return t},ov.flattenChunks=t=>{let e=0;for(let i=0,n=t.length;i=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;cv[254]=cv[254]=1,lv.string2buf=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,i,n,s,r,o=t.length,a=0;for(s=0;s>>6,e[r++]=128|63&i):i<65536?(e[r++]=224|i>>>12,e[r++]=128|i>>>6&63,e[r++]=128|63&i):(e[r++]=240|i>>>18,e[r++]=128|i>>>12&63,e[r++]=128|i>>>6&63,e[r++]=128|63&i);return e};lv.buf2string=(t,e)=>{const i=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let n,s;const r=new Array(2*i);for(s=0,n=0;n4)r[s++]=65533,n+=o-1;else{for(e&=2===o?31:3===o?15:7;o>1&&n1?r[s++]=65533:e<65536?r[s++]=e:(e-=65536,r[s++]=55296|e>>10&1023,r[s++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&hv)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let i="";for(let n=0;n{(e=e||t.length)>t.length&&(e=t.length);let i=e-1;for(;i>=0&&128==(192&t[i]);)i--;return i<0||0===i?e:i+cv[t[i]]>e?i:e};var uv=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const dv=bb,fv=ov,pv=lv,Ov=rw,gv=uv,mv=Object.prototype.toString,{Z_NO_FLUSH:bv,Z_SYNC_FLUSH:wv,Z_FULL_FLUSH:vv,Z_FINISH:Sv,Z_OK:yv,Z_STREAM_END:xv,Z_DEFAULT_COMPRESSION:kv,Z_DEFAULT_STRATEGY:Qv,Z_DEFLATED:$v}=ow;function Pv(t){this.options=fv.assign({level:kv,method:$v,chunkSize:16384,windowBits:15,memLevel:8,strategy:Qv},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new gv,this.strm.avail_out=0;let i=dv.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(i!==yv)throw new Error(Ov[i]);if(e.header&&dv.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?pv.string2buf(e.dictionary):"[object ArrayBuffer]"===mv.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,i=dv.deflateSetDictionary(this.strm,t),i!==yv)throw new Error(Ov[i]);this._dict_set=!0}}function Cv(t,e){const i=new Pv(e);if(i.push(t,!0),i.err)throw i.msg||Ov[i.err];return i.result}Pv.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize;let s,r;if(this.ended)return!1;for(r=e===~~e?e:!0===e?Sv:bv,"string"==typeof t?i.input=pv.string2buf(t):"[object ArrayBuffer]"===mv.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),(r===wv||r===vv)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(s=dv.deflate(i,r),s===xv)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),s=dv.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===yv;if(0!==i.avail_out){if(r>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},Pv.prototype.onData=function(t){this.chunks.push(t)},Pv.prototype.onEnd=function(t){t===yv&&(this.result=fv.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},mb.Deflate=Pv,mb.deflate=Cv,mb.deflateRaw=function(t,e){return(e=e||{}).raw=!0,Cv(t,e)},mb.gzip=function(t,e){return(e=e||{}).gzip=!0,Cv(t,e)},mb.constants=ow;var _v={},Xv={};const Zv=16209;const Av=15,Tv=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Rv=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Ev=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Vv=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Mv=(t,e,i,n,s,r,o,a)=>{const l=a.bits;let h,c,u,d,f,p,O=0,g=0,m=0,b=0,w=0,v=0,S=0,y=0,x=0,k=0,Q=null;const $=new Uint16Array(16),P=new Uint16Array(16);let C,_,X,Z=null;for(O=0;O<=Av;O++)$[O]=0;for(g=0;g=1&&0===$[b];b--);if(w>b&&(w=b),0===b)return s[r++]=20971520,s[r++]=20971520,a.bits=1,0;for(m=1;m0&&(0===t||1!==b))return-1;for(P[1]=0,O=1;O852||2===t&&x>592)return 1;for(;;){C=O-S,o[g]+1=p?(_=Z[o[g]-p],X=Q[o[g]-p]):(_=96,X=0),h=1<>S)+c]=C<<24|_<<16|X|0}while(0!==c);for(h=1<>=1;if(0!==h?(k&=h-1,k+=h):k=0,g++,0==--$[O]){if(O===b)break;O=e[i+o[g]]}if(O>w&&(k&d)!==u){for(0===S&&(S=w),f+=m,v=O-S,y=1<852||2===t&&x>592)return 1;u=k&d,s[u]=w<<24|v<<16|f-r|0}}return 0!==k&&(s[f+k]=O-S<<24|64<<16|0),a.bits=w,0};const Dv=iw,Wv=sw,Uv=function(t,e){let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,S,y,x,k,Q;const $=t.state;i=t.next_in,k=t.input,n=i+(t.avail_in-5),s=t.next_out,Q=t.output,r=s-(e-t.avail_out),o=s+(t.avail_out-257),a=$.dmax,l=$.wsize,h=$.whave,c=$.wnext,u=$.window,d=$.hold,f=$.bits,p=$.lencode,O=$.distcode,g=(1<<$.lenbits)-1,m=(1<<$.distbits)-1;t:do{f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,0===w)Q[s++]=65535&b;else{if(!(16&w)){if(0==(64&w)){b=p[(65535&b)+(d&(1<>>=w,f-=w),f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,!(16&w)){if(0==(64&w)){b=O[(65535&b)+(d&(1<a){t.msg="invalid distance too far back",$.mode=Zv;break t}if(d>>>=w,f-=w,w=s-r,S>w){if(w=S-w,w>h&&$.sane){t.msg="invalid distance too far back",$.mode=Zv;break t}if(y=0,x=u,0===c){if(y+=l-w,w2;)Q[s++]=x[y++],Q[s++]=x[y++],Q[s++]=x[y++],v-=3;v&&(Q[s++]=x[y++],v>1&&(Q[s++]=x[y++]))}else{y=s-S;do{Q[s++]=Q[y++],Q[s++]=Q[y++],Q[s++]=Q[y++],v-=3}while(v>2);v&&(Q[s++]=Q[y++],v>1&&(Q[s++]=Q[y++]))}break}}break}}while(i>3,i-=v,f-=v<<3,d&=(1<(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function hS(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const cS=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode16211?1:0},uS=t=>{if(cS(t))return Nv;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Kv,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,Iv},dS=t=>{if(cS(t))return Nv;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,uS(t)},fS=(t,e)=>{let i;if(cS(t))return Nv;const n=t.state;return e<0?(i=0,e=-e):(i=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?Nv:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=i,n.wbits=e,dS(t))},pS=(t,e)=>{if(!t)return Nv;const i=new hS;t.state=i,i.strm=t,i.window=null,i.mode=Kv;const n=fS(t,e);return n!==Iv&&(t.state=null),n};let OS,gS,mS=!0;const bS=t=>{if(mS){OS=new Int32Array(512),gS=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Yv(1,t.lens,0,288,OS,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Yv(2,t.lens,0,32,gS,0,t.work,{bits:5}),mS=!1}t.lencode=OS,t.lenbits=9,t.distcode=gS,t.distbits=5},wS=(t,e,i,n)=>{let s;const r=t.state;return null===r.window&&(r.wsize=1<=r.wsize?(r.window.set(e.subarray(i-r.wsize,i),0),r.wnext=0,r.whave=r.wsize):(s=r.wsize-r.wnext,s>n&&(s=n),r.window.set(e.subarray(i-n,i-n+s),r.wnext),(n-=s)?(r.window.set(e.subarray(i-n,i),0),r.wnext=n,r.whave=r.wsize):(r.wnext+=s,r.wnext===r.wsize&&(r.wnext=0),r.whavepS(t,15),Xv.inflateInit2=pS,Xv.inflate=(t,e)=>{let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,S,y,x,k=0;const Q=new Uint8Array(4);let $,P;const C=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(cS(t)||!t.output||!t.input&&0!==t.avail_in)return Nv;i=t.state,i.mode===eS&&(i.mode=iS),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,u=a,d=l,x=Iv;t:for(;;)switch(i.mode){case Kv:if(0===i.wrap){i.mode=iS;break}for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0),h=0,c=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",i.mode=aS;break}if((15&h)!==Jv){t.msg="unknown compression method",i.mode=aS;break}if(h>>>=4,c-=4,y=8+(15&h),0===i.wbits&&(i.wbits=y),y>15||y>i.wbits){t.msg="invalid window size",i.mode=aS;break}i.dmax=1<>8&1),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16182;case 16182:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>8&255,Q[2]=h>>>16&255,Q[3]=h>>>24&255,i.check=Wv(i.check,Q,4,0)),h=0,c=0,i.mode=16183;case 16183:for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>8),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16184;case 16184:if(1024&i.flags){for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(f=i.length,f>a&&(f=a),f&&(i.head&&(y=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(n.subarray(r,r+f),y)),512&i.flags&&4&i.wrap&&(i.check=Wv(i.check,n,f,r)),a-=f,r+=f,i.length-=f),i.length))break t;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===a)break t;f=0;do{y=n[r+f++],i.head&&y&&i.length<65536&&(i.head.name+=String.fromCharCode(y))}while(y&&f>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=eS;break;case 16189:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>=7&c,c-=7&c,i.mode=oS;break}for(;c<3;){if(0===a)break t;a--,h+=n[r++]<>>=1,c-=1,3&h){case 0:i.mode=16193;break;case 1:if(bS(i),i.mode=sS,e===zv){h>>>=2,c-=2;break t}break;case 2:i.mode=16196;break;case 3:t.msg="invalid block type",i.mode=aS}h>>>=2,c-=2;break;case 16193:for(h>>>=7&c,c-=7&c;c<32;){if(0===a)break t;a--,h+=n[r++]<>>16^65535)){t.msg="invalid stored block lengths",i.mode=aS;break}if(i.length=65535&h,h=0,c=0,i.mode=nS,e===zv)break t;case nS:i.mode=16195;case 16195:if(f=i.length,f){if(f>a&&(f=a),f>l&&(f=l),0===f)break t;s.set(n.subarray(r,r+f),o),a-=f,r+=f,l-=f,o+=f,i.length-=f;break}i.mode=eS;break;case 16196:for(;c<14;){if(0===a)break t;a--,h+=n[r++]<>>=5,c-=5,i.ndist=1+(31&h),h>>>=5,c-=5,i.ncode=4+(15&h),h>>>=4,c-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=aS;break}i.have=0,i.mode=16197;case 16197:for(;i.have>>=3,c-=3}for(;i.have<19;)i.lens[C[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,$={bits:i.lenbits},x=Yv(0,i.lens,0,19,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid code lengths set",i.mode=aS;break}i.have=0,i.mode=16198;case 16198:for(;i.have>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=g,c-=g,i.lens[i.have++]=b;else{if(16===b){for(P=g+2;c>>=g,c-=g,0===i.have){t.msg="invalid bit length repeat",i.mode=aS;break}y=i.lens[i.have-1],f=3+(3&h),h>>>=2,c-=2}else if(17===b){for(P=g+3;c>>=g,c-=g,y=0,f=3+(7&h),h>>>=3,c-=3}else{for(P=g+7;c>>=g,c-=g,y=0,f=11+(127&h),h>>>=7,c-=7}if(i.have+f>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=aS;break}for(;f--;)i.lens[i.have++]=y}}if(i.mode===aS)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=aS;break}if(i.lenbits=9,$={bits:i.lenbits},x=Yv(1,i.lens,0,i.nlen,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid literal/lengths set",i.mode=aS;break}if(i.distbits=6,i.distcode=i.distdyn,$={bits:i.distbits},x=Yv(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,$),i.distbits=$.bits,x){t.msg="invalid distances set",i.mode=aS;break}if(i.mode=sS,e===zv)break t;case sS:i.mode=rS;case rS:if(a>=6&&l>=258){t.next_out=o,t.avail_out=l,t.next_in=r,t.avail_in=a,i.hold=h,i.bits=c,Uv(t,d),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,i.mode===eS&&(i.back=-1);break}for(i.back=0;k=i.lencode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,i.length=b,0===m){i.mode=16205;break}if(32&m){i.back=-1,i.mode=eS;break}if(64&m){t.msg="invalid literal/length code",i.mode=aS;break}i.extra=15&m,i.mode=16201;case 16201:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;k=i.distcode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,64&m){t.msg="invalid distance code",i.mode=aS;break}i.offset=b,i.extra=15&m,i.mode=16203;case 16203:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=aS;break}i.mode=16204;case 16204:if(0===l)break t;if(f=d-l,i.offset>f){if(f=i.offset-f,f>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=aS;break}f>i.wnext?(f-=i.wnext,p=i.wsize-f):p=i.wnext-f,f>i.length&&(f=i.length),O=i.window}else O=s,p=o-i.offset,f=i.length;f>l&&(f=l),l-=f,i.length-=f;do{s[o++]=O[p++]}while(--f);0===i.length&&(i.mode=rS);break;case 16205:if(0===l)break t;s[o++]=i.length,l--,i.mode=rS;break;case oS:if(i.wrap){for(;c<32;){if(0===a)break t;a--,h|=n[r++]<{if(cS(t))return Nv;let e=t.state;return e.window&&(e.window=null),t.state=null,Iv},Xv.inflateGetHeader=(t,e)=>{if(cS(t))return Nv;const i=t.state;return 0==(2&i.wrap)?Nv:(i.head=e,e.done=!1,Iv)},Xv.inflateSetDictionary=(t,e)=>{const i=e.length;let n,s,r;return cS(t)?Nv:(n=t.state,0!==n.wrap&&n.mode!==tS?Nv:n.mode===tS&&(s=1,s=Dv(s,e,i,0),s!==n.check)?Gv:(r=wS(t,e,i,i),r?(n.mode=16210,Fv):(n.havedict=1,Iv)))},Xv.inflateInfo="pako inflate (from Nodeca project)";const vS=Xv,SS=ov,yS=lv,xS=rw,kS=uv,QS=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},$S=Object.prototype.toString,{Z_NO_FLUSH:PS,Z_FINISH:CS,Z_OK:_S,Z_STREAM_END:XS,Z_NEED_DICT:ZS,Z_STREAM_ERROR:AS,Z_DATA_ERROR:TS,Z_MEM_ERROR:RS}=ow;function ES(t){this.options=SS.assign({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new kS,this.strm.avail_out=0;let i=vS.inflateInit2(this.strm,e.windowBits);if(i!==_S)throw new Error(xS[i]);if(this.header=new QS,vS.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=yS.string2buf(e.dictionary):"[object ArrayBuffer]"===$S.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(i=vS.inflateSetDictionary(this.strm,e.dictionary),i!==_S)))throw new Error(xS[i])}function VS(t,e){const i=new ES(e);if(i.push(t),i.err)throw i.msg||xS[i.err];return i.result}ES.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize,s=this.options.dictionary;let r,o,a;if(this.ended)return!1;for(o=e===~~e?e:!0===e?CS:PS,"[object ArrayBuffer]"===$S.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),r=vS.inflate(i,o),r===ZS&&s&&(r=vS.inflateSetDictionary(i,s),r===_S?r=vS.inflate(i,o):r===TS&&(r=ZS));i.avail_in>0&&r===XS&&i.state.wrap>0&&0!==t[i.next_in];)vS.inflateReset(i),r=vS.inflate(i,o);switch(r){case AS:case TS:case ZS:case RS:return this.onEnd(r),this.ended=!0,!1}if(a=i.avail_out,i.next_out&&(0===i.avail_out||r===XS))if("string"===this.options.to){let t=yS.utf8border(i.output,i.next_out),e=i.next_out-t,s=yS.buf2string(i.output,t);i.next_out=e,i.avail_out=n-e,e&&i.output.set(i.output.subarray(t,t+e),0),this.onData(s)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(r!==_S||0!==a){if(r===XS)return r=vS.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},ES.prototype.onData=function(t){this.chunks.push(t)},ES.prototype.onEnd=function(t){t===_S&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=SS.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},_v.Inflate=ES,_v.inflate=VS,_v.inflateRaw=function(t,e){return(e=e||{}).raw=!0,VS(t,e)},_v.ungzip=VS,_v.constants=ow;const{Deflate:MS,deflate:DS,deflateRaw:WS,gzip:US}=mb,{Inflate:YS,inflate:qS,inflateRaw:LS,ungzip:zS}=_v,IS=ow;gb.Deflate=MS,gb.deflate=DS,gb.deflateRaw=WS,gb.gzip=US,gb.Inflate=YS,gb.inflate=qS,gb.inflateRaw=LS,gb.ungzip=zS,gb.constants=IS;const BS=gb;let jS={};var NS;function GS(t){return NS=t,[ty]}jS.Util={},jS.Decode={},jS.Messages=[],jS.Log=function(t){jS.Messages.push(["I",t]),console.log("Mma.js INFO: ",t)},jS.Warn=function(t){jS.Messages.push(["W",t]),console.log("Mma.js WARNING: ",t)},jS.Fail=function(t){throw jS.Messages.push(["E",t]),"Mma.js ERROR: "+t},jS.Util.Base64Decode=function(t){for(var e=atob(t),i=e.length>>>0,n=new Uint8Array(i),s=0;s1&&0===t[0]&&jS.Fail("IntegerAP: input starts with 0: "+String(t)),this.nstring=t}else void 0===t?this.nstring=void 0:jS.Fail("Integer: invalid input: "+String(t))},jS.RealMP=function(t){"number"==typeof t?this.n=t:void 0===t?this.n=void 0:jS.Fail("RealMP: invalid input")},jS.RealAP=function(t){"string"==typeof t?(t.length>1&&0===t[0]&&jS.Fail("RealAP: input starts with 0: "+String(t)),this.nstring=t):void 0===t?this.nstring=void 0:jS.Fail("RealAP: invalid input: "+String(t))},jS.Symbol=function(t){"string"==typeof t?this.name=t:void 0===t?this.name=void 0:jS.Fail("Symbol: invalid input: "+String(t))},jS.String=function(t){"string"==typeof t?this.str=t:void 0===t?this.str=void 0:jS.Fail("String: invalid input: "+String(t))},jS.Expression=function(t,e){t instanceof jS.Symbol||jS.Fail("Expression: head must be an Mma.Symbol"),e instanceof Array||jS.Fail("Expression: parts must be an Array"),this.head=t,this.parts=e},jS.Decode.Int32=function(t,e){try{return new DataView(t.buffer).getInt32(e,!0)}catch(t){return 0}},jS.Decode.Float64=function(t,e){try{return new DataView(t.buffer).getFloat64(e,!0)}catch(t){return 0}},jS.Decode.String=function(t,e,i){return void 0===e&&(e=0),void 0===i&&(i=t.length),jS.Util.U8ArrayToString(t.slice(e,e+i))},jS.Decode.StringEntry=function(t,e){void 0===e&&(e=0);var i=jS.Decode.Int32(t,e);return{length:i,string:jS.Decode.String(t,e+4,i),bytesRead:i+4}},jS.Decode.Any=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=1/0);var n=e;for(var s=0,r=[];ee%2!=0?t:{...t,body:Lm(t.body,/\(\*\|\*\)/gm)})),Array.isArray(this.args[this.args.length-1].body)||(this.decorator=this.args.pop());const r=this.args;console.log("creating InstanceWidget");for(let t=0;t{e.viewState.state.config.eval()},update:e=>this.applyChanges(e,t,i),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i-2>=0?(o[i-2].editor.dispatch({selection:{anchor:o[i-2].editor.state.doc.length}}),o[i-2].editor.focus(),void(t.editorLastCursor=void 0)):(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0));t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i+2=0)return r[t-2].body[i].editor.focus(),void(e.editorLastCursor=void 0)}},{key:"ArrowDown",run:function(e,n){if(t+2{},focus:()=>{},dispatch:()=>{}};const t=l.match(FS);if(t){a.innerHTML=t[1];const e=jS.DecompressDecode(t[2]),i=jS.toArray(e.parts[0]),n=uuidv4();interpretate(i,{global:{call:n},element:a})}else a.innerHTML=l.slice(1,-1)}delete o[i].body,n.appendChild(a)}i.appendChild(n)}if(this.decorator){const t=jS.DecompressDecode(this.decorator.body.slice(2,-2)),e=jS.toArray(t.parts[0]);let n={global:{call:uuidv4(),EditorWidget:s},element:i};this.interpretated=interpretate(e,n)}}applyChanges(t,e,i){const n=this.args,s=this.args[e].body,r=this.visibleValue.argsPos,o=this.args[e].from;let a=t;0==i&&0==e&&(a="{{"+a),0==i&&0!=e&&(a="{"+a),i==s.length-1&&e==n.length-1&&(a+="}}"),i==s.length-1&&e!=n.length-1&&(a+="}");const l=s[i].length,h={from:r+o+s[i].from,to:r+o+s[i].from+l,insert:a},c=a.length-l;for(let t=i+1;t{s.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.args[0].body[0].editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.args[0].body[0].editor.focus();else{const t=this.DOMElement.EditorWidget.args,e=t[t.length-1].body[t[t.length-1].body.length-1].editor;e.dispatch({selection:{anchor:e.state.doc.length}}),e.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const KS=(t,e)=>new Bm({tag:"GB",decoration:i=>ni.replace({widget:new JS(i,t,e)})}),ty=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=KS(this.disposable,t).createDeco(t)}update(t){this.placeholder=KS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});function ey(t){return[ry]}let iy=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.span=i,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this,r=this.args[1].body.slice(3,-3),o=jS.DecompressDecode(r),a=jS.toArray(o.parts[0]);this.data=a;const l="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}));this.cuid=l;let h={call:l,EditorWidget:s},c={global:h,element:i};this.expression=a,this.env=c,this.interpretated=interpretate(a,c),this.interpretated.then((()=>{if(c.options?.Event){console.warn("Event listeners are enabled!"),s.events=c.options.Event;let t=c;if(h.stack){const e=Object.values(h.stack);e.length>0&&(console.log("Attaching first found instance..."),t=e[0].env)}interpretate(["MetaMarker","'"+l+"'"],t).then((()=>{server.kernel.emitt(s.events,'"'+l+'"',"Mounted")}))}}))}getDoc(){return this.args[0].body.slice(1,-1)}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+t+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].length=s.length,this.view.dispatch({changes:r})}applyOuterChanges(t){const e=this.visibleValue,i=t,n={from:e.pos,to:e.pos+e.length,insert:i};this.view.dispatch({changes:n})}update(t){if(!this.deactivated){if(t.str!=this.visibleValue.str){console.warn("Out of sync"),console.log("recreate..."),this.destroy();const e=this.span;return e.replaceChildren(),void this._construct(t,this.view,e)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}}destroy(t){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.events&&server.kernel.emitt(this.events,'"'+this.cuid+'"',"Destroy"),delete this.data}},ny=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=this;let i=document.createElement("span");return i.classList.add("frontend-view"),i.EditorWidget=new iy(this.visibleValue,t,i),this.reference.push({destroy:()=>{e.destroy(i)}}),i}ignoreEvent(){return!0}destroy(t){console.log("destroy in general*"),t.EditorWidget.destroy()}};const sy=(t,e)=>new Bm({tag:"VB",decoration:i=>ni.replace({widget:new ny(i,t,e)})}),ry=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=sy(this.disposable,t).createDeco(t)}update(t){this.placeholder=sy(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var oy;function ay(t){return oy=t,[uy]}let ly=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.span=i,this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this;this.epilog={offset:0,string:""},this.prolog={offset:0,string:""};const r=this.args[1].body.slice(3,-3),o=jS.DecompressDecode(r),a=jS.toArray(o.parts[0]);this.data=a;let l={global:{call:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)})),element:i,origin:s},element:i};this.env=l,interpretate(a,l).then((()=>{if(l.options?.Head&&(s.prolog.offset=l.options.Head.length+1,s.prolog.string=l.options.Head+"[",s.epilog.offset=1,s.epilog.string="]"),l.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=l.options.Event),l.options?.String){s.prolog.offset=1,s.prolog.string='"',s.epilog.offset=1,s.epilog.string='"',l.options?.HeadString&&(s.prolog.string=l.options.HeadString,s.prolog.offset=s.prolog.string.length),l.options?.TailString&&(s.epilog.string=l.options.TailString,s.epilog.offset=s.epilog.string.length),s.editor={destroy:()=>{console.log("Nothing to destroy, this is just a text field.")}};const t=document.createElement("span");return this.aa,t.onkeydown=function(t){13===t.keyCode&&t.preventDefault()},t.contentEditable="plaintext-only",t.innerText=s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),t.addEventListener("input",console.log),t.addEventListener("input",(()=>{console.log("Update"),console.log(t.innerText),this.applyChanges(t.innerText)})),l.global.element.appendChild(t),void(s.events&&server.kernel.emitt(s.events,"Null","Mounted"))}s.editor=oy({doc:s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),parent:l.global.element,update:t=>this.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos+s.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]}),s.events&&server.kernel.emitt(s.events,"Null","Mounted")}))}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+this.prolog.string+t+this.epilog.string+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length));const o=s.length-i[0].length;i[0].length=s.length,this.visibleValue.length=this.visibleValue.length+o,this.view.dispatch({changes:r})}update(t){if(this.visibleValue.str!=t.str)return console.warn("Out of sync"),console.log("recreating InstanceWidget"),this.destroy(),this.span.replaceChildren(),void this._construct(t,this.view,this.span);this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.editor.destroy(),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}},hy=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("subscript-tail"),e.EditorWidget=new ly(this.visibleValue,t,e,[]);const i=this;return this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const cy=(t,e)=>new Bm({tag:"BB",decoration:i=>ni.replace({widget:new hy(i,t,e)})}),uy=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=cy(this.disposable,t).createDeco(t)}update(t){this.placeholder=cy(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var dy;function fy(t){return dy=t,[my]}class py{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm);const s=this,r=Array.from({length:Math.ceil((s.args.length-3)/2)},((t,e)=>2*e+1));s.indexes=r;const o=[];this.span=i,this.spans=o;for(let t=0;t{c.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=c.options.Event),s.editors=r.map(((t,i)=>dy({doc:s.args[t].body,parent:o[i],update:e=>this.applyChanges(e,t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i>0?s.editors[i-1].focus():(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus()),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return it.destroy())),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}}class Oy extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("inline-flex"),e.EditorWidget=new py(this.visibleValue,t,e,[]);const i=this;return this.DOMElement=e,this.reference.push({destroy:()=>{i.destroy(e)}}),e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;const n=this.DOMElement.EditorWidget.editors;return t.from-e.from<0?(n[n.length-1].dispatch({selection:{anchor:n[n.length-1].state.doc.length}}),n[n.length-1].focus()):(n[0].dispatch({selection:{anchor:0}}),n[0].focus()),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}}const gy=(t,e)=>new Bm({tag:"TB",decoration:i=>ni.replace({widget:new Oy(i,t,e)})}),my=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=gy(this.disposable,t).createDeco(t)}update(t){this.placeholder=gy(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});const by=_i.fromClass(class{decorations=ni.none;constructor(t){this.view=t,this.recompute()}recompute(t){let e,i,n=[];for(let{from:t,to:e}of this.view.visibleRanges)this.getDecorationsFor(t,e,n);this.decorations=ni.set(n,!0),this.decorations=this.decorations.update({filter:(n,s)=>!(n>e&&s=e&&s.selection.main.head<=i)return!0;if(!n&&s.selection.main.head>e&&s.selection.main.headt.decorations});class wy extends ei{constructor(t,e){super(),this.rawValue=t,this.visibleValue=e}eq(t){return this.rawValue===t.rawValue}toDOM(){let t=document.createElement("div");t.classList.add("cell-type-widget");const e=this.rawValue.split(" "),i=e[0].split(".");if(console.log(i),t.classList.add("cell-type-"+i[1].trim()),t.innerText=e[0].trim(),e.length>1){const n=e.slice(1),s=document.createElement("span");return s.appendChild(t),n.forEach((t=>{const e=document.createElement("span");e.innerText=t,e.classList.add("cell-type-"+i[1].trim()+"-"+t.split("=")[0]),s.appendChild(e)})),s}return t}ignoreEvent(){return!1}}const vy=new F,Sy=new F,yy=[],xy=yl.define([{tag:ya.meta,color:"var(--editor-key-meta)"},{tag:ya.link,textDecoration:"underline"},{tag:ya.heading,textDecoration:"underline",fontWeight:"bold"},{tag:ya.emphasis,fontStyle:"italic"},{tag:ya.strong,fontWeight:"bold"},{tag:ya.strikethrough,textDecoration:"line-through"},{tag:ya.keyword,color:"var(--editor-key-keyword)"},{tag:[ya.atom,ya.bool,ya.url,ya.contentSeparator,ya.labelName],color:"var(--editor-key-atom)"},{tag:[ya.literal,ya.inserted],color:"var(--editor-key-literal)"},{tag:[ya.string,ya.deleted],color:"var(--editor-key-string)"},{tag:[ya.regexp,ya.escape,ya.special(ya.string)],color:"var(--editor-key-escape)"},{tag:ya.definition(ya.variableName),color:"var(--editor-key-variable)"},{tag:ya.local(ya.variableName),color:"var(--editor-local-variable)"},{tag:[ya.typeName,ya.namespace],color:"var(--editor-key-type)"},{tag:ya.className,color:"var(--editor-key-class)"},{tag:[ya.special(ya.variableName),ya.macroName],color:"var(--editor-special-variable)"},{tag:ya.definition(ya.propertyName),color:"var(--editor-key-property)"},{tag:ya.comment,color:"var(--editor-key-comment)"},{tag:ya.invalid,color:"var(--editor-key-invalid)"}]),ky={data:[],extend:t=>{ky.data.push(...t),Qm.reBuild(ky.data)},replaceAll:t=>{ky.data=t,Qm.reBuild(ky.data)}},Qy=Gl.define({name:"spreadsheet",startState:function(){return{stringType:null,stack:[]}},token:function(t,e){if(t){switch(0===e.stack.length&&('"'!=t.peek()&&"'"!=t.peek()||(e.stringType=t.peek(),t.next(),e.stack.unshift("string"))),e.stack[0]){case"string":for(;"string"===e.stack[0]&&!t.eol();)t.peek()===e.stringType?(t.next(),e.stack.shift()):"\\"===t.peek()?(t.next(),t.next()):t.match(/^.[^\\\"\']*/);return"string";case"characterClass":for(;"characterClass"===e.stack[0]&&!t.eol();)t.match(/^[^\]\\]+/)||t.match(/^\\./)||e.stack.shift();return"operator"}var i=t.peek();switch(i){case"[":return t.next(),e.stack.unshift("characterClass"),"bracket";case":":return t.next(),"operator";case"\\":return t.match(/\\[a-z]+/)?"string.special":(t.next(),"atom");case".":case",":case";":case"*":case"-":case"+":case"^":case"<":case"/":case"=":return t.next(),"atom";case"$":return t.next(),"builtin"}return t.match(/\d+/)?t.match(/^\w+/)?"error":"number":t.match(/^[a-zA-Z_]\w*/)?t.match(/(?=[\(.])/,!1)?"keyword":"variable":-1!=["[","]","(",")","{","}"].indexOf(i)?(t.next(),"bracket"):(t.eatSpace()||t.next(),null)}}}),$y=new RegExp(/^[\w]*\.[\w]+/);function Py(t){const e=$y.exec(t),i=Object.values(window.SupportedLanguages);for(let t=0;t{if(!t.docChanged)return null;let e=Py(t.newDoc.line(1).text);if(e.legacy){const i=t.startState.facet(Wa);if(i){if(i.name==e.name)return null}else if(t.startState.facet(Cy)==e.name)return null;return console.log("switching... to "+e.name),{effects:vy.reconfigure(e.plugins)}}return e.name===t.startState.facet(Wa).name?null:(console.log("switching... to "+e.name),{effects:vy.reconfigure(e.plugins)})}));let Xy,Zy=null;const Ay=t=>{const e=t||Xy;return e&&e.viewState?(console.log(),Py(e.state.doc.line(1).text).name):""},Ty=t=>{const e=t||Xy;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return!1;const n=i[0];return[n.from,n.to]},Ry=t=>{const e=t||Xy;return e&&e.viewState?e.state.doc.toString():""},Ey=t=>{const e=t||Xy;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return"";const n=i[0];return console.log("yoko"),console.log(n),console.log(e.state.doc.toString().slice(n.from,n.to)),console.log("processing"),e.state.doc.toString().slice(n.from,n.to)},Vy=(t,e)=>{const i=e||Xy;if(!i)return;if(!i.viewState)return;const n=i.viewState.state.selection.ranges;if(!n.length)return;const s=n[0];console.log("result"),console.log(t),i.dispatch({changes:{...s,insert:t}})},My=()=>Xy,Dy=(t,e)=>{const i=e||Xy;i&&i.viewState&&(console.log("result"),console.log(t),i.dispatch({changes:{from:0,to:i.viewState.state.doc.length,insert:t}}))};Zy=t=>{let e=new Ts({doc:t.doc,extensions:[Ys.of([{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,Ly,Qm.of(ky),jm(Zy),Km(Zy),rb(Zy),ub(Zy),GS(Zy),ey(),ay(Zy),fy(Zy),Wl(),Xm,yy,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(Xy=e.view)}))],parent:t.parent});return e.viewState.state.config.eval=t.eval,e},Zy.state=t=>{let e=xt.create({doc:t.doc,extensions:[Ys.of([{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,Ly,Qm.of(ky),jm(Zy),Km(Zy),rb(Zy),ub(Zy),GS(Zy),ey(),ay(Zy),fy(Zy),Wl(),Xm,yy,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(Xy=e.view)}))]});return e.config.eval=t.eval,e};const Wy={transaction:(t,e,i,n)=>{if(console.log(e.dom.ocellref),e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:DropEvent"]')}},file:(t,e,i,n,s)=>{console.log(e.dom.ocellref),e.dom.ocellref&&server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},Uy={transaction:(t,e,i,n)=>{if(console.log(e.dom.ocellref),e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:PasteEvent"]')}},file:(t,e,i,n,s)=>{console.log(e.dom.ocellref),e.dom.ocellref&&server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},Yy=[Qm.of(ky),jm(Zy),Km(Zy),rb(Zy),ub(Zy),GS(Zy),ey(),ay(Zy),fy(Zy),Wl(),Xm,yy,Cm(Wy,Uy)];let qy=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"}}),Ly=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"},".cm-scroller":{"line-height":"inherit","overflow-x":"overlay","overflow-y":"overlay","align-items":"initial"},".cm-content":{padding:"0px 0"},".rainbow-bracket-red":{color:"var(--editor-bracket-1)"},".rainbow-bracket-orange":{color:"var(--editor-bracket-2)"},".rainbow-bracket-yellow":{color:"var(--editor-bracket-3)"},".rainbow-bracket-green":{color:"var(--editor-bracket-4)"},".rainbow-bracket-blue":{color:"var(--editor-bracket-5)"},".rainbow-bracket-indigo":{color:"var(--editor-bracket-6)"},".rainbow-bracket-violet":{color:"var(--editor-bracket-7)"},".rainbow-bracket-red > span":{color:"var(--editor-bracket-1-a)"},".rainbow-bracket-orange > span":{color:"var(--editor-bracket-2-a)"},".rainbow-bracket-yellow > span":{color:"var(--editor-bracket-3-a)"},".rainbow-bracket-green > span":{color:"var(--editor-bracket-4-a)"},".rainbow-bracket-blue > span":{color:"var(--editor-bracket-5-a)"},".rainbow-bracket-indigo > span":{color:"var(--editor-bracket-6-a)"},".rainbow-bracket-violet > span":{color:"var(--editor-bracket-7-a)"}}),zy=!1;const Iy=[()=>vr(),()=>yh(),()=>ir(),()=>dr(),()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xy,{fallback:!1}),()=>eu()],By={},jy=[()=>vr(),()=>yh(),()=>ir(),()=>dr(),t=>Ny.of(t),()=>By.gutter?function(t={}){return[eo.of(t),jr(),so]}():[],()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xy,{fallback:!1}),()=>eu(),()=>by,()=>function(t){return _i.fromClass(class{constructor(e){this.view=e,this.placeholder=ni.set([ni.widget({widget:new kr(t),side:1}).range(0)])}get decorations(){return this.view.state.doc.length?ni.none:this.placeholder}},{decorations:t=>t.decorations})}("Type WL Expression / .md / .js"),()=>xt.allowMultipleSelections.of(!0),(t,e)=>vy.of(e),()=>Sy.of(xt.readOnly.of(!1)),()=>_y,()=>{return t?[au.of(t),qu]:qu;var t},(t,e)=>Ys.of([Mc,{key:"Backspace",run:function(e,i){if(0===e.state.doc.length)return t.origin.remove(),!0}},{key:"ArrowLeft",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus prev"),t.origin.focusPrev(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus next"),t.origin.focusNext(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"Shift-Enter",preventDefault:!0,run:function(e,i){console.log(e.state.doc.toString()),t.origin.eval(e.state.doc.toString())}},...Vc,...Wh,...Eu]),(t,e)=>Ts.updateListener.of((e=>{e.docChanged&&t.origin.save(encodeURIComponent(e.state.doc.toString())),e.selectionSet&&(Xy=e.view)})),()=>qy];const Ny=E.define();function Gy(t){return t.replace(/\\\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\\\:/g,""),16))})).replaceAll("\\:F74E","I").replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))}function Fy(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(t=>(+t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+t/4).toString(16)))}core.ReadOnly=()=>"ReadOnly",core.EditorView=async(t,e)=>{let i=await interpretate(t[0],e);i=Gy(i),console.log("UNICODE Disaster");const n=await core._getRules(t,e);let s=()=>{},r=()=>{},o=i;const a=[];n.ReadOnly&&a.push(xt.readOnly.of(!0)),n.ForceUpdate&&(e.local.forceUpdate=n.ForceUpdate),n.Event&&(r=t=>{o=t,console.log("editor view emitt data: "+t),server.kernel.emitt(n.Event,'"'+t.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Input")},s=()=>{server.kernel.emitt(n.Event,'"'+o.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Evaluate")}),e.local?e.local.editor=Zy({doc:i,parent:e.element,eval:s,update:r,extensions:a}):Zy({doc:i,parent:e.element,eval:s,update:r,extensions:a}),e.element.style.verticalAlign="inherit"},core.StripOnInput=async()=>{},core.EditorView.update=async(t,e)=>{if(!e.local.editor)return;const i=Gy(await interpretate(t[0],e));console.log("editor view: dispatch"),e.local.forceUpdate,e.local.editor.dispatch({changes:{from:0,to:e.local.editor.state.doc.length,insert:i}})},core.EditorView.destroy=async(t,e)=>{await interpretate(t[0],e),e.local&&e.local.editor&&e.local.editor.destroy()},core.EditorView.virtual=!0,core.PreviewCell=(t,e)=>{},window.SupportedLanguages.push({check:t=>null===t,legacy:!0,plugins:Yy,name:"mathematica"}),window.SupportedLanguages.push({check:t=>null!=t[0].match(/\w+\.(wl|wls)$/),plugins:Yy,legacy:!0,name:"mathematica"}),window.SupportedCells.codemirror={view:class{origin={};editor={};trash=[];forceFocusNext(){zy=!0}focus(t){t>0?this.editor.dispatch({selection:{anchor:0}}):t<0&&this.editor.dispatch({selection:{anchor:this.editor.state.doc.length}}),this.editor.focus()}setContent(t){if(console.warn("content mutation!"),!this.editor.viewState)return;const e=this.editor;console.log("result"),console.log(t),this.editor.dispatch({changes:{from:0,to:e.viewState.state.doc.length,insert:t}})}addDisposable(t){this.trash.push(t)}dispose(){this.editor.destroy()}readOnly(t){this.editor.dispatch({effects:Sy.reconfigure(xt.readOnly.of(t))})}constructor(t,e){this.origin=t;const i=this.origin,n=Py(e).plugins,s=this;this.origin.element.ocellref=s;const r=new Ts({doc:(o=e,o.replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))),extensions:jy.map((t=>t(s,n))),parent:this.origin.element});var o;return this.editor=r,this.editor.dom.ocellref=s,this.editor.viewState.state.config.eval=()=>{i.eval(this.editor.state.doc.toString())},zy&&r.focus(),zy=!1,this}},context:{EditorAutocomplete:ky,javascriptLanguage:qf,javascript:Nf,markdownLanguage:rm,markdown:function(t={}){let{codeLanguages:e,defaultCodeLanguage:i,addKeymap:n=!0,base:{parser:s}=sm}=t;if(!(s instanceof Zp))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let r,o=t.extensions?[t.extensions]:[],a=[dm.support];i instanceof Ua?(a.push(i.support),r=i.language):i&&(r=i);let l=e||r?(h=e,c=r,t=>{if(t&&h){let e=null;if(t=/\S*/.exec(t)[0],e="function"==typeof h?h(t):Ya.matchLanguageName(h,t,!0),e instanceof Ya)return e.support?e.support.language.parser:Ta.getSkippingParser(e.load());if(e)return e.parser}return c?c.parser:null}):void 0;var h,c;return o.push(function(t){let{codeParser:e,htmlParser:i}=t,n=Do(((t,n)=>{let s=t.type.id;if(!e||s!=Kf.CodeBlock&&s!=Kf.FencedCode){if(i&&(s==Kf.HTMLBlock||s==Kf.HTMLTag))return{parser:i,overlay:rO(t.node,t.from,t.to)}}else{let i="";if(s==Kf.FencedCode){let e=t.node.getChild(Kf.CodeInfo);e&&(i=n.read(e.from,e.to))}let r=e(i);if(r)return{parser:r,overlay:t=>t.type.id==Kf.CodeText}}return null}));return{wrap:n}}({codeParser:l,htmlParser:dm.language.parser})),n&&a.push(N.high(Ys.of(um))),new Ua(nm(s.configure(o)),a)},htmlLanguage:jg,html:Ng,cssLanguage:kg,css:Qg,EditorView:Ts,EditorState:xt,highlightSpecialChars:vr,syntaxHighlighting:$l,defaultHighlightStyle:xy,editorCustomTheme:qy,foldGutter:function(t={}){let e=Object.assign(Object.assign({},wl),t),i=new vl(e,!0),n=new vl(e,!1),s=_i.fromClass(class{constructor(t){this.from=t.viewport.from,this.markers=this.buildMarkers(t)}update(t){(t.docChanged||t.viewportChanged||t.startState.facet(Wa)!=t.state.facet(Wa)||t.startState.field(dl,!1)!=t.state.field(dl,!1)||Xa(t.startState)!=Xa(t.state)||e.foldingChanged(t))&&(this.markers=this.buildMarkers(t.view))}buildMarkers(t){let e=new Xt;for(let s of t.viewportLineBlocks){let r=fl(t.state,s.from,s.to)?n:ll(t.state,s.from,s.to)?i:null;r&&e.add(s.from,s.from,r)}return e.finish()}}),{domEventHandlers:r}=e;return[s,Ir({class:"cm-foldGutter",markers(t){var e;return(null===(e=t.plugin(s))||void 0===e?void 0:e.markers)||_t.empty},initialSpacer:()=>new vl(e,!1),domEventHandlers:Object.assign(Object.assign({},r),{click:(t,e,i)=>{if(r.click&&r.click(t,e,i))return!0;let n=fl(t.state,e.from,e.to);if(n)return t.dispatch({effects:ul.of(n)}),!0;let s=ll(t.state,e.from,e.to);return!!s&&(t.dispatch({effects:cl.of(s)}),!0)}})}),ml()]},Facet:E,Compartment:F,mathematicaPlugins:Yy,legacyLangNameFacet:Cy,DropPasteHandlers:Cm,EditorExtensionsMinimal:Iy,EditorParameters:By,EditorExtensions:jy,StateField:q,Decoration:ni,ViewPlugin:_i,WidgetType:ei,originFacet:Ny,MatchDecorator:pr}},window.OfflineMode&&yy.push(xt.readOnly.of(!0)),core.CellView=async(t,e)=>{const i=await core._getRules(t,e);i.Display||(i.Display="codemirror");const n=await interpretate(t[0],e),s={element:e.element,uid:Fy()};i.Style&&(e.element.style=i.Style),i.Class&&e.element.classList.add(...i.Class.split(" ")),i.ImageSize&&(Array.isArray(i.ImageSize)?(e.element.style.width=i.ImageSize[0]+"px",e.element.style.height=i.ImageSize[1]+"px"):e.element.style.width=i.ImageSize+"px"),new window.SupportedCells[i.Display].view(s,n)};const Hy={};core.FrontEditorSelected=async(t,e)=>{console.log("check");const i=await interpretate(t[0],e),n=await core._getRules(t,e);let s;switch(n.Editor&&(s=Hy[n.Editor],console.log("Editor"),console.log(n.Editor),console.log(s)),i){case"Get":return Ey(s);case"Set":let i=await interpretate(t[1],e);Vy(i,s);break;case"GetDoc":return Ry(s);case"SetDoc":let n=await interpretate(t[1],e);Dy(n,s);break;case"Cursor":return Ty(s);case"Type":return Ay(s);case"Editor":const r=Fy();return Hy[r]=My(),r}}; +class t{constructor(){}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 a(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}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 l(n,o,i,r);n=o+1,i++}}decompose(t,i,r,o){let a=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(a.text,t.text.slice(),0,a.length);if(i.length<=32)r.push(new e(i,t.length+a.length));else{let t=i.length>>1;r.push(new e(i.slice(0,t)),new e(i.slice(t)))}}else r.push(a)}replace(t,r,o){if(!(o instanceof e))return super.replace(t,r,o);let a=n(this.text,n(o.text,s(this.text,0,t)),r),l=this.length+o.length-(r-t);return a.length<=32?new e(a,l):i.from(e.split(a,[]),l)}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=a+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,a=i+r.lines-1;if((e?a:o)>=t)return r.lineInner(t,e,i,n);n=o+1,i=a+1}}decompose(t,e,i,n){for(let s=0,r=0;r<=e&&s=r){let s=n&((r<=t?1:0)|(a>=e?2:0));r>=t&&a<=e&&!s?i.push(o):o.decompose(t-r,e-r,i,s)}r=a+1}}replace(t,e,n){if(n.lines=r&&e<=a){let l=o.replace(t-r,e-r,n),h=this.lines-o.lines+l.lines;if(l.lines>4&&l.lines>h>>6){let r=this.children.slice();return r[s]=l,new i(r,this.length-(e-t)+n.length)}return super.replace(r,a,l)}r=a+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=a+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,a]=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==a)return n;let i=this.children[s],l=t.children[r];if(i!=l)return n+i.scanIdentical(l,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,a=r>>1,l=[],h=0,c=-1,u=[];function d(t){let n;if(t.lines>o&&t instanceof i)for(let e of t.children)d(e);else t.lines>a&&(h>a||!h)?(f(),l.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&&f(),h+=t.lines,c+=t.length+1,u.push(t))}function f(){0!=h&&(l.push(1==u.length?u[0]:i.from(u,c)),c=-1,h=u.length=0)}for(let e of t)d(e);return f(),1==l.length?l[0]:new i(l,n)}}function n(t,e,i=0,n=1e9){for(let s=0,r=0,o=!0;r=i&&(l>n&&(a=a.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,a=s instanceof e?s.text.length:s.children.length;if(o==(i>0?a: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 a{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]=a.prototype[Symbol.iterator]=function(){return this});let l=class{constructor(t,e,i,n){this.from=t,this.to=e,this.number=i,this.text=n}get length(){return this.to-this.from}},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 d=8205;function f(t,e,i=!0,n=!0){return(i?p:O)(t,e,n)}function p(t,e,i){if(e==t.length)return e;e&&g(t.charCodeAt(e))&&m(t.charCodeAt(e-1))&&e--;let n=b(t,e);for(e+=v(n);e=0&&u(b(t,n));)i++,n-=2;if(i%2==0)break;e+=2}}}return e}function O(t,e,i){for(;e>0;){let n=p(t,e-2,i);if(n=56320&&t<57344}function m(t){return t>=55296&&t<56320}function b(t,e){let i=t.charCodeAt(e);if(!m(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return g(n)?n-56320+(i-55296<<10)+65536:i}function w(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function v(t){return t<65536?1:2}const y=/\r\n?|\n/;var S=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(S||(S={}));class x{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;et)return s+(t-n);s+=o}else{if(i!=S.Simple&&l>=t&&(i==S.TrackDel&&nt||i==S.TrackBefore&&nt))return null;if(l>t||l==t&&e<0&&!o)return t==n||e<0?s:s+a;s+=a}n=l}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 x(t)}static create(t){return new x(t)}}class k extends x{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 P(this,((e,i,n,s,r)=>t=t.replace(n,n+(i-e),r)),!1),t}mapDesc(t,e=!1){return C(this,t,e,!0)}invert(e){let i=this.sections.slice(),n=[];for(let s=0,r=0;s=0){i[s]=a,i[s+1]=o;let l=s>>1;for(;n.length0&&$(i,e,s.text),s.forward(t),o+=t}let l=t[r++];for(;o>1].toJSON()))}return t}static of(e,i,n){let s=[],r=[],o=0,a=null;function l(t=!1){if(!t&&!s.length)return;oa||e<0||a>i)throw new RangeError(`Invalid change range ${e} to ${a} (in doc of length ${i})`);let u=c?"string"==typeof c?t.of(c.split(n||y)):c:t.empty,d=u.length;if(e==a&&0==d)return;eo&&Q(s,e-o,-1),Q(s,a-e,d),$(r,s,u),o=a}}(e),l(!a),a}static empty(t){return new k(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 $(e,i,n){if(0==n.length)return;let s=i.length-2>>1;if(s>1])),!(n||a==e.sections.length||e.sections[a+1]<0);)l=e.sections[a++],h=e.sections[a++];i(r,c,o,u,d),r=c,o=u}}}function C(t,e,i,n=!1){let s=[],r=n?[]:null,o=new X(t),a=new X(e);for(let t=-1;;)if(-1==o.ins&&-1==a.ins){let t=Math.min(o.len,a.len);Q(s,t,-1),o.forward(t),a.forward(t)}else if(a.ins>=0&&(o.ins<0||t==o.i||0==o.off&&(a.len=0&&t=0)){if(o.done&&a.done)return r?k.createSet(s,r):x.create(s);throw new Error("Mismatched change set lengths")}{let e=0,i=o.len;for(;i;)if(-1==a.ins){let t=Math.min(i,a.len);e+=t,i-=t,a.forward(t)}else{if(!(0==a.ins&&a.lene||o.ins>=0&&o.len>e)&&(t||n.length>i),r.forward2(e),o.forward(e)}}else Q(n,0,o.ins,t),s&&$(s,n,o.text),o.next()}}class X{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 Z{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 Z(i,n,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return A.range(t,e);let i=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return A.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 A.range(t.anchor,t.head)}static create(t,e,i){return new Z(t,e,i)}}class A{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:A.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 A(t.ranges.map((t=>Z.fromJSON(t))),t.main)}static single(t,e=t){return new A([A.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?A.range(o,r):A.range(r,o))}}return new A(t,e)}}function T(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let R=0;class E{constructor(t,e,i,n,s){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=n,this.id=R++,this.default=t([]),this.extensions="function"==typeof s?s(this):s}static define(t={}){return new E(t.combine||(t=>t),t.compareInput||((t,e)=>t===e),t.compare||(t.combine?(t,e)=>t===e:V),!!t.static,t.enables)}of(t){return new M([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,2,e)}from(t,e){return e||(e=t=>t),this.compute([t],(i=>e(i.field(t))))}}function V(t,e){return t==e||t.length==e.length&&t.every(((t,i)=>t===e[i]))}class M{constructor(t,e,i,n){this.dependencies=t,this.facet=e,this.type=i,this.value=n,this.id=R++}dynamicSlot(t){var e;let i=this.value,n=this.facet.compareInput,s=this.id,r=t[s]>>1,o=2==this.type,a=!1,l=!1,h=[];for(let i of this.dependencies)"doc"==i?a=!0:"selection"==i?l=!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(a&&e.docChanged||l&&(e.docChanged||e.selection)||W(t,h)){let e=i(t);if(o?!D(e,t.values[r],n):!n(e,t.values[r]))return t.values[r]=e,1}return 0},reconfigure:(t,e)=>{let a,l=e.config.address[s];if(null!=l){let s=tt(e,l);if(this.dependencies.every((i=>i instanceof E?e.facet(i)===t.facet(i):!(i instanceof q)||e.field(i,!1)==t.field(i,!1)))||(o?D(a=i(t),s,n):n(a=i(t),s)))return t.values[r]=s,0}else a=i(t);return t.values[r]=a,1}}}}function D(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 a(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(Y).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,Y.of({field:this,create:t})]}get extension(){return this}}const L=4,z=3,I=2,B=1;function j(t){return e=>new G(e,t)}const N={highest:j(0),high:j(B),default:j(I),low:j(z),lowest:j(L)};class G{constructor(t,e){this.inner=t,this.prec=e}}class F{of(t){return new H(this,t)}reconfigure(t){return F.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class H{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;function r(t,o){let a=s.get(t);if(null!=a){if(a<=o)return;let e=n[a].indexOf(t);e>-1&&n[a].splice(e,1),t instanceof H&&i.delete(t.compartment)}if(s.set(t,o),Array.isArray(t))for(let e of t)r(e,o);else if(t instanceof H){if(i.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");let n=e.get(t.compartment)||t.inner;i.set(t.compartment,n),r(n,o)}else if(t instanceof G)r(t.inner,t.prec);else if(t instanceof q)n[o].push(t),t.provides&&r(t.provides,o);else if(t instanceof M)n[o].push(t),t.facet.extensions&&r(t.facet.extensions,I);else{let e=t.extension;if(!e)throw new Error(`Unrecognized extension value in extension set (${t}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(e,o)}}return r(t,I),n.reduce(((t,e)=>t.concat(e)))}(t,e,r))i instanceof q?n.push(i):(s[i.facet.id]||(s[i.facet.id]=[])).push(i);let o=Object.create(null),a=[],l=[];for(let t of n)o[t.id]=l.length<<1,l.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]=a.length<<1|1,V(r,e))a.push(i.facet(n));else{let t=n.combine(e.map((t=>t.value)));a.push(i&&n.compare(t,i.facet(n))?i.facet(n):t)}else{for(let t of e)0==t.type?(o[t.id]=a.length<<1|1,a.push(t.value)):(o[t.id]=l.length<<1,l.push((e=>t.dynamicSlot(e))));o[n.id]=l.length<<1,l.push((t=>U(t,n,e)))}}let c=l.map((t=>t(o)));return new J(t,r,c,o,a,s)}}function K(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 tt(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}const et=E.define(),it=E.define({combine:t=>t.some((t=>t)),static:!0}),nt=E.define({combine:t=>t.length?t[0]:void 0,static:!0}),st=E.define(),rt=E.define(),ot=E.define(),at=E.define({combine:t=>!!t.length&&t[0]});class lt{constructor(t,e){this.type=t,this.value=e}static define(){return new ht}}class ht{of(t){return new lt(this,t)}}class ct{constructor(t){this.map=t}of(t){return new ut(this,t)}}class ut{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 ut(this.type,e)}is(t){return this.type==t}static define(t={}){return new ct(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}}ut.reconfigure=ut.define(),ut.appendConfig=ut.define();class dt{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&&T(i,e.newLength),s.some((t=>t.type==dt.time))||(this.annotations=s.concat(dt.time.of(Date.now())))}static create(t,e,i,n,s,r){return new dt(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(dt.userEvent);return!(!e||!(e==t||e.length>t.length&&e.slice(0,t.length)==t&&"."==e[t.length]))}}function ft(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=pt(n,Ot(e,r,t.changes.newLength),!0))}return n==t?t:dt.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(st)){let e=n(t);if(!1===e){i=!1;break}Array.isArray(e)&&(i=!0===i?e:ft(i,e))}if(!0!==i){let n,s;if(!1===i)s=t.changes.invertedDesc,n=k.empty(e.doc.length);else{let e=t.changes.filter(i);n=e.changes,s=e.filtered.mapDesc(e.changes).invertedDesc}t=dt.create(e,n,t.selection&&t.selection.map(s),ut.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let n=e.facet(rt);for(let i=n.length-1;i>=0;i--){let s=n[i](t);t=s instanceof dt?s:Array.isArray(s)&&1==s.length&&s[0]instanceof dt?s[0]:gt(e,bt(s),!1)}return t}(s):s)}dt.time=lt.define(),dt.userEvent=lt.define(),dt.addToHistory=lt.define(),dt.remote=lt.define();const mt=[];function bt(t){return null==t?mt:Array.isArray(t)?t:[t]}var wt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(wt||(wt={}));const vt=/[\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){}function St(t){return e=>{if(!/\S/.test(e))return wt.Space;if(function(t){if(yt)return yt.test(t);for(let e=0;e"€"&&(i.toUpperCase()!=i.toLowerCase()||vt.test(i)))return!0}return!1}(e))return wt.Word;for(let i=0;i-1)return wt.Word;return wt.Other}}class xt{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(ut.reconfigure)?(i=null,n=e.value):e.is(ut.appendConfig)&&(i=null,n=bt(n).concat(e.value));if(i)e=t.startState.values.slice();else{i=J.resolve(n,s,this),e=new xt(i,this.doc,this.selection,i.dynamicSlots.map((()=>null)),((t,e)=>e.reconfigure(t,this)),null).values}new xt(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:A.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=bt(i.effects);for(let i=1;is.spec.fromJSON(r,t))))}return xt.create({doc:t.doc,selection:A.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(xt.lineSeparator)||y)),s=e.selection?e.selection instanceof A?e.selection:A.single(e.selection.anchor,e.selection.head):A.single(0);return T(s,n.length),i.staticFacet(it)||(s=s.asSingle()),new xt(i,n,s,i.dynamicSlots.map((()=>null)),((t,e)=>e.create(t)),null)}get tabSize(){return this.facet(xt.tabSize)}get lineBreak(){return this.facet(xt.lineSeparator)||"\n"}get readOnly(){return this.facet(at)}phrase(t,...e){for(let e of this.facet(xt.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(et))for(let r of s(this,e,i))Object.prototype.hasOwnProperty.call(r,t)&&n.push(r[t]);return n}charCategorizer(t){return St(this.languageDataAt("wordChars",t).join(""))}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=f(e,r,!1);if(s(e.slice(t,r))!=wt.Word)break;r=t}for(;ot.length?t[0]:4}),xt.lineSeparator=nt,xt.readOnly=at,xt.phrases=E.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]))}}),xt.languageData=et,xt.changeFilter=st,xt.transactionFilter=rt,xt.transactionExtender=ot,F.reconfigure=ut.define();class Qt{eq(t){return this==t}range(t,e=t){return $t.create(t,e,this)}}Qt.prototype.startSide=Qt.prototype.endSide=0,Qt.prototype.point=!1,Qt.prototype.mapMode=S.TrackDel;let $t=class t{constructor(t,e,i){this.from=t,this.to=e,this.value=i}static create(e,i,n){return new t(e,i,n)}};function Pt(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Ct{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,a=s[n]-t||(i?this.value[n].endSide:this.value[n].startSide)-e;if(n==r)return a>=0?r:o;a>=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||l==h&&c.startSide>0&&c.endSide<=0)continue;(h-l||c.endSide-c.startSide)<0||(r<0&&(r=l),c.point&&(o=Math.max(o,h-l)),i.push(c),n.push(l-r),s.push(h-r))}return{mapped:i.length?new Ct(n,s,i,o):null,pos:r}}}class _t{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 _t(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(Pt)),this.isEmpty)return e.length?_t.of(e):this;let o=new At(this,null,-1).goto(0),a=0,l=[],h=new Xt;for(;o.value||a=0){let t=e[a++];h.addInner(t.from,t.to,t.value)||l.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 Tt.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return Tt.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)),a=Zt(r,o,i),l=new Et(r,a,s),h=new Et(o,a,s);i.iterGaps(((t,e,i)=>Vt(l,t,h,e,i,n))),i.empty&&0==i.length&&Vt(l,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=Zt(s,r),a=new Et(s,o,0).goto(i),l=new Et(r,o,0).goto(i);for(;;){if(a.to!=l.to||!Mt(a.active,l.active)||a.point&&(!l.point||!a.point.eq(l.point)))return!1;if(a.to>n)return!0;a.next(),l.next()}}static spans(t,e,i,n,s=-1){let r=new Et(t,null,s).goto(e),o=e,a=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,a),a=r.openEnd(t));if(r.to>i)return a+(r.point&&r.to>i?1:0);o=r.to,r.next()}}static of(t,e=!1){let i=new Xt;for(let n of t instanceof $t?[t]:e?function(t){if(t.length>1)for(let e=t[0],i=1;i0)return t.slice().sort(Pt);e=n}return t}(t):t)i.add(n.from,n.to,n.value);return i.finish()}}_t.empty=new _t([],[],null,-1),_t.empty.nextLayer=_t.empty;class Xt{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}finishChunk(t){this.chunks.push(new Ct(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=[])}add(t,e,i){this.addInner(t,e,i)||(this.nextLayer||(this.nextLayer=new Xt)).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(_t.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;let e=_t.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function Zt(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 At(r,e,i,s));return 1==n.length?n[0]:new Tt(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--)Rt(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--)Rt(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(),Rt(this.heap,0)}}}function Rt(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 Et{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=Tt.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){Dt(this.active,t),Dt(this.activeTo,t),Dt(this.activeRank,t),this.minActive=Ut(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&&Dt(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 Vt(t,e,i,n,s,r){t.goto(e),i.goto(n);let o=n+s,a=n,l=n-e;for(;;){let e=t.to+l-i.to||t.endSide-i.endSide,n=e<0?t.to+l: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))&&Mt(t.activeForPoint(t.to+l),i.activeForPoint(i.to))||r.comparePoint(a,s,t.point,i.point):s>a&&!Mt(t.active,i.active)&&r.compareRange(a,s,t.active,i.active),n>o)break;a=n,e<=0&&t.next(),e>=0&&i.next()}}function Mt(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 Ut(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(!l)throw new RangeError("The value of a property ("+i+") should be a primitive value.");s(n(i),o,a,h)}else null!=o&&a.push(i.replace(/_.*/,"").replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))+": "+o+";")}(a.length||h)&&r.push((!i||l||o?t:t.map(i)).join(", ")+" {"+a.join(" ")+"}")}for(let e in t)s(n(e),t[e],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let t=zt[qt]||1;return zt[qt]=t+1,"ͼ"+t.toString(36)}static mount(t,e){(t[Lt]||new jt(t)).mount(Array.isArray(e)?e:[e])}}let Bt=new Map;class jt{constructor(t){let e=t.ownerDocument||t,i=e.defaultView;if(!t.head&&t.adoptedStyleSheets&&i.CSSStyleSheet){let n=Bt.get(e);if(n)return t.adoptedStyleSheets=[n.sheet,...t.adoptedStyleSheets],t[Lt]=n;this.sheet=new i.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets],Bt.set(e,this)}else{this.styleTag=e.createElement("style");let i=t.head||t;i.insertBefore(this.styleTag,i.firstChild)}this.modules=[],t[Lt]=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:'"'},Ft="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),Ht="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Jt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Kt=Ht||Ft&&+Ft[1]<57,te=0;te<10;te++)Nt[48+te]=Nt[96+te]=String(te);for(te=1;te<=24;te++)Nt[te+111]="F"+te;for(te=65;te<=90;te++)Nt[te]=String.fromCharCode(te+32),Gt[te]=String.fromCharCode(te);for(var ee in Nt)Gt.hasOwnProperty(ee)||(Gt[ee]=Nt[ee]);function ie(t){let e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection()}function ne(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function se(t,e){if(!e.anchorNode)return!1;try{return ne(t,e.anchorNode)}catch(t){return!1}}function re(t){return 3==t.nodeType?me(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function oe(t,e,i,n){return!!i&&(le(t,e,i,n,-1)||le(t,e,i,n,1))}function ae(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function le(t,e,i,n,s){for(;;){if(t==i&&e==n)return!0;if(e==(s<0?0:he(t))){if("DIV"==t.nodeName)return!1;let i=t.parentNode;if(!i||1!=i.nodeType)return!1;e=ae(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?he(t):0}}}function he(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}const ce={left:0,right:0,top:0,bottom:0};function ue(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function de(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}class fe{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){this.set(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset)}set(t,e,i,n){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=n}}let pe,Oe=null;function ge(t){if(t.setActive)return t.setActive();if(Oe)return t.focus(Oe);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==Oe?{get preventScroll(){return Oe={preventScroll:!0},!0}}:void 0),!Oe){Oe=!1;for(let t=0;te)return i.domBoundsAround(t,e,l);if(c>=t&&-1==n&&(n=a,s=l),l>e&&i.dom.parentNode==this.dom){r=a,o=h;break}h=c,l=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.dirty|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.dirty|=2),1&e.dirty)return;e.dirty|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,this.dirty&&this.markParentsDirty(!0))}setDOM(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=ye){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 Qe(t,e,i,n,s,r,o,a,l){let{children:h}=t,c=h.length?h[e]:null,u=r.length?r[r.length-1]:null,d=u?u.breakAfter:o;if(!(e==n&&c&&!o&&!d&&r.length<2&&c.merge(i,s,r.length?u:null,0==i,a,l))){if(n0&&(!o&&r.length&&c.merge(i,c.length,r[0],!1,a,0)?c.breakAfter=r.shift().breakAfter:(i2);var De={mac:Me||/Mac/.test(Pe.platform),windows:/Win/.test(Pe.platform),linux:/Linux|X11/.test(Pe.platform),ie:Ae,ie_version:Xe?Ce.documentMode||6:Ze?+Ze[1]:_e?+_e[1]:0,gecko:Te,gecko_version:Te?+(/Firefox\/(\d+)/.exec(Pe.userAgent)||[0,0])[1]:0,chrome:!!Re,chrome_version:Re?+Re[1]:0,ios:Me,android:/Android\b/.test(Pe.userAgent),webkit:Ee,safari:Ve,webkit_version:Ee?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Ce.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class We extends Se{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(!i||i instanceof We&&!(this.length-(e-t)+i.length>256))&&(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),!0)}split(t){let e=new We(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new ve(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 Ye(this.dom,t,e)}}class Ue extends Se{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(we(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}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.dirty|=6)}sync(t,e){this.dom?4&this.dirty&&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 Ue&&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 Ue(this.mark,e,r)}domAtPos(t){return Ge(this,t)}coordsAt(t,e){return He(this,t,e)}}function Ye(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?De.chrome||De.gecko||(e?(s--,o=1):r=0)?0:a.length-1];return De.safari&&!o&&0==l.width&&(l=Array.prototype.find.call(a,(t=>t.width))||l),o?ue(l,o<0):l||null}class qe extends Se{constructor(t,e,i){super(),this.widget=t,this.length=e,this.side=i,this.prevWidget=null}static create(t,e,i){return new(t.customView||qe)(t,e,i)}split(t){let e=qe.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 qe&&this.widget.compare(i.widget))||t>0&&s<=0||e0)?ve.before(this.dom):ve.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let i=this.dom.getClientRects(),n=null;if(!i.length)return ce;for(let e=t>0?i.length-1:0;n=i[e],!(t>0?0==e:e==i.length-1||n.top0?-1:1);return this.length?n:ue(n,this.side>0)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class Le extends qe{domAtPos(t){let{topView:e,text:i}=this.widget;return e?ze(t,0,e,i,this.length-e.length,((t,e)=>t.domAtPos(e)),((t,e)=>new ve(t,Math.min(e,t.nodeValue.length)))):new ve(i,Math.min(t,i.nodeValue.length))}sync(){this.setDOM(this.widget.toDOM())}localPosFromDOM(t,e){let{topView:i,text:n}=this.widget;return i?Be(t,e,i,n,this.length-i.length):Math.min(e,this.length)}ignoreMutation(){return!1}get overrideDOMText(){return null}coordsAt(t,e){let{topView:i,text:n}=this.widget;return i?ze(t,e,i,n,this.length-i.length,((t,e,i)=>t.coordsAt(e,i)),((t,e,i)=>Ye(t,e,i))):Ye(n,t,e)}destroy(){var t;super.destroy(),null===(t=this.widget.topView)||void 0===t||t.destroy()}get isEditable(){return!0}canReuseDOM(){return!0}}function ze(t,e,i,n,s,r,o){if(i instanceof Ue){for(let a=i.dom.firstChild;a;a=a.nextSibling){let i=Se.get(a);if(i){let l=ne(a,n),h=i.length+(l?s:0);if(t0?ve.before(this.dom):ve.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){let e=this.dom.getBoundingClientRect(),i=function(t,e){let i=t.parent,n=i?i.children.indexOf(t):-1;for(;i&&n>=0;)if(e<0?n>0:n0?-1:1);return i&&i.tope.top?{left:e.left,right:e.right,top:i.top,bottom:i.bottom}:e}get overrideDOMText(){return t.empty}get isHidden(){return!0}}function Ge(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 Ue&&s.length&&(n=s[s.length-1])instanceof Ue&&n.mark.eq(e.mark)?Fe(n,e.children[0],i-1):(s.push(e),e.setParent(t)),t.length+=e.length}function He(t,e,i){let n=null,s=-1,r=null,o=-1;!function t(e,a){for(let l=0,h=0;l=a&&(c.children.length?t(c,a-h):(!r||r instanceof Ne&&i>0)&&(u>a||h==u&&c.getSide()>0)?(r=c,o=a-h):(h0?3e8:-4e8:e>0?1e8:-1e8,new oi(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}=ai(t,n);e=(s?n?-3e8:-1:5e8)-1,i=1+(r?n?2e8:1:-6e8)}return new oi(t,e,i,n,t.widget||null,!0)}static line(t){return new ri(t)}static set(t,e=!1){return _t.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}ni.none=_t.empty;class si extends ni{constructor(t){let{start:e,end:i}=ai(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){return this==t||t instanceof si&&this.tagName==t.tagName&&this.class==t.class&&Ke(this.attrs,t.attrs)}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}si.prototype.point=!1;class ri extends ni{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof ri&&this.spec.class==t.spec.class&&Ke(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)}}ri.prototype.mapMode=S.TrackBefore,ri.prototype.point=!0;class oi extends ni{constructor(t,e,i,n,s,r){super(e,i,s,t),this.block=n,this.isReplace=r,this.mapMode=n?e<=0?S.TrackBefore:S.TrackAfter:S.TrackDel}get type(){return this.startSide=5}eq(t){return t instanceof oi&&(e=this.widget,i=t.widget,e==i||!!(e&&i&&e.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var e,i}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 ai(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 li(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)}oi.prototype.point=!0;class hi extends Se{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 hi))return!1;this.dom||i.transferDOM(this)}return n&&this.setDeco(i?i.attrs:null),$e(this,t,e,i?i.children:[],s,r),!0}split(t){let e=new hi;if(e.breakAfter=this.breakAfter,0==this.length)return e;let{i: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){Ke(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){Fe(this,t,e)}addLineDeco(t){let e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=Je(e,this.attrs||{})),i&&(this.attrs=Je({class:i},this.attrs||{}))}domAtPos(t){return Ge(this,t)}reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.dirty|=6)}sync(t,e){var i;this.dom?4&this.dirty&&(we(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&&(ti(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&&Se.get(n)instanceof Ue;)n=n.lastChild;if(!(n&&this.length&&("BR"==n.nodeName||0!=(null===(i=Se.get(n))||void 0===i?void 0:i.isEditable)||De.ios&&this.children.some((t=>t instanceof We))))){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 We)||/[^ -~]/.test(i.text))return null;let n=re(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=He(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 hi)return s;if(r>e)break}n=r+s.breakAfter}return null}}class ci extends Se{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 ci&&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(di(new We(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 oi){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let o=e-t;if(i instanceof oi)if(i.block){let{type:t}=i;t!=ii.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new ci(i.widget||new fi("div"),o,t))}else{let r=qe.create(i.widget||new fi("span"),o,o?0:i.startSide),a=this.atCursorPos&&!r.isEditable&&s<=n.length&&(t0),l=!r.isEditable&&(tn.length||i.startSide<=0),h=this.getLine();2!=this.pendingBuffer||a||r.isEditable||(this.pendingBuffer=0),this.flushBuffer(n),a&&(h.append(di(new Ne(1),n),s),s=n.length+Math.max(0,s-n.length)),h.append(di(r,n),s),this.atCursorPos=l,this.pendingBuffer=l?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 ui(t,e,i,s);return r.openEnd=_t.spans(n,e,i,r),r.openStart<0&&(r.openStart=r.openEnd),r.finish(r.openEnd),r}}function di(t,e){for(let i of e)t=new Ue(i,[t],t.length);return t}class fi extends ei{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 pi=E.define(),Oi=E.define(),gi=E.define(),mi=E.define(),bi=E.define(),wi=E.define(),vi=E.define(),yi=E.define({combine:t=>t.some((t=>t))}),Si=E.define({combine:t=>t.some((t=>t))});class xi{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 xi(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin)}}const ki=ut.define({map:(t,e)=>t.map(e)});function Qi(t,e,i){let n=t.facet(mi);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 $i=E.define({combine:t=>!t.length||t[0]});let Pi=0;const Ci=E.define();class _i{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 _i(Pi++,t,i,(t=>{let e=[Ci.of(t)];return s&&e.push(Ti.of((e=>{let i=e.plugin(t);return i?s(i):ni.none}))),n&&e.push(n(t)),e}))}static fromClass(t,e){return _i.define((e=>new t(e)),e)}}class Xi{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(Qi(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){Qi(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){Qi(t.state,e,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Zi=E.define(),Ai=E.define(),Ti=E.define(),Ri=E.define(),Ei=E.define(),Vi=E.define();class Mi{constructor(t,e,i,n){this.fromA=t,this.toA=e,this.fromB=i,this.toB=n}join(t){return new Mi(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(!a)return i;new Mi(a.fromA,a.toA,a.fromB,a.toB).addToSet(i),r=a.toA,o=a.toB}}}class Di{constructor(t,e,i){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=k.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 Mi(t,e,i,s)))),this.changedRanges=n}static create(t,e,i){return new Di(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 Wi=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Wi||(Wi={}));const Ui=Wi.LTR,Yi=Wi.RTL;function qi(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}}const Gi=[];function Fi(t){return[new Ni(0,t,0)]}let Hi="";function Ji(t,e,i,n,s){var r;let o=n.head-t.from,a=-1;if(0==o){if(!s||!t.length)return null;e[0].level!=i&&(o=e[0].side(!1,i),a=0)}else if(o==t.length){if(s)return null;let t=e[e.length-1];t.level!=i&&(o=t.side(!0,i),a=e.length-1)}a<0&&(a=Ni.find(e,o,null!==(r=n.bidiLevel)&&void 0!==r?r:-1,n.assoc));let l=e[a];o==l.side(s,i)&&(l=e[a+=s?1:-1],o=l.side(!s,i));let h=s==(l.dir==i),c=f(t.text,o,h);if(Hi=t.text.slice(Math.min(o,c),Math.max(o,c)),c!=l.side(s,i))return A.cursor(c+t.from,h?-1:1,l.level);let u=a==(s?e.length-1:0)?null:e[a+(s?1:-1)];return u||l.level==i?u&&u.level1)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=Se.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 en(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}class nn{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class sn extends Se{constructor(t){super(),this.view=t,this.compositionDeco=ni.none,this.decorations=[],this.dynamicDecorationMap=[],this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(t.contentDOM),this.children=[new hi],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Mi(0,0,0,t.state.doc.length)],0)}get length(){return this.view.state.doc.length}update(t){let e=t.changedRanges;this.minWidth>0&&e.length&&(e.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),this.view.inputState.composing<0?this.compositionDeco=ni.none:(t.transactions.length||this.dirty)&&(this.compositionDeco=function(t,e){let i=on(t);if(!i)return ni.none;let{from:n,to:s,node:r,text:o}=i,a=e.mapPos(n,1),l=Math.max(a,e.mapPos(s,-1)),{state:h}=t,c=3==r.nodeType?r.nodeValue:new tn([],h).readRange(r.firstChild,null).text;if(l-a{this.dom.style.height=this.view.viewState.contentHeight+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let t=De.chrome||De.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,t),this.dirty=0,t&&(t.written||i.selectionRange.focusNode!=t.node)&&(this.forceSelection=!0),this.dom.style.height=""}));let n=[];if(this.view.viewport.from||this.view.viewport.to=0?t[e]:null;if(!n)break;let{fromA:s,toA:r,fromB:o,toB:a}=n,{content:l,breakAtStart:h,openStart:c,openEnd:u}=ui.build(this.view.state.doc,o,a,this.decorations,this.dynamicDecorationMap),{i:d,off:f}=i.findPos(r,1),{i:p,off:O}=i.findPos(s,-1);Qe(this,p,O,d,f,l,h,c,u)}}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&&se(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,a=this.domAtPos(o.anchor),l=o.empty?a:this.domAtPos(o.head);if(De.gecko&&o.empty&&!this.compositionDeco.size&&(1==(h=a).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((()=>a.node.insertBefore(t,a.node.childNodes[a.offset]||null))),a=l=new ve(t,0),r=!0}var h;let c=this.view.observer.selectionRange;!r&&c.focusNode&&oe(a.node,a.offset,c.anchorNode,c.anchorOffset)&&oe(l.node,l.offset,c.focusNode,c.focusOffset)||(this.view.observer.ignore((()=>{De.android&&De.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=ie(this.view.root);if(t)if(o.empty){if(De.gecko){let t=(e=a.node,n=a.offset,1!=e.nodeType?0:(n&&"false"==e.childNodes[n-1].contentEditable?1:0)|(no.head&&([a,l]=[l,a]),e.setEnd(l.node,l.offset),e.setStart(a.node,a.offset),t.removeAllRanges(),t.addRange(e)}else;var e,n;s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())})),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new ve(c.anchorNode,c.anchorOffset),this.impreciseHead=l.precise?null:new ve(c.focusNode,c.focusOffset)}enforceCursorAssoc(){if(this.compositionDeco.size)return;let{view:t}=this,e=t.state.selection.main,i=ie(t.root),{anchorNode:n,anchorOffset:s}=t.observer.selectionRange;if(!(i&&e.empty&&e.assoc&&i.modify))return;let r=hi.find(this,e.head);if(!r)return;let o=r.posAtStart;if(e.head==o||e.head==o+r.length)return;let a=this.coordsAt(e.head,-1),l=this.coordsAt(e.head,1);if(!a||!l||a.bottom>l.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)}nearest(t){for(let e=t;e;){let t=Se.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!=ii.WidgetBefore&&s.type!=ii.WidgetAfter&&(!n||2==e||this.children[n-1].breakAfter||this.children[n-1].type==ii.WidgetBefore&&e>-2))return s.coordsAt(t-r,e);i=r}}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,a=this.view.textDirection==Wi.LTR;for(let t=0,l=0;ln)break;if(t>=i){let i=h.dom.getBoundingClientRect();if(e.push(i.height),r){let e=h.dom.lastChild,n=e?re(e):[];if(n.length){let e=n[n.length-1],r=a?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?Wi.RTL:Wi.LTR}measureTextSize(){for(let t of this.children)if(t instanceof hi){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.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(n);let s=re(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 ke(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;t.push(ni.replace({widget:new rn(n),block:!0,inclusive:!0,isBlockGap:!0}).range(i,r))}if(!s)break;i=s.to+1}return ni.set(t)}updateDeco(){let t=this.view.state.facet(Ti).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=0,r=0,o=0,a=0;for(let t of this.view.state.facet(Ei).map((t=>t(this.view))))if(t){let{left:e,right:i,top:n,bottom:l}=t;null!=e&&(s=Math.max(s,e)),null!=i&&(r=Math.max(r,i)),null!=n&&(o=Math.max(o,n)),null!=l&&(a=Math.max(a,l))}let l={left:n.left-s,top:n.top-o,right:n.right+r,bottom:n.bottom+a};!function(t,e,i,n,s,r,o,a){let l=t.ownerDocument,h=l.defaultView||window;for(let c=t;c;)if(1==c.nodeType){let t,u=c==l.body;if(u)t=de(h);else{if(c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let e=c.getBoundingClientRect();t={left:e.left,right:e.left+c.clientWidth,top:e.top,bottom:e.top+c.clientHeight}}let d=0,f=0;if("nearest"==s)e.top0&&e.bottom>t.bottom+f&&(f=e.bottom-t.bottom+f+o)):e.bottom>t.bottom&&(f=e.bottom-t.bottom+o,i<0&&e.top-f0&&e.right>t.right+d&&(d=e.right-t.right+d+r)):e.right>t.right&&(d=e.right-t.right+r,i<0&&e.left0))break;i=i.childNodes[n-1],n=he(i)}if(i>=0)for(let n=t,s=e;;){if(3==n.nodeType)return n;if(!(1==n.nodeType&&s=0))break;n=n.childNodes[s],s=0}return null}class hn{constructor(){this.changes=[]}compareRange(t,e){li(t,e,this.changes)}comparePoint(t,e){li(t,e,this.changes)}}function cn(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function un(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function dn(t,e){return t.tope.top+1}function fn(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,a,l,h,c,u=!1;for(let d=t.firstChild;d;d=d.nextSibling){let t=re(d);for(let f=0;fg||o==g&&r>O){n=d,s=p,r=O,o=g;let a=g?i0?f0)}0==O?i>p.bottom&&(!h||h.bottomp.top)&&(l=d,c=p):h&&dn(h,p)?h=pn(h,p.bottom):c&&dn(c,p)&&(c=fn(c,p.top))}}if(h&&h.bottom>=i?(n=a,s=h):c&&c.top<=i&&(n=l,s=c),!n)return{node:t,offset:0};let d=Math.max(s.left,Math.min(s.right,e));return 3==n.nodeType?gn(n,d,i):u&&"false"!=n.contentEditable?On(n,d,i):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,n)+(e>=(s.left+s.right)/2?1:0)}}function gn(t,e,i){let n=t.nodeValue.length,s=-1,r=1e9,o=0;for(let a=0;ai?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(De.chrome||De.gecko){me(t,a).getBoundingClientRect().left==h.right&&(n=!i)}if(c<=0)return{node:t,offset:a+(n?1:0)};s=a+(n?1:0),r=c}}}return{node:t,offset:s>-1?s:o>0?t.nodeValue.length:0}}function mn(t,e,i,n=-1){var s,r;let o,a=t.contentDOM.getBoundingClientRect(),l=a.top+t.viewState.paddingTop,{docHeight:h}=t.viewState,{x:c,y:u}=e,d=u-l;if(d<0)return 0;if(d>h)return t.state.doc.length;for(let e=t.defaultLineHeight/2,s=!1;o=t.elementAtHeight(d),o.type!=ii.Text;)for(;d=n>0?o.bottom+e:o.top-e,!(d>=0&&d<=h);){if(s)return i?null:0;s=!0,n=-n}u=l+d;let f=o.from;if(ft.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:bn(t,a,o,c,u);let p=t.dom.ownerDocument,O=t.root.elementFromPoint?t.root:p,g=O.elementFromPoint(c,u);g&&!t.contentDOM.contains(g)&&(g=null),g||(c=Math.max(a.left+1,Math.min(a.right-1,c)),g=O.elementFromPoint(c,u),g&&!t.contentDOM.contains(g)&&(g=null));let m,b=-1;if(g&&0!=(null===(s=t.docView.nearest(g))||void 0===s?void 0:s.isEditable))if(p.caretPositionFromPoint){let t=p.caretPositionFromPoint(c,u);t&&({offsetNode:m,offset:b}=t)}else if(p.caretRangeFromPoint){let e=p.caretRangeFromPoint(c,u);e&&(({startContainer:m,startOffset:b}=e),(!t.contentDOM.contains(m)||De.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 me(t,n-1,n).getBoundingClientRect().left>i}(m,b,c)||De.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}let n=1==t.nodeType?t.getBoundingClientRect():me(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return i-n.left>5}(m,b,c))&&(m=void 0))}if(!m||!t.docView.dom.contains(m)){let e=hi.find(t.docView,f);if(!e)return d>o.top+o.height/2?o.to:o.from;({node:m,offset:b}=On(e.dom,c,u))}let w=t.docView.nearest(m);if(!w)return null;if(w.isWidget&&1==(null===(r=w.dom)||void 0===r?void 0:r.nodeType)){let t=w.dom.getBoundingClientRect();return e.y1.5*t.defaultLineHeight){r+=Math.floor((s-i.top)/t.defaultLineHeight)*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=f(t,n)}return!0===n?-1:t.length}(o,r,t.state.tabSize)}function wn(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=t.bidiSpans(s),o=t.textDirectionAt(s.from);for(let a=e,l=null;;){let e=Ji(s,r,o,a,i),h=Hi;if(!e){if(s.number==(i?t.state.doc.lines:1))return a;h="\n",s=t.state.doc.line(s.number+(i?1:-1)),r=t.bidiSpans(s),e=A.cursor(i?s.from:s.to)}if(l){if(!l(h))return a}else{if(!n)return e;l=n(h)}a=e}}function vn(t,e,i,n){let s=t.state.facet(Ri).map((e=>e(t)));for(;;){let t=!1;for(let r of s)r.between(i.from-1,i.from+1,((s,r,o)=>{i.from>s&&i.fromi.from?A.cursor(s,1):A.cursor(r,-1),t=!0,o.widget.skipPosition&&(i=o.widget.skipPosition(i,e,n)))}));if(!t)return i}}class yn{constructor(t){this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null;let e=(e,i)=>{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 Cn){let n=Cn[i];t.contentDOM.addEventListener(i,(i=>{Pn(t,i)&&e(n,i)}),_n[i]),this.registeredEvents.push(i)}t.scrollDOM.addEventListener("mousedown",(i=>{if(i.target==t.scrollDOM&&i.clientY>t.contentDOM.getBoundingClientRect().bottom&&(e(Cn.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)}})),De.chrome&&102==De.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,De.safari&&t.contentDOM.addEventListener("input",(()=>null))}setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}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=>{Pn(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){Qi(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){Qi(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||xn.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,be(t.contentDOM,e.key,e.keyCode))}ignoreDuringComposition(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(De.safari&&!De.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 Sn=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],xn="dthko",kn=[16,17,18,20,91,92,224,225];function Qn(t){return.7*Math.max(0,t)+8}class $n{constructor(t,e,i,n){this.view=t,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);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(xt.allowMultipleSelections)&&function(t,e){let i=t.state.facet(pi);return i.length?i[0](e):(De.mac,e.altKey)}(t,e),this.dragMove=function(t,e){let i=t.state.facet(Oi);return i.length?i[0](e):De.mac?!e.altKey:!e.ctrlKey}(t,e),this.dragging=!(!function(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let n=ie(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!=Yn(e))&&null}start(t){!1===this.dragging&&(t.preventDefault(),this.select(t))}move(t){var e;if(0==t.buttons)return this.destroy();if(!1!==this.dragging)return;this.select(this.lastEvent=t);let i=0,n=0,s=(null===(e=this.scrollParent)||void 0===e?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight};t.clientX<=s.left+6?i=-Qn(s.left-t.clientX):t.clientX>=s.right-6&&(i=Qn(t.clientX-s.right)),t.clientY<=s.top+6?n=-Qn(s.top-t.clientY):t.clientY>=s.bottom-6&&(n=Qn(t.clientY-s.bottom)),this.setScrollSpeed(i,n)}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)}select(t){let e=this.style.get(t,this.extend,this.multiple);!this.mustSelect&&e.eq(this.view.state.selection)&&e.main.assoc==this.view.state.selection.main.assoc||this.view.dispatch({selection:e,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.docChanged&&this.dragging&&(this.dragging=this.dragging.map(t.changes)),this.style.update(t)&&setTimeout((()=>this.select(this.lastEvent)),20)}}function Pn(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=Se.get(n))&&i.ignoreEvent(e))return!1;return!0}const Cn=Object.create(null),_n=Object.create(null),Xn=De.ie&&De.ie_version<15||De.ios&&De.webkit_version<604;function Zn(t,e){let i,{state:n}=t,s=1,r=n.toText(e),o=r.lines==n.selection.ranges.length;if(null!=Ln&&n.selection.ranges.every((t=>t.empty))&&Ln==r.toString()){let t=-1;i=n.changeByRange((i=>{let a=n.doc.lineAt(i.from);if(a.from==t)return{range:i};t=a.from;let l=n.toText((o?r.line(s++).text:e)+n.lineBreak);return{changes:{from:a.from,insert:l},range:A.cursor(i.from+l.length)}}))}else i=o?n.changeByRange((t=>{let e=r.line(s++);return{changes:{from:t.from,to:t.to,insert:e.text},range:A.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 A.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 A.cursor(e);0==r?i=1:r==s.length&&(i=-1);let o=r,a=r;i<0?o=f(s.text,r,!1):a=f(s.text,r);let l=n(s.text.slice(o,a));for(;o>0;){let t=f(s.text,o,!1);if(n(s.text.slice(t,o))!=l)break;o=t}for(;a{t.inputState.setSelectionOrigin("select"),27==e.keyCode&&(t.inputState.lastEscPress=Date.now())},Cn.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},Cn.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},_n.touchstart=_n.touchmove={passive:!0},Cn.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return;let i=null;for(let n of t.state.facet(gi))if(i=n(t,e),i)break;if(i||0!=e.button||(i=function(t,e){let i=Vn(t,e),n=Yn(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 a,l=Vn(t,e),h=An(t,l.pos,l.bias,n);if(i.pos!=l.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&&(a=function(t,e){for(let i=0;i=e)return A.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,l.pos))?a:o?s.addRange(h):A.create([h])}}}(t,e)),i){let n=t.root.activeElement!=t.contentDOM;t.inputState.startMouseSelection(new $n(t,e,i,n)),n&&t.observer.ignore((()=>ge(t.contentDOM))),t.inputState.mouseSelection&&t.inputState.mouseSelection.start(e)}};let Tn=(t,e)=>t>=e.top&&t<=e.bottom,Rn=(t,e,i)=>Tn(e,i)&&t>=i.left&&t<=i.right;function En(t,e,i,n){let s=hi.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&&Rn(i,n,o))return-1;let a=s.coordsAt(r,1);return a&&Rn(i,n,a)?1:o&&Tn(n,o)?-1:1}function Vn(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:En(t,i,e.clientX,e.clientY)}}const Mn=De.ie&&De.ie_version<=11;let Dn=null,Wn=0,Un=0;function Yn(t){if(!Mn)return t.detail;let e=Dn,i=Un;return Dn=t,Un=Date.now(),Wn=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Wn+1)%3:1}function qn(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&&r.dragMove?{from:r.dragging.from,to:r.dragging.to}:null,a={from:s,insert:i},l=t.state.changes(o?[o,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(s,-1),head:l.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"})}Cn.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")},Cn.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&&qn(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 qn(t,e,e.dataTransfer.getData("Text"),!0)},Cn.paste=(t,e)=>{if(t.state.readOnly)return e.preventDefault();t.observer.flush();let i=Xn?null:e.clipboardData;i?(Zn(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(),Zn(t,i.value)}),50)}(t)};let Ln=null;Cn.copy=Cn.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;Ln=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 zn=lt.define();function In(t,e){let i=[];for(let n of t.facet(vi)){let s=n(t,e);s&&i.push(s)}return i?t.update({effects:i,annotations:zn.of(!0)}):null}function Bn(t){setTimeout((()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=In(t.state,e);i?t.dispatch(i):t.update([])}}),10)}Cn.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),Bn(t)},Cn.blur=t=>{t.observer.clearSelectionRange(),Bn(t)},Cn.compositionstart=Cn.compositionupdate=t=>{null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},Cn.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,De.chrome&&De.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then((()=>t.observer.flush())):setTimeout((()=>{t.inputState.composing<0&&t.docView.compositionDeco.size&&t.update([])}),50)},Cn.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},Cn.beforeinput=(t,e)=>{var i;let n;if(De.chrome&&De.android&&(n=Sn.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 jn=["pre-wrap","normal","pre-line","break-spaces"];class Nn{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){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return jn.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i-1,a=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,a){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)>Jn&&(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:a,toA:l,fromB:h,toB:c}=n[o],u=s.lineAt(a,Hn.ByPosNoHeight,i.setDoc(e),0,0),d=u.to>=l?u:s.lineAt(l,Hn.ByPosNoHeight,i,0,0);for(c+=d.to-l,l=d.to;o>0&&u.from<=n[o-1].toA;)a=n[o-1].fromA,h=n[o-1].fromB,o--,a2*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 es extends ts{constructor(t,e){super(t,e,ii.Text),this.collapsed=0,this.widgetHeight=0}replace(t,e,i){let n=i[0];return 1==i.length&&(n instanceof es||n instanceof is&&4&n.flags)&&Math.abs(this.length-n.length)<10?(n instanceof is?n=new es(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.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class is 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:a}=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),l=o+r.length*a,h=Math.max(i,t-l/2);return new Fn(r.from,r.length,h,l,ii.Text)}{let n=Math.max(0,Math.min(r-s,Math.floor((t-i)/o))),{from:a,length:l}=e.doc.line(s+n);return new Fn(a,l,i+o*n,o,ii.Text)}}lineAt(t,e,i,n,s){if(e==Hn.ByHeight)return this.blockAt(t,i,n,s);if(e==Hn.ByPosNoHeight){let{from:e,to:n}=i.doc.lineAt(t);return new Fn(e,n-e,0,0,ii.Text)}let{firstLine:r,perLine:o,perChar:a}=this.heightMetrics(i,s),l=i.doc.lineAt(t),h=o+l.length*a,c=l.number-r,u=n+o*c+a*(l.from-s-c);return new Fn(l.from,l.length,Math.max(n,Math.min(u,n+this.height-h)),h,ii.Text)}forEachLine(t,e,i,n,s,r){t=Math.max(t,s),e=Math.min(e,s+this.length);let{firstLine:o,perLine:a,perChar:l}=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+=a*i+l*(t-s-i)}let n=a+l*e.length;r(new Fn(e.from,e.length,c,n,ii.Text)),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 is?i[i.length-1]=new is(t.length+n):i.push(null,new is(n-1))}if(t>0){let e=i[0];e instanceof is?i[0]=new is(t+e.length):i.unshift(new is(t-1),null)}return Kn.of(i)}decomposeLeft(t,e){e.push(new is(t-1),null)}decomposeRight(t,e){e.push(null,new is(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 is(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)>=Jn&&(o=-2);let a=new es(e,s);a.outdated=!1,i.push(a),r+=e+1}r<=s&&i.push(null,new is(s-r).updateHeight(t,r));let a=Kn.of(i);return(o<0||Math.abs(a.height-this.height)>=Jn||Math.abs(o-this.heightMetrics(t,e).perLine)>=Jn)&&(t.heightChanged=!0),a}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class ns 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 l;let h=e==Hn.ByPosNoHeight?Hn.ByPosNoHeight:Hn.ByPos;return a?l.join(this.right.lineAt(o,h,i,r,o)):this.left.lineAt(o,h,i,n,s).join(l)}forEachLine(t,e,i,n,s,r){let o=n+this.left.height,a=s+this.left.length+this.break;if(this.break)t=a&&this.right.forEachLine(t,e,i,o,a,r);else{let l=this.lineAt(a,Hn.ByPos,i,n,s);t=t&&l.from<=e&&r(l),e>l.to&&this.right.forEachLine(l.to+1,e,i,o,a,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&&ss(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,a=null;return n&&n.from<=e+s.length&&n.more?a=s=s.updateHeight(t,e,i,n):s.updateHeight(t,e,i),n&&n.from<=o+r.length&&n.more?a=r=r.updateHeight(t,o,i,n):r.updateHeight(t,o,i),a?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 ss(t,e){let i,n;null==t[e]&&(i=t[e-1])instanceof is&&(n=t[e+1])instanceof is&&t.splice(e-1,3,new is(i.length+1+n.length))}class rs{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 es?i.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new es(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)}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 es(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let i=new is(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 es)return t;let e=new es(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine(),t.type!=ii.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,t.type!=ii.WidgetBefore&&(this.covering=t)}addLineDeco(t,e){let i=this.ensureLine();i.length+=e,i.collapsed+=e,i.widgetHeight=Math.max(i.widgetHeight,t),this.writtenTo=this.pos=this.pos+e}finish(t){let e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof es||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),a=Math.max(a,n.top),l=e==t.parentNode?n.bottom:Math.min(l,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:a-(i.top+e),bottom:Math.max(a,l)-(i.top+e)}}function ls(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class hs{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 Nn(i),this.stateDeco=e.facet(Ti).filter((t=>"function"!=typeof t)),this.heightMap=Kn.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle.setDoc(e.doc),[new Mi(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ni.set(this.lineGaps.map((t=>t.draw(!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 ds(e,i))}}this.viewports=t.sort(((t,e)=>t.from-e.from)),this.scaler=this.heightMap.height<=7e6?gs:new ms(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:bs(t,this.scaler))}))}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=this.state.facet(Ti).filter((t=>"function"!=typeof t));let n=t.changedRanges,s=Mi.extendWithRanges(n,function(t,e,i){let n=new os;return _t.compare(t,e,i,n,0),n.changes}(i,this.stateDeco,t?t.changes:k.empty(this.state.doc.length))),r=this.heightMap.height;this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),s),this.heightMap.height!=r&&(t.flags|=2);let o=s.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.heado.to)||!this.viewportIsAppropriate(o))&&(o=this.getViewport(0,e));let a=!t.changes.empty||2&t.flags||o.from!=this.viewport.from||o.to!=this.viewport.to;this.viewport=o,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(Si)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let i=e.contentDOM,n=window.getComputedStyle(i),s=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Wi.RTL:Wi.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),a=i.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let h=0,c=0,u=parseInt(n.paddingTop)||0,d=parseInt(n.paddingBottom)||0;this.paddingTop==u&&this.paddingBottom==d||(this.paddingTop=u,this.paddingBottom=d,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let f=(this.printing?ls:as)(i,this.paddingTop),p=f.top-this.pixelViewport.top,O=f.bottom-this.pixelViewport.bottom;this.pixelViewport=f;let g=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(g!=this.inView&&(this.inView=g,g&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let m=a.width;if(this.contentDOMWidth==m&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,h|=8),l){let i=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(i)&&(o=!0),o||s.lineWrapping&&Math.abs(m-this.contentDOMWidth)>s.charWidth){let{lineHeight:t,charWidth:n,textHeight:a}=e.docView.measureTextSize();o=t>0&&s.refresh(r,t,n,a,m/n,i),o&&(e.docView.minWidth=0,h|=8)}p>0&&O>0?c=Math.max(p,O):p<0&&O<0&&(c=Math.min(p,O)),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 Mi(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new Gn(n.from,r))}s.heightChanged&&(h|=2)}let b=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return b&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(2&h||b)&&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,a=new ds(n.lineAt(r-1e3*i,Hn.ByHeight,s,0,0).from,n.lineAt(o+1e3*(1-i),Hn.ByHeight,s,0,0).to);if(e){let{head:t}=e.range;if(ta.to){let i,r=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=n.lineAt(t,Hn.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!=Wi.LTR&&!i)return[];let o=[],a=(n,r,l,h)=>{if(r-nn&&tt.from>=l.from&&t.to<=l.to&&Math.abs(t.from-n)t.frome))));if(!d){if(rt.from<=r&&t.to>=r))){let t=e.moveToLineBoundary(A.cursor(r),!1,!0).head;t>n&&(r=t)}d=new hs(n,r,this.gapSize(l,n,r,h))}o.push(d)};for(let t of this.viewportLines){if(t.lengtht.from&&a(t.from,s,t,e),ot.draw(this.heightOracle.lineWrapping)))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];_t.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))||bs(this.heightMap.lineAt(t,Hn.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return bs(this.heightMap.lineAt(this.scaler.fromDOM(t),Hn.ByHeight,this.heightOracle,0,0),this.scaler)}elementAtHeight(t){return bs(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 ds{constructor(t,e){this.from=t,this.to=e}}function fs(t,e,i){let n=[],s=t,r=0;return _t.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 Os(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 gs={toDOM:t=>t,fromDOM:t=>t,scale:1};class ms{constructor(t,e,i){let n=0,s=0,r=0;this.viewports=i.map((({from:i,to:s})=>{let r=e.lineAt(i,Hn.ByPos,t,0,0).top,o=e.lineAt(s,Hn.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=ebs(t,e))):t.type)}const ws=E.define({combine:t=>t.join(" ")}),vs=E.define({combine:t=>t.indexOf(!0)>-1}),ys=It.newName(),Ss=It.newName(),xs=It.newName(),ks={"&light":"."+Ss,"&dark":"."+xs};function Qs(t,e,i){return new It(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 $s=Qs("."+ys,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",borderRadius:"4px",marginTop:"0.5rem",width:"30%",minWidth:"190px",marginLeft:"auto",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&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:"#333338",fontSize:"70%",padding:".2em 1em",borderRadius:"4px"},"&light .cm-button":{background:"#eee"},"&dark .cm-button":{background:"#eee"},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",borderRadius:"0.25rem",border:"1px solid silver",padding:".0em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},ks);class Ps{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;i&&(e.push(new nn(i,n)),s==i&&r==n||e.push(new nn(s,r)));return e}(t),i=new tn(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?A.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||!ne(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||!ne(t.contentDOM,e.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(e.anchorNode,e.anchorOffset);this.newSel=A.single(n,i)}}}function Cs(e,i){let n,{newSel:s}=i,r=e.state.selection.main;if(i.bounds){let{from:s,to:o}=i.bounds,a=r.from,l=null;(8===e.inputState.lastKeyCode&&e.inputState.lastKeyTime>Date.now()-100||De.android&&i.text.length0&&a>0&&t.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if("end"==n){i-=o+Math.max(0,r-Math.min(o,a))-r}if(o=o?r-i:0,a=r+(a-o),o=r}else if(a=a?r-i:0,o=r+(o-a),a=r}return{from:r,toA:o,toB:a}}(e.state.doc.sliceString(s,o,Ki),i.text,a-s,l);h&&(De.chrome&&13==e.inputState.lastKeyCode&&h.toB==h.from+2&&i.text.slice(h.from,h.toB)==Ki+Ki&&h.toB--,n={from:s+h.from,to:s+h.toA,insert:t.of(i.text.slice(h.from,h.toB).split(Ki))})}else s&&(!e.hasFocus&&e.state.facet($i)||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))}:(De.mac||De.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=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}):De.chrome&&n&&n.from==n.to&&n.from==r.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(s&&(s=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}),n){let t=e.state;if(De.ios&&e.inputState.flushIOSKey(e))return!0;if(De.android&&(n.from==r.from&&n.to==r.to&&1==n.insert.length&&2==n.insert.lines&&be(e.contentDOM,"Enter",13)||n.from==r.from-1&&n.to==r.to&&0==n.insert.length&&be(e.contentDOM,"Backspace",8)||n.from==r.from&&n.to==r.to+1&&0==n.insert.length&&be(e.contentDOM,"Delete",46)))return!0;let i,o=n.insert.toString();if(e.state.facet(wi).some((t=>t(e,n.from,n.to,o))))return!0;if(e.inputState.composing>=0&&e.inputState.composing++,n.from>=r.from&&n.to<=r.to&&n.to-n.from>=(r.to-r.from)/3&&(!s||s.main.empty&&s.main.from==n.from+n.insert.length)&&e.inputState.composing<0){let s=r.fromn.to?t.sliceDoc(n.to,r.to):"";i=t.replaceSelection(e.state.toText(s+n.insert.sliceString(0,void 0,e.state.lineBreak)+o))}else{let o=t.changes(n),a=s&&s.main.to<=o.newLength?s.main:void 0;if(t.selection.ranges.length>1&&e.inputState.composing>=0&&n.to<=r.to&&n.to>=r.to-10){let s=e.state.sliceDoc(n.from,n.to),l=on(e)||e.state.doc.lineAt(r.head),h=r.to-n.to,c=r.to-r.from;i=t.changeByRange((i=>{if(i.from==r.from&&i.to==r.to)return{changes:o,range:a||i.map(o)};let u=i.to-h,d=u-s.length;if(i.to-i.from!=c||e.state.sliceDoc(d,u)!=s||l&&i.to>=l.from&&i.from<=l.to)return{range:i};let f=t.changes({from:d,to:u,insert:n.insert}),p=i.to-r.to;return{changes:f,range:a?A.range(Math.max(0,a.anchor+p),Math.max(0,a.head+p)):i.map(f)}}))}else i={changes:o,selection:a&&t.selection.replaceRange(a)}}let a="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,a+=".compose",e.inputState.compositionFirstChange&&(a+=".start",e.inputState.compositionFirstChange=!1)),e.dispatch(i,{scrollIntoView:!0,userEvent:a}),!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 _s={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Xs=De.ie&&De.ie_version<=11;class Zs{constructor(t){this.view=t,this.active=!1,this.selectionRange=new fe,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);(De.ie&&De.ie_version<=11||De.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()})),Xs&&(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")))}),{}),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($i)?i.root.activeElement!=this.dom:!se(i.dom,n))return;let s=n.anchorNode&&i.docView.nearest(n.anchorNode);s&&s.ignoreEvent(t)?e||(this.selectionChanged=!1):(De.ie&&De.ie_version<=11||De.android&&De.chrome)&&!i.state.selection.main.empty&&n.focusNode&&oe(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=De.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,a=t.docView.domAtPos(t.state.selection.main.anchor);oe(a.node,a.offset,r,o)&&([n,s,r,o]=[r,o,n,s]);return{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:o}}(this.view)||ie(t.root);if(!e||this.selectionRange.eq(e))return!1;let i=se(this.dom,e);return i&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let t=this.delayedAndroidKey;t&&(this.clearDelayedAndroidKey(),!this.flush()&&t.force&&be(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&&se(this.dom,this.selectionRange);return t<0&&!n?null:(t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new Ps(this.view,t,e,i))}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=Cs(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.dirty|=4),"childList"==t.type){let i=As(e,t.previousSibling||t.target.previousSibling,-1),n=As(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 As(t,e,i){for(;e;){let n=Se.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 Ts{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),this._dispatch=t.dispatch||(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 us(t.state||xt.create(t)),this.plugins=this.state.facet(Ci).map((t=>new Xi(t)));for(let t of this.plugins)t.update(this);this.observer=new Zs(this),this.inputState=new yn(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new sn(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),t.parent&&t.parent.appendChild(this.dom)}get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}dispatch(...t){this._dispatch(1==t.length&&t[0]instanceof dt?t[0]:this.state.update(...t))}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,a=null;t.some((t=>t.annotation(zn)))?(this.inputState.notifiedFocused=r,o=1):r!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=r,a=In(s,r),a||(o=1));let l=this.observer.delayedAndroidKey,h=null;if(l?(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(xt.phrases)!=this.state.facet(xt.phrases))return this.setState(s);e=Di.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 xi(t.empty?t:A.cursor(t.head,t.head>t.anchor?-1:1))}for(let t of e.effects)t.is(ki)&&(c=t.value)}this.viewState.update(e,c),this.bidiCache=Vs.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),i=this.docView.update(e),this.state.facet(Vi)!=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(ws)!=e.state.facet(ws)&&(this.viewState.mustMeasureContent=!0),(i||n||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!e.empty)for(let t of this.state.facet(bi))t(e);(a||h)&&Promise.resolve().then((()=>{a&&this.state==a.startState&&this.dispatch(a),h&&!Cs(this,h)&&l.force&&be(this.contentDOM,l.key,l.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 us(t),this.plugins=t.facet(Ci).map((t=>new Xi(t))),this.pluginMap.clear();for(let t of this.plugins)t.update(this);this.docView=new sn(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(Ci),i=t.state.facet(Ci);if(e!=i){let n=[];for(let s of i){let i=e.indexOf(s);if(i<0)n.push(new Xi(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.measureScheduled=0,t&&this.observer.forceFlush();let e=null,{scrollHeight:i,scrollTop:n,clientHeight:s}=this.scrollDOM,r=n>i-s-4?i:n;try{for(let t=0;;t++){this.updateState=1;let i=this.viewport,n=this.viewState.lineBlockAtHeight(r),s=this.viewState.measure(this);if(!s&&!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 o=[];4&s||([this.measureRequests,o]=[o,this.measureRequests]);let a=o.map((t=>{try{return t.read(this)}catch(t){return Qi(this.state,t),Es}})),l=Di.create(this,this.state,[]),h=!1,c=!1;l.flags|=s,e?e.flags|=s:e=l,this.updateState=2,l.empty||(this.updatePlugins(l),this.inputState.update(l),this.updateAttrs(),h=this.docView.update(l));for(let t=0;t1||t<-1)&&(this.scrollDOM.scrollTop+=t,c=!0)}if(h&&this.docView.updateSelection(!0),this.viewport.from==i.from&&this.viewport.to==i.to&&!c&&0==this.measureRequests.length)break}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let t of this.state.facet(bi))t(e)}get themeClasses(){return ys+" "+(this.state.facet(vs)?xs:Ss)+" "+this.state.facet(ws)}updateAttrs(){let t=Ms(this,Zi,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet($i)?"true":"false",class:"cm-content",style:`${De.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Ms(this,Ai,e);let i=this.observer.ignore((()=>{let i=ti(this.contentDOM,this.contentAttrs,e),n=ti(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)if(t.is(Ts.announce)){e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(Vi),It.mount(this.root,this.styleModules.concat($s).reverse())}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}}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 vn(this,t,wn(this,t,e,i))}moveByCharSelected(t,e,i){return vn(this,t,wn(this,t,e,i),!0)}moveByGroup(t,e){return vn(this,t,wn(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==wt.Space&&(s=e),s==e}}(this,t.head,e))))}moveToLineBoundary(t,e,i=!0){return function(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=n&&t.lineWrapping?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==Wi.LTR)?e.right-1:e.left+1,y:(r.top+r.bottom)/2});if(null!=o)return A.cursor(o,i?-1:1)}let o=hi.find(t.docView,e.head),a=o?i?o.posAtEnd:o.posAtStart:i?s.to:s.from;return A.cursor(a,i?-1:1)}(this,t,e,i)}moveVertically(t,e,i){return vn(this,t,function(t,e,i,n){let s=e.head,r=i?1:-1;if(s==(i?t.state.doc.length:0))return A.cursor(s,e.assoc);let o,a=e.goalColumn,l=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s),c=t.documentTop;if(h)null==a&&(a=h.left-l.left),o=r<0?h.top:h.bottom;else{let e=t.viewState.lineBlockAt(s);null==a&&(a=Math.min(l.right-l.left,t.defaultCharacterWidth*(s-e.from))),o=(r<0?e.top:e.bottom)+c}let u=l.left+a,d=null!=n?n:t.defaultLineHeight>>1;for(let i=0;;i+=10){let n=o+(d+i)*r,h=mn(t,{x:u,y:n},!1,r);if(nl.bottom||(r<0?hs))return A.cursor(h,e.assoc,void 0,a)}}(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(),mn(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 ue(i,s[Ni.find(s,t-n.from,-1,e)].dir==Wi.LTR==e>0)}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(yi)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Rs)return Fi(t.length);let e=this.textDirectionAt(t.from);for(let i of this.bidiCache)if(i.from==t.from&&i.dir==e)return i.order;let i=function(t,e){let i=t.length,n=e==Ui?1:2,s=e==Ui?2:1;if(!t||1==n&&!ji.test(t))return Fi(i);for(let e=0,s=n,o=n;e=0;t-=3)if(Bi[t+1]==-r){let e=Bi[t+2],i=2&e?n:4&e?1&e?s:n:0;i&&(Gi[a]=Gi[Bi[t]]=i),l=t;break}}else{if(189==Bi.length)break;Bi[l++]=a,Bi[l++]=e,Bi[l++]=h}else if(2==(o=Gi[a])||1==o){let t=o==n;h=t?0:1;for(let e=l-3;e>=0;e-=3){let i=Bi[e+2];if(2&i)break;if(t)Bi[e+2]|=2;else{if(4&i)break;Bi[e+2]|=4}}}for(let t=0;te;){let t=i,n=2!=Gi[--i];for(;i>e&&n==(2!=Gi[i-1]);)i--;o.push(new Ni(i,t,n?2:1))}else o.push(new Ni(e,t,0))}else for(let t=0;tDate.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{ge(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 ki.of(new xi("number"==typeof t?A.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}static domEventHandlers(t){return _i.define((()=>({})),{eventHandlers:t})}static theme(t,e){let i=It.newName(),n=[ws.of(i),Vi.of(Qs(`.${i}`,t))];return e&&e.dark&&n.push(vs.of(!0)),n}static baseTheme(t){return N.lowest(Vi.of(Qs("."+ys,t,ks)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),n=i&&Se.get(i)||Se.get(t);return(null===(e=null==n?void 0:n.rootView)||void 0===e?void 0:e.view)||null}}Ts.styleModule=Vi,Ts.inputHandler=wi,Ts.focusChangeEffect=vi,Ts.perLineTextDirection=yi,Ts.exceptionSink=mi,Ts.updateListener=bi,Ts.editable=$i,Ts.mouseSelectionStyle=gi,Ts.dragMovesSelection=Oi,Ts.clickAddsSelectionRange=pi,Ts.decorations=Ti,Ts.atomicRanges=Ri,Ts.scrollMargins=Ei,Ts.darkTheme=vs,Ts.contentAttributes=Ai,Ts.editorAttributes=Zi,Ts.lineWrapping=Ts.contentAttributes.of({class:"cm-lineWrapping"}),Ts.announce=ut.define();const Rs=4096,Es={};class Vs{constructor(t,e,i,n){this.from=t,this.to=e,this.dir=i,this.order=n}static update(t,e){if(e.empty)return t;let i=[],n=t.length?t[t.length-1].dir:Wi.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&&Je(r,i)}return i}const Ds=De.mac?"mac":De.windows?"win":De.linux?"linux":"key";function Ws(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 Us=N.default(Ts.domEventHandlers({keydown:(t,e)=>Bs(Ls(e.state),t,e,"editor")})),Ys=E.define({enables:Us}),qs=new WeakMap;function Ls(t){let e=t.facet(Ys),i=qs.get(e);return i||qs.set(e,i=function(t,e=Ds){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)=>{var a,l;let h=i[t]||(i[t]=Object.create(null)),c=n.split(/ (?!$)/).map((t=>function(t,e){const i=t.split(/-(?!$)/);let n,s,r,o,a=i[i.length-1];"Space"==a&&(a=" ");for(let t=0;t{let n=zs={view:e,prefix:i,scope:t};return setTimeout((()=>{zs==n&&(zs=null)}),Is),!0}]})}let u=c.join(" ");s(u,!1);let d=h[u]||(h[u]={preventDefault:!1,run:(null===(l=null===(a=h._any)||void 0===a?void 0:a.run)||void 0===l?void 0:l.slice())||[]});r&&d.run.push(r),o&&(d.preventDefault=!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,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.shift&&r(e,"Shift-"+s,n.shift,n.preventDefault)}return i}(e.reduce(((t,e)=>t.concat(e)),[]))),i}let zs=null;const Is=4e3;function Bs(t,e,i,n){let s=function(t){var e=!(Kt&&(t.ctrlKey||t.altKey||t.metaKey)||Jt&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?Gt:Nt)[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=v(b(s,0))==s.length&&" "!=s,o="",a=!1;zs&&zs.view==i&&zs.scope==n&&(o=zs.prefix+" ",(a=kn.indexOf(e.keyCode)<0)&&(zs=null));let l,h,c=new Set,u=t=>{if(t){for(let n of t.run)if(!c.has(n)&&(c.add(n),n(i,e)))return!0;t.preventDefault&&(a=!0)}return!1},d=t[n];if(d){if(u(d[o+Ws(s,e,!r)]))return!0;if(r&&(e.altKey||e.metaKey||e.ctrlKey)&&!(De.windows&&e.ctrlKey&&e.altKey)&&(l=Nt[e.keyCode])&&l!=s){if(u(d[o+Ws(l,e,!0)]))return!0;if(e.shiftKey&&(h=Gt[e.keyCode])!=s&&h!=l&&u(d[o+Ws(h,e,!1)]))return!0}else if(r&&e.shiftKey&&u(d[o+Ws(s,e,!0)]))return!0;if(u(d._any))return!0}return a}class js{constructor(t,e,i,n,s){this.className=t,this.left=e,this.top=i,this.width=n,this.height=s}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className==this.className&&(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",null!=this.width&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,i){if(i.empty){let n=t.coordsAtPos(i.head,i.assoc||1);if(!n)return[];let s=Ns(t);return[new js(e,n.left-s.left,n.top-s.top,null,n.bottom-n.top)]}return function(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];let n=Math.max(i.from,t.viewport.from),s=Math.min(i.to,t.viewport.to),r=t.textDirection==Wi.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=Ns(t),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),u=a.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),d=a.right-(c?parseInt(c.paddingRight):0),f=Fs(t,n),p=Fs(t,s),O=f.type==ii.Text?f:null,g=p.type==ii.Text?p:null;t.lineWrapping&&(O&&(O=Gs(t,n,O)),g&&(g=Gs(t,s,g)));if(O&&g&&O.from==g.from)return b(w(i.from,i.to,O));{let e=O?w(i.from,null,O):v(f,!1),n=g?w(null,i.to,g):v(p,!0),s=[];return(O||f).to<(g||p).from-1?s.push(m(u,e.bottom,d,n.top)):e.bottomh&&n.from=r)break;a>s&&l(Math.max(t,s),null==e&&t<=h,Math.min(a,r),null==i&&a>=c,o.dir)}if(s=n.to+1,s>=r)break}return 0==a.length&&l(h,null==e,c,null==i,t.textDirection),{top:s,bottom:o,horizontal:a}}function v(t,e){let i=a.top+(e?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]}}}(t,e,i)}}function Ns(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Wi.LTR?e.left:e.right-t.scrollDOM.clientWidth)-t.scrollDOM.scrollLeft,top:e.top-t.scrollDOM.scrollTop}}function Gs(t,e,i){let n=A.cursor(e);return{from:Math.max(i.from,t.moveToLineBoundary(n,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(n,!0,!0).from),type:ii.Text}}function Fs(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==ii.Text))return t;return i}class Hs{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),e.above&&this.dom.classList.add("cm-layer-above"),e.class&&this.dom.classList.add(e.class),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(Js)!=t.state.facet(Js)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&t.view.requestMeasure(this.measureReq)}setOrder(t){let e=0,i=t.facet(Js);for(;e{return i=t,n=this.drawn[e],!(i.constructor==n.constructor&&i.eq(n));var i,n}))){let e=this.dom.firstChild,i=0;for(let n of t)n.update&&e&&n.constructor&&this.drawn[i].constructor&&n.update(e,this.drawn[i])?(e=e.nextSibling,i++):this.dom.insertBefore(n.draw(),e);for(;e;){let t=e.nextSibling;e.remove(),e=t}this.drawn=t}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Js=E.define();function Ks(t){return[_i.define((e=>new Hs(e,t))),Js.of(t)]}const tr=!De.ios,er=E.define({combine:t=>kt(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})});function ir(t={}){return[er.of(t),sr,or,lr,Si.of(!0)]}function nr(t){return t.startState.facet(er)!=t.state.facet(er)}const sr=Ks({above:!0,markers(t){let{state:e}=t,i=e.facet(er),n=[];for(let s of e.selection.ranges){let r=s==e.selection.main;if(s.empty?!r||tr:i.drawRangeCursor){let e=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",i=s.empty?s:A.cursor(s.head,s.head>s.anchor?-1:1);for(let s of js.forRange(t,e,i))n.push(s)}}return n},update(t,e){t.transactions.some((t=>t.selection))&&(e.style.animationName="cm-blink"==e.style.animationName?"cm-blink2":"cm-blink");let i=nr(t);return i&&rr(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){rr(e.state,t)},class:"cm-cursorLayer"});function rr(t,e){e.style.animationDuration=t.facet(er).cursorBlinkRate+"ms"}const or=Ks({above:!1,markers:t=>t.state.selection.ranges.map((e=>e.empty?[]:js.forRange(t,"cm-selectionBackground",e))).reduce(((t,e)=>t.concat(e))),update:(t,e)=>t.docChanged||t.selectionSet||t.viewportChanged||nr(t),class:"cm-selectionLayer"}),ar={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};tr&&(ar[".cm-line"].caretColor="transparent !important");const lr=N.highest(Ts.theme(ar)),hr=ut.define({map:(t,e)=>null==t?null:e.mapPos(t)}),cr=q.define({create:()=>null,update:(t,e)=>(null!=t&&(t=e.changes.mapPos(t)),e.effects.reduce(((t,e)=>e.is(hr)?e.value:t),t))}),ur=_i.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let i=t.state.field(cr);null==i?null!=this.cursor&&(null===(e=this.cursor)||void 0===e||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(cr)!=i||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let t=this.view.state.field(cr),e=null!=t&&this.view.coordsAtPos(t);if(!e)return null;let i=this.view.scrollDOM.getBoundingClientRect();return{left:e.left-i.left+this.view.scrollDOM.scrollLeft,top:e.top-i.top+this.view.scrollDOM.scrollTop,height:e.bottom-e.top}}drawCursor(t){this.cursor&&(t?(this.cursor.style.left=t.left+"px",this.cursor.style.top=t.top+"px",this.cursor.style.height=t.height+"px"):this.cursor.style.left="-100000px")}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(cr)!=t&&this.view.dispatch({effects:hr.of(t)})}},{eventHandlers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){t.target!=this.view.contentDOM&&this.view.contentDOM.contains(t.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function dr(){return[cr,ur]}function fr(t,e,i,n,s){e.lastIndex=0;for(let r,o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)if(!o.lineBreak)for(;r=e.exec(o.value);)s(a+r.index,r)}class pr{constructor(t){const{regexp:e,decoration:i,decorate:n,boundary:s,maxLength:r=1e3}=t;if(!e.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=e,n)this.addMatch=(t,e,i,s)=>n(s,i,i+t[0].length,t,e);else if("function"==typeof i)this.addMatch=(t,e,n,s)=>{let r=i(t,e,n);r&&s(n,n+t[0].length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(t,e,n,s)=>s(n,n+t[0].length,i)}this.boundary=s,this.maxLength=r}createDeco(t){let e=new Xt,i=e.add.bind(e);for(let{from:e,to:n}of function(t,e){let i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;let n=[];for(let{from:s,to:r}of i)s=Math.max(t.state.doc.lineAt(s).from,s-e),r=Math.min(t.state.doc.lineAt(r).to,r+e),n.length&&n[n.length-1].to>=s?n[n.length-1].to=r:n.push({from:s,to:r});return n}(t,this.maxLength))fr(t.state.doc,this.regexp,e,n,((e,n)=>this.addMatch(n,t,e,i)));return e.finish()}updateDeco(t,e){let i=1e9,n=-1;return t.docChanged&&t.changes.iterChanges(((e,s,r,o)=>{o>t.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e}updateRange(t,e,i,n){for(let s of t.visibleRanges){let r=Math.max(s.from,i),o=Math.min(s.to,n);if(o>r){let i=t.state.doc.lineAt(r),n=i.toi.from;r--)if(this.boundary.test(i.text[r-1-i.from])){a=r;break}for(;oc.push(i.range(t,e));if(i==n)for(this.regexp.lastIndex=a-i.from;(h=this.regexp.exec(i.text))&&h.indexthis.addMatch(i,t,e,u)));e=e.update({filterFrom:a,filterTo:l,filter:(t,e)=>tl,add:c})}}return e}}const Or=null!=/x/.unicode?"gu":"g",gr=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",Or),mr={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let br=null;const wr=E.define({combine(t){let e=kt(t,{render:null,specialChars:gr,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==br&&"undefined"!=typeof document&&document.body){let e=document.body.style;br=null!=(null!==(t=e.tabSize)&&void 0!==t?t:e.MozTabSize)}return br||!1}())&&(e.specialChars=new RegExp("\t|"+e.specialChars.source,Or)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Or)),e}});function vr(t={}){return[wr.of(t),yr||(yr=_i.fromClass(class{constructor(t){this.view=t,this.decorations=ni.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(wr)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new pr({regexp:t.specialChars,decoration:(e,i,n)=>{let{doc:s}=i.state,r=b(e[0],0);if(9==r){let t=s.lineAt(n),e=i.state.tabSize,r=Yt(t.text,e,n-t.from);return ni.replace({widget:new xr((e-r%e)*this.view.defaultCharacterWidth)})}return this.decorationCache[r]||(this.decorationCache[r]=ni.replace({widget:new Sr(t,r)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(wr);t.startState.facet(wr)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))]}let yr=null;class Sr extends ei{constructor(t,e){super(),this.options=t,this.code=e}eq(t){return t.code==this.code}toDOM(t){let e=function(t){return t>=32?"•":10==t?"␤":String.fromCharCode(9216+t)}(this.code),i=t.state.phrase("Control character")+" "+(mr[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,i,e);if(n)return n;let s=document.createElement("span");return s.textContent=e,s.title=i,s.setAttribute("aria-label",i),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class xr extends ei{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent="\t",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}class kr extends ei{constructor(t){super(),this.content=t}toDOM(){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):this.content),"string"==typeof this.content?t.setAttribute("aria-label","placeholder "+this.content):t.setAttribute("aria-hidden","true"),t}ignoreEvent(){return!1}}const Qr="-10000px";class $r{constructor(t,e,i){this.facet=e,this.createTooltipView=i,this.input=t.state.facet(e),this.tooltips=this.input.filter((t=>t)),this.tooltipViews=this.tooltips.map(i)}update(t){var e;let i=t.state.facet(this.facet),n=i.filter((t=>t));if(i===this.input){for(let e of this.tooltipViews)e.update&&e.update(t);return!1}let s=[];for(let e=0;e{var e,i,n;return{position:De.ios?"absolute":(null===(e=t.find((t=>t.position)))||void 0===e?void 0:e.position)||"fixed",parent:(null===(i=t.find((t=>t.parent)))||void 0===i?void 0:i.parent)||null,tooltipSpace:(null===(n=t.find((t=>t.tooltipSpace)))||void 0===n?void 0:n.tooltipSpace)||Pr}}}),_r=new WeakMap,Xr=_i.fromClass(class{constructor(t){this.view=t,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(Cr);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new $r(t,Tr,(t=>this.createTooltip(t))),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout((()=>{this.measureTimeout=-1,this.maybeMeasure()}),50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t);e&&this.observeIntersection();let i=e||t.geometryChanged,n=t.state.facet(Cr);if(n.position!=this.position){this.position=n.position;for(let t of this.manager.tooltipViews)t.dom.style.position=this.position;i=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let t of this.manager.tooltipViews)this.container.appendChild(t.dom);i=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure()}createTooltip(t){let e=t.create(this.view);if(e.dom.classList.add("cm-tooltip"),t.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",e.dom.appendChild(t)}return e.dom.style.position=this.position,e.dom.style.top=Qr,this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var t,e;this.view.win.removeEventListener("resize",this.measureSoon);for(let e of this.manager.tooltipViews)e.dom.remove(),null===(t=e.destroy)||void 0===t||t.call(e);null===(e=this.intersectionObserver)||void 0===e||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=this.view.dom.getBoundingClientRect();return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map(((t,e)=>{let i=this.manager.tooltipViews[e];return i.getCoords?i.getCoords(t.pos):this.view.coordsAtPos(t.pos)})),size:this.manager.tooltipViews.map((({dom:t})=>t.getBoundingClientRect())),space:this.view.state.facet(Cr).tooltipSpace(this.view)}}writeMeasure(t){var e;let{editor:i,space:n}=t,s=[];for(let r=0;r=Math.min(i.bottom,n.bottom)||h.rightMath.min(i.right,n.right)+.1){l.style.top=Qr;continue}let u=o.arrow?a.dom.querySelector(".cm-tooltip-arrow"):null,d=u?7:0,f=c.right-c.left,p=null!==(e=_r.get(a))&&void 0!==e?e:c.bottom-c.top,O=a.offset||Ar,g=this.view.textDirection==Wi.LTR,m=c.width>n.right-n.left?g?n.left:n.right-c.width:g?Math.min(h.left-(u?14:0)+O.x,n.right-f):Math.max(n.left,h.left-f+(u?14:0)-O.x),b=!!o.above;!o.strictSide&&(b?h.top-(c.bottom-c.top)-O.yn.bottom)&&b==n.bottom-h.bottom>h.top-n.top&&(b=!b);let w=(b?h.top-n.top:n.bottom-h.bottom)-d;if(wm&&t.topv&&(v=b?t.top-p-2-d:t.bottom+d+2);"absolute"==this.position?(l.style.top=v-t.parent.top+"px",l.style.left=m-t.parent.left+"px"):(l.style.top=v+"px",l.style.left=m+"px"),u&&(u.style.left=h.left+(g?O.x:-O.x)-(m+14-7)+"px"),!0!==a.overlap&&s.push({left:m,top:v,right:y,bottom:v+p}),l.classList.toggle("cm-tooltip-above",b),l.classList.toggle("cm-tooltip-below",!b),a.positioned&&a.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=Qr}},{eventHandlers:{scroll(){this.maybeMeasure()}}}),Zr=Ts.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Ar={x:0,y:0},Tr=E.define({enables:[Xr,Zr]});function Rr(t,e){let i=t.plugin(Xr);if(!i)return null;let n=i.manager.tooltips.indexOf(e);return n<0?null:i.manager.tooltipViews[n]}const Er=E.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 Vr(t,e){let i=t.plugin(Mr),n=i?i.specs.indexOf(e):-1;return n>-1?i.panels[n]:null}const Mr=_i.fromClass(class{constructor(t){this.input=t.state.facet(Ur),this.specs=this.input.filter((t=>t)),this.panels=this.specs.map((e=>e(t)));let e=t.state.facet(Er);this.top=new Dr(t,!0,e.topContainer),this.bottom=new Dr(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(Er);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Dr(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Dr(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(Ur);if(i!=this.input){let e=i.filter((t=>t)),n=[],s=[],r=[],o=[];for(let i of e){let e,a=this.specs.indexOf(i);a<0?(e=i(t.view),o.push(e)):(e=this.panels[a],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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}}))});class Dr{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=Wr(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=Wr(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 Wr(t){let e=t.nextSibling;return t.remove(),e}const Ur=E.define({enables:Mr});class Yr extends Qt{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Yr.prototype.elementClass="",Yr.prototype.toDOM=void 0,Yr.prototype.mapMode=S.TrackBefore,Yr.prototype.startSide=Yr.prototype.endSide=-1,Yr.prototype.point=!0;const qr=E.define(),Lr={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>_t.empty,lineMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},zr=E.define();function Ir(t){return[jr(),zr.of(Object.assign(Object.assign({},Lr),t))]}const Br=E.define({combine:t=>t.some((t=>t))});function jr(t){let e=[Nr];return t&&!1===t.fixed&&e.push(Br.of(!0)),e}const Nr=_i.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+"px",this.gutters=t.state.facet(zr).map((e=>new Jr(t,e)));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!t.state.facet(Br),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(Br)!=!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=_t.iter(this.view.state.facet(qr),this.view.viewport.from),n=[],s=this.gutters.map((t=>new Hr(t,this.view.viewport,-this.view.documentPadding.top)));for(let t of this.view.viewportLineBlocks){let e;if(Array.isArray(t.type)){for(let i of t.type)if(i.type==ii.Text){e=i;break}}else e=t.type==ii.Text?t:void 0;if(e){n.length&&(n=[]),Fr(i,n,t.from);for(let t of s)t.line(this.view,e,n)}}for(let t of s)t.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(zr),i=t.state.facet(zr),n=t.docChanged||t.heightChanged||t.viewportChanged||!_t.eq(t.startState.facet(qr),t.state.facet(qr),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 Jr(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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&0!=i.gutters.length&&i.fixed?e.textDirection==Wi.LTR?{left:i.dom.offsetWidth}:{right:i.dom.offsetWidth}:null}))});function Gr(t){return Array.isArray(t)?t:[t]}function Fr(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class Hr{constructor(t,e,i){this.gutter=t,this.height=i,this.i=0,this.cursor=_t.iter(t.markers,e.from)}line(t,e,i){let n=[];Fr(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;if(0==n.length&&!r.config.renderEmptyElements)return;let o=e.top-this.height;if(this.i==r.elements.length){let i=new Kr(t,e.height,o,n);r.elements.push(i),r.dom.appendChild(i.dom)}else r.elements[this.i].update(t,e.height,o,n);this.height=e.bottom,this.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 Jr{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=Gr(e.markers(t)),e.initialSpacer&&(this.spacer=new Kr(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=Gr(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!_t.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 Kr{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.dom.style.height=(this.height=e)+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),function(t,e){if(t.length!=e.length)return!1;for(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 io extends Yr{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function no(t,e){return t.state.facet(eo).formatNumber(e,t.state)}const so=zr.compute([eo],(t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:t=>t.state.facet(to),lineMarker:(t,e,i)=>i.some((t=>t.toDOM))?null:new io(no(t,t.state.doc.lineAt(e.from).number)),lineMarkerChange:t=>t.startState.facet(eo)!=t.state.facet(eo),initialSpacer:t=>new io(no(t,ro(t.state.doc.lines))),updateSpacer(t,e){let i=no(e.view,ro(e.view.state.doc.lines));return i==t.number?t:new io(i)},domEventHandlers:t.facet(eo).domEventHandlers})));function ro(t){let e=9;for(;e{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=fo.match(t)),e=>{let i=t(e);return void 0===i?null:[this,i]}}}ho.closedBy=new ho({deserialize:t=>t.split(" ")}),ho.openedBy=new ho({deserialize:t=>t.split(" ")}),ho.group=new ho({deserialize:t=>t.split(" ")}),ho.contextHash=new ho({perNode:!0}),ho.lookAhead=new ho({perNode:!0}),ho.mounted=new ho({perNode:!0});class co{constructor(t,e,i){this.tree=t,this.overlay=e,this.parser=i}}const uo=Object.create(null);class fo{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):uo,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),n=new fo(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(ho.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(ho.group),n=-1;n<(i?i.length:0);n++){let s=e[n<0?t.name:i[n]];if(s)return s}}}}fo.none=new fo("",Object.create(null),0,8);class po{constructor(t){this.types=t;for(let e=0;e=n&&(r.type.isAnonymous||!1!==e(r))){if(r.firstChild())continue;t=!0}for(;t&&i&&!r.type.isAnonymous&&i(r),!r.nextSibling();){if(!r.parent())return;t=!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:To(fo.none,this.children,this.positions,0,this.children.length,0,this.length,((t,e,i)=>new bo(this.type,t,e,i,this.propValues)),t.makeTree||((t,e,i)=>new bo(fo.none,t,e,i)))}static build(t){return function(t){var e;let{buffer:i,nodeSet:n,maxBufferLength:s=oo,reused:r=[],minRepeatType:o=n.types.length}=t,a=Array.isArray(i)?new wo(i,i.length):i,l=n.types,h=0,c=0;function u(t,e,i,m,b){let{id:w,start:v,end:y,size:S}=a,x=c;for(;S<0;){if(a.next(),-1==S){let e=r[w];return i.push(e),void m.push(v-t)}if(-3==S)return void(h=w);if(-4==S)return void(c=w);throw new RangeError(`Unrecognized record size: ${S}`)}let k,Q,$=l[w],P=v-t;if(y-v<=s&&(Q=O(a.pos-e,b))){let e=new Uint16Array(Q.size-Q.skip),i=a.pos-Q.size,s=e.length;for(;a.pos>i;)s=g(Q.start,e,s);k=new vo(e,y-Q.start,n),P=Q.start-t}else{let t=a.pos-S;a.next();let e=[],i=[],n=w>=o?w:-1,r=0,l=y;for(;a.pos>t;)n>=0&&a.id==n&&a.size>=0?(a.end<=l-s&&(f(e,i,v,r,a.end,l,n,x),r=e.length,l=a.end),a.next()):u(v,t,e,i,n);if(n>=0&&r>0&&r-1&&r>0){let t=d($);k=To($,e,i,0,e.length,0,y-v,t,t)}else k=p($,e,i,y-v,x-y)}i.push(k),m.push(P)}function d(t){return(e,i,n)=>{let s,r,o=0,a=e.length-1;if(a>=0&&(s=e[a])instanceof bo){if(!a&&s.type==t&&s.length==n)return s;(r=s.prop(ho.lookAhead))&&(o=i[a]+s.length+r)}return p(t,e,i,n,o)}}function f(t,e,i,s,r,o,a,l){let h=[],c=[];for(;t.length>s;)h.push(t.pop()),c.push(e.pop()+i-r);t.push(p(n.types[a],h,c,o-r,l-o)),e.push(r-i)}function p(t,e,i,n,s=0,r){if(h){let t=[ho.contextHash,h];r=r?[t].concat(r):[t]}if(s>25){let t=[ho.lookAhead,s];r=r?[t].concat(r):[t]}return new bo(t,e,i,n,r)}function O(t,e){let i=a.fork(),n=0,r=0,l=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=l,l+=4,n+=4,i.next();continue}let a=i.pos-t;if(t<0||a=o?4:0,d=i.start;for(i.next();i.pos>a;){if(i.size<0){if(-3!=i.size)break t;u+=4}else i.id>=o&&(u+=4);i.next()}r=d,n+=t,l+=u}return(e<0||n==t)&&(c.size=n,c.start=r,c.skip=l),c.size>4?c:void 0}function g(t,e,i){let{id:n,start:s,end:r,size:l}=a;if(a.next(),l>=0&&n4){let n=a.pos-(l-4);for(;a.pos>n;)i=g(t,e,i)}e[--i]=o,e[--i]=r-t,e[--i]=s-t,e[--i]=n}else-3==l?h=n:-4==l&&(c=n);return i}let m=[],b=[];for(;a.pos>0;)u(t.start||0,t.bufferStart||0,m,b,-1);let w=null!==(e=t.length)&&void 0!==e?e:m.length?b[0]+m[0].length:0;return new bo(l[t.topID],m.reverse(),b.reverse(),w)}(t)}}bo.empty=new bo(fo.none,[],[],0);class wo{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 wo(this.buffer,this.index)}}class vo{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return fo.none}toString(){let t=[];for(let e=0;e0));a=r[a+3]);return o}slice(t,e,i){let n=this.buffer,s=new Uint16Array(e-t),r=0;for(let o=t,a=0;o=e&&ie;case 1:return i<=e&&n>e;case 2:return n>e;case 4:return!0}}function So(t,e){let i=t.childBefore(e);for(;i;){let e=i.lastChild;if(!e||e.to!=i.to)break;e.type.isError&&e.from==e.to?(t=i,i=e.prevSibling):i=e}return t}function xo(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!=l;t+=e){let l=o[t],h=a[t]+r.from;if(yo(n,i,h,h+l.length))if(l instanceof vo){if(s&mo.ExcludeBuffers)continue;let o=l.findChild(0,l.buffer.length,e,i-h,n);if(o>-1)return new Co(new Po(r,l,t,h),null,o)}else if(s&mo.IncludeAnonymous||!l.type.isAnonymous||Xo(l)){let o;if(!(s&mo.IgnoreMounts)&&l.props&&(o=l.prop(ho.mounted))&&!o.overlay)return new ko(o.tree,h,t,r);let a=new ko(l,h,t,r);return s&mo.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(e<0?l.children.length-1:0,e,i,n)}}if(s&mo.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&mo.IgnoreOverlays)&&(n=this._tree.prop(ho.mounted))&&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 ko(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}cursor(t=0){return new _o(this,t)}get tree(){return this._tree}toTree(){return this._tree}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return So(this,t)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}toString(){return this._tree.toString()}get node(){return this}matchContext(t){return $o(this,t)}}function Qo(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 $o(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 Po{constructor(t,e,i,n){this.parent=t,this.buffer=e,this.index=i,this.start=n}}class Co{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){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 Co(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&mo.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 Co(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 Co(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 Co(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}cursor(t=0){return new _o(this,t)}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 bo(this.type,t,e,this.to-this.from)}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return So(this,t)}toString(){return this.context.buffer.childString(this.index)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}get node(){return this}matchContext(t){return $o(this,t)}}class _o{get name(){return this.type.name}constructor(t,e=0){if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof ko)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let e=t._parent;e;e=e._parent)this.stack.unshift(e.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return!!t&&(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0)}yieldBuf(t,e){this.index=t;let{start:i,buffer:n}=this.buffer;return this.type=e||n.set.types[n.buffer[t]],this.from=i+n.buffer[t+1],this.to=i+n.buffer[t+2],!0}yield(t){return!!t&&(t instanceof ko?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,i){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,i,this.mode));let{buffer:n}=this.buffer,s=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.buffer.start,i);return!(s<0)&&(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,i=this.mode){return this.buffer?!(i&mo.ExcludeBuffers)&&this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&mo.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&mo.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode));let{buffer:e}=this.buffer,i=this.stack.length-1;if(t<0){let t=i<0?0:this.stack[i]+4;if(this.index!=t)return this.yieldBuf(e.findChild(t,this.index,-1,0,4))}else{let t=e.buffer[this.index+3];if(t<(i<0?e.buffer.length:e.buffer[this.stack[i]+3]))return this.yieldBuf(t)}return i<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,i,{buffer:n}=this;if(n){if(t>0){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&mo.IncludeAnonymous||t instanceof vo||!t.type.isAnonymous||Xo(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 $o(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 Xo(t){return t.children.some((t=>t instanceof vo||!t.type.isAnonymous||Xo(t)))}const Zo=new WeakMap;function Ao(t,e){if(!t.isAnonymous||e instanceof vo||e.type!=t)return 1;let i=Zo.get(e);if(null==i){i=1;for(let n of e.children){if(n.type!=t||!(n instanceof bo)){i=1;break}i+=Ao(t,n)}Zo.set(e,i)}return i}function To(t,e,i,n,s,r,o,a,l){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]+a);continue}u.push(i[s])}else{let e=n[h-1]+i[h-1].length-f;u.push(To(t,i,n,s,h,f,e,null,l))}d.push(f+a-r)}}(e,i,n,s,0),(a||l)(u,d,o)}class Ro{constructor(){this.map=new WeakMap}setBuffer(t,e,i){let n=this.map.get(t);n||this.map.set(t,n=new Map),n.set(e,i)}getBuffer(t,e){let i=this.map.get(t);return i&&i.get(e)}set(t,e){t instanceof Co?this.setBuffer(t.context.buffer,t.index,e):t instanceof ko&&this.map.set(t.tree,e)}get(t){return t instanceof Co?this.getBuffer(t.context.buffer,t.index):t instanceof ko?this.map.get(t.tree):void 0}cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}}class Eo{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 Eo(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,a=0,l=0;;o++){let h=o=i)for(;r&&r.from=e.from||c<=e.to||l){let t=Math.max(e.from,a)-l,i=Math.min(e.to,c)-l;e=t>=i?null:new Eo(t,i,e.tree,e.offset+l,o>0,!!h)}if(e&&n.push(e),r.to>c)break;r=snew lo(t.from,t.to))):[new lo(0,0)]:[new lo(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 Mo{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)}}function Do(t){return(e,i,n,s)=>new qo(e,t,i,n,s)}class Wo{constructor(t,e,i,n,s){this.parser=t,this.parse=e,this.overlay=i,this.target=n,this.ranges=s}}class Uo{constructor(t,e,i,n,s,r,o){this.parser=t,this.predicate=e,this.mounts=i,this.index=n,this.start=s,this.target=r,this.prev=o,this.depth=0,this.ranges=[]}}const Yo=new ho({perNode:!0});class qo{constructor(t,e,i,n,s){this.nest=e,this.input=i,this.fragments=n,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=t}advance(){if(this.baseParse){let t=this.baseParse.advance();if(!t)return null;if(this.baseParse=null,this.baseTree=t,this.startInner(),null!=this.stoppedAt)for(let t of this.inner)t.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let t=this.baseTree;return null!=this.stoppedAt&&(t=new bo(t.type,t.children,t.positions,t.length,t.propValues.concat([[Yo,this.stoppedAt]]))),t}let t=this.inner[this.innerDone],e=t.parse.advance();if(e){this.innerDone++;let i=Object.assign(Object.create(null),t.target.props);i[ho.mounted.id]=new co(e,t.overlay,t.parser),t.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let t=this.input.length;for(let e=this.innerDone;et.frag.from<=n.from&&t.frag.to>=n.to&&t.mount.overlay));if(t)for(let i of t.mount.overlay){let s=i.from+t.pos,r=i.to+t.pos;s>=n.from&&r<=n.to&&!e.ranges.some((t=>t.froms))&&e.ranges.push({from:s,to:r})}}a=!1}else if(i&&(r=Lo(i.ranges,n.from,n.to)))a=2!=r;else if(!n.type.isAnonymous&&n.fromnew lo(t.from-n.from,t.to-n.from))):null,n.tree,t)),s.overlay?t.length&&(i={ranges:t,depth:0,prev:i}):a=!1}}else e&&(o=e.predicate(n))&&(!0===o&&(o=new lo(n.from,n.to)),o.fromnew lo(t.from-e.start,t.to-e.start))),e.target,t)),e=e.prev}i&&! --i.depth&&(i=i.prev)}}}}function Lo(t,e,i){for(let n of t){if(n.from>=i)break;if(n.to>e)return n.from<=e&&n.to>=i?2:1}return 0}function zo(t,e,i,n,s,r){if(e=e.to);n++);let o=s.children[n],a=o.buffer;s.children[n]=function t(i,n,s,l,h){let c=i;for(;a[c+2]+r<=e.from;)c=a[c+3];let u=[],d=[];zo(o,i,c,u,d,l);let f=a[c+1],p=a[c+2],O=f+r==e.from&&p+r==e.to&&a[c]==e.type.id;return u.push(O?e.toTree():t(c+4,a[c+3],o.set.types[a[c]],f,p-f)),d.push(f-l),zo(o,a[c+3],n,u,d,l),new bo(s,u,d,h)}(0,a.length,fo.none,0,o.length);for(let n=0;n<=i;n++)t.childAfter(e.from)}class Bo{constructor(t,e){this.offset=e,this.done=!1,this.cursor=t.cursor(mo.IncludeAnonymous|mo.IgnoreMounts)}moveTo(t){let{cursor:e}=this,i=t-this.offset;for(;!this.done&&e.from=t&&e.enter(i,1,mo.IgnoreOverlays|mo.ExcludeBuffers)||e.next(!1)||(this.done=!0)}hasNode(t){if(this.moveTo(t.from),!this.done&&this.cursor.from+this.offset==t.from&&this.cursor.tree)for(let e=this.cursor.tree;;){if(e==t.tree)return!0;if(!(e.children.length&&0==e.positions[0]&&e.children[0]instanceof bo))break;e=e.children[0]}return!1}}let jo=class{constructor(t){var e;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){let i=this.curFrag=t[0];this.curTo=null!==(e=i.tree.prop(Yo))&&void 0!==e?e:i.to,this.inner=new Bo(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t)}nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=null!==(t=e.tree.prop(Yo))&&void 0!==t?t:e.to,this.inner=new Bo(e.tree,-e.offset)}}findMounts(t,e){var i;let n=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let t=this.inner.cursor.node;t;t=t.parent){let s=null===(i=t.tree)||void 0===i?void 0:i.prop(ho.mounted);if(s&&s.parser==e)for(let e=this.fragI;e=t.to)break;i.tree==this.curFrag.tree&&n.push({frag:i,pos:t.from-i.offset,mount:s})}}}return n}};function No(t,e){let i=null,n=e;for(let s=1,r=0;s=a)break;t.to<=o||(i||(n=i=e.slice()),t.froma&&i.splice(r+1,0,new lo(a,t.to))):t.to>a?i[r--]=new lo(a,t.to):i.splice(r--,1))}}return n}function Go(t,e,i,n){let s=0,r=0,o=!1,a=!1,l=-1e9,h=[];for(;;){let c=s==t.length?1e9:o?t[s].to:t[s].from,u=r==e.length?1e9:a?e[r].to:e[r].from;if(o!=a){let t=Math.max(l,i),e=Math.min(c,u,n);tnew lo(t.from+n,t.to+n))),a,l);for(let e=0,n=a;;e++){let a=e==o.length,h=a?l:o[e].from;if(h>n&&i.push(new Eo(n,h,s.tree,-t,r.from>=n||r.openStart,r.to<=h||r.openEnd)),a)break;n=o[e].to}}else i.push(new Eo(a,l,s.tree,-t,r.from>=t||r.openStart,r.to<=o||r.openEnd))}return i}let Ho=0;class Jo{constructor(t,e,i){this.set=t,this.base=e,this.modified=i,this.id=Ho++}static define(t){if(null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let e=new Jo([],null,[]);if(e.set.push(e),t)for(let i of t.set)e.set.push(i);return e}static defineModifier(){let t=new ta;return e=>e.modified.indexOf(t)>-1?e:ta.get(e.base||e,e.modified.concat(t).sort(((t,e)=>t.id-e.id)))}}let Ko=0;class ta{constructor(){this.instances=[],this.id=Ko++}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 Jo(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(ta.get(e,t));return s}}function ea(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,a=i[o];if(!a)throw new RangeError("Invalid path: "+t);let l=new na(n,s,o>0?i.slice(0,o):null);e[a]=l.sort(e[a])}}return ia.add(e)}const ia=new ho;class na{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 ra(t,e,i,n=0,s=t.length){let r=new oa(n,Array.isArray(e)?e:[e],i);r.highlightRange(t.cursor(),n,s,"",r.highlighters),r.flush(s)}na.empty=new na([],2,null);class oa{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:a}=t;if(o>=i||a<=e)return;r.isTop&&(s=this.highlighters.filter((t=>!t.scope||t.scope(r))));let l=n,h=function(t){let e=t.type.prop(ia);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}(t)||na.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&&(l&&(l+=" "),l+=c,1==h.mode&&(n+=(n?" ":"")+c)),this.startSpan(t.from,l),h.opaque)return;let u=t.tree&&t.tree.prop(ho.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 d=0,f=o;;d++){let p=d=O)&&t.nextSibling()););if(!p||O>i)break;f=p.to+o,f>e&&(this.highlightRange(r.cursor(),Math.max(e,p.from+o),Math.min(i,f),n,h),this.startSpan(f,l))}c&&t.parent()}else if(t.firstChild()){do{if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,n,s),this.startSpan(Math.min(i,t.to),l)}}while(t.nextSibling());t.parent()}}}const aa=Jo.define,la=aa(),ha=aa(),ca=aa(ha),ua=aa(ha),da=aa(),fa=aa(da),pa=aa(da),Oa=aa(),ga=aa(Oa),ma=aa(),ba=aa(),wa=aa(),va=aa(wa),ya=aa(),Sa={comment:la,lineComment:aa(la),blockComment:aa(la),docComment:aa(la),name:ha,variableName:aa(ha),typeName:ca,tagName:aa(ca),propertyName:ua,attributeName:aa(ua),className:aa(ha),labelName:aa(ha),namespace:aa(ha),macroName:aa(ha),literal:da,string:fa,docString:aa(fa),character:aa(fa),attributeValue:aa(fa),number:pa,integer:aa(pa),float:aa(pa),bool:aa(da),regexp:aa(da),escape:aa(da),color:aa(da),url:aa(da),keyword:ma,self:aa(ma),null:aa(ma),atom:aa(ma),unit:aa(ma),modifier:aa(ma),operatorKeyword:aa(ma),controlKeyword:aa(ma),definitionKeyword:aa(ma),moduleKeyword:aa(ma),operator:ba,derefOperator:aa(ba),arithmeticOperator:aa(ba),logicOperator:aa(ba),bitwiseOperator:aa(ba),compareOperator:aa(ba),updateOperator:aa(ba),definitionOperator:aa(ba),typeOperator:aa(ba),controlOperator:aa(ba),punctuation:wa,separator:aa(wa),bracket:va,angleBracket:aa(va),squareBracket:aa(va),paren:aa(va),brace:aa(va),content:Oa,heading:ga,heading1:aa(ga),heading2:aa(ga),heading3:aa(ga),heading4:aa(ga),heading5:aa(ga),heading6:aa(ga),contentSeparator:aa(Oa),list:aa(Oa),quote:aa(Oa),emphasis:aa(Oa),strong:aa(Oa),link:aa(Oa),monospace:aa(Oa),strikethrough:aa(Oa),inserted:aa(),deleted:aa(),changed:aa(),invalid:aa(),meta:ya,documentMeta:aa(ya),annotation:aa(ya),processingInstruction:aa(ya),definition:Jo.defineModifier(),constant:Jo.defineModifier(),function:Jo.defineModifier(),standard:Jo.defineModifier(),local:Jo.defineModifier(),special:Jo.defineModifier()};var xa;sa([{tag:Sa.link,class:"tok-link"},{tag:Sa.heading,class:"tok-heading"},{tag:Sa.emphasis,class:"tok-emphasis"},{tag:Sa.strong,class:"tok-strong"},{tag:Sa.keyword,class:"tok-keyword"},{tag:Sa.atom,class:"tok-atom"},{tag:Sa.bool,class:"tok-bool"},{tag:Sa.url,class:"tok-url"},{tag:Sa.labelName,class:"tok-labelName"},{tag:Sa.inserted,class:"tok-inserted"},{tag:Sa.deleted,class:"tok-deleted"},{tag:Sa.literal,class:"tok-literal"},{tag:Sa.string,class:"tok-string"},{tag:Sa.number,class:"tok-number"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],class:"tok-string2"},{tag:Sa.variableName,class:"tok-variableName"},{tag:Sa.local(Sa.variableName),class:"tok-variableName tok-local"},{tag:Sa.definition(Sa.variableName),class:"tok-variableName tok-definition"},{tag:Sa.special(Sa.variableName),class:"tok-variableName2"},{tag:Sa.definition(Sa.propertyName),class:"tok-propertyName tok-definition"},{tag:Sa.typeName,class:"tok-typeName"},{tag:Sa.namespace,class:"tok-namespace"},{tag:Sa.className,class:"tok-className"},{tag:Sa.macroName,class:"tok-macroName"},{tag:Sa.propertyName,class:"tok-propertyName"},{tag:Sa.operator,class:"tok-operator"},{tag:Sa.comment,class:"tok-comment"},{tag:Sa.meta,class:"tok-meta"},{tag:Sa.invalid,class:"tok-invalid"},{tag:Sa.punctuation,class:"tok-punctuation"}]);const ka=new ho;function Qa(t){return E.define({combine:t?e=>e.concat(t):void 0})}const $a=new ho;class Pa{constructor(t,e,i=[],n=""){this.data=t,this.name=n,xt.prototype.hasOwnProperty("tree")||Object.defineProperty(xt.prototype,"tree",{get(){return Xa(this)}}),this.parser=e,this.extension=[Wa.of(this),xt.languageData.of(((t,e,i)=>{let n=Ca(t,e,i),s=n.type.prop(ka);if(!s)return[];let r=t.facet(s),o=n.type.prop($a);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 Ca(t,e,i).type.prop(ka)==this.data}findRegions(t){let e=t.facet(Wa);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(ka)==this.data)return void i.push({from:e,to:e+t.length});let s=t.prop(ho.mounted);if(s){if(s.tree.prop(ka)==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;it.isTop?e:void 0))]}),t.name)}configure(t,e){return new _a(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Xa(t){let e=t.field(Pa.state,!1);return e?e.tree:bo.empty}class Za{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let i=this.cursorPos-this.string.length;return t=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i)}}let Aa=null;class Ta{constructor(t,e,i=[],n,s,r,o,a){this.parser=t,this.state=e,this.fragments=i,this.tree=n,this.treeLen=s,this.viewport=r,this.skipped=o,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(t,e,i){return new Ta(t,e,[],bo.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Za(this.state.doc),this.fragments)}work(t,e){return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=bo.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(Eo.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Aa;Aa=this;try{return t()}finally{Aa=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=Ra(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=Eo.applyChanges(i,e),n=bo.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=Ra(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 Vo{createParse(e,i,n){let s=n[0].from,r=n[n.length-1].to;return{parsedPos:s,advance(){let e=Aa;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 bo(fo.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 Aa}}function Ra(t,e,i){return Eo.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class Ea{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 Ea(e)}static init(t){let e=Math.min(3e3,t.doc.length),i=Ta.create(t.facet(Wa).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new Ea(i)}}Pa.state=q.define({create:Ea.init,update(t,e){for(let t of e.effects)if(t.is(Pa.setState))return t.value;return e.startState.facet(Wa)!=e.state.facet(Wa)?Ea.init(e.state):t.apply(e)}});let Va=t=>{let e=setTimeout((()=>t()),500);return()=>clearTimeout(e)};"undefined"!=typeof requestIdleCallback&&(Va=t=>{let e=-1,i=setTimeout((()=>{e=requestIdleCallback(t,{timeout:400})}),100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const Ma="undefined"!=typeof navigator&&(null===(xa=navigator.scheduling)||void 0===xa?void 0:xa.isInputPending)?()=>navigator.scheduling.isInputPending():null,Da=_i.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(Pa.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),t.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(Pa.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=Va(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEndn+1e3,a=s.context.work((()=>Ma&&Ma()||Date.now()>r),n+(o?0:1e5));this.chunkBudget-=Date.now()-e,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Pa.setState.of(new Ea(s.context))})),this.chunkBudget>0&&(!a||o)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then((()=>this.scheduleWork())).catch((t=>Qi(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()}}}),Wa=E.define({combine:t=>t.length?t[0]:null,enables:t=>[Pa.state,Da,Ts.contentAttributes.compute([t],(e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}}))]});class Ua{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}class Ya{constructor(t,e,i,n,s,r=void 0){this.name=t,this.alias=e,this.extensions=i,this.filename=n,this.loadFunc=s,this.support=r,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then((t=>this.support=t),(t=>{throw this.loading=null,t})))}static of(t){let{load:e,support:i}=t;if(!e){if(!i)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");e=()=>Promise.resolve(i)}return new Ya(t.name,(t.alias||[]).concat(t.name).map((t=>t.toLowerCase())),t.extensions||[],t.filename,e,i)}static matchFilename(t,e){for(let i of t)if(i.filename&&i.filename.test(e))return i;let i=/\.([^.]+)$/.exec(e);if(i)for(let e of t)if(e.extensions.indexOf(i[1])>-1)return e;return null}static matchLanguageName(t,e,i=!0){e=e.toLowerCase();for(let i of t)if(i.alias.some((t=>t==e)))return i;if(i)for(let i of t)for(let t of i.alias){let n=e.indexOf(t);if(n>-1&&(t.length>2||!/\w/.test(e[n-1])&&!/\w/.test(e[n+t.length])))return i}return null}}const qa=E.define(),La=E.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 za(t){let e=t.facet(La);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function Ia(t,e){let i="",n=t.tabSize,s=t.facet(La)[0];if("\t"==s){for(;e>=n;)i+="\t",e-=n;s=" "}for(let t=0;t=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 Yt(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 Na=new ho;function Ga(t){let e=t.type.prop(Na);if(e)return e;let i,n=t.firstChild;if(n&&(i=n.type.prop(ho.closedBy))){let e=t.lastChild,n=e&&i.indexOf(e.name)>-1;return t=>el(t,!0,1,void 0,n&&!function(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}(t)?e.from:void 0)}return null==t.parent?Ha:null}function Fa(t,e,i){for(;t;t=t.parent){let n=Ga(t);if(n)return n(Ja.create(i,e,t))}return null}function Ha(){return 0}class Ja extends ja{constructor(t,e,i){super(t.state,t.options),this.base=t,this.pos=e,this.node=i}static create(t,e,i){return new Ja(t,e,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){let t=this.state.doc.lineAt(this.node.from);for(;;){let e=this.node.resolve(t.from);for(;e.parent&&e.parent.from==e.from;)e=e.parent;if(Ka(e,this.node))break;t=this.state.doc.lineAt(e.from)}return this.lineIndent(t.from)}continue(){let t=this.node.parent;return t?Fa(t,this.pos,this.base):0}}function Ka(t,e){for(let i=e;i;i=i.parent)if(t==i)return!0;return!1}function tl({closing:t,align:e=!0,units:i=1}){return n=>el(n,e,i,t)}function el(t,e,i,n,s){let r=t.textAfter,o=r.match(/^\s*/)[0].length,a=n&&r.slice(o,o+n.length)==n||s==t.pos+o,l=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.from{let n=t&&t.test(i.textAfter);return i.baseIndent+(n?0:e*i.unit)}}function nl(){return xt.transactionFilter.of((t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let i=t.newDoc,{head:n}=t.newSelection.main,s=i.lineAt(n);if(n>s.from+200)return t;let r=i.sliceString(s.from,n);if(!e.some((t=>t.test(r))))return t;let{state:o}=t,a=-1,l=[];for(let{head:t}of o.selection.ranges){let e=o.doc.lineAt(t);if(e.from==a)continue;a=e.from;let i=Ba(o,e.from);if(null==i)continue;let n=/^\s*/.exec(e.text)[0],s=Ia(o,i);n!=s&&l.push({from:e.from,to:e.from+n.length,insert:s})}return l.length?[t,{changes:l,sequential:!0}]:t}))}const sl=E.define(),rl=new ho;function ol(t){let e=t.firstChild,i=t.lastChild;return e&&e.toi)continue;if(s&&r.from=e&&n.to>i&&(s=n)}}return s}(t,e,i)}function hl(t,e){let i=e.mapPos(t.from,1),n=e.mapPos(t.to,-1);return i>=n?void 0:{from:i,to:n}}const cl=ut.define({map:hl}),ul=ut.define({map:hl}),dl=q.define({create:()=>ni.none,update(t,e){t=t.map(e.changes);for(let i of e.effects)i.is(cl)&&!pl(t,i.value.from,i.value.to)?t=t.update({add:[bl.range(i.value.from,i.value.to)]}):i.is(ul)&&(t=t.update({filter:(t,e)=>i.value.from!=t||i.value.to!=e,filterFrom:i.value.from,filterTo:i.value.to}));if(e.selection){let i=!1,{head:n}=e.selection.main;t.between(n,n,((t,e)=>{tn&&(i=!0)})),i&&(t=t.update({filterFrom:n,filterTo:n,filter:(t,e)=>e<=n||t>=n}))}return t},provide:t=>Ts.decorations.from(t),toJSON(t,e){let i=[];return t.between(0,e.doc.length,((t,e)=>{i.push(t,e)})),i},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let i=0;i{(!s||s.from>t)&&(s={from:t,to:e})})),s}function pl(t,e,i){let n=!1;return t.between(e,e,((t,s)=>{t==e&&s==i&&(n=!0)})),n}const Ol={placeholderDOM:null,placeholderText:"…"},gl=E.define({combine:t=>kt(t,Ol)});function ml(t){let e=[dl,yl];return t&&e.push(gl.of(t)),e}const bl=ni.replace({widget:new class extends ei{toDOM(t){let{state:e}=t,i=e.facet(gl),n=e=>{let i=t.lineBlockAt(t.posAtDOM(e.target)),n=fl(t.state,i.from,i.to);n&&t.dispatch({effects:ul.of(n)}),e.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(t,n);let s=document.createElement("span");return s.textContent=i.placeholderText,s.setAttribute("aria-label",e.phrase("folded code")),s.title=e.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=n,s}}}),wl={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class vl extends Yr{constructor(t,e){super(),this.config=t,this.open=e}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let e=document.createElement("span");return e.textContent=this.open?this.config.openText:this.config.closedText,e.title=t.state.phrase(this.open?"Fold line":"Unfold line"),e}}const yl=Ts.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Sl{constructor(t,e){let i;function n(t){let e=It.newName();return(i||(i=Object.create(null)))["."+e]=t,e}this.specs=t;const s="string"==typeof e.all?e.all:e.all?n(e.all):void 0,r=e.scope;this.scope=r instanceof Pa?t=>t.prop(ka)==r.data:r?t=>t==r:void 0,this.style=sa(t.map((t=>({tag:t.tag,class:t.class||n(Object.assign({},t,{tag:null}))}))),{all:s}).style,this.module=i?new It(i):null,this.themeType=e.themeType}static define(t,e){return new Sl(t,e||{})}}const xl=E.define(),kl=E.define({combine:t=>t.length?[t[0]]:null});function Ql(t){let e=t.facet(xl);return e.length?e:t.facet(kl)}function $l(t,e){let i,n=[Cl];return t instanceof Sl&&(t.module&&n.push(Ts.styleModule.of(t.module)),i=t.themeType),(null==e?void 0:e.fallback)?n.push(kl.of(t)):i?n.push(xl.computeN([Ts.darkTheme],(e=>e.facet(Ts.darkTheme)==("dark"==i)?[t]:[]))):n.push(xl.of(t)),n}class Pl{constructor(t){this.markCache=Object.create(null),this.tree=Xa(t.state),this.decorations=this.buildDeco(t,Ql(t.state))}update(t){let e=Xa(t.state),i=Ql(t.state),n=i!=Ql(t.startState);e.length{i.add(t,e,this.markCache[n]||(this.markCache[n]=ni.mark({class:n})))}),n,s);return i.finish()}}const Cl=N.high(_i.fromClass(Pl,{decorations:t=>t.decorations})),_l=Sl.define([{tag:Sa.meta,color:"#404740"},{tag:Sa.link,textDecoration:"underline"},{tag:Sa.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Sa.emphasis,fontStyle:"italic"},{tag:Sa.strong,fontWeight:"bold"},{tag:Sa.strikethrough,textDecoration:"line-through"},{tag:Sa.keyword,color:"#708"},{tag:[Sa.atom,Sa.bool,Sa.url,Sa.contentSeparator,Sa.labelName],color:"#219"},{tag:[Sa.literal,Sa.inserted],color:"#164"},{tag:[Sa.string,Sa.deleted],color:"#a11"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],color:"#e40"},{tag:Sa.definition(Sa.variableName),color:"#00f"},{tag:Sa.local(Sa.variableName),color:"#30a"},{tag:[Sa.typeName,Sa.namespace],color:"#085"},{tag:Sa.className,color:"#167"},{tag:[Sa.special(Sa.variableName),Sa.macroName],color:"#256"},{tag:Sa.definition(Sa.propertyName),color:"#00c"},{tag:Sa.comment,color:"#940"},{tag:Sa.invalid,color:"#f00"}]),Xl=Ts.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Zl=1e4,Al="()[]{}",Tl=E.define({combine:t=>kt(t,{afterCursor:!0,brackets:Al,maxScanDistance:Zl,renderMatch:Vl})}),Rl=ni.mark({class:"cm-matchingBracket"}),El=ni.mark({class:"cm-nonmatchingBracket"});function Vl(t){let e=[],i=t.matched?Rl:El;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 Ml=q.define({create:()=>ni.none,update(t,e){if(!e.docChanged&&!e.selection)return t;let i=[],n=e.state.facet(Tl);for(let t of e.state.selection.ranges){if(!t.empty)continue;let s=Ll(e.state,t.head,-1,n)||t.head>0&&Ll(e.state,t.head-1,1,n)||n.afterCursor&&(Ll(e.state,t.head,1,n)||t.headTs.decorations.from(t)}),Dl=[Ml,Xl];function Wl(t={}){return[Tl.of(t),Dl]}const Ul=new ho;function Yl(t,e,i){let n=t.prop(e<0?ho.openedBy:ho.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 ql(t){let e=t.type.prop(Ul);return e?e(t.node):t}function Ll(t,e,i,n={}){let s=n.maxScanDistance||Zl,r=n.brackets||Al,o=Xa(t),a=o.resolveInner(e,i);for(let n=a;n;n=n.parent){let s=Yl(n.type,i,r);if(s&&n.from0?e>=o.from&&eo.from&&e<=o.to))return zl(t,e,i,n,o,s,r)}}return function(t,e,i,n,s,r,o){let a=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%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 a=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(a+t,1).type!=s))if(e%2==0==i>0)u++;else{if(1==u)return{start:h,end:{from:a+t,to:a+t+1},matched:e>>1==l>>1};u--}}i>0&&(t+=r.length)}return c.done?{start:h,matched:!1}:null}(t,e,i,o,a.type,s,r)}function zl(t,e,i,n,s,r,o){let a=n.parent,l={from:s.from,to:s.to},h=0,c=null==a?void 0:a.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 jl(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 Nl=new WeakMap;class Gl extends Pa{constructor(t){let e,i=Qa(t.languageData),n={name:(s=t).name||"",token:s.token,blankLine:s.blankLine||(()=>{}),startState:s.startState||(()=>!0),copyState:s.copyState||jl,indent:s.indent||(()=>null),languageData:s.languageData||{},tokenTable:s.tokenTable||th};var s;super(i,new class extends Vo{createParse(t,i,n){return new Jl(e,t,i,n)}},[qa.of(((t,e)=>this.getIndent(t,e)))],t.name),this.topNode=function(t){let e=fo.define({id:eh.length,name:"Document",props:[ka.add((()=>t))]});return eh.push(e),e}(i),e=this,this.streamParser=n,this.stateAfter=new ho({perNode:!0}),this.tokenTable=t.tokenTable?new rh(n.tokenTable):oh}static define(t){return new Gl(t)}getIndent(t,e){let i,n=Xa(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=Nl.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],a=i+e.positions[r],l=o instanceof bo&&a=e.length)return e;s||e.type!=t.topNode||(s=!0);for(let r=e.children.length-1;r>=0;r--){let o,a=e.positions[r],l=e.children[r];if(ai&&Fl(t,n.tree,0-n.offset,i,r);if(o&&(e=Hl(t,n.tree,i+n.offset,o.pos+n.offset,!1)))return{state:o.state,tree:e}}return{state:t.streamParser.startState(n?za(n):4),tree:bo.empty}}(t,i,r,null==s?void 0:s.state);this.state=o,this.parsedPos=this.chunkStart=r+a.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 Bl(e,t?t.state.tabSize:4,t?za(t.state):2);if(r.eol())s.blankLine(this.state,r.indentUnit);else for(;!r.eol();){let t=Kl(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 th=Object.create(null),eh=[fo.none],ih=new po(eh),nh=[],sh=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"]])sh[t]=lh(th,e);class rh{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),sh)}resolve(t){return t?this.table[t]||(this.table[t]=lh(this.extra,t)):0}}const oh=new rh(th);function ah(t,e){nh.indexOf(t)>-1||(nh.push(t),console.warn(e))}function lh(t,e){let i=null;for(let n of e.split(".")){let e=t[n]||Sa[n];e?"function"==typeof e?i?i=e(i):ah(n,`Modifier ${n} used at start of tag`):i?ah(n,`Tag ${n} used as modifier`):i=e:ah(n,`Unknown highlighting tag ${n}`)}if(!i)return 0;let n=e.replace(/ /g,"_"),s=fo.define({id:eh.length,name:n,props:[ea({[n]:i})]});return eh.push(s),s.id}function hh(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 ch=hh(gh,0),uh=hh(Oh,0),dh=hh(((t,e)=>Oh(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 fh(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}const ph=50;function Oh(t,e,i=e.selection.ranges){let n=i.map((t=>fh(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,a=t.sliceDoc(n-ph,n),l=t.sliceDoc(s,s+ph),h=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(l)[0].length,u=a.length-h;if(a.slice(u-e.length,u)==e&&l.slice(c,c+i.length)==i)return{open:{pos:n-h,margin:h&&1},close:{pos:s+c,margin:c&&1}};s-n<=2*ph?r=o=t.sliceDoc(n,s):(r=t.sliceDoc(n,n+ph),o=t.sliceDoc(s-ph,s));let d=/^\s*/.exec(r)[0].length,f=/\s*$/.exec(o)[0].length,p=o.length-f-i.length;return r.slice(d,d+e.length)==e&&o.slice(p,p+i.length)==i?{open:{pos:n+d+e.length,margin:/\s/.test(r.charAt(d+e.length))?1:0},close:{pos:s-f-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>l.from)){s=l.from;let t=/^\s*/.exec(l.text)[0].length,e=t==l.length,i=l.text.slice(t,t+a.length)==a?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 mh=lt.define(),bh=lt.define(),wh=E.define(),vh=E.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)})});const yh=q.define({create:()=>Dh.empty,update(t,e){let i=e.state.facet(vh),n=e.annotation(mh);if(n){let s=e.docChanged?A.single(function(t){let e=0;return t.iterChangedRanges(((t,i)=>e=i)),e}(e.changes)):void 0,r=Ch.fromTransaction(e,s),o=n.side,a=0==o?t.undone:t.done;return a=r?_h(a,a.length,i.minDepth,r):Th(a,e.startState.selection),new Dh(0==o?n.rest:a,0==o?a:n.rest)}let s=e.annotation(bh);if("full"!=s&&"before"!=s||(t=t.isolate()),!1===e.annotation(dt.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);let r=Ch.fromTransaction(e),o=e.annotation(dt.time),a=e.annotation(dt.userEvent);return r?t=t.addChanges(r,o,a,i,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,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 Dh(t.done.map(Ch.fromJSON),t.undone.map(Ch.fromJSON))});function Sh(t={}){return[yh,vh.of(t),Ts.domEventHandlers({beforeinput(t,e){let i="historyUndo"==t.inputType?kh:"historyRedo"==t.inputType?Qh:null;return!!i&&(t.preventDefault(),i(e))}})]}function xh(t,e){return function({state:i,dispatch:n}){if(!e&&i.readOnly)return!1;let s=i.field(yh,!1);if(!s)return!1;let r=s.pop(t,i,e);return!!r&&(n(r),!0)}}const kh=xh(0,!1),Qh=xh(1,!1),$h=xh(0,!0),Ph=xh(1,!0);class Ch{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 Ch(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 Ch(t.changes&&k.fromJSON(t.changes),[],t.mapped&&x.fromJSON(t.mapped),t.startSelection&&A.fromJSON(t.startSelection),t.selectionsAfter.map(A.fromJSON))}static fromTransaction(t,e){let i=Zh;for(let e of t.startState.facet(wh)){let n=e(t);n.length&&(i=i.concat(n))}return!i.length&&t.changes.empty?null:new Ch(t.changes.invert(t.startState.doc),i,void 0,e||t.startState.selection,Zh)}static selection(t){return new Ch(void 0,Zh,void 0,void 0,t)}}function _h(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 Xh(t,e){return t.length?e.length?t.concat(e):t:e}const Zh=[],Ah=200;function Th(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-Ah));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),_h(t,t.length-1,1e9,i.setSelAfter(n)))}return[Ch.selection([e])]}function Rh(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 Eh(t,e){if(!t.length)return t;let i=t.length,n=Zh;for(;i;){let s=Vh(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?[Ch.selection(n)]:Zh}function Vh(t,e,i){let n=Xh(t.selectionsAfter.length?t.selectionsAfter.map((t=>t.map(e))):Zh,i);if(!t.changes)return Ch.selection(n);let s=t.changes.map(e),r=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(r):r;return new Ch(s,ut.mapEffects(t.effects,e),o,t.startSelection.map(r),n)}const Mh=/^(input\.type|delete)($|\.)/;class Dh{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 Dh(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||Mh.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)?_h(r,r.length-1,n.minDepth,new Ch(t.changes.compose(o.changes),Xh(t.effects,o.effects),o.mapped,o.startSelection,Zh)):_h(r,r.length,n.minDepth,t),new Dh(r,Zh,e,i)}addSelection(t,e,i,n){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Zh;return s.length>0&&e-this.prevTimet.empty!=o.ranges[e].empty)).length)?this:new Dh(Th(this.done,t),this.undone,e,i);var r,o}addMapping(t){return new Dh(Eh(this.done,t),Eh(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:mh.of({side:t,rest:Rh(n)}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let i=1==n.length?Zh:n.slice(0,n.length-1);return s.mapped&&(i=Eh(i,s.mapped)),e.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:mh.of({side:t,rest:i}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}}Dh.empty=new Dh(Zh,Zh);const Wh=[{key:"Mod-z",run:kh,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Qh,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Qh,preventDefault:!0},{key:"Mod-u",run:$h,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Ph,preventDefault:!0}];function Uh(t,e){return A.create(t.ranges.map(e),t.mainIndex)}function Yh(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function qh({state:t,dispatch:e},i){let n=Uh(t.selection,i);return!n.eq(t.selection)&&(e(Yh(t,n)),!0)}function Lh(t,e){return A.cursor(e?t.to:t.from)}function zh(t,e){return qh(t,(i=>i.empty?t.moveByChar(i,e):Lh(i,e)))}function Ih(t){return t.textDirectionAt(t.state.selection.main.head)==Wi.LTR}const Bh=t=>zh(t,!Ih(t)),jh=t=>zh(t,Ih(t));function Nh(t,e){return qh(t,(i=>i.empty?t.moveByGroup(i,e):Lh(i,e)))}function Gh(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 Fh(t,e,i){let n,s,r=Xa(t).resolveInner(e.head),o=i?ho.closedBy:ho.openedBy;for(let n=e.head;;){let e=i?r.childAfter(n):r.childBefore(n);if(!e)break;Gh(t,e,o)?r=e:n=i?e.to:e.from}return s=r.type.prop(o)&&(n=i?Ll(t,r.from,1):Ll(t,r.to,-1))&&n.matched?i?n.end.to:n.end.from:i?r.to:r.from,A.cursor(s,i?-1:1)}function Hh(t,e){return qh(t,(i=>{if(!i.empty)return Lh(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)}))}const Jh=t=>Hh(t,!1),Kh=t=>Hh(t,!0);function tc(t){let e,i=t.scrollDOM.clientHeighti.empty?t.moveVertically(i,e,n.height):Lh(i,e)));if(r.eq(s.selection))return!1;if(n.selfScroll){let e=t.coordsAtPos(s.selection.main.head),o=t.scrollDOM.getBoundingClientRect(),a=o.top+n.marginTop,l=o.bottom-n.marginBottom;e&&e.top>a&&e.bottomec(t,!1),nc=t=>ec(t,!0);function sc(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=A.cursor(n.from+i))}return s}function rc(t,e){let i=Uh(t.state.selection,(t=>{let i=e(t);return A.range(t.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)}));return!i.eq(t.state.selection)&&(t.dispatch(Yh(t.state,i)),!0)}function oc(t,e){return console.log("Select!"),rc(t,(i=>t.moveByCharSelected(i,e)))}const ac=t=>oc(t,!Ih(t)),lc=t=>oc(t,Ih(t));function hc(t,e){return rc(t,(i=>t.moveByGroup(i,e)))}function cc(t,e){return rc(t,(i=>t.moveVertically(i,e)))}const uc=t=>cc(t,!1),dc=t=>cc(t,!0);function fc(t,e){return rc(t,(i=>t.moveVertically(i,e,tc(t).height)))}const pc=t=>fc(t,!1),Oc=t=>fc(t,!0),gc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:0})),!0),mc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.doc.length})),!0),bc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:0})),!0),wc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0);function vc(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=yc(t,n,!0)),s=Math.min(s,n),r=Math.max(r,n)}else s=yc(t,s,!1),r=yc(t,r,!0);return s==r?{range:n}:{changes:{from:s,to:r},range:A.cursor(s)}}));return!s.changes.empty&&(t.dispatch(n.update(s,{scrollIntoView:!0,userEvent:i,effects:"delete.selection"==i?Ts.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function yc(t,e,i){if(t instanceof Ts)for(let n of t.state.facet(Ts.atomicRanges).map((e=>e(t))))n.between(e,e,((t,n)=>{te&&(e=i?n:t)}));return e}const Sc=(t,e)=>vc(t,(i=>{let n,s,{state:r}=t,o=r.doc.lineAt(i);if(!e&&i>o.from&&iSc(t,!1),kc=t=>Sc(t,!0),Qc=(t,e)=>vc(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 a=f(r.text,n-r.from,e)+r.from,l=r.text.slice(Math.min(n,a)-r.from,Math.max(n,a)-r.from),h=o(l);if(null!=t&&h!=t)break;" "==l&&n==i||(t=h),n=a}return n})),$c=t=>Qc(t,!1),Pc=t=>vc(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 _c(t,e,i){if(t.readOnly)return!1;let n=[],s=[];for(let e of Cc(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(A.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(A.range(t.anchor-o,t.head-o))}}return!!n.length&&(e(t.update({changes:n,scrollIntoView:!0,selection:A.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0)}function Xc(t,e,i){if(t.readOnly)return!1;let n=[];for(let e of Cc(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 Zc=Ac(!1);function Ac(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),a=!e&&s==r&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i,n=Xa(t).resolveInner(e),s=n.childBefore(e),r=n.childAfter(e);return s&&r&&s.to<=e&&r.from>=e&&(i=s.type.prop(ho.closedBy))&&i.indexOf(r.name)>-1&&t.doc.lineAt(s.to).from==t.doc.lineAt(r.from).from?{from:s.to,to:r.from}:null}(i,s);e&&(s=r=(r<=o.to?o:i.doc.lineAt(r)).to);let l=new ja(i,{simulateBreak:s,simulateDoubleBreak:!!a}),h=Ba(l,s);for(null==h&&(h=/^\s*/.exec(i.doc.lineAt(s).text)[0].length);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:A.range(r.mapPos(n.anchor,1),r.mapPos(n.head,1))}}))}const Rc=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{i.push({from:e.from,insert:t.facet(La)})})),{userEvent:"input.indent"})),!0),Ec=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{let n=/^\s*/.exec(e.text)[0];if(!n)return;let s=Yt(n,t.tabSize),r=0,o=Ia(t,Math.max(0,s-za(t)));for(;rqh(t,(e=>Fh(t.state,e,!Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,!Ih(t))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:t=>qh(t,(e=>Fh(t.state,e,Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,Ih(t))))},{key:"Alt-ArrowUp",run:({state:t,dispatch:e})=>_c(t,e,!1)},{key:"Shift-Alt-ArrowUp",run:({state:t,dispatch:e})=>Xc(t,e,!1)},{key:"Alt-ArrowDown",run:({state:t,dispatch:e})=>_c(t,e,!0)},{key:"Shift-Alt-ArrowDown",run:({state:t,dispatch:e})=>Xc(t,e,!0)},{key:"Escape",run:({state:t,dispatch:e})=>{let i=t.selection,n=null;return i.ranges.length>1?n=A.create([i.main]):i.main.empty||(n=A.create([A.cursor(i.main.head)])),!!n&&(e(Yh(t,n)),!0)}},{key:"Mod-Enter",run:Ac(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:t,dispatch:e})=>{let i=Cc(t).map((({from:e,to:i})=>A.range(e,Math.min(i+1,t.doc.length))));return e(t.update({selection:A.create(i),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:t,dispatch:e})=>{let i=Uh(t.selection,(e=>{var i;let n=Xa(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 A.range(n.to,n.from)}));return e(Yh(t,i)),!0},preventDefault:!0},{key:"Mod-[",run:Ec},{key:"Mod-]",run:Rc},{key:"Mod-Alt-\\",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new ja(t,{overrideIndentation:t=>{let e=i[t];return null==e?-1:e}}),s=Tc(t,((e,s,r)=>{let o=Ba(n,e.from);if(null==o)return;/\S/.test(e.text)||(o=0);let a=/^\s*/.exec(e.text)[0],l=Ia(t,o);(a!=l||r.from{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(Cc(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=Uh(t.selection,(e=>{let s=Ll(t,e.head,-1)||Ll(t,e.head,1)||e.head>0&&Ll(t,e.head-1,1)||e.head{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=fh(t.state,i.from);return n.line?ch(t):!!n.block&&dh(t)}},{key:"Alt-A",run:uh}].concat([{key:"ArrowLeft",run:Bh,shift:ac,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:t=>Nh(t,!Ih(t)),shift:t=>hc(t,!Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:t=>qh(t,(e=>sc(t,e,!Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,!Ih(t)))),preventDefault:!0},{key:"ArrowRight",run:jh,shift:lc,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:t=>Nh(t,Ih(t)),shift:t=>hc(t,Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:t=>qh(t,(e=>sc(t,e,Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,Ih(t)))),preventDefault:!0},{key:"ArrowUp",run:Jh,shift:uc,preventDefault:!0},{mac:"Cmd-ArrowUp",run:gc,shift:bc},{mac:"Ctrl-ArrowUp",run:ic,shift:pc},{key:"ArrowDown",run:Kh,shift:dc,preventDefault:!0},{mac:"Cmd-ArrowDown",run:mc,shift:wc},{mac:"Ctrl-ArrowDown",run:nc,shift:Oc},{key:"PageUp",run:ic,shift:pc},{key:"PageDown",run:nc,shift:Oc},{key:"Home",run:t=>qh(t,(e=>sc(t,e,!1))),shift:t=>rc(t,(e=>sc(t,e,!1))),preventDefault:!0},{key:"Mod-Home",run:gc,shift:bc},{key:"End",run:t=>qh(t,(e=>sc(t,e,!0))),shift:t=>rc(t,(e=>sc(t,e,!0))),preventDefault:!0},{key:"Mod-End",run:mc,shift:wc},{key:"Enter",run:Zc},{key:"Mod-a",run:({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:xc,shift:xc},{key:"Delete",run:kc},{key:"Mod-Backspace",mac:"Alt-Backspace",run:$c},{key:"Mod-Delete",mac:"Alt-Delete",run:t=>Qc(t,!0)},{mac:"Mod-Backspace",run:t=>vc(t,(e=>{let i=t.lineBlockAt(e).from;return e>i?i:Math.max(0,e-1)}))},{mac:"Mod-Delete",run:Pc}].concat([{key:"Ctrl-b",run:Bh,shift:ac,preventDefault:!0},{key:"Ctrl-f",run:jh,shift:lc},{key:"Ctrl-p",run:Jh,shift:uc},{key:"Ctrl-n",run:Kh,shift:dc},{key:"Ctrl-a",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).from,1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).from)))},{key:"Ctrl-e",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).to,-1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).to)))},{key:"Ctrl-d",run:kc},{key:"Ctrl-h",run:xc},{key:"Ctrl-k",run:Pc},{key:"Ctrl-Alt-h",run:$c},{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:A.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:f(n.text,i-n.from,!1)+n.from,r=i==n.to?i+1:f(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:A.cursor(r)}}));return!i.changes.empty&&(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:nc}].map((t=>({mac:t.key,run:t.run,shift:t.shift})))));function Mc(){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 Uc{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(Wc(t)):Wc,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 b(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=w(t),i=this.bufferStart+this.bufferPos;this.bufferPos+=v(t);let n=this.normalize(e);for(let t=0,s=i;;t++){let r=n.charCodeAt(t),o=this.match(r,s);if(o)return this.value=o,this;if(t==n.length-1)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=jc(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 Ic(e,t.sliceString(e,i));return zc.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=jc(this.text,i+(t==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ic.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function jc(t,e){if(e>=t.length)return e;let i,n=t.lineAt(e);for(;e=56320&&i<57344;)e++;return e}function Nc(t){let e=Mc("input",{class:"cm-textfield",name:"line"});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,a,l]=i,h=a?+a.slice(1):0,c=o?+o:s.number;if(o&&l){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)));t.dispatch({effects:Gc.of(!1),selection:A.cursor(u.from+Math.max(0,Math.min(h,u.length))),scrollIntoView:!0}),t.focus()}return{dom:Mc("form",{class:"cm-gotoLine",onkeydown:e=>{27==e.keyCode?(e.preventDefault(),t.dispatch({effects:Gc.of(!1)}),t.focus()):13==e.keyCode&&(e.preventDefault(),i())},onsubmit:t=>{t.preventDefault(),i()}},Mc("label",t.state.phrase("Go to line"),": ",e)," ",Mc("button",{class:"cm-button",type:"submit"},t.state.phrase("go")))}}"undefined"!=typeof Symbol&&(Lc.prototype[Symbol.iterator]=Bc.prototype[Symbol.iterator]=function(){return this});const Gc=ut.define(),Fc=q.define({create:()=>!0,update(t,e){for(let i of e.effects)i.is(Gc)&&(t=i.value);return t},provide:t=>Ur.from(t,(t=>t?Nc:null))}),Hc=Ts.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),Jc={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Kc=E.define({combine:t=>kt(t,Jc,{highlightWordAroundCursor:(t,e)=>t||e,minSelectionLength:Math.min,maxMatches:Math.min})});function tu(t){let e=[ru,su];return t&&e.push(Kc.of(t)),e}const eu=ni.mark({class:"cm-selectionMatch"}),iu=ni.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function nu(t,e,i,n){return!(0!=i&&t(e.sliceDoc(i-1,i))==wt.Word||n!=e.doc.length&&t(e.sliceDoc(n,n+1))==wt.Word)}const su=_i.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(Kc),{state:i}=t,n=i.selection;if(n.ranges.length>1)return ni.none;let s,r=n.main,o=null;if(r.empty){if(!e.highlightWordAroundCursor)return ni.none;let t=i.wordAt(r.head);if(!t)return ni.none;o=i.charCategorizer(r.head),s=i.sliceDoc(t.from,t.to)}else{let t=r.to-r.from;if(t200)return ni.none;if(e.wholeWords){if(s=i.sliceDoc(r.from,r.to),o=i.charCategorizer(r.head),!nu(o,i,r.from,r.to)||!function(t,e,i,n){return t(e.sliceDoc(i,i+1))==wt.Word&&t(e.sliceDoc(n-1,n))==wt.Word}(o,i,r.from,r.to))return ni.none}else if(s=i.sliceDoc(r.from,r.to).trim(),!s)return ni.none}let a=[];for(let n of t.visibleRanges){let t=new Uc(i.doc,s,n.from,n.to);for(;!t.next().done;){let{from:n,to:s}=t.value;if((!o||nu(o,i,n,s))&&(r.empty&&n<=r.from&&s>=r.to?a.push(iu.range(n,s)):(n>=r.to||s<=r.from)&&a.push(eu.range(n,s)),a.length>e.maxMatches))return ni.none}}return ni.set(a)}},{decorations:t=>t.decorations}),ru=Ts.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});const ou=E.define({combine:t=>kt(t,{top:!1,caseSensitive:!1,literal:!1,wholeWord:!1,createPanel:t=>new Eu(t),scrollToMatch:t=>Ts.scrollIntoView(t)})});class au{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,qc),!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 pu(this):new cu(this)}getCursor(t,e=0,i){let n=t.doc?t:xt.create({doc:t});return null==i&&(i=n.doc.length),this.regexp?uu(this,n,e,i):hu(this,n,e,i)}}class lu{constructor(t){this.spec=t}}function hu(t,e,i,n){return new Uc(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=hu(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 uu(t,e,i,n){return new Lc(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?(s=e.charCategorizer(e.selection.main.head),(t,e,i)=>!i[0].length||(s(du(i.input,i.index))!=wt.Word||s(fu(i.input,i.index))!=wt.Word)&&(s(fu(i.input,i.index+i[0].length))!=wt.Word||s(du(i.input,i.index+i[0].length))!=wt.Word)):void 0},i,n);var s}function du(t,e){return t.slice(f(t,e,!1),e)}function fu(t,e){return t.slice(e,f(t,e))}class pu extends lu{nextMatch(t,e,i){let n=uu(this.spec,t,i,t.doc.length).next();return n.done&&(n=uu(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=uu(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=uu(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 Ou=ut.define(),gu=ut.define(),mu=q.define({create:t=>new bu(_u(t).create(),null),update(t,e){for(let i of e.effects)i.is(Ou)?t=new bu(i.value.create(),t.panel):i.is(gu)&&(t=new bu(t.query,i.value?Cu:null));return t},provide:t=>Ur.from(t,(t=>t.panel))});class bu{constructor(t,e){this.query=t,this.panel=e}}const wu=ni.mark({class:"cm-searchMatch"}),vu=ni.mark({class:"cm-searchMatch cm-searchMatch-selected"}),yu=_i.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(mu))}update(t){let e=t.state.field(mu);(e!=t.startState.field(mu)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ni.none;let{view:i}=this,n=new Xt;for(let e=0,s=i.visibleRanges,r=s.length;es[e+1].from-500;)a=s[++e].to;t.highlight(i.state,o,a,((t,e)=>{let s=i.state.selection.ranges.some((i=>i.from==t&&i.to==e));n.add(t,e,s?vu:wu)}))}return n.finish()}},{decorations:t=>t.decorations});function Su(t){return e=>{let i=e.state.field(mu,!1);return i&&i.query.spec.valid?t(e,i):Au(e)}}const xu=Su(((t,{query:e})=>{let{to:i}=t.state.selection.main,n=e.nextMatch(t.state,i,i);if(!n)return!1;let s=A.single(n.from,n.to),r=t.state.facet(ou);return t.dispatch({selection:s,effects:[Wu(t,n),r.scrollToMatch(s.main,t)],userEvent:"select.search"}),Zu(t),!0})),ku=Su(((t,{query:e})=>{let{state:i}=t,{from:n}=i.selection.main,s=e.prevMatch(i,n,n);if(!s)return!1;let r=A.single(s.from,s.to),o=t.state.facet(ou);return t.dispatch({selection:r,effects:[Wu(t,s),o.scrollToMatch(r.main,t)],userEvent:"select.search"}),Zu(t),!0})),Qu=Su(((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!(!i||!i.length)&&(t.dispatch({selection:A.create(i.map((t=>A.range(t.from,t.to)))),userEvent:"select.search.matches"}),!0)})),$u=Su(((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,a,l=[],h=[];if(r.from==n&&r.to==s&&(a=i.toText(e.getReplacement(r)),l.push({from:r.from,to:r.to,insert:a}),r=e.nextMatch(i,r.from,r.to),h.push(Ts.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(n).number)+"."))),r){let e=0==l.length||l[0].from>=r.to?0:r.to-r.from-a.length;o=A.single(r.from-e,r.to-e),h.push(Wu(t,r)),h.push(i.facet(ou).scrollToMatch(o.main,t))}return t.dispatch({changes:l,selection:o,effects:h,userEvent:"input.replace"}),!0})),Pu=Su(((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:Ts.announce.of(n),userEvent:"input.replace.all"}),!0}));function Cu(t){return t.state.facet(ou).createPanel(t)}function _u(t,e){var i,n,s,r;let o=t.selection.main,a=o.empty||o.to>o.from+100?"":t.sliceDoc(o.from,o.to);if(e&&!a)return e;let l=t.facet(ou);return new au({search:(null!==(i=null==e?void 0:e.literal)&&void 0!==i?i:l.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:null!==(n=null==e?void 0:e.caseSensitive)&&void 0!==n?n:l.caseSensitive,literal:null!==(s=null==e?void 0:e.literal)&&void 0!==s?s:l.literal,wholeWord:null!==(r=null==e?void 0:e.wholeWord)&&void 0!==r?r:l.wholeWord})}function Xu(t){let e=Vr(t,Cu);return e&&e.dom.querySelector("[main-field]")}function Zu(t){let e=Xu(t);e&&e==t.root.activeElement&&e.select()}const Au=t=>{let e=t.state.field(mu,!1);if(e&&e.panel){let i=Xu(t);if(i&&i!=t.root.activeElement){let n=_u(t.state,e.query.spec);n.valid&&t.dispatch({effects:Ou.of(n)}),i.focus(),i.select()}}else t.dispatch({effects:[gu.of(!0),e?Ou.of(_u(t.state,e.query.spec)):ut.appendConfig.of(Yu)]});return!0},Tu=t=>{let e=t.state.field(mu,!1);if(!e||!e.panel)return!1;let i=Vr(t,Cu);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:gu.of(!1)}),!0},Ru=[{key:"Mod-f",run:Au,scope:"editor search-panel"},{key:"F3",run:xu,shift:ku,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:xu,shift:ku,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Tu,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 Uc(t.doc,t.sliceDoc(n,s));!e.next().done;){if(r.length>1e3)return!1;e.value.from==n&&(o=r.length),r.push(A.range(e.value.from,e.value.to))}return e(t.update({selection:A.create(r,o),userEvent:"select.search.matches"})),!0}},{key:"Alt-g",run:t=>{let e=Vr(t,Nc);if(!e){let i=[Gc.of(!0)];null==t.state.field(Fc,!1)&&i.push(ut.appendConfig.of([Fc,Hc])),t.dispatch({effects:i}),e=Vr(t,Nc)}return e&&e.dom.querySelector("input").focus(),!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=A.create(i.ranges.map((e=>t.wordAt(e.head)||A.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 Uc(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 Uc(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(A.range(s.from,s.to),!1),effects:Ts.scrollIntoView(s.to)})),!0)},preventDefault:!0}];class Eu{constructor(t){this.view=t;let e=this.query=t.state.field(mu).query.spec;function i(t,e,i){return Mc("button",{class:"cm-button",name:t,onclick:e,type:"button"},i)}this.commit=this.commit.bind(this),this.searchField=Mc("input",{value:e.search,placeholder:Vu(t,"Find"),"aria-label":Vu(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Mc("input",{value:e.replace,placeholder:Vu(t,"Replace"),"aria-label":Vu(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Mc("input",{type:"checkbox",name:"case",form:"",checked:e.caseSensitive,onchange:this.commit}),this.reField=Mc("input",{type:"checkbox",name:"re",form:"",checked:e.regexp,onchange:this.commit}),this.wordField=Mc("input",{type:"checkbox",name:"word",form:"",checked:e.wholeWord,onchange:this.commit}),this.dom=Mc("div",{onkeydown:t=>this.keydown(t),class:"cm-search"},[this.searchField,i("next",(()=>xu(t)),[Vu(t,"next")]),i("prev",(()=>ku(t)),[Vu(t,"previous")]),i("select",(()=>Qu(t)),[Vu(t,"all")]),...t.state.readOnly?[]:[Mc("br"),this.replaceField,i("replace",(()=>$u(t)),[Vu(t,"replace")]),i("replaceAll",(()=>Pu(t)),[Vu(t,"replace all")])],Mc("button",{name:"close",onclick:()=>Tu(t),"aria-label":Vu(t,"close"),type:"button"},["×"])])}commit(){let t=new au({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:Ou.of(t)}))}keydown(t){var e,i,n;e=this.view,i=t,n="search-panel",Bs(Ls(e.state),i,e,n)?t.preventDefault():13==t.keyCode&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?ku:xu)(this.view)):13==t.keyCode&&t.target==this.replaceField&&(t.preventDefault(),$u(this.view))}update(t){for(let e of t.transactions)for(let t of e.effects)t.is(Ou)&&!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(ou).top}}function Vu(t,e){return t.state.phrase(e)}const Mu=30,Du=/[\s\.,:;?!]/;function Wu(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-Mu),o=Math.min(s,i+Mu),a=t.state.sliceDoc(r,o);if(r!=n.from)for(let t=0;ta.length-Mu;t--)if(!Du.test(a[t-1])&&Du.test(a[t])){a=a.slice(0,t);break}return Ts.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${n.number}.`)}const Uu=Ts.baseTheme({".cm-panel.cm-search":{padding:"0.25rem 0.5rem 0.25rem 0.5rem",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"0.5rem",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"}}),Yu=[mu,N.lowest(yu),Uu];class qu{constructor(t,e,i){this.state=t,this.pos=e,this.explicit=i,this.abortListeners=[]}tokenBefore(t){let e=Xa(this.state).resolveInner(this.pos,-1);for(;e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null}matchBefore(t){let e=this.state.doc.lineAt(this.pos),i=Math.max(e.from,this.pos-250),n=e.text.slice(i-e.from,this.pos-e.from),s=n.search(ju(t,!1));return s<0?null:{from:i+s,to:this.pos,text:n.slice(s)}}get aborted(){return null==this.abortListeners}addEventListener(t,e){"abort"==t&&this.abortListeners&&this.abortListeners.push(e)}}function Lu(t){let e=Object.keys(t).join(""),i=/\w/.test(e);return i&&(e=e.replace(/\w/g,"")),`[${i?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function zu(t){let e=t.map((t=>"string"==typeof t?{label:t}:t)),[i,n]=e.every((t=>/^\w+$/.test(t.label)))?[/\w*$/,/\w+$/]:function(t){let e=Object.create(null),i=Object.create(null);for(let{label:n}of t){e[n[0]]=!0;for(let t=1;t{let s=t.matchBefore(n);return s||t.explicit?{from:s?s.from:t.pos,options:e,validFor:i}:null}}class Iu{constructor(t,e,i,n){this.completion=t,this.source=e,this.match=i,this.score=n}}function Bu(t){return t.selection.main.from}function ju(t,e){var i;let{source:n}=t,s=e&&"^"!=n[0],r="$"!=n[n.length-1];return s||r?new RegExp(`${s?"^":""}(?:${n})${r?"$":""}`,null!==(i=t.flags)&&void 0!==i?i:t.ignoreCase?"i":""):t}const Nu=lt.define();const Gu=new WeakMap;function Fu(t){if(!Array.isArray(t))return t;let e=Gu.get(t);return e||Gu.set(t,e=zu(t)),e}const Hu=ut.define(),Ju=ut.define();class Ku{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[];for(let e=0;e=48&&l<=57||l>=97&&l<=122?2:l>=65&&l<=90?1:0:(y=w(l))!=y.toLowerCase()?1:y!=y.toUpperCase()?2:0;(!n||1==S&&O||0==m&&0!=S)&&(e[c]==l||i[c]==l&&(u=!0)?r[c++]=n:r.length&&(g=!1)),m=S,n+=v(l)}return c==a&&0==r[0]&&g?this.result((u?-200:0)-100,r,t):d==a&&0==f?[-200-t.length+(p==t.length?0:-100),0,p]:o>-1?[-700-t.length,o,o+this.pattern.length]:d==a?[-900-t.length,f,p]:c==a?this.result((u?-200:0)-100-700+(g?0:-1100),r,t):2==e.length?null:this.result((n[0]?-700:0)-200-1100,n,t)}result(t,e,i){let n=[t-i.length],s=1;for(let t of e){let e=t+(this.astral?v(b(i,t)):1);s>1&&n[s-1]==t?n[s-1]=e:(n[s++]=t,n[s++]=e)}return n}}const td=E.define({combine:t=>kt(t,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:id,compareCompletions:(t,e)=>t.label.localeCompare(e.label),interactionDelay:75},{defaultKeymap:(t,e)=>t&&e,closeOnBlur:(t,e)=>t&&e,icons:(t,e)=>t&&e,tooltipClass:(t,e)=>i=>ed(t(i),e(i)),optionClass:(t,e)=>i=>ed(t(i),e(i)),addToOptions:(t,e)=>t.concat(e)})});function ed(t,e){return t?e?t+" "+e:t:e}function id(t,e,i,n,s){let r,o,a=t.textDirection==Wi.RTL,l=a,h=!1,c="top",u=e.left-s.left,d=s.right-e.right,f=n.right-n.left,p=n.bottom-n.top;if(l&&u=p||t>e.top?r=i.bottom-e.top:(c="bottom",r=e.bottom-i.top)}return{style:`${c}: ${r}px; max-width: ${o}px`,class:"cm-completionInfo-"+(h?a?"left-narrow":"right-narrow":l?"left":"right")}}function nd(t,e="option"){return i=>{let n=i.state.field(yd,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp-1?n.open.selected+r*(t?1:-1):t?0:o-1;return a<0?a="page"==e?0:o-1:a>=o&&(a="page"==e?o-1:0),i.dispatch({effects:vd.of(a)}),!0}}const sd=t=>{let e=t.state.field(yd,!1);return!(t.state.readOnly||!e||!e.open||e.open.selected<0||Date.now()-e.open.timestamp(t.selection||t.docChanged)&&!gd(t)));for(let e=0;e50&&Date.now()-n.time>1e3){for(let t of n.context.abortListeners)try{t()}catch(t){Qi(this.view.state,t)}n.context.abortListeners=null,this.running.splice(e--,1)}else n.updates.push(...t.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some((t=>1==t.state&&!this.running.some((e=>e.active.source==t.source))))?setTimeout((()=>this.startUpdate()),50):-1,0!=this.composing)for(let e of t.transactions)"input"==gd(e)?this.composing=2:2==this.composing&&e.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:t}=this.view,e=t.field(yd);for(let t of e.active)1!=t.state||this.running.some((e=>e.active.source==t.source))||this.startQuery(t)}startQuery(t){let{state:e}=this.view,i=Bu(e),n=new qu(e,i,t.explicitPos==i),s=new rd(t,n);this.running.push(s),Promise.resolve(t.source(n)).then((t=>{s.context.aborted||(s.done=t||null,this.scheduleAccept())}),(t=>{this.view.dispatch({effects:Ju.of(null)}),Qi(this.view.state,t)}))}scheduleAccept(){this.running.every((t=>void 0!==t.done))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((()=>this.accept()),50))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],i=this.view.state.facet(td);for(let n=0;nt.source==s.active.source));if(r&&1==r.state)if(null==s.done){let t=new md(s.active.source,0);for(let e of s.updates)t=t.update(e,i);1!=t.state&&e.push(t)}else this.startQuery(r)}e.length&&this.view.dispatch({effects:wd.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(yd,!1);if(e&&e.tooltip&&this.view.state.facet(td).closeOnBlur){let i=e.open&&Rr(this.view,e.open.tooltip);i&&i.dom.contains(t.relatedTarget)||this.view.dispatch({effects:Ju.of(null)})}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout((()=>this.view.dispatch({effects:Hu.of(!1)})),20),this.composing=0}}});function ad(t,e){const i=e.completion.apply||e.completion.label;let n=t.state.field(yd).active.find((t=>t.source==e.source));return n instanceof bd&&("string"==typeof i?t.dispatch(Object.assign(Object.assign({},function(t,e,i,n){let{main:s}=t.selection,r=i-s.from,o=n-s.from;return Object.assign(Object.assign({},t.changeByRange((a=>a!=s&&i!=n&&t.sliceDoc(a.from+r,a.from+o)!=t.sliceDoc(i,n)?{range:a}:{changes:{from:a.from+r,to:n==s.from?a.to:a.from+o,insert:e},range:A.cursor(a.from+r+e.length)}))),{userEvent:"input.complete"})}(t.state,i,n.from,n.to)),{annotations:Nu.of(e.completion)})):i(t,e.completion,n.from,n.to),!0)}function ld(t,e,i){if(t<=i)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let t=Math.floor(e/i);return{from:t*i,to:(t+1)*i}}let n=Math.floor((t-e)/i);return{from:t-(n+1)*i,to:t-n*i}}class hd{constructor(t,e){this.view=t,this.stateField=e,this.info=null,this.placeInfoReq={read:()=>this.measureInfo(),write:t=>this.placeInfo(t),key:this},this.space=null,this.currentClass="";let i=t.state.field(e),{options:n,selected:s}=i.open,r=t.state.facet(td);this.optionContent=function(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(t){let e=document.createElement("div");return e.classList.add("cm-completionIcon"),t.type&&e.classList.add(...t.type.split(/\s+/g).map((t=>"cm-completionIcon-"+t))),e.setAttribute("aria-hidden","true"),e},position:20}),e.push({render(t,e,i){let n=document.createElement("span");n.className="cm-completionLabel";let{label:s}=t,r=0;for(let t=1;tr&&n.appendChild(document.createTextNode(s.slice(r,e)));let a=n.appendChild(document.createElement("span"));a.appendChild(document.createTextNode(s.slice(e,o))),a.className="cm-completionMatchedText",r=o}return rt.position-e.position)).map((t=>t.render))}(r),this.optionClass=r.optionClass,this.tooltipClass=r.tooltipClass,this.range=ld(n.length,s,r.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",(e=>{for(let i,s=e.target;s&&s!=this.dom;s=s.parentNode)if("LI"==s.nodeName&&(i=/-(\d+)$/.exec(s.id))&&+i[1]{let i=t.state.field(this.stateField,!1);i&&i.tooltip&&t.state.facet(td).closeOnBlur&&e.relatedTarget!=t.contentDOM&&t.dispatch({effects:Ju.of(null)})})),this.list=this.dom.appendChild(this.createListBox(n,i.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))}mount(){this.updateSel()}update(t){var e,i,n;let s=t.state.field(this.stateField),r=t.startState.field(this.stateField);this.updateTooltipClass(t.state),s!=r&&(this.updateSel(),(null===(e=s.open)||void 0===e?void 0:e.disabled)!=(null===(i=r.open)||void 0===i?void 0:i.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!(null===(n=s.open)||void 0===n?void 0:n.disabled)))}updateTooltipClass(t){let e=this.tooltipClass(t);if(e!=this.currentClass){for(let t of this.currentClass.split(" "))t&&this.dom.classList.remove(t);for(let t of e.split(" "))t&&this.dom.classList.add(t);this.currentClass=e}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),e=t.open;if((e.selected>-1&&e.selected=this.range.to)&&(this.range=ld(e.options.length,e.selected,this.view.state.facet(td).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e.options,t.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))),this.updateSelectedOption(e.selected)){this.info&&(this.info.remove(),this.info=null);let{completion:i}=e.options[e.selected],{info:n,label:s,c:r}=i;if(!n)return;let o="string"==typeof n?document.createTextNode(n+" "):n(i);if(!o)return;if(!r){const t=document.createElement("span");t.appendChild(o),o=t;const e=document.createElement("a");e.innerText="🔎",e.href="/docFind/"+s,e.target="blank",o.appendChild(e)}if(!o)return;"then"in o?o.then((e=>{e&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(e)})).catch((t=>Qi(this.view.state,t,"completion info"))):this.addInfoPane(o)}}addInfoPane(t){let e=this.info=document.createElement("div");e.className="cm-tooltip cm-completionInfo",e.appendChild(t),this.dom.appendChild(e),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let e=null;for(let i=this.list.firstChild,n=this.range.from;i;i=i.nextSibling,n++)"LI"==i.nodeName&&i.id?n==t?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),e=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected"):n--;return e&&function(t,e){let i=t.getBoundingClientRect(),n=e.getBoundingClientRect();n.topi.bottom&&(t.scrollTop+=n.bottom-i.bottom)}(this.list,e),e}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let e=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),n=t.getBoundingClientRect(),s=this.space;if(!s){let t=this.dom.ownerDocument.defaultView||window;s={left:0,top:0,right:t.innerWidth,bottom:t.innerHeight}}return n.top>Math.min(s.bottom,e.bottom)-10||n.bottomi.from||0==i.from))if(s=t,"string"!=typeof l&&l.header)n.appendChild(l.header(l));else{n.appendChild(document.createElement("completion-section")).textContent=t}}const h=n.appendChild(document.createElement("li"));h.id=e+"-"+r,h.setAttribute("role","option");let c=this.optionClass(o);c&&(h.className=c);for(let t of this.optionContent){let e=t(o,this.view.state,a);e&&h.appendChild(e)}}return i.from&&n.classList.add("cm-completionListIncompleteTop"),i.to=this.options.length?this:new ud(this.options,pd(e,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,e,i,n,s){let r=function(t,e){let i=[],n=null,s=t=>{i.push(t);let{section:e}=t.completion;if(e){n||(n=[]);let t="string"==typeof e?e:e.name;n.some((e=>e.name==t))||n.push("string"==typeof e?{name:t}:e)}};for(let n of t)if(n.hasResult())if(!1===n.result.filter){let t=n.result.getMatch;for(let e of n.result.options){let r=[1e9-i.length];if(t)for(let i of t(e))r.push(i);s(new Iu(e,n.source,r,r[0]))}}else{let t,i=new Ku(e.sliceDoc(n.from,n.to));for(let e of n.result.options)(t=i.match(e.label))&&s(new Iu(e,n.source,t,t[0]+(e.boost||0)))}if(n){let t=Object.create(null),e=0,s=(t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:1e9)-(null!==(n=e.rank)&&void 0!==n?n:1e9)||(t.namee.score-t.score||a(t.completion,e.completion))))!o||o.label!=t.completion.label||o.detail!=t.completion.detail||null!=o.type&&null!=t.completion.type&&o.type!=t.completion.type||o.apply!=t.completion.apply?r.push(t):cd(t.completion)>cd(o)&&(r[r.length-1]=t),o=t.completion;return r}(t,e);if(!r.length)return n&&t.some((t=>1==t.state))?new ud(n.options,n.attrs,n.tooltip,n.timestamp,n.selected,!0):null;let o=e.facet(td).selectOnOpen?0:-1;if(n&&n.selected!=o&&-1!=n.selected){let t=n.options[n.selected].completion;for(let e=0;ee.hasResult()?Math.min(t,e.from):t),1e8),create:(a=yd,t=>new hd(t,a)),above:s.aboveCursor},n?n.timestamp:Date.now(),o,!1);var a}map(t){return new ud(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class dd{constructor(t,e,i){this.active=t,this.id=e,this.open=i}static start(){return new dd(Od,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(t){let{state:e}=t,i=e.facet(td),n=(i.override||e.languageDataAt("autocomplete",Bu(e)).map(Fu)).map((e=>(this.active.find((t=>t.source==e))||new md(e,this.active.some((t=>0!=t.state))?1:0)).update(t,i)));n.length==this.active.length&&n.every(((t,e)=>t==this.active[e]))&&(n=this.active);let s=this.open;s&&t.docChanged&&(s=s.map(t.changes)),t.selection||n.some((e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to)))||!function(t,e){if(t==e)return!0;for(let i=0,n=0;;){for(;i1==t.state))&&(s=null),!s&&n.every((t=>1!=t.state))&&n.some((t=>t.hasResult()))&&(n=n.map((t=>t.hasResult()?new md(t.source,0):t)));for(let e of t.effects)e.is(vd)&&(s=s&&s.setSelected(e.value,this.id));return n==this.active&&s==this.open?this:new dd(n,this.id,s)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:fd}}const fd={"aria-autocomplete":"list"};function pd(t,e){let i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(i["aria-activedescendant"]=t+"-"+e),i}const Od=[];function gd(t){return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null}class md{constructor(t,e,i=-1){this.source=t,this.state=e,this.explicitPos=i}hasResult(){return!1}update(t,e){let i=gd(t),n=this;i?n=n.handleUserEvent(t,i,e):t.docChanged?n=n.handleChange(t):t.selection&&0!=n.state&&(n=new md(n.source,0));for(let e of t.effects)if(e.is(Hu))n=new md(n.source,1,e.value?Bu(t.state):-1);else if(e.is(Ju))n=new md(n.source,0);else if(e.is(wd))for(let t of e.value)t.source==n.source&&(n=t);return n}handleUserEvent(t,e,i){return"delete"!=e&&i.activateOnTyping?new md(this.source,1):this.map(t.changes)}handleChange(t){return t.changes.touchesRange(Bu(t.startState))?new md(this.source,0):this.map(t.changes)}map(t){return t.empty||this.explicitPos<0?this:new md(this.source,this.state,t.mapPos(this.explicitPos))}}class bd extends md{constructor(t,e,i,n,s){super(t,2,e),this.result=i,this.from=n,this.to=s}hasResult(){return!0}handleUserEvent(t,e,i){var n;let s=t.changes.mapPos(this.from),r=t.changes.mapPos(this.to,1),o=Bu(t.state);if((this.explicitPos<0?o<=s:or||"delete"==e&&Bu(t.startState)==this.from)return new md(this.source,"input"==e&&i.activateOnTyping?1:0);let a,l=this.explicitPos<0?-1:t.changes.mapPos(this.explicitPos);return function(t,e,i,n){if(!t)return!1;let s=e.sliceDoc(i,n);return"function"==typeof t?t(s,i,n,e):ju(t,!0).test(s)}(this.result.validFor,t.state,s,r)?new bd(this.source,l,this.result,s,r):this.result.update&&(a=this.result.update(this.result,s,r,new qu(t.state,o,l>=0)))?new bd(this.source,l,a,a.from,null!==(n=a.to)&&void 0!==n?n:Bu(t.state)):new md(this.source,1,l)}handleChange(t){return t.changes.touchesRange(this.from,this.to)?new md(this.source,0):this.map(t.changes)}map(t){return t.empty?this:new bd(this.source,this.explicitPos<0?-1:t.mapPos(this.explicitPos),this.result,t.mapPos(this.from),t.mapPos(this.to,1))}}const wd=ut.define({map:(t,e)=>t.map((t=>t.map(e)))}),vd=ut.define(),yd=q.define({create:()=>dd.start(),update:(t,e)=>t.update(e),provide:t=>[Tr.from(t,(t=>t.tooltip)),Ts.contentAttributes.from(t,(t=>t.attrs))]}),Sd=Ts.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class xd{constructor(t,e,i,n){this.field=t,this.line=e,this.from=i,this.to=n}}class kd{constructor(t,e,i){this.field=t,this.from=e,this.to=i}map(t){let e=t.mapPos(this.from,-1,S.TrackDel),i=t.mapPos(this.to,1,S.TrackDel);return null==e||null==i?null:new kd(this.field,e,i)}}class Qd{constructor(t,e){this.lines=t,this.fieldPositions=e}instantiate(t,e){let i=[],n=[e],s=t.doc.lineAt(e),r=/^\s*/.exec(s.text)[0];for(let s of this.lines){if(i.length){let i=r,o=/^\t*/.exec(s)[0].length;for(let e=0;enew kd(t.field,n[t.line]+t.from,n[t.line]+t.to)));return{text:i,ranges:o}}static parse(t){let e,i=[],n=[],s=[];for(let r of t.split(/\r\n?|\n/)){for(;e=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(r);){let t=e[1]?+e[1]:null,o=e[2]||e[3]||"",a=-1;for(let e=0;e=a&&t.field++}s.push(new xd(a,n.length,e.index,e.index+o.length)),r=r.slice(0,e.index)+o+r.slice(e.index+e[0].length)}for(let t;t=/\\([{}])/.exec(r);){r=r.slice(0,t.index)+t[1]+r.slice(t.index+t[0].length);for(let e of s)e.line==n.length&&e.from>t.index&&(e.from--,e.to--)}n.push(r)}return new Qd(n,s)}}let $d=ni.widget({widget:new class extends ei{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),Pd=ni.mark({class:"cm-snippetField"});class Cd{constructor(t,e){this.ranges=t,this.active=e,this.deco=ni.set(t.map((t=>(t.from==t.to?$d:Pd).range(t.from,t.to))))}map(t){let e=[];for(let i of this.ranges){let n=i.map(t);if(!n)return null;e.push(n)}return new Cd(e,this.active)}selectionInsideField(t){return t.ranges.every((t=>this.ranges.some((e=>e.field==this.active&&e.from<=t.from&&e.to>=t.to))))}}const _d=ut.define({map:(t,e)=>t&&t.map(e)}),Xd=ut.define(),Zd=q.define({create:()=>null,update(t,e){for(let i of e.effects){if(i.is(_d))return i.value;if(i.is(Xd)&&t)return new Cd(t.ranges,i.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>Ts.decorations.from(t,(t=>t?t.deco:ni.none))});function Ad(t,e){return A.create(t.filter((t=>t.field==e)).map((t=>A.range(t.from,t.to))))}function Td(e){let i=Qd.parse(e);return(e,n,s,r)=>{let{text:o,ranges:a}=i.instantiate(e.state,s),l={changes:{from:s,to:r,insert:t.of(o)},scrollIntoView:!0,annotations:n?Nu.of(n):void 0};if(a.length&&(l.selection=Ad(a,0)),a.length>1){let t=new Cd(a,0),i=l.effects=[_d.of(t)];void 0===e.state.field(Zd,!1)&&i.push(ut.appendConfig.of([Zd,Md,Wd,Sd]))}e.dispatch(e.state.update(l))}}function Rd(t){return({state:e,dispatch:i})=>{let n=e.field(Zd,!1);if(!n||t<0&&0==n.active)return!1;let s=n.active+t,r=t>0&&!n.ranges.some((e=>e.field==s+t));return i(e.update({selection:Ad(n.ranges,s),effects:_d.of(r?null:new Cd(n.ranges,s))})),!0}}const Ed=[{key:"Tab",run:Rd(1),shift:Rd(-1)},{key:"Escape",run:({state:t,dispatch:e})=>!!t.field(Zd,!1)&&(e(t.update({effects:_d.of(null)})),!0)}],Vd=E.define({combine:t=>t.length?t[0]:Ed}),Md=N.highest(Ys.compute([Vd],(t=>t.facet(Vd))));function Dd(t,e){return Object.assign(Object.assign({},e),{apply:Td(t)})}const Wd=Ts.domEventHandlers({mousedown(t,e){let i,n=e.state.field(Zd,!1);if(!n||null==(i=e.posAtCoords({x:t.clientX,y:t.clientY})))return!1;let s=n.ranges.find((t=>t.from<=i&&t.to>=i));return!(!s||s.field==n.active)&&(e.dispatch({selection:Ad(n.ranges,s.field),effects:_d.of(n.ranges.some((t=>t.field>s.field))?new Cd(n.ranges,s.field):null)}),!0)}}),Ud=new class extends Qt{};function Yd(t={}){return[yd,td.of(t),od,Ld,Sd]}Ud.startSide=1,Ud.endSide=-1;const qd=[{key:"Ctrl-Space",run:t=>!!t.state.field(yd,!1)&&(t.dispatch({effects:Hu.of(!0)}),!0)},{key:"Escape",run:t=>{let e=t.state.field(yd,!1);return!(!e||!e.active.some((t=>0!=t.state)))&&(t.dispatch({effects:Ju.of(null)}),!0)}},{key:"ArrowDown",run:nd(!0)},{key:"ArrowUp",run:nd(!1)},{key:"PageDown",run:nd(!0,"page")},{key:"PageUp",run:nd(!1,"page")},{key:"Enter",run:sd}],Ld=N.highest(Ys.computeN([td],(t=>t.facet(td).defaultKeymap?[qd]:[]))),zd=(()=>[vr(),Sh(),ir(),$l(_l,{fallback:!0}),Ys.of([...Vc,...Wh])])();class Id{constructor(t,e,i,n,s,r,o,a,l,h=0,c){this.p=t,this.stack=e,this.state=i,this.reducePos=n,this.pos=s,this.score=r,this.buffer=o,this.bufferBase=a,this.curContext=l,this.lookAhead=h,this.parent=c}toString(){return`[${this.stack.filter(((t,e)=>e%3==0)).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,i=0){let n=t.parser.context;return new Id(t,[],e,i,i,0,[],0,n?new Bd(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let i=t>>19,n=65535&t,{parser:s}=this.p,r=s.dynamicPrecedence(n);if(r&&(this.score+=r),0==i)return this.pushState(s.getGoto(this.state,n,!0),this.reducePos),n=2e3&&!(null===(e=this.p.parser.nodeSet.types[n])||void 0===e?void 0:e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=l):this.p.lastBigReductionSizeo;)this.stack.pop();this.reduceContext(n,a)}storeNode(t,e,i,n=4,s=!1){if(0==t&&(!this.stack.length||this.stack[this.stack.length-1]0&&0==t.buffer[n-4]&&t.buffer[n-1]>-1){if(e==i)return;if(t.buffer[n-2]>=e)return void(t.buffer[n-2]=i)}}if(s&&this.pos!=i){let s=this.buffer.length;if(s>0&&0!=this.buffer[s-4])for(;s>0&&this.buffer[s-2]>i;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,n>4&&(n-=4);this.buffer[s]=t,this.buffer[s+1]=e,this.buffer[s+2]=i,this.buffer[s+3]=n}else this.buffer.push(t,e,i,n)}shift(t,e,i){let n=this.pos;if(131072&t)this.pushState(65535&t,this.pos);else if(0==(262144&t)){let s=t,{parser:r}=this.p;(i>this.pos||e<=r.maxNode)&&(this.pos=i,r.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,n),this.shiftContext(e,n),e<=r.maxNode&&this.buffer.push(e,n,i,4)}else this.pos=i,this.shiftContext(e,n),e<=this.p.parser.maxNode&&this.buffer.push(e,n,i,4)}apply(t,e,i){65536&t?this.reduce(t):this.shift(t,e,i)}useNode(t,e){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=t)&&(this.p.reused.push(t),i++);let n=this.pos;this.reducePos=this.pos=n+t.length,this.pushState(e,n),this.buffer.push(i,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let i=t.buffer.slice(e),n=t.bufferBase+e;for(;t&&n==t.bufferBase;)t=t.parent;return new Id(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,n,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let i=t<=this.p.parser.maxNode;i&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,i?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new Nd(this);;){let i=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(0==i)return!1;if(0==(65536&i))return!0;e.reduce(i)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let n,s=0;s1&e&&t==n))||i.push(e[t],n)}e=i}let i=[];for(let t=0;t>19,n=65535&t,s=this.stack.length-3*i;if(s<0||e.getGoto(this.stack[s],n,!1)<0)return!1;this.storeNode(0,this.reducePos,this.reducePos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:t}=this.p;return 65535==t.data[t.stateSlot(this.state,1)]&&!t.stateSlot(this.state,4)}restart(){this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;ethis.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Bd{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}var jd;!function(t){t[t.Insert=200]="Insert",t[t.Delete=190]="Delete",t[t.Reduce=100]="Reduce",t[t.MaxNext=4]="MaxNext",t[t.MaxInsertStackDepth=300]="MaxInsertStackDepth",t[t.DampenInsertStackDepth=120]="DampenInsertStackDepth",t[t.MinBigReduction=2e3]="MinBigReduction"}(jd||(jd={}));class Nd{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=65535&t,i=t>>19;0==i?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(i-1);let n=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=n}}class Gd{constructor(t,e,i){this.stack=t,this.pos=e,this.index=i,this.buffer=t.buffer,0==this.index&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new Gd(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;null!=t&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new Gd(this.stack,this.pos,this.index)}}function Fd(t,e=Uint16Array){if("string"!=typeof t)return t;let i=null;for(let n=0,s=0;n=92&&e--,e>=34&&e--;let s=e-32;if(s>=46&&(s-=46,i=!0),r+=s,i)break;r*=46}i?i[s++]=r:i=new e(r)}return i}class Hd{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Jd=new Hd;class Kd{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Jd,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let i=this.range,n=this.rangeIndex,s=this.pos+t;for(;si.to:s>=i.to;){if(n==this.ranges.length-1)return null;let t=this.ranges[++n];s+=t.from-i.to,i=t}return s}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,e.from);return this.end}peek(t){let e,i,n=this.chunkOff+t;if(n>=0&&n=this.chunk2Pos&&en.to&&(this.chunk2=this.chunk2.slice(0,n.to-e)),i=this.chunk2.charCodeAt(0)}}return e>=this.token.lookAhead&&(this.token.lookAhead=e+1),i}acceptToken(t,e=0){let i=e?this.resolveOffset(e,-1):this.pos;if(null==i||i=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=Jd,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let i="";for(let n of this.ranges){if(n.from>=e)break;n.to>t&&(i+=this.input.read(Math.max(n.from,t),Math.min(n.to,e)))}return i}}class tf{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:i}=e.p;sf(this.data,t,e,this.id,i.data,i.tokenPrecTable)}}tf.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class ef{constructor(t,e,i){this.precTable=e,this.elseToken=i,this.data="string"==typeof t?Fd(t):t}token(t,e){let i=t.pos,n=0;for(;sf(this.data,t,e,0,this.data,this.precTable),!(t.token.value>-1);){if(null==this.elseToken)return;if(t.next<0)break;t.advance(),t.reset(t.pos,t.token),n++}n&&(t.reset(i,t.token),t.acceptToken(this.elseToken,n))}}ef.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class nf{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function sf(t,e,i,n,s,r){let o=0,a=1<0){let i=t[n];if(l.allows(i)&&(-1==e.token.value||e.token.value==i||of(i,e.token.value,s,r))){e.acceptToken(i);break}}let n=e.next,h=0,c=t[o+2];if(!(e.next<0&&c>h&&65535==t[i+3*c-3]&&65535==t[i+3*c-3])){for(;h>1,r=i+s+(s<<1),a=t[r],l=t[r+1]||65536;if(n=l)){o=t[r+2],e.advance();continue t}h=s+1}}break}o=t[i+3*c-1]}}function rf(t,e,i){for(let n,s=e;65535!=(n=t[s]);s++)if(n==i)return s-e;return-1}function of(t,e,i,n){let s=rf(i,n,e);return s<0||rf(i,n,t)e)&&!n.type.isError)return i<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(t.length,Math.max(n.from+1,e+25));if(i<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return i<0?0:t.length}}!function(t){t[t.Margin=25]="Margin"}(hf||(hf={}));let uf=class{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?cf(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?cf(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=r,null;if(s instanceof bo){if(r==t){if(r=Math.max(this.safeFrom,t)&&(this.trees.push(s),this.start.push(r),this.index.push(0))}else this.index[e]++,this.nextStart=r+s.length}}};class df{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map((t=>new Hd))}getActions(t){let e=0,i=null,{parser:n}=t.p,{tokenizers:s}=n,r=n.stateSlot(t.state,3),o=t.curContext?t.curContext.hash:0,a=0;for(let n=0;nh.end+25&&(a=Math.max(h.lookAhead,a)),0!=h.value)){let n=e;if(h.extended>-1&&(e=this.addActions(t,h.extended,h.end,e)),e=this.addActions(t,h.value,h.end,e),!l.extend&&(i=h,e>n))break}}for(;this.actions.length>e;)this.actions.pop();return a&&t.setLookAhead(a),i||t.pos!=this.stream.end||(i=new Hd,i.value=t.p.parser.eofTerm,i.start=i.end=t.pos,e=this.addActions(t,i.value,i.end,e)),this.mainToken=i,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new Hd,{pos:i,p:n}=t;return e.start=i,e.end=Math.min(i+1,n.stream.end),e.value=i==n.stream.end?n.parser.eofTerm:0,e}updateCachedToken(t,e,i){let n=this.stream.clipPos(i.pos);if(e.token(this.stream.reset(n,t),i),t.value>-1){let{parser:e}=i.p;for(let n=0;n=0&&i.p.parser.dialect.allows(s>>1)){0==(1&s)?t.value=s>>1:t.extended=s>>1;break}}}else t.value=0,t.end=this.stream.clipPos(n+1)}putAction(t,e,i,n){for(let e=0;e4*t.bufferLength?new uf(i,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t,e,i=this.stacks,n=this.minStackPos,s=this.stacks=[];if(this.bigReductionCount>300&&1==i.length){let[t]=i;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;rn)s.push(o);else{if(this.advanceStack(o,s,i))continue;{t||(t=[],e=[]),t.push(o);let i=this.tokens.getMainToken(o);e.push(i.value,i.end)}}break}}if(!s.length){let e=t&&function(t){let e=null;for(let i of t){let t=i.p.stoppedAt;(i.pos==i.p.stream.end||null!=t&&i.pos>t)&&i.p.parser.stateFlag(i.state,2)&&(!e||e.scorethis.stoppedAt?t[0]:this.runRecovery(t,e,s);if(i)return this.stackToTree(i.forceAll())}if(this.recovering){let t=1==this.recovering?1:3*this.recovering;if(s.length>t)for(s.sort(((t,e)=>e.score-t.score));s.length>t;)s.pop();s.some((t=>t.reducePos>n))&&this.recovering--}else if(s.length>1){t:for(let t=0;t500&&n.buffer.length>500){if(!((e.score-n.score||e.buffer.length-n.buffer.length)>0)){s.splice(t--,1);continue t}s.splice(i--,1)}}}s.length>12&&s.splice(12,s.length-12)}this.minStackPos=s[0].pos;for(let t=1;t ":"";if(null!=this.stoppedAt&&n>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let e=t.curContext&&t.curContext.tracker.strict,i=e?t.curContext.hash:0;for(let o=this.fragments.nodeAt(n);o;){let n=this.parser.nodeSet.types[o.type.id]==o.type?s.getGoto(t.state,o.type.id):-1;if(n>-1&&o.length&&(!e||(o.prop(ho.contextHash)||0)==i))return t.useNode(o,n),af&&console.log(r+this.stackID(t)+` (via reuse of ${s.getName(o.type.id)})`),!0;if(!(o instanceof bo)||0==o.children.length||o.positions[0]>0)break;let a=o.children[0];if(!(a instanceof bo&&0==o.positions[0]))break;o=a}}let o=s.stateSlot(t.state,4);if(o>0)return t.reduce(o),af&&console.log(r+this.stackID(t)+` (via always-reduce ${s.getName(65535&o)})`),!0;if(t.stack.length>=15e3)for(;t.stack.length>9e3&&t.forceReduce(););let a=this.tokens.getActions(t);for(let o=0;on?e.push(d):i.push(d)}return!1}advanceFully(t,e){let i=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>i)return Of(t,e),!0}}runRecovery(t,e,i){let n=null,s=!1;for(let r=0;r ":"";if(o.deadEnd){if(s)continue;if(s=!0,o.restart(),af&&console.log(h+this.stackID(o)+" (restarted)"),this.advanceFully(o,i))continue}let c=o.split(),u=h;for(let t=0;c.forceReduce()&&t<10;t++){if(af&&console.log(u+this.stackID(c)+" (via force-reduce)"),this.advanceFully(c,i))break;af&&(u=this.stackID(c)+" -> ")}for(let t of o.recoverByInsert(a))af&&console.log(h+this.stackID(t)+" (via recover-insert)"),this.advanceFully(t,i);this.stream.end>o.pos?(l==o.pos&&(l++,a=0),o.recoverByDelete(a,l),af&&console.log(h+this.stackID(o)+` (via recover-delete ${this.parser.getName(a)})`),Of(o,i)):(!n||n.scoret;class bf{constructor(t){this.start=t.start,this.shift=t.shift||mf,this.reduce=t.reduce||mf,this.reuse=t.reuse||mf,this.hash=t.hash||(()=>0),this.strict=!1!==t.strict}}class wf extends Vo{constructor(t){if(super(),this.wrappers=[],14!=t.version)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let i=0;it.topRules[e][1])),n=[];for(let t=0;t=0)s(n,t,e[i++]);else{let r=e[i+-n];for(let o=-n;o>0;o--)s(e[i++],t,r);i++}}}this.nodeSet=new po(e.map(((e,s)=>fo.define({name:s>=this.minRepeatTerm?void 0:e,id:s,props:n[s],top:i.indexOf(s)>-1,error:0==s,skipped:t.skippedNodes&&t.skippedNodes.indexOf(s)>-1})))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=oo;let r=Fd(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let t=0;t"number"==typeof t?new tf(r,t):t)),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,i){let n=new pf(this,t,e,i);for(let s of this.wrappers)n=s(n,t,e,i);return n}getGoto(t,e,i=!1){let n=this.goto;if(e>=n[0])return-1;for(let s=n[e+1];;){let e=n[s++],r=1&e,o=n[s++];if(r&&i)return o;for(let i=s+(e>>1);s0}validAction(t,e){if(e==this.stateSlot(t,4))return!0;for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])return!1;i=vf(this.data,i+2)}if(e==vf(this.data,i+1))return!0}}nextStates(t){let e=[];for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])break;i=vf(this.data,i+2)}if(0==(1&this.data[i+2])){let t=this.data[i+1];e.some(((e,i)=>1&i&&e==t))||e.push(this.data[i],t)}}return e}configure(t){let e=Object.assign(Object.create(wf.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let i=this.topRules[t.top];if(!i)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=i}return t.tokenizers&&(e.tokenizers=this.tokenizers.map((e=>{let i=t.tokenizers.find((t=>t.from==e));return i?i.to:e}))),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map(((i,n)=>{let s=t.specializers.find((t=>t.from==i.external));if(!s)return i;let r=Object.assign(Object.assign({},i),{external:s.to});return e.specializers[n]=yf(r),r}))),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),null!=t.strict&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),null!=t.bufferLength&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return null==e?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),i=e.map((()=>!1));if(t)for(let n of t.split(" ")){let t=e.indexOf(n);t>=0&&(i[t]=!0)}let n=null;for(let t=0;tt.external(i,n)<<1|e}return t.get}const Sf=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],xf=new bf({start:!1,shift:(t,e)=>3==e||4==e||305==e?t:306==e,strict:!1}),kf=new nf(((t,e)=>{let{next:i}=t;(125==i||-1==i||e.context)&&e.canShift(303)&&t.acceptToken(303)}),{contextual:!0,fallback:!0}),Qf=new nf(((t,e)=>{let i,{next:n}=t;Sf.indexOf(n)>-1||(47!=n||47!=(i=t.peek(1))&&42!=i)&&125!=n&&59!=n&&-1!=n&&!e.context&&e.canShift(302)&&t.acceptToken(302)}),{contextual:!0}),$f=new nf(((t,e)=>{let{next:i}=t;if((43==i||45==i)&&(t.advance(),i==t.next)){t.advance();let i=!e.context&&e.canShift(1);t.acceptToken(i?1:2)}}),{contextual:!0}),Pf=ea({"get set async static":Sa.modifier,"for while do if else switch try catch finally return throw break continue default case":Sa.controlKeyword,"in of await yield void typeof delete instanceof":Sa.operatorKeyword,"let var const function class extends":Sa.definitionKeyword,"import export from":Sa.moduleKeyword,"with debugger as new":Sa.keyword,TemplateString:Sa.special(Sa.string),super:Sa.atom,BooleanLiteral:Sa.bool,this:Sa.self,null:Sa.null,Star:Sa.modifier,VariableName:Sa.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":Sa.function(Sa.variableName),VariableDefinition:Sa.definition(Sa.variableName),Label:Sa.labelName,PropertyName:Sa.propertyName,PrivatePropertyName:Sa.special(Sa.propertyName),"CallExpression/MemberExpression/PropertyName":Sa.function(Sa.propertyName),"FunctionDeclaration/VariableDefinition":Sa.function(Sa.definition(Sa.variableName)),"ClassDeclaration/VariableDefinition":Sa.definition(Sa.className),PropertyDefinition:Sa.definition(Sa.propertyName),PrivatePropertyDefinition:Sa.definition(Sa.special(Sa.propertyName)),UpdateOp:Sa.updateOperator,LineComment:Sa.lineComment,BlockComment:Sa.blockComment,Number:Sa.number,String:Sa.string,Escape:Sa.escape,ArithOp:Sa.arithmeticOperator,LogicOp:Sa.logicOperator,BitOp:Sa.bitwiseOperator,CompareOp:Sa.compareOperator,RegExp:Sa.regexp,Equals:Sa.definitionOperator,Arrow:Sa.function(Sa.punctuation),": Spread":Sa.punctuation,"( )":Sa.paren,"[ ]":Sa.squareBracket,"{ }":Sa.brace,"InterpolationStart InterpolationEnd":Sa.special(Sa.brace),".":Sa.derefOperator,", ;":Sa.separator,"@":Sa.meta,TypeName:Sa.typeName,TypeDefinition:Sa.definition(Sa.typeName),"type enum interface implements namespace module declare":Sa.definitionKeyword,"abstract global Privacy readonly override":Sa.modifier,"is keyof unique infer":Sa.operatorKeyword,JSXAttributeValue:Sa.attributeValue,JSXText:Sa.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":Sa.angleBracket,"JSXIdentifier JSXNameSpacedName":Sa.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":Sa.attributeName,"JSXBuiltin/JSXIdentifier":Sa.standard(Sa.tagName)}),Cf={__proto__:null,export:14,as:19,from:27,default:30,async:35,function:36,extends:46,this:50,true:58,false:58,null:70,void:74,typeof:78,super:96,new:130,delete:146,yield:155,await:159,class:164,public:221,private:221,protected:221,readonly:223,instanceof:242,satisfies:245,in:246,const:248,import:280,keyof:335,unique:339,infer:345,is:381,abstract:401,implements:403,type:405,let:408,var:410,interface:417,enum:421,namespace:427,module:429,declare:433,global:437,for:456,of:465,while:468,with:472,do:476,if:480,else:482,switch:486,case:492,try:498,catch:502,finally:506,return:510,throw:514,break:518,continue:522,debugger:526},_f={__proto__:null,async:117,get:119,set:121,declare:181,public:183,private:183,protected:183,static:185,abstract:187,override:189,readonly:195,accessor:197,new:385},Xf={__proto__:null,"<":137},Zf=wf.deserialize({version:14,states:"$6[O`QUOOO%QQUOOO'TQWOOP(bOSOOO*pQ(CjO'#CfO*wOpO'#CgO+VO!bO'#CgO+eO07`O'#DZO-vQUO'#DaO.WQUO'#DlO%QQUO'#DvO0[QUO'#EOOOQ(CY'#EW'#EWO0uQSO'#ETOOQO'#Ei'#EiOOQO'#Ib'#IbO0}QSO'#GkO1YQSO'#EhO1_QSO'#EhO3aQ(CjO'#JcO6QQ(CjO'#JdO6nQSO'#FWO6sQ#tO'#FoOOQ(CY'#F`'#F`O7OO&jO'#F`O7^Q,UO'#FvO8tQSO'#FuOOQ(CY'#Jd'#JdOOQ(CW'#Jc'#JcOOQQ'#KO'#KOO8yQSO'#IOO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eclaration async function VariableDefinition > TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXStartTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:364,context:xf,nodeProps:[["group",-26,6,14,16,62,199,203,206,207,209,212,215,225,227,233,235,237,239,242,248,254,256,258,260,262,264,265,"Statement",-32,10,11,25,28,29,35,45,48,49,51,56,64,72,76,78,80,81,103,104,113,114,131,134,136,137,138,139,141,142,162,163,165,"Expression",-23,24,26,30,34,36,38,166,168,170,171,173,174,175,177,178,179,181,182,183,193,195,197,198,"Type",-3,84,96,102,"ClassItem"],["openedBy",31,"InterpolationStart",50,"[",54,"{",69,"(",143,"JSXStartTag",155,"JSXStartTag JSXStartCloseTag"],["closedBy",33,"InterpolationEnd",44,"]",55,"}",70,")",144,"JSXSelfCloseEndTag JSXEndTag",160,"JSXEndTag"]],propSources:[Pf],skippedNodes:[0,3,4,268],repeatNodeCount:33,tokenData:"$>y(CSR!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tu>PuvBavwDxwxGgxyMvyz! Qz{!![{|!%O|}!&]}!O!%O!O!P!'g!P!Q!1w!Q!R#0t!R![#3T![!]#@T!]!^#Aa!^!_#Bk!_!`#GS!`!a#In!a!b#N{!b!c$$z!c!}>P!}#O$&U#O#P$'`#P#Q$,w#Q#R$.R#R#S>P#S#T$/`#T#o$0j#o#p$4z#p#q$5p#q#r$7Q#r#s$8^#s$f%Z$f$g+g$g#BY>P#BY#BZ$9h#BZ$IS>P$IS$I_$9h$I_$I|>P$I|$I}$P$JT$JU$9h$JU$KV>P$KV$KW$9h$KW&FU>P&FU&FV$9h&FV;'S>P;'S;=`BZ<%l?HT>P?HT?HU$9h?HUO>P(n%d_$d&j'wp'z!bOY%ZYZ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'S;=`BZ<%l?HT>P?HT?HU$9h?HUO>P(CS$=Uk$d&j'wp'z!b'n(;d(U!LY't&;d$W#tOY%ZYZ&cZr%Zrs&}st%Ztu>Puw%Zwx(rx}%Z}!O@T!O!Q%Z!Q![>P![!^%Z!^!_*g!_!c%Z!c!}>P!}#O%Z#O#P&c#P#R%Z#R#S>P#S#T%Z#T#o>P#o#p*g#p$g%Z$g;'S>P;'S;=`BZ<%lO>P",tokenizers:[Qf,$f,2,3,4,5,6,7,8,9,10,11,12,13,kf,new ef("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOq~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!O~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(T~~",141,326),new ef("j~RQYZXz{^~^O'q~~aP!P!Qd~iO'r~~",25,308)],topRules:{Script:[0,5],SingleExpression:[1,266],SingleClassItem:[2,267]},dialects:{jsx:12686,ts:12688},dynamicPrecedences:{76:1,78:1,163:1,191:1},specialized:[{term:312,get:t=>Cf[t]||-1},{term:328,get:t=>_f[t]||-1},{term:67,get:t=>Xf[t]||-1}],tokenPrec:12712}),Af=[Dd("function ${name}(${params}) {\n\t${}\n}",{label:"function",detail:"definition",type:"keyword"}),Dd("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n\t${}\n}",{label:"for",detail:"loop",type:"keyword"}),Dd("for (let ${name} of ${collection}) {\n\t${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Dd("do {\n\t${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),Dd("while (${}) {\n\t${}\n}",{label:"while",detail:"loop",type:"keyword"}),Dd("try {\n\t${}\n} catch (${error}) {\n\t${}\n}",{label:"try",detail:"/ catch block",type:"keyword"}),Dd("if (${}) {\n\t${}\n}",{label:"if",detail:"block",type:"keyword"}),Dd("if (${}) {\n\t${}\n} else {\n\t${}\n}",{label:"if",detail:"/ else block",type:"keyword"}),Dd("class ${name} {\n\tconstructor(${params}) {\n\t\t${}\n\t}\n}",{label:"class",detail:"definition",type:"keyword"}),Dd('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Dd('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Tf=new Ro,Rf=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Ef(t){return(e,i)=>{let n=e.node.getChild("VariableDefinition");return n&&i(n,t),!0}}const Vf=["FunctionDeclaration"],Mf={FunctionDeclaration:Ef("function"),ClassDeclaration:Ef("class"),ClassExpression:()=>!0,EnumDeclaration:Ef("constant"),TypeAliasDeclaration:Ef("type"),NamespaceDeclaration:Ef("namespace"),VariableDefinition(t,e){t.matchContext(Vf)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function Df(t,e){let i=Tf.get(e);if(i)return i;let n=[],s=!0;function r(e,i){let s=t.sliceString(e.from,e.to);n.push({label:s,type:i})}return e.cursor(mo.IncludeAnonymous).iterate((e=>{if(s)s=!1;else if(e.name){let t=Mf[e.name];if(t&&t(e,r)||Rf.has(e.name))return!1}else if(e.to-e.from>8192){for(let i of Df(t,e.node))n.push(i);return!1}})),Tf.set(e,n),n}const Wf=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Uf=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName"];function Yf(t){let e=Xa(t.state).resolveInner(t.pos,-1);if(Uf.indexOf(e.name)>-1)return null;let i="VariableName"==e.name||e.to-e.from<20&&Wf.test(t.state.sliceDoc(e.from,e.to));if(!i&&!t.explicit)return null;let n=[];for(let i=e;i;i=i.parent)Rf.has(i.name)&&(n=n.concat(Df(t.state.doc,i)));return{options:n,from:i?e.from:t.pos,validFor:Wf}}const qf=_a.define({name:"javascript",parser:Zf.configure({props:[Na.add({IfStatement:il({except:/^\s*({|else\b)/}),TryStatement:il({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:t=>t.baseIndent,SwitchBody:t=>{let e=t.textAfter,i=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return t.baseIndent+(i?0:n?1:2)*t.unit},Block:tl({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":il({except:/^{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag":t=>t.column(t.node.from)+t.unit}),rl.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression":ol,BlockComment:t=>({from:t.from+2,to:t.to-2})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Lf={test:t=>/^JSX/.test(t.name),facet:Qa({commentTokens:{block:{open:"{/*",close:"*/}"}}})},zf=qf.configure({dialect:"ts"},"typescript"),If=qf.configure({dialect:"jsx",props:[$a.add((t=>t.isTop?[Lf]:void 0))]}),Bf=qf.configure({dialect:"jsx ts",props:[$a.add((t=>t.isTop?[Lf]:void 0))]},"typescript"),jf="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map((t=>({label:t,type:"keyword"})));function Nf(t={}){let e=t.jsx?t.typescript?Bf:If:t.typescript?zf:qf;return new Ua(e,[qf.data.of({autocomplete:(i=Uf,n=zu(Af.concat(jf)),t=>{for(let e=Xa(t.state).resolveInner(t.pos,-1);e;e=e.parent){if(i.indexOf(e.name)>-1)return null;if(e.type.isTop)break}return n(t)})}),qf.data.of({autocomplete:Yf}),t.jsx?Hf:[]]);var i,n}function Gf(t,e,i=t.length){for(let n=null==e?void 0:e.firstChild;n;n=n.nextSibling)if("JSXIdentifier"==n.name||"JSXBuiltin"==n.name||"JSXNamespacedName"==n.name||"JSXMemberExpression"==n.name)return t.sliceString(n.from,Math.min(n.to,i));return""}const Ff="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),Hf=Ts.inputHandler.of(((t,e,i,n)=>{if((Ff?t.composing:t.compositionStarted)||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!qf.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((t=>{var e,i;let r,{head:o}=t,a=Xa(s).resolveInner(o,-1);if("JSXStartTag"==a.name&&(a=a.parent),">"==n&&"JSXFragmentTag"==a.name)return{range:A.cursor(o+1),changes:{from:o,insert:">"}};if("/"==n&&"JSXFragmentTag"==a.name){let t=a.parent,i=null==t?void 0:t.parent;if(t.from==o-1&&"JSXEndTag"!=(null===(e=i.lastChild)||void 0===e?void 0:e.name)&&(r=Gf(s.doc,null==i?void 0:i.firstChild,o))){let t=`/${r}>`;return{range:A.cursor(o+t.length),changes:{from:o,insert:t}}}}else if(">"==n){let t=function(t){for(;;){if("JSXOpenTag"==t.name||"JSXSelfClosingTag"==t.name||"JSXFragmentTag"==t.name)return t;if(!t.parent)return null;t=t.parent}}(a);if(t&&"JSXEndTag"!=(null===(i=t.lastChild)||void 0===i?void 0:i.name)&&"`}}}return{range:t}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)}));class Jf{constructor(t,e,i,n,s,r,o){this.type=t,this.value=e,this.from=i,this.hash=n,this.end=s,this.children=r,this.positions=o,this.hashProp=[[ho.contextHash,n]]}static create(t,e,i,n,s){return new Jf(t,e,i,n+(n<<8)+t+(e<<4)|0,s,[],[])}addChild(t,e){t.prop(ho.contextHash)!=this.hash&&(t=new bo(t.type,t.children,t.positions,t.length,this.hashProp)),this.children.push(t),this.positions.push(e)}toTree(t,e=this.end){let i=this.children.length-1;return i>=0&&(e=Math.max(e,this.positions[i]+this.children[i].length+this.from)),new bo(t.types[this.type],this.children,this.positions,e-this.from).balance({makeTree:(t,e,i)=>new bo(fo.none,t,e,i,this.hashProp)})}}var Kf;!function(t){t[t.Document=1]="Document",t[t.CodeBlock=2]="CodeBlock",t[t.FencedCode=3]="FencedCode",t[t.Blockquote=4]="Blockquote",t[t.HorizontalRule=5]="HorizontalRule",t[t.BulletList=6]="BulletList",t[t.OrderedList=7]="OrderedList",t[t.ListItem=8]="ListItem",t[t.ATXHeading1=9]="ATXHeading1",t[t.ATXHeading2=10]="ATXHeading2",t[t.ATXHeading3=11]="ATXHeading3",t[t.ATXHeading4=12]="ATXHeading4",t[t.ATXHeading5=13]="ATXHeading5",t[t.ATXHeading6=14]="ATXHeading6",t[t.SetextHeading1=15]="SetextHeading1",t[t.SetextHeading2=16]="SetextHeading2",t[t.HTMLBlock=17]="HTMLBlock",t[t.LinkReference=18]="LinkReference",t[t.Paragraph=19]="Paragraph",t[t.CommentBlock=20]="CommentBlock",t[t.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",t[t.Escape=22]="Escape",t[t.Entity=23]="Entity",t[t.HardBreak=24]="HardBreak",t[t.Emphasis=25]="Emphasis",t[t.StrongEmphasis=26]="StrongEmphasis",t[t.Link=27]="Link",t[t.Image=28]="Image",t[t.InlineCode=29]="InlineCode",t[t.HTMLTag=30]="HTMLTag",t[t.Comment=31]="Comment",t[t.ProcessingInstruction=32]="ProcessingInstruction",t[t.URL=33]="URL",t[t.HeaderMark=34]="HeaderMark",t[t.QuoteMark=35]="QuoteMark",t[t.ListMark=36]="ListMark",t[t.LinkMark=37]="LinkMark",t[t.EmphasisMark=38]="EmphasisMark",t[t.CodeMark=39]="CodeMark",t[t.CodeText=40]="CodeText",t[t.CodeInfo=41]="CodeInfo",t[t.LinkTitle=42]="LinkTitle",t[t.LinkLabel=43]="LinkLabel"}(Kf||(Kf={}));class tp{constructor(t,e){this.start=t,this.content=e,this.marks=[],this.parsers=[]}}class ep{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let t=this.skipSpace(this.basePos);this.indent=this.countIndent(t,this.pos,this.indent),this.pos=t,this.next=t==this.text.length?-1:this.text.charCodeAt(t)}skipSpace(t){return rp(this.text,t)}reset(t){for(this.text=t,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(t){this.basePos=t,this.baseIndent=this.countIndent(t,this.pos,this.indent)}moveBaseColumn(t){this.baseIndent=t,this.basePos=this.findColumn(t)}addMarker(t){this.markers.push(t)}countIndent(t,e=0,i=0){for(let n=e;n=e.stack[i.depth+1].value+i.baseIndent)return!0;if(i.indent>=i.baseIndent+4)return!1;let n=(t.type==Kf.OrderedList?dp:up)(i,e,!1);return n>0&&(t.type!=Kf.BulletList||hp(i,e,!1)<0)&&i.text.charCodeAt(i.pos+n-1)==t.value}const np={[Kf.Blockquote]:(t,e,i)=>62==i.next&&(i.markers.push(Up(Kf.QuoteMark,e.lineStart+i.pos,e.lineStart+i.pos+1)),i.moveBase(i.pos+(sp(i.text.charCodeAt(i.pos+1))?2:1)),t.end=e.lineStart+i.text.length,!0),[Kf.ListItem]:(t,e,i)=>!(i.indent-1)&&(i.moveBaseColumn(i.baseIndent+t.value),!0),[Kf.OrderedList]:ip,[Kf.BulletList]:ip,[Kf.Document]:()=>!0};function sp(t){return 32==t||9==t||10==t||13==t}function rp(t,e=0){for(;ei&&sp(t.charCodeAt(e-1));)e--;return e}function ap(t){if(96!=t.next&&126!=t.next)return-1;let e=t.pos+1;for(;e-1&&t.depth==e.stack.length||n<3?-1:1}function cp(t,e){for(let i=t.stack.length-1;i>=0;i--)if(t.stack[i].type==e)return!0;return!1}function up(t,e,i){return 45!=t.next&&43!=t.next&&42!=t.next||t.pos!=t.text.length-1&&!sp(t.text.charCodeAt(t.pos+1))||!(!i||cp(e,Kf.BulletList)||t.skipSpace(t.pos+2)=48&&s<=57;){if(n++,n==t.text.length)return-1;s=t.text.charCodeAt(n)}return n==t.pos||n>t.pos+9||46!=s&&41!=s||nt.pos+1||49!=t.next)?-1:n+1-t.pos}function fp(t){if(35!=t.next)return-1;let e=t.pos+1;for(;e6?-1:i}function pp(t){if(45!=t.next&&61!=t.next||t.indent>=t.baseIndent+4)return-1;let e=t.pos+1;for(;e/,mp=/\?>/,bp=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*/i.exec(n);if(r)return t.append(Up(Kf.Comment,i,i+1+r[0].length));let o=/^\?[^]*?\?>/.exec(n);if(o)return t.append(Up(Kf.ProcessingInstruction,i,i+1+o[0].length));let a=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(n);return a?t.append(Up(Kf.HTMLTag,i,i+1+a[0].length)):-1},Emphasis(t,e,i){if(95!=e&&42!=e)return-1;let n=i+1;for(;t.char(n)==e;)n++;let s=t.slice(i-1,i),r=t.slice(n,n+1),o=jp.test(s),a=jp.test(r),l=/\s|^$/.test(s),h=/\s|^$/.test(r),c=!h&&(!a||l||o),u=!l&&(!o||h||a),d=c&&(42==e||!u||o),f=u&&(42==e||!c||a);return t.append(new Ip(95==e?Yp:qp,i,n,(d?1:0)|(f?2:0)))},HardBreak(t,e,i){if(92==e&&10==t.char(i+1))return t.append(Up(Kf.HardBreak,i,i+2));if(32==e){let e=i+1;for(;32==t.char(e);)e++;if(10==t.char(e)&&e>=i+2)return t.append(Up(Kf.HardBreak,i,e+1))}return-1},Link:(t,e,i)=>91==e?t.append(new Ip(Lp,i,i+1,1)):-1,Image:(t,e,i)=>33==e&&91==t.char(i+1)?t.append(new Ip(zp,i,i+2,1)):-1,LinkEnd(t,e,i){if(93!=e)return-1;for(let e=t.parts.length-1;e>=0;e--){let n=t.parts[e];if(n instanceof Ip&&(n.type==Lp||n.type==zp)){if(!n.side||t.skipSpace(n.to)==i&&!/[(\[]/.test(t.slice(i+1,i+2)))return t.parts[e]=null,-1;let s=t.takeContent(e),r=t.parts[e]=Gp(t,s,n.type==Lp?Kf.Link:Kf.Image,n.from,i+1);if(n.type==Lp)for(let i=0;ie?Up(Kf.URL,e+i,s+i):s==t.length&&null}}function Hp(t,e,i){let n=t.charCodeAt(e);if(39!=n&&34!=n&&40!=n)return!1;let s=40==n?41:n;for(let n=e+1,r=!1;n=this.end?-1:this.text.charCodeAt(t-this.offset)}get end(){return this.offset+this.text.length}slice(t,e){return this.text.slice(t-this.offset,e-this.offset)}append(t){return this.parts.push(t),t.to}addDelimiter(t,e,i,n,s){return this.append(new Ip(t,e,i,(n?1:0)|(s?2:0)))}addElement(t){return this.append(t)}resolveMarkers(t){for(let e=t;e=t;o--){let t=this.parts[o];if(t instanceof Ip&&1&t.side&&t.type==i.type&&!(s&&(1&i.side||2&t.side)&&(t.to-t.from+r)%3==0&&((t.to-t.from)%3||r%3))){n=t;break}}if(!n)continue;let a=i.type.resolve,l=[],h=n.from,c=i.to;if(s){let t=Math.min(2,n.to-n.from,r);h=n.to-t,c=i.from+t,a=1==t?"Emphasis":"StrongEmphasis"}n.type.mark&&l.push(this.elt(n.type.mark,h,n.to));for(let t=o+1;t=0;e--){let i=this.parts[e];if(i instanceof Ip&&i.type==t)return e}return null}takeContent(t){let e=this.resolveMarkers(t);return this.parts.length=t,e}skipSpace(t){return rp(this.text,t-this.offset)+this.offset}elt(t,e,i,n){return"string"==typeof t?Up(this.parser.getNodeType(t),e,i,n):new Wp(t,e)}}function tO(t,e){if(!e.length)return t;if(!t.length)return e;let i=t.slice(),n=0;for(let t of e){for(;n(t?t-1:0))return!1;if(this.fragmentEnd<0){let t=this.fragment.to;for(;t>0&&"\n"!=this.input.read(t-1,t);)t--;this.fragmentEnd=t?t-1:0}let i=this.cursor;i||(i=this.cursor=this.fragment.tree.cursor(),i.firstChild());let n=t+this.fragment.offset;for(;i.to<=n;)if(!i.parent())return!1;for(;;){if(i.from>=n)return this.fragment.from<=e;if(!i.childAfter(n))return!1}}matches(t){let e=this.cursor.tree;return e&&e.prop(ho.contextHash)==t}takeNodes(t){let e=this.cursor,i=this.fragment.offset,n=this.fragmentEnd-(this.fragment.openEnd?1:0),s=t.absoluteLineStart,r=s,o=t.block.children.length,a=r,l=o;for(;;){if(e.to-i>n){if(e.type.isAnonymous&&e.firstChild())continue;break}if(t.dontInject.add(e.tree),t.addNode(e.tree,e.from-i),e.type.is("Block")&&(eO.indexOf(e.type.id)<0?(r=e.to-i,o=t.block.children.length):(r=a,o=l,a=e.to-i,l=t.block.children.length)),!e.nextSibling())break}for(;t.block.children.length>o;)t.block.children.pop(),t.block.positions.pop();return r-s}}const nO=ea({"Blockquote/...":Sa.quote,HorizontalRule:Sa.contentSeparator,"ATXHeading1/... SetextHeading1/...":Sa.heading1,"ATXHeading2/... SetextHeading2/...":Sa.heading2,"ATXHeading3/...":Sa.heading3,"ATXHeading4/...":Sa.heading4,"ATXHeading5/...":Sa.heading5,"ATXHeading6/...":Sa.heading6,"Comment CommentBlock":Sa.comment,Escape:Sa.escape,Entity:Sa.character,"Emphasis/...":Sa.emphasis,"StrongEmphasis/...":Sa.strong,"Link/... Image/...":Sa.link,"OrderedList/... BulletList/...":Sa.list,"BlockQuote/...":Sa.quote,"InlineCode CodeText":Sa.monospace,URL:Sa.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":Sa.processingInstruction,"CodeInfo LinkLabel":Sa.labelName,LinkTitle:Sa.string,Paragraph:Sa.content}),sO=new Zp(new po(Ep).extend(nO),Object.keys(Sp).map((t=>Sp[t])),Object.keys(Sp).map((t=>$p[t])),Object.keys(Sp),Pp,np,Object.keys(Np).map((t=>Np[t])),Object.keys(Np),[]);function rO(t,e,i){let n=[];for(let s=t.firstChild,r=e;;s=s.nextSibling){let t=s?s.from:i;if(t>r&&n.push({from:r,to:t}),!s)break;r=s.to}return n}const oO={resolve:"Strikethrough",mark:"StrikethroughMark"},aO={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":Sa.strikethrough}},{name:"StrikethroughMark",style:Sa.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,i){if(126!=e||126!=t.char(i+1)||126==t.char(i+2))return-1;let n=t.slice(i-1,i),s=t.slice(i+2,i+3),r=/\s|^$/.test(n),o=/\s|^$/.test(s),a=jp.test(n),l=jp.test(s);return t.addDelimiter(oO,i,i+2,!o&&(!l||r||a),!r&&(!a||o||l))},after:"Emphasis"}]};function lO(t,e,i=0,n,s=0){let r=0,o=!0,a=-1,l=-1,h=!1,c=()=>{n.push(t.elt("TableCell",s+a,s+l,t.parser.parseInline(e.slice(a,l),s+a)))};for(let u=i;u-1)&&r++,o=!1,n&&(a>-1&&c(),n.push(t.elt("TableDelimiter",u+s,u+s+1))),a=l=-1),h=!h&&92==i}return a>-1&&(r++,n&&c()),r}function hO(t,e){for(let i=e;ihO(e.content,0)?new uO:null,endLeaf(t,e,i){if(i.parsers.some((t=>t instanceof uO))||!hO(e.text,e.basePos))return!1;let n=t.scanLine(t.absoluteLineEnd+1).text;return cO.test(n)&&lO(t,e.text,e.basePos)==lO(t,n,e.basePos)},before:"SetextHeading"}]};class fO{nextLine(){return!1}finish(t,e){return t.addLeafElement(e,t.elt("Task",e.start,e.start+e.content.length,[t.elt("TaskMarker",e.start,e.start+3),...t.parser.parseInline(e.content.slice(3),e.start+3)])),!0}}const pO=[dO,{defineNodes:[{name:"Task",block:!0,style:Sa.list},{name:"TaskMarker",style:Sa.atom}],parseBlock:[{name:"TaskList",leaf:(t,e)=>/^\[[ xX]\]/.test(e.content)&&"ListItem"==t.parentType().name?new fO:null,after:"SetextHeading"}]},aO];function OO(t,e,i){return(n,s,r)=>{if(s!=t||n.char(r+1)==t)return-1;let o=[n.elt(i,r,r+1)];for(let s=r+1;s=65&&r<=90||95==r||r>=97&&r<=122||r>=161;)s+=String.fromCharCode(n),n=t.peek(++e);var r;return RO=t,EO=i,TO=s?s.toLowerCase():n==MO||n==DO?void 0:null}const MO=63,DO=33;function WO(t,e){this.name=t,this.parent=e,this.hash=e?e.hash:0;for(let e=0;eUO.indexOf(e)>-1?new WO(VO(n,1)||"",t):t,reduce:(t,e)=>e==wO&&t?t.parent:t,reuse(t,e,i,n){let s=e.type.id;return 6==s||36==s?new WO(VO(n,1)||"",t):t},hash:t=>t?t.hash:0,strict:!1}),qO=new nf(((t,e)=>{if(60!=t.next)return void(t.next<0&&e.context&&t.acceptToken(57));t.advance();let i=47==t.next;i&&t.advance();let n=VO(t,0);if(void 0===n)return;if(!n)return t.acceptToken(i?14:6);let s=e.context?e.context.name:null;if(i){if(n==s)return t.acceptToken(11);if(s&&XO[s])return t.acceptToken(57,-2);if(e.dialectEnabled(0))return t.acceptToken(12);for(let t=e.context;t;t=t.parent)if(t.name==n)return;t.acceptToken(13)}else{if("script"==n)return t.acceptToken(7);if("style"==n)return t.acceptToken(8);if("textarea"==n)return t.acceptToken(9);if(_O.hasOwnProperty(n))return t.acceptToken(10);s&&ZO[s]&&ZO[s][n]?t.acceptToken(57,-1):t.acceptToken(6)}}),{contextual:!0}),LO=new nf((t=>{for(let e=0,i=0;;i++){if(t.next<0){i&&t.acceptToken(58);break}if(45==t.next)e++;else{if(62==t.next&&e>=2){i>3&&t.acceptToken(58,-2);break}e=0}t.advance()}}));const zO=new nf(((t,e)=>{if(47==t.next&&62==t.peek(1)){let i=e.dialectEnabled(1)||function(t){for(;t;t=t.parent)if("svg"==t.name||"math"==t.name)return!0;return!1}(e.context);t.acceptToken(i?5:4,2)}else 62==t.next&&t.acceptToken(4,1)}));function IO(t,e,i){let n=2+t.length;return new nf((s=>{for(let r=0,o=0,a=0;;a++){if(s.next<0){a&&s.acceptToken(e);break}if(0==r&&60==s.next||1==r&&47==s.next||r>=2&&ro?s.acceptToken(e,-o):s.acceptToken(i,-(o-2));break}if((10==s.next||13==s.next)&&a){s.acceptToken(e,1);break}r=o=0}else o++;s.advance()}}))}const BO=IO("script",54,1),jO=IO("style",55,2),NO=IO("textarea",56,3),GO=ea({"Text RawText":Sa.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":Sa.angleBracket,TagName:Sa.tagName,"MismatchedCloseTag/TagName":[Sa.tagName,Sa.invalid],AttributeName:Sa.attributeName,"AttributeValue UnquotedAttributeValue":Sa.attributeValue,Is:Sa.definitionOperator,"EntityReference CharacterReference":Sa.character,Comment:Sa.blockComment,ProcessingInst:Sa.processingInstruction,DoctypeDecl:Sa.documentMeta}),FO=wf.deserialize({version:14,states:",xOVO!rOOO!WQ#tO'#CqO!]Q#tO'#CzO!bQ#tO'#C}O!gQ#tO'#DQO!lQ#tO'#DSO!qOaO'#CpO!|ObO'#CpO#XOdO'#CpO$eO!rO'#CpOOO`'#Cp'#CpO$lO$fO'#DTO$tQ#tO'#DVO$yQ#tO'#DWOOO`'#Dk'#DkOOO`'#DY'#DYQVO!rOOO%OQ&rO,59]O%WQ&rO,59fO%`Q&rO,59iO%hQ&rO,59lO%sQ&rO,59nOOOa'#D^'#D^O%{OaO'#CxO&WOaO,59[OOOb'#D_'#D_O&`ObO'#C{O&kObO,59[OOOd'#D`'#D`O&sOdO'#DOO'OOdO,59[OOO`'#Da'#DaO'WO!rO,59[O'_Q#tO'#DROOO`,59[,59[OOOp'#Db'#DbO'dO$fO,59oOOO`,59o,59oO'lQ#|O,59qO'qQ#|O,59rOOO`-E7W-E7WO'vQ&rO'#CsOOQW'#DZ'#DZO(UQ&rO1G.wOOOa1G.w1G.wO(^Q&rO1G/QOOOb1G/Q1G/QO(fQ&rO1G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!wO!a!uO~Oa!xOb!xOc!xO!b!wO!c!xO~Oa!uOb!uOc!uO!`!{O!a!uO~Oa!xOb!xOc!xO!b!{O!c!xO~OT~bac!dx{!d~",goto:"%p!`PPPPPPPPPPPPPPPPPPPP!a!gP!mPP!yP!|#P#S#Y#]#`#f#i#l#r#x!aP!a!aP$O$U$l$r$x%O%U%[%bPPPPPPPP%hX^OX`pXUOX`pezabcde{}!P!R!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ}bQ!PcQ!RdQ!UeZ!e{}!P!R!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:67,context:YO,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,21,30,33,36,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,29,32,35,37,"OpenTag"],["group",-9,14,17,18,19,20,39,40,41,42,"Entity",16,"Entity TextContent",-3,28,31,34,"TextContent Entity"]],propSources:[GO],skippedNodes:[0],repeatNodeCount:9,tokenData:"#%g!aR!YOX$qXY,QYZ,QZ[$q[]&X]^,Q^p$qpq,Qqr-_rs4ysv-_vw5iwxJ^x}-_}!OKP!O!P-_!P!Q$q!Q![-_![!]!!O!]!^-_!^!_!&W!_!`#$o!`!a&X!a!c-_!c!}!!O!}#R-_#R#S!!O#S#T3V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Hp?BY?Mn!Nc?MnO!HpT##QP;=`<%l!Nc!V##^chS!a`!cpOq!G_qr!Eyrs!HUsv!Eyvw!Ncwx!Jvx!P!Ey!P!Q!G_!Q!_!Ey!_!`!G_!`!a!Mm!a#s!Ey#s$f!G_$f;'S!Ey;'S;=`#$i<%l?Ah!Ey?Ah?BY!G_?BY?Mn!Ey?MnO!G_!V#$lP;=`<%l!Ey!V#$zXiS`P!a`!cpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X",tokenizers:[BO,jO,NO,zO,qO,LO,0,1,2,3,4,5],topRules:{Document:[0,15]},dialects:{noMatch:0,selfClosing:485},tokenPrec:487});function HO(t,e){let i=Object.create(null);for(let n of t.getChildren(yO)){let t=n.getChild(SO),s=n.getChild(xO)||n.getChild(kO);t&&(i[e.read(t.from,t.to)]=s?s.type.id==xO?e.read(s.from+1,s.to-1):e.read(s.from,s.to):"")}return i}function JO(t,e){let i=t.getChild(vO);return i?e.read(i.from,i.to):" "}function KO(t,e,i){let n;for(let s of i)if(!s.attrs||s.attrs(n||(n=HO(t.node.parent.firstChild,e))))return{parser:s.parser};return null}function tg(t=[],e=[]){let i=[],n=[],s=[],r=[];for(let e of t){("script"==e.tag?i:"style"==e.tag?n:"textarea"==e.tag?s:r).push(e)}let o=e.length?Object.create(null):null;for(let t of e)(o[t.name]||(o[t.name]=[])).push(t);return Do(((t,e)=>{let a=t.type.id;if(a==QO)return KO(t,e,i);if(a==$O)return KO(t,e,n);if(a==PO)return KO(t,e,s);if(a==wO&&r.length){let i,n=t.node,s=n.firstChild,o=s&&JO(s,e);if(o)for(let t of r)if(t.tag==o&&(!t.attrs||t.attrs(i||(i=HO(n,e))))){let e=n.lastChild;return{parser:t.parser,overlay:[{from:s.to,to:e.type.id==CO?e.from:n.to}]}}}if(o&&a==yO){let i,n=t.node;if(i=n.firstChild){let t=o[e.read(i.from,i.to)];if(t)for(let i of t){if(i.tagName&&i.tagName!=JO(n.parent,e))continue;let t=n.lastChild;if(t.type.id==xO){let e=t.from+1,n=t.lastChild,s=t.to-(n&&n.isError?0:1);if(s>e)return{parser:i.parser,overlay:[{from:e,to:s}]}}else if(t.type.id==kO)return{parser:i.parser,overlay:[{from:t.from,to:t.to}]}}}}return null}))}const eg=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288];function ig(t){return t>=65&&t<=90||t>=97&&t<=122||t>=161}const ng=new nf(((t,e)=>{for(let n=!1,s=0,r=0;;r++){let{next:o}=t;if(!(ig(o)||45==o||95==o||n&&(i=o,i>=48&&i<=57))){n&&t.acceptToken(40==o?95:2==s&&e.canShift(2)?2:96);break}!n&&(45!=o||r>0)&&(n=!0),s===r&&45==o&&s++,t.advance()}var i})),sg=new nf((t=>{if(eg.includes(t.peek(-1))){let{next:e}=t;(ig(e)||95==e||35==e||46==e||91==e||58==e||45==e)&&t.acceptToken(94)}})),rg=new nf((t=>{if(!eg.includes(t.peek(-1))){let{next:e}=t;if(37==e&&(t.advance(),t.acceptToken(1)),ig(e)){do{t.advance()}while(ig(t.next));t.acceptToken(1)}}})),og=ea({"AtKeyword import charset namespace keyframes media supports":Sa.definitionKeyword,"from to selector":Sa.keyword,NamespaceName:Sa.namespace,KeyframeName:Sa.labelName,TagName:Sa.tagName,ClassName:Sa.className,PseudoClassName:Sa.constant(Sa.className),IdName:Sa.labelName,"FeatureName PropertyName":Sa.propertyName,AttributeName:Sa.attributeName,NumberLiteral:Sa.number,KeywordQuery:Sa.keyword,UnaryQueryOp:Sa.operatorKeyword,"CallTag ValueName":Sa.atom,VariableName:Sa.variableName,Callee:Sa.operatorKeyword,Unit:Sa.unit,"UniversalSelector NestingSelector":Sa.definitionOperator,MatchOp:Sa.compareOperator,"ChildOp SiblingOp, LogicOp":Sa.logicOperator,BinOp:Sa.arithmeticOperator,Important:Sa.modifier,Comment:Sa.blockComment,ParenthesizedContent:Sa.special(Sa.name),ColorLiteral:Sa.color,StringLiteral:Sa.string,":":Sa.punctuation,"PseudoOp #":Sa.derefOperator,"; ,":Sa.separator,"( )":Sa.paren,"[ ]":Sa.squareBracket,"{ }":Sa.brace}),ag={__proto__:null,lang:32,"nth-child":32,"nth-last-child":32,"nth-of-type":32,"nth-last-of-type":32,dir:32,"host-context":32,url:60,"url-prefix":60,domain:60,regexp:60,selector:134},lg={__proto__:null,"@import":114,"@media":138,"@charset":142,"@namespace":146,"@keyframes":152,"@supports":164},hg={__proto__:null,not:128,only:128,from:158,to:160},cg=wf.deserialize({version:14,states:"7WQYQ[OOO#_Q[OOOOQP'#Cd'#CdOOQP'#Cc'#CcO#fQ[O'#CfO$YQXO'#CaO$aQ[O'#ChO$lQ[O'#DPO$qQ[O'#DTOOQP'#Ed'#EdO$vQdO'#DeO%bQ[O'#DrO$vQdO'#DtO%sQ[O'#DvO&OQ[O'#DyO&TQ[O'#EPO&cQ[O'#EROOQS'#Ec'#EcOOQS'#ET'#ETQYQ[OOO&jQXO'#CdO'_QWO'#DaO'dQWO'#EjO'oQ[O'#EjQOQWOOOOQP'#Cg'#CgOOQP,59Q,59QO#fQ[O,59QO'yQ[O'#EWO(eQWO,58{O(mQ[O,59SO$lQ[O,59kO$qQ[O,59oO'yQ[O,59sO'yQ[O,59uO'yQ[O,59vO(xQ[O'#D`OOQS,58{,58{OOQP'#Ck'#CkOOQO'#C}'#C}OOQP,59S,59SO)PQWO,59SO)UQWO,59SOOQP'#DR'#DROOQP,59k,59kOOQO'#DV'#DVO)ZQ`O,59oOOQS'#Cp'#CpO$vQdO'#CqO)cQvO'#CsO*pQtO,5:POOQO'#Cx'#CxO)UQWO'#CwO+UQWO'#CyOOQS'#Eg'#EgOOQO'#Dh'#DhO+ZQ[O'#DoO+iQWO'#EkO&TQ[O'#DmO+wQWO'#DpOOQO'#El'#ElO(hQWO,5:^O+|QpO,5:`OOQS'#Dx'#DxO,UQWO,5:bO,ZQ[O,5:bOOQO'#D{'#D{O,cQWO,5:eO,h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%^XJmS!`PoWOy%^z;'S%^;'S;=`%o<%lO%^XJ|UOy%^z#f%^#f#gJf#g;'S%^;'S;=`%o<%lO%^XKeS!RPOy%^z;'S%^;'S;=`%o<%lO%^_KvS!QVOy%^z;'S%^;'S;=`%o<%lO%^ZLXU!PPOy%^z!_%^!_!`6y!`;'S%^;'S;=`%o<%lO%^WLnP;=`<%l$}",tokenizers:[sg,rg,ng,0,1,2,3],topRules:{StyleSheet:[0,4],Styles:[1,84]},specialized:[{term:95,get:t=>ag[t]||-1},{term:56,get:t=>lg[t]||-1},{term:96,get:t=>hg[t]||-1}],tokenPrec:1123});let ug=null;function dg(){if(!ug&&"object"==typeof document&&document.body){let{style:t}=document.body,e=[],i=new Set;for(let n in t)"cssText"!=n&&"cssFloat"!=n&&"string"==typeof t[n]&&(/[A-Z]/.test(n)&&(n=n.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))),i.has(n)||(e.push(n),i.add(n)));ug=e.sort().map((t=>({type:"property",label:t})))}return ug||[]}const fg=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map((t=>({type:"class",label:t}))),pg=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map((t=>({type:"keyword",label:t}))).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map((t=>({type:"constant",label:t})))),Og=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map((t=>({type:"type",label:t}))),gg=/^(\w[\w-]*|-\w[\w-]*|)$/,mg=/^-(-[\w-]*)?$/;const bg=new Ro,wg=["Declaration"];function vg(t){for(let e=t;;){if(e.type.isTop)return e;if(!(e=e.parent))return t}}function yg(t,e,i){if(e.to-e.from>4096){let n=bg.get(e);if(n)return n;let s=[],r=new Set,o=e.cursor(mo.IncludeAnonymous);if(o.firstChild())do{for(let e of yg(t,o.node,i))r.has(e.label)||(r.add(e.label),s.push(e))}while(o.nextSibling());return bg.set(e,s),s}{let n=[],s=new Set;return e.cursor().iterate((e=>{var r;if(i(e)&&e.matchContext(wg)&&":"==(null===(r=e.node.nextSibling)||void 0===r?void 0:r.name)){let i=t.sliceString(e.from,e.to);s.has(i)||(s.add(i),n.push({label:i,type:"variable"}))}})),n}}const Sg=t=>e=>{let{state:i,pos:n}=e,s=Xa(i).resolveInner(n,-1),r=s.type.isError&&s.from==s.to-1&&"-"==i.doc.sliceString(s.from,s.to);if("PropertyName"==s.name||(r||"TagName"==s.name)&&/^(Block|Styles)$/.test(s.resolve(s.to).name))return{from:s.from,options:dg(),validFor:gg};if("ValueName"==s.name)return{from:s.from,options:pg,validFor:gg};if("PseudoClassName"==s.name)return{from:s.from,options:fg,validFor:gg};if(t(s)||(e.explicit||r)&&function(t,e){var i;if(("("==t.name||t.type.isError)&&(t=t.parent||t),"ArgList"!=t.name)return!1;let n=null===(i=t.parent)||void 0===i?void 0:i.firstChild;return"Callee"==(null==n?void 0:n.name)&&"var"==e.sliceString(n.from,n.to)}(s,i.doc))return{from:t(s)||r?s.from:n,options:yg(i.doc,vg(s),t),validFor:mg};if("TagName"==s.name){for(let{parent:t}=s;t;t=t.parent)if("Block"==t.name)return{from:s.from,options:dg(),validFor:gg};return{from:s.from,options:Og,validFor:gg}}if(!e.explicit)return null;let o=s.resolve(n),a=o.childBefore(n);return a&&":"==a.name&&"PseudoClassSelector"==o.name?{from:n,options:fg,validFor:gg}:a&&":"==a.name&&"Declaration"==o.name||"ArgList"==o.name?{from:n,options:pg,validFor:gg}:"Block"==o.name||"Styles"==o.name?{from:n,options:dg(),validFor:gg}:null},xg=Sg((t=>"VariableName"==t.name)),kg=_a.define({name:"css",parser:cg.configure({props:[Na.add({Declaration:il()}),rl.add({"Block KeyframeList":ol})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function Qg(){return new Ua(kg,kg.data.of({autocomplete:xg}))}const $g=["_blank","_self","_top","_parent"],Pg=["ascii","utf-8","utf-16","latin1","latin1"],Cg=["get","post","put","delete"],_g=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Xg=["true","false"],Zg={},Ag={a:{attrs:{href:null,ping:null,type:null,media:null,target:$g,hreflang:null}},abbr:Zg,address:Zg,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Zg,aside:Zg,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Zg,base:{attrs:{href:null,target:$g}},bdi:Zg,bdo:Zg,blockquote:{attrs:{cite:null}},body:Zg,br:Zg,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Zg,center:Zg,cite:Zg,code:Zg,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:Zg,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Zg,div:Zg,dl:Zg,dt:Zg,em:Zg,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Zg,figure:Zg,footer:Zg,form:{attrs:{action:null,name:null,"accept-charset":Pg,autocomplete:["on","off"],enctype:_g,method:Cg,novalidate:["novalidate"],target:$g}},h1:Zg,h2:Zg,h3:Zg,h4:Zg,h5:Zg,h6:Zg,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Zg,hgroup:Zg,hr:Zg,html:{attrs:{manifest:null}},i:Zg,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:Zg,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Zg,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:Zg,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Pg,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:Zg,noscript:Zg,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:Zg,param:{attrs:{name:null,value:null}},pre:Zg,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Zg,rt:Zg,ruby:Zg,samp:Zg,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Pg}},section:Zg,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Zg,source:{attrs:{src:null,type:null,media:null}},span:Zg,strong:Zg,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Zg,summary:Zg,sup:Zg,table:Zg,tbody:Zg,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Zg,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:Zg,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Zg,time:{attrs:{datetime:null}},title:Zg,tr:Zg,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Zg,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:Zg},Tg={accesskey:null,class:null,contenteditable:Xg,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Xg,autocorrect:Xg,autocapitalize:Xg,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Xg,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Xg,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Xg,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Xg,"aria-hidden":Xg,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Xg,"aria-multiselectable":Xg,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Xg,"aria-relevant":null,"aria-required":Xg,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},Rg="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map((t=>"on"+t));for(let t of Rg)Tg[t]=null;class Eg{constructor(t,e){this.tags=Object.assign(Object.assign({},Ag),t),this.globalAttrs=Object.assign(Object.assign({},Tg),e),this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}function Vg(t,e,i=t.length){if(!e)return"";let n=e.firstChild,s=n&&n.getChild("TagName");return s?t.sliceString(s.from,Math.min(s.to,i)):""}function Mg(t,e=!1){for(let i=t.parent;i;i=i.parent)if("Element"==i.name){if(!e)return i;e=!1}return null}function Dg(t,e,i){let n=i.tags[Vg(t,Mg(e,!0))];return(null==n?void 0:n.children)||i.allTags}function Wg(t,e){let i=[];for(let n=e;n=Mg(n);){let s=Vg(t,n);if(s&&"CloseTag"==n.lastChild.name)break;s&&i.indexOf(s)<0&&("EndTag"==e.name||e.from>=n.firstChild.to)&&i.push(s)}return i}Eg.default=new Eg;const Ug=/^[:\-\.\w\u00b7-\uffff]*$/;function Yg(t,e,i,n,s){let r=/\s*>/.test(t.sliceDoc(s,s+5))?"":">";return{from:n,to:s,options:Dg(t.doc,i,e).map((t=>({label:t,type:"type"}))).concat(Wg(t.doc,i).map(((t,e)=>({label:"/"+t,apply:"/"+t+r,type:"type",boost:99-e})))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function qg(t,e,i,n){let s=/\s*>/.test(t.sliceDoc(n,n+5))?"":">";return{from:i,to:n,options:Wg(t.doc,e).map(((t,e)=>({label:t,apply:t+s,type:"type",boost:99-e}))),validFor:Ug}}function Lg(t,e){let{state:i,pos:n}=e,s=Xa(i).resolveInner(n),r=s.resolve(n,-1);for(let t,e=n;s==r&&(t=r.childBefore(e));){let i=t.lastChild;if(!i||!i.type.isError||i.from({label:t,type:"property"}))),validFor:Ug}}(i,t,r,"AttributeName"==r.name?r.from:n,n):"Is"==r.name||"AttributeValue"==r.name||"UnquotedAttributeValue"==r.name?function(t,e,i,n,s){var r;let o,a=null===(r=i.parent)||void 0===r?void 0:r.getChild("AttributeName"),l=[];if(a){let r=t.sliceDoc(a.from,a.to),h=e.globalAttrs[r];if(!h){let n=Mg(i),s=n?e.tags[Vg(t.doc,n)]:null;h=(null==s?void 0:s.attrs)&&s.attrs[r]}if(h){let e=t.sliceDoc(n,s).toLowerCase(),i='"',r='"';/^['"]/.test(e)?(o='"'==e[0]?/^[^"]*$/:/^[^']*$/,i="",r=t.sliceDoc(s,s+1)==e[0]?"":e[0],e=e.slice(1),n++):o=/^[^\s<>='"]*$/;for(let t of h)l.push({label:t,apply:i+t+r,type:"constant"})}}return{from:n,to:s,options:l,validFor:o}}(i,t,r,"Is"==r.name?n:r.from,n):!e.explicit||"Element"!=s.name&&"Text"!=s.name&&"Document"!=s.name?null:function(t,e,i,n){let s=[],r=0;for(let n of Dg(t.doc,i,e))s.push({label:"<"+n,type:"type"});for(let e of Wg(t.doc,i))s.push({label:"",type:"type",boost:99-r++});return{from:n,to:n,options:s,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}(i,t,r,n)}function zg(t){let{extraTags:e,extraGlobalAttributes:i}=t,n=i||e?new Eg(e,i):Eg.default;return t=>Lg(n,t)}const Ig=[{tag:"script",attrs:t=>"text/typescript"==t.type||"ts"==t.lang,parser:zf.parser},{tag:"script",attrs:t=>"text/babel"==t.type||"text/jsx"==t.type,parser:If.parser},{tag:"script",attrs:t=>"text/typescript-jsx"==t.type,parser:Bf.parser},{tag:"script",attrs:t=>!t.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(t.type),parser:qf.parser},{tag:"style",attrs:t=>(!t.lang||"css"==t.lang)&&(!t.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(t.type)),parser:kg.parser}],Bg=[{name:"style",parser:kg.parser.configure({top:"Styles"})}].concat(Rg.map((t=>({name:t,parser:qf.parser})))),jg=_a.define({name:"html",parser:FO.configure({props:[Na.add({Element(t){let e=/^(\s*)(<\/)?/.exec(t.textAfter);return t.node.to<=t.pos+e[0].length?t.continue():t.lineIndent(t.node.from)+(e[2]?0:t.unit)},"OpenTag CloseTag SelfClosingTag":t=>t.column(t.node.from)+t.unit,Document(t){if(t.pos+/\s*/.exec(t.textAfter)[0].lengtht.getChild("TagName")})],wrap:tg(Ig,Bg)}),languageData:{commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-._"}});function Ng(t={}){let e,i="";!1===t.matchClosingTags&&(i="noMatch"),!0===t.selfClosingTags&&(i=(i?i+" ":"")+"selfClosing"),(t.nestedLanguages&&t.nestedLanguages.length||t.nestedAttributes&&t.nestedAttributes.length)&&(e=tg((t.nestedLanguages||[]).concat(Ig),(t.nestedAttributes||[]).concat(Bg)));let n=e||i?jg.configure({dialect:i,wrap:e}):jg;return new Ua(n,[jg.data.of({autocomplete:zg(t)}),!1!==t.autoCloseTags?Fg:[],Nf().support,Qg().support])}const Gg=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),Fg=Ts.inputHandler.of(((t,e,i,n)=>{if(t.composing||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!jg.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((e=>{var i,r,o;let a,{head:l}=e,h=Xa(s).resolveInner(l,-1);if("TagName"!=h.name&&"StartTag"!=h.name||(h=h.parent),">"==n&&"OpenTag"==h.name){if("CloseTag"!=(null===(r=null===(i=h.parent)||void 0===i?void 0:i.lastChild)||void 0===r?void 0:r.name)&&(a=Vg(s.doc,h.parent,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`${e?"":">"}`;return{range:A.cursor(l+1),changes:{from:l+(e?1:0),insert:i}}}}else if("/"==n&&"OpenTag"==h.name){let e=h.parent,i=null==e?void 0:e.parent;if(e.from==l-1&&"CloseTag"!=(null===(o=i.lastChild)||void 0===o?void 0:o.name)&&(a=Vg(s.doc,i,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`/${a}${e?"":">"}`,n=l+i.length+(e?1:0);return{range:A.cursor(n),changes:{from:l,insert:i}}}}return{range:e}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)})),Hg=Qa({commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}}}),Jg=new ho,Kg=sO.configure({props:[rl.add((t=>!t.is("Block")||t.is("Document")||null!=tm(t)?void 0:(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to}))),Jg.add(tm),Na.add({Document:()=>null}),ka.add({Document:Hg})]});function tm(t){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(t.name);return e?+e[1]:void 0}function em(t,e){let i=t;for(;;){let t,n=i.nextSibling;if(!n||null!=(t=tm(n.type))&&t<=e)break;i=n}return i.to}const im=sl.of(((t,e,i)=>{for(let n=Xa(t).resolveInner(i,-1);n&&!(n.fromi)return{from:i,to:e}}return null}));function nm(t){return new Pa(Hg,t,[im],"markdown")}const sm=nm(Kg),rm=nm(Kg.configure([pO,mO,gO,bO]));class om{constructor(t,e,i,n,s,r,o){this.node=t,this.from=e,this.to=i,this.spaceBefore=n,this.spaceAfter=s,this.type=r,this.item=o}blank(t,e=!0){let i=this.spaceBefore+("Blockquote"==this.node.name?">":"");if(null!=t){for(;i.length0;t--)i+=" ";return i+(e?this.spaceAfter:"")}marker(t,e){let i="OrderedList"==this.node.name?String(+lm(this.item,t)[2]+e):"";return this.spaceBefore+i+this.type+this.spaceAfter}}function am(t,e){let i=[];for(let e=t;e&&"Document"!=e.name;e=e.parent)"ListItem"!=e.name&&"Blockquote"!=e.name&&"FencedCode"!=e.name||i.push(e);let n=[];for(let t=i.length-1;t>=0;t--){let s,r=i[t],o=e.lineAt(r.from),a=r.from-o.from;if("FencedCode"==r.name)n.push(new om(r,a,a,"","","",null));else if("Blockquote"==r.name&&(s=/^[ \t]*>( ?)/.exec(o.text.slice(a))))n.push(new om(r,a,a+s[0].length,"",s[1],">",null));else if("ListItem"==r.name&&"OrderedList"==r.parent.name&&(s=/^([ \t]*)\d+([.)])([ \t]*)/.exec(o.text.slice(a)))){let t=s[3],e=s[0].length;t.length>=4&&(t=t.slice(0,t.length-4),e-=4),n.push(new om(r.parent,a,a+e,s[1],t,s[2],r))}else if("ListItem"==r.name&&"BulletList"==r.parent.name&&(s=/^([ \t]*)([-+*])([ \t]{1,4}\[[ xX]\])?([ \t]+)/.exec(o.text.slice(a)))){let t=s[4],e=s[0].length;t.length>4&&(t=t.slice(0,t.length-4),e-=4);let i=s[2];s[3]&&(i+=s[3].replace(/[xX]/," ")),n.push(new om(r.parent,a,a+e,s[1],t,i,r))}}return n}function lm(t,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(t.from,t.from+10))}function hm(t,e,i,n=0){for(let s=-1,r=t;;){if("ListItem"==r.name){let t=lm(r,e),o=+t[2];if(s>=0){if(o!=s+1)return;i.push({from:r.from+t[1].length,to:r.from+t[0].length,insert:String(s+2+n)})}s=o}let t=r.nextSibling;if(!t)break;r=t}}function cm(t){return"QuoteMark"==t.name||"ListMark"==t.name}const um=[{key:"Enter",run:({state:t,dispatch:e})=>{let i=Xa(t),{doc:n}=t,s=null,r=t.changeByRange((e=>{if(!e.empty||!rm.isActiveAt(t,e.from))return s={range:e};let r=e.from,o=n.lineAt(r),a=am(i.resolveInner(r,-1),n);for(;a.length&&a[a.length-1].from>r-o.from;)a.pop();if(!a.length)return s={range:e};let l=a[a.length-1];if(l.to-l.spaceAfter.length>r-o.from)return s={range:e};let h=r>=l.to-l.spaceAfter.length&&!/\S/.test(o.text.slice(l.to));if(l.item&&h){if(l.node.firstChild.to>=r||o.from>0&&!/[^\s>]/.test(n.lineAt(o.from-1).text)){let t,e=a.length>1?a[a.length-2]:null,i="";e&&e.item?(t=o.from+e.from,i=e.marker(n,1)):t=o.from+(e?e.to:0);let s=[{from:t,to:r,insert:i}];return"OrderedList"==l.node.name&&hm(l.item,n,s,-2),e&&"OrderedList"==e.node.name&&hm(e.item,n,s),{range:A.cursor(t+i.length),changes:s}}{let e="";for(let t=0,i=a.length-2;t<=i;t++)e+=a[t].blank(t\s*$/.exec(i.text);if(s&&s.index==l.from){let n=t.changes([{from:i.from+s.index,to:i.to},{from:o.from+l.from,to:o.to}]);return{range:e.map(n),changes:n}}}let c=[];"OrderedList"==l.node.name&&hm(l.item,n,c);let u=l.item&&l.item.from]*/.exec(o.text)[0].length>=l.to)for(let t=0,e=a.length-1;t<=e;t++)d+=t!=e||u?a[t].blank(to.from&&/\s/.test(o.text.charAt(f-o.from-1));)f--;return d=t.lineBreak+d,c.push({from:f,to:r,insert:d}),{range:A.cursor(f+d.length),changes:c}}));return!s&&(e(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0)}},{key:"Backspace",run:({state:t,dispatch:e})=>{let i=Xa(t),n=null,s=t.changeByRange((e=>{let s=e.from,{doc:r}=t;if(e.empty&&rm.isActiveAt(t,e.from)){let t=r.lineAt(s),n=am(function(t,e){let i=t.resolveInner(e,-1),n=e;cm(i)&&(n=i.from,i=i.parent);for(let t;t=i.childBefore(n);)if(cm(t))n=t.from;else{if("OrderedList"!=t.name&&"BulletList"!=t.name)break;i=t.lastChild,n=i.to}return i}(i,s),r);if(n.length){let i=n[n.length-1],r=i.to-i.spaceAfter.length+(i.spaceAfter?1:0);if(s-t.from>r&&!/\S/.test(t.text.slice(r,s-t.from)))return{range:A.cursor(t.from+r),changes:{from:t.from+r,to:s}};if(s-t.from==r&&(!i.item||t.from<=i.item.from||!/\S/.test(t.text.slice(0,i.to)))){let n=t.from+i.from;if(i.item&&i.node.fromt.from-e.from||t.startSide-e.startSide)),ni.set(i)}getMatchingBracket(t){switch(t){case")":return"(";case"]":return"[";case"}":return"{";default:return null}}},{decorations:t=>t.decorations});var fm="[a-zA-Z\\$][a-zA-Z0-9\\$]*",pm="(?:\\.\\d+|\\d+\\.\\d*|\\d+)",Om="(?:`(?:`?"+pm+")?)",gm=new RegExp("(?:(?:\\d+)(?:\\^\\^(?:\\.\\w+|\\w+\\.\\w*|\\w+)"+Om+"?(?:\\*\\^[+-]?\\d+)?))"),mm=new RegExp("(?:"+pm+Om+"?(?:\\*\\^[+-]?\\d+)?)"),bm=new RegExp("(?:`?)(?:"+fm+")(?:`(?:"+fm+"))*(?:`?)");let wm=[];const vm=["True","False","All","None","Null","Full","$Failed","$Aborted"];function ym(t,e){var i;return'"'===(i=t.next())?(e.tokenize=Sm,e.tokenize(t,e)):"("===i&&t.eat("*")?(e.commentLevel++,e.tokenize=xm,e.tokenize(t,e)):(t.backUp(1),t.match(gm,!0,!1)||t.match(mm,!0,!1)?"number":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::usage)/,!0,!1)?"meta":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::[a-zA-Z\$][a-zA-Z0-9\$]*):?/,!0,!1)?"string.special":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*\s*:)(?:(?:[a-zA-Z\$][a-zA-Z0-9\$]*)|(?:[^:=>~@\^\&\*\)\[\]'\?,\|])).*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+/,!0,!1)||t.match(/_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)?"variableName.special":t.match(/\\\[[a-zA-Z\$][a-zA-Z0-9\$]*\]/,!0,!1)?"character":t.match(/(?:\[|\]|{|}|\(|\))/,!0,!1)?"bracket":t.match(/(?:#[a-zA-Z\$][a-zA-Z0-9\$]*|#+[0-9]?)/,!0,!1)?"variableName.constant":t.match(bm,!0,!1)?vm.indexOf(t.current())>-1?"number":wm.indexOf(t.current())>-1||0==wm.length?"keyword":t.current()in e.localVars?"atom":(e.localVars[t.current()]=!0,"function"):t.match(/(?:\\|\+|\-|\*|\/|,|;|\.|:|@|~|=|>|<|&|\||_|`|'|\^|\?|!|%)/,!0,!1)?"operator":(t.next(),"error"))}function Sm(t,e){for(var i,n=!1,s=!1;null!=(i=t.next());){if('"'===i&&!s){n=!0;break}s=!s&&"\\"===i}return n&&!s&&(e.tokenize=ym),"string"}function xm(t,e){for(var i,n;e.commentLevel>0&&null!=(n=t.next());)"("===i&&"*"===n&&e.commentLevel++,"*"===i&&")"===n&&e.commentLevel--,i=n;return e.commentLevel<=0&&(e.tokenize=ym),"comment"}const km={name:"mathematica",extendVariables:function(t){},startState:function(){return{tokenize:ym,commentLevel:0,localVars:{}}},token:function(t,e){return t.eatSpace()?null:e.tokenize(t,e)},languageData:{commentTokens:{block:{open:"(*",close:"*)"}}}};let Qm={of:t=>[Gl.define(km),Yd({override:[async e=>function(t,e){let i=t.matchBefore(/\w*/);return i.from!==i.to||t.explicit?{from:i.from,options:e.data}:null}(e,t)]}),Ys.of([{key:"Escape",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((t=>{let{from:e,to:i}=t;return{changes:{from:e,to:i,insert:"EC"},range:A.cursor(e+2)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])],reBuild:t=>{wm=t.map((t=>t.label))}};const $m=(t,e,i,n)=>{if(0==t.length)return;const s=(new Date).valueOf();n.transaction(e,i,s,t.length);for(const r of t)Pm(r,((t,r)=>{n.file(e,i,s,t,r)}))};function Pm(t,e){const i=new FileReader;i.addEventListener("load",(i=>{let n=base64ArrayBuffer(i.target.result);e(t.name,n)})),i.addEventListener("progress",(t=>{if(t.loaded&&t.total){const e=t.loaded/t.total*100;console.log(e)}})),i.readAsArrayBuffer(t)}const Cm=(t,e)=>Ts.domEventHandlers({drop(e,i){e.preventDefault();const n=[];e.dataTransfer.items?[...e.dataTransfer.items].forEach(((t,e)=>{if("file"===t.kind){const i=t.getAsFile();console.log(`… file[${e}].name = ${i.name}`),n.push(i)}})):[...e.dataTransfer.files].forEach(((t,e)=>{console.log(`… file[${e}].name = ${t.name}`),n.push(t)})),$m(n,e,i,t)},paste(t,i){let n=t.clipboardData||window.clipboardData;for(const s of n.items)if("string"===s.kind)switch(s.type){case"text/plain":break;case"image/png":t.preventDefault(),$m([s.getAsFile()],t,i,e)}else t.preventDefault(),$m([s.getAsFile()],t,i,e)}}),_m=new pr({regexp:/\\\[(\w+)\]/g,decoration:t=>ni.replace({widget:new Zm(t[1])})}),Xm=_i.fromClass(class{constructor(t){this.Greekholder=_m.createDeco(t)}update(t){this.Greekholder=_m.updateDeco(t,this.Greekholder)}},{decorations:t=>t.Greekholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Greekholder||ni.none))});class Zm extends ei{constructor(t){super(),this.name=t}eq(t){return this.name===t.name}toDOM(){let t=document.createElement("span");return t.innerHTML="&"+this.name.toLowerCase().replace("sqrt","radic").replace("undirectededge","harr").replace("directededge","rarr").replace(/capital(.*)/,((t,e)=>e.charAt(0).toUpperCase()+e.slice(1))).replace(/curly(.*)/,((t,e)=>e)).replace(/script(.*)/,((t,e)=>"el"+e.toLowerCase())).replace("transpose","#7488").replace("degree","deg")+";",t}ignoreEvent(){return!1}}const Am=new pr({regexp:/(->|<-)/g,decoration:t=>ni.replace({widget:new Tm(t[1])})});_i.fromClass(class{constructor(t){this.Arrowholder=Am.createDeco(t)}update(t){this.Arrowholder=Am.updateDeco(t,this.Arrowholder)}},{decorations:t=>t.Arrowholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Arrowholder||ni.none))});class Tm extends ei{constructor(t){super(),this.dir=t}eq(t){return this.dir===t.dir}toDOM(){let t=document.createElement("span");return"->"===this.dir?t.innerText="→":t.innerText="←",t}ignoreEvent(){return!1}}function Rm(t){if(!(t=t||{}).open)throw new Error('Balanced: please provide a "open" property');if(!t.close)throw new Error('Balanced: please provide a "close" property');if(this.balance=t.balance||!1,this.exceptions=t.exceptions||!1,this.caseInsensitive=t.caseInsensitive,this.head=t.head||t.open,this.head=Array.isArray(this.head)?this.head:[this.head],this.open=Array.isArray(t.open)?t.open:[t.open],this.close=Array.isArray(t.close)?t.close:[t.close],!Array.isArray(this.head)||!Array.isArray(this.open)||!Array.isArray(this.close)||this.head.length!==this.open.length||this.open.length!==this.close.length)throw new Error('Balanced: if you use arrays for a "head,open,close" you must use matching arrays for all options');var e=Dm(this.head.map(this.regExpFromArrayGroupedMap,this)),i=Dm(this.open.map(this.regExpFromArrayGroupedMap,this)),n=Dm(this.close.map(this.regExpFromArrayGroupedMap,this));this.regExp=Dm([e,i,n],"g"+(this.caseInsensitive?"i":"")),this.regExpGroupLength=this.head.length}function Em(t,e,i){for(var n=Mm(e.substr(0,i+1),/^.*\n?$/gim),s=Mm(e,/^.*\n?$/gim),r=n.length-1,o=i+1-(n.length?n[n.length-1].index:0),a="",l=2;l>=0;l--)r-l>=0&&s[r-l]&&(a+=e.substr(s[r-l].index,s[r-l].length)+"\n");for(l=0;l=0&&s[r+l]&&(a+=e.substr(s[r+l].index,s[r+l].length)+"\n");a=a.replace(/\t/g," ").replace(/\n$/,"");var h=new Error(t+" at "+(r+1)+":"+o+"\n\n"+a);return h.line=r+1,h.column=o,h.index=i,h}function Vm(t,e){return t>=e.index&&t<=e.index+e.length-1}function Mm(t,e){var i,n=new RegExp(e),s=[];if(t)for(;i=n.exec(t);)s.push({index:i.index,length:i[0].length,match:i[0]}),i[0].length||n.lastIndex++;return s}function Dm(t,e,i){var n=t.map((function(t){return t instanceof RegExp?t.source:function(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}(t)}),this).join("|");return n=i?"("+n+")":"(?:"+n+")",new RegExp(n,e||void 0)}Rm.prototype={regExpFromArrayGroupedMap:function(t){return Dm([t],null,!0)},matchContentsInBetweenBrackets:function(t,e){for(var i,n=new RegExp(this.regExp),s=[],r=[],o=null,a=!0;i=n.exec(t);){if(e){for(var l=!1,h=0;h{const i=((t,e,i)=>{var n,s=new RegExp(t),r=[];if(e)for(;n=s.exec(e);){if(i){for(var o=!1,a=0;a{new qm({open:"(*"+t+"[*)",close:"(*]"+t+"*)",balance:!1}).matchContentsInBetweenBrackets(e.value,[]).forEach((function(t){const s=e.value.slice(t.index+t.head.length,t.index+t.length-t.tail.length);n(i+t.index,{length:t.length,pos:i+t.index,argsPos:i+t.index+t.head.length,str:s})}))})(e,t,i,s)},o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)r(o,a)}var Im,Bm=function(){function t(t){var e=t.tag,i=t.decoration,n=t.decorate,s=t.boundary,r=t.maxLength,o=void 0===r?1e3:r;if(this.tag=e,n)this.addMatch=function(t,e,i,s){return n(s,i,i+t.length,t,e)};else if("function"==typeof i)this.addMatch=function(t,e,n,s){var r=i(t,e,n);r&&s(n,n+t.length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=function(t,e,n,s){return s(n,n+t.length,i)}}this.boundary=s,this.maxLength=o}return t.prototype.createDeco=function(t){for(var e=this,i=new Xt,n=i.add.bind(i),s=0,r=function(t,e){var i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;for(var n=[],s=0,r=i;s=a?n[n.length-1].to=l:n.push({from:a,to:l})}return n}(t,this.maxLength);st.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e},t.prototype.updateRange=function(t,e,i,n){for(var s=this,r=function(r){var a=Math.max(r.from,i),l=Math.min(r.to,n);if(l>a){var h=t.state.doc.lineAt(a),c=h.toh.from;a--)if(o.boundary.test(h.text[a-1-h.from])){u=a;break}for(;ld},add:f})}},o=this,a=0,l=t.visibleRanges;a{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*FB[*)((_)(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*FB[*)(("+s+")(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let Nm=class{constructor(t,e,i,n,s,r){this.view=e,this.visibleValue=t,this.placeholder=r,console.log(r),this.args=Lm(t.str,/\(\*,\*\)/gm);const o=this;let a,l;console.log("creating InstanceWidget"),a=Im({doc:o.args[0].body.slice(2,-1),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(o.visibleValue.pos),e.dispatch({selection:{anchor:o.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return l.dispatch({selection:{anchor:0}}),l.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){l.focus(),t.editorLastCursor=void 0}}])]}),l=Im({doc:o.args[2].body.slice(1,-2),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:a.state.doc.length}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:o.visibleValue.pos+o.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus(),t.editorLastCursor=void 0}}])]}),o.args[0].length=o.args[0].body.length,o.args[2].length=o.args[2].body.length,delete o.args[2].body,delete o.args[1].body,delete o.args[0].body,this.topEditor=a,this.bottomEditor=l}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="(("+t+")",s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length));const r=e.length-i[0].length;i[0].to=i[0].to+r,i[2].from=i[2].from+r,i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e="("+t+"))",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length));const r=e.length-i[2].length;i[2].to=i[2].to+r,i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t,e){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm),console.log("recreating InstanceWidget"),n=Im.state({doc:e.args[0].body.slice(2,-1),update:t=>e.applyChanges(t,0),eval:()=>{i.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(e.visibleValue.pos),i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus(),t.editorLastCursor=void 0}}])]}),s=Im.state({doc:e.args[2].body.slice(1,-2),update:t=>e.applyChanges(t,2),eval:()=>{e.view.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus(),t.editorLastCursor=void 0}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),console.log(e),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.placeholder=e,this.visibleValue.argsPos=t.argsPos}destroy(){this.topEditor.destroy(),this.bottomEditor.destroy()}},Gm=class extends ei{constructor(t,e,i,n){super(),this.view=i,this.visibleValue=t,this.reference=e,this.placeholder=n}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue,this),!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("fraction");const i=document.createElement("table");i.classList.add("container"),e.appendChild(i);const n=document.createElement("tbody");i.appendChild(n);const s=document.createElement("tr"),r=document.createElement("tr");n.appendChild(s),n.appendChild(r);const o=document.createElement("td");o.classList.add("enumenator"),s.appendChild(o);const a=document.createElement("td");r.appendChild(a);const l=this;return e.EditorWidget=new Nm(this.visibleValue,t,o,a,[],this),this.DOMElement=e,this.reference.push({destroy:()=>{l.destroy(e)}}),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const Fm=(t,e,i)=>new Bm({tag:"FB",decoration:n=>ni.replace({widget:new Gm(n,t,e,i)})}),Hm=t=>_i.fromClass(class{constructor(e){this.disposable=[],this.placeholder=Fm(this.disposable,e,this).createDeco(e),t.placeholder=this}update(t){this.placeholder=Fm(this.disposable,t,this).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var Jm;function Km(t){return Jm=t,[nb,Ys.of([{key:"Ctrl-2",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt[_](*]SqB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt["+s+"](*]SqB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let tb=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;this.sliceRanges=n,this.length=t.str.length,console.log("creating InstanceWidget"),this.editor=Jm({doc:t.str.slice(...n),parent:i,update:t=>r.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]})}applyChanges(t){const e=t,i={from:this.visibleValue.argsPos+5,to:this.visibleValue.argsPos+this.length-1,insert:e};console.log(this.visibleValue);const n=e.length+6-this.length;this.length=this.length+n,this.visibleValue.length=this.visibleValue.length+n,this.visibleValue.str="Sqrt["+e+"]",this.view.dispatch({changes:i})}update(t){if(this.visibleValue.str==t.str)this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos;else{console.warn("Out of sync"),this.visibleValue=t;const e=this.sliceRanges,i=this.editor,n=this,s=this.view;this.length=t.str.length;const r=Jm.state({doc:t.str.slice(...e),update:t=>n.applyChanges(t),eval:()=>{s.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos+n.visibleValue.length}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]});i.setState(r)}}destroy(){console.warn("destroy Instance of Widget!"),this.editor.destroy()}},eb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("sqroot");const i=this,n=document.createElement("span");return n.classList.add("radicand"),e.EditorWidget=new tb(this.visibleValue,t,n,[5,-1],[]),e.appendChild(n),this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const ib=(t,e)=>new Bm({tag:"SqB",decoration:i=>ni.replace({widget:new eb(i,t,e)})}),nb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=ib(this.disposable,t).createDeco(t)}update(t){this.placeholder=ib(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var sb;function rb(t){return sb=t,[hb,Ys.of([{key:"Ctrl--",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SbB[*)Subscript[_(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SbB[*)Subscript["+s+"(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let ob=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),console.log(r.visibleValue),o=sb({doc:r.args[0].body.slice(10),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){a.focus()}}])]}),a=sb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Subscript["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),console.log(e.visibleValue),n=sb.state({doc:e.args[0].body.slice(10),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus()}}])]}),s=sb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},ab=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sub");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new ob(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const lb=(t,e)=>new Bm({tag:"SbB",decoration:i=>ni.replace({widget:new ab(i,t,e)})}),hb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=lb(this.disposable,t).createDeco(t)}update(t){this.placeholder=lb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var cb;function ub(t){return cb=t,[Ob,Ys.of([{key:"Ctrl-6",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SpB[*)Power[_(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SpB[*)Power["+s+"(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let db=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),o=cb({doc:r.args[0].body.slice(6),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus()}}])]}),a=cb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Power["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),n=cb.state({doc:e.args[0].body.slice(6),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.bottomEditor.focus()}}])]}),s=cb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},fb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sup");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new db(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}destroy(t){t.EditorWidget.destroy()}};const pb=(t,e)=>new Bm({tag:"SpB",decoration:i=>ni.replace({widget:new fb(i,t,e)})}),Ob=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=pb(this.disposable,t).createDeco(t)}update(t){this.placeholder=pb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var gb={},mb={},bb={},wb={};function vb(t){let e=t.length;for(;--e>=0;)t[e]=0}const yb=256,Sb=286,xb=30,kb=15,Qb=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),$b=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Pb=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Cb=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_b=new Array(576);vb(_b);const Xb=new Array(60);vb(Xb);const Zb=new Array(512);vb(Zb);const Ab=new Array(256);vb(Ab);const Tb=new Array(29);vb(Tb);const Rb=new Array(xb);function Eb(t,e,i,n,s){this.static_tree=t,this.extra_bits=e,this.extra_base=i,this.elems=n,this.max_length=s,this.has_stree=t&&t.length}let Vb,Mb,Db;function Wb(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}vb(Rb);const Ub=t=>t<256?Zb[t]:Zb[256+(t>>>7)],Yb=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},qb=(t,e,i)=>{t.bi_valid>16-i?(t.bi_buf|=e<>16-t.bi_valid,t.bi_valid+=i-16):(t.bi_buf|=e<{qb(t,i[2*e],i[2*e+1])},zb=(t,e)=>{let i=0;do{i|=1&t,t>>>=1,i<<=1}while(--e>0);return i>>>1},Ib=(t,e,i)=>{const n=new Array(16);let s,r,o=0;for(s=1;s<=kb;s++)o=o+i[s-1]<<1,n[s]=o;for(r=0;r<=e;r++){let e=t[2*r+1];0!==e&&(t[2*r]=zb(n[e]++,e))}},Bb=t=>{let e;for(e=0;e{t.bi_valid>8?Yb(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},Nb=(t,e,i,n)=>{const s=2*e,r=2*i;return t[s]{const n=t.heap[i];let s=i<<1;for(;s<=t.heap_len&&(s{let n,s,r,o,a=0;if(0!==t.sym_next)do{n=255&t.pending_buf[t.sym_buf+a++],n+=(255&t.pending_buf[t.sym_buf+a++])<<8,s=t.pending_buf[t.sym_buf+a++],0===n?Lb(t,s,e):(r=Ab[s],Lb(t,r+yb+1,e),o=Qb[r],0!==o&&(s-=Tb[r],qb(t,s,o)),n--,r=Ub(n),Lb(t,r,i),o=$b[r],0!==o&&(n-=Rb[r],qb(t,n,o)))}while(a{const i=e.dyn_tree,n=e.stat_desc.static_tree,s=e.stat_desc.has_stree,r=e.stat_desc.elems;let o,a,l,h=-1;for(t.heap_len=0,t.heap_max=573,o=0;o>1;o>=1;o--)Gb(t,i,o);l=r;do{o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Gb(t,i,1),a=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=a,i[2*l]=i[2*o]+i[2*a],t.depth[l]=(t.depth[o]>=t.depth[a]?t.depth[o]:t.depth[a])+1,i[2*o+1]=i[2*a+1]=l,t.heap[1]=l++,Gb(t,i,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const i=e.dyn_tree,n=e.max_code,s=e.stat_desc.static_tree,r=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,l=e.stat_desc.max_length;let h,c,u,d,f,p,O=0;for(d=0;d<=kb;d++)t.bl_count[d]=0;for(i[2*t.heap[t.heap_max]+1]=0,h=t.heap_max+1;h<573;h++)c=t.heap[h],d=i[2*i[2*c+1]+1]+1,d>l&&(d=l,O++),i[2*c+1]=d,c>n||(t.bl_count[d]++,f=0,c>=a&&(f=o[c-a]),p=i[2*c],t.opt_len+=p*(d+f),r&&(t.static_len+=p*(s[2*c+1]+f)));if(0!==O){do{for(d=l-1;0===t.bl_count[d];)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[l]--,O-=2}while(O>0);for(d=l;0!==d;d--)for(c=t.bl_count[d];0!==c;)u=t.heap[--h],u>n||(i[2*u+1]!==d&&(t.opt_len+=(d-i[2*u+1])*i[2*u],i[2*u+1]=d),c--)}})(t,e),Ib(i,h,t.bl_count)},Jb=(t,e,i)=>{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),e[2*(i+1)+1]=65535,n=0;n<=i;n++)s=o,o=e[2*(n+1)+1],++a{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),n=0;n<=i;n++)if(s=o,o=e[2*(n+1)+1],!(++a{qb(t,0+(n?1:0),3),jb(t),Yb(t,i),Yb(t,~i),i&&t.pending_buf.set(t.window.subarray(e,e+i),t.pending),t.pending+=i};wb._tr_init=t=>{tw||((()=>{let t,e,i,n,s;const r=new Array(16);for(i=0,n=0;n<28;n++)for(Tb[n]=i,t=0;t<1<>=7;n{let s,r,o=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e{let e;for(Jb(t,t.dyn_ltree,t.l_desc.max_code),Jb(t,t.dyn_dtree,t.d_desc.max_code),Hb(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*Cb[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=i+5,i+4<=s&&-1!==e?ew(t,e,i,n):4===t.strategy||r===s?(qb(t,2+(n?1:0),3),Fb(t,_b,Xb)):(qb(t,4+(n?1:0),3),((t,e,i,n)=>{let s;for(qb(t,e-257,5),qb(t,i-1,5),qb(t,n-4,4),s=0;s(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=i,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(Ab[i]+yb+1)]++,t.dyn_dtree[2*Ub(e)]++),t.sym_next===t.sym_end),wb._tr_align=t=>{qb(t,2,3),Lb(t,256,_b),(t=>{16===t.bi_valid?(Yb(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)};var iw=(t,e,i,n)=>{let s=65535&t|0,r=t>>>16&65535|0,o=0;for(;0!==i;){o=i>2e3?2e3:i,i-=o;do{s=s+e[n++]|0,r=r+s|0}while(--o);s%=65521,r%=65521}return s|r<<16|0};const nw=new Uint32Array((()=>{let t,e=[];for(var i=0;i<256;i++){t=i;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e})());var sw=(t,e,i,n)=>{const s=nw,r=n+i;t^=-1;for(let i=n;i>>8^s[255&(t^e[i])];return-1^t},rw={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},ow={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:aw,_tr_stored_block:lw,_tr_flush_block:hw,_tr_tally:cw,_tr_align:uw}=wb,dw=iw,fw=sw,pw=rw,{Z_NO_FLUSH:Ow,Z_PARTIAL_FLUSH:gw,Z_FULL_FLUSH:mw,Z_FINISH:bw,Z_BLOCK:ww,Z_OK:vw,Z_STREAM_END:yw,Z_STREAM_ERROR:Sw,Z_DATA_ERROR:xw,Z_BUF_ERROR:kw,Z_DEFAULT_COMPRESSION:Qw,Z_FILTERED:$w,Z_HUFFMAN_ONLY:Pw,Z_RLE:Cw,Z_FIXED:_w,Z_DEFAULT_STRATEGY:Xw,Z_UNKNOWN:Zw,Z_DEFLATED:Aw}=ow,Tw=258,Rw=262,Ew=42,Vw=113,Mw=666,Dw=(t,e)=>(t.msg=pw[e],e),Ww=t=>2*t-(t>4?9:0),Uw=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Yw=t=>{let e,i,n,s=t.w_size;e=t.hash_size,n=e;do{i=t.head[--n],t.head[n]=i>=s?i-s:0}while(--e);e=s,n=e;do{i=t.prev[--n],t.prev[n]=i>=s?i-s:0}while(--e)};let qw=(t,e,i)=>(e<{const e=t.state;let i=e.pending;i>t.avail_out&&(i=t.avail_out),0!==i&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+i),t.next_out),t.next_out+=i,e.pending_out+=i,t.total_out+=i,t.avail_out-=i,e.pending-=i,0===e.pending&&(e.pending_out=0))},zw=(t,e)=>{hw(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Lw(t.strm)},Iw=(t,e)=>{t.pending_buf[t.pending++]=e},Bw=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},jw=(t,e,i,n)=>{let s=t.avail_in;return s>n&&(s=n),0===s?0:(t.avail_in-=s,e.set(t.input.subarray(t.next_in,t.next_in+s),i),1===t.state.wrap?t.adler=dw(t.adler,e,s,i):2===t.state.wrap&&(t.adler=fw(t.adler,e,s,i)),t.next_in+=s,t.total_in+=s,s)},Nw=(t,e)=>{let i,n,s=t.max_chain_length,r=t.strstart,o=t.prev_length,a=t.nice_match;const l=t.strstart>t.w_size-Rw?t.strstart-(t.w_size-Rw):0,h=t.window,c=t.w_mask,u=t.prev,d=t.strstart+Tw;let f=h[r+o-1],p=h[r+o];t.prev_length>=t.good_match&&(s>>=2),a>t.lookahead&&(a=t.lookahead);do{if(i=e,h[i+o]===p&&h[i+o-1]===f&&h[i]===h[r]&&h[++i]===h[r+1]){r+=2,i++;do{}while(h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&ro){if(t.match_start=e,o=n,n>=a)break;f=h[r+o-1],p=h[r+o]}}}while((e=u[e&c])>l&&0!=--s);return o<=t.lookahead?o:t.lookahead},Gw=t=>{const e=t.w_size;let i,n,s;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Rw)&&(t.window.set(t.window.subarray(e,e+e-n),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Yw(t),n+=e),0===t.strm.avail_in)break;if(i=jw(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=i,t.lookahead+t.insert>=3)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=qw(t,t.ins_h,t.window[s+1]);t.insert&&(t.ins_h=qw(t,t.ins_h,t.window[s+3-1]),t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead{let i,n,s,r=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,o=0,a=t.strm.avail_in;do{if(i=65535,s=t.bi_valid+42>>3,t.strm.avail_outn+t.strm.avail_in&&(i=n+t.strm.avail_in),i>s&&(i=s),i>8,t.pending_buf[t.pending-2]=~i,t.pending_buf[t.pending-1]=~i>>8,Lw(t.strm),n&&(n>i&&(n=i),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+n),t.strm.next_out),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n,t.block_start+=n,i-=n),i&&(jw(t.strm,t.strm.output,t.strm.next_out,i),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i)}while(0===o);return a-=t.strm.avail_in,a&&(a>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=a&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-a,t.strm.next_in),t.strstart),t.strstart+=a,t.insert+=a>t.w_size-t.insert?t.w_size-t.insert:a),t.block_start=t.strstart),t.high_waters&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,s+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),s>t.strm.avail_in&&(s=t.strm.avail_in),s&&(jw(t.strm,t.window,t.strstart,s),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.high_water>3,s=t.pending_buf_size-s>65535?65535:t.pending_buf_size-s,r=s>t.w_size?t.w_size:s,n=t.strstart-t.block_start,(n>=r||(n||e===bw)&&e!==Ow&&0===t.strm.avail_in&&n<=s)&&(i=n>s?s:n,o=e===bw&&0===t.strm.avail_in&&i===n?1:0,lw(t,t.block_start,i,o),t.block_start+=i,Lw(t.strm)),o?3:1)},Hw=(t,e)=>{let i,n;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==i&&t.strstart-i<=t.w_size-Rw&&(t.match_length=Nw(t,i)),t.match_length>=3)if(n=cw(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=qw(t,t.ins_h,t.window[t.strstart+1]);else n=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2},Jw=(t,e)=>{let i,n,s;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==i&&t.prev_length4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){s=t.strstart+t.lookahead-3,n=cw(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=s&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(zw(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(n=cw(t,0,t.window[t.strstart-1]),n&&zw(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=cw(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2};function Kw(t,e,i,n,s){this.good_length=t,this.max_lazy=e,this.nice_length=i,this.max_chain=n,this.func=s}const tv=[new Kw(0,0,0,0,Fw),new Kw(4,4,8,4,Hw),new Kw(4,5,16,8,Hw),new Kw(4,6,32,32,Hw),new Kw(4,4,16,16,Jw),new Kw(8,16,32,32,Jw),new Kw(8,16,128,128,Jw),new Kw(8,32,128,256,Jw),new Kw(32,128,258,1024,Jw),new Kw(32,258,258,4096,Jw)];function ev(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Aw,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Uw(this.dyn_ltree),Uw(this.dyn_dtree),Uw(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Uw(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Uw(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const iv=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==Ew&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==Vw&&e.status!==Mw?1:0},nv=t=>{if(iv(t))return Dw(t,Sw);t.total_in=t.total_out=0,t.data_type=Zw;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?Ew:Vw,t.adler=2===e.wrap?0:1,e.last_flush=-2,aw(e),vw},sv=t=>{const e=nv(t);var i;return e===vw&&((i=t.state).window_size=2*i.w_size,Uw(i.head),i.max_lazy_match=tv[i.level].max_lazy,i.good_match=tv[i.level].good_length,i.nice_match=tv[i.level].nice_length,i.max_chain_length=tv[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=2,i.match_available=0,i.ins_h=0),e},rv=(t,e,i,n,s,r)=>{if(!t)return Sw;let o=1;if(e===Qw&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),s<1||s>9||i!==Aw||n<8||n>15||e<0||e>9||r<0||r>_w||8===n&&1!==o)return Dw(t,Sw);8===n&&(n=9);const a=new ev;return t.state=a,a.strm=t,a.status=Ew,a.wrap=o,a.gzhead=null,a.w_bits=n,a.w_size=1<rv(t,e,Aw,15,8,Xw),bb.deflateInit2=rv,bb.deflateReset=sv,bb.deflateResetKeep=nv,bb.deflateSetHeader=(t,e)=>iv(t)||2!==t.state.wrap?Sw:(t.state.gzhead=e,vw),bb.deflate=(t,e)=>{if(iv(t)||e>ww||e<0)return t?Dw(t,Sw):Sw;const i=t.state;if(!t.output||0!==t.avail_in&&!t.input||i.status===Mw&&e!==bw)return Dw(t,0===t.avail_out?kw:Sw);const n=i.last_flush;if(i.last_flush=e,0!==i.pending){if(Lw(t),0===t.avail_out)return i.last_flush=-1,vw}else if(0===t.avail_in&&Ww(e)<=Ww(n)&&e!==bw)return Dw(t,kw);if(i.status===Mw&&0!==t.avail_in)return Dw(t,kw);if(i.status===Ew&&0===i.wrap&&(i.status=Vw),i.status===Ew){let e=Aw+(i.w_bits-8<<4)<<8,n=-1;if(n=i.strategy>=Pw||i.level<2?0:i.level<6?1:6===i.level?2:3,e|=n<<6,0!==i.strstart&&(e|=32),e+=31-e%31,Bw(i,e),0!==i.strstart&&(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),t.adler=1,i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(57===i.status)if(t.adler=0,Iw(i,31),Iw(i,139),Iw(i,8),i.gzhead)Iw(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),Iw(i,255&i.gzhead.time),Iw(i,i.gzhead.time>>8&255),Iw(i,i.gzhead.time>>16&255),Iw(i,i.gzhead.time>>24&255),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(Iw(i,255&i.gzhead.extra.length),Iw(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=fw(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if(Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,3),i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw;if(69===i.status){if(i.gzhead.extra){let e=i.pending,n=(65535&i.gzhead.extra.length)-i.gzindex;for(;i.pending+n>i.pending_buf_size;){let s=i.pending_buf_size-i.pending;if(i.pending_buf.set(i.gzhead.extra.subarray(i.gzindex,i.gzindex+s),i.pending),i.pending=i.pending_buf_size,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex+=s,Lw(t),0!==i.pending)return i.last_flush=-1,vw;e=0,n-=s}let s=new Uint8Array(i.gzhead.extra);i.pending_buf.set(s.subarray(i.gzindex,i.gzindex+n),i.pending),i.pending+=n,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex=0}i.status=73}if(73===i.status){if(i.gzhead.name){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),i.gzindex=0}i.status=91}if(91===i.status){if(i.gzhead.comment){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n))}i.status=103}if(103===i.status){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size&&(Lw(t),0!==i.pending))return i.last_flush=-1,vw;Iw(i,255&t.adler),Iw(i,t.adler>>8&255),t.adler=0}if(i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(0!==t.avail_in||0!==i.lookahead||e!==Ow&&i.status!==Mw){let n=0===i.level?Fw(i,e):i.strategy===Pw?((t,e)=>{let i;for(;;){if(0===t.lookahead&&(Gw(t),0===t.lookahead)){if(e===Ow)return 1;break}if(t.match_length=0,i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):i.strategy===Cw?((t,e)=>{let i,n,s,r;const o=t.window;for(;;){if(t.lookahead<=Tw){if(Gw(t),t.lookahead<=Tw&&e===Ow)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(s=t.strstart-1,n=o[s],n===o[++s]&&n===o[++s]&&n===o[++s])){r=t.strstart+Tw;do{}while(n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&st.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(i=cw(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):tv[i.level].func(i,e);if(3!==n&&4!==n||(i.status=Mw),1===n||3===n)return 0===t.avail_out&&(i.last_flush=-1),vw;if(2===n&&(e===gw?uw(i):e!==ww&&(lw(i,0,0,!1),e===mw&&(Uw(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),Lw(t),0===t.avail_out))return i.last_flush=-1,vw}return e!==bw?vw:i.wrap<=0?yw:(2===i.wrap?(Iw(i,255&t.adler),Iw(i,t.adler>>8&255),Iw(i,t.adler>>16&255),Iw(i,t.adler>>24&255),Iw(i,255&t.total_in),Iw(i,t.total_in>>8&255),Iw(i,t.total_in>>16&255),Iw(i,t.total_in>>24&255)):(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),Lw(t),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?vw:yw)},bb.deflateEnd=t=>{if(iv(t))return Sw;const e=t.state.status;return t.state=null,e===Vw?Dw(t,xw):vw},bb.deflateSetDictionary=(t,e)=>{let i=e.length;if(iv(t))return Sw;const n=t.state,s=n.wrap;if(2===s||1===s&&n.status!==Ew||n.lookahead)return Sw;if(1===s&&(t.adler=dw(t.adler,e,i,0)),n.wrap=0,i>=n.w_size){0===s&&(Uw(n.head),n.strstart=0,n.block_start=0,n.insert=0);let t=new Uint8Array(n.w_size);t.set(e.subarray(i-n.w_size,i),0),e=t,i=n.w_size}const r=t.avail_in,o=t.next_in,a=t.input;for(t.avail_in=i,t.next_in=0,t.input=e,Gw(n);n.lookahead>=3;){let t=n.strstart,e=n.lookahead-2;do{n.ins_h=qw(n,n.ins_h,n.window[t+3-1]),n.prev[t&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=t,t++}while(--e);n.strstart=t,n.lookahead=2,Gw(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,t.next_in=o,t.input=a,t.avail_in=r,n.wrap=s,vw},bb.deflateInfo="pako deflate (from Nodeca project)";var ov={};const av=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);ov.assign=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const e in i)av(i,e)&&(t[e]=i[e])}}return t},ov.flattenChunks=t=>{let e=0;for(let i=0,n=t.length;i=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;cv[254]=cv[254]=1,lv.string2buf=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,i,n,s,r,o=t.length,a=0;for(s=0;s>>6,e[r++]=128|63&i):i<65536?(e[r++]=224|i>>>12,e[r++]=128|i>>>6&63,e[r++]=128|63&i):(e[r++]=240|i>>>18,e[r++]=128|i>>>12&63,e[r++]=128|i>>>6&63,e[r++]=128|63&i);return e};lv.buf2string=(t,e)=>{const i=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let n,s;const r=new Array(2*i);for(s=0,n=0;n4)r[s++]=65533,n+=o-1;else{for(e&=2===o?31:3===o?15:7;o>1&&n1?r[s++]=65533:e<65536?r[s++]=e:(e-=65536,r[s++]=55296|e>>10&1023,r[s++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&hv)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let i="";for(let n=0;n{(e=e||t.length)>t.length&&(e=t.length);let i=e-1;for(;i>=0&&128==(192&t[i]);)i--;return i<0||0===i?e:i+cv[t[i]]>e?i:e};var uv=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const dv=bb,fv=ov,pv=lv,Ov=rw,gv=uv,mv=Object.prototype.toString,{Z_NO_FLUSH:bv,Z_SYNC_FLUSH:wv,Z_FULL_FLUSH:vv,Z_FINISH:yv,Z_OK:Sv,Z_STREAM_END:xv,Z_DEFAULT_COMPRESSION:kv,Z_DEFAULT_STRATEGY:Qv,Z_DEFLATED:$v}=ow;function Pv(t){this.options=fv.assign({level:kv,method:$v,chunkSize:16384,windowBits:15,memLevel:8,strategy:Qv},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new gv,this.strm.avail_out=0;let i=dv.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(i!==Sv)throw new Error(Ov[i]);if(e.header&&dv.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?pv.string2buf(e.dictionary):"[object ArrayBuffer]"===mv.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,i=dv.deflateSetDictionary(this.strm,t),i!==Sv)throw new Error(Ov[i]);this._dict_set=!0}}function Cv(t,e){const i=new Pv(e);if(i.push(t,!0),i.err)throw i.msg||Ov[i.err];return i.result}Pv.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize;let s,r;if(this.ended)return!1;for(r=e===~~e?e:!0===e?yv:bv,"string"==typeof t?i.input=pv.string2buf(t):"[object ArrayBuffer]"===mv.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),(r===wv||r===vv)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(s=dv.deflate(i,r),s===xv)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),s=dv.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===Sv;if(0!==i.avail_out){if(r>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},Pv.prototype.onData=function(t){this.chunks.push(t)},Pv.prototype.onEnd=function(t){t===Sv&&(this.result=fv.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},mb.Deflate=Pv,mb.deflate=Cv,mb.deflateRaw=function(t,e){return(e=e||{}).raw=!0,Cv(t,e)},mb.gzip=function(t,e){return(e=e||{}).gzip=!0,Cv(t,e)},mb.constants=ow;var _v={},Xv={};const Zv=16209;const Av=15,Tv=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Rv=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Ev=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Vv=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Mv=(t,e,i,n,s,r,o,a)=>{const l=a.bits;let h,c,u,d,f,p,O=0,g=0,m=0,b=0,w=0,v=0,y=0,S=0,x=0,k=0,Q=null;const $=new Uint16Array(16),P=new Uint16Array(16);let C,_,X,Z=null;for(O=0;O<=Av;O++)$[O]=0;for(g=0;g=1&&0===$[b];b--);if(w>b&&(w=b),0===b)return s[r++]=20971520,s[r++]=20971520,a.bits=1,0;for(m=1;m0&&(0===t||1!==b))return-1;for(P[1]=0,O=1;O852||2===t&&x>592)return 1;for(;;){C=O-y,o[g]+1=p?(_=Z[o[g]-p],X=Q[o[g]-p]):(_=96,X=0),h=1<>y)+c]=C<<24|_<<16|X|0}while(0!==c);for(h=1<>=1;if(0!==h?(k&=h-1,k+=h):k=0,g++,0==--$[O]){if(O===b)break;O=e[i+o[g]]}if(O>w&&(k&d)!==u){for(0===y&&(y=w),f+=m,v=O-y,S=1<852||2===t&&x>592)return 1;u=k&d,s[u]=w<<24|v<<16|f-r|0}}return 0!==k&&(s[f+k]=O-y<<24|64<<16|0),a.bits=w,0};const Dv=iw,Wv=sw,Uv=function(t,e){let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,y,S,x,k,Q;const $=t.state;i=t.next_in,k=t.input,n=i+(t.avail_in-5),s=t.next_out,Q=t.output,r=s-(e-t.avail_out),o=s+(t.avail_out-257),a=$.dmax,l=$.wsize,h=$.whave,c=$.wnext,u=$.window,d=$.hold,f=$.bits,p=$.lencode,O=$.distcode,g=(1<<$.lenbits)-1,m=(1<<$.distbits)-1;t:do{f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,0===w)Q[s++]=65535&b;else{if(!(16&w)){if(0==(64&w)){b=p[(65535&b)+(d&(1<>>=w,f-=w),f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,!(16&w)){if(0==(64&w)){b=O[(65535&b)+(d&(1<a){t.msg="invalid distance too far back",$.mode=Zv;break t}if(d>>>=w,f-=w,w=s-r,y>w){if(w=y-w,w>h&&$.sane){t.msg="invalid distance too far back",$.mode=Zv;break t}if(S=0,x=u,0===c){if(S+=l-w,w2;)Q[s++]=x[S++],Q[s++]=x[S++],Q[s++]=x[S++],v-=3;v&&(Q[s++]=x[S++],v>1&&(Q[s++]=x[S++]))}else{S=s-y;do{Q[s++]=Q[S++],Q[s++]=Q[S++],Q[s++]=Q[S++],v-=3}while(v>2);v&&(Q[s++]=Q[S++],v>1&&(Q[s++]=Q[S++]))}break}}break}}while(i>3,i-=v,f-=v<<3,d&=(1<(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function hy(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const cy=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode16211?1:0},uy=t=>{if(cy(t))return Nv;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Kv,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,Iv},dy=t=>{if(cy(t))return Nv;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,uy(t)},fy=(t,e)=>{let i;if(cy(t))return Nv;const n=t.state;return e<0?(i=0,e=-e):(i=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?Nv:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=i,n.wbits=e,dy(t))},py=(t,e)=>{if(!t)return Nv;const i=new hy;t.state=i,i.strm=t,i.window=null,i.mode=Kv;const n=fy(t,e);return n!==Iv&&(t.state=null),n};let Oy,gy,my=!0;const by=t=>{if(my){Oy=new Int32Array(512),gy=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Yv(1,t.lens,0,288,Oy,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Yv(2,t.lens,0,32,gy,0,t.work,{bits:5}),my=!1}t.lencode=Oy,t.lenbits=9,t.distcode=gy,t.distbits=5},wy=(t,e,i,n)=>{let s;const r=t.state;return null===r.window&&(r.wsize=1<=r.wsize?(r.window.set(e.subarray(i-r.wsize,i),0),r.wnext=0,r.whave=r.wsize):(s=r.wsize-r.wnext,s>n&&(s=n),r.window.set(e.subarray(i-n,i-n+s),r.wnext),(n-=s)?(r.window.set(e.subarray(i-n,i),0),r.wnext=n,r.whave=r.wsize):(r.wnext+=s,r.wnext===r.wsize&&(r.wnext=0),r.whavepy(t,15),Xv.inflateInit2=py,Xv.inflate=(t,e)=>{let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,y,S,x,k=0;const Q=new Uint8Array(4);let $,P;const C=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(cy(t)||!t.output||!t.input&&0!==t.avail_in)return Nv;i=t.state,i.mode===ey&&(i.mode=iy),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,u=a,d=l,x=Iv;t:for(;;)switch(i.mode){case Kv:if(0===i.wrap){i.mode=iy;break}for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0),h=0,c=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",i.mode=ay;break}if((15&h)!==Jv){t.msg="unknown compression method",i.mode=ay;break}if(h>>>=4,c-=4,S=8+(15&h),0===i.wbits&&(i.wbits=S),S>15||S>i.wbits){t.msg="invalid window size",i.mode=ay;break}i.dmax=1<>8&1),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16182;case 16182:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>8&255,Q[2]=h>>>16&255,Q[3]=h>>>24&255,i.check=Wv(i.check,Q,4,0)),h=0,c=0,i.mode=16183;case 16183:for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>8),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16184;case 16184:if(1024&i.flags){for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(f=i.length,f>a&&(f=a),f&&(i.head&&(S=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(n.subarray(r,r+f),S)),512&i.flags&&4&i.wrap&&(i.check=Wv(i.check,n,f,r)),a-=f,r+=f,i.length-=f),i.length))break t;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===a)break t;f=0;do{S=n[r+f++],i.head&&S&&i.length<65536&&(i.head.name+=String.fromCharCode(S))}while(S&&f>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=ey;break;case 16189:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>=7&c,c-=7&c,i.mode=oy;break}for(;c<3;){if(0===a)break t;a--,h+=n[r++]<>>=1,c-=1,3&h){case 0:i.mode=16193;break;case 1:if(by(i),i.mode=sy,e===zv){h>>>=2,c-=2;break t}break;case 2:i.mode=16196;break;case 3:t.msg="invalid block type",i.mode=ay}h>>>=2,c-=2;break;case 16193:for(h>>>=7&c,c-=7&c;c<32;){if(0===a)break t;a--,h+=n[r++]<>>16^65535)){t.msg="invalid stored block lengths",i.mode=ay;break}if(i.length=65535&h,h=0,c=0,i.mode=ny,e===zv)break t;case ny:i.mode=16195;case 16195:if(f=i.length,f){if(f>a&&(f=a),f>l&&(f=l),0===f)break t;s.set(n.subarray(r,r+f),o),a-=f,r+=f,l-=f,o+=f,i.length-=f;break}i.mode=ey;break;case 16196:for(;c<14;){if(0===a)break t;a--,h+=n[r++]<>>=5,c-=5,i.ndist=1+(31&h),h>>>=5,c-=5,i.ncode=4+(15&h),h>>>=4,c-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=ay;break}i.have=0,i.mode=16197;case 16197:for(;i.have>>=3,c-=3}for(;i.have<19;)i.lens[C[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,$={bits:i.lenbits},x=Yv(0,i.lens,0,19,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid code lengths set",i.mode=ay;break}i.have=0,i.mode=16198;case 16198:for(;i.have>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=g,c-=g,i.lens[i.have++]=b;else{if(16===b){for(P=g+2;c>>=g,c-=g,0===i.have){t.msg="invalid bit length repeat",i.mode=ay;break}S=i.lens[i.have-1],f=3+(3&h),h>>>=2,c-=2}else if(17===b){for(P=g+3;c>>=g,c-=g,S=0,f=3+(7&h),h>>>=3,c-=3}else{for(P=g+7;c>>=g,c-=g,S=0,f=11+(127&h),h>>>=7,c-=7}if(i.have+f>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=ay;break}for(;f--;)i.lens[i.have++]=S}}if(i.mode===ay)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=ay;break}if(i.lenbits=9,$={bits:i.lenbits},x=Yv(1,i.lens,0,i.nlen,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid literal/lengths set",i.mode=ay;break}if(i.distbits=6,i.distcode=i.distdyn,$={bits:i.distbits},x=Yv(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,$),i.distbits=$.bits,x){t.msg="invalid distances set",i.mode=ay;break}if(i.mode=sy,e===zv)break t;case sy:i.mode=ry;case ry:if(a>=6&&l>=258){t.next_out=o,t.avail_out=l,t.next_in=r,t.avail_in=a,i.hold=h,i.bits=c,Uv(t,d),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,i.mode===ey&&(i.back=-1);break}for(i.back=0;k=i.lencode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,i.length=b,0===m){i.mode=16205;break}if(32&m){i.back=-1,i.mode=ey;break}if(64&m){t.msg="invalid literal/length code",i.mode=ay;break}i.extra=15&m,i.mode=16201;case 16201:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;k=i.distcode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,64&m){t.msg="invalid distance code",i.mode=ay;break}i.offset=b,i.extra=15&m,i.mode=16203;case 16203:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=ay;break}i.mode=16204;case 16204:if(0===l)break t;if(f=d-l,i.offset>f){if(f=i.offset-f,f>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=ay;break}f>i.wnext?(f-=i.wnext,p=i.wsize-f):p=i.wnext-f,f>i.length&&(f=i.length),O=i.window}else O=s,p=o-i.offset,f=i.length;f>l&&(f=l),l-=f,i.length-=f;do{s[o++]=O[p++]}while(--f);0===i.length&&(i.mode=ry);break;case 16205:if(0===l)break t;s[o++]=i.length,l--,i.mode=ry;break;case oy:if(i.wrap){for(;c<32;){if(0===a)break t;a--,h|=n[r++]<{if(cy(t))return Nv;let e=t.state;return e.window&&(e.window=null),t.state=null,Iv},Xv.inflateGetHeader=(t,e)=>{if(cy(t))return Nv;const i=t.state;return 0==(2&i.wrap)?Nv:(i.head=e,e.done=!1,Iv)},Xv.inflateSetDictionary=(t,e)=>{const i=e.length;let n,s,r;return cy(t)?Nv:(n=t.state,0!==n.wrap&&n.mode!==ty?Nv:n.mode===ty&&(s=1,s=Dv(s,e,i,0),s!==n.check)?Gv:(r=wy(t,e,i,i),r?(n.mode=16210,Fv):(n.havedict=1,Iv)))},Xv.inflateInfo="pako inflate (from Nodeca project)";const vy=Xv,yy=ov,Sy=lv,xy=rw,ky=uv,Qy=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},$y=Object.prototype.toString,{Z_NO_FLUSH:Py,Z_FINISH:Cy,Z_OK:_y,Z_STREAM_END:Xy,Z_NEED_DICT:Zy,Z_STREAM_ERROR:Ay,Z_DATA_ERROR:Ty,Z_MEM_ERROR:Ry}=ow;function Ey(t){this.options=yy.assign({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ky,this.strm.avail_out=0;let i=vy.inflateInit2(this.strm,e.windowBits);if(i!==_y)throw new Error(xy[i]);if(this.header=new Qy,vy.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=Sy.string2buf(e.dictionary):"[object ArrayBuffer]"===$y.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(i=vy.inflateSetDictionary(this.strm,e.dictionary),i!==_y)))throw new Error(xy[i])}function Vy(t,e){const i=new Ey(e);if(i.push(t),i.err)throw i.msg||xy[i.err];return i.result}Ey.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize,s=this.options.dictionary;let r,o,a;if(this.ended)return!1;for(o=e===~~e?e:!0===e?Cy:Py,"[object ArrayBuffer]"===$y.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),r=vy.inflate(i,o),r===Zy&&s&&(r=vy.inflateSetDictionary(i,s),r===_y?r=vy.inflate(i,o):r===Ty&&(r=Zy));i.avail_in>0&&r===Xy&&i.state.wrap>0&&0!==t[i.next_in];)vy.inflateReset(i),r=vy.inflate(i,o);switch(r){case Ay:case Ty:case Zy:case Ry:return this.onEnd(r),this.ended=!0,!1}if(a=i.avail_out,i.next_out&&(0===i.avail_out||r===Xy))if("string"===this.options.to){let t=Sy.utf8border(i.output,i.next_out),e=i.next_out-t,s=Sy.buf2string(i.output,t);i.next_out=e,i.avail_out=n-e,e&&i.output.set(i.output.subarray(t,t+e),0),this.onData(s)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(r!==_y||0!==a){if(r===Xy)return r=vy.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},Ey.prototype.onData=function(t){this.chunks.push(t)},Ey.prototype.onEnd=function(t){t===_y&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=yy.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},_v.Inflate=Ey,_v.inflate=Vy,_v.inflateRaw=function(t,e){return(e=e||{}).raw=!0,Vy(t,e)},_v.ungzip=Vy,_v.constants=ow;const{Deflate:My,deflate:Dy,deflateRaw:Wy,gzip:Uy}=mb,{Inflate:Yy,inflate:qy,inflateRaw:Ly,ungzip:zy}=_v,Iy=ow;gb.Deflate=My,gb.deflate=Dy,gb.deflateRaw=Wy,gb.gzip=Uy,gb.Inflate=Yy,gb.inflate=qy,gb.inflateRaw=Ly,gb.ungzip=zy,gb.constants=Iy;const By=gb;let jy={};var Ny;function Gy(t){return Ny=t,[tS]}jy.Util={},jy.Decode={},jy.Messages=[],jy.Log=function(t){jy.Messages.push(["I",t]),console.log("Mma.js INFO: ",t)},jy.Warn=function(t){jy.Messages.push(["W",t]),console.log("Mma.js WARNING: ",t)},jy.Fail=function(t){throw jy.Messages.push(["E",t]),"Mma.js ERROR: "+t},jy.Util.Base64Decode=function(t){for(var e=atob(t),i=e.length>>>0,n=new Uint8Array(i),s=0;s1&&0===t[0]&&jy.Fail("IntegerAP: input starts with 0: "+String(t)),this.nstring=t}else void 0===t?this.nstring=void 0:jy.Fail("Integer: invalid input: "+String(t))},jy.RealMP=function(t){"number"==typeof t?this.n=t:void 0===t?this.n=void 0:jy.Fail("RealMP: invalid input")},jy.RealAP=function(t){"string"==typeof t?(t.length>1&&0===t[0]&&jy.Fail("RealAP: input starts with 0: "+String(t)),this.nstring=t):void 0===t?this.nstring=void 0:jy.Fail("RealAP: invalid input: "+String(t))},jy.Symbol=function(t){"string"==typeof t?this.name=t:void 0===t?this.name=void 0:jy.Fail("Symbol: invalid input: "+String(t))},jy.String=function(t){"string"==typeof t?this.str=t:void 0===t?this.str=void 0:jy.Fail("String: invalid input: "+String(t))},jy.Expression=function(t,e){t instanceof jy.Symbol||jy.Fail("Expression: head must be an Mma.Symbol"),e instanceof Array||jy.Fail("Expression: parts must be an Array"),this.head=t,this.parts=e},jy.Decode.Int32=function(t,e){try{return new DataView(t.buffer).getInt32(e,!0)}catch(t){return 0}},jy.Decode.Float64=function(t,e){try{return new DataView(t.buffer).getFloat64(e,!0)}catch(t){return 0}},jy.Decode.String=function(t,e,i){return void 0===e&&(e=0),void 0===i&&(i=t.length),jy.Util.U8ArrayToString(t.slice(e,e+i))},jy.Decode.StringEntry=function(t,e){void 0===e&&(e=0);var i=jy.Decode.Int32(t,e);return{length:i,string:jy.Decode.String(t,e+4,i),bytesRead:i+4}},jy.Decode.Any=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=1/0);var n=e;for(var s=0,r=[];ee%2!=0?t:{...t,body:Lm(t.body,/\(\*\|\*\)/gm)})),Array.isArray(this.args[this.args.length-1].body)||(this.decorator=this.args.pop());const r=this.args;console.log("creating InstanceWidget");for(let t=0;t{e.viewState.state.config.eval()},update:e=>this.applyChanges(e,t,i),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i-2>=0?(o[i-2].editor.dispatch({selection:{anchor:o[i-2].editor.state.doc.length}}),o[i-2].editor.focus(),void(t.editorLastCursor=void 0)):(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0));t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i+2=0)return r[t-2].body[i].editor.focus(),void(e.editorLastCursor=void 0)}},{key:"ArrowDown",run:function(e,n){if(t+2{},focus:()=>{},dispatch:()=>{}};const t=l.match(Fy);if(t){a.innerHTML=t[1];const e=jy.DecompressDecode(t[2]),i=jy.toArray(e.parts[0]),n=uuidv4();interpretate(i,{global:{call:n},element:a})}else a.innerHTML=l.slice(1,-1)}delete o[i].body,n.appendChild(a)}i.appendChild(n)}if(this.decorator){const t=jy.DecompressDecode(this.decorator.body.slice(2,-2)),e=jy.toArray(t.parts[0]);let n={global:{call:uuidv4(),EditorWidget:s},element:i};this.interpretated=interpretate(e,n)}}applyChanges(t,e,i){const n=this.args,s=this.args[e].body,r=this.visibleValue.argsPos,o=this.args[e].from;let a=t;0==i&&0==e&&(a="{{"+a),0==i&&0!=e&&(a="{"+a),i==s.length-1&&e==n.length-1&&(a+="}}"),i==s.length-1&&e!=n.length-1&&(a+="}");const l=s[i].length,h={from:r+o+s[i].from,to:r+o+s[i].from+l,insert:a},c=a.length-l;for(let t=i+1;t{s.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.args[0].body[0].editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.args[0].body[0].editor.focus();else{const t=this.DOMElement.EditorWidget.args,e=t[t.length-1].body[t[t.length-1].body.length-1].editor;e.dispatch({selection:{anchor:e.state.doc.length}}),e.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const Ky=(t,e)=>new Bm({tag:"GB",decoration:i=>ni.replace({widget:new Jy(i,t,e)})}),tS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=Ky(this.disposable,t).createDeco(t)}update(t){this.placeholder=Ky(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});function eS(t){return[rS]}let iS=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.span=i,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this,r=this.args[1].body.slice(3,-3),o=jy.DecompressDecode(r),a=jy.toArray(o.parts[0]);this.data=a;const l="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}));this.cuid=l;let h={call:l,EditorWidget:s},c={global:h,element:i};this.expression=a,this.env=c,this.interpretated=interpretate(a,c),this.interpretated.then((()=>{if(c.options?.Event){console.warn("Event listeners are enabled!"),s.events=c.options.Event;let t=c;if(h.stack){const e=Object.values(h.stack);e.length>0&&(console.log("Attaching first found instance..."),t=e[0].env)}interpretate(["MetaMarker","'"+l+"'"],t).then((()=>{server.kernel.emitt(s.events,'"'+l+'"',"Mounted")}))}}))}getDoc(){return this.args[0].body.slice(1,-1)}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+t+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].length=s.length,this.view.dispatch({changes:r})}applyOuterChanges(t){const e=this.visibleValue,i=t,n={from:e.pos,to:e.pos+e.length,insert:i};this.view.dispatch({changes:n})}update(t){if(!this.deactivated){if(t.str!=this.visibleValue.str){console.warn("Out of sync"),console.log("recreate..."),this.destroy();const e=this.span;return e.replaceChildren(),void this._construct(t,this.view,e)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}}destroy(t){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.events&&server.kernel.emitt(this.events,'"'+this.cuid+'"',"Destroy"),delete this.data}},nS=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=this;let i=document.createElement("span");return i.classList.add("frontend-view"),i.EditorWidget=new iS(this.visibleValue,t,i),this.reference.push({destroy:()=>{e.destroy(i)}}),i}ignoreEvent(){return!0}destroy(t){console.log("destroy in general*"),t.EditorWidget.destroy()}};const sS=(t,e)=>new Bm({tag:"VB",decoration:i=>ni.replace({widget:new nS(i,t,e)})}),rS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=sS(this.disposable,t).createDeco(t)}update(t){this.placeholder=sS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var oS;function aS(t){return oS=t,[uS]}let lS=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.span=i,this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this;this.epilog={offset:0,string:""},this.prolog={offset:0,string:""};const r=this.args[1].body.slice(3,-3),o=jy.DecompressDecode(r),a=jy.toArray(o.parts[0]);this.data=a;let l={global:{call:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)})),element:i,origin:s},element:i};this.env=l,interpretate(a,l).then((()=>{if(l.options?.Head&&(s.prolog.offset=l.options.Head.length+1,s.prolog.string=l.options.Head+"[",s.epilog.offset=1,s.epilog.string="]"),l.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=l.options.Event),l.options?.String){s.prolog.offset=1,s.prolog.string='"',s.epilog.offset=1,s.epilog.string='"',l.options?.HeadString&&(s.prolog.string=l.options.HeadString,s.prolog.offset=s.prolog.string.length),l.options?.TailString&&(s.epilog.string=l.options.TailString,s.epilog.offset=s.epilog.string.length),s.editor={destroy:()=>{console.log("Nothing to destroy, this is just a text field.")}};const t=document.createElement("span");return this.aa,t.onkeydown=function(t){13===t.keyCode&&t.preventDefault()},t.contentEditable="plaintext-only",t.innerText=s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),t.addEventListener("input",console.log),t.addEventListener("input",(()=>{console.log("Update"),console.log(t.innerText),this.applyChanges(t.innerText)})),l.global.element.appendChild(t),void(s.events&&server.kernel.emitt(s.events,"Null","Mounted"))}s.editor=oS({doc:s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),parent:l.global.element,update:t=>this.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos+s.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]}),s.events&&server.kernel.emitt(s.events,"Null","Mounted")}))}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+this.prolog.string+t+this.epilog.string+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length));const o=s.length-i[0].length;i[0].length=s.length,this.visibleValue.length=this.visibleValue.length+o,this.view.dispatch({changes:r})}update(t){if(this.visibleValue.str!=t.str)return console.warn("Out of sync"),console.log("recreating InstanceWidget"),this.destroy(),this.span.replaceChildren(),void this._construct(t,this.view,this.span);this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.editor.destroy(),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}},hS=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("subscript-tail"),e.EditorWidget=new lS(this.visibleValue,t,e,[]);const i=this;return this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const cS=(t,e)=>new Bm({tag:"BB",decoration:i=>ni.replace({widget:new hS(i,t,e)})}),uS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=cS(this.disposable,t).createDeco(t)}update(t){this.placeholder=cS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var dS;function fS(t){return dS=t,[mS]}class pS{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm);const s=this,r=Array.from({length:Math.ceil((s.args.length-3)/2)},((t,e)=>2*e+1));s.indexes=r;const o=[];this.span=i,this.spans=o;for(let t=0;t{c.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=c.options.Event),s.editors=r.map(((t,i)=>dS({doc:s.args[t].body,parent:o[i],update:e=>this.applyChanges(e,t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i>0?s.editors[i-1].focus():(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus()),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return it.destroy())),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}}class OS extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("inline-flex"),e.EditorWidget=new pS(this.visibleValue,t,e,[]);const i=this;return this.DOMElement=e,this.reference.push({destroy:()=>{i.destroy(e)}}),e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;const n=this.DOMElement.EditorWidget.editors;return t.from-e.from<0?(n[n.length-1].dispatch({selection:{anchor:n[n.length-1].state.doc.length}}),n[n.length-1].focus()):(n[0].dispatch({selection:{anchor:0}}),n[0].focus()),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}}const gS=(t,e)=>new Bm({tag:"TB",decoration:i=>ni.replace({widget:new OS(i,t,e)})}),mS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=gS(this.disposable,t).createDeco(t)}update(t){this.placeholder=gS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});const bS=_i.fromClass(class{decorations=ni.none;constructor(t){this.view=t,this.recompute()}recompute(t){let e,i,n=[];for(let{from:t,to:e}of this.view.visibleRanges)this.getDecorationsFor(t,e,n);this.decorations=ni.set(n,!0),this.decorations=this.decorations.update({filter:(n,s)=>!(n>e&&s=e&&s.selection.main.head<=i)return!0;if(!n&&s.selection.main.head>e&&s.selection.main.headt.decorations});class wS extends ei{constructor(t,e){super(),this.rawValue=t,this.visibleValue=e}eq(t){return this.rawValue===t.rawValue}toDOM(){let t=document.createElement("div");t.classList.add("cell-type-widget");const e=this.rawValue.split(" "),i=e[0].split(".");if(console.log(i),t.classList.add("cell-type-"+i[1].trim()),t.innerText=e[0].trim(),e.length>1){const n=e.slice(1),s=document.createElement("span");return s.appendChild(t),n.forEach((t=>{const e=document.createElement("span");e.innerText=t,e.classList.add("cell-type-"+i[1].trim()+"-"+t.split("=")[0]),s.appendChild(e)})),s}return t}ignoreEvent(){return!1}}const vS=new F,yS=new F,SS=[],xS=Sl.define([{tag:Sa.meta,color:"var(--editor-key-meta)"},{tag:Sa.link,textDecoration:"underline"},{tag:Sa.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Sa.emphasis,fontStyle:"italic"},{tag:Sa.strong,fontWeight:"bold"},{tag:Sa.strikethrough,textDecoration:"line-through"},{tag:Sa.keyword,color:"var(--editor-key-keyword)"},{tag:[Sa.atom,Sa.bool,Sa.url,Sa.contentSeparator,Sa.labelName],color:"var(--editor-key-atom)"},{tag:[Sa.literal,Sa.inserted],color:"var(--editor-key-literal)"},{tag:[Sa.string,Sa.deleted],color:"var(--editor-key-string)"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],color:"var(--editor-key-escape)"},{tag:Sa.definition(Sa.variableName),color:"var(--editor-key-variable)"},{tag:Sa.local(Sa.variableName),color:"var(--editor-local-variable)"},{tag:[Sa.typeName,Sa.namespace],color:"var(--editor-key-type)"},{tag:Sa.className,color:"var(--editor-key-class)"},{tag:[Sa.special(Sa.variableName),Sa.macroName],color:"var(--editor-special-variable)"},{tag:Sa.definition(Sa.propertyName),color:"var(--editor-key-property)"},{tag:Sa.comment,color:"var(--editor-key-comment)"},{tag:Sa.invalid,color:"var(--editor-key-invalid)"}]),kS={data:[],extend:t=>{kS.data.push(...t),Qm.reBuild(kS.data)},replaceAll:t=>{kS.data=t,Qm.reBuild(kS.data)}},QS=Gl.define({name:"spreadsheet",startState:function(){return{stringType:null,stack:[]}},token:function(t,e){if(t){switch(0===e.stack.length&&('"'!=t.peek()&&"'"!=t.peek()||(e.stringType=t.peek(),t.next(),e.stack.unshift("string"))),e.stack[0]){case"string":for(;"string"===e.stack[0]&&!t.eol();)t.peek()===e.stringType?(t.next(),e.stack.shift()):"\\"===t.peek()?(t.next(),t.next()):t.match(/^.[^\\\"\']*/);return"string";case"characterClass":for(;"characterClass"===e.stack[0]&&!t.eol();)t.match(/^[^\]\\]+/)||t.match(/^\\./)||e.stack.shift();return"operator"}var i=t.peek();switch(i){case"[":return t.next(),e.stack.unshift("characterClass"),"bracket";case":":return t.next(),"operator";case"\\":return t.match(/\\[a-z]+/)?"string.special":(t.next(),"atom");case".":case",":case";":case"*":case"-":case"+":case"^":case"<":case"/":case"=":return t.next(),"atom";case"$":return t.next(),"builtin"}return t.match(/\d+/)?t.match(/^\w+/)?"error":"number":t.match(/^[a-zA-Z_]\w*/)?t.match(/(?=[\(.])/,!1)?"keyword":"variable":-1!=["[","]","(",")","{","}"].indexOf(i)?(t.next(),"bracket"):(t.eatSpace()||t.next(),null)}}}),$S=new RegExp(/^[\w]*\.[\w]+/);function PS(t){const e=$S.exec(t),i=Object.values(window.SupportedLanguages);for(let t=0;t{if(!t.docChanged)return null;let e=PS(t.newDoc.line(1).text);if(e.legacy){const i=t.startState.facet(Wa);if(i){if(i.name==e.name)return null}else if(t.startState.facet(CS)==e.name)return null;return console.log("switching... to "+e.name),{effects:vS.reconfigure(e.plugins)}}return e.name===t.startState.facet(Wa).name?null:(console.log("switching... to "+e.name),{effects:vS.reconfigure(e.plugins)})}));let XS,ZS=null;const AS=t=>{const e=t||XS;return e&&e.viewState?(console.log(),PS(e.state.doc.line(1).text).name):""},TS=t=>{const e=t||XS;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return!1;const n=i[0];return[n.from,n.to]},RS=t=>{const e=t||XS;return e&&e.viewState?e.state.doc.toString():""},ES=t=>{const e=t||XS;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return"";const n=i[0];return console.log("yoko"),console.log(n),console.log(e.state.doc.toString().slice(n.from,n.to)),console.log("processing"),e.state.doc.toString().slice(n.from,n.to)},VS=(t,e)=>{const i=e||XS;if(!i)return;if(!i.viewState)return;const n=i.viewState.state.selection.ranges;if(!n.length)return;const s=n[0];console.log("result"),console.log(t),i.dispatch({changes:{...s,insert:t}})},MS=()=>XS,DS=(t,e)=>{const i=e||XS;i&&i.viewState&&(console.log("result"),console.log(t),i.dispatch({changes:{from:0,to:i.viewState.state.doc.length,insert:t}}))};ZS=t=>{let e=new Ts({doc:t.doc,extensions:[Ys.of([{key:"Tab",run:function(t,e){return sd(t)}},{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,LS,Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(XS=e.view)}))],parent:t.parent});return e.viewState.state.config.eval=t.eval,e},ZS.state=t=>{let e=xt.create({doc:t.doc,extensions:[Ys.of([{key:"Tab",run:function(t,e){return sd(t)}},{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,LS,Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(XS=e.view)}))]});return e.config.eval=t.eval,e};const WS={transaction:(t,e,i,n)=>{if(console.log(e.dom.ocellref),e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:DropEvent"]')}},file:(t,e,i,n,s)=>{console.log(e.dom.ocellref),e.dom.ocellref&&server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},US={transaction:(t,e,i,n)=>{if(console.log(e.dom.ocellref),e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:PasteEvent"]')}},file:(t,e,i,n,s)=>{console.log(e.dom.ocellref),e.dom.ocellref&&server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},YS=[Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Cm(WS,US)];let qS=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"}}),LS=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"},".cm-scroller":{"line-height":"inherit","overflow-x":"overlay","overflow-y":"overlay","align-items":"initial"},".cm-content":{padding:"0px 0"},".rainbow-bracket-red":{color:"var(--editor-bracket-1)"},".rainbow-bracket-orange":{color:"var(--editor-bracket-2)"},".rainbow-bracket-yellow":{color:"var(--editor-bracket-3)"},".rainbow-bracket-green":{color:"var(--editor-bracket-4)"},".rainbow-bracket-blue":{color:"var(--editor-bracket-5)"},".rainbow-bracket-indigo":{color:"var(--editor-bracket-6)"},".rainbow-bracket-violet":{color:"var(--editor-bracket-7)"},".rainbow-bracket-red > span":{color:"var(--editor-bracket-1-a)"},".rainbow-bracket-orange > span":{color:"var(--editor-bracket-2-a)"},".rainbow-bracket-yellow > span":{color:"var(--editor-bracket-3-a)"},".rainbow-bracket-green > span":{color:"var(--editor-bracket-4-a)"},".rainbow-bracket-blue > span":{color:"var(--editor-bracket-5-a)"},".rainbow-bracket-indigo > span":{color:"var(--editor-bracket-6-a)"},".rainbow-bracket-violet > span":{color:"var(--editor-bracket-7-a)"}}),zS=!1;const IS=[()=>vr(),()=>Sh(),()=>ir(),()=>dr(),()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xS,{fallback:!1}),()=>tu()],BS={},jS=[()=>vr(),()=>Sh(),()=>ir(),()=>dr(),t=>NS.of(t),()=>BS.gutter?function(t={}){return[eo.of(t),jr(),so]}():[],()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xS,{fallback:!1}),()=>tu(),()=>bS,()=>function(t){return _i.fromClass(class{constructor(e){this.view=e,this.placeholder=ni.set([ni.widget({widget:new kr(t),side:1}).range(0)])}get decorations(){return this.view.state.doc.length?ni.none:this.placeholder}},{decorations:t=>t.decorations})}("Type WL Expression / .md / .js"),()=>xt.allowMultipleSelections.of(!0),(t,e)=>vS.of(e),()=>yS.of(xt.readOnly.of(!1)),()=>_S,()=>{return t?[ou.of(t),Yu]:Yu;var t},(t,e)=>Ys.of([{key:"Tab",run:function(t,e){const i=sd(t);return i||Rc(t)},shift:Ec},{key:"Backspace",run:function(e,i){if(0===e.state.doc.length)return t.origin.remove(),!0}},{key:"ArrowLeft",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus prev"),t.origin.focusPrev(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus next"),t.origin.focusNext(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"Shift-Enter",preventDefault:!0,run:function(e,i){console.log(e.state.doc.toString()),t.origin.eval(e.state.doc.toString())}},...Vc,...Wh,...Ru]),(t,e)=>Ts.updateListener.of((e=>{e.docChanged&&t.origin.save(encodeURIComponent(e.state.doc.toString())),e.selectionSet&&(XS=e.view)})),()=>qS];const NS=E.define();function GS(t){return t.replace(/\\\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\\\:/g,""),16))})).replaceAll("\\:F74E","I").replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))}function FS(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(t=>(+t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+t/4).toString(16)))}core.ReadOnly=()=>"ReadOnly",core.EditorView=async(t,e)=>{let i=await interpretate(t[0],e);i=GS(i),console.log("UNICODE Disaster");const n=await core._getRules(t,e);let s=()=>{},r=()=>{},o=i;const a=[];n.ReadOnly&&a.push(xt.readOnly.of(!0)),n.ForceUpdate&&(e.local.forceUpdate=n.ForceUpdate),n.Event&&(r=t=>{o=t,console.log("editor view emitt data: "+t),server.kernel.emitt(n.Event,'"'+t.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Input")},s=()=>{server.kernel.emitt(n.Event,'"'+o.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Evaluate")}),e.local?e.local.editor=ZS({doc:i,parent:e.element,eval:s,update:r,extensions:a}):ZS({doc:i,parent:e.element,eval:s,update:r,extensions:a}),e.element.style.verticalAlign="inherit"},core.StripOnInput=async()=>{},core.EditorView.update=async(t,e)=>{if(!e.local.editor)return;const i=GS(await interpretate(t[0],e));console.log("editor view: dispatch"),e.local.forceUpdate,e.local.editor.dispatch({changes:{from:0,to:e.local.editor.state.doc.length,insert:i}})},core.EditorView.destroy=async(t,e)=>{await interpretate(t[0],e),e.local&&e.local.editor&&e.local.editor.destroy()},core.EditorView.virtual=!0,core.PreviewCell=(t,e)=>{},window.SupportedLanguages.push({check:t=>null===t,legacy:!0,plugins:YS,name:"mathematica"}),window.SupportedLanguages.push({check:t=>null!=t[0].match(/\w+\.(wl|wls)$/),plugins:YS,legacy:!0,name:"mathematica"}),window.SupportedCells.codemirror={view:class{origin={};editor={};trash=[];forceFocusNext(){zS=!0}focus(t){t>0?this.editor.dispatch({selection:{anchor:0}}):t<0&&this.editor.dispatch({selection:{anchor:this.editor.state.doc.length}}),this.editor.focus()}setContent(t){if(console.warn("content mutation!"),!this.editor.viewState)return;const e=this.editor;console.log("result"),console.log(t),this.editor.dispatch({changes:{from:0,to:e.viewState.state.doc.length,insert:t}})}addDisposable(t){this.trash.push(t)}dispose(){this.editor.destroy()}readOnly(t){this.editor.dispatch({effects:yS.reconfigure(xt.readOnly.of(t))})}constructor(t,e){this.origin=t;const i=this.origin,n=PS(e).plugins,s=this;this.origin.element.ocellref=s;const r=new Ts({doc:(o=e,o.replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))),extensions:jS.map((t=>t(s,n))),parent:this.origin.element});var o;return this.editor=r,this.editor.dom.ocellref=s,this.editor.viewState.state.config.eval=()=>{i.eval(this.editor.state.doc.toString())},zS&&r.focus(),zS=!1,this}},context:{EditorAutocomplete:kS,javascriptLanguage:qf,javascript:Nf,markdownLanguage:rm,markdown:function(t={}){let{codeLanguages:e,defaultCodeLanguage:i,addKeymap:n=!0,base:{parser:s}=sm}=t;if(!(s instanceof Zp))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let r,o=t.extensions?[t.extensions]:[],a=[dm.support];i instanceof Ua?(a.push(i.support),r=i.language):i&&(r=i);let l=e||r?(h=e,c=r,t=>{if(t&&h){let e=null;if(t=/\S*/.exec(t)[0],e="function"==typeof h?h(t):Ya.matchLanguageName(h,t,!0),e instanceof Ya)return e.support?e.support.language.parser:Ta.getSkippingParser(e.load());if(e)return e.parser}return c?c.parser:null}):void 0;var h,c;return o.push(function(t){let{codeParser:e,htmlParser:i}=t,n=Do(((t,n)=>{let s=t.type.id;if(!e||s!=Kf.CodeBlock&&s!=Kf.FencedCode){if(i&&(s==Kf.HTMLBlock||s==Kf.HTMLTag))return{parser:i,overlay:rO(t.node,t.from,t.to)}}else{let i="";if(s==Kf.FencedCode){let e=t.node.getChild(Kf.CodeInfo);e&&(i=n.read(e.from,e.to))}let r=e(i);if(r)return{parser:r,overlay:t=>t.type.id==Kf.CodeText}}return null}));return{wrap:n}}({codeParser:l,htmlParser:dm.language.parser})),n&&a.push(N.high(Ys.of(um))),new Ua(nm(s.configure(o)),a)},htmlLanguage:jg,html:Ng,cssLanguage:kg,css:Qg,EditorView:Ts,EditorState:xt,highlightSpecialChars:vr,syntaxHighlighting:$l,defaultHighlightStyle:xS,editorCustomTheme:qS,foldGutter:function(t={}){let e=Object.assign(Object.assign({},wl),t),i=new vl(e,!0),n=new vl(e,!1),s=_i.fromClass(class{constructor(t){this.from=t.viewport.from,this.markers=this.buildMarkers(t)}update(t){(t.docChanged||t.viewportChanged||t.startState.facet(Wa)!=t.state.facet(Wa)||t.startState.field(dl,!1)!=t.state.field(dl,!1)||Xa(t.startState)!=Xa(t.state)||e.foldingChanged(t))&&(this.markers=this.buildMarkers(t.view))}buildMarkers(t){let e=new Xt;for(let s of t.viewportLineBlocks){let r=fl(t.state,s.from,s.to)?n:ll(t.state,s.from,s.to)?i:null;r&&e.add(s.from,s.from,r)}return e.finish()}}),{domEventHandlers:r}=e;return[s,Ir({class:"cm-foldGutter",markers(t){var e;return(null===(e=t.plugin(s))||void 0===e?void 0:e.markers)||_t.empty},initialSpacer:()=>new vl(e,!1),domEventHandlers:Object.assign(Object.assign({},r),{click:(t,e,i)=>{if(r.click&&r.click(t,e,i))return!0;let n=fl(t.state,e.from,e.to);if(n)return t.dispatch({effects:ul.of(n)}),!0;let s=ll(t.state,e.from,e.to);return!!s&&(t.dispatch({effects:cl.of(s)}),!0)}})}),ml()]},Facet:E,Compartment:F,mathematicaPlugins:YS,legacyLangNameFacet:CS,DropPasteHandlers:Cm,EditorExtensionsMinimal:IS,EditorParameters:BS,EditorExtensions:jS,StateField:q,Decoration:ni,ViewPlugin:_i,WidgetType:ei,originFacet:NS,MatchDecorator:pr}},window.OfflineMode&&SS.push(xt.readOnly.of(!0)),core.CellView=async(t,e)=>{const i=await core._getRules(t,e);i.Display||(i.Display="codemirror");const n=await interpretate(t[0],e),s={element:e.element,uid:FS()};i.Style&&(e.element.style=i.Style),i.Class&&e.element.classList.add(...i.Class.split(" ")),i.ImageSize&&(Array.isArray(i.ImageSize)?(e.element.style.width=i.ImageSize[0]+"px",e.element.style.height=i.ImageSize[1]+"px"):e.element.style.width=i.ImageSize+"px"),new window.SupportedCells[i.Display].view(s,n)};const HS={};core.FrontEditorSelected=async(t,e)=>{console.log("check");const i=await interpretate(t[0],e),n=await core._getRules(t,e);let s;switch(n.Editor&&(s=HS[n.Editor],console.log("Editor"),console.log(n.Editor),console.log(s)),i){case"Get":return ES(s);case"Set":let i=await interpretate(t[1],e);VS(i,s);break;case"GetDoc":return RS(s);case"SetDoc":let n=await interpretate(t[1],e);DS(n,s);break;case"Cursor":return TS(s);case"Type":return AS(s);case"Editor":const r=FS();return HS[r]=MS(),r}}; diff --git a/package.json b/package.json index 085ccb9..d666d00 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wljs-editor", - "version": "1.1.9", + "version": "1.2.0", "description": "WLJS Code editor", "scripts": { "build": "node --max-old-space-size=8192 ./node_modules/.bin/rollup --config rollup.config.mjs", diff --git a/src/kernel.js b/src/kernel.js index 05ff19c..c384f27 100644 --- a/src/kernel.js +++ b/src/kernel.js @@ -13,7 +13,7 @@ import {search, searchKeymap} from "@codemirror/search" import {cssLanguage, css} from "@codemirror/lang-css" -import {indentWithTab} from "@codemirror/commands" +import {indentWithTab, indentMore, indentLess} from "@codemirror/commands" import { MatchDecorator, WidgetType, keymap } from "@codemirror/view" @@ -43,7 +43,8 @@ import { EditorState, Compartment, Facet, StateField } from "@codemirror/state" import { syntaxHighlighting, indentOnInput, bracketMatching, HighlightStyle, foldGutter} from "@codemirror/language" import { history, historyKeymap } from "@codemirror/commands" import { highlightSelectionMatches } from "@codemirror/search" -import { autocompletion, closeBrackets } from "@codemirror/autocomplete" +import { autocompletion, closeBrackets, acceptCompletion } from "@codemirror/autocomplete" + import { Decoration, @@ -316,6 +317,9 @@ compactWLEditor = (args) => { doc: args.doc, extensions: [ keymap.of([ + { key: "Tab", run: function (editor, key) { + return acceptCompletion(editor); + } }, { key: "Enter", preventDefault: true, run: function (editor, key) { return true; } } @@ -366,6 +370,9 @@ compactWLEditor.state = (args) => { doc: args.doc, extensions: [ keymap.of([ + { key: "Tab", run: function (editor, key) { + return acceptCompletion(editor); + } }, { key: "Enter", preventDefault: true, run: function (editor, key) { return true; } } @@ -592,7 +599,12 @@ const EditorExtensions = [ () => search(), - (self, initialLang) => keymap.of([indentWithTab, + (self, initialLang) => keymap.of([ + { key: "Tab", run: function (editor, key) { + const res = acceptCompletion(editor); + if (!res) return indentMore(editor); + return res; + }, shift: indentLess }, { key: "Backspace", run: function (editor, key) { if(editor.state.doc.length === 0) { self.origin.remove(); return true; } } }, From ffffffa6c826d928ebce778a96be933b61f67860 Mon Sep 17 00:00:00 2001 From: Kirill Vasin Date: Sun, 27 Oct 2024 11:28:25 +0100 Subject: [PATCH 04/26] added timeout option --- package.json | 2 +- src/StoreKernel.wl | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index d666d00..1fd2125 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wljs-editor", - "version": "1.2.0", + "version": "1.2.1", "description": "WLJS Code editor", "scripts": { "build": "node --max-old-space-size=8192 ./node_modules/.bin/rollup --config rollup.config.mjs", diff --git a/src/StoreKernel.wl b/src/StoreKernel.wl index 54b1419..2dc2925 100644 --- a/src/StoreKernel.wl +++ b/src/StoreKernel.wl @@ -8,35 +8,35 @@ NotebookStore::usage = "Use is as an association NotebookStore[\"Key\", opts] to Begin["`Private`"] -NotebookStore /: Keys[ NotebookStore[ OptionsPattern[] ] ] := With[{notebook = OptionValue[NotebookStore, "Notebook"] // First}, +NotebookStore /: Keys[ NotebookStore[ OptionsPattern[] ] ] := With[{notebook = OptionValue[NotebookStore, "Notebook"] // First, timeout = OptionValue["Timeout"]}, With[{promise = Promise[]}, EventFire[Internal`Kernel`CommunicationChannel, "NotebookStoreGetKeys", <|"Ref"->notebook, "Promise" -> promise, "Kernel"->Internal`Kernel`Hash|>]; - promise // WaitAll + WaitAll[promise, timeout] ] ] -NotebookStore[key_String, OptionsPattern[] ] := With[{notebook = OptionValue[NotebookStore, "Notebook"] // First}, +NotebookStore[key_String, OptionsPattern[] ] := With[{notebook = OptionValue[NotebookStore, "Notebook"] // First, timeout = OptionValue["Timeout"]}, With[{promise = Promise[]}, EventFire[Internal`Kernel`CommunicationChannel, "NotebookStoreGet", <|"Ref"->notebook, "Key"->key, "Promise" -> promise, "Kernel"->Internal`Kernel`Hash|>]; - promise // WaitAll + WaitAll[promise, timeout] ] // Uncompress ] -NotebookStore /: Set[NotebookStore[key_String, OptionsPattern[] ], data_] := With[{notebook = OptionValue[NotebookStore, "Notebook"] // First}, +NotebookStore /: Set[NotebookStore[key_String, OptionsPattern[] ], data_] := With[{notebook = OptionValue[NotebookStore, "Notebook"] // First, timeout = OptionValue["Timeout"]}, With[{promise = Promise[]}, EventFire[Internal`Kernel`CommunicationChannel, "NotebookStoreSet", <|"Ref"->notebook, "Key"->key, "Data"->Compress[data], "Promise" -> promise, "Kernel"->Internal`Kernel`Hash|>]; - promise // WaitAll + WaitAll[promise, timeout] ] ] -NotebookStore /: Unset[NotebookStore[key_String, OptionsPattern[] ] ] := With[{notebook = OptionValue[NotebookStore, "Notebook"] // First}, +NotebookStore /: Unset[NotebookStore[key_String, OptionsPattern[] ] ] := With[{notebook = OptionValue[NotebookStore, "Notebook"] // First, timeout = OptionValue["Timeout"]}, With[{promise = Promise[]}, EventFire[Internal`Kernel`CommunicationChannel, "NotebookStoreUnset", <|"Ref"->notebook, "Key"->key, "Promise" -> promise, "Kernel"->Internal`Kernel`Hash|>]; - promise // WaitAll + WaitAll[promise, timeout] ] ] -Options[NotebookStore] = {"Notebook" :> RemoteNotebook[ Global`$EvaluationContext["Notebook"] ]} +Options[NotebookStore] = {"Notebook" :> RemoteNotebook[ Global`$EvaluationContext["Notebook"] ], "Timeout" -> 80} End[] EndPackage[] \ No newline at end of file From 43ce0f9c5d7230a8e3659cbde3043db67bdc8264 Mon Sep 17 00:00:00 2001 From: Kirill Vasin Date: Sun, 27 Oct 2024 19:49:55 +0100 Subject: [PATCH 05/26] restricted uploader --- dist/kernel.js | 56 ++++++++++++++++++- dist/kernel.min.js | 2 +- .../src/mathematica/dropevents.js | 53 +++++++++++++++++- package.json | 2 +- src/AutocompleteDefaults.wl | 6 +- 5 files changed, 112 insertions(+), 7 deletions(-) diff --git a/dist/kernel.js b/dist/kernel.js index f847db6..78fe1e4 100644 --- a/dist/kernel.js +++ b/dist/kernel.js @@ -28753,21 +28753,73 @@ wolframLanguage.reBuild = (vocabulary) => { const transferFiles = (list, ev, view, handler) => { if (list.length == 0) return; const id = new Date().valueOf(); + let count = 0; + + view.dom.loadingMark = true; + const originalColor = view.dom.style.background; + + let hue = 0; + + console.log('Start animation'); + + const loaderAnimation = setInterval(() => { + view.dom.style.setProperty("background", 'hsl('+hue+'deg 100% 97%)', "important"); + hue = hue + 2; + if (hue > 360) hue = 0; + }, 30); handler.transaction(ev, view, id, list.length); // server.kernel.emitt('', `<|"Id" -> "${id}", "Length" -> ${list.length}|>`, 'Transaction'); for (const file of list) { readFile(file, (name, result) => { handler.file(ev, view, id, name, result); + //server.kernel.emitt('id', `<|"Transaction" -> "${id}", "Name" -> "${name}", "Data" -> "${result}"|>`, 'File'); + count++; + if (count >= list.length && view.dom) { + if (view.dom.loadingMark) { + view.dom.loadingMark = false; + setTimeout(() => { + view.dom.style.background = originalColor; + clearInterval(loaderAnimation); + console.log('Stop animation'); + }, 2000); + } + } + }, () => { + console.warn('Fauilure'); + const original = view.dom.style.background; + view.dom.style.background = 'rgb(255 189 189 / 97%)'; + let opacity = 97; + const interval = setInterval(() => { + view.dom.style.background = 'rgb(255 189 189 / '+Math.round(opacity)+'%)'; + opacity = opacity * 0.95; + }, 30); + + + clearInterval(loaderAnimation); + + setTimeout(() => { + clearInterval(interval); + view.dom.style.background = original; + }, 3000); }); } }; -function readFile(file, cbk) { +function readFile(file, cbk, fail) { const reader = new FileReader(); + reader.addEventListener('load', (event) => { - let compressedData = base64ArrayBuffer(event.target.result); + const payload = event.target.result; + if (payload.byteLength / 1024 / 1024 > 15) { + alert('Files > 15Mb are not supported for drag and drop'); + fail(); + return; + //throw 'Files > 15Mb are not supported for drag and drop'; + } + + let compressedData = base64ArrayBuffer(payload); //console.log(compressedData); cbk(file.name, compressedData); }); diff --git a/dist/kernel.min.js b/dist/kernel.min.js index f6e4f0a..a5646d9 100644 --- a/dist/kernel.min.js +++ b/dist/kernel.min.js @@ -1 +1 @@ -class t{constructor(){}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 a(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}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 l(n,o,i,r);n=o+1,i++}}decompose(t,i,r,o){let a=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(a.text,t.text.slice(),0,a.length);if(i.length<=32)r.push(new e(i,t.length+a.length));else{let t=i.length>>1;r.push(new e(i.slice(0,t)),new e(i.slice(t)))}}else r.push(a)}replace(t,r,o){if(!(o instanceof e))return super.replace(t,r,o);let a=n(this.text,n(o.text,s(this.text,0,t)),r),l=this.length+o.length-(r-t);return a.length<=32?new e(a,l):i.from(e.split(a,[]),l)}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=a+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,a=i+r.lines-1;if((e?a:o)>=t)return r.lineInner(t,e,i,n);n=o+1,i=a+1}}decompose(t,e,i,n){for(let s=0,r=0;r<=e&&s=r){let s=n&((r<=t?1:0)|(a>=e?2:0));r>=t&&a<=e&&!s?i.push(o):o.decompose(t-r,e-r,i,s)}r=a+1}}replace(t,e,n){if(n.lines=r&&e<=a){let l=o.replace(t-r,e-r,n),h=this.lines-o.lines+l.lines;if(l.lines>4&&l.lines>h>>6){let r=this.children.slice();return r[s]=l,new i(r,this.length-(e-t)+n.length)}return super.replace(r,a,l)}r=a+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=a+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,a]=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==a)return n;let i=this.children[s],l=t.children[r];if(i!=l)return n+i.scanIdentical(l,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,a=r>>1,l=[],h=0,c=-1,u=[];function d(t){let n;if(t.lines>o&&t instanceof i)for(let e of t.children)d(e);else t.lines>a&&(h>a||!h)?(f(),l.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&&f(),h+=t.lines,c+=t.length+1,u.push(t))}function f(){0!=h&&(l.push(1==u.length?u[0]:i.from(u,c)),c=-1,h=u.length=0)}for(let e of t)d(e);return f(),1==l.length?l[0]:new i(l,n)}}function n(t,e,i=0,n=1e9){for(let s=0,r=0,o=!0;r=i&&(l>n&&(a=a.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,a=s instanceof e?s.text.length:s.children.length;if(o==(i>0?a: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 a{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]=a.prototype[Symbol.iterator]=function(){return this});let l=class{constructor(t,e,i,n){this.from=t,this.to=e,this.number=i,this.text=n}get length(){return this.to-this.from}},h="lc,34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,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 d=8205;function f(t,e,i=!0,n=!0){return(i?p:O)(t,e,n)}function p(t,e,i){if(e==t.length)return e;e&&g(t.charCodeAt(e))&&m(t.charCodeAt(e-1))&&e--;let n=b(t,e);for(e+=v(n);e=0&&u(b(t,n));)i++,n-=2;if(i%2==0)break;e+=2}}}return e}function O(t,e,i){for(;e>0;){let n=p(t,e-2,i);if(n=56320&&t<57344}function m(t){return t>=55296&&t<56320}function b(t,e){let i=t.charCodeAt(e);if(!m(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return g(n)?n-56320+(i-55296<<10)+65536:i}function w(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function v(t){return t<65536?1:2}const y=/\r\n?|\n/;var S=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(S||(S={}));class x{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;et)return s+(t-n);s+=o}else{if(i!=S.Simple&&l>=t&&(i==S.TrackDel&&nt||i==S.TrackBefore&&nt))return null;if(l>t||l==t&&e<0&&!o)return t==n||e<0?s:s+a;s+=a}n=l}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 x(t)}static create(t){return new x(t)}}class k extends x{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 P(this,((e,i,n,s,r)=>t=t.replace(n,n+(i-e),r)),!1),t}mapDesc(t,e=!1){return C(this,t,e,!0)}invert(e){let i=this.sections.slice(),n=[];for(let s=0,r=0;s=0){i[s]=a,i[s+1]=o;let l=s>>1;for(;n.length0&&$(i,e,s.text),s.forward(t),o+=t}let l=t[r++];for(;o>1].toJSON()))}return t}static of(e,i,n){let s=[],r=[],o=0,a=null;function l(t=!1){if(!t&&!s.length)return;oa||e<0||a>i)throw new RangeError(`Invalid change range ${e} to ${a} (in doc of length ${i})`);let u=c?"string"==typeof c?t.of(c.split(n||y)):c:t.empty,d=u.length;if(e==a&&0==d)return;eo&&Q(s,e-o,-1),Q(s,a-e,d),$(r,s,u),o=a}}(e),l(!a),a}static empty(t){return new k(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 $(e,i,n){if(0==n.length)return;let s=i.length-2>>1;if(s>1])),!(n||a==e.sections.length||e.sections[a+1]<0);)l=e.sections[a++],h=e.sections[a++];i(r,c,o,u,d),r=c,o=u}}}function C(t,e,i,n=!1){let s=[],r=n?[]:null,o=new X(t),a=new X(e);for(let t=-1;;)if(-1==o.ins&&-1==a.ins){let t=Math.min(o.len,a.len);Q(s,t,-1),o.forward(t),a.forward(t)}else if(a.ins>=0&&(o.ins<0||t==o.i||0==o.off&&(a.len=0&&t=0)){if(o.done&&a.done)return r?k.createSet(s,r):x.create(s);throw new Error("Mismatched change set lengths")}{let e=0,i=o.len;for(;i;)if(-1==a.ins){let t=Math.min(i,a.len);e+=t,i-=t,a.forward(t)}else{if(!(0==a.ins&&a.lene||o.ins>=0&&o.len>e)&&(t||n.length>i),r.forward2(e),o.forward(e)}}else Q(n,0,o.ins,t),s&&$(s,n,o.text),o.next()}}class X{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 Z{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 Z(i,n,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return A.range(t,e);let i=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return A.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 A.range(t.anchor,t.head)}static create(t,e,i){return new Z(t,e,i)}}class A{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:A.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 A(t.ranges.map((t=>Z.fromJSON(t))),t.main)}static single(t,e=t){return new A([A.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?A.range(o,r):A.range(r,o))}}return new A(t,e)}}function T(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let R=0;class E{constructor(t,e,i,n,s){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=n,this.id=R++,this.default=t([]),this.extensions="function"==typeof s?s(this):s}static define(t={}){return new E(t.combine||(t=>t),t.compareInput||((t,e)=>t===e),t.compare||(t.combine?(t,e)=>t===e:V),!!t.static,t.enables)}of(t){return new M([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,2,e)}from(t,e){return e||(e=t=>t),this.compute([t],(i=>e(i.field(t))))}}function V(t,e){return t==e||t.length==e.length&&t.every(((t,i)=>t===e[i]))}class M{constructor(t,e,i,n){this.dependencies=t,this.facet=e,this.type=i,this.value=n,this.id=R++}dynamicSlot(t){var e;let i=this.value,n=this.facet.compareInput,s=this.id,r=t[s]>>1,o=2==this.type,a=!1,l=!1,h=[];for(let i of this.dependencies)"doc"==i?a=!0:"selection"==i?l=!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(a&&e.docChanged||l&&(e.docChanged||e.selection)||W(t,h)){let e=i(t);if(o?!D(e,t.values[r],n):!n(e,t.values[r]))return t.values[r]=e,1}return 0},reconfigure:(t,e)=>{let a,l=e.config.address[s];if(null!=l){let s=tt(e,l);if(this.dependencies.every((i=>i instanceof E?e.facet(i)===t.facet(i):!(i instanceof q)||e.field(i,!1)==t.field(i,!1)))||(o?D(a=i(t),s,n):n(a=i(t),s)))return t.values[r]=s,0}else a=i(t);return t.values[r]=a,1}}}}function D(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 a(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(Y).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,Y.of({field:this,create:t})]}get extension(){return this}}const L=4,z=3,I=2,B=1;function j(t){return e=>new G(e,t)}const N={highest:j(0),high:j(B),default:j(I),low:j(z),lowest:j(L)};class G{constructor(t,e){this.inner=t,this.prec=e}}class F{of(t){return new H(this,t)}reconfigure(t){return F.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class H{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;function r(t,o){let a=s.get(t);if(null!=a){if(a<=o)return;let e=n[a].indexOf(t);e>-1&&n[a].splice(e,1),t instanceof H&&i.delete(t.compartment)}if(s.set(t,o),Array.isArray(t))for(let e of t)r(e,o);else if(t instanceof H){if(i.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");let n=e.get(t.compartment)||t.inner;i.set(t.compartment,n),r(n,o)}else if(t instanceof G)r(t.inner,t.prec);else if(t instanceof q)n[o].push(t),t.provides&&r(t.provides,o);else if(t instanceof M)n[o].push(t),t.facet.extensions&&r(t.facet.extensions,I);else{let e=t.extension;if(!e)throw new Error(`Unrecognized extension value in extension set (${t}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(e,o)}}return r(t,I),n.reduce(((t,e)=>t.concat(e)))}(t,e,r))i instanceof q?n.push(i):(s[i.facet.id]||(s[i.facet.id]=[])).push(i);let o=Object.create(null),a=[],l=[];for(let t of n)o[t.id]=l.length<<1,l.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]=a.length<<1|1,V(r,e))a.push(i.facet(n));else{let t=n.combine(e.map((t=>t.value)));a.push(i&&n.compare(t,i.facet(n))?i.facet(n):t)}else{for(let t of e)0==t.type?(o[t.id]=a.length<<1|1,a.push(t.value)):(o[t.id]=l.length<<1,l.push((e=>t.dynamicSlot(e))));o[n.id]=l.length<<1,l.push((t=>U(t,n,e)))}}let c=l.map((t=>t(o)));return new J(t,r,c,o,a,s)}}function K(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 tt(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}const et=E.define(),it=E.define({combine:t=>t.some((t=>t)),static:!0}),nt=E.define({combine:t=>t.length?t[0]:void 0,static:!0}),st=E.define(),rt=E.define(),ot=E.define(),at=E.define({combine:t=>!!t.length&&t[0]});class lt{constructor(t,e){this.type=t,this.value=e}static define(){return new ht}}class ht{of(t){return new lt(this,t)}}class ct{constructor(t){this.map=t}of(t){return new ut(this,t)}}class ut{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 ut(this.type,e)}is(t){return this.type==t}static define(t={}){return new ct(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}}ut.reconfigure=ut.define(),ut.appendConfig=ut.define();class dt{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&&T(i,e.newLength),s.some((t=>t.type==dt.time))||(this.annotations=s.concat(dt.time.of(Date.now())))}static create(t,e,i,n,s,r){return new dt(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(dt.userEvent);return!(!e||!(e==t||e.length>t.length&&e.slice(0,t.length)==t&&"."==e[t.length]))}}function ft(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=pt(n,Ot(e,r,t.changes.newLength),!0))}return n==t?t:dt.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(st)){let e=n(t);if(!1===e){i=!1;break}Array.isArray(e)&&(i=!0===i?e:ft(i,e))}if(!0!==i){let n,s;if(!1===i)s=t.changes.invertedDesc,n=k.empty(e.doc.length);else{let e=t.changes.filter(i);n=e.changes,s=e.filtered.mapDesc(e.changes).invertedDesc}t=dt.create(e,n,t.selection&&t.selection.map(s),ut.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let n=e.facet(rt);for(let i=n.length-1;i>=0;i--){let s=n[i](t);t=s instanceof dt?s:Array.isArray(s)&&1==s.length&&s[0]instanceof dt?s[0]:gt(e,bt(s),!1)}return t}(s):s)}dt.time=lt.define(),dt.userEvent=lt.define(),dt.addToHistory=lt.define(),dt.remote=lt.define();const mt=[];function bt(t){return null==t?mt:Array.isArray(t)?t:[t]}var wt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(wt||(wt={}));const vt=/[\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){}function St(t){return e=>{if(!/\S/.test(e))return wt.Space;if(function(t){if(yt)return yt.test(t);for(let e=0;e"€"&&(i.toUpperCase()!=i.toLowerCase()||vt.test(i)))return!0}return!1}(e))return wt.Word;for(let i=0;i-1)return wt.Word;return wt.Other}}class xt{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(ut.reconfigure)?(i=null,n=e.value):e.is(ut.appendConfig)&&(i=null,n=bt(n).concat(e.value));if(i)e=t.startState.values.slice();else{i=J.resolve(n,s,this),e=new xt(i,this.doc,this.selection,i.dynamicSlots.map((()=>null)),((t,e)=>e.reconfigure(t,this)),null).values}new xt(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:A.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=bt(i.effects);for(let i=1;is.spec.fromJSON(r,t))))}return xt.create({doc:t.doc,selection:A.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(xt.lineSeparator)||y)),s=e.selection?e.selection instanceof A?e.selection:A.single(e.selection.anchor,e.selection.head):A.single(0);return T(s,n.length),i.staticFacet(it)||(s=s.asSingle()),new xt(i,n,s,i.dynamicSlots.map((()=>null)),((t,e)=>e.create(t)),null)}get tabSize(){return this.facet(xt.tabSize)}get lineBreak(){return this.facet(xt.lineSeparator)||"\n"}get readOnly(){return this.facet(at)}phrase(t,...e){for(let e of this.facet(xt.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(et))for(let r of s(this,e,i))Object.prototype.hasOwnProperty.call(r,t)&&n.push(r[t]);return n}charCategorizer(t){return St(this.languageDataAt("wordChars",t).join(""))}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=f(e,r,!1);if(s(e.slice(t,r))!=wt.Word)break;r=t}for(;ot.length?t[0]:4}),xt.lineSeparator=nt,xt.readOnly=at,xt.phrases=E.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]))}}),xt.languageData=et,xt.changeFilter=st,xt.transactionFilter=rt,xt.transactionExtender=ot,F.reconfigure=ut.define();class Qt{eq(t){return this==t}range(t,e=t){return $t.create(t,e,this)}}Qt.prototype.startSide=Qt.prototype.endSide=0,Qt.prototype.point=!1,Qt.prototype.mapMode=S.TrackDel;let $t=class t{constructor(t,e,i){this.from=t,this.to=e,this.value=i}static create(e,i,n){return new t(e,i,n)}};function Pt(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Ct{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,a=s[n]-t||(i?this.value[n].endSide:this.value[n].startSide)-e;if(n==r)return a>=0?r:o;a>=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||l==h&&c.startSide>0&&c.endSide<=0)continue;(h-l||c.endSide-c.startSide)<0||(r<0&&(r=l),c.point&&(o=Math.max(o,h-l)),i.push(c),n.push(l-r),s.push(h-r))}return{mapped:i.length?new Ct(n,s,i,o):null,pos:r}}}class _t{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 _t(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(Pt)),this.isEmpty)return e.length?_t.of(e):this;let o=new At(this,null,-1).goto(0),a=0,l=[],h=new Xt;for(;o.value||a=0){let t=e[a++];h.addInner(t.from,t.to,t.value)||l.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 Tt.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return Tt.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)),a=Zt(r,o,i),l=new Et(r,a,s),h=new Et(o,a,s);i.iterGaps(((t,e,i)=>Vt(l,t,h,e,i,n))),i.empty&&0==i.length&&Vt(l,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=Zt(s,r),a=new Et(s,o,0).goto(i),l=new Et(r,o,0).goto(i);for(;;){if(a.to!=l.to||!Mt(a.active,l.active)||a.point&&(!l.point||!a.point.eq(l.point)))return!1;if(a.to>n)return!0;a.next(),l.next()}}static spans(t,e,i,n,s=-1){let r=new Et(t,null,s).goto(e),o=e,a=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,a),a=r.openEnd(t));if(r.to>i)return a+(r.point&&r.to>i?1:0);o=r.to,r.next()}}static of(t,e=!1){let i=new Xt;for(let n of t instanceof $t?[t]:e?function(t){if(t.length>1)for(let e=t[0],i=1;i0)return t.slice().sort(Pt);e=n}return t}(t):t)i.add(n.from,n.to,n.value);return i.finish()}}_t.empty=new _t([],[],null,-1),_t.empty.nextLayer=_t.empty;class Xt{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}finishChunk(t){this.chunks.push(new Ct(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=[])}add(t,e,i){this.addInner(t,e,i)||(this.nextLayer||(this.nextLayer=new Xt)).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(_t.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;let e=_t.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function Zt(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 At(r,e,i,s));return 1==n.length?n[0]:new Tt(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--)Rt(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--)Rt(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(),Rt(this.heap,0)}}}function Rt(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 Et{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=Tt.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){Dt(this.active,t),Dt(this.activeTo,t),Dt(this.activeRank,t),this.minActive=Ut(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&&Dt(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 Vt(t,e,i,n,s,r){t.goto(e),i.goto(n);let o=n+s,a=n,l=n-e;for(;;){let e=t.to+l-i.to||t.endSide-i.endSide,n=e<0?t.to+l: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))&&Mt(t.activeForPoint(t.to+l),i.activeForPoint(i.to))||r.comparePoint(a,s,t.point,i.point):s>a&&!Mt(t.active,i.active)&&r.compareRange(a,s,t.active,i.active),n>o)break;a=n,e<=0&&t.next(),e>=0&&i.next()}}function Mt(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 Ut(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(!l)throw new RangeError("The value of a property ("+i+") should be a primitive value.");s(n(i),o,a,h)}else null!=o&&a.push(i.replace(/_.*/,"").replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))+": "+o+";")}(a.length||h)&&r.push((!i||l||o?t:t.map(i)).join(", ")+" {"+a.join(" ")+"}")}for(let e in t)s(n(e),t[e],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let t=zt[qt]||1;return zt[qt]=t+1,"ͼ"+t.toString(36)}static mount(t,e){(t[Lt]||new jt(t)).mount(Array.isArray(e)?e:[e])}}let Bt=new Map;class jt{constructor(t){let e=t.ownerDocument||t,i=e.defaultView;if(!t.head&&t.adoptedStyleSheets&&i.CSSStyleSheet){let n=Bt.get(e);if(n)return t.adoptedStyleSheets=[n.sheet,...t.adoptedStyleSheets],t[Lt]=n;this.sheet=new i.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets],Bt.set(e,this)}else{this.styleTag=e.createElement("style");let i=t.head||t;i.insertBefore(this.styleTag,i.firstChild)}this.modules=[],t[Lt]=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:'"'},Ft="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),Ht="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Jt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Kt=Ht||Ft&&+Ft[1]<57,te=0;te<10;te++)Nt[48+te]=Nt[96+te]=String(te);for(te=1;te<=24;te++)Nt[te+111]="F"+te;for(te=65;te<=90;te++)Nt[te]=String.fromCharCode(te+32),Gt[te]=String.fromCharCode(te);for(var ee in Nt)Gt.hasOwnProperty(ee)||(Gt[ee]=Nt[ee]);function ie(t){let e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection()}function ne(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function se(t,e){if(!e.anchorNode)return!1;try{return ne(t,e.anchorNode)}catch(t){return!1}}function re(t){return 3==t.nodeType?me(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function oe(t,e,i,n){return!!i&&(le(t,e,i,n,-1)||le(t,e,i,n,1))}function ae(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function le(t,e,i,n,s){for(;;){if(t==i&&e==n)return!0;if(e==(s<0?0:he(t))){if("DIV"==t.nodeName)return!1;let i=t.parentNode;if(!i||1!=i.nodeType)return!1;e=ae(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?he(t):0}}}function he(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}const ce={left:0,right:0,top:0,bottom:0};function ue(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function de(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}class fe{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){this.set(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset)}set(t,e,i,n){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=n}}let pe,Oe=null;function ge(t){if(t.setActive)return t.setActive();if(Oe)return t.focus(Oe);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==Oe?{get preventScroll(){return Oe={preventScroll:!0},!0}}:void 0),!Oe){Oe=!1;for(let t=0;te)return i.domBoundsAround(t,e,l);if(c>=t&&-1==n&&(n=a,s=l),l>e&&i.dom.parentNode==this.dom){r=a,o=h;break}h=c,l=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.dirty|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.dirty|=2),1&e.dirty)return;e.dirty|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,this.dirty&&this.markParentsDirty(!0))}setDOM(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=ye){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 Qe(t,e,i,n,s,r,o,a,l){let{children:h}=t,c=h.length?h[e]:null,u=r.length?r[r.length-1]:null,d=u?u.breakAfter:o;if(!(e==n&&c&&!o&&!d&&r.length<2&&c.merge(i,s,r.length?u:null,0==i,a,l))){if(n0&&(!o&&r.length&&c.merge(i,c.length,r[0],!1,a,0)?c.breakAfter=r.shift().breakAfter:(i2);var De={mac:Me||/Mac/.test(Pe.platform),windows:/Win/.test(Pe.platform),linux:/Linux|X11/.test(Pe.platform),ie:Ae,ie_version:Xe?Ce.documentMode||6:Ze?+Ze[1]:_e?+_e[1]:0,gecko:Te,gecko_version:Te?+(/Firefox\/(\d+)/.exec(Pe.userAgent)||[0,0])[1]:0,chrome:!!Re,chrome_version:Re?+Re[1]:0,ios:Me,android:/Android\b/.test(Pe.userAgent),webkit:Ee,safari:Ve,webkit_version:Ee?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Ce.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class We extends Se{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(!i||i instanceof We&&!(this.length-(e-t)+i.length>256))&&(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),!0)}split(t){let e=new We(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new ve(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 Ye(this.dom,t,e)}}class Ue extends Se{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(we(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}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.dirty|=6)}sync(t,e){this.dom?4&this.dirty&&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 Ue&&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 Ue(this.mark,e,r)}domAtPos(t){return Ge(this,t)}coordsAt(t,e){return He(this,t,e)}}function Ye(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?De.chrome||De.gecko||(e?(s--,o=1):r=0)?0:a.length-1];return De.safari&&!o&&0==l.width&&(l=Array.prototype.find.call(a,(t=>t.width))||l),o?ue(l,o<0):l||null}class qe extends Se{constructor(t,e,i){super(),this.widget=t,this.length=e,this.side=i,this.prevWidget=null}static create(t,e,i){return new(t.customView||qe)(t,e,i)}split(t){let e=qe.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 qe&&this.widget.compare(i.widget))||t>0&&s<=0||e0)?ve.before(this.dom):ve.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let i=this.dom.getClientRects(),n=null;if(!i.length)return ce;for(let e=t>0?i.length-1:0;n=i[e],!(t>0?0==e:e==i.length-1||n.top0?-1:1);return this.length?n:ue(n,this.side>0)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class Le extends qe{domAtPos(t){let{topView:e,text:i}=this.widget;return e?ze(t,0,e,i,this.length-e.length,((t,e)=>t.domAtPos(e)),((t,e)=>new ve(t,Math.min(e,t.nodeValue.length)))):new ve(i,Math.min(t,i.nodeValue.length))}sync(){this.setDOM(this.widget.toDOM())}localPosFromDOM(t,e){let{topView:i,text:n}=this.widget;return i?Be(t,e,i,n,this.length-i.length):Math.min(e,this.length)}ignoreMutation(){return!1}get overrideDOMText(){return null}coordsAt(t,e){let{topView:i,text:n}=this.widget;return i?ze(t,e,i,n,this.length-i.length,((t,e,i)=>t.coordsAt(e,i)),((t,e,i)=>Ye(t,e,i))):Ye(n,t,e)}destroy(){var t;super.destroy(),null===(t=this.widget.topView)||void 0===t||t.destroy()}get isEditable(){return!0}canReuseDOM(){return!0}}function ze(t,e,i,n,s,r,o){if(i instanceof Ue){for(let a=i.dom.firstChild;a;a=a.nextSibling){let i=Se.get(a);if(i){let l=ne(a,n),h=i.length+(l?s:0);if(t0?ve.before(this.dom):ve.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){let e=this.dom.getBoundingClientRect(),i=function(t,e){let i=t.parent,n=i?i.children.indexOf(t):-1;for(;i&&n>=0;)if(e<0?n>0:n0?-1:1);return i&&i.tope.top?{left:e.left,right:e.right,top:i.top,bottom:i.bottom}:e}get overrideDOMText(){return t.empty}get isHidden(){return!0}}function Ge(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 Ue&&s.length&&(n=s[s.length-1])instanceof Ue&&n.mark.eq(e.mark)?Fe(n,e.children[0],i-1):(s.push(e),e.setParent(t)),t.length+=e.length}function He(t,e,i){let n=null,s=-1,r=null,o=-1;!function t(e,a){for(let l=0,h=0;l=a&&(c.children.length?t(c,a-h):(!r||r instanceof Ne&&i>0)&&(u>a||h==u&&c.getSide()>0)?(r=c,o=a-h):(h0?3e8:-4e8:e>0?1e8:-1e8,new oi(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}=ai(t,n);e=(s?n?-3e8:-1:5e8)-1,i=1+(r?n?2e8:1:-6e8)}return new oi(t,e,i,n,t.widget||null,!0)}static line(t){return new ri(t)}static set(t,e=!1){return _t.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}ni.none=_t.empty;class si extends ni{constructor(t){let{start:e,end:i}=ai(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){return this==t||t instanceof si&&this.tagName==t.tagName&&this.class==t.class&&Ke(this.attrs,t.attrs)}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}si.prototype.point=!1;class ri extends ni{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof ri&&this.spec.class==t.spec.class&&Ke(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)}}ri.prototype.mapMode=S.TrackBefore,ri.prototype.point=!0;class oi extends ni{constructor(t,e,i,n,s,r){super(e,i,s,t),this.block=n,this.isReplace=r,this.mapMode=n?e<=0?S.TrackBefore:S.TrackAfter:S.TrackDel}get type(){return this.startSide=5}eq(t){return t instanceof oi&&(e=this.widget,i=t.widget,e==i||!!(e&&i&&e.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var e,i}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 ai(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 li(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)}oi.prototype.point=!0;class hi extends Se{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 hi))return!1;this.dom||i.transferDOM(this)}return n&&this.setDeco(i?i.attrs:null),$e(this,t,e,i?i.children:[],s,r),!0}split(t){let e=new hi;if(e.breakAfter=this.breakAfter,0==this.length)return e;let{i: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){Ke(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){Fe(this,t,e)}addLineDeco(t){let e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=Je(e,this.attrs||{})),i&&(this.attrs=Je({class:i},this.attrs||{}))}domAtPos(t){return Ge(this,t)}reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.dirty|=6)}sync(t,e){var i;this.dom?4&this.dirty&&(we(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&&(ti(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&&Se.get(n)instanceof Ue;)n=n.lastChild;if(!(n&&this.length&&("BR"==n.nodeName||0!=(null===(i=Se.get(n))||void 0===i?void 0:i.isEditable)||De.ios&&this.children.some((t=>t instanceof We))))){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 We)||/[^ -~]/.test(i.text))return null;let n=re(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=He(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 hi)return s;if(r>e)break}n=r+s.breakAfter}return null}}class ci extends Se{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 ci&&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(di(new We(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 oi){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let o=e-t;if(i instanceof oi)if(i.block){let{type:t}=i;t!=ii.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new ci(i.widget||new fi("div"),o,t))}else{let r=qe.create(i.widget||new fi("span"),o,o?0:i.startSide),a=this.atCursorPos&&!r.isEditable&&s<=n.length&&(t0),l=!r.isEditable&&(tn.length||i.startSide<=0),h=this.getLine();2!=this.pendingBuffer||a||r.isEditable||(this.pendingBuffer=0),this.flushBuffer(n),a&&(h.append(di(new Ne(1),n),s),s=n.length+Math.max(0,s-n.length)),h.append(di(r,n),s),this.atCursorPos=l,this.pendingBuffer=l?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 ui(t,e,i,s);return r.openEnd=_t.spans(n,e,i,r),r.openStart<0&&(r.openStart=r.openEnd),r.finish(r.openEnd),r}}function di(t,e){for(let i of e)t=new Ue(i,[t],t.length);return t}class fi extends ei{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 pi=E.define(),Oi=E.define(),gi=E.define(),mi=E.define(),bi=E.define(),wi=E.define(),vi=E.define(),yi=E.define({combine:t=>t.some((t=>t))}),Si=E.define({combine:t=>t.some((t=>t))});class xi{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 xi(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin)}}const ki=ut.define({map:(t,e)=>t.map(e)});function Qi(t,e,i){let n=t.facet(mi);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 $i=E.define({combine:t=>!t.length||t[0]});let Pi=0;const Ci=E.define();class _i{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 _i(Pi++,t,i,(t=>{let e=[Ci.of(t)];return s&&e.push(Ti.of((e=>{let i=e.plugin(t);return i?s(i):ni.none}))),n&&e.push(n(t)),e}))}static fromClass(t,e){return _i.define((e=>new t(e)),e)}}class Xi{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(Qi(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){Qi(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){Qi(t.state,e,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Zi=E.define(),Ai=E.define(),Ti=E.define(),Ri=E.define(),Ei=E.define(),Vi=E.define();class Mi{constructor(t,e,i,n){this.fromA=t,this.toA=e,this.fromB=i,this.toB=n}join(t){return new Mi(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(!a)return i;new Mi(a.fromA,a.toA,a.fromB,a.toB).addToSet(i),r=a.toA,o=a.toB}}}class Di{constructor(t,e,i){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=k.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 Mi(t,e,i,s)))),this.changedRanges=n}static create(t,e,i){return new Di(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 Wi=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Wi||(Wi={}));const Ui=Wi.LTR,Yi=Wi.RTL;function qi(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}}const Gi=[];function Fi(t){return[new Ni(0,t,0)]}let Hi="";function Ji(t,e,i,n,s){var r;let o=n.head-t.from,a=-1;if(0==o){if(!s||!t.length)return null;e[0].level!=i&&(o=e[0].side(!1,i),a=0)}else if(o==t.length){if(s)return null;let t=e[e.length-1];t.level!=i&&(o=t.side(!0,i),a=e.length-1)}a<0&&(a=Ni.find(e,o,null!==(r=n.bidiLevel)&&void 0!==r?r:-1,n.assoc));let l=e[a];o==l.side(s,i)&&(l=e[a+=s?1:-1],o=l.side(!s,i));let h=s==(l.dir==i),c=f(t.text,o,h);if(Hi=t.text.slice(Math.min(o,c),Math.max(o,c)),c!=l.side(s,i))return A.cursor(c+t.from,h?-1:1,l.level);let u=a==(s?e.length-1:0)?null:e[a+(s?1:-1)];return u||l.level==i?u&&u.level1)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=Se.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 en(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}class nn{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class sn extends Se{constructor(t){super(),this.view=t,this.compositionDeco=ni.none,this.decorations=[],this.dynamicDecorationMap=[],this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(t.contentDOM),this.children=[new hi],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Mi(0,0,0,t.state.doc.length)],0)}get length(){return this.view.state.doc.length}update(t){let e=t.changedRanges;this.minWidth>0&&e.length&&(e.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),this.view.inputState.composing<0?this.compositionDeco=ni.none:(t.transactions.length||this.dirty)&&(this.compositionDeco=function(t,e){let i=on(t);if(!i)return ni.none;let{from:n,to:s,node:r,text:o}=i,a=e.mapPos(n,1),l=Math.max(a,e.mapPos(s,-1)),{state:h}=t,c=3==r.nodeType?r.nodeValue:new tn([],h).readRange(r.firstChild,null).text;if(l-a{this.dom.style.height=this.view.viewState.contentHeight+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let t=De.chrome||De.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,t),this.dirty=0,t&&(t.written||i.selectionRange.focusNode!=t.node)&&(this.forceSelection=!0),this.dom.style.height=""}));let n=[];if(this.view.viewport.from||this.view.viewport.to=0?t[e]:null;if(!n)break;let{fromA:s,toA:r,fromB:o,toB:a}=n,{content:l,breakAtStart:h,openStart:c,openEnd:u}=ui.build(this.view.state.doc,o,a,this.decorations,this.dynamicDecorationMap),{i:d,off:f}=i.findPos(r,1),{i:p,off:O}=i.findPos(s,-1);Qe(this,p,O,d,f,l,h,c,u)}}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&&se(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,a=this.domAtPos(o.anchor),l=o.empty?a:this.domAtPos(o.head);if(De.gecko&&o.empty&&!this.compositionDeco.size&&(1==(h=a).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((()=>a.node.insertBefore(t,a.node.childNodes[a.offset]||null))),a=l=new ve(t,0),r=!0}var h;let c=this.view.observer.selectionRange;!r&&c.focusNode&&oe(a.node,a.offset,c.anchorNode,c.anchorOffset)&&oe(l.node,l.offset,c.focusNode,c.focusOffset)||(this.view.observer.ignore((()=>{De.android&&De.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=ie(this.view.root);if(t)if(o.empty){if(De.gecko){let t=(e=a.node,n=a.offset,1!=e.nodeType?0:(n&&"false"==e.childNodes[n-1].contentEditable?1:0)|(no.head&&([a,l]=[l,a]),e.setEnd(l.node,l.offset),e.setStart(a.node,a.offset),t.removeAllRanges(),t.addRange(e)}else;var e,n;s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())})),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new ve(c.anchorNode,c.anchorOffset),this.impreciseHead=l.precise?null:new ve(c.focusNode,c.focusOffset)}enforceCursorAssoc(){if(this.compositionDeco.size)return;let{view:t}=this,e=t.state.selection.main,i=ie(t.root),{anchorNode:n,anchorOffset:s}=t.observer.selectionRange;if(!(i&&e.empty&&e.assoc&&i.modify))return;let r=hi.find(this,e.head);if(!r)return;let o=r.posAtStart;if(e.head==o||e.head==o+r.length)return;let a=this.coordsAt(e.head,-1),l=this.coordsAt(e.head,1);if(!a||!l||a.bottom>l.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)}nearest(t){for(let e=t;e;){let t=Se.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!=ii.WidgetBefore&&s.type!=ii.WidgetAfter&&(!n||2==e||this.children[n-1].breakAfter||this.children[n-1].type==ii.WidgetBefore&&e>-2))return s.coordsAt(t-r,e);i=r}}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,a=this.view.textDirection==Wi.LTR;for(let t=0,l=0;ln)break;if(t>=i){let i=h.dom.getBoundingClientRect();if(e.push(i.height),r){let e=h.dom.lastChild,n=e?re(e):[];if(n.length){let e=n[n.length-1],r=a?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?Wi.RTL:Wi.LTR}measureTextSize(){for(let t of this.children)if(t instanceof hi){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.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(n);let s=re(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 ke(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;t.push(ni.replace({widget:new rn(n),block:!0,inclusive:!0,isBlockGap:!0}).range(i,r))}if(!s)break;i=s.to+1}return ni.set(t)}updateDeco(){let t=this.view.state.facet(Ti).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=0,r=0,o=0,a=0;for(let t of this.view.state.facet(Ei).map((t=>t(this.view))))if(t){let{left:e,right:i,top:n,bottom:l}=t;null!=e&&(s=Math.max(s,e)),null!=i&&(r=Math.max(r,i)),null!=n&&(o=Math.max(o,n)),null!=l&&(a=Math.max(a,l))}let l={left:n.left-s,top:n.top-o,right:n.right+r,bottom:n.bottom+a};!function(t,e,i,n,s,r,o,a){let l=t.ownerDocument,h=l.defaultView||window;for(let c=t;c;)if(1==c.nodeType){let t,u=c==l.body;if(u)t=de(h);else{if(c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let e=c.getBoundingClientRect();t={left:e.left,right:e.left+c.clientWidth,top:e.top,bottom:e.top+c.clientHeight}}let d=0,f=0;if("nearest"==s)e.top0&&e.bottom>t.bottom+f&&(f=e.bottom-t.bottom+f+o)):e.bottom>t.bottom&&(f=e.bottom-t.bottom+o,i<0&&e.top-f0&&e.right>t.right+d&&(d=e.right-t.right+d+r)):e.right>t.right&&(d=e.right-t.right+r,i<0&&e.left0))break;i=i.childNodes[n-1],n=he(i)}if(i>=0)for(let n=t,s=e;;){if(3==n.nodeType)return n;if(!(1==n.nodeType&&s=0))break;n=n.childNodes[s],s=0}return null}class hn{constructor(){this.changes=[]}compareRange(t,e){li(t,e,this.changes)}comparePoint(t,e){li(t,e,this.changes)}}function cn(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function un(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function dn(t,e){return t.tope.top+1}function fn(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,a,l,h,c,u=!1;for(let d=t.firstChild;d;d=d.nextSibling){let t=re(d);for(let f=0;fg||o==g&&r>O){n=d,s=p,r=O,o=g;let a=g?i0?f0)}0==O?i>p.bottom&&(!h||h.bottomp.top)&&(l=d,c=p):h&&dn(h,p)?h=pn(h,p.bottom):c&&dn(c,p)&&(c=fn(c,p.top))}}if(h&&h.bottom>=i?(n=a,s=h):c&&c.top<=i&&(n=l,s=c),!n)return{node:t,offset:0};let d=Math.max(s.left,Math.min(s.right,e));return 3==n.nodeType?gn(n,d,i):u&&"false"!=n.contentEditable?On(n,d,i):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,n)+(e>=(s.left+s.right)/2?1:0)}}function gn(t,e,i){let n=t.nodeValue.length,s=-1,r=1e9,o=0;for(let a=0;ai?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(De.chrome||De.gecko){me(t,a).getBoundingClientRect().left==h.right&&(n=!i)}if(c<=0)return{node:t,offset:a+(n?1:0)};s=a+(n?1:0),r=c}}}return{node:t,offset:s>-1?s:o>0?t.nodeValue.length:0}}function mn(t,e,i,n=-1){var s,r;let o,a=t.contentDOM.getBoundingClientRect(),l=a.top+t.viewState.paddingTop,{docHeight:h}=t.viewState,{x:c,y:u}=e,d=u-l;if(d<0)return 0;if(d>h)return t.state.doc.length;for(let e=t.defaultLineHeight/2,s=!1;o=t.elementAtHeight(d),o.type!=ii.Text;)for(;d=n>0?o.bottom+e:o.top-e,!(d>=0&&d<=h);){if(s)return i?null:0;s=!0,n=-n}u=l+d;let f=o.from;if(ft.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:bn(t,a,o,c,u);let p=t.dom.ownerDocument,O=t.root.elementFromPoint?t.root:p,g=O.elementFromPoint(c,u);g&&!t.contentDOM.contains(g)&&(g=null),g||(c=Math.max(a.left+1,Math.min(a.right-1,c)),g=O.elementFromPoint(c,u),g&&!t.contentDOM.contains(g)&&(g=null));let m,b=-1;if(g&&0!=(null===(s=t.docView.nearest(g))||void 0===s?void 0:s.isEditable))if(p.caretPositionFromPoint){let t=p.caretPositionFromPoint(c,u);t&&({offsetNode:m,offset:b}=t)}else if(p.caretRangeFromPoint){let e=p.caretRangeFromPoint(c,u);e&&(({startContainer:m,startOffset:b}=e),(!t.contentDOM.contains(m)||De.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 me(t,n-1,n).getBoundingClientRect().left>i}(m,b,c)||De.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}let n=1==t.nodeType?t.getBoundingClientRect():me(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return i-n.left>5}(m,b,c))&&(m=void 0))}if(!m||!t.docView.dom.contains(m)){let e=hi.find(t.docView,f);if(!e)return d>o.top+o.height/2?o.to:o.from;({node:m,offset:b}=On(e.dom,c,u))}let w=t.docView.nearest(m);if(!w)return null;if(w.isWidget&&1==(null===(r=w.dom)||void 0===r?void 0:r.nodeType)){let t=w.dom.getBoundingClientRect();return e.y1.5*t.defaultLineHeight){r+=Math.floor((s-i.top)/t.defaultLineHeight)*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=f(t,n)}return!0===n?-1:t.length}(o,r,t.state.tabSize)}function wn(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=t.bidiSpans(s),o=t.textDirectionAt(s.from);for(let a=e,l=null;;){let e=Ji(s,r,o,a,i),h=Hi;if(!e){if(s.number==(i?t.state.doc.lines:1))return a;h="\n",s=t.state.doc.line(s.number+(i?1:-1)),r=t.bidiSpans(s),e=A.cursor(i?s.from:s.to)}if(l){if(!l(h))return a}else{if(!n)return e;l=n(h)}a=e}}function vn(t,e,i,n){let s=t.state.facet(Ri).map((e=>e(t)));for(;;){let t=!1;for(let r of s)r.between(i.from-1,i.from+1,((s,r,o)=>{i.from>s&&i.fromi.from?A.cursor(s,1):A.cursor(r,-1),t=!0,o.widget.skipPosition&&(i=o.widget.skipPosition(i,e,n)))}));if(!t)return i}}class yn{constructor(t){this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null;let e=(e,i)=>{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 Cn){let n=Cn[i];t.contentDOM.addEventListener(i,(i=>{Pn(t,i)&&e(n,i)}),_n[i]),this.registeredEvents.push(i)}t.scrollDOM.addEventListener("mousedown",(i=>{if(i.target==t.scrollDOM&&i.clientY>t.contentDOM.getBoundingClientRect().bottom&&(e(Cn.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)}})),De.chrome&&102==De.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,De.safari&&t.contentDOM.addEventListener("input",(()=>null))}setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}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=>{Pn(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){Qi(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){Qi(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||xn.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,be(t.contentDOM,e.key,e.keyCode))}ignoreDuringComposition(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(De.safari&&!De.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 Sn=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],xn="dthko",kn=[16,17,18,20,91,92,224,225];function Qn(t){return.7*Math.max(0,t)+8}class $n{constructor(t,e,i,n){this.view=t,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);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(xt.allowMultipleSelections)&&function(t,e){let i=t.state.facet(pi);return i.length?i[0](e):(De.mac,e.altKey)}(t,e),this.dragMove=function(t,e){let i=t.state.facet(Oi);return i.length?i[0](e):De.mac?!e.altKey:!e.ctrlKey}(t,e),this.dragging=!(!function(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let n=ie(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!=Yn(e))&&null}start(t){!1===this.dragging&&(t.preventDefault(),this.select(t))}move(t){var e;if(0==t.buttons)return this.destroy();if(!1!==this.dragging)return;this.select(this.lastEvent=t);let i=0,n=0,s=(null===(e=this.scrollParent)||void 0===e?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight};t.clientX<=s.left+6?i=-Qn(s.left-t.clientX):t.clientX>=s.right-6&&(i=Qn(t.clientX-s.right)),t.clientY<=s.top+6?n=-Qn(s.top-t.clientY):t.clientY>=s.bottom-6&&(n=Qn(t.clientY-s.bottom)),this.setScrollSpeed(i,n)}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)}select(t){let e=this.style.get(t,this.extend,this.multiple);!this.mustSelect&&e.eq(this.view.state.selection)&&e.main.assoc==this.view.state.selection.main.assoc||this.view.dispatch({selection:e,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.docChanged&&this.dragging&&(this.dragging=this.dragging.map(t.changes)),this.style.update(t)&&setTimeout((()=>this.select(this.lastEvent)),20)}}function Pn(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=Se.get(n))&&i.ignoreEvent(e))return!1;return!0}const Cn=Object.create(null),_n=Object.create(null),Xn=De.ie&&De.ie_version<15||De.ios&&De.webkit_version<604;function Zn(t,e){let i,{state:n}=t,s=1,r=n.toText(e),o=r.lines==n.selection.ranges.length;if(null!=Ln&&n.selection.ranges.every((t=>t.empty))&&Ln==r.toString()){let t=-1;i=n.changeByRange((i=>{let a=n.doc.lineAt(i.from);if(a.from==t)return{range:i};t=a.from;let l=n.toText((o?r.line(s++).text:e)+n.lineBreak);return{changes:{from:a.from,insert:l},range:A.cursor(i.from+l.length)}}))}else i=o?n.changeByRange((t=>{let e=r.line(s++);return{changes:{from:t.from,to:t.to,insert:e.text},range:A.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 A.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 A.cursor(e);0==r?i=1:r==s.length&&(i=-1);let o=r,a=r;i<0?o=f(s.text,r,!1):a=f(s.text,r);let l=n(s.text.slice(o,a));for(;o>0;){let t=f(s.text,o,!1);if(n(s.text.slice(t,o))!=l)break;o=t}for(;a{t.inputState.setSelectionOrigin("select"),27==e.keyCode&&(t.inputState.lastEscPress=Date.now())},Cn.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},Cn.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},_n.touchstart=_n.touchmove={passive:!0},Cn.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return;let i=null;for(let n of t.state.facet(gi))if(i=n(t,e),i)break;if(i||0!=e.button||(i=function(t,e){let i=Vn(t,e),n=Yn(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 a,l=Vn(t,e),h=An(t,l.pos,l.bias,n);if(i.pos!=l.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&&(a=function(t,e){for(let i=0;i=e)return A.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,l.pos))?a:o?s.addRange(h):A.create([h])}}}(t,e)),i){let n=t.root.activeElement!=t.contentDOM;t.inputState.startMouseSelection(new $n(t,e,i,n)),n&&t.observer.ignore((()=>ge(t.contentDOM))),t.inputState.mouseSelection&&t.inputState.mouseSelection.start(e)}};let Tn=(t,e)=>t>=e.top&&t<=e.bottom,Rn=(t,e,i)=>Tn(e,i)&&t>=i.left&&t<=i.right;function En(t,e,i,n){let s=hi.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&&Rn(i,n,o))return-1;let a=s.coordsAt(r,1);return a&&Rn(i,n,a)?1:o&&Tn(n,o)?-1:1}function Vn(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:En(t,i,e.clientX,e.clientY)}}const Mn=De.ie&&De.ie_version<=11;let Dn=null,Wn=0,Un=0;function Yn(t){if(!Mn)return t.detail;let e=Dn,i=Un;return Dn=t,Un=Date.now(),Wn=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Wn+1)%3:1}function qn(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&&r.dragMove?{from:r.dragging.from,to:r.dragging.to}:null,a={from:s,insert:i},l=t.state.changes(o?[o,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(s,-1),head:l.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"})}Cn.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")},Cn.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&&qn(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 qn(t,e,e.dataTransfer.getData("Text"),!0)},Cn.paste=(t,e)=>{if(t.state.readOnly)return e.preventDefault();t.observer.flush();let i=Xn?null:e.clipboardData;i?(Zn(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(),Zn(t,i.value)}),50)}(t)};let Ln=null;Cn.copy=Cn.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;Ln=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 zn=lt.define();function In(t,e){let i=[];for(let n of t.facet(vi)){let s=n(t,e);s&&i.push(s)}return i?t.update({effects:i,annotations:zn.of(!0)}):null}function Bn(t){setTimeout((()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=In(t.state,e);i?t.dispatch(i):t.update([])}}),10)}Cn.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),Bn(t)},Cn.blur=t=>{t.observer.clearSelectionRange(),Bn(t)},Cn.compositionstart=Cn.compositionupdate=t=>{null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},Cn.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,De.chrome&&De.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then((()=>t.observer.flush())):setTimeout((()=>{t.inputState.composing<0&&t.docView.compositionDeco.size&&t.update([])}),50)},Cn.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},Cn.beforeinput=(t,e)=>{var i;let n;if(De.chrome&&De.android&&(n=Sn.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 jn=["pre-wrap","normal","pre-line","break-spaces"];class Nn{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){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return jn.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i-1,a=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,a){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)>Jn&&(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:a,toA:l,fromB:h,toB:c}=n[o],u=s.lineAt(a,Hn.ByPosNoHeight,i.setDoc(e),0,0),d=u.to>=l?u:s.lineAt(l,Hn.ByPosNoHeight,i,0,0);for(c+=d.to-l,l=d.to;o>0&&u.from<=n[o-1].toA;)a=n[o-1].fromA,h=n[o-1].fromB,o--,a2*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 es extends ts{constructor(t,e){super(t,e,ii.Text),this.collapsed=0,this.widgetHeight=0}replace(t,e,i){let n=i[0];return 1==i.length&&(n instanceof es||n instanceof is&&4&n.flags)&&Math.abs(this.length-n.length)<10?(n instanceof is?n=new es(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.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class is 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:a}=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),l=o+r.length*a,h=Math.max(i,t-l/2);return new Fn(r.from,r.length,h,l,ii.Text)}{let n=Math.max(0,Math.min(r-s,Math.floor((t-i)/o))),{from:a,length:l}=e.doc.line(s+n);return new Fn(a,l,i+o*n,o,ii.Text)}}lineAt(t,e,i,n,s){if(e==Hn.ByHeight)return this.blockAt(t,i,n,s);if(e==Hn.ByPosNoHeight){let{from:e,to:n}=i.doc.lineAt(t);return new Fn(e,n-e,0,0,ii.Text)}let{firstLine:r,perLine:o,perChar:a}=this.heightMetrics(i,s),l=i.doc.lineAt(t),h=o+l.length*a,c=l.number-r,u=n+o*c+a*(l.from-s-c);return new Fn(l.from,l.length,Math.max(n,Math.min(u,n+this.height-h)),h,ii.Text)}forEachLine(t,e,i,n,s,r){t=Math.max(t,s),e=Math.min(e,s+this.length);let{firstLine:o,perLine:a,perChar:l}=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+=a*i+l*(t-s-i)}let n=a+l*e.length;r(new Fn(e.from,e.length,c,n,ii.Text)),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 is?i[i.length-1]=new is(t.length+n):i.push(null,new is(n-1))}if(t>0){let e=i[0];e instanceof is?i[0]=new is(t+e.length):i.unshift(new is(t-1),null)}return Kn.of(i)}decomposeLeft(t,e){e.push(new is(t-1),null)}decomposeRight(t,e){e.push(null,new is(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 is(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)>=Jn&&(o=-2);let a=new es(e,s);a.outdated=!1,i.push(a),r+=e+1}r<=s&&i.push(null,new is(s-r).updateHeight(t,r));let a=Kn.of(i);return(o<0||Math.abs(a.height-this.height)>=Jn||Math.abs(o-this.heightMetrics(t,e).perLine)>=Jn)&&(t.heightChanged=!0),a}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class ns 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 l;let h=e==Hn.ByPosNoHeight?Hn.ByPosNoHeight:Hn.ByPos;return a?l.join(this.right.lineAt(o,h,i,r,o)):this.left.lineAt(o,h,i,n,s).join(l)}forEachLine(t,e,i,n,s,r){let o=n+this.left.height,a=s+this.left.length+this.break;if(this.break)t=a&&this.right.forEachLine(t,e,i,o,a,r);else{let l=this.lineAt(a,Hn.ByPos,i,n,s);t=t&&l.from<=e&&r(l),e>l.to&&this.right.forEachLine(l.to+1,e,i,o,a,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&&ss(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,a=null;return n&&n.from<=e+s.length&&n.more?a=s=s.updateHeight(t,e,i,n):s.updateHeight(t,e,i),n&&n.from<=o+r.length&&n.more?a=r=r.updateHeight(t,o,i,n):r.updateHeight(t,o,i),a?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 ss(t,e){let i,n;null==t[e]&&(i=t[e-1])instanceof is&&(n=t[e+1])instanceof is&&t.splice(e-1,3,new is(i.length+1+n.length))}class rs{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 es?i.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new es(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)}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 es(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let i=new is(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 es)return t;let e=new es(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine(),t.type!=ii.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,t.type!=ii.WidgetBefore&&(this.covering=t)}addLineDeco(t,e){let i=this.ensureLine();i.length+=e,i.collapsed+=e,i.widgetHeight=Math.max(i.widgetHeight,t),this.writtenTo=this.pos=this.pos+e}finish(t){let e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof es||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),a=Math.max(a,n.top),l=e==t.parentNode?n.bottom:Math.min(l,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:a-(i.top+e),bottom:Math.max(a,l)-(i.top+e)}}function ls(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class hs{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 Nn(i),this.stateDeco=e.facet(Ti).filter((t=>"function"!=typeof t)),this.heightMap=Kn.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle.setDoc(e.doc),[new Mi(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ni.set(this.lineGaps.map((t=>t.draw(!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 ds(e,i))}}this.viewports=t.sort(((t,e)=>t.from-e.from)),this.scaler=this.heightMap.height<=7e6?gs:new ms(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:bs(t,this.scaler))}))}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=this.state.facet(Ti).filter((t=>"function"!=typeof t));let n=t.changedRanges,s=Mi.extendWithRanges(n,function(t,e,i){let n=new os;return _t.compare(t,e,i,n,0),n.changes}(i,this.stateDeco,t?t.changes:k.empty(this.state.doc.length))),r=this.heightMap.height;this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),s),this.heightMap.height!=r&&(t.flags|=2);let o=s.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.heado.to)||!this.viewportIsAppropriate(o))&&(o=this.getViewport(0,e));let a=!t.changes.empty||2&t.flags||o.from!=this.viewport.from||o.to!=this.viewport.to;this.viewport=o,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(Si)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let i=e.contentDOM,n=window.getComputedStyle(i),s=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Wi.RTL:Wi.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),a=i.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let h=0,c=0,u=parseInt(n.paddingTop)||0,d=parseInt(n.paddingBottom)||0;this.paddingTop==u&&this.paddingBottom==d||(this.paddingTop=u,this.paddingBottom=d,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let f=(this.printing?ls:as)(i,this.paddingTop),p=f.top-this.pixelViewport.top,O=f.bottom-this.pixelViewport.bottom;this.pixelViewport=f;let g=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(g!=this.inView&&(this.inView=g,g&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let m=a.width;if(this.contentDOMWidth==m&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,h|=8),l){let i=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(i)&&(o=!0),o||s.lineWrapping&&Math.abs(m-this.contentDOMWidth)>s.charWidth){let{lineHeight:t,charWidth:n,textHeight:a}=e.docView.measureTextSize();o=t>0&&s.refresh(r,t,n,a,m/n,i),o&&(e.docView.minWidth=0,h|=8)}p>0&&O>0?c=Math.max(p,O):p<0&&O<0&&(c=Math.min(p,O)),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 Mi(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new Gn(n.from,r))}s.heightChanged&&(h|=2)}let b=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return b&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(2&h||b)&&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,a=new ds(n.lineAt(r-1e3*i,Hn.ByHeight,s,0,0).from,n.lineAt(o+1e3*(1-i),Hn.ByHeight,s,0,0).to);if(e){let{head:t}=e.range;if(ta.to){let i,r=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=n.lineAt(t,Hn.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!=Wi.LTR&&!i)return[];let o=[],a=(n,r,l,h)=>{if(r-nn&&tt.from>=l.from&&t.to<=l.to&&Math.abs(t.from-n)t.frome))));if(!d){if(rt.from<=r&&t.to>=r))){let t=e.moveToLineBoundary(A.cursor(r),!1,!0).head;t>n&&(r=t)}d=new hs(n,r,this.gapSize(l,n,r,h))}o.push(d)};for(let t of this.viewportLines){if(t.lengtht.from&&a(t.from,s,t,e),ot.draw(this.heightOracle.lineWrapping)))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];_t.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))||bs(this.heightMap.lineAt(t,Hn.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return bs(this.heightMap.lineAt(this.scaler.fromDOM(t),Hn.ByHeight,this.heightOracle,0,0),this.scaler)}elementAtHeight(t){return bs(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 ds{constructor(t,e){this.from=t,this.to=e}}function fs(t,e,i){let n=[],s=t,r=0;return _t.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 Os(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 gs={toDOM:t=>t,fromDOM:t=>t,scale:1};class ms{constructor(t,e,i){let n=0,s=0,r=0;this.viewports=i.map((({from:i,to:s})=>{let r=e.lineAt(i,Hn.ByPos,t,0,0).top,o=e.lineAt(s,Hn.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=ebs(t,e))):t.type)}const ws=E.define({combine:t=>t.join(" ")}),vs=E.define({combine:t=>t.indexOf(!0)>-1}),ys=It.newName(),Ss=It.newName(),xs=It.newName(),ks={"&light":"."+Ss,"&dark":"."+xs};function Qs(t,e,i){return new It(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 $s=Qs("."+ys,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",borderRadius:"4px",marginTop:"0.5rem",width:"30%",minWidth:"190px",marginLeft:"auto",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&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:"#333338",fontSize:"70%",padding:".2em 1em",borderRadius:"4px"},"&light .cm-button":{background:"#eee"},"&dark .cm-button":{background:"#eee"},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",borderRadius:"0.25rem",border:"1px solid silver",padding:".0em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},ks);class Ps{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;i&&(e.push(new nn(i,n)),s==i&&r==n||e.push(new nn(s,r)));return e}(t),i=new tn(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?A.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||!ne(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||!ne(t.contentDOM,e.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(e.anchorNode,e.anchorOffset);this.newSel=A.single(n,i)}}}function Cs(e,i){let n,{newSel:s}=i,r=e.state.selection.main;if(i.bounds){let{from:s,to:o}=i.bounds,a=r.from,l=null;(8===e.inputState.lastKeyCode&&e.inputState.lastKeyTime>Date.now()-100||De.android&&i.text.length0&&a>0&&t.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if("end"==n){i-=o+Math.max(0,r-Math.min(o,a))-r}if(o=o?r-i:0,a=r+(a-o),o=r}else if(a=a?r-i:0,o=r+(o-a),a=r}return{from:r,toA:o,toB:a}}(e.state.doc.sliceString(s,o,Ki),i.text,a-s,l);h&&(De.chrome&&13==e.inputState.lastKeyCode&&h.toB==h.from+2&&i.text.slice(h.from,h.toB)==Ki+Ki&&h.toB--,n={from:s+h.from,to:s+h.toA,insert:t.of(i.text.slice(h.from,h.toB).split(Ki))})}else s&&(!e.hasFocus&&e.state.facet($i)||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))}:(De.mac||De.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=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}):De.chrome&&n&&n.from==n.to&&n.from==r.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(s&&(s=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}),n){let t=e.state;if(De.ios&&e.inputState.flushIOSKey(e))return!0;if(De.android&&(n.from==r.from&&n.to==r.to&&1==n.insert.length&&2==n.insert.lines&&be(e.contentDOM,"Enter",13)||n.from==r.from-1&&n.to==r.to&&0==n.insert.length&&be(e.contentDOM,"Backspace",8)||n.from==r.from&&n.to==r.to+1&&0==n.insert.length&&be(e.contentDOM,"Delete",46)))return!0;let i,o=n.insert.toString();if(e.state.facet(wi).some((t=>t(e,n.from,n.to,o))))return!0;if(e.inputState.composing>=0&&e.inputState.composing++,n.from>=r.from&&n.to<=r.to&&n.to-n.from>=(r.to-r.from)/3&&(!s||s.main.empty&&s.main.from==n.from+n.insert.length)&&e.inputState.composing<0){let s=r.fromn.to?t.sliceDoc(n.to,r.to):"";i=t.replaceSelection(e.state.toText(s+n.insert.sliceString(0,void 0,e.state.lineBreak)+o))}else{let o=t.changes(n),a=s&&s.main.to<=o.newLength?s.main:void 0;if(t.selection.ranges.length>1&&e.inputState.composing>=0&&n.to<=r.to&&n.to>=r.to-10){let s=e.state.sliceDoc(n.from,n.to),l=on(e)||e.state.doc.lineAt(r.head),h=r.to-n.to,c=r.to-r.from;i=t.changeByRange((i=>{if(i.from==r.from&&i.to==r.to)return{changes:o,range:a||i.map(o)};let u=i.to-h,d=u-s.length;if(i.to-i.from!=c||e.state.sliceDoc(d,u)!=s||l&&i.to>=l.from&&i.from<=l.to)return{range:i};let f=t.changes({from:d,to:u,insert:n.insert}),p=i.to-r.to;return{changes:f,range:a?A.range(Math.max(0,a.anchor+p),Math.max(0,a.head+p)):i.map(f)}}))}else i={changes:o,selection:a&&t.selection.replaceRange(a)}}let a="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,a+=".compose",e.inputState.compositionFirstChange&&(a+=".start",e.inputState.compositionFirstChange=!1)),e.dispatch(i,{scrollIntoView:!0,userEvent:a}),!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 _s={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Xs=De.ie&&De.ie_version<=11;class Zs{constructor(t){this.view=t,this.active=!1,this.selectionRange=new fe,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);(De.ie&&De.ie_version<=11||De.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()})),Xs&&(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")))}),{}),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($i)?i.root.activeElement!=this.dom:!se(i.dom,n))return;let s=n.anchorNode&&i.docView.nearest(n.anchorNode);s&&s.ignoreEvent(t)?e||(this.selectionChanged=!1):(De.ie&&De.ie_version<=11||De.android&&De.chrome)&&!i.state.selection.main.empty&&n.focusNode&&oe(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=De.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,a=t.docView.domAtPos(t.state.selection.main.anchor);oe(a.node,a.offset,r,o)&&([n,s,r,o]=[r,o,n,s]);return{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:o}}(this.view)||ie(t.root);if(!e||this.selectionRange.eq(e))return!1;let i=se(this.dom,e);return i&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let t=this.delayedAndroidKey;t&&(this.clearDelayedAndroidKey(),!this.flush()&&t.force&&be(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&&se(this.dom,this.selectionRange);return t<0&&!n?null:(t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new Ps(this.view,t,e,i))}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=Cs(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.dirty|=4),"childList"==t.type){let i=As(e,t.previousSibling||t.target.previousSibling,-1),n=As(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 As(t,e,i){for(;e;){let n=Se.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 Ts{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),this._dispatch=t.dispatch||(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 us(t.state||xt.create(t)),this.plugins=this.state.facet(Ci).map((t=>new Xi(t)));for(let t of this.plugins)t.update(this);this.observer=new Zs(this),this.inputState=new yn(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new sn(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),t.parent&&t.parent.appendChild(this.dom)}get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}dispatch(...t){this._dispatch(1==t.length&&t[0]instanceof dt?t[0]:this.state.update(...t))}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,a=null;t.some((t=>t.annotation(zn)))?(this.inputState.notifiedFocused=r,o=1):r!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=r,a=In(s,r),a||(o=1));let l=this.observer.delayedAndroidKey,h=null;if(l?(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(xt.phrases)!=this.state.facet(xt.phrases))return this.setState(s);e=Di.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 xi(t.empty?t:A.cursor(t.head,t.head>t.anchor?-1:1))}for(let t of e.effects)t.is(ki)&&(c=t.value)}this.viewState.update(e,c),this.bidiCache=Vs.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),i=this.docView.update(e),this.state.facet(Vi)!=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(ws)!=e.state.facet(ws)&&(this.viewState.mustMeasureContent=!0),(i||n||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!e.empty)for(let t of this.state.facet(bi))t(e);(a||h)&&Promise.resolve().then((()=>{a&&this.state==a.startState&&this.dispatch(a),h&&!Cs(this,h)&&l.force&&be(this.contentDOM,l.key,l.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 us(t),this.plugins=t.facet(Ci).map((t=>new Xi(t))),this.pluginMap.clear();for(let t of this.plugins)t.update(this);this.docView=new sn(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(Ci),i=t.state.facet(Ci);if(e!=i){let n=[];for(let s of i){let i=e.indexOf(s);if(i<0)n.push(new Xi(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.measureScheduled=0,t&&this.observer.forceFlush();let e=null,{scrollHeight:i,scrollTop:n,clientHeight:s}=this.scrollDOM,r=n>i-s-4?i:n;try{for(let t=0;;t++){this.updateState=1;let i=this.viewport,n=this.viewState.lineBlockAtHeight(r),s=this.viewState.measure(this);if(!s&&!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 o=[];4&s||([this.measureRequests,o]=[o,this.measureRequests]);let a=o.map((t=>{try{return t.read(this)}catch(t){return Qi(this.state,t),Es}})),l=Di.create(this,this.state,[]),h=!1,c=!1;l.flags|=s,e?e.flags|=s:e=l,this.updateState=2,l.empty||(this.updatePlugins(l),this.inputState.update(l),this.updateAttrs(),h=this.docView.update(l));for(let t=0;t1||t<-1)&&(this.scrollDOM.scrollTop+=t,c=!0)}if(h&&this.docView.updateSelection(!0),this.viewport.from==i.from&&this.viewport.to==i.to&&!c&&0==this.measureRequests.length)break}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let t of this.state.facet(bi))t(e)}get themeClasses(){return ys+" "+(this.state.facet(vs)?xs:Ss)+" "+this.state.facet(ws)}updateAttrs(){let t=Ms(this,Zi,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet($i)?"true":"false",class:"cm-content",style:`${De.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Ms(this,Ai,e);let i=this.observer.ignore((()=>{let i=ti(this.contentDOM,this.contentAttrs,e),n=ti(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)if(t.is(Ts.announce)){e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(Vi),It.mount(this.root,this.styleModules.concat($s).reverse())}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}}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 vn(this,t,wn(this,t,e,i))}moveByCharSelected(t,e,i){return vn(this,t,wn(this,t,e,i),!0)}moveByGroup(t,e){return vn(this,t,wn(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==wt.Space&&(s=e),s==e}}(this,t.head,e))))}moveToLineBoundary(t,e,i=!0){return function(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=n&&t.lineWrapping?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==Wi.LTR)?e.right-1:e.left+1,y:(r.top+r.bottom)/2});if(null!=o)return A.cursor(o,i?-1:1)}let o=hi.find(t.docView,e.head),a=o?i?o.posAtEnd:o.posAtStart:i?s.to:s.from;return A.cursor(a,i?-1:1)}(this,t,e,i)}moveVertically(t,e,i){return vn(this,t,function(t,e,i,n){let s=e.head,r=i?1:-1;if(s==(i?t.state.doc.length:0))return A.cursor(s,e.assoc);let o,a=e.goalColumn,l=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s),c=t.documentTop;if(h)null==a&&(a=h.left-l.left),o=r<0?h.top:h.bottom;else{let e=t.viewState.lineBlockAt(s);null==a&&(a=Math.min(l.right-l.left,t.defaultCharacterWidth*(s-e.from))),o=(r<0?e.top:e.bottom)+c}let u=l.left+a,d=null!=n?n:t.defaultLineHeight>>1;for(let i=0;;i+=10){let n=o+(d+i)*r,h=mn(t,{x:u,y:n},!1,r);if(nl.bottom||(r<0?hs))return A.cursor(h,e.assoc,void 0,a)}}(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(),mn(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 ue(i,s[Ni.find(s,t-n.from,-1,e)].dir==Wi.LTR==e>0)}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(yi)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Rs)return Fi(t.length);let e=this.textDirectionAt(t.from);for(let i of this.bidiCache)if(i.from==t.from&&i.dir==e)return i.order;let i=function(t,e){let i=t.length,n=e==Ui?1:2,s=e==Ui?2:1;if(!t||1==n&&!ji.test(t))return Fi(i);for(let e=0,s=n,o=n;e=0;t-=3)if(Bi[t+1]==-r){let e=Bi[t+2],i=2&e?n:4&e?1&e?s:n:0;i&&(Gi[a]=Gi[Bi[t]]=i),l=t;break}}else{if(189==Bi.length)break;Bi[l++]=a,Bi[l++]=e,Bi[l++]=h}else if(2==(o=Gi[a])||1==o){let t=o==n;h=t?0:1;for(let e=l-3;e>=0;e-=3){let i=Bi[e+2];if(2&i)break;if(t)Bi[e+2]|=2;else{if(4&i)break;Bi[e+2]|=4}}}for(let t=0;te;){let t=i,n=2!=Gi[--i];for(;i>e&&n==(2!=Gi[i-1]);)i--;o.push(new Ni(i,t,n?2:1))}else o.push(new Ni(e,t,0))}else for(let t=0;tDate.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{ge(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 ki.of(new xi("number"==typeof t?A.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}static domEventHandlers(t){return _i.define((()=>({})),{eventHandlers:t})}static theme(t,e){let i=It.newName(),n=[ws.of(i),Vi.of(Qs(`.${i}`,t))];return e&&e.dark&&n.push(vs.of(!0)),n}static baseTheme(t){return N.lowest(Vi.of(Qs("."+ys,t,ks)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),n=i&&Se.get(i)||Se.get(t);return(null===(e=null==n?void 0:n.rootView)||void 0===e?void 0:e.view)||null}}Ts.styleModule=Vi,Ts.inputHandler=wi,Ts.focusChangeEffect=vi,Ts.perLineTextDirection=yi,Ts.exceptionSink=mi,Ts.updateListener=bi,Ts.editable=$i,Ts.mouseSelectionStyle=gi,Ts.dragMovesSelection=Oi,Ts.clickAddsSelectionRange=pi,Ts.decorations=Ti,Ts.atomicRanges=Ri,Ts.scrollMargins=Ei,Ts.darkTheme=vs,Ts.contentAttributes=Ai,Ts.editorAttributes=Zi,Ts.lineWrapping=Ts.contentAttributes.of({class:"cm-lineWrapping"}),Ts.announce=ut.define();const Rs=4096,Es={};class Vs{constructor(t,e,i,n){this.from=t,this.to=e,this.dir=i,this.order=n}static update(t,e){if(e.empty)return t;let i=[],n=t.length?t[t.length-1].dir:Wi.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&&Je(r,i)}return i}const Ds=De.mac?"mac":De.windows?"win":De.linux?"linux":"key";function Ws(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 Us=N.default(Ts.domEventHandlers({keydown:(t,e)=>Bs(Ls(e.state),t,e,"editor")})),Ys=E.define({enables:Us}),qs=new WeakMap;function Ls(t){let e=t.facet(Ys),i=qs.get(e);return i||qs.set(e,i=function(t,e=Ds){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)=>{var a,l;let h=i[t]||(i[t]=Object.create(null)),c=n.split(/ (?!$)/).map((t=>function(t,e){const i=t.split(/-(?!$)/);let n,s,r,o,a=i[i.length-1];"Space"==a&&(a=" ");for(let t=0;t{let n=zs={view:e,prefix:i,scope:t};return setTimeout((()=>{zs==n&&(zs=null)}),Is),!0}]})}let u=c.join(" ");s(u,!1);let d=h[u]||(h[u]={preventDefault:!1,run:(null===(l=null===(a=h._any)||void 0===a?void 0:a.run)||void 0===l?void 0:l.slice())||[]});r&&d.run.push(r),o&&(d.preventDefault=!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,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.shift&&r(e,"Shift-"+s,n.shift,n.preventDefault)}return i}(e.reduce(((t,e)=>t.concat(e)),[]))),i}let zs=null;const Is=4e3;function Bs(t,e,i,n){let s=function(t){var e=!(Kt&&(t.ctrlKey||t.altKey||t.metaKey)||Jt&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?Gt:Nt)[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=v(b(s,0))==s.length&&" "!=s,o="",a=!1;zs&&zs.view==i&&zs.scope==n&&(o=zs.prefix+" ",(a=kn.indexOf(e.keyCode)<0)&&(zs=null));let l,h,c=new Set,u=t=>{if(t){for(let n of t.run)if(!c.has(n)&&(c.add(n),n(i,e)))return!0;t.preventDefault&&(a=!0)}return!1},d=t[n];if(d){if(u(d[o+Ws(s,e,!r)]))return!0;if(r&&(e.altKey||e.metaKey||e.ctrlKey)&&!(De.windows&&e.ctrlKey&&e.altKey)&&(l=Nt[e.keyCode])&&l!=s){if(u(d[o+Ws(l,e,!0)]))return!0;if(e.shiftKey&&(h=Gt[e.keyCode])!=s&&h!=l&&u(d[o+Ws(h,e,!1)]))return!0}else if(r&&e.shiftKey&&u(d[o+Ws(s,e,!0)]))return!0;if(u(d._any))return!0}return a}class js{constructor(t,e,i,n,s){this.className=t,this.left=e,this.top=i,this.width=n,this.height=s}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className==this.className&&(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",null!=this.width&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,i){if(i.empty){let n=t.coordsAtPos(i.head,i.assoc||1);if(!n)return[];let s=Ns(t);return[new js(e,n.left-s.left,n.top-s.top,null,n.bottom-n.top)]}return function(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];let n=Math.max(i.from,t.viewport.from),s=Math.min(i.to,t.viewport.to),r=t.textDirection==Wi.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=Ns(t),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),u=a.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),d=a.right-(c?parseInt(c.paddingRight):0),f=Fs(t,n),p=Fs(t,s),O=f.type==ii.Text?f:null,g=p.type==ii.Text?p:null;t.lineWrapping&&(O&&(O=Gs(t,n,O)),g&&(g=Gs(t,s,g)));if(O&&g&&O.from==g.from)return b(w(i.from,i.to,O));{let e=O?w(i.from,null,O):v(f,!1),n=g?w(null,i.to,g):v(p,!0),s=[];return(O||f).to<(g||p).from-1?s.push(m(u,e.bottom,d,n.top)):e.bottomh&&n.from=r)break;a>s&&l(Math.max(t,s),null==e&&t<=h,Math.min(a,r),null==i&&a>=c,o.dir)}if(s=n.to+1,s>=r)break}return 0==a.length&&l(h,null==e,c,null==i,t.textDirection),{top:s,bottom:o,horizontal:a}}function v(t,e){let i=a.top+(e?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]}}}(t,e,i)}}function Ns(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Wi.LTR?e.left:e.right-t.scrollDOM.clientWidth)-t.scrollDOM.scrollLeft,top:e.top-t.scrollDOM.scrollTop}}function Gs(t,e,i){let n=A.cursor(e);return{from:Math.max(i.from,t.moveToLineBoundary(n,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(n,!0,!0).from),type:ii.Text}}function Fs(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==ii.Text))return t;return i}class Hs{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),e.above&&this.dom.classList.add("cm-layer-above"),e.class&&this.dom.classList.add(e.class),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(Js)!=t.state.facet(Js)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&t.view.requestMeasure(this.measureReq)}setOrder(t){let e=0,i=t.facet(Js);for(;e{return i=t,n=this.drawn[e],!(i.constructor==n.constructor&&i.eq(n));var i,n}))){let e=this.dom.firstChild,i=0;for(let n of t)n.update&&e&&n.constructor&&this.drawn[i].constructor&&n.update(e,this.drawn[i])?(e=e.nextSibling,i++):this.dom.insertBefore(n.draw(),e);for(;e;){let t=e.nextSibling;e.remove(),e=t}this.drawn=t}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Js=E.define();function Ks(t){return[_i.define((e=>new Hs(e,t))),Js.of(t)]}const tr=!De.ios,er=E.define({combine:t=>kt(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})});function ir(t={}){return[er.of(t),sr,or,lr,Si.of(!0)]}function nr(t){return t.startState.facet(er)!=t.state.facet(er)}const sr=Ks({above:!0,markers(t){let{state:e}=t,i=e.facet(er),n=[];for(let s of e.selection.ranges){let r=s==e.selection.main;if(s.empty?!r||tr:i.drawRangeCursor){let e=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",i=s.empty?s:A.cursor(s.head,s.head>s.anchor?-1:1);for(let s of js.forRange(t,e,i))n.push(s)}}return n},update(t,e){t.transactions.some((t=>t.selection))&&(e.style.animationName="cm-blink"==e.style.animationName?"cm-blink2":"cm-blink");let i=nr(t);return i&&rr(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){rr(e.state,t)},class:"cm-cursorLayer"});function rr(t,e){e.style.animationDuration=t.facet(er).cursorBlinkRate+"ms"}const or=Ks({above:!1,markers:t=>t.state.selection.ranges.map((e=>e.empty?[]:js.forRange(t,"cm-selectionBackground",e))).reduce(((t,e)=>t.concat(e))),update:(t,e)=>t.docChanged||t.selectionSet||t.viewportChanged||nr(t),class:"cm-selectionLayer"}),ar={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};tr&&(ar[".cm-line"].caretColor="transparent !important");const lr=N.highest(Ts.theme(ar)),hr=ut.define({map:(t,e)=>null==t?null:e.mapPos(t)}),cr=q.define({create:()=>null,update:(t,e)=>(null!=t&&(t=e.changes.mapPos(t)),e.effects.reduce(((t,e)=>e.is(hr)?e.value:t),t))}),ur=_i.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let i=t.state.field(cr);null==i?null!=this.cursor&&(null===(e=this.cursor)||void 0===e||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(cr)!=i||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let t=this.view.state.field(cr),e=null!=t&&this.view.coordsAtPos(t);if(!e)return null;let i=this.view.scrollDOM.getBoundingClientRect();return{left:e.left-i.left+this.view.scrollDOM.scrollLeft,top:e.top-i.top+this.view.scrollDOM.scrollTop,height:e.bottom-e.top}}drawCursor(t){this.cursor&&(t?(this.cursor.style.left=t.left+"px",this.cursor.style.top=t.top+"px",this.cursor.style.height=t.height+"px"):this.cursor.style.left="-100000px")}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(cr)!=t&&this.view.dispatch({effects:hr.of(t)})}},{eventHandlers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){t.target!=this.view.contentDOM&&this.view.contentDOM.contains(t.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function dr(){return[cr,ur]}function fr(t,e,i,n,s){e.lastIndex=0;for(let r,o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)if(!o.lineBreak)for(;r=e.exec(o.value);)s(a+r.index,r)}class pr{constructor(t){const{regexp:e,decoration:i,decorate:n,boundary:s,maxLength:r=1e3}=t;if(!e.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=e,n)this.addMatch=(t,e,i,s)=>n(s,i,i+t[0].length,t,e);else if("function"==typeof i)this.addMatch=(t,e,n,s)=>{let r=i(t,e,n);r&&s(n,n+t[0].length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(t,e,n,s)=>s(n,n+t[0].length,i)}this.boundary=s,this.maxLength=r}createDeco(t){let e=new Xt,i=e.add.bind(e);for(let{from:e,to:n}of function(t,e){let i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;let n=[];for(let{from:s,to:r}of i)s=Math.max(t.state.doc.lineAt(s).from,s-e),r=Math.min(t.state.doc.lineAt(r).to,r+e),n.length&&n[n.length-1].to>=s?n[n.length-1].to=r:n.push({from:s,to:r});return n}(t,this.maxLength))fr(t.state.doc,this.regexp,e,n,((e,n)=>this.addMatch(n,t,e,i)));return e.finish()}updateDeco(t,e){let i=1e9,n=-1;return t.docChanged&&t.changes.iterChanges(((e,s,r,o)=>{o>t.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e}updateRange(t,e,i,n){for(let s of t.visibleRanges){let r=Math.max(s.from,i),o=Math.min(s.to,n);if(o>r){let i=t.state.doc.lineAt(r),n=i.toi.from;r--)if(this.boundary.test(i.text[r-1-i.from])){a=r;break}for(;oc.push(i.range(t,e));if(i==n)for(this.regexp.lastIndex=a-i.from;(h=this.regexp.exec(i.text))&&h.indexthis.addMatch(i,t,e,u)));e=e.update({filterFrom:a,filterTo:l,filter:(t,e)=>tl,add:c})}}return e}}const Or=null!=/x/.unicode?"gu":"g",gr=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",Or),mr={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let br=null;const wr=E.define({combine(t){let e=kt(t,{render:null,specialChars:gr,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==br&&"undefined"!=typeof document&&document.body){let e=document.body.style;br=null!=(null!==(t=e.tabSize)&&void 0!==t?t:e.MozTabSize)}return br||!1}())&&(e.specialChars=new RegExp("\t|"+e.specialChars.source,Or)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Or)),e}});function vr(t={}){return[wr.of(t),yr||(yr=_i.fromClass(class{constructor(t){this.view=t,this.decorations=ni.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(wr)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new pr({regexp:t.specialChars,decoration:(e,i,n)=>{let{doc:s}=i.state,r=b(e[0],0);if(9==r){let t=s.lineAt(n),e=i.state.tabSize,r=Yt(t.text,e,n-t.from);return ni.replace({widget:new xr((e-r%e)*this.view.defaultCharacterWidth)})}return this.decorationCache[r]||(this.decorationCache[r]=ni.replace({widget:new Sr(t,r)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(wr);t.startState.facet(wr)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))]}let yr=null;class Sr extends ei{constructor(t,e){super(),this.options=t,this.code=e}eq(t){return t.code==this.code}toDOM(t){let e=function(t){return t>=32?"•":10==t?"␤":String.fromCharCode(9216+t)}(this.code),i=t.state.phrase("Control character")+" "+(mr[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,i,e);if(n)return n;let s=document.createElement("span");return s.textContent=e,s.title=i,s.setAttribute("aria-label",i),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class xr extends ei{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent="\t",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}class kr extends ei{constructor(t){super(),this.content=t}toDOM(){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):this.content),"string"==typeof this.content?t.setAttribute("aria-label","placeholder "+this.content):t.setAttribute("aria-hidden","true"),t}ignoreEvent(){return!1}}const Qr="-10000px";class $r{constructor(t,e,i){this.facet=e,this.createTooltipView=i,this.input=t.state.facet(e),this.tooltips=this.input.filter((t=>t)),this.tooltipViews=this.tooltips.map(i)}update(t){var e;let i=t.state.facet(this.facet),n=i.filter((t=>t));if(i===this.input){for(let e of this.tooltipViews)e.update&&e.update(t);return!1}let s=[];for(let e=0;e{var e,i,n;return{position:De.ios?"absolute":(null===(e=t.find((t=>t.position)))||void 0===e?void 0:e.position)||"fixed",parent:(null===(i=t.find((t=>t.parent)))||void 0===i?void 0:i.parent)||null,tooltipSpace:(null===(n=t.find((t=>t.tooltipSpace)))||void 0===n?void 0:n.tooltipSpace)||Pr}}}),_r=new WeakMap,Xr=_i.fromClass(class{constructor(t){this.view=t,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(Cr);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new $r(t,Tr,(t=>this.createTooltip(t))),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout((()=>{this.measureTimeout=-1,this.maybeMeasure()}),50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t);e&&this.observeIntersection();let i=e||t.geometryChanged,n=t.state.facet(Cr);if(n.position!=this.position){this.position=n.position;for(let t of this.manager.tooltipViews)t.dom.style.position=this.position;i=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let t of this.manager.tooltipViews)this.container.appendChild(t.dom);i=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure()}createTooltip(t){let e=t.create(this.view);if(e.dom.classList.add("cm-tooltip"),t.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",e.dom.appendChild(t)}return e.dom.style.position=this.position,e.dom.style.top=Qr,this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var t,e;this.view.win.removeEventListener("resize",this.measureSoon);for(let e of this.manager.tooltipViews)e.dom.remove(),null===(t=e.destroy)||void 0===t||t.call(e);null===(e=this.intersectionObserver)||void 0===e||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=this.view.dom.getBoundingClientRect();return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map(((t,e)=>{let i=this.manager.tooltipViews[e];return i.getCoords?i.getCoords(t.pos):this.view.coordsAtPos(t.pos)})),size:this.manager.tooltipViews.map((({dom:t})=>t.getBoundingClientRect())),space:this.view.state.facet(Cr).tooltipSpace(this.view)}}writeMeasure(t){var e;let{editor:i,space:n}=t,s=[];for(let r=0;r=Math.min(i.bottom,n.bottom)||h.rightMath.min(i.right,n.right)+.1){l.style.top=Qr;continue}let u=o.arrow?a.dom.querySelector(".cm-tooltip-arrow"):null,d=u?7:0,f=c.right-c.left,p=null!==(e=_r.get(a))&&void 0!==e?e:c.bottom-c.top,O=a.offset||Ar,g=this.view.textDirection==Wi.LTR,m=c.width>n.right-n.left?g?n.left:n.right-c.width:g?Math.min(h.left-(u?14:0)+O.x,n.right-f):Math.max(n.left,h.left-f+(u?14:0)-O.x),b=!!o.above;!o.strictSide&&(b?h.top-(c.bottom-c.top)-O.yn.bottom)&&b==n.bottom-h.bottom>h.top-n.top&&(b=!b);let w=(b?h.top-n.top:n.bottom-h.bottom)-d;if(wm&&t.topv&&(v=b?t.top-p-2-d:t.bottom+d+2);"absolute"==this.position?(l.style.top=v-t.parent.top+"px",l.style.left=m-t.parent.left+"px"):(l.style.top=v+"px",l.style.left=m+"px"),u&&(u.style.left=h.left+(g?O.x:-O.x)-(m+14-7)+"px"),!0!==a.overlap&&s.push({left:m,top:v,right:y,bottom:v+p}),l.classList.toggle("cm-tooltip-above",b),l.classList.toggle("cm-tooltip-below",!b),a.positioned&&a.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=Qr}},{eventHandlers:{scroll(){this.maybeMeasure()}}}),Zr=Ts.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Ar={x:0,y:0},Tr=E.define({enables:[Xr,Zr]});function Rr(t,e){let i=t.plugin(Xr);if(!i)return null;let n=i.manager.tooltips.indexOf(e);return n<0?null:i.manager.tooltipViews[n]}const Er=E.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 Vr(t,e){let i=t.plugin(Mr),n=i?i.specs.indexOf(e):-1;return n>-1?i.panels[n]:null}const Mr=_i.fromClass(class{constructor(t){this.input=t.state.facet(Ur),this.specs=this.input.filter((t=>t)),this.panels=this.specs.map((e=>e(t)));let e=t.state.facet(Er);this.top=new Dr(t,!0,e.topContainer),this.bottom=new Dr(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(Er);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Dr(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Dr(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(Ur);if(i!=this.input){let e=i.filter((t=>t)),n=[],s=[],r=[],o=[];for(let i of e){let e,a=this.specs.indexOf(i);a<0?(e=i(t.view),o.push(e)):(e=this.panels[a],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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}}))});class Dr{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=Wr(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=Wr(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 Wr(t){let e=t.nextSibling;return t.remove(),e}const Ur=E.define({enables:Mr});class Yr extends Qt{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Yr.prototype.elementClass="",Yr.prototype.toDOM=void 0,Yr.prototype.mapMode=S.TrackBefore,Yr.prototype.startSide=Yr.prototype.endSide=-1,Yr.prototype.point=!0;const qr=E.define(),Lr={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>_t.empty,lineMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},zr=E.define();function Ir(t){return[jr(),zr.of(Object.assign(Object.assign({},Lr),t))]}const Br=E.define({combine:t=>t.some((t=>t))});function jr(t){let e=[Nr];return t&&!1===t.fixed&&e.push(Br.of(!0)),e}const Nr=_i.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+"px",this.gutters=t.state.facet(zr).map((e=>new Jr(t,e)));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!t.state.facet(Br),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(Br)!=!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=_t.iter(this.view.state.facet(qr),this.view.viewport.from),n=[],s=this.gutters.map((t=>new Hr(t,this.view.viewport,-this.view.documentPadding.top)));for(let t of this.view.viewportLineBlocks){let e;if(Array.isArray(t.type)){for(let i of t.type)if(i.type==ii.Text){e=i;break}}else e=t.type==ii.Text?t:void 0;if(e){n.length&&(n=[]),Fr(i,n,t.from);for(let t of s)t.line(this.view,e,n)}}for(let t of s)t.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(zr),i=t.state.facet(zr),n=t.docChanged||t.heightChanged||t.viewportChanged||!_t.eq(t.startState.facet(qr),t.state.facet(qr),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 Jr(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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&0!=i.gutters.length&&i.fixed?e.textDirection==Wi.LTR?{left:i.dom.offsetWidth}:{right:i.dom.offsetWidth}:null}))});function Gr(t){return Array.isArray(t)?t:[t]}function Fr(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class Hr{constructor(t,e,i){this.gutter=t,this.height=i,this.i=0,this.cursor=_t.iter(t.markers,e.from)}line(t,e,i){let n=[];Fr(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;if(0==n.length&&!r.config.renderEmptyElements)return;let o=e.top-this.height;if(this.i==r.elements.length){let i=new Kr(t,e.height,o,n);r.elements.push(i),r.dom.appendChild(i.dom)}else r.elements[this.i].update(t,e.height,o,n);this.height=e.bottom,this.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 Jr{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=Gr(e.markers(t)),e.initialSpacer&&(this.spacer=new Kr(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=Gr(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!_t.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 Kr{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.dom.style.height=(this.height=e)+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),function(t,e){if(t.length!=e.length)return!1;for(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 io extends Yr{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function no(t,e){return t.state.facet(eo).formatNumber(e,t.state)}const so=zr.compute([eo],(t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:t=>t.state.facet(to),lineMarker:(t,e,i)=>i.some((t=>t.toDOM))?null:new io(no(t,t.state.doc.lineAt(e.from).number)),lineMarkerChange:t=>t.startState.facet(eo)!=t.state.facet(eo),initialSpacer:t=>new io(no(t,ro(t.state.doc.lines))),updateSpacer(t,e){let i=no(e.view,ro(e.view.state.doc.lines));return i==t.number?t:new io(i)},domEventHandlers:t.facet(eo).domEventHandlers})));function ro(t){let e=9;for(;e{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=fo.match(t)),e=>{let i=t(e);return void 0===i?null:[this,i]}}}ho.closedBy=new ho({deserialize:t=>t.split(" ")}),ho.openedBy=new ho({deserialize:t=>t.split(" ")}),ho.group=new ho({deserialize:t=>t.split(" ")}),ho.contextHash=new ho({perNode:!0}),ho.lookAhead=new ho({perNode:!0}),ho.mounted=new ho({perNode:!0});class co{constructor(t,e,i){this.tree=t,this.overlay=e,this.parser=i}}const uo=Object.create(null);class fo{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):uo,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),n=new fo(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(ho.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(ho.group),n=-1;n<(i?i.length:0);n++){let s=e[n<0?t.name:i[n]];if(s)return s}}}}fo.none=new fo("",Object.create(null),0,8);class po{constructor(t){this.types=t;for(let e=0;e=n&&(r.type.isAnonymous||!1!==e(r))){if(r.firstChild())continue;t=!0}for(;t&&i&&!r.type.isAnonymous&&i(r),!r.nextSibling();){if(!r.parent())return;t=!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:To(fo.none,this.children,this.positions,0,this.children.length,0,this.length,((t,e,i)=>new bo(this.type,t,e,i,this.propValues)),t.makeTree||((t,e,i)=>new bo(fo.none,t,e,i)))}static build(t){return function(t){var e;let{buffer:i,nodeSet:n,maxBufferLength:s=oo,reused:r=[],minRepeatType:o=n.types.length}=t,a=Array.isArray(i)?new wo(i,i.length):i,l=n.types,h=0,c=0;function u(t,e,i,m,b){let{id:w,start:v,end:y,size:S}=a,x=c;for(;S<0;){if(a.next(),-1==S){let e=r[w];return i.push(e),void m.push(v-t)}if(-3==S)return void(h=w);if(-4==S)return void(c=w);throw new RangeError(`Unrecognized record size: ${S}`)}let k,Q,$=l[w],P=v-t;if(y-v<=s&&(Q=O(a.pos-e,b))){let e=new Uint16Array(Q.size-Q.skip),i=a.pos-Q.size,s=e.length;for(;a.pos>i;)s=g(Q.start,e,s);k=new vo(e,y-Q.start,n),P=Q.start-t}else{let t=a.pos-S;a.next();let e=[],i=[],n=w>=o?w:-1,r=0,l=y;for(;a.pos>t;)n>=0&&a.id==n&&a.size>=0?(a.end<=l-s&&(f(e,i,v,r,a.end,l,n,x),r=e.length,l=a.end),a.next()):u(v,t,e,i,n);if(n>=0&&r>0&&r-1&&r>0){let t=d($);k=To($,e,i,0,e.length,0,y-v,t,t)}else k=p($,e,i,y-v,x-y)}i.push(k),m.push(P)}function d(t){return(e,i,n)=>{let s,r,o=0,a=e.length-1;if(a>=0&&(s=e[a])instanceof bo){if(!a&&s.type==t&&s.length==n)return s;(r=s.prop(ho.lookAhead))&&(o=i[a]+s.length+r)}return p(t,e,i,n,o)}}function f(t,e,i,s,r,o,a,l){let h=[],c=[];for(;t.length>s;)h.push(t.pop()),c.push(e.pop()+i-r);t.push(p(n.types[a],h,c,o-r,l-o)),e.push(r-i)}function p(t,e,i,n,s=0,r){if(h){let t=[ho.contextHash,h];r=r?[t].concat(r):[t]}if(s>25){let t=[ho.lookAhead,s];r=r?[t].concat(r):[t]}return new bo(t,e,i,n,r)}function O(t,e){let i=a.fork(),n=0,r=0,l=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=l,l+=4,n+=4,i.next();continue}let a=i.pos-t;if(t<0||a=o?4:0,d=i.start;for(i.next();i.pos>a;){if(i.size<0){if(-3!=i.size)break t;u+=4}else i.id>=o&&(u+=4);i.next()}r=d,n+=t,l+=u}return(e<0||n==t)&&(c.size=n,c.start=r,c.skip=l),c.size>4?c:void 0}function g(t,e,i){let{id:n,start:s,end:r,size:l}=a;if(a.next(),l>=0&&n4){let n=a.pos-(l-4);for(;a.pos>n;)i=g(t,e,i)}e[--i]=o,e[--i]=r-t,e[--i]=s-t,e[--i]=n}else-3==l?h=n:-4==l&&(c=n);return i}let m=[],b=[];for(;a.pos>0;)u(t.start||0,t.bufferStart||0,m,b,-1);let w=null!==(e=t.length)&&void 0!==e?e:m.length?b[0]+m[0].length:0;return new bo(l[t.topID],m.reverse(),b.reverse(),w)}(t)}}bo.empty=new bo(fo.none,[],[],0);class wo{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 wo(this.buffer,this.index)}}class vo{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return fo.none}toString(){let t=[];for(let e=0;e0));a=r[a+3]);return o}slice(t,e,i){let n=this.buffer,s=new Uint16Array(e-t),r=0;for(let o=t,a=0;o=e&&ie;case 1:return i<=e&&n>e;case 2:return n>e;case 4:return!0}}function So(t,e){let i=t.childBefore(e);for(;i;){let e=i.lastChild;if(!e||e.to!=i.to)break;e.type.isError&&e.from==e.to?(t=i,i=e.prevSibling):i=e}return t}function xo(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!=l;t+=e){let l=o[t],h=a[t]+r.from;if(yo(n,i,h,h+l.length))if(l instanceof vo){if(s&mo.ExcludeBuffers)continue;let o=l.findChild(0,l.buffer.length,e,i-h,n);if(o>-1)return new Co(new Po(r,l,t,h),null,o)}else if(s&mo.IncludeAnonymous||!l.type.isAnonymous||Xo(l)){let o;if(!(s&mo.IgnoreMounts)&&l.props&&(o=l.prop(ho.mounted))&&!o.overlay)return new ko(o.tree,h,t,r);let a=new ko(l,h,t,r);return s&mo.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(e<0?l.children.length-1:0,e,i,n)}}if(s&mo.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&mo.IgnoreOverlays)&&(n=this._tree.prop(ho.mounted))&&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 ko(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}cursor(t=0){return new _o(this,t)}get tree(){return this._tree}toTree(){return this._tree}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return So(this,t)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}toString(){return this._tree.toString()}get node(){return this}matchContext(t){return $o(this,t)}}function Qo(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 $o(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 Po{constructor(t,e,i,n){this.parent=t,this.buffer=e,this.index=i,this.start=n}}class Co{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){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 Co(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&mo.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 Co(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 Co(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 Co(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}cursor(t=0){return new _o(this,t)}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 bo(this.type,t,e,this.to-this.from)}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return So(this,t)}toString(){return this.context.buffer.childString(this.index)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}get node(){return this}matchContext(t){return $o(this,t)}}class _o{get name(){return this.type.name}constructor(t,e=0){if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof ko)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let e=t._parent;e;e=e._parent)this.stack.unshift(e.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return!!t&&(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0)}yieldBuf(t,e){this.index=t;let{start:i,buffer:n}=this.buffer;return this.type=e||n.set.types[n.buffer[t]],this.from=i+n.buffer[t+1],this.to=i+n.buffer[t+2],!0}yield(t){return!!t&&(t instanceof ko?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,i){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,i,this.mode));let{buffer:n}=this.buffer,s=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.buffer.start,i);return!(s<0)&&(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,i=this.mode){return this.buffer?!(i&mo.ExcludeBuffers)&&this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&mo.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&mo.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode));let{buffer:e}=this.buffer,i=this.stack.length-1;if(t<0){let t=i<0?0:this.stack[i]+4;if(this.index!=t)return this.yieldBuf(e.findChild(t,this.index,-1,0,4))}else{let t=e.buffer[this.index+3];if(t<(i<0?e.buffer.length:e.buffer[this.stack[i]+3]))return this.yieldBuf(t)}return i<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,i,{buffer:n}=this;if(n){if(t>0){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&mo.IncludeAnonymous||t instanceof vo||!t.type.isAnonymous||Xo(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 $o(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 Xo(t){return t.children.some((t=>t instanceof vo||!t.type.isAnonymous||Xo(t)))}const Zo=new WeakMap;function Ao(t,e){if(!t.isAnonymous||e instanceof vo||e.type!=t)return 1;let i=Zo.get(e);if(null==i){i=1;for(let n of e.children){if(n.type!=t||!(n instanceof bo)){i=1;break}i+=Ao(t,n)}Zo.set(e,i)}return i}function To(t,e,i,n,s,r,o,a,l){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]+a);continue}u.push(i[s])}else{let e=n[h-1]+i[h-1].length-f;u.push(To(t,i,n,s,h,f,e,null,l))}d.push(f+a-r)}}(e,i,n,s,0),(a||l)(u,d,o)}class Ro{constructor(){this.map=new WeakMap}setBuffer(t,e,i){let n=this.map.get(t);n||this.map.set(t,n=new Map),n.set(e,i)}getBuffer(t,e){let i=this.map.get(t);return i&&i.get(e)}set(t,e){t instanceof Co?this.setBuffer(t.context.buffer,t.index,e):t instanceof ko&&this.map.set(t.tree,e)}get(t){return t instanceof Co?this.getBuffer(t.context.buffer,t.index):t instanceof ko?this.map.get(t.tree):void 0}cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}}class Eo{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 Eo(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,a=0,l=0;;o++){let h=o=i)for(;r&&r.from=e.from||c<=e.to||l){let t=Math.max(e.from,a)-l,i=Math.min(e.to,c)-l;e=t>=i?null:new Eo(t,i,e.tree,e.offset+l,o>0,!!h)}if(e&&n.push(e),r.to>c)break;r=snew lo(t.from,t.to))):[new lo(0,0)]:[new lo(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 Mo{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)}}function Do(t){return(e,i,n,s)=>new qo(e,t,i,n,s)}class Wo{constructor(t,e,i,n,s){this.parser=t,this.parse=e,this.overlay=i,this.target=n,this.ranges=s}}class Uo{constructor(t,e,i,n,s,r,o){this.parser=t,this.predicate=e,this.mounts=i,this.index=n,this.start=s,this.target=r,this.prev=o,this.depth=0,this.ranges=[]}}const Yo=new ho({perNode:!0});class qo{constructor(t,e,i,n,s){this.nest=e,this.input=i,this.fragments=n,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=t}advance(){if(this.baseParse){let t=this.baseParse.advance();if(!t)return null;if(this.baseParse=null,this.baseTree=t,this.startInner(),null!=this.stoppedAt)for(let t of this.inner)t.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let t=this.baseTree;return null!=this.stoppedAt&&(t=new bo(t.type,t.children,t.positions,t.length,t.propValues.concat([[Yo,this.stoppedAt]]))),t}let t=this.inner[this.innerDone],e=t.parse.advance();if(e){this.innerDone++;let i=Object.assign(Object.create(null),t.target.props);i[ho.mounted.id]=new co(e,t.overlay,t.parser),t.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let t=this.input.length;for(let e=this.innerDone;et.frag.from<=n.from&&t.frag.to>=n.to&&t.mount.overlay));if(t)for(let i of t.mount.overlay){let s=i.from+t.pos,r=i.to+t.pos;s>=n.from&&r<=n.to&&!e.ranges.some((t=>t.froms))&&e.ranges.push({from:s,to:r})}}a=!1}else if(i&&(r=Lo(i.ranges,n.from,n.to)))a=2!=r;else if(!n.type.isAnonymous&&n.fromnew lo(t.from-n.from,t.to-n.from))):null,n.tree,t)),s.overlay?t.length&&(i={ranges:t,depth:0,prev:i}):a=!1}}else e&&(o=e.predicate(n))&&(!0===o&&(o=new lo(n.from,n.to)),o.fromnew lo(t.from-e.start,t.to-e.start))),e.target,t)),e=e.prev}i&&! --i.depth&&(i=i.prev)}}}}function Lo(t,e,i){for(let n of t){if(n.from>=i)break;if(n.to>e)return n.from<=e&&n.to>=i?2:1}return 0}function zo(t,e,i,n,s,r){if(e=e.to);n++);let o=s.children[n],a=o.buffer;s.children[n]=function t(i,n,s,l,h){let c=i;for(;a[c+2]+r<=e.from;)c=a[c+3];let u=[],d=[];zo(o,i,c,u,d,l);let f=a[c+1],p=a[c+2],O=f+r==e.from&&p+r==e.to&&a[c]==e.type.id;return u.push(O?e.toTree():t(c+4,a[c+3],o.set.types[a[c]],f,p-f)),d.push(f-l),zo(o,a[c+3],n,u,d,l),new bo(s,u,d,h)}(0,a.length,fo.none,0,o.length);for(let n=0;n<=i;n++)t.childAfter(e.from)}class Bo{constructor(t,e){this.offset=e,this.done=!1,this.cursor=t.cursor(mo.IncludeAnonymous|mo.IgnoreMounts)}moveTo(t){let{cursor:e}=this,i=t-this.offset;for(;!this.done&&e.from=t&&e.enter(i,1,mo.IgnoreOverlays|mo.ExcludeBuffers)||e.next(!1)||(this.done=!0)}hasNode(t){if(this.moveTo(t.from),!this.done&&this.cursor.from+this.offset==t.from&&this.cursor.tree)for(let e=this.cursor.tree;;){if(e==t.tree)return!0;if(!(e.children.length&&0==e.positions[0]&&e.children[0]instanceof bo))break;e=e.children[0]}return!1}}let jo=class{constructor(t){var e;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){let i=this.curFrag=t[0];this.curTo=null!==(e=i.tree.prop(Yo))&&void 0!==e?e:i.to,this.inner=new Bo(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t)}nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=null!==(t=e.tree.prop(Yo))&&void 0!==t?t:e.to,this.inner=new Bo(e.tree,-e.offset)}}findMounts(t,e){var i;let n=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let t=this.inner.cursor.node;t;t=t.parent){let s=null===(i=t.tree)||void 0===i?void 0:i.prop(ho.mounted);if(s&&s.parser==e)for(let e=this.fragI;e=t.to)break;i.tree==this.curFrag.tree&&n.push({frag:i,pos:t.from-i.offset,mount:s})}}}return n}};function No(t,e){let i=null,n=e;for(let s=1,r=0;s=a)break;t.to<=o||(i||(n=i=e.slice()),t.froma&&i.splice(r+1,0,new lo(a,t.to))):t.to>a?i[r--]=new lo(a,t.to):i.splice(r--,1))}}return n}function Go(t,e,i,n){let s=0,r=0,o=!1,a=!1,l=-1e9,h=[];for(;;){let c=s==t.length?1e9:o?t[s].to:t[s].from,u=r==e.length?1e9:a?e[r].to:e[r].from;if(o!=a){let t=Math.max(l,i),e=Math.min(c,u,n);tnew lo(t.from+n,t.to+n))),a,l);for(let e=0,n=a;;e++){let a=e==o.length,h=a?l:o[e].from;if(h>n&&i.push(new Eo(n,h,s.tree,-t,r.from>=n||r.openStart,r.to<=h||r.openEnd)),a)break;n=o[e].to}}else i.push(new Eo(a,l,s.tree,-t,r.from>=t||r.openStart,r.to<=o||r.openEnd))}return i}let Ho=0;class Jo{constructor(t,e,i){this.set=t,this.base=e,this.modified=i,this.id=Ho++}static define(t){if(null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let e=new Jo([],null,[]);if(e.set.push(e),t)for(let i of t.set)e.set.push(i);return e}static defineModifier(){let t=new ta;return e=>e.modified.indexOf(t)>-1?e:ta.get(e.base||e,e.modified.concat(t).sort(((t,e)=>t.id-e.id)))}}let Ko=0;class ta{constructor(){this.instances=[],this.id=Ko++}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 Jo(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(ta.get(e,t));return s}}function ea(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,a=i[o];if(!a)throw new RangeError("Invalid path: "+t);let l=new na(n,s,o>0?i.slice(0,o):null);e[a]=l.sort(e[a])}}return ia.add(e)}const ia=new ho;class na{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 ra(t,e,i,n=0,s=t.length){let r=new oa(n,Array.isArray(e)?e:[e],i);r.highlightRange(t.cursor(),n,s,"",r.highlighters),r.flush(s)}na.empty=new na([],2,null);class oa{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:a}=t;if(o>=i||a<=e)return;r.isTop&&(s=this.highlighters.filter((t=>!t.scope||t.scope(r))));let l=n,h=function(t){let e=t.type.prop(ia);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}(t)||na.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&&(l&&(l+=" "),l+=c,1==h.mode&&(n+=(n?" ":"")+c)),this.startSpan(t.from,l),h.opaque)return;let u=t.tree&&t.tree.prop(ho.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 d=0,f=o;;d++){let p=d=O)&&t.nextSibling()););if(!p||O>i)break;f=p.to+o,f>e&&(this.highlightRange(r.cursor(),Math.max(e,p.from+o),Math.min(i,f),n,h),this.startSpan(f,l))}c&&t.parent()}else if(t.firstChild()){do{if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,n,s),this.startSpan(Math.min(i,t.to),l)}}while(t.nextSibling());t.parent()}}}const aa=Jo.define,la=aa(),ha=aa(),ca=aa(ha),ua=aa(ha),da=aa(),fa=aa(da),pa=aa(da),Oa=aa(),ga=aa(Oa),ma=aa(),ba=aa(),wa=aa(),va=aa(wa),ya=aa(),Sa={comment:la,lineComment:aa(la),blockComment:aa(la),docComment:aa(la),name:ha,variableName:aa(ha),typeName:ca,tagName:aa(ca),propertyName:ua,attributeName:aa(ua),className:aa(ha),labelName:aa(ha),namespace:aa(ha),macroName:aa(ha),literal:da,string:fa,docString:aa(fa),character:aa(fa),attributeValue:aa(fa),number:pa,integer:aa(pa),float:aa(pa),bool:aa(da),regexp:aa(da),escape:aa(da),color:aa(da),url:aa(da),keyword:ma,self:aa(ma),null:aa(ma),atom:aa(ma),unit:aa(ma),modifier:aa(ma),operatorKeyword:aa(ma),controlKeyword:aa(ma),definitionKeyword:aa(ma),moduleKeyword:aa(ma),operator:ba,derefOperator:aa(ba),arithmeticOperator:aa(ba),logicOperator:aa(ba),bitwiseOperator:aa(ba),compareOperator:aa(ba),updateOperator:aa(ba),definitionOperator:aa(ba),typeOperator:aa(ba),controlOperator:aa(ba),punctuation:wa,separator:aa(wa),bracket:va,angleBracket:aa(va),squareBracket:aa(va),paren:aa(va),brace:aa(va),content:Oa,heading:ga,heading1:aa(ga),heading2:aa(ga),heading3:aa(ga),heading4:aa(ga),heading5:aa(ga),heading6:aa(ga),contentSeparator:aa(Oa),list:aa(Oa),quote:aa(Oa),emphasis:aa(Oa),strong:aa(Oa),link:aa(Oa),monospace:aa(Oa),strikethrough:aa(Oa),inserted:aa(),deleted:aa(),changed:aa(),invalid:aa(),meta:ya,documentMeta:aa(ya),annotation:aa(ya),processingInstruction:aa(ya),definition:Jo.defineModifier(),constant:Jo.defineModifier(),function:Jo.defineModifier(),standard:Jo.defineModifier(),local:Jo.defineModifier(),special:Jo.defineModifier()};var xa;sa([{tag:Sa.link,class:"tok-link"},{tag:Sa.heading,class:"tok-heading"},{tag:Sa.emphasis,class:"tok-emphasis"},{tag:Sa.strong,class:"tok-strong"},{tag:Sa.keyword,class:"tok-keyword"},{tag:Sa.atom,class:"tok-atom"},{tag:Sa.bool,class:"tok-bool"},{tag:Sa.url,class:"tok-url"},{tag:Sa.labelName,class:"tok-labelName"},{tag:Sa.inserted,class:"tok-inserted"},{tag:Sa.deleted,class:"tok-deleted"},{tag:Sa.literal,class:"tok-literal"},{tag:Sa.string,class:"tok-string"},{tag:Sa.number,class:"tok-number"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],class:"tok-string2"},{tag:Sa.variableName,class:"tok-variableName"},{tag:Sa.local(Sa.variableName),class:"tok-variableName tok-local"},{tag:Sa.definition(Sa.variableName),class:"tok-variableName tok-definition"},{tag:Sa.special(Sa.variableName),class:"tok-variableName2"},{tag:Sa.definition(Sa.propertyName),class:"tok-propertyName tok-definition"},{tag:Sa.typeName,class:"tok-typeName"},{tag:Sa.namespace,class:"tok-namespace"},{tag:Sa.className,class:"tok-className"},{tag:Sa.macroName,class:"tok-macroName"},{tag:Sa.propertyName,class:"tok-propertyName"},{tag:Sa.operator,class:"tok-operator"},{tag:Sa.comment,class:"tok-comment"},{tag:Sa.meta,class:"tok-meta"},{tag:Sa.invalid,class:"tok-invalid"},{tag:Sa.punctuation,class:"tok-punctuation"}]);const ka=new ho;function Qa(t){return E.define({combine:t?e=>e.concat(t):void 0})}const $a=new ho;class Pa{constructor(t,e,i=[],n=""){this.data=t,this.name=n,xt.prototype.hasOwnProperty("tree")||Object.defineProperty(xt.prototype,"tree",{get(){return Xa(this)}}),this.parser=e,this.extension=[Wa.of(this),xt.languageData.of(((t,e,i)=>{let n=Ca(t,e,i),s=n.type.prop(ka);if(!s)return[];let r=t.facet(s),o=n.type.prop($a);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 Ca(t,e,i).type.prop(ka)==this.data}findRegions(t){let e=t.facet(Wa);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(ka)==this.data)return void i.push({from:e,to:e+t.length});let s=t.prop(ho.mounted);if(s){if(s.tree.prop(ka)==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;it.isTop?e:void 0))]}),t.name)}configure(t,e){return new _a(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Xa(t){let e=t.field(Pa.state,!1);return e?e.tree:bo.empty}class Za{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let i=this.cursorPos-this.string.length;return t=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i)}}let Aa=null;class Ta{constructor(t,e,i=[],n,s,r,o,a){this.parser=t,this.state=e,this.fragments=i,this.tree=n,this.treeLen=s,this.viewport=r,this.skipped=o,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(t,e,i){return new Ta(t,e,[],bo.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Za(this.state.doc),this.fragments)}work(t,e){return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=bo.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(Eo.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Aa;Aa=this;try{return t()}finally{Aa=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=Ra(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=Eo.applyChanges(i,e),n=bo.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=Ra(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 Vo{createParse(e,i,n){let s=n[0].from,r=n[n.length-1].to;return{parsedPos:s,advance(){let e=Aa;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 bo(fo.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 Aa}}function Ra(t,e,i){return Eo.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class Ea{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 Ea(e)}static init(t){let e=Math.min(3e3,t.doc.length),i=Ta.create(t.facet(Wa).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new Ea(i)}}Pa.state=q.define({create:Ea.init,update(t,e){for(let t of e.effects)if(t.is(Pa.setState))return t.value;return e.startState.facet(Wa)!=e.state.facet(Wa)?Ea.init(e.state):t.apply(e)}});let Va=t=>{let e=setTimeout((()=>t()),500);return()=>clearTimeout(e)};"undefined"!=typeof requestIdleCallback&&(Va=t=>{let e=-1,i=setTimeout((()=>{e=requestIdleCallback(t,{timeout:400})}),100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const Ma="undefined"!=typeof navigator&&(null===(xa=navigator.scheduling)||void 0===xa?void 0:xa.isInputPending)?()=>navigator.scheduling.isInputPending():null,Da=_i.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(Pa.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),t.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(Pa.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=Va(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEndn+1e3,a=s.context.work((()=>Ma&&Ma()||Date.now()>r),n+(o?0:1e5));this.chunkBudget-=Date.now()-e,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Pa.setState.of(new Ea(s.context))})),this.chunkBudget>0&&(!a||o)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then((()=>this.scheduleWork())).catch((t=>Qi(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()}}}),Wa=E.define({combine:t=>t.length?t[0]:null,enables:t=>[Pa.state,Da,Ts.contentAttributes.compute([t],(e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}}))]});class Ua{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}class Ya{constructor(t,e,i,n,s,r=void 0){this.name=t,this.alias=e,this.extensions=i,this.filename=n,this.loadFunc=s,this.support=r,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then((t=>this.support=t),(t=>{throw this.loading=null,t})))}static of(t){let{load:e,support:i}=t;if(!e){if(!i)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");e=()=>Promise.resolve(i)}return new Ya(t.name,(t.alias||[]).concat(t.name).map((t=>t.toLowerCase())),t.extensions||[],t.filename,e,i)}static matchFilename(t,e){for(let i of t)if(i.filename&&i.filename.test(e))return i;let i=/\.([^.]+)$/.exec(e);if(i)for(let e of t)if(e.extensions.indexOf(i[1])>-1)return e;return null}static matchLanguageName(t,e,i=!0){e=e.toLowerCase();for(let i of t)if(i.alias.some((t=>t==e)))return i;if(i)for(let i of t)for(let t of i.alias){let n=e.indexOf(t);if(n>-1&&(t.length>2||!/\w/.test(e[n-1])&&!/\w/.test(e[n+t.length])))return i}return null}}const qa=E.define(),La=E.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 za(t){let e=t.facet(La);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function Ia(t,e){let i="",n=t.tabSize,s=t.facet(La)[0];if("\t"==s){for(;e>=n;)i+="\t",e-=n;s=" "}for(let t=0;t=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 Yt(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 Na=new ho;function Ga(t){let e=t.type.prop(Na);if(e)return e;let i,n=t.firstChild;if(n&&(i=n.type.prop(ho.closedBy))){let e=t.lastChild,n=e&&i.indexOf(e.name)>-1;return t=>el(t,!0,1,void 0,n&&!function(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}(t)?e.from:void 0)}return null==t.parent?Ha:null}function Fa(t,e,i){for(;t;t=t.parent){let n=Ga(t);if(n)return n(Ja.create(i,e,t))}return null}function Ha(){return 0}class Ja extends ja{constructor(t,e,i){super(t.state,t.options),this.base=t,this.pos=e,this.node=i}static create(t,e,i){return new Ja(t,e,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){let t=this.state.doc.lineAt(this.node.from);for(;;){let e=this.node.resolve(t.from);for(;e.parent&&e.parent.from==e.from;)e=e.parent;if(Ka(e,this.node))break;t=this.state.doc.lineAt(e.from)}return this.lineIndent(t.from)}continue(){let t=this.node.parent;return t?Fa(t,this.pos,this.base):0}}function Ka(t,e){for(let i=e;i;i=i.parent)if(t==i)return!0;return!1}function tl({closing:t,align:e=!0,units:i=1}){return n=>el(n,e,i,t)}function el(t,e,i,n,s){let r=t.textAfter,o=r.match(/^\s*/)[0].length,a=n&&r.slice(o,o+n.length)==n||s==t.pos+o,l=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.from{let n=t&&t.test(i.textAfter);return i.baseIndent+(n?0:e*i.unit)}}function nl(){return xt.transactionFilter.of((t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let i=t.newDoc,{head:n}=t.newSelection.main,s=i.lineAt(n);if(n>s.from+200)return t;let r=i.sliceString(s.from,n);if(!e.some((t=>t.test(r))))return t;let{state:o}=t,a=-1,l=[];for(let{head:t}of o.selection.ranges){let e=o.doc.lineAt(t);if(e.from==a)continue;a=e.from;let i=Ba(o,e.from);if(null==i)continue;let n=/^\s*/.exec(e.text)[0],s=Ia(o,i);n!=s&&l.push({from:e.from,to:e.from+n.length,insert:s})}return l.length?[t,{changes:l,sequential:!0}]:t}))}const sl=E.define(),rl=new ho;function ol(t){let e=t.firstChild,i=t.lastChild;return e&&e.toi)continue;if(s&&r.from=e&&n.to>i&&(s=n)}}return s}(t,e,i)}function hl(t,e){let i=e.mapPos(t.from,1),n=e.mapPos(t.to,-1);return i>=n?void 0:{from:i,to:n}}const cl=ut.define({map:hl}),ul=ut.define({map:hl}),dl=q.define({create:()=>ni.none,update(t,e){t=t.map(e.changes);for(let i of e.effects)i.is(cl)&&!pl(t,i.value.from,i.value.to)?t=t.update({add:[bl.range(i.value.from,i.value.to)]}):i.is(ul)&&(t=t.update({filter:(t,e)=>i.value.from!=t||i.value.to!=e,filterFrom:i.value.from,filterTo:i.value.to}));if(e.selection){let i=!1,{head:n}=e.selection.main;t.between(n,n,((t,e)=>{tn&&(i=!0)})),i&&(t=t.update({filterFrom:n,filterTo:n,filter:(t,e)=>e<=n||t>=n}))}return t},provide:t=>Ts.decorations.from(t),toJSON(t,e){let i=[];return t.between(0,e.doc.length,((t,e)=>{i.push(t,e)})),i},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let i=0;i{(!s||s.from>t)&&(s={from:t,to:e})})),s}function pl(t,e,i){let n=!1;return t.between(e,e,((t,s)=>{t==e&&s==i&&(n=!0)})),n}const Ol={placeholderDOM:null,placeholderText:"…"},gl=E.define({combine:t=>kt(t,Ol)});function ml(t){let e=[dl,yl];return t&&e.push(gl.of(t)),e}const bl=ni.replace({widget:new class extends ei{toDOM(t){let{state:e}=t,i=e.facet(gl),n=e=>{let i=t.lineBlockAt(t.posAtDOM(e.target)),n=fl(t.state,i.from,i.to);n&&t.dispatch({effects:ul.of(n)}),e.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(t,n);let s=document.createElement("span");return s.textContent=i.placeholderText,s.setAttribute("aria-label",e.phrase("folded code")),s.title=e.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=n,s}}}),wl={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class vl extends Yr{constructor(t,e){super(),this.config=t,this.open=e}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let e=document.createElement("span");return e.textContent=this.open?this.config.openText:this.config.closedText,e.title=t.state.phrase(this.open?"Fold line":"Unfold line"),e}}const yl=Ts.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Sl{constructor(t,e){let i;function n(t){let e=It.newName();return(i||(i=Object.create(null)))["."+e]=t,e}this.specs=t;const s="string"==typeof e.all?e.all:e.all?n(e.all):void 0,r=e.scope;this.scope=r instanceof Pa?t=>t.prop(ka)==r.data:r?t=>t==r:void 0,this.style=sa(t.map((t=>({tag:t.tag,class:t.class||n(Object.assign({},t,{tag:null}))}))),{all:s}).style,this.module=i?new It(i):null,this.themeType=e.themeType}static define(t,e){return new Sl(t,e||{})}}const xl=E.define(),kl=E.define({combine:t=>t.length?[t[0]]:null});function Ql(t){let e=t.facet(xl);return e.length?e:t.facet(kl)}function $l(t,e){let i,n=[Cl];return t instanceof Sl&&(t.module&&n.push(Ts.styleModule.of(t.module)),i=t.themeType),(null==e?void 0:e.fallback)?n.push(kl.of(t)):i?n.push(xl.computeN([Ts.darkTheme],(e=>e.facet(Ts.darkTheme)==("dark"==i)?[t]:[]))):n.push(xl.of(t)),n}class Pl{constructor(t){this.markCache=Object.create(null),this.tree=Xa(t.state),this.decorations=this.buildDeco(t,Ql(t.state))}update(t){let e=Xa(t.state),i=Ql(t.state),n=i!=Ql(t.startState);e.length{i.add(t,e,this.markCache[n]||(this.markCache[n]=ni.mark({class:n})))}),n,s);return i.finish()}}const Cl=N.high(_i.fromClass(Pl,{decorations:t=>t.decorations})),_l=Sl.define([{tag:Sa.meta,color:"#404740"},{tag:Sa.link,textDecoration:"underline"},{tag:Sa.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Sa.emphasis,fontStyle:"italic"},{tag:Sa.strong,fontWeight:"bold"},{tag:Sa.strikethrough,textDecoration:"line-through"},{tag:Sa.keyword,color:"#708"},{tag:[Sa.atom,Sa.bool,Sa.url,Sa.contentSeparator,Sa.labelName],color:"#219"},{tag:[Sa.literal,Sa.inserted],color:"#164"},{tag:[Sa.string,Sa.deleted],color:"#a11"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],color:"#e40"},{tag:Sa.definition(Sa.variableName),color:"#00f"},{tag:Sa.local(Sa.variableName),color:"#30a"},{tag:[Sa.typeName,Sa.namespace],color:"#085"},{tag:Sa.className,color:"#167"},{tag:[Sa.special(Sa.variableName),Sa.macroName],color:"#256"},{tag:Sa.definition(Sa.propertyName),color:"#00c"},{tag:Sa.comment,color:"#940"},{tag:Sa.invalid,color:"#f00"}]),Xl=Ts.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Zl=1e4,Al="()[]{}",Tl=E.define({combine:t=>kt(t,{afterCursor:!0,brackets:Al,maxScanDistance:Zl,renderMatch:Vl})}),Rl=ni.mark({class:"cm-matchingBracket"}),El=ni.mark({class:"cm-nonmatchingBracket"});function Vl(t){let e=[],i=t.matched?Rl:El;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 Ml=q.define({create:()=>ni.none,update(t,e){if(!e.docChanged&&!e.selection)return t;let i=[],n=e.state.facet(Tl);for(let t of e.state.selection.ranges){if(!t.empty)continue;let s=Ll(e.state,t.head,-1,n)||t.head>0&&Ll(e.state,t.head-1,1,n)||n.afterCursor&&(Ll(e.state,t.head,1,n)||t.headTs.decorations.from(t)}),Dl=[Ml,Xl];function Wl(t={}){return[Tl.of(t),Dl]}const Ul=new ho;function Yl(t,e,i){let n=t.prop(e<0?ho.openedBy:ho.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 ql(t){let e=t.type.prop(Ul);return e?e(t.node):t}function Ll(t,e,i,n={}){let s=n.maxScanDistance||Zl,r=n.brackets||Al,o=Xa(t),a=o.resolveInner(e,i);for(let n=a;n;n=n.parent){let s=Yl(n.type,i,r);if(s&&n.from0?e>=o.from&&eo.from&&e<=o.to))return zl(t,e,i,n,o,s,r)}}return function(t,e,i,n,s,r,o){let a=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%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 a=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(a+t,1).type!=s))if(e%2==0==i>0)u++;else{if(1==u)return{start:h,end:{from:a+t,to:a+t+1},matched:e>>1==l>>1};u--}}i>0&&(t+=r.length)}return c.done?{start:h,matched:!1}:null}(t,e,i,o,a.type,s,r)}function zl(t,e,i,n,s,r,o){let a=n.parent,l={from:s.from,to:s.to},h=0,c=null==a?void 0:a.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 jl(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 Nl=new WeakMap;class Gl extends Pa{constructor(t){let e,i=Qa(t.languageData),n={name:(s=t).name||"",token:s.token,blankLine:s.blankLine||(()=>{}),startState:s.startState||(()=>!0),copyState:s.copyState||jl,indent:s.indent||(()=>null),languageData:s.languageData||{},tokenTable:s.tokenTable||th};var s;super(i,new class extends Vo{createParse(t,i,n){return new Jl(e,t,i,n)}},[qa.of(((t,e)=>this.getIndent(t,e)))],t.name),this.topNode=function(t){let e=fo.define({id:eh.length,name:"Document",props:[ka.add((()=>t))]});return eh.push(e),e}(i),e=this,this.streamParser=n,this.stateAfter=new ho({perNode:!0}),this.tokenTable=t.tokenTable?new rh(n.tokenTable):oh}static define(t){return new Gl(t)}getIndent(t,e){let i,n=Xa(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=Nl.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],a=i+e.positions[r],l=o instanceof bo&&a=e.length)return e;s||e.type!=t.topNode||(s=!0);for(let r=e.children.length-1;r>=0;r--){let o,a=e.positions[r],l=e.children[r];if(ai&&Fl(t,n.tree,0-n.offset,i,r);if(o&&(e=Hl(t,n.tree,i+n.offset,o.pos+n.offset,!1)))return{state:o.state,tree:e}}return{state:t.streamParser.startState(n?za(n):4),tree:bo.empty}}(t,i,r,null==s?void 0:s.state);this.state=o,this.parsedPos=this.chunkStart=r+a.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 Bl(e,t?t.state.tabSize:4,t?za(t.state):2);if(r.eol())s.blankLine(this.state,r.indentUnit);else for(;!r.eol();){let t=Kl(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 th=Object.create(null),eh=[fo.none],ih=new po(eh),nh=[],sh=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"]])sh[t]=lh(th,e);class rh{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),sh)}resolve(t){return t?this.table[t]||(this.table[t]=lh(this.extra,t)):0}}const oh=new rh(th);function ah(t,e){nh.indexOf(t)>-1||(nh.push(t),console.warn(e))}function lh(t,e){let i=null;for(let n of e.split(".")){let e=t[n]||Sa[n];e?"function"==typeof e?i?i=e(i):ah(n,`Modifier ${n} used at start of tag`):i?ah(n,`Tag ${n} used as modifier`):i=e:ah(n,`Unknown highlighting tag ${n}`)}if(!i)return 0;let n=e.replace(/ /g,"_"),s=fo.define({id:eh.length,name:n,props:[ea({[n]:i})]});return eh.push(s),s.id}function hh(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 ch=hh(gh,0),uh=hh(Oh,0),dh=hh(((t,e)=>Oh(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 fh(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}const ph=50;function Oh(t,e,i=e.selection.ranges){let n=i.map((t=>fh(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,a=t.sliceDoc(n-ph,n),l=t.sliceDoc(s,s+ph),h=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(l)[0].length,u=a.length-h;if(a.slice(u-e.length,u)==e&&l.slice(c,c+i.length)==i)return{open:{pos:n-h,margin:h&&1},close:{pos:s+c,margin:c&&1}};s-n<=2*ph?r=o=t.sliceDoc(n,s):(r=t.sliceDoc(n,n+ph),o=t.sliceDoc(s-ph,s));let d=/^\s*/.exec(r)[0].length,f=/\s*$/.exec(o)[0].length,p=o.length-f-i.length;return r.slice(d,d+e.length)==e&&o.slice(p,p+i.length)==i?{open:{pos:n+d+e.length,margin:/\s/.test(r.charAt(d+e.length))?1:0},close:{pos:s-f-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>l.from)){s=l.from;let t=/^\s*/.exec(l.text)[0].length,e=t==l.length,i=l.text.slice(t,t+a.length)==a?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 mh=lt.define(),bh=lt.define(),wh=E.define(),vh=E.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)})});const yh=q.define({create:()=>Dh.empty,update(t,e){let i=e.state.facet(vh),n=e.annotation(mh);if(n){let s=e.docChanged?A.single(function(t){let e=0;return t.iterChangedRanges(((t,i)=>e=i)),e}(e.changes)):void 0,r=Ch.fromTransaction(e,s),o=n.side,a=0==o?t.undone:t.done;return a=r?_h(a,a.length,i.minDepth,r):Th(a,e.startState.selection),new Dh(0==o?n.rest:a,0==o?a:n.rest)}let s=e.annotation(bh);if("full"!=s&&"before"!=s||(t=t.isolate()),!1===e.annotation(dt.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);let r=Ch.fromTransaction(e),o=e.annotation(dt.time),a=e.annotation(dt.userEvent);return r?t=t.addChanges(r,o,a,i,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,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 Dh(t.done.map(Ch.fromJSON),t.undone.map(Ch.fromJSON))});function Sh(t={}){return[yh,vh.of(t),Ts.domEventHandlers({beforeinput(t,e){let i="historyUndo"==t.inputType?kh:"historyRedo"==t.inputType?Qh:null;return!!i&&(t.preventDefault(),i(e))}})]}function xh(t,e){return function({state:i,dispatch:n}){if(!e&&i.readOnly)return!1;let s=i.field(yh,!1);if(!s)return!1;let r=s.pop(t,i,e);return!!r&&(n(r),!0)}}const kh=xh(0,!1),Qh=xh(1,!1),$h=xh(0,!0),Ph=xh(1,!0);class Ch{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 Ch(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 Ch(t.changes&&k.fromJSON(t.changes),[],t.mapped&&x.fromJSON(t.mapped),t.startSelection&&A.fromJSON(t.startSelection),t.selectionsAfter.map(A.fromJSON))}static fromTransaction(t,e){let i=Zh;for(let e of t.startState.facet(wh)){let n=e(t);n.length&&(i=i.concat(n))}return!i.length&&t.changes.empty?null:new Ch(t.changes.invert(t.startState.doc),i,void 0,e||t.startState.selection,Zh)}static selection(t){return new Ch(void 0,Zh,void 0,void 0,t)}}function _h(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 Xh(t,e){return t.length?e.length?t.concat(e):t:e}const Zh=[],Ah=200;function Th(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-Ah));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),_h(t,t.length-1,1e9,i.setSelAfter(n)))}return[Ch.selection([e])]}function Rh(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 Eh(t,e){if(!t.length)return t;let i=t.length,n=Zh;for(;i;){let s=Vh(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?[Ch.selection(n)]:Zh}function Vh(t,e,i){let n=Xh(t.selectionsAfter.length?t.selectionsAfter.map((t=>t.map(e))):Zh,i);if(!t.changes)return Ch.selection(n);let s=t.changes.map(e),r=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(r):r;return new Ch(s,ut.mapEffects(t.effects,e),o,t.startSelection.map(r),n)}const Mh=/^(input\.type|delete)($|\.)/;class Dh{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 Dh(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||Mh.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)?_h(r,r.length-1,n.minDepth,new Ch(t.changes.compose(o.changes),Xh(t.effects,o.effects),o.mapped,o.startSelection,Zh)):_h(r,r.length,n.minDepth,t),new Dh(r,Zh,e,i)}addSelection(t,e,i,n){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Zh;return s.length>0&&e-this.prevTimet.empty!=o.ranges[e].empty)).length)?this:new Dh(Th(this.done,t),this.undone,e,i);var r,o}addMapping(t){return new Dh(Eh(this.done,t),Eh(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:mh.of({side:t,rest:Rh(n)}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let i=1==n.length?Zh:n.slice(0,n.length-1);return s.mapped&&(i=Eh(i,s.mapped)),e.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:mh.of({side:t,rest:i}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}}Dh.empty=new Dh(Zh,Zh);const Wh=[{key:"Mod-z",run:kh,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Qh,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Qh,preventDefault:!0},{key:"Mod-u",run:$h,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Ph,preventDefault:!0}];function Uh(t,e){return A.create(t.ranges.map(e),t.mainIndex)}function Yh(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function qh({state:t,dispatch:e},i){let n=Uh(t.selection,i);return!n.eq(t.selection)&&(e(Yh(t,n)),!0)}function Lh(t,e){return A.cursor(e?t.to:t.from)}function zh(t,e){return qh(t,(i=>i.empty?t.moveByChar(i,e):Lh(i,e)))}function Ih(t){return t.textDirectionAt(t.state.selection.main.head)==Wi.LTR}const Bh=t=>zh(t,!Ih(t)),jh=t=>zh(t,Ih(t));function Nh(t,e){return qh(t,(i=>i.empty?t.moveByGroup(i,e):Lh(i,e)))}function Gh(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 Fh(t,e,i){let n,s,r=Xa(t).resolveInner(e.head),o=i?ho.closedBy:ho.openedBy;for(let n=e.head;;){let e=i?r.childAfter(n):r.childBefore(n);if(!e)break;Gh(t,e,o)?r=e:n=i?e.to:e.from}return s=r.type.prop(o)&&(n=i?Ll(t,r.from,1):Ll(t,r.to,-1))&&n.matched?i?n.end.to:n.end.from:i?r.to:r.from,A.cursor(s,i?-1:1)}function Hh(t,e){return qh(t,(i=>{if(!i.empty)return Lh(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)}))}const Jh=t=>Hh(t,!1),Kh=t=>Hh(t,!0);function tc(t){let e,i=t.scrollDOM.clientHeighti.empty?t.moveVertically(i,e,n.height):Lh(i,e)));if(r.eq(s.selection))return!1;if(n.selfScroll){let e=t.coordsAtPos(s.selection.main.head),o=t.scrollDOM.getBoundingClientRect(),a=o.top+n.marginTop,l=o.bottom-n.marginBottom;e&&e.top>a&&e.bottomec(t,!1),nc=t=>ec(t,!0);function sc(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=A.cursor(n.from+i))}return s}function rc(t,e){let i=Uh(t.state.selection,(t=>{let i=e(t);return A.range(t.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)}));return!i.eq(t.state.selection)&&(t.dispatch(Yh(t.state,i)),!0)}function oc(t,e){return console.log("Select!"),rc(t,(i=>t.moveByCharSelected(i,e)))}const ac=t=>oc(t,!Ih(t)),lc=t=>oc(t,Ih(t));function hc(t,e){return rc(t,(i=>t.moveByGroup(i,e)))}function cc(t,e){return rc(t,(i=>t.moveVertically(i,e)))}const uc=t=>cc(t,!1),dc=t=>cc(t,!0);function fc(t,e){return rc(t,(i=>t.moveVertically(i,e,tc(t).height)))}const pc=t=>fc(t,!1),Oc=t=>fc(t,!0),gc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:0})),!0),mc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.doc.length})),!0),bc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:0})),!0),wc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0);function vc(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=yc(t,n,!0)),s=Math.min(s,n),r=Math.max(r,n)}else s=yc(t,s,!1),r=yc(t,r,!0);return s==r?{range:n}:{changes:{from:s,to:r},range:A.cursor(s)}}));return!s.changes.empty&&(t.dispatch(n.update(s,{scrollIntoView:!0,userEvent:i,effects:"delete.selection"==i?Ts.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function yc(t,e,i){if(t instanceof Ts)for(let n of t.state.facet(Ts.atomicRanges).map((e=>e(t))))n.between(e,e,((t,n)=>{te&&(e=i?n:t)}));return e}const Sc=(t,e)=>vc(t,(i=>{let n,s,{state:r}=t,o=r.doc.lineAt(i);if(!e&&i>o.from&&iSc(t,!1),kc=t=>Sc(t,!0),Qc=(t,e)=>vc(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 a=f(r.text,n-r.from,e)+r.from,l=r.text.slice(Math.min(n,a)-r.from,Math.max(n,a)-r.from),h=o(l);if(null!=t&&h!=t)break;" "==l&&n==i||(t=h),n=a}return n})),$c=t=>Qc(t,!1),Pc=t=>vc(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 _c(t,e,i){if(t.readOnly)return!1;let n=[],s=[];for(let e of Cc(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(A.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(A.range(t.anchor-o,t.head-o))}}return!!n.length&&(e(t.update({changes:n,scrollIntoView:!0,selection:A.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0)}function Xc(t,e,i){if(t.readOnly)return!1;let n=[];for(let e of Cc(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 Zc=Ac(!1);function Ac(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),a=!e&&s==r&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i,n=Xa(t).resolveInner(e),s=n.childBefore(e),r=n.childAfter(e);return s&&r&&s.to<=e&&r.from>=e&&(i=s.type.prop(ho.closedBy))&&i.indexOf(r.name)>-1&&t.doc.lineAt(s.to).from==t.doc.lineAt(r.from).from?{from:s.to,to:r.from}:null}(i,s);e&&(s=r=(r<=o.to?o:i.doc.lineAt(r)).to);let l=new ja(i,{simulateBreak:s,simulateDoubleBreak:!!a}),h=Ba(l,s);for(null==h&&(h=/^\s*/.exec(i.doc.lineAt(s).text)[0].length);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:A.range(r.mapPos(n.anchor,1),r.mapPos(n.head,1))}}))}const Rc=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{i.push({from:e.from,insert:t.facet(La)})})),{userEvent:"input.indent"})),!0),Ec=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{let n=/^\s*/.exec(e.text)[0];if(!n)return;let s=Yt(n,t.tabSize),r=0,o=Ia(t,Math.max(0,s-za(t)));for(;rqh(t,(e=>Fh(t.state,e,!Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,!Ih(t))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:t=>qh(t,(e=>Fh(t.state,e,Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,Ih(t))))},{key:"Alt-ArrowUp",run:({state:t,dispatch:e})=>_c(t,e,!1)},{key:"Shift-Alt-ArrowUp",run:({state:t,dispatch:e})=>Xc(t,e,!1)},{key:"Alt-ArrowDown",run:({state:t,dispatch:e})=>_c(t,e,!0)},{key:"Shift-Alt-ArrowDown",run:({state:t,dispatch:e})=>Xc(t,e,!0)},{key:"Escape",run:({state:t,dispatch:e})=>{let i=t.selection,n=null;return i.ranges.length>1?n=A.create([i.main]):i.main.empty||(n=A.create([A.cursor(i.main.head)])),!!n&&(e(Yh(t,n)),!0)}},{key:"Mod-Enter",run:Ac(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:t,dispatch:e})=>{let i=Cc(t).map((({from:e,to:i})=>A.range(e,Math.min(i+1,t.doc.length))));return e(t.update({selection:A.create(i),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:t,dispatch:e})=>{let i=Uh(t.selection,(e=>{var i;let n=Xa(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 A.range(n.to,n.from)}));return e(Yh(t,i)),!0},preventDefault:!0},{key:"Mod-[",run:Ec},{key:"Mod-]",run:Rc},{key:"Mod-Alt-\\",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new ja(t,{overrideIndentation:t=>{let e=i[t];return null==e?-1:e}}),s=Tc(t,((e,s,r)=>{let o=Ba(n,e.from);if(null==o)return;/\S/.test(e.text)||(o=0);let a=/^\s*/.exec(e.text)[0],l=Ia(t,o);(a!=l||r.from{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(Cc(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=Uh(t.selection,(e=>{let s=Ll(t,e.head,-1)||Ll(t,e.head,1)||e.head>0&&Ll(t,e.head-1,1)||e.head{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=fh(t.state,i.from);return n.line?ch(t):!!n.block&&dh(t)}},{key:"Alt-A",run:uh}].concat([{key:"ArrowLeft",run:Bh,shift:ac,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:t=>Nh(t,!Ih(t)),shift:t=>hc(t,!Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:t=>qh(t,(e=>sc(t,e,!Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,!Ih(t)))),preventDefault:!0},{key:"ArrowRight",run:jh,shift:lc,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:t=>Nh(t,Ih(t)),shift:t=>hc(t,Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:t=>qh(t,(e=>sc(t,e,Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,Ih(t)))),preventDefault:!0},{key:"ArrowUp",run:Jh,shift:uc,preventDefault:!0},{mac:"Cmd-ArrowUp",run:gc,shift:bc},{mac:"Ctrl-ArrowUp",run:ic,shift:pc},{key:"ArrowDown",run:Kh,shift:dc,preventDefault:!0},{mac:"Cmd-ArrowDown",run:mc,shift:wc},{mac:"Ctrl-ArrowDown",run:nc,shift:Oc},{key:"PageUp",run:ic,shift:pc},{key:"PageDown",run:nc,shift:Oc},{key:"Home",run:t=>qh(t,(e=>sc(t,e,!1))),shift:t=>rc(t,(e=>sc(t,e,!1))),preventDefault:!0},{key:"Mod-Home",run:gc,shift:bc},{key:"End",run:t=>qh(t,(e=>sc(t,e,!0))),shift:t=>rc(t,(e=>sc(t,e,!0))),preventDefault:!0},{key:"Mod-End",run:mc,shift:wc},{key:"Enter",run:Zc},{key:"Mod-a",run:({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:xc,shift:xc},{key:"Delete",run:kc},{key:"Mod-Backspace",mac:"Alt-Backspace",run:$c},{key:"Mod-Delete",mac:"Alt-Delete",run:t=>Qc(t,!0)},{mac:"Mod-Backspace",run:t=>vc(t,(e=>{let i=t.lineBlockAt(e).from;return e>i?i:Math.max(0,e-1)}))},{mac:"Mod-Delete",run:Pc}].concat([{key:"Ctrl-b",run:Bh,shift:ac,preventDefault:!0},{key:"Ctrl-f",run:jh,shift:lc},{key:"Ctrl-p",run:Jh,shift:uc},{key:"Ctrl-n",run:Kh,shift:dc},{key:"Ctrl-a",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).from,1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).from)))},{key:"Ctrl-e",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).to,-1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).to)))},{key:"Ctrl-d",run:kc},{key:"Ctrl-h",run:xc},{key:"Ctrl-k",run:Pc},{key:"Ctrl-Alt-h",run:$c},{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:A.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:f(n.text,i-n.from,!1)+n.from,r=i==n.to?i+1:f(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:A.cursor(r)}}));return!i.changes.empty&&(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:nc}].map((t=>({mac:t.key,run:t.run,shift:t.shift})))));function Mc(){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 Uc{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(Wc(t)):Wc,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 b(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=w(t),i=this.bufferStart+this.bufferPos;this.bufferPos+=v(t);let n=this.normalize(e);for(let t=0,s=i;;t++){let r=n.charCodeAt(t),o=this.match(r,s);if(o)return this.value=o,this;if(t==n.length-1)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=jc(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 Ic(e,t.sliceString(e,i));return zc.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=jc(this.text,i+(t==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ic.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function jc(t,e){if(e>=t.length)return e;let i,n=t.lineAt(e);for(;e=56320&&i<57344;)e++;return e}function Nc(t){let e=Mc("input",{class:"cm-textfield",name:"line"});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,a,l]=i,h=a?+a.slice(1):0,c=o?+o:s.number;if(o&&l){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)));t.dispatch({effects:Gc.of(!1),selection:A.cursor(u.from+Math.max(0,Math.min(h,u.length))),scrollIntoView:!0}),t.focus()}return{dom:Mc("form",{class:"cm-gotoLine",onkeydown:e=>{27==e.keyCode?(e.preventDefault(),t.dispatch({effects:Gc.of(!1)}),t.focus()):13==e.keyCode&&(e.preventDefault(),i())},onsubmit:t=>{t.preventDefault(),i()}},Mc("label",t.state.phrase("Go to line"),": ",e)," ",Mc("button",{class:"cm-button",type:"submit"},t.state.phrase("go")))}}"undefined"!=typeof Symbol&&(Lc.prototype[Symbol.iterator]=Bc.prototype[Symbol.iterator]=function(){return this});const Gc=ut.define(),Fc=q.define({create:()=>!0,update(t,e){for(let i of e.effects)i.is(Gc)&&(t=i.value);return t},provide:t=>Ur.from(t,(t=>t?Nc:null))}),Hc=Ts.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),Jc={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Kc=E.define({combine:t=>kt(t,Jc,{highlightWordAroundCursor:(t,e)=>t||e,minSelectionLength:Math.min,maxMatches:Math.min})});function tu(t){let e=[ru,su];return t&&e.push(Kc.of(t)),e}const eu=ni.mark({class:"cm-selectionMatch"}),iu=ni.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function nu(t,e,i,n){return!(0!=i&&t(e.sliceDoc(i-1,i))==wt.Word||n!=e.doc.length&&t(e.sliceDoc(n,n+1))==wt.Word)}const su=_i.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(Kc),{state:i}=t,n=i.selection;if(n.ranges.length>1)return ni.none;let s,r=n.main,o=null;if(r.empty){if(!e.highlightWordAroundCursor)return ni.none;let t=i.wordAt(r.head);if(!t)return ni.none;o=i.charCategorizer(r.head),s=i.sliceDoc(t.from,t.to)}else{let t=r.to-r.from;if(t200)return ni.none;if(e.wholeWords){if(s=i.sliceDoc(r.from,r.to),o=i.charCategorizer(r.head),!nu(o,i,r.from,r.to)||!function(t,e,i,n){return t(e.sliceDoc(i,i+1))==wt.Word&&t(e.sliceDoc(n-1,n))==wt.Word}(o,i,r.from,r.to))return ni.none}else if(s=i.sliceDoc(r.from,r.to).trim(),!s)return ni.none}let a=[];for(let n of t.visibleRanges){let t=new Uc(i.doc,s,n.from,n.to);for(;!t.next().done;){let{from:n,to:s}=t.value;if((!o||nu(o,i,n,s))&&(r.empty&&n<=r.from&&s>=r.to?a.push(iu.range(n,s)):(n>=r.to||s<=r.from)&&a.push(eu.range(n,s)),a.length>e.maxMatches))return ni.none}}return ni.set(a)}},{decorations:t=>t.decorations}),ru=Ts.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});const ou=E.define({combine:t=>kt(t,{top:!1,caseSensitive:!1,literal:!1,wholeWord:!1,createPanel:t=>new Eu(t),scrollToMatch:t=>Ts.scrollIntoView(t)})});class au{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,qc),!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 pu(this):new cu(this)}getCursor(t,e=0,i){let n=t.doc?t:xt.create({doc:t});return null==i&&(i=n.doc.length),this.regexp?uu(this,n,e,i):hu(this,n,e,i)}}class lu{constructor(t){this.spec=t}}function hu(t,e,i,n){return new Uc(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=hu(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 uu(t,e,i,n){return new Lc(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?(s=e.charCategorizer(e.selection.main.head),(t,e,i)=>!i[0].length||(s(du(i.input,i.index))!=wt.Word||s(fu(i.input,i.index))!=wt.Word)&&(s(fu(i.input,i.index+i[0].length))!=wt.Word||s(du(i.input,i.index+i[0].length))!=wt.Word)):void 0},i,n);var s}function du(t,e){return t.slice(f(t,e,!1),e)}function fu(t,e){return t.slice(e,f(t,e))}class pu extends lu{nextMatch(t,e,i){let n=uu(this.spec,t,i,t.doc.length).next();return n.done&&(n=uu(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=uu(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=uu(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 Ou=ut.define(),gu=ut.define(),mu=q.define({create:t=>new bu(_u(t).create(),null),update(t,e){for(let i of e.effects)i.is(Ou)?t=new bu(i.value.create(),t.panel):i.is(gu)&&(t=new bu(t.query,i.value?Cu:null));return t},provide:t=>Ur.from(t,(t=>t.panel))});class bu{constructor(t,e){this.query=t,this.panel=e}}const wu=ni.mark({class:"cm-searchMatch"}),vu=ni.mark({class:"cm-searchMatch cm-searchMatch-selected"}),yu=_i.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(mu))}update(t){let e=t.state.field(mu);(e!=t.startState.field(mu)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ni.none;let{view:i}=this,n=new Xt;for(let e=0,s=i.visibleRanges,r=s.length;es[e+1].from-500;)a=s[++e].to;t.highlight(i.state,o,a,((t,e)=>{let s=i.state.selection.ranges.some((i=>i.from==t&&i.to==e));n.add(t,e,s?vu:wu)}))}return n.finish()}},{decorations:t=>t.decorations});function Su(t){return e=>{let i=e.state.field(mu,!1);return i&&i.query.spec.valid?t(e,i):Au(e)}}const xu=Su(((t,{query:e})=>{let{to:i}=t.state.selection.main,n=e.nextMatch(t.state,i,i);if(!n)return!1;let s=A.single(n.from,n.to),r=t.state.facet(ou);return t.dispatch({selection:s,effects:[Wu(t,n),r.scrollToMatch(s.main,t)],userEvent:"select.search"}),Zu(t),!0})),ku=Su(((t,{query:e})=>{let{state:i}=t,{from:n}=i.selection.main,s=e.prevMatch(i,n,n);if(!s)return!1;let r=A.single(s.from,s.to),o=t.state.facet(ou);return t.dispatch({selection:r,effects:[Wu(t,s),o.scrollToMatch(r.main,t)],userEvent:"select.search"}),Zu(t),!0})),Qu=Su(((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!(!i||!i.length)&&(t.dispatch({selection:A.create(i.map((t=>A.range(t.from,t.to)))),userEvent:"select.search.matches"}),!0)})),$u=Su(((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,a,l=[],h=[];if(r.from==n&&r.to==s&&(a=i.toText(e.getReplacement(r)),l.push({from:r.from,to:r.to,insert:a}),r=e.nextMatch(i,r.from,r.to),h.push(Ts.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(n).number)+"."))),r){let e=0==l.length||l[0].from>=r.to?0:r.to-r.from-a.length;o=A.single(r.from-e,r.to-e),h.push(Wu(t,r)),h.push(i.facet(ou).scrollToMatch(o.main,t))}return t.dispatch({changes:l,selection:o,effects:h,userEvent:"input.replace"}),!0})),Pu=Su(((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:Ts.announce.of(n),userEvent:"input.replace.all"}),!0}));function Cu(t){return t.state.facet(ou).createPanel(t)}function _u(t,e){var i,n,s,r;let o=t.selection.main,a=o.empty||o.to>o.from+100?"":t.sliceDoc(o.from,o.to);if(e&&!a)return e;let l=t.facet(ou);return new au({search:(null!==(i=null==e?void 0:e.literal)&&void 0!==i?i:l.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:null!==(n=null==e?void 0:e.caseSensitive)&&void 0!==n?n:l.caseSensitive,literal:null!==(s=null==e?void 0:e.literal)&&void 0!==s?s:l.literal,wholeWord:null!==(r=null==e?void 0:e.wholeWord)&&void 0!==r?r:l.wholeWord})}function Xu(t){let e=Vr(t,Cu);return e&&e.dom.querySelector("[main-field]")}function Zu(t){let e=Xu(t);e&&e==t.root.activeElement&&e.select()}const Au=t=>{let e=t.state.field(mu,!1);if(e&&e.panel){let i=Xu(t);if(i&&i!=t.root.activeElement){let n=_u(t.state,e.query.spec);n.valid&&t.dispatch({effects:Ou.of(n)}),i.focus(),i.select()}}else t.dispatch({effects:[gu.of(!0),e?Ou.of(_u(t.state,e.query.spec)):ut.appendConfig.of(Yu)]});return!0},Tu=t=>{let e=t.state.field(mu,!1);if(!e||!e.panel)return!1;let i=Vr(t,Cu);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:gu.of(!1)}),!0},Ru=[{key:"Mod-f",run:Au,scope:"editor search-panel"},{key:"F3",run:xu,shift:ku,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:xu,shift:ku,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Tu,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 Uc(t.doc,t.sliceDoc(n,s));!e.next().done;){if(r.length>1e3)return!1;e.value.from==n&&(o=r.length),r.push(A.range(e.value.from,e.value.to))}return e(t.update({selection:A.create(r,o),userEvent:"select.search.matches"})),!0}},{key:"Alt-g",run:t=>{let e=Vr(t,Nc);if(!e){let i=[Gc.of(!0)];null==t.state.field(Fc,!1)&&i.push(ut.appendConfig.of([Fc,Hc])),t.dispatch({effects:i}),e=Vr(t,Nc)}return e&&e.dom.querySelector("input").focus(),!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=A.create(i.ranges.map((e=>t.wordAt(e.head)||A.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 Uc(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 Uc(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(A.range(s.from,s.to),!1),effects:Ts.scrollIntoView(s.to)})),!0)},preventDefault:!0}];class Eu{constructor(t){this.view=t;let e=this.query=t.state.field(mu).query.spec;function i(t,e,i){return Mc("button",{class:"cm-button",name:t,onclick:e,type:"button"},i)}this.commit=this.commit.bind(this),this.searchField=Mc("input",{value:e.search,placeholder:Vu(t,"Find"),"aria-label":Vu(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Mc("input",{value:e.replace,placeholder:Vu(t,"Replace"),"aria-label":Vu(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Mc("input",{type:"checkbox",name:"case",form:"",checked:e.caseSensitive,onchange:this.commit}),this.reField=Mc("input",{type:"checkbox",name:"re",form:"",checked:e.regexp,onchange:this.commit}),this.wordField=Mc("input",{type:"checkbox",name:"word",form:"",checked:e.wholeWord,onchange:this.commit}),this.dom=Mc("div",{onkeydown:t=>this.keydown(t),class:"cm-search"},[this.searchField,i("next",(()=>xu(t)),[Vu(t,"next")]),i("prev",(()=>ku(t)),[Vu(t,"previous")]),i("select",(()=>Qu(t)),[Vu(t,"all")]),...t.state.readOnly?[]:[Mc("br"),this.replaceField,i("replace",(()=>$u(t)),[Vu(t,"replace")]),i("replaceAll",(()=>Pu(t)),[Vu(t,"replace all")])],Mc("button",{name:"close",onclick:()=>Tu(t),"aria-label":Vu(t,"close"),type:"button"},["×"])])}commit(){let t=new au({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:Ou.of(t)}))}keydown(t){var e,i,n;e=this.view,i=t,n="search-panel",Bs(Ls(e.state),i,e,n)?t.preventDefault():13==t.keyCode&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?ku:xu)(this.view)):13==t.keyCode&&t.target==this.replaceField&&(t.preventDefault(),$u(this.view))}update(t){for(let e of t.transactions)for(let t of e.effects)t.is(Ou)&&!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(ou).top}}function Vu(t,e){return t.state.phrase(e)}const Mu=30,Du=/[\s\.,:;?!]/;function Wu(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-Mu),o=Math.min(s,i+Mu),a=t.state.sliceDoc(r,o);if(r!=n.from)for(let t=0;ta.length-Mu;t--)if(!Du.test(a[t-1])&&Du.test(a[t])){a=a.slice(0,t);break}return Ts.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${n.number}.`)}const Uu=Ts.baseTheme({".cm-panel.cm-search":{padding:"0.25rem 0.5rem 0.25rem 0.5rem",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"0.5rem",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"}}),Yu=[mu,N.lowest(yu),Uu];class qu{constructor(t,e,i){this.state=t,this.pos=e,this.explicit=i,this.abortListeners=[]}tokenBefore(t){let e=Xa(this.state).resolveInner(this.pos,-1);for(;e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null}matchBefore(t){let e=this.state.doc.lineAt(this.pos),i=Math.max(e.from,this.pos-250),n=e.text.slice(i-e.from,this.pos-e.from),s=n.search(ju(t,!1));return s<0?null:{from:i+s,to:this.pos,text:n.slice(s)}}get aborted(){return null==this.abortListeners}addEventListener(t,e){"abort"==t&&this.abortListeners&&this.abortListeners.push(e)}}function Lu(t){let e=Object.keys(t).join(""),i=/\w/.test(e);return i&&(e=e.replace(/\w/g,"")),`[${i?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function zu(t){let e=t.map((t=>"string"==typeof t?{label:t}:t)),[i,n]=e.every((t=>/^\w+$/.test(t.label)))?[/\w*$/,/\w+$/]:function(t){let e=Object.create(null),i=Object.create(null);for(let{label:n}of t){e[n[0]]=!0;for(let t=1;t{let s=t.matchBefore(n);return s||t.explicit?{from:s?s.from:t.pos,options:e,validFor:i}:null}}class Iu{constructor(t,e,i,n){this.completion=t,this.source=e,this.match=i,this.score=n}}function Bu(t){return t.selection.main.from}function ju(t,e){var i;let{source:n}=t,s=e&&"^"!=n[0],r="$"!=n[n.length-1];return s||r?new RegExp(`${s?"^":""}(?:${n})${r?"$":""}`,null!==(i=t.flags)&&void 0!==i?i:t.ignoreCase?"i":""):t}const Nu=lt.define();const Gu=new WeakMap;function Fu(t){if(!Array.isArray(t))return t;let e=Gu.get(t);return e||Gu.set(t,e=zu(t)),e}const Hu=ut.define(),Ju=ut.define();class Ku{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[];for(let e=0;e=48&&l<=57||l>=97&&l<=122?2:l>=65&&l<=90?1:0:(y=w(l))!=y.toLowerCase()?1:y!=y.toUpperCase()?2:0;(!n||1==S&&O||0==m&&0!=S)&&(e[c]==l||i[c]==l&&(u=!0)?r[c++]=n:r.length&&(g=!1)),m=S,n+=v(l)}return c==a&&0==r[0]&&g?this.result((u?-200:0)-100,r,t):d==a&&0==f?[-200-t.length+(p==t.length?0:-100),0,p]:o>-1?[-700-t.length,o,o+this.pattern.length]:d==a?[-900-t.length,f,p]:c==a?this.result((u?-200:0)-100-700+(g?0:-1100),r,t):2==e.length?null:this.result((n[0]?-700:0)-200-1100,n,t)}result(t,e,i){let n=[t-i.length],s=1;for(let t of e){let e=t+(this.astral?v(b(i,t)):1);s>1&&n[s-1]==t?n[s-1]=e:(n[s++]=t,n[s++]=e)}return n}}const td=E.define({combine:t=>kt(t,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:id,compareCompletions:(t,e)=>t.label.localeCompare(e.label),interactionDelay:75},{defaultKeymap:(t,e)=>t&&e,closeOnBlur:(t,e)=>t&&e,icons:(t,e)=>t&&e,tooltipClass:(t,e)=>i=>ed(t(i),e(i)),optionClass:(t,e)=>i=>ed(t(i),e(i)),addToOptions:(t,e)=>t.concat(e)})});function ed(t,e){return t?e?t+" "+e:t:e}function id(t,e,i,n,s){let r,o,a=t.textDirection==Wi.RTL,l=a,h=!1,c="top",u=e.left-s.left,d=s.right-e.right,f=n.right-n.left,p=n.bottom-n.top;if(l&&u=p||t>e.top?r=i.bottom-e.top:(c="bottom",r=e.bottom-i.top)}return{style:`${c}: ${r}px; max-width: ${o}px`,class:"cm-completionInfo-"+(h?a?"left-narrow":"right-narrow":l?"left":"right")}}function nd(t,e="option"){return i=>{let n=i.state.field(yd,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp-1?n.open.selected+r*(t?1:-1):t?0:o-1;return a<0?a="page"==e?0:o-1:a>=o&&(a="page"==e?o-1:0),i.dispatch({effects:vd.of(a)}),!0}}const sd=t=>{let e=t.state.field(yd,!1);return!(t.state.readOnly||!e||!e.open||e.open.selected<0||Date.now()-e.open.timestamp(t.selection||t.docChanged)&&!gd(t)));for(let e=0;e50&&Date.now()-n.time>1e3){for(let t of n.context.abortListeners)try{t()}catch(t){Qi(this.view.state,t)}n.context.abortListeners=null,this.running.splice(e--,1)}else n.updates.push(...t.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some((t=>1==t.state&&!this.running.some((e=>e.active.source==t.source))))?setTimeout((()=>this.startUpdate()),50):-1,0!=this.composing)for(let e of t.transactions)"input"==gd(e)?this.composing=2:2==this.composing&&e.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:t}=this.view,e=t.field(yd);for(let t of e.active)1!=t.state||this.running.some((e=>e.active.source==t.source))||this.startQuery(t)}startQuery(t){let{state:e}=this.view,i=Bu(e),n=new qu(e,i,t.explicitPos==i),s=new rd(t,n);this.running.push(s),Promise.resolve(t.source(n)).then((t=>{s.context.aborted||(s.done=t||null,this.scheduleAccept())}),(t=>{this.view.dispatch({effects:Ju.of(null)}),Qi(this.view.state,t)}))}scheduleAccept(){this.running.every((t=>void 0!==t.done))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((()=>this.accept()),50))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],i=this.view.state.facet(td);for(let n=0;nt.source==s.active.source));if(r&&1==r.state)if(null==s.done){let t=new md(s.active.source,0);for(let e of s.updates)t=t.update(e,i);1!=t.state&&e.push(t)}else this.startQuery(r)}e.length&&this.view.dispatch({effects:wd.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(yd,!1);if(e&&e.tooltip&&this.view.state.facet(td).closeOnBlur){let i=e.open&&Rr(this.view,e.open.tooltip);i&&i.dom.contains(t.relatedTarget)||this.view.dispatch({effects:Ju.of(null)})}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout((()=>this.view.dispatch({effects:Hu.of(!1)})),20),this.composing=0}}});function ad(t,e){const i=e.completion.apply||e.completion.label;let n=t.state.field(yd).active.find((t=>t.source==e.source));return n instanceof bd&&("string"==typeof i?t.dispatch(Object.assign(Object.assign({},function(t,e,i,n){let{main:s}=t.selection,r=i-s.from,o=n-s.from;return Object.assign(Object.assign({},t.changeByRange((a=>a!=s&&i!=n&&t.sliceDoc(a.from+r,a.from+o)!=t.sliceDoc(i,n)?{range:a}:{changes:{from:a.from+r,to:n==s.from?a.to:a.from+o,insert:e},range:A.cursor(a.from+r+e.length)}))),{userEvent:"input.complete"})}(t.state,i,n.from,n.to)),{annotations:Nu.of(e.completion)})):i(t,e.completion,n.from,n.to),!0)}function ld(t,e,i){if(t<=i)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let t=Math.floor(e/i);return{from:t*i,to:(t+1)*i}}let n=Math.floor((t-e)/i);return{from:t-(n+1)*i,to:t-n*i}}class hd{constructor(t,e){this.view=t,this.stateField=e,this.info=null,this.placeInfoReq={read:()=>this.measureInfo(),write:t=>this.placeInfo(t),key:this},this.space=null,this.currentClass="";let i=t.state.field(e),{options:n,selected:s}=i.open,r=t.state.facet(td);this.optionContent=function(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(t){let e=document.createElement("div");return e.classList.add("cm-completionIcon"),t.type&&e.classList.add(...t.type.split(/\s+/g).map((t=>"cm-completionIcon-"+t))),e.setAttribute("aria-hidden","true"),e},position:20}),e.push({render(t,e,i){let n=document.createElement("span");n.className="cm-completionLabel";let{label:s}=t,r=0;for(let t=1;tr&&n.appendChild(document.createTextNode(s.slice(r,e)));let a=n.appendChild(document.createElement("span"));a.appendChild(document.createTextNode(s.slice(e,o))),a.className="cm-completionMatchedText",r=o}return rt.position-e.position)).map((t=>t.render))}(r),this.optionClass=r.optionClass,this.tooltipClass=r.tooltipClass,this.range=ld(n.length,s,r.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",(e=>{for(let i,s=e.target;s&&s!=this.dom;s=s.parentNode)if("LI"==s.nodeName&&(i=/-(\d+)$/.exec(s.id))&&+i[1]{let i=t.state.field(this.stateField,!1);i&&i.tooltip&&t.state.facet(td).closeOnBlur&&e.relatedTarget!=t.contentDOM&&t.dispatch({effects:Ju.of(null)})})),this.list=this.dom.appendChild(this.createListBox(n,i.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))}mount(){this.updateSel()}update(t){var e,i,n;let s=t.state.field(this.stateField),r=t.startState.field(this.stateField);this.updateTooltipClass(t.state),s!=r&&(this.updateSel(),(null===(e=s.open)||void 0===e?void 0:e.disabled)!=(null===(i=r.open)||void 0===i?void 0:i.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!(null===(n=s.open)||void 0===n?void 0:n.disabled)))}updateTooltipClass(t){let e=this.tooltipClass(t);if(e!=this.currentClass){for(let t of this.currentClass.split(" "))t&&this.dom.classList.remove(t);for(let t of e.split(" "))t&&this.dom.classList.add(t);this.currentClass=e}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),e=t.open;if((e.selected>-1&&e.selected=this.range.to)&&(this.range=ld(e.options.length,e.selected,this.view.state.facet(td).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e.options,t.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))),this.updateSelectedOption(e.selected)){this.info&&(this.info.remove(),this.info=null);let{completion:i}=e.options[e.selected],{info:n,label:s,c:r}=i;if(!n)return;let o="string"==typeof n?document.createTextNode(n+" "):n(i);if(!o)return;if(!r){const t=document.createElement("span");t.appendChild(o),o=t;const e=document.createElement("a");e.innerText="🔎",e.href="/docFind/"+s,e.target="blank",o.appendChild(e)}if(!o)return;"then"in o?o.then((e=>{e&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(e)})).catch((t=>Qi(this.view.state,t,"completion info"))):this.addInfoPane(o)}}addInfoPane(t){let e=this.info=document.createElement("div");e.className="cm-tooltip cm-completionInfo",e.appendChild(t),this.dom.appendChild(e),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let e=null;for(let i=this.list.firstChild,n=this.range.from;i;i=i.nextSibling,n++)"LI"==i.nodeName&&i.id?n==t?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),e=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected"):n--;return e&&function(t,e){let i=t.getBoundingClientRect(),n=e.getBoundingClientRect();n.topi.bottom&&(t.scrollTop+=n.bottom-i.bottom)}(this.list,e),e}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let e=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),n=t.getBoundingClientRect(),s=this.space;if(!s){let t=this.dom.ownerDocument.defaultView||window;s={left:0,top:0,right:t.innerWidth,bottom:t.innerHeight}}return n.top>Math.min(s.bottom,e.bottom)-10||n.bottomi.from||0==i.from))if(s=t,"string"!=typeof l&&l.header)n.appendChild(l.header(l));else{n.appendChild(document.createElement("completion-section")).textContent=t}}const h=n.appendChild(document.createElement("li"));h.id=e+"-"+r,h.setAttribute("role","option");let c=this.optionClass(o);c&&(h.className=c);for(let t of this.optionContent){let e=t(o,this.view.state,a);e&&h.appendChild(e)}}return i.from&&n.classList.add("cm-completionListIncompleteTop"),i.to=this.options.length?this:new ud(this.options,pd(e,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,e,i,n,s){let r=function(t,e){let i=[],n=null,s=t=>{i.push(t);let{section:e}=t.completion;if(e){n||(n=[]);let t="string"==typeof e?e:e.name;n.some((e=>e.name==t))||n.push("string"==typeof e?{name:t}:e)}};for(let n of t)if(n.hasResult())if(!1===n.result.filter){let t=n.result.getMatch;for(let e of n.result.options){let r=[1e9-i.length];if(t)for(let i of t(e))r.push(i);s(new Iu(e,n.source,r,r[0]))}}else{let t,i=new Ku(e.sliceDoc(n.from,n.to));for(let e of n.result.options)(t=i.match(e.label))&&s(new Iu(e,n.source,t,t[0]+(e.boost||0)))}if(n){let t=Object.create(null),e=0,s=(t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:1e9)-(null!==(n=e.rank)&&void 0!==n?n:1e9)||(t.namee.score-t.score||a(t.completion,e.completion))))!o||o.label!=t.completion.label||o.detail!=t.completion.detail||null!=o.type&&null!=t.completion.type&&o.type!=t.completion.type||o.apply!=t.completion.apply?r.push(t):cd(t.completion)>cd(o)&&(r[r.length-1]=t),o=t.completion;return r}(t,e);if(!r.length)return n&&t.some((t=>1==t.state))?new ud(n.options,n.attrs,n.tooltip,n.timestamp,n.selected,!0):null;let o=e.facet(td).selectOnOpen?0:-1;if(n&&n.selected!=o&&-1!=n.selected){let t=n.options[n.selected].completion;for(let e=0;ee.hasResult()?Math.min(t,e.from):t),1e8),create:(a=yd,t=>new hd(t,a)),above:s.aboveCursor},n?n.timestamp:Date.now(),o,!1);var a}map(t){return new ud(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class dd{constructor(t,e,i){this.active=t,this.id=e,this.open=i}static start(){return new dd(Od,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(t){let{state:e}=t,i=e.facet(td),n=(i.override||e.languageDataAt("autocomplete",Bu(e)).map(Fu)).map((e=>(this.active.find((t=>t.source==e))||new md(e,this.active.some((t=>0!=t.state))?1:0)).update(t,i)));n.length==this.active.length&&n.every(((t,e)=>t==this.active[e]))&&(n=this.active);let s=this.open;s&&t.docChanged&&(s=s.map(t.changes)),t.selection||n.some((e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to)))||!function(t,e){if(t==e)return!0;for(let i=0,n=0;;){for(;i1==t.state))&&(s=null),!s&&n.every((t=>1!=t.state))&&n.some((t=>t.hasResult()))&&(n=n.map((t=>t.hasResult()?new md(t.source,0):t)));for(let e of t.effects)e.is(vd)&&(s=s&&s.setSelected(e.value,this.id));return n==this.active&&s==this.open?this:new dd(n,this.id,s)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:fd}}const fd={"aria-autocomplete":"list"};function pd(t,e){let i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(i["aria-activedescendant"]=t+"-"+e),i}const Od=[];function gd(t){return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null}class md{constructor(t,e,i=-1){this.source=t,this.state=e,this.explicitPos=i}hasResult(){return!1}update(t,e){let i=gd(t),n=this;i?n=n.handleUserEvent(t,i,e):t.docChanged?n=n.handleChange(t):t.selection&&0!=n.state&&(n=new md(n.source,0));for(let e of t.effects)if(e.is(Hu))n=new md(n.source,1,e.value?Bu(t.state):-1);else if(e.is(Ju))n=new md(n.source,0);else if(e.is(wd))for(let t of e.value)t.source==n.source&&(n=t);return n}handleUserEvent(t,e,i){return"delete"!=e&&i.activateOnTyping?new md(this.source,1):this.map(t.changes)}handleChange(t){return t.changes.touchesRange(Bu(t.startState))?new md(this.source,0):this.map(t.changes)}map(t){return t.empty||this.explicitPos<0?this:new md(this.source,this.state,t.mapPos(this.explicitPos))}}class bd extends md{constructor(t,e,i,n,s){super(t,2,e),this.result=i,this.from=n,this.to=s}hasResult(){return!0}handleUserEvent(t,e,i){var n;let s=t.changes.mapPos(this.from),r=t.changes.mapPos(this.to,1),o=Bu(t.state);if((this.explicitPos<0?o<=s:or||"delete"==e&&Bu(t.startState)==this.from)return new md(this.source,"input"==e&&i.activateOnTyping?1:0);let a,l=this.explicitPos<0?-1:t.changes.mapPos(this.explicitPos);return function(t,e,i,n){if(!t)return!1;let s=e.sliceDoc(i,n);return"function"==typeof t?t(s,i,n,e):ju(t,!0).test(s)}(this.result.validFor,t.state,s,r)?new bd(this.source,l,this.result,s,r):this.result.update&&(a=this.result.update(this.result,s,r,new qu(t.state,o,l>=0)))?new bd(this.source,l,a,a.from,null!==(n=a.to)&&void 0!==n?n:Bu(t.state)):new md(this.source,1,l)}handleChange(t){return t.changes.touchesRange(this.from,this.to)?new md(this.source,0):this.map(t.changes)}map(t){return t.empty?this:new bd(this.source,this.explicitPos<0?-1:t.mapPos(this.explicitPos),this.result,t.mapPos(this.from),t.mapPos(this.to,1))}}const wd=ut.define({map:(t,e)=>t.map((t=>t.map(e)))}),vd=ut.define(),yd=q.define({create:()=>dd.start(),update:(t,e)=>t.update(e),provide:t=>[Tr.from(t,(t=>t.tooltip)),Ts.contentAttributes.from(t,(t=>t.attrs))]}),Sd=Ts.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class xd{constructor(t,e,i,n){this.field=t,this.line=e,this.from=i,this.to=n}}class kd{constructor(t,e,i){this.field=t,this.from=e,this.to=i}map(t){let e=t.mapPos(this.from,-1,S.TrackDel),i=t.mapPos(this.to,1,S.TrackDel);return null==e||null==i?null:new kd(this.field,e,i)}}class Qd{constructor(t,e){this.lines=t,this.fieldPositions=e}instantiate(t,e){let i=[],n=[e],s=t.doc.lineAt(e),r=/^\s*/.exec(s.text)[0];for(let s of this.lines){if(i.length){let i=r,o=/^\t*/.exec(s)[0].length;for(let e=0;enew kd(t.field,n[t.line]+t.from,n[t.line]+t.to)));return{text:i,ranges:o}}static parse(t){let e,i=[],n=[],s=[];for(let r of t.split(/\r\n?|\n/)){for(;e=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(r);){let t=e[1]?+e[1]:null,o=e[2]||e[3]||"",a=-1;for(let e=0;e=a&&t.field++}s.push(new xd(a,n.length,e.index,e.index+o.length)),r=r.slice(0,e.index)+o+r.slice(e.index+e[0].length)}for(let t;t=/\\([{}])/.exec(r);){r=r.slice(0,t.index)+t[1]+r.slice(t.index+t[0].length);for(let e of s)e.line==n.length&&e.from>t.index&&(e.from--,e.to--)}n.push(r)}return new Qd(n,s)}}let $d=ni.widget({widget:new class extends ei{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),Pd=ni.mark({class:"cm-snippetField"});class Cd{constructor(t,e){this.ranges=t,this.active=e,this.deco=ni.set(t.map((t=>(t.from==t.to?$d:Pd).range(t.from,t.to))))}map(t){let e=[];for(let i of this.ranges){let n=i.map(t);if(!n)return null;e.push(n)}return new Cd(e,this.active)}selectionInsideField(t){return t.ranges.every((t=>this.ranges.some((e=>e.field==this.active&&e.from<=t.from&&e.to>=t.to))))}}const _d=ut.define({map:(t,e)=>t&&t.map(e)}),Xd=ut.define(),Zd=q.define({create:()=>null,update(t,e){for(let i of e.effects){if(i.is(_d))return i.value;if(i.is(Xd)&&t)return new Cd(t.ranges,i.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>Ts.decorations.from(t,(t=>t?t.deco:ni.none))});function Ad(t,e){return A.create(t.filter((t=>t.field==e)).map((t=>A.range(t.from,t.to))))}function Td(e){let i=Qd.parse(e);return(e,n,s,r)=>{let{text:o,ranges:a}=i.instantiate(e.state,s),l={changes:{from:s,to:r,insert:t.of(o)},scrollIntoView:!0,annotations:n?Nu.of(n):void 0};if(a.length&&(l.selection=Ad(a,0)),a.length>1){let t=new Cd(a,0),i=l.effects=[_d.of(t)];void 0===e.state.field(Zd,!1)&&i.push(ut.appendConfig.of([Zd,Md,Wd,Sd]))}e.dispatch(e.state.update(l))}}function Rd(t){return({state:e,dispatch:i})=>{let n=e.field(Zd,!1);if(!n||t<0&&0==n.active)return!1;let s=n.active+t,r=t>0&&!n.ranges.some((e=>e.field==s+t));return i(e.update({selection:Ad(n.ranges,s),effects:_d.of(r?null:new Cd(n.ranges,s))})),!0}}const Ed=[{key:"Tab",run:Rd(1),shift:Rd(-1)},{key:"Escape",run:({state:t,dispatch:e})=>!!t.field(Zd,!1)&&(e(t.update({effects:_d.of(null)})),!0)}],Vd=E.define({combine:t=>t.length?t[0]:Ed}),Md=N.highest(Ys.compute([Vd],(t=>t.facet(Vd))));function Dd(t,e){return Object.assign(Object.assign({},e),{apply:Td(t)})}const Wd=Ts.domEventHandlers({mousedown(t,e){let i,n=e.state.field(Zd,!1);if(!n||null==(i=e.posAtCoords({x:t.clientX,y:t.clientY})))return!1;let s=n.ranges.find((t=>t.from<=i&&t.to>=i));return!(!s||s.field==n.active)&&(e.dispatch({selection:Ad(n.ranges,s.field),effects:_d.of(n.ranges.some((t=>t.field>s.field))?new Cd(n.ranges,s.field):null)}),!0)}}),Ud=new class extends Qt{};function Yd(t={}){return[yd,td.of(t),od,Ld,Sd]}Ud.startSide=1,Ud.endSide=-1;const qd=[{key:"Ctrl-Space",run:t=>!!t.state.field(yd,!1)&&(t.dispatch({effects:Hu.of(!0)}),!0)},{key:"Escape",run:t=>{let e=t.state.field(yd,!1);return!(!e||!e.active.some((t=>0!=t.state)))&&(t.dispatch({effects:Ju.of(null)}),!0)}},{key:"ArrowDown",run:nd(!0)},{key:"ArrowUp",run:nd(!1)},{key:"PageDown",run:nd(!0,"page")},{key:"PageUp",run:nd(!1,"page")},{key:"Enter",run:sd}],Ld=N.highest(Ys.computeN([td],(t=>t.facet(td).defaultKeymap?[qd]:[]))),zd=(()=>[vr(),Sh(),ir(),$l(_l,{fallback:!0}),Ys.of([...Vc,...Wh])])();class Id{constructor(t,e,i,n,s,r,o,a,l,h=0,c){this.p=t,this.stack=e,this.state=i,this.reducePos=n,this.pos=s,this.score=r,this.buffer=o,this.bufferBase=a,this.curContext=l,this.lookAhead=h,this.parent=c}toString(){return`[${this.stack.filter(((t,e)=>e%3==0)).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,i=0){let n=t.parser.context;return new Id(t,[],e,i,i,0,[],0,n?new Bd(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let i=t>>19,n=65535&t,{parser:s}=this.p,r=s.dynamicPrecedence(n);if(r&&(this.score+=r),0==i)return this.pushState(s.getGoto(this.state,n,!0),this.reducePos),n=2e3&&!(null===(e=this.p.parser.nodeSet.types[n])||void 0===e?void 0:e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=l):this.p.lastBigReductionSizeo;)this.stack.pop();this.reduceContext(n,a)}storeNode(t,e,i,n=4,s=!1){if(0==t&&(!this.stack.length||this.stack[this.stack.length-1]0&&0==t.buffer[n-4]&&t.buffer[n-1]>-1){if(e==i)return;if(t.buffer[n-2]>=e)return void(t.buffer[n-2]=i)}}if(s&&this.pos!=i){let s=this.buffer.length;if(s>0&&0!=this.buffer[s-4])for(;s>0&&this.buffer[s-2]>i;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,n>4&&(n-=4);this.buffer[s]=t,this.buffer[s+1]=e,this.buffer[s+2]=i,this.buffer[s+3]=n}else this.buffer.push(t,e,i,n)}shift(t,e,i){let n=this.pos;if(131072&t)this.pushState(65535&t,this.pos);else if(0==(262144&t)){let s=t,{parser:r}=this.p;(i>this.pos||e<=r.maxNode)&&(this.pos=i,r.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,n),this.shiftContext(e,n),e<=r.maxNode&&this.buffer.push(e,n,i,4)}else this.pos=i,this.shiftContext(e,n),e<=this.p.parser.maxNode&&this.buffer.push(e,n,i,4)}apply(t,e,i){65536&t?this.reduce(t):this.shift(t,e,i)}useNode(t,e){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=t)&&(this.p.reused.push(t),i++);let n=this.pos;this.reducePos=this.pos=n+t.length,this.pushState(e,n),this.buffer.push(i,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let i=t.buffer.slice(e),n=t.bufferBase+e;for(;t&&n==t.bufferBase;)t=t.parent;return new Id(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,n,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let i=t<=this.p.parser.maxNode;i&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,i?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new Nd(this);;){let i=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(0==i)return!1;if(0==(65536&i))return!0;e.reduce(i)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let n,s=0;s1&e&&t==n))||i.push(e[t],n)}e=i}let i=[];for(let t=0;t>19,n=65535&t,s=this.stack.length-3*i;if(s<0||e.getGoto(this.stack[s],n,!1)<0)return!1;this.storeNode(0,this.reducePos,this.reducePos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:t}=this.p;return 65535==t.data[t.stateSlot(this.state,1)]&&!t.stateSlot(this.state,4)}restart(){this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;ethis.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Bd{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}var jd;!function(t){t[t.Insert=200]="Insert",t[t.Delete=190]="Delete",t[t.Reduce=100]="Reduce",t[t.MaxNext=4]="MaxNext",t[t.MaxInsertStackDepth=300]="MaxInsertStackDepth",t[t.DampenInsertStackDepth=120]="DampenInsertStackDepth",t[t.MinBigReduction=2e3]="MinBigReduction"}(jd||(jd={}));class Nd{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=65535&t,i=t>>19;0==i?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(i-1);let n=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=n}}class Gd{constructor(t,e,i){this.stack=t,this.pos=e,this.index=i,this.buffer=t.buffer,0==this.index&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new Gd(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;null!=t&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new Gd(this.stack,this.pos,this.index)}}function Fd(t,e=Uint16Array){if("string"!=typeof t)return t;let i=null;for(let n=0,s=0;n=92&&e--,e>=34&&e--;let s=e-32;if(s>=46&&(s-=46,i=!0),r+=s,i)break;r*=46}i?i[s++]=r:i=new e(r)}return i}class Hd{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Jd=new Hd;class Kd{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Jd,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let i=this.range,n=this.rangeIndex,s=this.pos+t;for(;si.to:s>=i.to;){if(n==this.ranges.length-1)return null;let t=this.ranges[++n];s+=t.from-i.to,i=t}return s}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,e.from);return this.end}peek(t){let e,i,n=this.chunkOff+t;if(n>=0&&n=this.chunk2Pos&&en.to&&(this.chunk2=this.chunk2.slice(0,n.to-e)),i=this.chunk2.charCodeAt(0)}}return e>=this.token.lookAhead&&(this.token.lookAhead=e+1),i}acceptToken(t,e=0){let i=e?this.resolveOffset(e,-1):this.pos;if(null==i||i=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=Jd,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let i="";for(let n of this.ranges){if(n.from>=e)break;n.to>t&&(i+=this.input.read(Math.max(n.from,t),Math.min(n.to,e)))}return i}}class tf{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:i}=e.p;sf(this.data,t,e,this.id,i.data,i.tokenPrecTable)}}tf.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class ef{constructor(t,e,i){this.precTable=e,this.elseToken=i,this.data="string"==typeof t?Fd(t):t}token(t,e){let i=t.pos,n=0;for(;sf(this.data,t,e,0,this.data,this.precTable),!(t.token.value>-1);){if(null==this.elseToken)return;if(t.next<0)break;t.advance(),t.reset(t.pos,t.token),n++}n&&(t.reset(i,t.token),t.acceptToken(this.elseToken,n))}}ef.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class nf{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function sf(t,e,i,n,s,r){let o=0,a=1<0){let i=t[n];if(l.allows(i)&&(-1==e.token.value||e.token.value==i||of(i,e.token.value,s,r))){e.acceptToken(i);break}}let n=e.next,h=0,c=t[o+2];if(!(e.next<0&&c>h&&65535==t[i+3*c-3]&&65535==t[i+3*c-3])){for(;h>1,r=i+s+(s<<1),a=t[r],l=t[r+1]||65536;if(n=l)){o=t[r+2],e.advance();continue t}h=s+1}}break}o=t[i+3*c-1]}}function rf(t,e,i){for(let n,s=e;65535!=(n=t[s]);s++)if(n==i)return s-e;return-1}function of(t,e,i,n){let s=rf(i,n,e);return s<0||rf(i,n,t)e)&&!n.type.isError)return i<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(t.length,Math.max(n.from+1,e+25));if(i<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return i<0?0:t.length}}!function(t){t[t.Margin=25]="Margin"}(hf||(hf={}));let uf=class{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?cf(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?cf(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=r,null;if(s instanceof bo){if(r==t){if(r=Math.max(this.safeFrom,t)&&(this.trees.push(s),this.start.push(r),this.index.push(0))}else this.index[e]++,this.nextStart=r+s.length}}};class df{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map((t=>new Hd))}getActions(t){let e=0,i=null,{parser:n}=t.p,{tokenizers:s}=n,r=n.stateSlot(t.state,3),o=t.curContext?t.curContext.hash:0,a=0;for(let n=0;nh.end+25&&(a=Math.max(h.lookAhead,a)),0!=h.value)){let n=e;if(h.extended>-1&&(e=this.addActions(t,h.extended,h.end,e)),e=this.addActions(t,h.value,h.end,e),!l.extend&&(i=h,e>n))break}}for(;this.actions.length>e;)this.actions.pop();return a&&t.setLookAhead(a),i||t.pos!=this.stream.end||(i=new Hd,i.value=t.p.parser.eofTerm,i.start=i.end=t.pos,e=this.addActions(t,i.value,i.end,e)),this.mainToken=i,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new Hd,{pos:i,p:n}=t;return e.start=i,e.end=Math.min(i+1,n.stream.end),e.value=i==n.stream.end?n.parser.eofTerm:0,e}updateCachedToken(t,e,i){let n=this.stream.clipPos(i.pos);if(e.token(this.stream.reset(n,t),i),t.value>-1){let{parser:e}=i.p;for(let n=0;n=0&&i.p.parser.dialect.allows(s>>1)){0==(1&s)?t.value=s>>1:t.extended=s>>1;break}}}else t.value=0,t.end=this.stream.clipPos(n+1)}putAction(t,e,i,n){for(let e=0;e4*t.bufferLength?new uf(i,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t,e,i=this.stacks,n=this.minStackPos,s=this.stacks=[];if(this.bigReductionCount>300&&1==i.length){let[t]=i;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;rn)s.push(o);else{if(this.advanceStack(o,s,i))continue;{t||(t=[],e=[]),t.push(o);let i=this.tokens.getMainToken(o);e.push(i.value,i.end)}}break}}if(!s.length){let e=t&&function(t){let e=null;for(let i of t){let t=i.p.stoppedAt;(i.pos==i.p.stream.end||null!=t&&i.pos>t)&&i.p.parser.stateFlag(i.state,2)&&(!e||e.scorethis.stoppedAt?t[0]:this.runRecovery(t,e,s);if(i)return this.stackToTree(i.forceAll())}if(this.recovering){let t=1==this.recovering?1:3*this.recovering;if(s.length>t)for(s.sort(((t,e)=>e.score-t.score));s.length>t;)s.pop();s.some((t=>t.reducePos>n))&&this.recovering--}else if(s.length>1){t:for(let t=0;t500&&n.buffer.length>500){if(!((e.score-n.score||e.buffer.length-n.buffer.length)>0)){s.splice(t--,1);continue t}s.splice(i--,1)}}}s.length>12&&s.splice(12,s.length-12)}this.minStackPos=s[0].pos;for(let t=1;t ":"";if(null!=this.stoppedAt&&n>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let e=t.curContext&&t.curContext.tracker.strict,i=e?t.curContext.hash:0;for(let o=this.fragments.nodeAt(n);o;){let n=this.parser.nodeSet.types[o.type.id]==o.type?s.getGoto(t.state,o.type.id):-1;if(n>-1&&o.length&&(!e||(o.prop(ho.contextHash)||0)==i))return t.useNode(o,n),af&&console.log(r+this.stackID(t)+` (via reuse of ${s.getName(o.type.id)})`),!0;if(!(o instanceof bo)||0==o.children.length||o.positions[0]>0)break;let a=o.children[0];if(!(a instanceof bo&&0==o.positions[0]))break;o=a}}let o=s.stateSlot(t.state,4);if(o>0)return t.reduce(o),af&&console.log(r+this.stackID(t)+` (via always-reduce ${s.getName(65535&o)})`),!0;if(t.stack.length>=15e3)for(;t.stack.length>9e3&&t.forceReduce(););let a=this.tokens.getActions(t);for(let o=0;on?e.push(d):i.push(d)}return!1}advanceFully(t,e){let i=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>i)return Of(t,e),!0}}runRecovery(t,e,i){let n=null,s=!1;for(let r=0;r ":"";if(o.deadEnd){if(s)continue;if(s=!0,o.restart(),af&&console.log(h+this.stackID(o)+" (restarted)"),this.advanceFully(o,i))continue}let c=o.split(),u=h;for(let t=0;c.forceReduce()&&t<10;t++){if(af&&console.log(u+this.stackID(c)+" (via force-reduce)"),this.advanceFully(c,i))break;af&&(u=this.stackID(c)+" -> ")}for(let t of o.recoverByInsert(a))af&&console.log(h+this.stackID(t)+" (via recover-insert)"),this.advanceFully(t,i);this.stream.end>o.pos?(l==o.pos&&(l++,a=0),o.recoverByDelete(a,l),af&&console.log(h+this.stackID(o)+` (via recover-delete ${this.parser.getName(a)})`),Of(o,i)):(!n||n.scoret;class bf{constructor(t){this.start=t.start,this.shift=t.shift||mf,this.reduce=t.reduce||mf,this.reuse=t.reuse||mf,this.hash=t.hash||(()=>0),this.strict=!1!==t.strict}}class wf extends Vo{constructor(t){if(super(),this.wrappers=[],14!=t.version)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let i=0;it.topRules[e][1])),n=[];for(let t=0;t=0)s(n,t,e[i++]);else{let r=e[i+-n];for(let o=-n;o>0;o--)s(e[i++],t,r);i++}}}this.nodeSet=new po(e.map(((e,s)=>fo.define({name:s>=this.minRepeatTerm?void 0:e,id:s,props:n[s],top:i.indexOf(s)>-1,error:0==s,skipped:t.skippedNodes&&t.skippedNodes.indexOf(s)>-1})))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=oo;let r=Fd(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let t=0;t"number"==typeof t?new tf(r,t):t)),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,i){let n=new pf(this,t,e,i);for(let s of this.wrappers)n=s(n,t,e,i);return n}getGoto(t,e,i=!1){let n=this.goto;if(e>=n[0])return-1;for(let s=n[e+1];;){let e=n[s++],r=1&e,o=n[s++];if(r&&i)return o;for(let i=s+(e>>1);s0}validAction(t,e){if(e==this.stateSlot(t,4))return!0;for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])return!1;i=vf(this.data,i+2)}if(e==vf(this.data,i+1))return!0}}nextStates(t){let e=[];for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])break;i=vf(this.data,i+2)}if(0==(1&this.data[i+2])){let t=this.data[i+1];e.some(((e,i)=>1&i&&e==t))||e.push(this.data[i],t)}}return e}configure(t){let e=Object.assign(Object.create(wf.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let i=this.topRules[t.top];if(!i)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=i}return t.tokenizers&&(e.tokenizers=this.tokenizers.map((e=>{let i=t.tokenizers.find((t=>t.from==e));return i?i.to:e}))),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map(((i,n)=>{let s=t.specializers.find((t=>t.from==i.external));if(!s)return i;let r=Object.assign(Object.assign({},i),{external:s.to});return e.specializers[n]=yf(r),r}))),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),null!=t.strict&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),null!=t.bufferLength&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return null==e?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),i=e.map((()=>!1));if(t)for(let n of t.split(" ")){let t=e.indexOf(n);t>=0&&(i[t]=!0)}let n=null;for(let t=0;tt.external(i,n)<<1|e}return t.get}const Sf=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],xf=new bf({start:!1,shift:(t,e)=>3==e||4==e||305==e?t:306==e,strict:!1}),kf=new nf(((t,e)=>{let{next:i}=t;(125==i||-1==i||e.context)&&e.canShift(303)&&t.acceptToken(303)}),{contextual:!0,fallback:!0}),Qf=new nf(((t,e)=>{let i,{next:n}=t;Sf.indexOf(n)>-1||(47!=n||47!=(i=t.peek(1))&&42!=i)&&125!=n&&59!=n&&-1!=n&&!e.context&&e.canShift(302)&&t.acceptToken(302)}),{contextual:!0}),$f=new nf(((t,e)=>{let{next:i}=t;if((43==i||45==i)&&(t.advance(),i==t.next)){t.advance();let i=!e.context&&e.canShift(1);t.acceptToken(i?1:2)}}),{contextual:!0}),Pf=ea({"get set async static":Sa.modifier,"for while do if else switch try catch finally return throw break continue default case":Sa.controlKeyword,"in of await yield void typeof delete instanceof":Sa.operatorKeyword,"let var const function class extends":Sa.definitionKeyword,"import export from":Sa.moduleKeyword,"with debugger as new":Sa.keyword,TemplateString:Sa.special(Sa.string),super:Sa.atom,BooleanLiteral:Sa.bool,this:Sa.self,null:Sa.null,Star:Sa.modifier,VariableName:Sa.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":Sa.function(Sa.variableName),VariableDefinition:Sa.definition(Sa.variableName),Label:Sa.labelName,PropertyName:Sa.propertyName,PrivatePropertyName:Sa.special(Sa.propertyName),"CallExpression/MemberExpression/PropertyName":Sa.function(Sa.propertyName),"FunctionDeclaration/VariableDefinition":Sa.function(Sa.definition(Sa.variableName)),"ClassDeclaration/VariableDefinition":Sa.definition(Sa.className),PropertyDefinition:Sa.definition(Sa.propertyName),PrivatePropertyDefinition:Sa.definition(Sa.special(Sa.propertyName)),UpdateOp:Sa.updateOperator,LineComment:Sa.lineComment,BlockComment:Sa.blockComment,Number:Sa.number,String:Sa.string,Escape:Sa.escape,ArithOp:Sa.arithmeticOperator,LogicOp:Sa.logicOperator,BitOp:Sa.bitwiseOperator,CompareOp:Sa.compareOperator,RegExp:Sa.regexp,Equals:Sa.definitionOperator,Arrow:Sa.function(Sa.punctuation),": Spread":Sa.punctuation,"( )":Sa.paren,"[ ]":Sa.squareBracket,"{ }":Sa.brace,"InterpolationStart InterpolationEnd":Sa.special(Sa.brace),".":Sa.derefOperator,", ;":Sa.separator,"@":Sa.meta,TypeName:Sa.typeName,TypeDefinition:Sa.definition(Sa.typeName),"type enum interface implements namespace module declare":Sa.definitionKeyword,"abstract global Privacy readonly override":Sa.modifier,"is keyof unique infer":Sa.operatorKeyword,JSXAttributeValue:Sa.attributeValue,JSXText:Sa.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":Sa.angleBracket,"JSXIdentifier JSXNameSpacedName":Sa.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":Sa.attributeName,"JSXBuiltin/JSXIdentifier":Sa.standard(Sa.tagName)}),Cf={__proto__:null,export:14,as:19,from:27,default:30,async:35,function:36,extends:46,this:50,true:58,false:58,null:70,void:74,typeof:78,super:96,new:130,delete:146,yield:155,await:159,class:164,public:221,private:221,protected:221,readonly:223,instanceof:242,satisfies:245,in:246,const:248,import:280,keyof:335,unique:339,infer:345,is:381,abstract:401,implements:403,type:405,let:408,var:410,interface:417,enum:421,namespace:427,module:429,declare:433,global:437,for:456,of:465,while:468,with:472,do:476,if:480,else:482,switch:486,case:492,try:498,catch:502,finally:506,return:510,throw:514,break:518,continue:522,debugger:526},_f={__proto__:null,async:117,get:119,set:121,declare:181,public:183,private:183,protected:183,static:185,abstract:187,override:189,readonly:195,accessor:197,new:385},Xf={__proto__:null,"<":137},Zf=wf.deserialize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y(Z+h-s-t-u-w2b2c5wQ1_,ZQ1r,oQ5e1jQ7m5fT:x&y+fT#]W%vS#[W%vS'u#S'}S'z#V+eS,t&y+fT-h't-mT'O!c%wQ$hfR)j$mT)_$h)`R3Z.kT*O$u*QR*W$xQ/}*zQ2e.OQ4s0wQ5{2iQ7X4vQ7x5zQ8e7WQ8w7wQ9W8gQ9`8yQ9e9XR9h9alpOXr!X#`%]&d&f&g&i,],b1b1eQ&^!TR,Q&ZV%z|},ZR0q+qR,P&XQ%szR+c%tR+X%nT&b!U&eT&c!U&eT1d,b1e",nodeNames:"⚠ ArithOp ArithOp LineComment BlockComment Script ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXStartTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:364,context:xf,nodeProps:[["group",-26,6,14,16,62,199,203,206,207,209,212,215,225,227,233,235,237,239,242,248,254,256,258,260,262,264,265,"Statement",-32,10,11,25,28,29,35,45,48,49,51,56,64,72,76,78,80,81,103,104,113,114,131,134,136,137,138,139,141,142,162,163,165,"Expression",-23,24,26,30,34,36,38,166,168,170,171,173,174,175,177,178,179,181,182,183,193,195,197,198,"Type",-3,84,96,102,"ClassItem"],["openedBy",31,"InterpolationStart",50,"[",54,"{",69,"(",143,"JSXStartTag",155,"JSXStartTag JSXStartCloseTag"],["closedBy",33,"InterpolationEnd",44,"]",55,"}",70,")",144,"JSXSelfCloseEndTag JSXEndTag",160,"JSXEndTag"]],propSources:[Pf],skippedNodes:[0,3,4,268],repeatNodeCount:33,tokenData:"$>y(CSR!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tu>PuvBavwDxwxGgxyMvyz!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term:312,get:t=>Cf[t]||-1},{term:328,get:t=>_f[t]||-1},{term:67,get:t=>Xf[t]||-1}],tokenPrec:12712}),Af=[Dd("function ${name}(${params}) {\n\t${}\n}",{label:"function",detail:"definition",type:"keyword"}),Dd("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n\t${}\n}",{label:"for",detail:"loop",type:"keyword"}),Dd("for (let ${name} of ${collection}) {\n\t${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Dd("do {\n\t${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),Dd("while (${}) {\n\t${}\n}",{label:"while",detail:"loop",type:"keyword"}),Dd("try {\n\t${}\n} catch (${error}) {\n\t${}\n}",{label:"try",detail:"/ catch block",type:"keyword"}),Dd("if (${}) {\n\t${}\n}",{label:"if",detail:"block",type:"keyword"}),Dd("if (${}) {\n\t${}\n} else {\n\t${}\n}",{label:"if",detail:"/ else block",type:"keyword"}),Dd("class ${name} {\n\tconstructor(${params}) {\n\t\t${}\n\t}\n}",{label:"class",detail:"definition",type:"keyword"}),Dd('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Dd('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Tf=new Ro,Rf=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Ef(t){return(e,i)=>{let n=e.node.getChild("VariableDefinition");return n&&i(n,t),!0}}const Vf=["FunctionDeclaration"],Mf={FunctionDeclaration:Ef("function"),ClassDeclaration:Ef("class"),ClassExpression:()=>!0,EnumDeclaration:Ef("constant"),TypeAliasDeclaration:Ef("type"),NamespaceDeclaration:Ef("namespace"),VariableDefinition(t,e){t.matchContext(Vf)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function Df(t,e){let i=Tf.get(e);if(i)return i;let n=[],s=!0;function r(e,i){let s=t.sliceString(e.from,e.to);n.push({label:s,type:i})}return e.cursor(mo.IncludeAnonymous).iterate((e=>{if(s)s=!1;else if(e.name){let t=Mf[e.name];if(t&&t(e,r)||Rf.has(e.name))return!1}else if(e.to-e.from>8192){for(let i of Df(t,e.node))n.push(i);return!1}})),Tf.set(e,n),n}const Wf=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Uf=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName"];function Yf(t){let e=Xa(t.state).resolveInner(t.pos,-1);if(Uf.indexOf(e.name)>-1)return null;let i="VariableName"==e.name||e.to-e.from<20&&Wf.test(t.state.sliceDoc(e.from,e.to));if(!i&&!t.explicit)return null;let n=[];for(let i=e;i;i=i.parent)Rf.has(i.name)&&(n=n.concat(Df(t.state.doc,i)));return{options:n,from:i?e.from:t.pos,validFor:Wf}}const qf=_a.define({name:"javascript",parser:Zf.configure({props:[Na.add({IfStatement:il({except:/^\s*({|else\b)/}),TryStatement:il({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:t=>t.baseIndent,SwitchBody:t=>{let e=t.textAfter,i=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return t.baseIndent+(i?0:n?1:2)*t.unit},Block:tl({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":il({except:/^{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag":t=>t.column(t.node.from)+t.unit}),rl.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression":ol,BlockComment:t=>({from:t.from+2,to:t.to-2})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Lf={test:t=>/^JSX/.test(t.name),facet:Qa({commentTokens:{block:{open:"{/*",close:"*/}"}}})},zf=qf.configure({dialect:"ts"},"typescript"),If=qf.configure({dialect:"jsx",props:[$a.add((t=>t.isTop?[Lf]:void 0))]}),Bf=qf.configure({dialect:"jsx ts",props:[$a.add((t=>t.isTop?[Lf]:void 0))]},"typescript"),jf="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map((t=>({label:t,type:"keyword"})));function Nf(t={}){let e=t.jsx?t.typescript?Bf:If:t.typescript?zf:qf;return new Ua(e,[qf.data.of({autocomplete:(i=Uf,n=zu(Af.concat(jf)),t=>{for(let e=Xa(t.state).resolveInner(t.pos,-1);e;e=e.parent){if(i.indexOf(e.name)>-1)return null;if(e.type.isTop)break}return n(t)})}),qf.data.of({autocomplete:Yf}),t.jsx?Hf:[]]);var i,n}function Gf(t,e,i=t.length){for(let n=null==e?void 0:e.firstChild;n;n=n.nextSibling)if("JSXIdentifier"==n.name||"JSXBuiltin"==n.name||"JSXNamespacedName"==n.name||"JSXMemberExpression"==n.name)return t.sliceString(n.from,Math.min(n.to,i));return""}const Ff="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),Hf=Ts.inputHandler.of(((t,e,i,n)=>{if((Ff?t.composing:t.compositionStarted)||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!qf.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((t=>{var e,i;let r,{head:o}=t,a=Xa(s).resolveInner(o,-1);if("JSXStartTag"==a.name&&(a=a.parent),">"==n&&"JSXFragmentTag"==a.name)return{range:A.cursor(o+1),changes:{from:o,insert:">"}};if("/"==n&&"JSXFragmentTag"==a.name){let t=a.parent,i=null==t?void 0:t.parent;if(t.from==o-1&&"JSXEndTag"!=(null===(e=i.lastChild)||void 0===e?void 0:e.name)&&(r=Gf(s.doc,null==i?void 0:i.firstChild,o))){let t=`/${r}>`;return{range:A.cursor(o+t.length),changes:{from:o,insert:t}}}}else if(">"==n){let t=function(t){for(;;){if("JSXOpenTag"==t.name||"JSXSelfClosingTag"==t.name||"JSXFragmentTag"==t.name)return t;if(!t.parent)return null;t=t.parent}}(a);if(t&&"JSXEndTag"!=(null===(i=t.lastChild)||void 0===i?void 0:i.name)&&"`}}}return{range:t}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)}));class Jf{constructor(t,e,i,n,s,r,o){this.type=t,this.value=e,this.from=i,this.hash=n,this.end=s,this.children=r,this.positions=o,this.hashProp=[[ho.contextHash,n]]}static create(t,e,i,n,s){return new Jf(t,e,i,n+(n<<8)+t+(e<<4)|0,s,[],[])}addChild(t,e){t.prop(ho.contextHash)!=this.hash&&(t=new bo(t.type,t.children,t.positions,t.length,this.hashProp)),this.children.push(t),this.positions.push(e)}toTree(t,e=this.end){let i=this.children.length-1;return i>=0&&(e=Math.max(e,this.positions[i]+this.children[i].length+this.from)),new bo(t.types[this.type],this.children,this.positions,e-this.from).balance({makeTree:(t,e,i)=>new bo(fo.none,t,e,i,this.hashProp)})}}var Kf;!function(t){t[t.Document=1]="Document",t[t.CodeBlock=2]="CodeBlock",t[t.FencedCode=3]="FencedCode",t[t.Blockquote=4]="Blockquote",t[t.HorizontalRule=5]="HorizontalRule",t[t.BulletList=6]="BulletList",t[t.OrderedList=7]="OrderedList",t[t.ListItem=8]="ListItem",t[t.ATXHeading1=9]="ATXHeading1",t[t.ATXHeading2=10]="ATXHeading2",t[t.ATXHeading3=11]="ATXHeading3",t[t.ATXHeading4=12]="ATXHeading4",t[t.ATXHeading5=13]="ATXHeading5",t[t.ATXHeading6=14]="ATXHeading6",t[t.SetextHeading1=15]="SetextHeading1",t[t.SetextHeading2=16]="SetextHeading2",t[t.HTMLBlock=17]="HTMLBlock",t[t.LinkReference=18]="LinkReference",t[t.Paragraph=19]="Paragraph",t[t.CommentBlock=20]="CommentBlock",t[t.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",t[t.Escape=22]="Escape",t[t.Entity=23]="Entity",t[t.HardBreak=24]="HardBreak",t[t.Emphasis=25]="Emphasis",t[t.StrongEmphasis=26]="StrongEmphasis",t[t.Link=27]="Link",t[t.Image=28]="Image",t[t.InlineCode=29]="InlineCode",t[t.HTMLTag=30]="HTMLTag",t[t.Comment=31]="Comment",t[t.ProcessingInstruction=32]="ProcessingInstruction",t[t.URL=33]="URL",t[t.HeaderMark=34]="HeaderMark",t[t.QuoteMark=35]="QuoteMark",t[t.ListMark=36]="ListMark",t[t.LinkMark=37]="LinkMark",t[t.EmphasisMark=38]="EmphasisMark",t[t.CodeMark=39]="CodeMark",t[t.CodeText=40]="CodeText",t[t.CodeInfo=41]="CodeInfo",t[t.LinkTitle=42]="LinkTitle",t[t.LinkLabel=43]="LinkLabel"}(Kf||(Kf={}));class tp{constructor(t,e){this.start=t,this.content=e,this.marks=[],this.parsers=[]}}class ep{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let t=this.skipSpace(this.basePos);this.indent=this.countIndent(t,this.pos,this.indent),this.pos=t,this.next=t==this.text.length?-1:this.text.charCodeAt(t)}skipSpace(t){return rp(this.text,t)}reset(t){for(this.text=t,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(t){this.basePos=t,this.baseIndent=this.countIndent(t,this.pos,this.indent)}moveBaseColumn(t){this.baseIndent=t,this.basePos=this.findColumn(t)}addMarker(t){this.markers.push(t)}countIndent(t,e=0,i=0){for(let n=e;n=e.stack[i.depth+1].value+i.baseIndent)return!0;if(i.indent>=i.baseIndent+4)return!1;let n=(t.type==Kf.OrderedList?dp:up)(i,e,!1);return n>0&&(t.type!=Kf.BulletList||hp(i,e,!1)<0)&&i.text.charCodeAt(i.pos+n-1)==t.value}const np={[Kf.Blockquote]:(t,e,i)=>62==i.next&&(i.markers.push(Up(Kf.QuoteMark,e.lineStart+i.pos,e.lineStart+i.pos+1)),i.moveBase(i.pos+(sp(i.text.charCodeAt(i.pos+1))?2:1)),t.end=e.lineStart+i.text.length,!0),[Kf.ListItem]:(t,e,i)=>!(i.indent-1)&&(i.moveBaseColumn(i.baseIndent+t.value),!0),[Kf.OrderedList]:ip,[Kf.BulletList]:ip,[Kf.Document]:()=>!0};function sp(t){return 32==t||9==t||10==t||13==t}function rp(t,e=0){for(;ei&&sp(t.charCodeAt(e-1));)e--;return e}function ap(t){if(96!=t.next&&126!=t.next)return-1;let e=t.pos+1;for(;e-1&&t.depth==e.stack.length||n<3?-1:1}function cp(t,e){for(let i=t.stack.length-1;i>=0;i--)if(t.stack[i].type==e)return!0;return!1}function up(t,e,i){return 45!=t.next&&43!=t.next&&42!=t.next||t.pos!=t.text.length-1&&!sp(t.text.charCodeAt(t.pos+1))||!(!i||cp(e,Kf.BulletList)||t.skipSpace(t.pos+2)=48&&s<=57;){if(n++,n==t.text.length)return-1;s=t.text.charCodeAt(n)}return n==t.pos||n>t.pos+9||46!=s&&41!=s||nt.pos+1||49!=t.next)?-1:n+1-t.pos}function fp(t){if(35!=t.next)return-1;let e=t.pos+1;for(;e6?-1:i}function pp(t){if(45!=t.next&&61!=t.next||t.indent>=t.baseIndent+4)return-1;let e=t.pos+1;for(;e/,mp=/\?>/,bp=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*/i.exec(n);if(r)return t.append(Up(Kf.Comment,i,i+1+r[0].length));let o=/^\?[^]*?\?>/.exec(n);if(o)return t.append(Up(Kf.ProcessingInstruction,i,i+1+o[0].length));let a=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(n);return a?t.append(Up(Kf.HTMLTag,i,i+1+a[0].length)):-1},Emphasis(t,e,i){if(95!=e&&42!=e)return-1;let n=i+1;for(;t.char(n)==e;)n++;let s=t.slice(i-1,i),r=t.slice(n,n+1),o=jp.test(s),a=jp.test(r),l=/\s|^$/.test(s),h=/\s|^$/.test(r),c=!h&&(!a||l||o),u=!l&&(!o||h||a),d=c&&(42==e||!u||o),f=u&&(42==e||!c||a);return t.append(new Ip(95==e?Yp:qp,i,n,(d?1:0)|(f?2:0)))},HardBreak(t,e,i){if(92==e&&10==t.char(i+1))return t.append(Up(Kf.HardBreak,i,i+2));if(32==e){let e=i+1;for(;32==t.char(e);)e++;if(10==t.char(e)&&e>=i+2)return t.append(Up(Kf.HardBreak,i,e+1))}return-1},Link:(t,e,i)=>91==e?t.append(new Ip(Lp,i,i+1,1)):-1,Image:(t,e,i)=>33==e&&91==t.char(i+1)?t.append(new Ip(zp,i,i+2,1)):-1,LinkEnd(t,e,i){if(93!=e)return-1;for(let e=t.parts.length-1;e>=0;e--){let n=t.parts[e];if(n instanceof Ip&&(n.type==Lp||n.type==zp)){if(!n.side||t.skipSpace(n.to)==i&&!/[(\[]/.test(t.slice(i+1,i+2)))return t.parts[e]=null,-1;let s=t.takeContent(e),r=t.parts[e]=Gp(t,s,n.type==Lp?Kf.Link:Kf.Image,n.from,i+1);if(n.type==Lp)for(let i=0;ie?Up(Kf.URL,e+i,s+i):s==t.length&&null}}function Hp(t,e,i){let n=t.charCodeAt(e);if(39!=n&&34!=n&&40!=n)return!1;let s=40==n?41:n;for(let n=e+1,r=!1;n=this.end?-1:this.text.charCodeAt(t-this.offset)}get end(){return this.offset+this.text.length}slice(t,e){return this.text.slice(t-this.offset,e-this.offset)}append(t){return this.parts.push(t),t.to}addDelimiter(t,e,i,n,s){return this.append(new Ip(t,e,i,(n?1:0)|(s?2:0)))}addElement(t){return this.append(t)}resolveMarkers(t){for(let e=t;e=t;o--){let t=this.parts[o];if(t instanceof Ip&&1&t.side&&t.type==i.type&&!(s&&(1&i.side||2&t.side)&&(t.to-t.from+r)%3==0&&((t.to-t.from)%3||r%3))){n=t;break}}if(!n)continue;let a=i.type.resolve,l=[],h=n.from,c=i.to;if(s){let t=Math.min(2,n.to-n.from,r);h=n.to-t,c=i.from+t,a=1==t?"Emphasis":"StrongEmphasis"}n.type.mark&&l.push(this.elt(n.type.mark,h,n.to));for(let t=o+1;t=0;e--){let i=this.parts[e];if(i instanceof Ip&&i.type==t)return e}return null}takeContent(t){let e=this.resolveMarkers(t);return this.parts.length=t,e}skipSpace(t){return rp(this.text,t-this.offset)+this.offset}elt(t,e,i,n){return"string"==typeof t?Up(this.parser.getNodeType(t),e,i,n):new Wp(t,e)}}function tO(t,e){if(!e.length)return t;if(!t.length)return e;let i=t.slice(),n=0;for(let t of e){for(;n(t?t-1:0))return!1;if(this.fragmentEnd<0){let t=this.fragment.to;for(;t>0&&"\n"!=this.input.read(t-1,t);)t--;this.fragmentEnd=t?t-1:0}let i=this.cursor;i||(i=this.cursor=this.fragment.tree.cursor(),i.firstChild());let n=t+this.fragment.offset;for(;i.to<=n;)if(!i.parent())return!1;for(;;){if(i.from>=n)return this.fragment.from<=e;if(!i.childAfter(n))return!1}}matches(t){let e=this.cursor.tree;return e&&e.prop(ho.contextHash)==t}takeNodes(t){let e=this.cursor,i=this.fragment.offset,n=this.fragmentEnd-(this.fragment.openEnd?1:0),s=t.absoluteLineStart,r=s,o=t.block.children.length,a=r,l=o;for(;;){if(e.to-i>n){if(e.type.isAnonymous&&e.firstChild())continue;break}if(t.dontInject.add(e.tree),t.addNode(e.tree,e.from-i),e.type.is("Block")&&(eO.indexOf(e.type.id)<0?(r=e.to-i,o=t.block.children.length):(r=a,o=l,a=e.to-i,l=t.block.children.length)),!e.nextSibling())break}for(;t.block.children.length>o;)t.block.children.pop(),t.block.positions.pop();return r-s}}const nO=ea({"Blockquote/...":Sa.quote,HorizontalRule:Sa.contentSeparator,"ATXHeading1/... SetextHeading1/...":Sa.heading1,"ATXHeading2/... SetextHeading2/...":Sa.heading2,"ATXHeading3/...":Sa.heading3,"ATXHeading4/...":Sa.heading4,"ATXHeading5/...":Sa.heading5,"ATXHeading6/...":Sa.heading6,"Comment CommentBlock":Sa.comment,Escape:Sa.escape,Entity:Sa.character,"Emphasis/...":Sa.emphasis,"StrongEmphasis/...":Sa.strong,"Link/... Image/...":Sa.link,"OrderedList/... BulletList/...":Sa.list,"BlockQuote/...":Sa.quote,"InlineCode CodeText":Sa.monospace,URL:Sa.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":Sa.processingInstruction,"CodeInfo LinkLabel":Sa.labelName,LinkTitle:Sa.string,Paragraph:Sa.content}),sO=new Zp(new po(Ep).extend(nO),Object.keys(Sp).map((t=>Sp[t])),Object.keys(Sp).map((t=>$p[t])),Object.keys(Sp),Pp,np,Object.keys(Np).map((t=>Np[t])),Object.keys(Np),[]);function rO(t,e,i){let n=[];for(let s=t.firstChild,r=e;;s=s.nextSibling){let t=s?s.from:i;if(t>r&&n.push({from:r,to:t}),!s)break;r=s.to}return n}const oO={resolve:"Strikethrough",mark:"StrikethroughMark"},aO={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":Sa.strikethrough}},{name:"StrikethroughMark",style:Sa.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,i){if(126!=e||126!=t.char(i+1)||126==t.char(i+2))return-1;let n=t.slice(i-1,i),s=t.slice(i+2,i+3),r=/\s|^$/.test(n),o=/\s|^$/.test(s),a=jp.test(n),l=jp.test(s);return t.addDelimiter(oO,i,i+2,!o&&(!l||r||a),!r&&(!a||o||l))},after:"Emphasis"}]};function lO(t,e,i=0,n,s=0){let r=0,o=!0,a=-1,l=-1,h=!1,c=()=>{n.push(t.elt("TableCell",s+a,s+l,t.parser.parseInline(e.slice(a,l),s+a)))};for(let u=i;u-1)&&r++,o=!1,n&&(a>-1&&c(),n.push(t.elt("TableDelimiter",u+s,u+s+1))),a=l=-1),h=!h&&92==i}return a>-1&&(r++,n&&c()),r}function hO(t,e){for(let i=e;ihO(e.content,0)?new uO:null,endLeaf(t,e,i){if(i.parsers.some((t=>t instanceof uO))||!hO(e.text,e.basePos))return!1;let n=t.scanLine(t.absoluteLineEnd+1).text;return cO.test(n)&&lO(t,e.text,e.basePos)==lO(t,n,e.basePos)},before:"SetextHeading"}]};class fO{nextLine(){return!1}finish(t,e){return t.addLeafElement(e,t.elt("Task",e.start,e.start+e.content.length,[t.elt("TaskMarker",e.start,e.start+3),...t.parser.parseInline(e.content.slice(3),e.start+3)])),!0}}const pO=[dO,{defineNodes:[{name:"Task",block:!0,style:Sa.list},{name:"TaskMarker",style:Sa.atom}],parseBlock:[{name:"TaskList",leaf:(t,e)=>/^\[[ xX]\]/.test(e.content)&&"ListItem"==t.parentType().name?new fO:null,after:"SetextHeading"}]},aO];function OO(t,e,i){return(n,s,r)=>{if(s!=t||n.char(r+1)==t)return-1;let o=[n.elt(i,r,r+1)];for(let s=r+1;s=65&&r<=90||95==r||r>=97&&r<=122||r>=161;)s+=String.fromCharCode(n),n=t.peek(++e);var r;return RO=t,EO=i,TO=s?s.toLowerCase():n==MO||n==DO?void 0:null}const MO=63,DO=33;function WO(t,e){this.name=t,this.parent=e,this.hash=e?e.hash:0;for(let e=0;eUO.indexOf(e)>-1?new WO(VO(n,1)||"",t):t,reduce:(t,e)=>e==wO&&t?t.parent:t,reuse(t,e,i,n){let s=e.type.id;return 6==s||36==s?new WO(VO(n,1)||"",t):t},hash:t=>t?t.hash:0,strict:!1}),qO=new nf(((t,e)=>{if(60!=t.next)return void(t.next<0&&e.context&&t.acceptToken(57));t.advance();let i=47==t.next;i&&t.advance();let n=VO(t,0);if(void 0===n)return;if(!n)return t.acceptToken(i?14:6);let s=e.context?e.context.name:null;if(i){if(n==s)return t.acceptToken(11);if(s&&XO[s])return t.acceptToken(57,-2);if(e.dialectEnabled(0))return t.acceptToken(12);for(let t=e.context;t;t=t.parent)if(t.name==n)return;t.acceptToken(13)}else{if("script"==n)return t.acceptToken(7);if("style"==n)return t.acceptToken(8);if("textarea"==n)return t.acceptToken(9);if(_O.hasOwnProperty(n))return t.acceptToken(10);s&&ZO[s]&&ZO[s][n]?t.acceptToken(57,-1):t.acceptToken(6)}}),{contextual:!0}),LO=new nf((t=>{for(let e=0,i=0;;i++){if(t.next<0){i&&t.acceptToken(58);break}if(45==t.next)e++;else{if(62==t.next&&e>=2){i>3&&t.acceptToken(58,-2);break}e=0}t.advance()}}));const zO=new nf(((t,e)=>{if(47==t.next&&62==t.peek(1)){let i=e.dialectEnabled(1)||function(t){for(;t;t=t.parent)if("svg"==t.name||"math"==t.name)return!0;return!1}(e.context);t.acceptToken(i?5:4,2)}else 62==t.next&&t.acceptToken(4,1)}));function IO(t,e,i){let n=2+t.length;return new nf((s=>{for(let r=0,o=0,a=0;;a++){if(s.next<0){a&&s.acceptToken(e);break}if(0==r&&60==s.next||1==r&&47==s.next||r>=2&&ro?s.acceptToken(e,-o):s.acceptToken(i,-(o-2));break}if((10==s.next||13==s.next)&&a){s.acceptToken(e,1);break}r=o=0}else o++;s.advance()}}))}const BO=IO("script",54,1),jO=IO("style",55,2),NO=IO("textarea",56,3),GO=ea({"Text RawText":Sa.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":Sa.angleBracket,TagName:Sa.tagName,"MismatchedCloseTag/TagName":[Sa.tagName,Sa.invalid],AttributeName:Sa.attributeName,"AttributeValue UnquotedAttributeValue":Sa.attributeValue,Is:Sa.definitionOperator,"EntityReference CharacterReference":Sa.character,Comment:Sa.blockComment,ProcessingInst:Sa.processingInstruction,DoctypeDecl:Sa.documentMeta}),FO=wf.deserialize({version:14,states:",xOVO!rOOO!WQ#tO'#CqO!]Q#tO'#CzO!bQ#tO'#C}O!gQ#tO'#DQO!lQ#tO'#DSO!qOaO'#CpO!|ObO'#CpO#XOdO'#CpO$eO!rO'#CpOOO`'#Cp'#CpO$lO$fO'#DTO$tQ#tO'#DVO$yQ#tO'#DWOOO`'#Dk'#DkOOO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Oa^Ob^Oc^Ox^O!dZO~O!ZrO~P#dO![sO!euO~OfvO~OfwO~OS|OhyO~OS!OOhyO~OS!QOhyO~OS!SOT!TOhyO~OS!TOhyO~O!WfOPlX!ZlX~OP!WO!Z!XO~O!XiOQoX!ZoX~OQ!ZO!Z!XO~O!YlORrX!ZrX~OR!]O!Z!XO~O!Z!XO~P#dOf!_O~O![sO!e!aO~OS!bO~OS!cO~Oi!dOSgXhgXTgX~OS!fOhyO~OS!gOhyO~OS!hOhyO~OS!iOT!jOhyO~OS!jOhyO~Of!kO~Of!lO~Of!mO~OS!nO~Ok!qO!`!oO!b!pO~OS!rO~OS!sO~OS!tO~Oa!uOb!uOc!uO!`!wO!a!uO~Oa!xOb!xOc!xO!b!wO!c!xO~Oa!uOb!uOc!uO!`!{O!a!uO~Oa!xOb!xOc!xO!b!{O!c!xO~OT~bac!dx{!d~",goto:"%p!`PPPPPPPPPPPPPPPPPPPP!a!gP!mPP!yP!|#P#S#Y#]#`#f#i#l#r#x!aP!a!aP$O$U$l$r$x%O%U%[%bPPPPPPPP%hX^OX`pXUOX`pezabcde{}!P!R!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ}bQ!PcQ!RdQ!UeZ!e{}!P!R!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:67,context:YO,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,21,30,33,36,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,29,32,35,37,"OpenTag"],["group",-9,14,17,18,19,20,39,40,41,42,"Entity",16,"Entity TextContent",-3,28,31,34,"TextContent Entity"]],propSources:[GO],skippedNodes:[0],repeatNodeCount:9,tokenData:"#%g!aR!YOX$qXY,QYZ,QZ[$q[]&X]^,Q^p$qpq,Qqr-_rs4ysv-_vw5iwxJ^x}-_}!OKP!O!P-_!P!Q$q!Q![-_![!]!!O!]!^-_!^!_!&W!_!`#$o!`!a&X!a!c-_!c!}!!O!}#R-_#R#S!!O#S#T3V#T#o!!O#o#s-_#s$f$q$f%W-_%W%o!!O%o%p-_%p&a!!O&a&b-_&b1p!!O1p4U-_4U4d!!O4d4e-_4e$IS!!O$IS$I`-_$I`$Ib!!O$Ib$Kh-_$Kh%#t!!O%#t&/x-_&/x&Et!!O&Et&FV-_&FV;'S!!O;'S;:j!&Q;:j;=`4s<%l?&r-_?&r?Ah!!O?Ah?BY$q?BY?Mn!!O?MnO$q!Z$|c`PkW!a`!cpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr$qrs&}sv$qvw+Pwx(tx!^$q!^!_*V!_!a&X!a#S$q#S#T&X#T;'S$q;'S;=`+z<%lO$q!R&bX`P!a`!cpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&Xq'UV`P!cpOv&}wx'kx!^&}!^!_(V!_;'S&};'S;=`(n<%lO&}P'pT`POv'kw!^'k!_;'S'k;'S;=`(P<%lO'kP(SP;=`<%l'kp([S!cpOv(Vx;'S(V;'S;=`(h<%lO(Vp(kP;=`<%l(Vq(qP;=`<%l&}a({W`P!a`Or(trs'ksv(tw!^(t!^!_)e!_;'S(t;'S;=`*P<%lO(t`)jT!a`Or)esv)ew;'S)e;'S;=`)y<%lO)e`)|P;=`<%l)ea*SP;=`<%l(t!Q*^V!a`!c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!N]<%lO!G_!R!MvV!a`!cpxPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!N`P;=`<%l!G_T!NhbhSOq!Hpqr!Ncrs!Hpsw!Ncwx!Hpx!P!Nc!P!Q!Hp!Q!_!Nc!_!a!Hp!a!b# p!b#s!Nc#s$f!Hp$f;'S!Nc;'S;=`#!}<%l?Ah!Nc?Ah?BY!Hp?BY?Mn!Nc?MnO!HpT# ubhSOq!Hpqr!Ncrs!Hpsw!Ncwx!Hpx!P!Nc!P!Q!Hp!Q!_!Nc!_!`!Hp!`!a!If!a#s!Nc#s$f!Hp$f;'S!Nc;'S;=`#!}<%l?Ah!Nc?Ah?BY!Hp?BY?Mn!Nc?MnO!HpT##QP;=`<%l!Nc!V##^chS!a`!cpOq!G_qr!Eyrs!HUsv!Eyvw!Ncwx!Jvx!P!Ey!P!Q!G_!Q!_!Ey!_!`!G_!`!a!Mm!a#s!Ey#s$f!G_$f;'S!Ey;'S;=`#$i<%l?Ah!Ey?Ah?BY!G_?BY?Mn!Ey?MnO!G_!V#$lP;=`<%l!Ey!V#$zXiS`P!a`!cpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X",tokenizers:[BO,jO,NO,zO,qO,LO,0,1,2,3,4,5],topRules:{Document:[0,15]},dialects:{noMatch:0,selfClosing:485},tokenPrec:487});function HO(t,e){let i=Object.create(null);for(let n of t.getChildren(yO)){let t=n.getChild(SO),s=n.getChild(xO)||n.getChild(kO);t&&(i[e.read(t.from,t.to)]=s?s.type.id==xO?e.read(s.from+1,s.to-1):e.read(s.from,s.to):"")}return i}function JO(t,e){let i=t.getChild(vO);return i?e.read(i.from,i.to):" "}function KO(t,e,i){let n;for(let s of i)if(!s.attrs||s.attrs(n||(n=HO(t.node.parent.firstChild,e))))return{parser:s.parser};return null}function tg(t=[],e=[]){let i=[],n=[],s=[],r=[];for(let e of t){("script"==e.tag?i:"style"==e.tag?n:"textarea"==e.tag?s:r).push(e)}let o=e.length?Object.create(null):null;for(let t of e)(o[t.name]||(o[t.name]=[])).push(t);return Do(((t,e)=>{let a=t.type.id;if(a==QO)return KO(t,e,i);if(a==$O)return KO(t,e,n);if(a==PO)return KO(t,e,s);if(a==wO&&r.length){let i,n=t.node,s=n.firstChild,o=s&&JO(s,e);if(o)for(let t of r)if(t.tag==o&&(!t.attrs||t.attrs(i||(i=HO(n,e))))){let e=n.lastChild;return{parser:t.parser,overlay:[{from:s.to,to:e.type.id==CO?e.from:n.to}]}}}if(o&&a==yO){let i,n=t.node;if(i=n.firstChild){let t=o[e.read(i.from,i.to)];if(t)for(let i of t){if(i.tagName&&i.tagName!=JO(n.parent,e))continue;let t=n.lastChild;if(t.type.id==xO){let e=t.from+1,n=t.lastChild,s=t.to-(n&&n.isError?0:1);if(s>e)return{parser:i.parser,overlay:[{from:e,to:s}]}}else if(t.type.id==kO)return{parser:i.parser,overlay:[{from:t.from,to:t.to}]}}}}return null}))}const eg=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288];function ig(t){return t>=65&&t<=90||t>=97&&t<=122||t>=161}const ng=new nf(((t,e)=>{for(let n=!1,s=0,r=0;;r++){let{next:o}=t;if(!(ig(o)||45==o||95==o||n&&(i=o,i>=48&&i<=57))){n&&t.acceptToken(40==o?95:2==s&&e.canShift(2)?2:96);break}!n&&(45!=o||r>0)&&(n=!0),s===r&&45==o&&s++,t.advance()}var i})),sg=new nf((t=>{if(eg.includes(t.peek(-1))){let{next:e}=t;(ig(e)||95==e||35==e||46==e||91==e||58==e||45==e)&&t.acceptToken(94)}})),rg=new nf((t=>{if(!eg.includes(t.peek(-1))){let{next:e}=t;if(37==e&&(t.advance(),t.acceptToken(1)),ig(e)){do{t.advance()}while(ig(t.next));t.acceptToken(1)}}})),og=ea({"AtKeyword import charset namespace keyframes media supports":Sa.definitionKeyword,"from to selector":Sa.keyword,NamespaceName:Sa.namespace,KeyframeName:Sa.labelName,TagName:Sa.tagName,ClassName:Sa.className,PseudoClassName:Sa.constant(Sa.className),IdName:Sa.labelName,"FeatureName PropertyName":Sa.propertyName,AttributeName:Sa.attributeName,NumberLiteral:Sa.number,KeywordQuery:Sa.keyword,UnaryQueryOp:Sa.operatorKeyword,"CallTag ValueName":Sa.atom,VariableName:Sa.variableName,Callee:Sa.operatorKeyword,Unit:Sa.unit,"UniversalSelector NestingSelector":Sa.definitionOperator,MatchOp:Sa.compareOperator,"ChildOp SiblingOp, LogicOp":Sa.logicOperator,BinOp:Sa.arithmeticOperator,Important:Sa.modifier,Comment:Sa.blockComment,ParenthesizedContent:Sa.special(Sa.name),ColorLiteral:Sa.color,StringLiteral:Sa.string,":":Sa.punctuation,"PseudoOp #":Sa.derefOperator,"; ,":Sa.separator,"( )":Sa.paren,"[ ]":Sa.squareBracket,"{ }":Sa.brace}),ag={__proto__:null,lang:32,"nth-child":32,"nth-last-child":32,"nth-of-type":32,"nth-last-of-type":32,dir:32,"host-context":32,url:60,"url-prefix":60,domain:60,regexp:60,selector:134},lg={__proto__:null,"@import":114,"@media":138,"@charset":142,"@namespace":146,"@keyframes":152,"@supports":164},hg={__proto__:null,not:128,only:128,from:158,to:160},cg=wf.deserialize({version:14,states:"7WQYQ[OOO#_Q[OOOOQP'#Cd'#CdOOQP'#Cc'#CcO#fQ[O'#CfO$YQXO'#CaO$aQ[O'#ChO$lQ[O'#DPO$qQ[O'#DTOOQP'#Ed'#EdO$vQdO'#DeO%bQ[O'#DrO$vQdO'#DtO%sQ[O'#DvO&OQ[O'#DyO&TQ[O'#EPO&cQ[O'#EROOQS'#Ec'#EcOOQS'#ET'#ETQYQ[OOO&jQXO'#CdO'_QWO'#DaO'dQWO'#EjO'oQ[O'#EjQOQWOOOOQP'#Cg'#CgOOQP,59Q,59QO#fQ[O,59QO'yQ[O'#EWO(eQWO,58{O(mQ[O,59SO$lQ[O,59kO$qQ[O,59oO'yQ[O,59sO'yQ[O,59uO'yQ[O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=`%o<%lO%^XFeU|POy%^z!`%^!`!aFw!a;'S%^;'S;=`%o<%lO%^XGOS|PoWOy%^z;'S%^;'S;=`%o<%lO%^XG_WOy%^z!c%^!c!}Gw!}#T%^#T#oGw#o;'S%^;'S;=`%o<%lO%^XHO[!YPoWOy%^z}%^}!OGw!O!Q%^!Q![Gw![!c%^!c!}Gw!}#T%^#T#oGw#o;'S%^;'S;=`%o<%lO%^XHySxPOy%^z;'S%^;'S;=`%o<%lO%^^I[SvUOy%^z;'S%^;'S;=`%o<%lO%^XIkUOy%^z#b%^#b#cI}#c;'S%^;'S;=`%o<%lO%^XJSUoWOy%^z#W%^#W#XJf#X;'S%^;'S;=`%o<%lO%^XJmS!`PoWOy%^z;'S%^;'S;=`%o<%lO%^XJ|UOy%^z#f%^#f#gJf#g;'S%^;'S;=`%o<%lO%^XKeS!RPOy%^z;'S%^;'S;=`%o<%lO%^_KvS!QVOy%^z;'S%^;'S;=`%o<%lO%^ZLXU!PPOy%^z!_%^!_!`6y!`;'S%^;'S;=`%o<%lO%^WLnP;=`<%l$}",tokenizers:[sg,rg,ng,0,1,2,3],topRules:{StyleSheet:[0,4],Styles:[1,84]},specialized:[{term:95,get:t=>ag[t]||-1},{term:56,get:t=>lg[t]||-1},{term:96,get:t=>hg[t]||-1}],tokenPrec:1123});let ug=null;function dg(){if(!ug&&"object"==typeof document&&document.body){let{style:t}=document.body,e=[],i=new Set;for(let n in t)"cssText"!=n&&"cssFloat"!=n&&"string"==typeof t[n]&&(/[A-Z]/.test(n)&&(n=n.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))),i.has(n)||(e.push(n),i.add(n)));ug=e.sort().map((t=>({type:"property",label:t})))}return ug||[]}const fg=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map((t=>({type:"class",label:t}))),pg=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map((t=>({type:"keyword",label:t}))).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map((t=>({type:"constant",label:t})))),Og=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map((t=>({type:"type",label:t}))),gg=/^(\w[\w-]*|-\w[\w-]*|)$/,mg=/^-(-[\w-]*)?$/;const bg=new Ro,wg=["Declaration"];function vg(t){for(let e=t;;){if(e.type.isTop)return e;if(!(e=e.parent))return t}}function yg(t,e,i){if(e.to-e.from>4096){let n=bg.get(e);if(n)return n;let s=[],r=new Set,o=e.cursor(mo.IncludeAnonymous);if(o.firstChild())do{for(let e of yg(t,o.node,i))r.has(e.label)||(r.add(e.label),s.push(e))}while(o.nextSibling());return bg.set(e,s),s}{let n=[],s=new Set;return e.cursor().iterate((e=>{var r;if(i(e)&&e.matchContext(wg)&&":"==(null===(r=e.node.nextSibling)||void 0===r?void 0:r.name)){let i=t.sliceString(e.from,e.to);s.has(i)||(s.add(i),n.push({label:i,type:"variable"}))}})),n}}const Sg=t=>e=>{let{state:i,pos:n}=e,s=Xa(i).resolveInner(n,-1),r=s.type.isError&&s.from==s.to-1&&"-"==i.doc.sliceString(s.from,s.to);if("PropertyName"==s.name||(r||"TagName"==s.name)&&/^(Block|Styles)$/.test(s.resolve(s.to).name))return{from:s.from,options:dg(),validFor:gg};if("ValueName"==s.name)return{from:s.from,options:pg,validFor:gg};if("PseudoClassName"==s.name)return{from:s.from,options:fg,validFor:gg};if(t(s)||(e.explicit||r)&&function(t,e){var i;if(("("==t.name||t.type.isError)&&(t=t.parent||t),"ArgList"!=t.name)return!1;let n=null===(i=t.parent)||void 0===i?void 0:i.firstChild;return"Callee"==(null==n?void 0:n.name)&&"var"==e.sliceString(n.from,n.to)}(s,i.doc))return{from:t(s)||r?s.from:n,options:yg(i.doc,vg(s),t),validFor:mg};if("TagName"==s.name){for(let{parent:t}=s;t;t=t.parent)if("Block"==t.name)return{from:s.from,options:dg(),validFor:gg};return{from:s.from,options:Og,validFor:gg}}if(!e.explicit)return null;let o=s.resolve(n),a=o.childBefore(n);return a&&":"==a.name&&"PseudoClassSelector"==o.name?{from:n,options:fg,validFor:gg}:a&&":"==a.name&&"Declaration"==o.name||"ArgList"==o.name?{from:n,options:pg,validFor:gg}:"Block"==o.name||"Styles"==o.name?{from:n,options:dg(),validFor:gg}:null},xg=Sg((t=>"VariableName"==t.name)),kg=_a.define({name:"css",parser:cg.configure({props:[Na.add({Declaration:il()}),rl.add({"Block KeyframeList":ol})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function Qg(){return new Ua(kg,kg.data.of({autocomplete:xg}))}const $g=["_blank","_self","_top","_parent"],Pg=["ascii","utf-8","utf-16","latin1","latin1"],Cg=["get","post","put","delete"],_g=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Xg=["true","false"],Zg={},Ag={a:{attrs:{href:null,ping:null,type:null,media:null,target:$g,hreflang:null}},abbr:Zg,address:Zg,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Zg,aside:Zg,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Zg,base:{attrs:{href:null,target:$g}},bdi:Zg,bdo:Zg,blockquote:{attrs:{cite:null}},body:Zg,br:Zg,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Zg,center:Zg,cite:Zg,code:Zg,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:Zg,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Zg,div:Zg,dl:Zg,dt:Zg,em:Zg,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Zg,figure:Zg,footer:Zg,form:{attrs:{action:null,name:null,"accept-charset":Pg,autocomplete:["on","off"],enctype:_g,method:Cg,novalidate:["novalidate"],target:$g}},h1:Zg,h2:Zg,h3:Zg,h4:Zg,h5:Zg,h6:Zg,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Zg,hgroup:Zg,hr:Zg,html:{attrs:{manifest:null}},i:Zg,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:Zg,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Zg,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:Zg,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Pg,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:Zg,noscript:Zg,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:Zg,param:{attrs:{name:null,value:null}},pre:Zg,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Zg,rt:Zg,ruby:Zg,samp:Zg,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Pg}},section:Zg,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Zg,source:{attrs:{src:null,type:null,media:null}},span:Zg,strong:Zg,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Zg,summary:Zg,sup:Zg,table:Zg,tbody:Zg,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Zg,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:Zg,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Zg,time:{attrs:{datetime:null}},title:Zg,tr:Zg,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Zg,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:Zg},Tg={accesskey:null,class:null,contenteditable:Xg,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Xg,autocorrect:Xg,autocapitalize:Xg,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Xg,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Xg,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Xg,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Xg,"aria-hidden":Xg,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Xg,"aria-multiselectable":Xg,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Xg,"aria-relevant":null,"aria-required":Xg,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},Rg="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map((t=>"on"+t));for(let t of Rg)Tg[t]=null;class Eg{constructor(t,e){this.tags=Object.assign(Object.assign({},Ag),t),this.globalAttrs=Object.assign(Object.assign({},Tg),e),this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}function Vg(t,e,i=t.length){if(!e)return"";let n=e.firstChild,s=n&&n.getChild("TagName");return s?t.sliceString(s.from,Math.min(s.to,i)):""}function Mg(t,e=!1){for(let i=t.parent;i;i=i.parent)if("Element"==i.name){if(!e)return i;e=!1}return null}function Dg(t,e,i){let n=i.tags[Vg(t,Mg(e,!0))];return(null==n?void 0:n.children)||i.allTags}function Wg(t,e){let i=[];for(let n=e;n=Mg(n);){let s=Vg(t,n);if(s&&"CloseTag"==n.lastChild.name)break;s&&i.indexOf(s)<0&&("EndTag"==e.name||e.from>=n.firstChild.to)&&i.push(s)}return i}Eg.default=new Eg;const Ug=/^[:\-\.\w\u00b7-\uffff]*$/;function Yg(t,e,i,n,s){let r=/\s*>/.test(t.sliceDoc(s,s+5))?"":">";return{from:n,to:s,options:Dg(t.doc,i,e).map((t=>({label:t,type:"type"}))).concat(Wg(t.doc,i).map(((t,e)=>({label:"/"+t,apply:"/"+t+r,type:"type",boost:99-e})))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function qg(t,e,i,n){let s=/\s*>/.test(t.sliceDoc(n,n+5))?"":">";return{from:i,to:n,options:Wg(t.doc,e).map(((t,e)=>({label:t,apply:t+s,type:"type",boost:99-e}))),validFor:Ug}}function Lg(t,e){let{state:i,pos:n}=e,s=Xa(i).resolveInner(n),r=s.resolve(n,-1);for(let t,e=n;s==r&&(t=r.childBefore(e));){let i=t.lastChild;if(!i||!i.type.isError||i.from({label:t,type:"property"}))),validFor:Ug}}(i,t,r,"AttributeName"==r.name?r.from:n,n):"Is"==r.name||"AttributeValue"==r.name||"UnquotedAttributeValue"==r.name?function(t,e,i,n,s){var r;let o,a=null===(r=i.parent)||void 0===r?void 0:r.getChild("AttributeName"),l=[];if(a){let r=t.sliceDoc(a.from,a.to),h=e.globalAttrs[r];if(!h){let n=Mg(i),s=n?e.tags[Vg(t.doc,n)]:null;h=(null==s?void 0:s.attrs)&&s.attrs[r]}if(h){let e=t.sliceDoc(n,s).toLowerCase(),i='"',r='"';/^['"]/.test(e)?(o='"'==e[0]?/^[^"]*$/:/^[^']*$/,i="",r=t.sliceDoc(s,s+1)==e[0]?"":e[0],e=e.slice(1),n++):o=/^[^\s<>='"]*$/;for(let t of h)l.push({label:t,apply:i+t+r,type:"constant"})}}return{from:n,to:s,options:l,validFor:o}}(i,t,r,"Is"==r.name?n:r.from,n):!e.explicit||"Element"!=s.name&&"Text"!=s.name&&"Document"!=s.name?null:function(t,e,i,n){let s=[],r=0;for(let n of Dg(t.doc,i,e))s.push({label:"<"+n,type:"type"});for(let e of Wg(t.doc,i))s.push({label:"",type:"type",boost:99-r++});return{from:n,to:n,options:s,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}(i,t,r,n)}function zg(t){let{extraTags:e,extraGlobalAttributes:i}=t,n=i||e?new Eg(e,i):Eg.default;return t=>Lg(n,t)}const Ig=[{tag:"script",attrs:t=>"text/typescript"==t.type||"ts"==t.lang,parser:zf.parser},{tag:"script",attrs:t=>"text/babel"==t.type||"text/jsx"==t.type,parser:If.parser},{tag:"script",attrs:t=>"text/typescript-jsx"==t.type,parser:Bf.parser},{tag:"script",attrs:t=>!t.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(t.type),parser:qf.parser},{tag:"style",attrs:t=>(!t.lang||"css"==t.lang)&&(!t.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(t.type)),parser:kg.parser}],Bg=[{name:"style",parser:kg.parser.configure({top:"Styles"})}].concat(Rg.map((t=>({name:t,parser:qf.parser})))),jg=_a.define({name:"html",parser:FO.configure({props:[Na.add({Element(t){let e=/^(\s*)(<\/)?/.exec(t.textAfter);return t.node.to<=t.pos+e[0].length?t.continue():t.lineIndent(t.node.from)+(e[2]?0:t.unit)},"OpenTag CloseTag SelfClosingTag":t=>t.column(t.node.from)+t.unit,Document(t){if(t.pos+/\s*/.exec(t.textAfter)[0].lengtht.getChild("TagName")})],wrap:tg(Ig,Bg)}),languageData:{commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-._"}});function Ng(t={}){let e,i="";!1===t.matchClosingTags&&(i="noMatch"),!0===t.selfClosingTags&&(i=(i?i+" ":"")+"selfClosing"),(t.nestedLanguages&&t.nestedLanguages.length||t.nestedAttributes&&t.nestedAttributes.length)&&(e=tg((t.nestedLanguages||[]).concat(Ig),(t.nestedAttributes||[]).concat(Bg)));let n=e||i?jg.configure({dialect:i,wrap:e}):jg;return new Ua(n,[jg.data.of({autocomplete:zg(t)}),!1!==t.autoCloseTags?Fg:[],Nf().support,Qg().support])}const Gg=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),Fg=Ts.inputHandler.of(((t,e,i,n)=>{if(t.composing||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!jg.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((e=>{var i,r,o;let a,{head:l}=e,h=Xa(s).resolveInner(l,-1);if("TagName"!=h.name&&"StartTag"!=h.name||(h=h.parent),">"==n&&"OpenTag"==h.name){if("CloseTag"!=(null===(r=null===(i=h.parent)||void 0===i?void 0:i.lastChild)||void 0===r?void 0:r.name)&&(a=Vg(s.doc,h.parent,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`${e?"":">"}`;return{range:A.cursor(l+1),changes:{from:l+(e?1:0),insert:i}}}}else if("/"==n&&"OpenTag"==h.name){let e=h.parent,i=null==e?void 0:e.parent;if(e.from==l-1&&"CloseTag"!=(null===(o=i.lastChild)||void 0===o?void 0:o.name)&&(a=Vg(s.doc,i,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`/${a}${e?"":">"}`,n=l+i.length+(e?1:0);return{range:A.cursor(n),changes:{from:l,insert:i}}}}return{range:e}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)})),Hg=Qa({commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}}}),Jg=new ho,Kg=sO.configure({props:[rl.add((t=>!t.is("Block")||t.is("Document")||null!=tm(t)?void 0:(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to}))),Jg.add(tm),Na.add({Document:()=>null}),ka.add({Document:Hg})]});function tm(t){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(t.name);return e?+e[1]:void 0}function em(t,e){let i=t;for(;;){let t,n=i.nextSibling;if(!n||null!=(t=tm(n.type))&&t<=e)break;i=n}return i.to}const im=sl.of(((t,e,i)=>{for(let n=Xa(t).resolveInner(i,-1);n&&!(n.fromi)return{from:i,to:e}}return null}));function nm(t){return new Pa(Hg,t,[im],"markdown")}const sm=nm(Kg),rm=nm(Kg.configure([pO,mO,gO,bO]));class om{constructor(t,e,i,n,s,r,o){this.node=t,this.from=e,this.to=i,this.spaceBefore=n,this.spaceAfter=s,this.type=r,this.item=o}blank(t,e=!0){let i=this.spaceBefore+("Blockquote"==this.node.name?">":"");if(null!=t){for(;i.length0;t--)i+=" ";return i+(e?this.spaceAfter:"")}marker(t,e){let i="OrderedList"==this.node.name?String(+lm(this.item,t)[2]+e):"";return this.spaceBefore+i+this.type+this.spaceAfter}}function am(t,e){let i=[];for(let e=t;e&&"Document"!=e.name;e=e.parent)"ListItem"!=e.name&&"Blockquote"!=e.name&&"FencedCode"!=e.name||i.push(e);let n=[];for(let t=i.length-1;t>=0;t--){let s,r=i[t],o=e.lineAt(r.from),a=r.from-o.from;if("FencedCode"==r.name)n.push(new om(r,a,a,"","","",null));else if("Blockquote"==r.name&&(s=/^[ \t]*>( ?)/.exec(o.text.slice(a))))n.push(new om(r,a,a+s[0].length,"",s[1],">",null));else if("ListItem"==r.name&&"OrderedList"==r.parent.name&&(s=/^([ \t]*)\d+([.)])([ \t]*)/.exec(o.text.slice(a)))){let t=s[3],e=s[0].length;t.length>=4&&(t=t.slice(0,t.length-4),e-=4),n.push(new om(r.parent,a,a+e,s[1],t,s[2],r))}else if("ListItem"==r.name&&"BulletList"==r.parent.name&&(s=/^([ \t]*)([-+*])([ \t]{1,4}\[[ xX]\])?([ \t]+)/.exec(o.text.slice(a)))){let t=s[4],e=s[0].length;t.length>4&&(t=t.slice(0,t.length-4),e-=4);let i=s[2];s[3]&&(i+=s[3].replace(/[xX]/," ")),n.push(new om(r.parent,a,a+e,s[1],t,i,r))}}return n}function lm(t,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(t.from,t.from+10))}function hm(t,e,i,n=0){for(let s=-1,r=t;;){if("ListItem"==r.name){let t=lm(r,e),o=+t[2];if(s>=0){if(o!=s+1)return;i.push({from:r.from+t[1].length,to:r.from+t[0].length,insert:String(s+2+n)})}s=o}let t=r.nextSibling;if(!t)break;r=t}}function cm(t){return"QuoteMark"==t.name||"ListMark"==t.name}const um=[{key:"Enter",run:({state:t,dispatch:e})=>{let i=Xa(t),{doc:n}=t,s=null,r=t.changeByRange((e=>{if(!e.empty||!rm.isActiveAt(t,e.from))return s={range:e};let r=e.from,o=n.lineAt(r),a=am(i.resolveInner(r,-1),n);for(;a.length&&a[a.length-1].from>r-o.from;)a.pop();if(!a.length)return s={range:e};let l=a[a.length-1];if(l.to-l.spaceAfter.length>r-o.from)return s={range:e};let h=r>=l.to-l.spaceAfter.length&&!/\S/.test(o.text.slice(l.to));if(l.item&&h){if(l.node.firstChild.to>=r||o.from>0&&!/[^\s>]/.test(n.lineAt(o.from-1).text)){let t,e=a.length>1?a[a.length-2]:null,i="";e&&e.item?(t=o.from+e.from,i=e.marker(n,1)):t=o.from+(e?e.to:0);let s=[{from:t,to:r,insert:i}];return"OrderedList"==l.node.name&&hm(l.item,n,s,-2),e&&"OrderedList"==e.node.name&&hm(e.item,n,s),{range:A.cursor(t+i.length),changes:s}}{let e="";for(let t=0,i=a.length-2;t<=i;t++)e+=a[t].blank(t\s*$/.exec(i.text);if(s&&s.index==l.from){let n=t.changes([{from:i.from+s.index,to:i.to},{from:o.from+l.from,to:o.to}]);return{range:e.map(n),changes:n}}}let c=[];"OrderedList"==l.node.name&&hm(l.item,n,c);let u=l.item&&l.item.from]*/.exec(o.text)[0].length>=l.to)for(let t=0,e=a.length-1;t<=e;t++)d+=t!=e||u?a[t].blank(to.from&&/\s/.test(o.text.charAt(f-o.from-1));)f--;return d=t.lineBreak+d,c.push({from:f,to:r,insert:d}),{range:A.cursor(f+d.length),changes:c}}));return!s&&(e(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0)}},{key:"Backspace",run:({state:t,dispatch:e})=>{let i=Xa(t),n=null,s=t.changeByRange((e=>{let s=e.from,{doc:r}=t;if(e.empty&&rm.isActiveAt(t,e.from)){let t=r.lineAt(s),n=am(function(t,e){let i=t.resolveInner(e,-1),n=e;cm(i)&&(n=i.from,i=i.parent);for(let t;t=i.childBefore(n);)if(cm(t))n=t.from;else{if("OrderedList"!=t.name&&"BulletList"!=t.name)break;i=t.lastChild,n=i.to}return i}(i,s),r);if(n.length){let i=n[n.length-1],r=i.to-i.spaceAfter.length+(i.spaceAfter?1:0);if(s-t.from>r&&!/\S/.test(t.text.slice(r,s-t.from)))return{range:A.cursor(t.from+r),changes:{from:t.from+r,to:s}};if(s-t.from==r&&(!i.item||t.from<=i.item.from||!/\S/.test(t.text.slice(0,i.to)))){let n=t.from+i.from;if(i.item&&i.node.fromt.from-e.from||t.startSide-e.startSide)),ni.set(i)}getMatchingBracket(t){switch(t){case")":return"(";case"]":return"[";case"}":return"{";default:return null}}},{decorations:t=>t.decorations});var fm="[a-zA-Z\\$][a-zA-Z0-9\\$]*",pm="(?:\\.\\d+|\\d+\\.\\d*|\\d+)",Om="(?:`(?:`?"+pm+")?)",gm=new RegExp("(?:(?:\\d+)(?:\\^\\^(?:\\.\\w+|\\w+\\.\\w*|\\w+)"+Om+"?(?:\\*\\^[+-]?\\d+)?))"),mm=new RegExp("(?:"+pm+Om+"?(?:\\*\\^[+-]?\\d+)?)"),bm=new RegExp("(?:`?)(?:"+fm+")(?:`(?:"+fm+"))*(?:`?)");let wm=[];const vm=["True","False","All","None","Null","Full","$Failed","$Aborted"];function ym(t,e){var i;return'"'===(i=t.next())?(e.tokenize=Sm,e.tokenize(t,e)):"("===i&&t.eat("*")?(e.commentLevel++,e.tokenize=xm,e.tokenize(t,e)):(t.backUp(1),t.match(gm,!0,!1)||t.match(mm,!0,!1)?"number":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::usage)/,!0,!1)?"meta":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::[a-zA-Z\$][a-zA-Z0-9\$]*):?/,!0,!1)?"string.special":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*\s*:)(?:(?:[a-zA-Z\$][a-zA-Z0-9\$]*)|(?:[^:=>~@\^\&\*\)\[\]'\?,\|])).*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+/,!0,!1)||t.match(/_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)?"variableName.special":t.match(/\\\[[a-zA-Z\$][a-zA-Z0-9\$]*\]/,!0,!1)?"character":t.match(/(?:\[|\]|{|}|\(|\))/,!0,!1)?"bracket":t.match(/(?:#[a-zA-Z\$][a-zA-Z0-9\$]*|#+[0-9]?)/,!0,!1)?"variableName.constant":t.match(bm,!0,!1)?vm.indexOf(t.current())>-1?"number":wm.indexOf(t.current())>-1||0==wm.length?"keyword":t.current()in e.localVars?"atom":(e.localVars[t.current()]=!0,"function"):t.match(/(?:\\|\+|\-|\*|\/|,|;|\.|:|@|~|=|>|<|&|\||_|`|'|\^|\?|!|%)/,!0,!1)?"operator":(t.next(),"error"))}function Sm(t,e){for(var i,n=!1,s=!1;null!=(i=t.next());){if('"'===i&&!s){n=!0;break}s=!s&&"\\"===i}return n&&!s&&(e.tokenize=ym),"string"}function xm(t,e){for(var i,n;e.commentLevel>0&&null!=(n=t.next());)"("===i&&"*"===n&&e.commentLevel++,"*"===i&&")"===n&&e.commentLevel--,i=n;return e.commentLevel<=0&&(e.tokenize=ym),"comment"}const km={name:"mathematica",extendVariables:function(t){},startState:function(){return{tokenize:ym,commentLevel:0,localVars:{}}},token:function(t,e){return t.eatSpace()?null:e.tokenize(t,e)},languageData:{commentTokens:{block:{open:"(*",close:"*)"}}}};let Qm={of:t=>[Gl.define(km),Yd({override:[async e=>function(t,e){let i=t.matchBefore(/\w*/);return i.from!==i.to||t.explicit?{from:i.from,options:e.data}:null}(e,t)]}),Ys.of([{key:"Escape",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((t=>{let{from:e,to:i}=t;return{changes:{from:e,to:i,insert:"EC"},range:A.cursor(e+2)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])],reBuild:t=>{wm=t.map((t=>t.label))}};const $m=(t,e,i,n)=>{if(0==t.length)return;const s=(new Date).valueOf();n.transaction(e,i,s,t.length);for(const r of t)Pm(r,((t,r)=>{n.file(e,i,s,t,r)}))};function Pm(t,e){const i=new FileReader;i.addEventListener("load",(i=>{let n=base64ArrayBuffer(i.target.result);e(t.name,n)})),i.addEventListener("progress",(t=>{if(t.loaded&&t.total){const e=t.loaded/t.total*100;console.log(e)}})),i.readAsArrayBuffer(t)}const Cm=(t,e)=>Ts.domEventHandlers({drop(e,i){e.preventDefault();const n=[];e.dataTransfer.items?[...e.dataTransfer.items].forEach(((t,e)=>{if("file"===t.kind){const i=t.getAsFile();console.log(`… file[${e}].name = ${i.name}`),n.push(i)}})):[...e.dataTransfer.files].forEach(((t,e)=>{console.log(`… file[${e}].name = ${t.name}`),n.push(t)})),$m(n,e,i,t)},paste(t,i){let n=t.clipboardData||window.clipboardData;for(const s of n.items)if("string"===s.kind)switch(s.type){case"text/plain":break;case"image/png":t.preventDefault(),$m([s.getAsFile()],t,i,e)}else t.preventDefault(),$m([s.getAsFile()],t,i,e)}}),_m=new pr({regexp:/\\\[(\w+)\]/g,decoration:t=>ni.replace({widget:new Zm(t[1])})}),Xm=_i.fromClass(class{constructor(t){this.Greekholder=_m.createDeco(t)}update(t){this.Greekholder=_m.updateDeco(t,this.Greekholder)}},{decorations:t=>t.Greekholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Greekholder||ni.none))});class Zm extends ei{constructor(t){super(),this.name=t}eq(t){return this.name===t.name}toDOM(){let t=document.createElement("span");return t.innerHTML="&"+this.name.toLowerCase().replace("sqrt","radic").replace("undirectededge","harr").replace("directededge","rarr").replace(/capital(.*)/,((t,e)=>e.charAt(0).toUpperCase()+e.slice(1))).replace(/curly(.*)/,((t,e)=>e)).replace(/script(.*)/,((t,e)=>"el"+e.toLowerCase())).replace("transpose","#7488").replace("degree","deg")+";",t}ignoreEvent(){return!1}}const Am=new pr({regexp:/(->|<-)/g,decoration:t=>ni.replace({widget:new Tm(t[1])})});_i.fromClass(class{constructor(t){this.Arrowholder=Am.createDeco(t)}update(t){this.Arrowholder=Am.updateDeco(t,this.Arrowholder)}},{decorations:t=>t.Arrowholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Arrowholder||ni.none))});class Tm extends ei{constructor(t){super(),this.dir=t}eq(t){return this.dir===t.dir}toDOM(){let t=document.createElement("span");return"->"===this.dir?t.innerText="→":t.innerText="←",t}ignoreEvent(){return!1}}function Rm(t){if(!(t=t||{}).open)throw new Error('Balanced: please provide a "open" property');if(!t.close)throw new Error('Balanced: please provide a "close" property');if(this.balance=t.balance||!1,this.exceptions=t.exceptions||!1,this.caseInsensitive=t.caseInsensitive,this.head=t.head||t.open,this.head=Array.isArray(this.head)?this.head:[this.head],this.open=Array.isArray(t.open)?t.open:[t.open],this.close=Array.isArray(t.close)?t.close:[t.close],!Array.isArray(this.head)||!Array.isArray(this.open)||!Array.isArray(this.close)||this.head.length!==this.open.length||this.open.length!==this.close.length)throw new Error('Balanced: if you use arrays for a "head,open,close" you must use matching arrays for all options');var e=Dm(this.head.map(this.regExpFromArrayGroupedMap,this)),i=Dm(this.open.map(this.regExpFromArrayGroupedMap,this)),n=Dm(this.close.map(this.regExpFromArrayGroupedMap,this));this.regExp=Dm([e,i,n],"g"+(this.caseInsensitive?"i":"")),this.regExpGroupLength=this.head.length}function Em(t,e,i){for(var n=Mm(e.substr(0,i+1),/^.*\n?$/gim),s=Mm(e,/^.*\n?$/gim),r=n.length-1,o=i+1-(n.length?n[n.length-1].index:0),a="",l=2;l>=0;l--)r-l>=0&&s[r-l]&&(a+=e.substr(s[r-l].index,s[r-l].length)+"\n");for(l=0;l=0&&s[r+l]&&(a+=e.substr(s[r+l].index,s[r+l].length)+"\n");a=a.replace(/\t/g," ").replace(/\n$/,"");var h=new Error(t+" at "+(r+1)+":"+o+"\n\n"+a);return h.line=r+1,h.column=o,h.index=i,h}function Vm(t,e){return t>=e.index&&t<=e.index+e.length-1}function Mm(t,e){var i,n=new RegExp(e),s=[];if(t)for(;i=n.exec(t);)s.push({index:i.index,length:i[0].length,match:i[0]}),i[0].length||n.lastIndex++;return s}function Dm(t,e,i){var n=t.map((function(t){return t instanceof RegExp?t.source:function(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}(t)}),this).join("|");return n=i?"("+n+")":"(?:"+n+")",new RegExp(n,e||void 0)}Rm.prototype={regExpFromArrayGroupedMap:function(t){return Dm([t],null,!0)},matchContentsInBetweenBrackets:function(t,e){for(var i,n=new RegExp(this.regExp),s=[],r=[],o=null,a=!0;i=n.exec(t);){if(e){for(var l=!1,h=0;h{const i=((t,e,i)=>{var n,s=new RegExp(t),r=[];if(e)for(;n=s.exec(e);){if(i){for(var o=!1,a=0;a{new qm({open:"(*"+t+"[*)",close:"(*]"+t+"*)",balance:!1}).matchContentsInBetweenBrackets(e.value,[]).forEach((function(t){const s=e.value.slice(t.index+t.head.length,t.index+t.length-t.tail.length);n(i+t.index,{length:t.length,pos:i+t.index,argsPos:i+t.index+t.head.length,str:s})}))})(e,t,i,s)},o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)r(o,a)}var Im,Bm=function(){function t(t){var e=t.tag,i=t.decoration,n=t.decorate,s=t.boundary,r=t.maxLength,o=void 0===r?1e3:r;if(this.tag=e,n)this.addMatch=function(t,e,i,s){return n(s,i,i+t.length,t,e)};else if("function"==typeof i)this.addMatch=function(t,e,n,s){var r=i(t,e,n);r&&s(n,n+t.length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=function(t,e,n,s){return s(n,n+t.length,i)}}this.boundary=s,this.maxLength=o}return t.prototype.createDeco=function(t){for(var e=this,i=new Xt,n=i.add.bind(i),s=0,r=function(t,e){var i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;for(var n=[],s=0,r=i;s=a?n[n.length-1].to=l:n.push({from:a,to:l})}return n}(t,this.maxLength);st.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e},t.prototype.updateRange=function(t,e,i,n){for(var s=this,r=function(r){var a=Math.max(r.from,i),l=Math.min(r.to,n);if(l>a){var h=t.state.doc.lineAt(a),c=h.toh.from;a--)if(o.boundary.test(h.text[a-1-h.from])){u=a;break}for(;ld},add:f})}},o=this,a=0,l=t.visibleRanges;a{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*FB[*)((_)(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*FB[*)(("+s+")(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let Nm=class{constructor(t,e,i,n,s,r){this.view=e,this.visibleValue=t,this.placeholder=r,console.log(r),this.args=Lm(t.str,/\(\*,\*\)/gm);const o=this;let a,l;console.log("creating InstanceWidget"),a=Im({doc:o.args[0].body.slice(2,-1),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(o.visibleValue.pos),e.dispatch({selection:{anchor:o.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return l.dispatch({selection:{anchor:0}}),l.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){l.focus(),t.editorLastCursor=void 0}}])]}),l=Im({doc:o.args[2].body.slice(1,-2),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:a.state.doc.length}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:o.visibleValue.pos+o.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus(),t.editorLastCursor=void 0}}])]}),o.args[0].length=o.args[0].body.length,o.args[2].length=o.args[2].body.length,delete o.args[2].body,delete o.args[1].body,delete o.args[0].body,this.topEditor=a,this.bottomEditor=l}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="(("+t+")",s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length));const r=e.length-i[0].length;i[0].to=i[0].to+r,i[2].from=i[2].from+r,i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e="("+t+"))",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length));const r=e.length-i[2].length;i[2].to=i[2].to+r,i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t,e){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm),console.log("recreating InstanceWidget"),n=Im.state({doc:e.args[0].body.slice(2,-1),update:t=>e.applyChanges(t,0),eval:()=>{i.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(e.visibleValue.pos),i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus(),t.editorLastCursor=void 0}}])]}),s=Im.state({doc:e.args[2].body.slice(1,-2),update:t=>e.applyChanges(t,2),eval:()=>{e.view.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus(),t.editorLastCursor=void 0}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),console.log(e),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.placeholder=e,this.visibleValue.argsPos=t.argsPos}destroy(){this.topEditor.destroy(),this.bottomEditor.destroy()}},Gm=class extends ei{constructor(t,e,i,n){super(),this.view=i,this.visibleValue=t,this.reference=e,this.placeholder=n}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue,this),!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("fraction");const i=document.createElement("table");i.classList.add("container"),e.appendChild(i);const n=document.createElement("tbody");i.appendChild(n);const s=document.createElement("tr"),r=document.createElement("tr");n.appendChild(s),n.appendChild(r);const o=document.createElement("td");o.classList.add("enumenator"),s.appendChild(o);const a=document.createElement("td");r.appendChild(a);const l=this;return e.EditorWidget=new Nm(this.visibleValue,t,o,a,[],this),this.DOMElement=e,this.reference.push({destroy:()=>{l.destroy(e)}}),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const Fm=(t,e,i)=>new Bm({tag:"FB",decoration:n=>ni.replace({widget:new Gm(n,t,e,i)})}),Hm=t=>_i.fromClass(class{constructor(e){this.disposable=[],this.placeholder=Fm(this.disposable,e,this).createDeco(e),t.placeholder=this}update(t){this.placeholder=Fm(this.disposable,t,this).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var Jm;function Km(t){return Jm=t,[nb,Ys.of([{key:"Ctrl-2",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt[_](*]SqB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt["+s+"](*]SqB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let tb=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;this.sliceRanges=n,this.length=t.str.length,console.log("creating InstanceWidget"),this.editor=Jm({doc:t.str.slice(...n),parent:i,update:t=>r.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]})}applyChanges(t){const e=t,i={from:this.visibleValue.argsPos+5,to:this.visibleValue.argsPos+this.length-1,insert:e};console.log(this.visibleValue);const n=e.length+6-this.length;this.length=this.length+n,this.visibleValue.length=this.visibleValue.length+n,this.visibleValue.str="Sqrt["+e+"]",this.view.dispatch({changes:i})}update(t){if(this.visibleValue.str==t.str)this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos;else{console.warn("Out of sync"),this.visibleValue=t;const e=this.sliceRanges,i=this.editor,n=this,s=this.view;this.length=t.str.length;const r=Jm.state({doc:t.str.slice(...e),update:t=>n.applyChanges(t),eval:()=>{s.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos+n.visibleValue.length}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]});i.setState(r)}}destroy(){console.warn("destroy Instance of Widget!"),this.editor.destroy()}},eb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("sqroot");const i=this,n=document.createElement("span");return n.classList.add("radicand"),e.EditorWidget=new tb(this.visibleValue,t,n,[5,-1],[]),e.appendChild(n),this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const ib=(t,e)=>new Bm({tag:"SqB",decoration:i=>ni.replace({widget:new eb(i,t,e)})}),nb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=ib(this.disposable,t).createDeco(t)}update(t){this.placeholder=ib(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var sb;function rb(t){return sb=t,[hb,Ys.of([{key:"Ctrl--",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SbB[*)Subscript[_(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SbB[*)Subscript["+s+"(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let ob=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),console.log(r.visibleValue),o=sb({doc:r.args[0].body.slice(10),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){a.focus()}}])]}),a=sb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Subscript["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),console.log(e.visibleValue),n=sb.state({doc:e.args[0].body.slice(10),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus()}}])]}),s=sb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},ab=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sub");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new ob(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const lb=(t,e)=>new Bm({tag:"SbB",decoration:i=>ni.replace({widget:new ab(i,t,e)})}),hb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=lb(this.disposable,t).createDeco(t)}update(t){this.placeholder=lb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var cb;function ub(t){return cb=t,[Ob,Ys.of([{key:"Ctrl-6",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SpB[*)Power[_(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SpB[*)Power["+s+"(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let db=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),o=cb({doc:r.args[0].body.slice(6),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus()}}])]}),a=cb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Power["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),n=cb.state({doc:e.args[0].body.slice(6),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.bottomEditor.focus()}}])]}),s=cb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},fb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sup");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new db(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}destroy(t){t.EditorWidget.destroy()}};const pb=(t,e)=>new Bm({tag:"SpB",decoration:i=>ni.replace({widget:new fb(i,t,e)})}),Ob=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=pb(this.disposable,t).createDeco(t)}update(t){this.placeholder=pb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var gb={},mb={},bb={},wb={};function vb(t){let e=t.length;for(;--e>=0;)t[e]=0}const yb=256,Sb=286,xb=30,kb=15,Qb=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),$b=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Pb=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Cb=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_b=new Array(576);vb(_b);const Xb=new Array(60);vb(Xb);const Zb=new Array(512);vb(Zb);const Ab=new Array(256);vb(Ab);const Tb=new Array(29);vb(Tb);const Rb=new Array(xb);function Eb(t,e,i,n,s){this.static_tree=t,this.extra_bits=e,this.extra_base=i,this.elems=n,this.max_length=s,this.has_stree=t&&t.length}let Vb,Mb,Db;function Wb(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}vb(Rb);const Ub=t=>t<256?Zb[t]:Zb[256+(t>>>7)],Yb=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},qb=(t,e,i)=>{t.bi_valid>16-i?(t.bi_buf|=e<>16-t.bi_valid,t.bi_valid+=i-16):(t.bi_buf|=e<{qb(t,i[2*e],i[2*e+1])},zb=(t,e)=>{let i=0;do{i|=1&t,t>>>=1,i<<=1}while(--e>0);return i>>>1},Ib=(t,e,i)=>{const n=new Array(16);let s,r,o=0;for(s=1;s<=kb;s++)o=o+i[s-1]<<1,n[s]=o;for(r=0;r<=e;r++){let e=t[2*r+1];0!==e&&(t[2*r]=zb(n[e]++,e))}},Bb=t=>{let e;for(e=0;e{t.bi_valid>8?Yb(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},Nb=(t,e,i,n)=>{const s=2*e,r=2*i;return t[s]{const n=t.heap[i];let s=i<<1;for(;s<=t.heap_len&&(s{let n,s,r,o,a=0;if(0!==t.sym_next)do{n=255&t.pending_buf[t.sym_buf+a++],n+=(255&t.pending_buf[t.sym_buf+a++])<<8,s=t.pending_buf[t.sym_buf+a++],0===n?Lb(t,s,e):(r=Ab[s],Lb(t,r+yb+1,e),o=Qb[r],0!==o&&(s-=Tb[r],qb(t,s,o)),n--,r=Ub(n),Lb(t,r,i),o=$b[r],0!==o&&(n-=Rb[r],qb(t,n,o)))}while(a{const i=e.dyn_tree,n=e.stat_desc.static_tree,s=e.stat_desc.has_stree,r=e.stat_desc.elems;let o,a,l,h=-1;for(t.heap_len=0,t.heap_max=573,o=0;o>1;o>=1;o--)Gb(t,i,o);l=r;do{o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Gb(t,i,1),a=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=a,i[2*l]=i[2*o]+i[2*a],t.depth[l]=(t.depth[o]>=t.depth[a]?t.depth[o]:t.depth[a])+1,i[2*o+1]=i[2*a+1]=l,t.heap[1]=l++,Gb(t,i,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const i=e.dyn_tree,n=e.max_code,s=e.stat_desc.static_tree,r=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,l=e.stat_desc.max_length;let h,c,u,d,f,p,O=0;for(d=0;d<=kb;d++)t.bl_count[d]=0;for(i[2*t.heap[t.heap_max]+1]=0,h=t.heap_max+1;h<573;h++)c=t.heap[h],d=i[2*i[2*c+1]+1]+1,d>l&&(d=l,O++),i[2*c+1]=d,c>n||(t.bl_count[d]++,f=0,c>=a&&(f=o[c-a]),p=i[2*c],t.opt_len+=p*(d+f),r&&(t.static_len+=p*(s[2*c+1]+f)));if(0!==O){do{for(d=l-1;0===t.bl_count[d];)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[l]--,O-=2}while(O>0);for(d=l;0!==d;d--)for(c=t.bl_count[d];0!==c;)u=t.heap[--h],u>n||(i[2*u+1]!==d&&(t.opt_len+=(d-i[2*u+1])*i[2*u],i[2*u+1]=d),c--)}})(t,e),Ib(i,h,t.bl_count)},Jb=(t,e,i)=>{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),e[2*(i+1)+1]=65535,n=0;n<=i;n++)s=o,o=e[2*(n+1)+1],++a{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),n=0;n<=i;n++)if(s=o,o=e[2*(n+1)+1],!(++a{qb(t,0+(n?1:0),3),jb(t),Yb(t,i),Yb(t,~i),i&&t.pending_buf.set(t.window.subarray(e,e+i),t.pending),t.pending+=i};wb._tr_init=t=>{tw||((()=>{let t,e,i,n,s;const r=new Array(16);for(i=0,n=0;n<28;n++)for(Tb[n]=i,t=0;t<1<>=7;n{let s,r,o=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e{let e;for(Jb(t,t.dyn_ltree,t.l_desc.max_code),Jb(t,t.dyn_dtree,t.d_desc.max_code),Hb(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*Cb[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=i+5,i+4<=s&&-1!==e?ew(t,e,i,n):4===t.strategy||r===s?(qb(t,2+(n?1:0),3),Fb(t,_b,Xb)):(qb(t,4+(n?1:0),3),((t,e,i,n)=>{let s;for(qb(t,e-257,5),qb(t,i-1,5),qb(t,n-4,4),s=0;s(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=i,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(Ab[i]+yb+1)]++,t.dyn_dtree[2*Ub(e)]++),t.sym_next===t.sym_end),wb._tr_align=t=>{qb(t,2,3),Lb(t,256,_b),(t=>{16===t.bi_valid?(Yb(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)};var iw=(t,e,i,n)=>{let s=65535&t|0,r=t>>>16&65535|0,o=0;for(;0!==i;){o=i>2e3?2e3:i,i-=o;do{s=s+e[n++]|0,r=r+s|0}while(--o);s%=65521,r%=65521}return s|r<<16|0};const nw=new Uint32Array((()=>{let t,e=[];for(var i=0;i<256;i++){t=i;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e})());var sw=(t,e,i,n)=>{const s=nw,r=n+i;t^=-1;for(let i=n;i>>8^s[255&(t^e[i])];return-1^t},rw={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},ow={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:aw,_tr_stored_block:lw,_tr_flush_block:hw,_tr_tally:cw,_tr_align:uw}=wb,dw=iw,fw=sw,pw=rw,{Z_NO_FLUSH:Ow,Z_PARTIAL_FLUSH:gw,Z_FULL_FLUSH:mw,Z_FINISH:bw,Z_BLOCK:ww,Z_OK:vw,Z_STREAM_END:yw,Z_STREAM_ERROR:Sw,Z_DATA_ERROR:xw,Z_BUF_ERROR:kw,Z_DEFAULT_COMPRESSION:Qw,Z_FILTERED:$w,Z_HUFFMAN_ONLY:Pw,Z_RLE:Cw,Z_FIXED:_w,Z_DEFAULT_STRATEGY:Xw,Z_UNKNOWN:Zw,Z_DEFLATED:Aw}=ow,Tw=258,Rw=262,Ew=42,Vw=113,Mw=666,Dw=(t,e)=>(t.msg=pw[e],e),Ww=t=>2*t-(t>4?9:0),Uw=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Yw=t=>{let e,i,n,s=t.w_size;e=t.hash_size,n=e;do{i=t.head[--n],t.head[n]=i>=s?i-s:0}while(--e);e=s,n=e;do{i=t.prev[--n],t.prev[n]=i>=s?i-s:0}while(--e)};let qw=(t,e,i)=>(e<{const e=t.state;let i=e.pending;i>t.avail_out&&(i=t.avail_out),0!==i&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+i),t.next_out),t.next_out+=i,e.pending_out+=i,t.total_out+=i,t.avail_out-=i,e.pending-=i,0===e.pending&&(e.pending_out=0))},zw=(t,e)=>{hw(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Lw(t.strm)},Iw=(t,e)=>{t.pending_buf[t.pending++]=e},Bw=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},jw=(t,e,i,n)=>{let s=t.avail_in;return s>n&&(s=n),0===s?0:(t.avail_in-=s,e.set(t.input.subarray(t.next_in,t.next_in+s),i),1===t.state.wrap?t.adler=dw(t.adler,e,s,i):2===t.state.wrap&&(t.adler=fw(t.adler,e,s,i)),t.next_in+=s,t.total_in+=s,s)},Nw=(t,e)=>{let i,n,s=t.max_chain_length,r=t.strstart,o=t.prev_length,a=t.nice_match;const l=t.strstart>t.w_size-Rw?t.strstart-(t.w_size-Rw):0,h=t.window,c=t.w_mask,u=t.prev,d=t.strstart+Tw;let f=h[r+o-1],p=h[r+o];t.prev_length>=t.good_match&&(s>>=2),a>t.lookahead&&(a=t.lookahead);do{if(i=e,h[i+o]===p&&h[i+o-1]===f&&h[i]===h[r]&&h[++i]===h[r+1]){r+=2,i++;do{}while(h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&ro){if(t.match_start=e,o=n,n>=a)break;f=h[r+o-1],p=h[r+o]}}}while((e=u[e&c])>l&&0!=--s);return o<=t.lookahead?o:t.lookahead},Gw=t=>{const e=t.w_size;let i,n,s;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Rw)&&(t.window.set(t.window.subarray(e,e+e-n),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Yw(t),n+=e),0===t.strm.avail_in)break;if(i=jw(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=i,t.lookahead+t.insert>=3)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=qw(t,t.ins_h,t.window[s+1]);t.insert&&(t.ins_h=qw(t,t.ins_h,t.window[s+3-1]),t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead{let i,n,s,r=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,o=0,a=t.strm.avail_in;do{if(i=65535,s=t.bi_valid+42>>3,t.strm.avail_outn+t.strm.avail_in&&(i=n+t.strm.avail_in),i>s&&(i=s),i>8,t.pending_buf[t.pending-2]=~i,t.pending_buf[t.pending-1]=~i>>8,Lw(t.strm),n&&(n>i&&(n=i),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+n),t.strm.next_out),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n,t.block_start+=n,i-=n),i&&(jw(t.strm,t.strm.output,t.strm.next_out,i),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i)}while(0===o);return a-=t.strm.avail_in,a&&(a>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=a&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-a,t.strm.next_in),t.strstart),t.strstart+=a,t.insert+=a>t.w_size-t.insert?t.w_size-t.insert:a),t.block_start=t.strstart),t.high_waters&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,s+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),s>t.strm.avail_in&&(s=t.strm.avail_in),s&&(jw(t.strm,t.window,t.strstart,s),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.high_water>3,s=t.pending_buf_size-s>65535?65535:t.pending_buf_size-s,r=s>t.w_size?t.w_size:s,n=t.strstart-t.block_start,(n>=r||(n||e===bw)&&e!==Ow&&0===t.strm.avail_in&&n<=s)&&(i=n>s?s:n,o=e===bw&&0===t.strm.avail_in&&i===n?1:0,lw(t,t.block_start,i,o),t.block_start+=i,Lw(t.strm)),o?3:1)},Hw=(t,e)=>{let i,n;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==i&&t.strstart-i<=t.w_size-Rw&&(t.match_length=Nw(t,i)),t.match_length>=3)if(n=cw(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=qw(t,t.ins_h,t.window[t.strstart+1]);else n=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2},Jw=(t,e)=>{let i,n,s;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==i&&t.prev_length4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){s=t.strstart+t.lookahead-3,n=cw(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=s&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(zw(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(n=cw(t,0,t.window[t.strstart-1]),n&&zw(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=cw(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2};function Kw(t,e,i,n,s){this.good_length=t,this.max_lazy=e,this.nice_length=i,this.max_chain=n,this.func=s}const tv=[new Kw(0,0,0,0,Fw),new Kw(4,4,8,4,Hw),new Kw(4,5,16,8,Hw),new Kw(4,6,32,32,Hw),new Kw(4,4,16,16,Jw),new Kw(8,16,32,32,Jw),new Kw(8,16,128,128,Jw),new Kw(8,32,128,256,Jw),new Kw(32,128,258,1024,Jw),new Kw(32,258,258,4096,Jw)];function ev(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Aw,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Uw(this.dyn_ltree),Uw(this.dyn_dtree),Uw(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Uw(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Uw(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const iv=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==Ew&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==Vw&&e.status!==Mw?1:0},nv=t=>{if(iv(t))return Dw(t,Sw);t.total_in=t.total_out=0,t.data_type=Zw;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?Ew:Vw,t.adler=2===e.wrap?0:1,e.last_flush=-2,aw(e),vw},sv=t=>{const e=nv(t);var i;return e===vw&&((i=t.state).window_size=2*i.w_size,Uw(i.head),i.max_lazy_match=tv[i.level].max_lazy,i.good_match=tv[i.level].good_length,i.nice_match=tv[i.level].nice_length,i.max_chain_length=tv[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=2,i.match_available=0,i.ins_h=0),e},rv=(t,e,i,n,s,r)=>{if(!t)return Sw;let o=1;if(e===Qw&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),s<1||s>9||i!==Aw||n<8||n>15||e<0||e>9||r<0||r>_w||8===n&&1!==o)return Dw(t,Sw);8===n&&(n=9);const a=new ev;return t.state=a,a.strm=t,a.status=Ew,a.wrap=o,a.gzhead=null,a.w_bits=n,a.w_size=1<rv(t,e,Aw,15,8,Xw),bb.deflateInit2=rv,bb.deflateReset=sv,bb.deflateResetKeep=nv,bb.deflateSetHeader=(t,e)=>iv(t)||2!==t.state.wrap?Sw:(t.state.gzhead=e,vw),bb.deflate=(t,e)=>{if(iv(t)||e>ww||e<0)return t?Dw(t,Sw):Sw;const i=t.state;if(!t.output||0!==t.avail_in&&!t.input||i.status===Mw&&e!==bw)return Dw(t,0===t.avail_out?kw:Sw);const n=i.last_flush;if(i.last_flush=e,0!==i.pending){if(Lw(t),0===t.avail_out)return i.last_flush=-1,vw}else if(0===t.avail_in&&Ww(e)<=Ww(n)&&e!==bw)return Dw(t,kw);if(i.status===Mw&&0!==t.avail_in)return Dw(t,kw);if(i.status===Ew&&0===i.wrap&&(i.status=Vw),i.status===Ew){let e=Aw+(i.w_bits-8<<4)<<8,n=-1;if(n=i.strategy>=Pw||i.level<2?0:i.level<6?1:6===i.level?2:3,e|=n<<6,0!==i.strstart&&(e|=32),e+=31-e%31,Bw(i,e),0!==i.strstart&&(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),t.adler=1,i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(57===i.status)if(t.adler=0,Iw(i,31),Iw(i,139),Iw(i,8),i.gzhead)Iw(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),Iw(i,255&i.gzhead.time),Iw(i,i.gzhead.time>>8&255),Iw(i,i.gzhead.time>>16&255),Iw(i,i.gzhead.time>>24&255),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(Iw(i,255&i.gzhead.extra.length),Iw(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=fw(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if(Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,3),i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw;if(69===i.status){if(i.gzhead.extra){let e=i.pending,n=(65535&i.gzhead.extra.length)-i.gzindex;for(;i.pending+n>i.pending_buf_size;){let s=i.pending_buf_size-i.pending;if(i.pending_buf.set(i.gzhead.extra.subarray(i.gzindex,i.gzindex+s),i.pending),i.pending=i.pending_buf_size,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex+=s,Lw(t),0!==i.pending)return i.last_flush=-1,vw;e=0,n-=s}let s=new Uint8Array(i.gzhead.extra);i.pending_buf.set(s.subarray(i.gzindex,i.gzindex+n),i.pending),i.pending+=n,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex=0}i.status=73}if(73===i.status){if(i.gzhead.name){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),i.gzindex=0}i.status=91}if(91===i.status){if(i.gzhead.comment){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n))}i.status=103}if(103===i.status){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size&&(Lw(t),0!==i.pending))return i.last_flush=-1,vw;Iw(i,255&t.adler),Iw(i,t.adler>>8&255),t.adler=0}if(i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(0!==t.avail_in||0!==i.lookahead||e!==Ow&&i.status!==Mw){let n=0===i.level?Fw(i,e):i.strategy===Pw?((t,e)=>{let i;for(;;){if(0===t.lookahead&&(Gw(t),0===t.lookahead)){if(e===Ow)return 1;break}if(t.match_length=0,i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):i.strategy===Cw?((t,e)=>{let i,n,s,r;const o=t.window;for(;;){if(t.lookahead<=Tw){if(Gw(t),t.lookahead<=Tw&&e===Ow)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(s=t.strstart-1,n=o[s],n===o[++s]&&n===o[++s]&&n===o[++s])){r=t.strstart+Tw;do{}while(n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&st.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(i=cw(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):tv[i.level].func(i,e);if(3!==n&&4!==n||(i.status=Mw),1===n||3===n)return 0===t.avail_out&&(i.last_flush=-1),vw;if(2===n&&(e===gw?uw(i):e!==ww&&(lw(i,0,0,!1),e===mw&&(Uw(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),Lw(t),0===t.avail_out))return i.last_flush=-1,vw}return e!==bw?vw:i.wrap<=0?yw:(2===i.wrap?(Iw(i,255&t.adler),Iw(i,t.adler>>8&255),Iw(i,t.adler>>16&255),Iw(i,t.adler>>24&255),Iw(i,255&t.total_in),Iw(i,t.total_in>>8&255),Iw(i,t.total_in>>16&255),Iw(i,t.total_in>>24&255)):(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),Lw(t),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?vw:yw)},bb.deflateEnd=t=>{if(iv(t))return Sw;const e=t.state.status;return t.state=null,e===Vw?Dw(t,xw):vw},bb.deflateSetDictionary=(t,e)=>{let i=e.length;if(iv(t))return Sw;const n=t.state,s=n.wrap;if(2===s||1===s&&n.status!==Ew||n.lookahead)return Sw;if(1===s&&(t.adler=dw(t.adler,e,i,0)),n.wrap=0,i>=n.w_size){0===s&&(Uw(n.head),n.strstart=0,n.block_start=0,n.insert=0);let t=new Uint8Array(n.w_size);t.set(e.subarray(i-n.w_size,i),0),e=t,i=n.w_size}const r=t.avail_in,o=t.next_in,a=t.input;for(t.avail_in=i,t.next_in=0,t.input=e,Gw(n);n.lookahead>=3;){let t=n.strstart,e=n.lookahead-2;do{n.ins_h=qw(n,n.ins_h,n.window[t+3-1]),n.prev[t&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=t,t++}while(--e);n.strstart=t,n.lookahead=2,Gw(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,t.next_in=o,t.input=a,t.avail_in=r,n.wrap=s,vw},bb.deflateInfo="pako deflate (from Nodeca project)";var ov={};const av=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);ov.assign=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const e in i)av(i,e)&&(t[e]=i[e])}}return t},ov.flattenChunks=t=>{let e=0;for(let i=0,n=t.length;i=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;cv[254]=cv[254]=1,lv.string2buf=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,i,n,s,r,o=t.length,a=0;for(s=0;s>>6,e[r++]=128|63&i):i<65536?(e[r++]=224|i>>>12,e[r++]=128|i>>>6&63,e[r++]=128|63&i):(e[r++]=240|i>>>18,e[r++]=128|i>>>12&63,e[r++]=128|i>>>6&63,e[r++]=128|63&i);return e};lv.buf2string=(t,e)=>{const i=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let n,s;const r=new Array(2*i);for(s=0,n=0;n4)r[s++]=65533,n+=o-1;else{for(e&=2===o?31:3===o?15:7;o>1&&n1?r[s++]=65533:e<65536?r[s++]=e:(e-=65536,r[s++]=55296|e>>10&1023,r[s++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&hv)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let i="";for(let n=0;n{(e=e||t.length)>t.length&&(e=t.length);let i=e-1;for(;i>=0&&128==(192&t[i]);)i--;return i<0||0===i?e:i+cv[t[i]]>e?i:e};var uv=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const dv=bb,fv=ov,pv=lv,Ov=rw,gv=uv,mv=Object.prototype.toString,{Z_NO_FLUSH:bv,Z_SYNC_FLUSH:wv,Z_FULL_FLUSH:vv,Z_FINISH:yv,Z_OK:Sv,Z_STREAM_END:xv,Z_DEFAULT_COMPRESSION:kv,Z_DEFAULT_STRATEGY:Qv,Z_DEFLATED:$v}=ow;function Pv(t){this.options=fv.assign({level:kv,method:$v,chunkSize:16384,windowBits:15,memLevel:8,strategy:Qv},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new gv,this.strm.avail_out=0;let i=dv.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(i!==Sv)throw new Error(Ov[i]);if(e.header&&dv.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?pv.string2buf(e.dictionary):"[object ArrayBuffer]"===mv.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,i=dv.deflateSetDictionary(this.strm,t),i!==Sv)throw new Error(Ov[i]);this._dict_set=!0}}function Cv(t,e){const i=new Pv(e);if(i.push(t,!0),i.err)throw i.msg||Ov[i.err];return i.result}Pv.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize;let s,r;if(this.ended)return!1;for(r=e===~~e?e:!0===e?yv:bv,"string"==typeof t?i.input=pv.string2buf(t):"[object ArrayBuffer]"===mv.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),(r===wv||r===vv)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(s=dv.deflate(i,r),s===xv)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),s=dv.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===Sv;if(0!==i.avail_out){if(r>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},Pv.prototype.onData=function(t){this.chunks.push(t)},Pv.prototype.onEnd=function(t){t===Sv&&(this.result=fv.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},mb.Deflate=Pv,mb.deflate=Cv,mb.deflateRaw=function(t,e){return(e=e||{}).raw=!0,Cv(t,e)},mb.gzip=function(t,e){return(e=e||{}).gzip=!0,Cv(t,e)},mb.constants=ow;var _v={},Xv={};const Zv=16209;const Av=15,Tv=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Rv=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Ev=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Vv=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Mv=(t,e,i,n,s,r,o,a)=>{const l=a.bits;let h,c,u,d,f,p,O=0,g=0,m=0,b=0,w=0,v=0,y=0,S=0,x=0,k=0,Q=null;const $=new Uint16Array(16),P=new Uint16Array(16);let C,_,X,Z=null;for(O=0;O<=Av;O++)$[O]=0;for(g=0;g=1&&0===$[b];b--);if(w>b&&(w=b),0===b)return s[r++]=20971520,s[r++]=20971520,a.bits=1,0;for(m=1;m0&&(0===t||1!==b))return-1;for(P[1]=0,O=1;O852||2===t&&x>592)return 1;for(;;){C=O-y,o[g]+1=p?(_=Z[o[g]-p],X=Q[o[g]-p]):(_=96,X=0),h=1<>y)+c]=C<<24|_<<16|X|0}while(0!==c);for(h=1<>=1;if(0!==h?(k&=h-1,k+=h):k=0,g++,0==--$[O]){if(O===b)break;O=e[i+o[g]]}if(O>w&&(k&d)!==u){for(0===y&&(y=w),f+=m,v=O-y,S=1<852||2===t&&x>592)return 1;u=k&d,s[u]=w<<24|v<<16|f-r|0}}return 0!==k&&(s[f+k]=O-y<<24|64<<16|0),a.bits=w,0};const Dv=iw,Wv=sw,Uv=function(t,e){let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,y,S,x,k,Q;const $=t.state;i=t.next_in,k=t.input,n=i+(t.avail_in-5),s=t.next_out,Q=t.output,r=s-(e-t.avail_out),o=s+(t.avail_out-257),a=$.dmax,l=$.wsize,h=$.whave,c=$.wnext,u=$.window,d=$.hold,f=$.bits,p=$.lencode,O=$.distcode,g=(1<<$.lenbits)-1,m=(1<<$.distbits)-1;t:do{f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,0===w)Q[s++]=65535&b;else{if(!(16&w)){if(0==(64&w)){b=p[(65535&b)+(d&(1<>>=w,f-=w),f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,!(16&w)){if(0==(64&w)){b=O[(65535&b)+(d&(1<a){t.msg="invalid distance too far back",$.mode=Zv;break t}if(d>>>=w,f-=w,w=s-r,y>w){if(w=y-w,w>h&&$.sane){t.msg="invalid distance too far back",$.mode=Zv;break t}if(S=0,x=u,0===c){if(S+=l-w,w2;)Q[s++]=x[S++],Q[s++]=x[S++],Q[s++]=x[S++],v-=3;v&&(Q[s++]=x[S++],v>1&&(Q[s++]=x[S++]))}else{S=s-y;do{Q[s++]=Q[S++],Q[s++]=Q[S++],Q[s++]=Q[S++],v-=3}while(v>2);v&&(Q[s++]=Q[S++],v>1&&(Q[s++]=Q[S++]))}break}}break}}while(i>3,i-=v,f-=v<<3,d&=(1<(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function hy(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const cy=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode16211?1:0},uy=t=>{if(cy(t))return Nv;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Kv,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,Iv},dy=t=>{if(cy(t))return Nv;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,uy(t)},fy=(t,e)=>{let i;if(cy(t))return Nv;const n=t.state;return e<0?(i=0,e=-e):(i=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?Nv:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=i,n.wbits=e,dy(t))},py=(t,e)=>{if(!t)return Nv;const i=new hy;t.state=i,i.strm=t,i.window=null,i.mode=Kv;const n=fy(t,e);return n!==Iv&&(t.state=null),n};let Oy,gy,my=!0;const by=t=>{if(my){Oy=new Int32Array(512),gy=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Yv(1,t.lens,0,288,Oy,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Yv(2,t.lens,0,32,gy,0,t.work,{bits:5}),my=!1}t.lencode=Oy,t.lenbits=9,t.distcode=gy,t.distbits=5},wy=(t,e,i,n)=>{let s;const r=t.state;return null===r.window&&(r.wsize=1<=r.wsize?(r.window.set(e.subarray(i-r.wsize,i),0),r.wnext=0,r.whave=r.wsize):(s=r.wsize-r.wnext,s>n&&(s=n),r.window.set(e.subarray(i-n,i-n+s),r.wnext),(n-=s)?(r.window.set(e.subarray(i-n,i),0),r.wnext=n,r.whave=r.wsize):(r.wnext+=s,r.wnext===r.wsize&&(r.wnext=0),r.whavepy(t,15),Xv.inflateInit2=py,Xv.inflate=(t,e)=>{let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,y,S,x,k=0;const Q=new Uint8Array(4);let $,P;const C=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(cy(t)||!t.output||!t.input&&0!==t.avail_in)return Nv;i=t.state,i.mode===ey&&(i.mode=iy),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,u=a,d=l,x=Iv;t:for(;;)switch(i.mode){case Kv:if(0===i.wrap){i.mode=iy;break}for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0),h=0,c=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",i.mode=ay;break}if((15&h)!==Jv){t.msg="unknown compression method",i.mode=ay;break}if(h>>>=4,c-=4,S=8+(15&h),0===i.wbits&&(i.wbits=S),S>15||S>i.wbits){t.msg="invalid window size",i.mode=ay;break}i.dmax=1<>8&1),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16182;case 16182:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>8&255,Q[2]=h>>>16&255,Q[3]=h>>>24&255,i.check=Wv(i.check,Q,4,0)),h=0,c=0,i.mode=16183;case 16183:for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>8),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16184;case 16184:if(1024&i.flags){for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(f=i.length,f>a&&(f=a),f&&(i.head&&(S=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(n.subarray(r,r+f),S)),512&i.flags&&4&i.wrap&&(i.check=Wv(i.check,n,f,r)),a-=f,r+=f,i.length-=f),i.length))break t;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===a)break t;f=0;do{S=n[r+f++],i.head&&S&&i.length<65536&&(i.head.name+=String.fromCharCode(S))}while(S&&f>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=ey;break;case 16189:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>=7&c,c-=7&c,i.mode=oy;break}for(;c<3;){if(0===a)break t;a--,h+=n[r++]<>>=1,c-=1,3&h){case 0:i.mode=16193;break;case 1:if(by(i),i.mode=sy,e===zv){h>>>=2,c-=2;break t}break;case 2:i.mode=16196;break;case 3:t.msg="invalid block type",i.mode=ay}h>>>=2,c-=2;break;case 16193:for(h>>>=7&c,c-=7&c;c<32;){if(0===a)break t;a--,h+=n[r++]<>>16^65535)){t.msg="invalid stored block lengths",i.mode=ay;break}if(i.length=65535&h,h=0,c=0,i.mode=ny,e===zv)break t;case ny:i.mode=16195;case 16195:if(f=i.length,f){if(f>a&&(f=a),f>l&&(f=l),0===f)break t;s.set(n.subarray(r,r+f),o),a-=f,r+=f,l-=f,o+=f,i.length-=f;break}i.mode=ey;break;case 16196:for(;c<14;){if(0===a)break t;a--,h+=n[r++]<>>=5,c-=5,i.ndist=1+(31&h),h>>>=5,c-=5,i.ncode=4+(15&h),h>>>=4,c-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=ay;break}i.have=0,i.mode=16197;case 16197:for(;i.have>>=3,c-=3}for(;i.have<19;)i.lens[C[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,$={bits:i.lenbits},x=Yv(0,i.lens,0,19,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid code lengths set",i.mode=ay;break}i.have=0,i.mode=16198;case 16198:for(;i.have>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=g,c-=g,i.lens[i.have++]=b;else{if(16===b){for(P=g+2;c>>=g,c-=g,0===i.have){t.msg="invalid bit length repeat",i.mode=ay;break}S=i.lens[i.have-1],f=3+(3&h),h>>>=2,c-=2}else if(17===b){for(P=g+3;c>>=g,c-=g,S=0,f=3+(7&h),h>>>=3,c-=3}else{for(P=g+7;c>>=g,c-=g,S=0,f=11+(127&h),h>>>=7,c-=7}if(i.have+f>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=ay;break}for(;f--;)i.lens[i.have++]=S}}if(i.mode===ay)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=ay;break}if(i.lenbits=9,$={bits:i.lenbits},x=Yv(1,i.lens,0,i.nlen,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid literal/lengths set",i.mode=ay;break}if(i.distbits=6,i.distcode=i.distdyn,$={bits:i.distbits},x=Yv(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,$),i.distbits=$.bits,x){t.msg="invalid distances set",i.mode=ay;break}if(i.mode=sy,e===zv)break t;case sy:i.mode=ry;case ry:if(a>=6&&l>=258){t.next_out=o,t.avail_out=l,t.next_in=r,t.avail_in=a,i.hold=h,i.bits=c,Uv(t,d),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,i.mode===ey&&(i.back=-1);break}for(i.back=0;k=i.lencode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,i.length=b,0===m){i.mode=16205;break}if(32&m){i.back=-1,i.mode=ey;break}if(64&m){t.msg="invalid literal/length code",i.mode=ay;break}i.extra=15&m,i.mode=16201;case 16201:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;k=i.distcode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,64&m){t.msg="invalid distance code",i.mode=ay;break}i.offset=b,i.extra=15&m,i.mode=16203;case 16203:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=ay;break}i.mode=16204;case 16204:if(0===l)break t;if(f=d-l,i.offset>f){if(f=i.offset-f,f>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=ay;break}f>i.wnext?(f-=i.wnext,p=i.wsize-f):p=i.wnext-f,f>i.length&&(f=i.length),O=i.window}else O=s,p=o-i.offset,f=i.length;f>l&&(f=l),l-=f,i.length-=f;do{s[o++]=O[p++]}while(--f);0===i.length&&(i.mode=ry);break;case 16205:if(0===l)break t;s[o++]=i.length,l--,i.mode=ry;break;case oy:if(i.wrap){for(;c<32;){if(0===a)break t;a--,h|=n[r++]<{if(cy(t))return Nv;let e=t.state;return e.window&&(e.window=null),t.state=null,Iv},Xv.inflateGetHeader=(t,e)=>{if(cy(t))return Nv;const i=t.state;return 0==(2&i.wrap)?Nv:(i.head=e,e.done=!1,Iv)},Xv.inflateSetDictionary=(t,e)=>{const i=e.length;let n,s,r;return cy(t)?Nv:(n=t.state,0!==n.wrap&&n.mode!==ty?Nv:n.mode===ty&&(s=1,s=Dv(s,e,i,0),s!==n.check)?Gv:(r=wy(t,e,i,i),r?(n.mode=16210,Fv):(n.havedict=1,Iv)))},Xv.inflateInfo="pako inflate (from Nodeca project)";const vy=Xv,yy=ov,Sy=lv,xy=rw,ky=uv,Qy=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},$y=Object.prototype.toString,{Z_NO_FLUSH:Py,Z_FINISH:Cy,Z_OK:_y,Z_STREAM_END:Xy,Z_NEED_DICT:Zy,Z_STREAM_ERROR:Ay,Z_DATA_ERROR:Ty,Z_MEM_ERROR:Ry}=ow;function Ey(t){this.options=yy.assign({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ky,this.strm.avail_out=0;let i=vy.inflateInit2(this.strm,e.windowBits);if(i!==_y)throw new Error(xy[i]);if(this.header=new Qy,vy.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=Sy.string2buf(e.dictionary):"[object ArrayBuffer]"===$y.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(i=vy.inflateSetDictionary(this.strm,e.dictionary),i!==_y)))throw new Error(xy[i])}function Vy(t,e){const i=new Ey(e);if(i.push(t),i.err)throw i.msg||xy[i.err];return i.result}Ey.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize,s=this.options.dictionary;let r,o,a;if(this.ended)return!1;for(o=e===~~e?e:!0===e?Cy:Py,"[object ArrayBuffer]"===$y.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),r=vy.inflate(i,o),r===Zy&&s&&(r=vy.inflateSetDictionary(i,s),r===_y?r=vy.inflate(i,o):r===Ty&&(r=Zy));i.avail_in>0&&r===Xy&&i.state.wrap>0&&0!==t[i.next_in];)vy.inflateReset(i),r=vy.inflate(i,o);switch(r){case Ay:case Ty:case Zy:case Ry:return this.onEnd(r),this.ended=!0,!1}if(a=i.avail_out,i.next_out&&(0===i.avail_out||r===Xy))if("string"===this.options.to){let t=Sy.utf8border(i.output,i.next_out),e=i.next_out-t,s=Sy.buf2string(i.output,t);i.next_out=e,i.avail_out=n-e,e&&i.output.set(i.output.subarray(t,t+e),0),this.onData(s)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(r!==_y||0!==a){if(r===Xy)return r=vy.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},Ey.prototype.onData=function(t){this.chunks.push(t)},Ey.prototype.onEnd=function(t){t===_y&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=yy.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},_v.Inflate=Ey,_v.inflate=Vy,_v.inflateRaw=function(t,e){return(e=e||{}).raw=!0,Vy(t,e)},_v.ungzip=Vy,_v.constants=ow;const{Deflate:My,deflate:Dy,deflateRaw:Wy,gzip:Uy}=mb,{Inflate:Yy,inflate:qy,inflateRaw:Ly,ungzip:zy}=_v,Iy=ow;gb.Deflate=My,gb.deflate=Dy,gb.deflateRaw=Wy,gb.gzip=Uy,gb.Inflate=Yy,gb.inflate=qy,gb.inflateRaw=Ly,gb.ungzip=zy,gb.constants=Iy;const By=gb;let jy={};var Ny;function Gy(t){return Ny=t,[tS]}jy.Util={},jy.Decode={},jy.Messages=[],jy.Log=function(t){jy.Messages.push(["I",t]),console.log("Mma.js INFO: ",t)},jy.Warn=function(t){jy.Messages.push(["W",t]),console.log("Mma.js WARNING: ",t)},jy.Fail=function(t){throw jy.Messages.push(["E",t]),"Mma.js ERROR: "+t},jy.Util.Base64Decode=function(t){for(var e=atob(t),i=e.length>>>0,n=new Uint8Array(i),s=0;s1&&0===t[0]&&jy.Fail("IntegerAP: input starts with 0: "+String(t)),this.nstring=t}else void 0===t?this.nstring=void 0:jy.Fail("Integer: invalid input: "+String(t))},jy.RealMP=function(t){"number"==typeof t?this.n=t:void 0===t?this.n=void 0:jy.Fail("RealMP: invalid input")},jy.RealAP=function(t){"string"==typeof t?(t.length>1&&0===t[0]&&jy.Fail("RealAP: input starts with 0: "+String(t)),this.nstring=t):void 0===t?this.nstring=void 0:jy.Fail("RealAP: invalid input: "+String(t))},jy.Symbol=function(t){"string"==typeof t?this.name=t:void 0===t?this.name=void 0:jy.Fail("Symbol: invalid input: "+String(t))},jy.String=function(t){"string"==typeof t?this.str=t:void 0===t?this.str=void 0:jy.Fail("String: invalid input: "+String(t))},jy.Expression=function(t,e){t instanceof jy.Symbol||jy.Fail("Expression: head must be an Mma.Symbol"),e instanceof Array||jy.Fail("Expression: parts must be an Array"),this.head=t,this.parts=e},jy.Decode.Int32=function(t,e){try{return new DataView(t.buffer).getInt32(e,!0)}catch(t){return 0}},jy.Decode.Float64=function(t,e){try{return new DataView(t.buffer).getFloat64(e,!0)}catch(t){return 0}},jy.Decode.String=function(t,e,i){return void 0===e&&(e=0),void 0===i&&(i=t.length),jy.Util.U8ArrayToString(t.slice(e,e+i))},jy.Decode.StringEntry=function(t,e){void 0===e&&(e=0);var i=jy.Decode.Int32(t,e);return{length:i,string:jy.Decode.String(t,e+4,i),bytesRead:i+4}},jy.Decode.Any=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=1/0);var n=e;for(var s=0,r=[];ee%2!=0?t:{...t,body:Lm(t.body,/\(\*\|\*\)/gm)})),Array.isArray(this.args[this.args.length-1].body)||(this.decorator=this.args.pop());const r=this.args;console.log("creating InstanceWidget");for(let t=0;t{e.viewState.state.config.eval()},update:e=>this.applyChanges(e,t,i),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i-2>=0?(o[i-2].editor.dispatch({selection:{anchor:o[i-2].editor.state.doc.length}}),o[i-2].editor.focus(),void(t.editorLastCursor=void 0)):(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0));t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i+2=0)return r[t-2].body[i].editor.focus(),void(e.editorLastCursor=void 0)}},{key:"ArrowDown",run:function(e,n){if(t+2{},focus:()=>{},dispatch:()=>{}};const t=l.match(Fy);if(t){a.innerHTML=t[1];const e=jy.DecompressDecode(t[2]),i=jy.toArray(e.parts[0]),n=uuidv4();interpretate(i,{global:{call:n},element:a})}else a.innerHTML=l.slice(1,-1)}delete o[i].body,n.appendChild(a)}i.appendChild(n)}if(this.decorator){const t=jy.DecompressDecode(this.decorator.body.slice(2,-2)),e=jy.toArray(t.parts[0]);let n={global:{call:uuidv4(),EditorWidget:s},element:i};this.interpretated=interpretate(e,n)}}applyChanges(t,e,i){const n=this.args,s=this.args[e].body,r=this.visibleValue.argsPos,o=this.args[e].from;let a=t;0==i&&0==e&&(a="{{"+a),0==i&&0!=e&&(a="{"+a),i==s.length-1&&e==n.length-1&&(a+="}}"),i==s.length-1&&e!=n.length-1&&(a+="}");const l=s[i].length,h={from:r+o+s[i].from,to:r+o+s[i].from+l,insert:a},c=a.length-l;for(let t=i+1;t{s.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.args[0].body[0].editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.args[0].body[0].editor.focus();else{const t=this.DOMElement.EditorWidget.args,e=t[t.length-1].body[t[t.length-1].body.length-1].editor;e.dispatch({selection:{anchor:e.state.doc.length}}),e.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const Ky=(t,e)=>new Bm({tag:"GB",decoration:i=>ni.replace({widget:new Jy(i,t,e)})}),tS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=Ky(this.disposable,t).createDeco(t)}update(t){this.placeholder=Ky(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});function eS(t){return[rS]}let iS=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.span=i,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this,r=this.args[1].body.slice(3,-3),o=jy.DecompressDecode(r),a=jy.toArray(o.parts[0]);this.data=a;const l="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}));this.cuid=l;let h={call:l,EditorWidget:s},c={global:h,element:i};this.expression=a,this.env=c,this.interpretated=interpretate(a,c),this.interpretated.then((()=>{if(c.options?.Event){console.warn("Event listeners are enabled!"),s.events=c.options.Event;let t=c;if(h.stack){const e=Object.values(h.stack);e.length>0&&(console.log("Attaching first found instance..."),t=e[0].env)}interpretate(["MetaMarker","'"+l+"'"],t).then((()=>{server.kernel.emitt(s.events,'"'+l+'"',"Mounted")}))}}))}getDoc(){return this.args[0].body.slice(1,-1)}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+t+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].length=s.length,this.view.dispatch({changes:r})}applyOuterChanges(t){const e=this.visibleValue,i=t,n={from:e.pos,to:e.pos+e.length,insert:i};this.view.dispatch({changes:n})}update(t){if(!this.deactivated){if(t.str!=this.visibleValue.str){console.warn("Out of sync"),console.log("recreate..."),this.destroy();const e=this.span;return e.replaceChildren(),void this._construct(t,this.view,e)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}}destroy(t){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.events&&server.kernel.emitt(this.events,'"'+this.cuid+'"',"Destroy"),delete this.data}},nS=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=this;let i=document.createElement("span");return i.classList.add("frontend-view"),i.EditorWidget=new iS(this.visibleValue,t,i),this.reference.push({destroy:()=>{e.destroy(i)}}),i}ignoreEvent(){return!0}destroy(t){console.log("destroy in general*"),t.EditorWidget.destroy()}};const sS=(t,e)=>new Bm({tag:"VB",decoration:i=>ni.replace({widget:new nS(i,t,e)})}),rS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=sS(this.disposable,t).createDeco(t)}update(t){this.placeholder=sS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var oS;function aS(t){return oS=t,[uS]}let lS=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.span=i,this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this;this.epilog={offset:0,string:""},this.prolog={offset:0,string:""};const r=this.args[1].body.slice(3,-3),o=jy.DecompressDecode(r),a=jy.toArray(o.parts[0]);this.data=a;let l={global:{call:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)})),element:i,origin:s},element:i};this.env=l,interpretate(a,l).then((()=>{if(l.options?.Head&&(s.prolog.offset=l.options.Head.length+1,s.prolog.string=l.options.Head+"[",s.epilog.offset=1,s.epilog.string="]"),l.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=l.options.Event),l.options?.String){s.prolog.offset=1,s.prolog.string='"',s.epilog.offset=1,s.epilog.string='"',l.options?.HeadString&&(s.prolog.string=l.options.HeadString,s.prolog.offset=s.prolog.string.length),l.options?.TailString&&(s.epilog.string=l.options.TailString,s.epilog.offset=s.epilog.string.length),s.editor={destroy:()=>{console.log("Nothing to destroy, this is just a text field.")}};const t=document.createElement("span");return this.aa,t.onkeydown=function(t){13===t.keyCode&&t.preventDefault()},t.contentEditable="plaintext-only",t.innerText=s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),t.addEventListener("input",console.log),t.addEventListener("input",(()=>{console.log("Update"),console.log(t.innerText),this.applyChanges(t.innerText)})),l.global.element.appendChild(t),void(s.events&&server.kernel.emitt(s.events,"Null","Mounted"))}s.editor=oS({doc:s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),parent:l.global.element,update:t=>this.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos+s.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]}),s.events&&server.kernel.emitt(s.events,"Null","Mounted")}))}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+this.prolog.string+t+this.epilog.string+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length));const o=s.length-i[0].length;i[0].length=s.length,this.visibleValue.length=this.visibleValue.length+o,this.view.dispatch({changes:r})}update(t){if(this.visibleValue.str!=t.str)return console.warn("Out of sync"),console.log("recreating InstanceWidget"),this.destroy(),this.span.replaceChildren(),void this._construct(t,this.view,this.span);this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.editor.destroy(),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}},hS=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("subscript-tail"),e.EditorWidget=new lS(this.visibleValue,t,e,[]);const i=this;return this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const cS=(t,e)=>new Bm({tag:"BB",decoration:i=>ni.replace({widget:new hS(i,t,e)})}),uS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=cS(this.disposable,t).createDeco(t)}update(t){this.placeholder=cS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var dS;function fS(t){return dS=t,[mS]}class pS{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm);const s=this,r=Array.from({length:Math.ceil((s.args.length-3)/2)},((t,e)=>2*e+1));s.indexes=r;const o=[];this.span=i,this.spans=o;for(let t=0;t{c.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=c.options.Event),s.editors=r.map(((t,i)=>dS({doc:s.args[t].body,parent:o[i],update:e=>this.applyChanges(e,t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i>0?s.editors[i-1].focus():(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus()),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return it.destroy())),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}}class OS extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("inline-flex"),e.EditorWidget=new pS(this.visibleValue,t,e,[]);const i=this;return this.DOMElement=e,this.reference.push({destroy:()=>{i.destroy(e)}}),e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;const n=this.DOMElement.EditorWidget.editors;return t.from-e.from<0?(n[n.length-1].dispatch({selection:{anchor:n[n.length-1].state.doc.length}}),n[n.length-1].focus()):(n[0].dispatch({selection:{anchor:0}}),n[0].focus()),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}}const gS=(t,e)=>new Bm({tag:"TB",decoration:i=>ni.replace({widget:new OS(i,t,e)})}),mS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=gS(this.disposable,t).createDeco(t)}update(t){this.placeholder=gS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});const bS=_i.fromClass(class{decorations=ni.none;constructor(t){this.view=t,this.recompute()}recompute(t){let e,i,n=[];for(let{from:t,to:e}of this.view.visibleRanges)this.getDecorationsFor(t,e,n);this.decorations=ni.set(n,!0),this.decorations=this.decorations.update({filter:(n,s)=>!(n>e&&s=e&&s.selection.main.head<=i)return!0;if(!n&&s.selection.main.head>e&&s.selection.main.headt.decorations});class wS extends ei{constructor(t,e){super(),this.rawValue=t,this.visibleValue=e}eq(t){return this.rawValue===t.rawValue}toDOM(){let t=document.createElement("div");t.classList.add("cell-type-widget");const e=this.rawValue.split(" "),i=e[0].split(".");if(console.log(i),t.classList.add("cell-type-"+i[1].trim()),t.innerText=e[0].trim(),e.length>1){const n=e.slice(1),s=document.createElement("span");return s.appendChild(t),n.forEach((t=>{const e=document.createElement("span");e.innerText=t,e.classList.add("cell-type-"+i[1].trim()+"-"+t.split("=")[0]),s.appendChild(e)})),s}return t}ignoreEvent(){return!1}}const vS=new F,yS=new F,SS=[],xS=Sl.define([{tag:Sa.meta,color:"var(--editor-key-meta)"},{tag:Sa.link,textDecoration:"underline"},{tag:Sa.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Sa.emphasis,fontStyle:"italic"},{tag:Sa.strong,fontWeight:"bold"},{tag:Sa.strikethrough,textDecoration:"line-through"},{tag:Sa.keyword,color:"var(--editor-key-keyword)"},{tag:[Sa.atom,Sa.bool,Sa.url,Sa.contentSeparator,Sa.labelName],color:"var(--editor-key-atom)"},{tag:[Sa.literal,Sa.inserted],color:"var(--editor-key-literal)"},{tag:[Sa.string,Sa.deleted],color:"var(--editor-key-string)"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],color:"var(--editor-key-escape)"},{tag:Sa.definition(Sa.variableName),color:"var(--editor-key-variable)"},{tag:Sa.local(Sa.variableName),color:"var(--editor-local-variable)"},{tag:[Sa.typeName,Sa.namespace],color:"var(--editor-key-type)"},{tag:Sa.className,color:"var(--editor-key-class)"},{tag:[Sa.special(Sa.variableName),Sa.macroName],color:"var(--editor-special-variable)"},{tag:Sa.definition(Sa.propertyName),color:"var(--editor-key-property)"},{tag:Sa.comment,color:"var(--editor-key-comment)"},{tag:Sa.invalid,color:"var(--editor-key-invalid)"}]),kS={data:[],extend:t=>{kS.data.push(...t),Qm.reBuild(kS.data)},replaceAll:t=>{kS.data=t,Qm.reBuild(kS.data)}},QS=Gl.define({name:"spreadsheet",startState:function(){return{stringType:null,stack:[]}},token:function(t,e){if(t){switch(0===e.stack.length&&('"'!=t.peek()&&"'"!=t.peek()||(e.stringType=t.peek(),t.next(),e.stack.unshift("string"))),e.stack[0]){case"string":for(;"string"===e.stack[0]&&!t.eol();)t.peek()===e.stringType?(t.next(),e.stack.shift()):"\\"===t.peek()?(t.next(),t.next()):t.match(/^.[^\\\"\']*/);return"string";case"characterClass":for(;"characterClass"===e.stack[0]&&!t.eol();)t.match(/^[^\]\\]+/)||t.match(/^\\./)||e.stack.shift();return"operator"}var i=t.peek();switch(i){case"[":return t.next(),e.stack.unshift("characterClass"),"bracket";case":":return t.next(),"operator";case"\\":return t.match(/\\[a-z]+/)?"string.special":(t.next(),"atom");case".":case",":case";":case"*":case"-":case"+":case"^":case"<":case"/":case"=":return t.next(),"atom";case"$":return t.next(),"builtin"}return t.match(/\d+/)?t.match(/^\w+/)?"error":"number":t.match(/^[a-zA-Z_]\w*/)?t.match(/(?=[\(.])/,!1)?"keyword":"variable":-1!=["[","]","(",")","{","}"].indexOf(i)?(t.next(),"bracket"):(t.eatSpace()||t.next(),null)}}}),$S=new RegExp(/^[\w]*\.[\w]+/);function PS(t){const e=$S.exec(t),i=Object.values(window.SupportedLanguages);for(let t=0;t{if(!t.docChanged)return null;let e=PS(t.newDoc.line(1).text);if(e.legacy){const i=t.startState.facet(Wa);if(i){if(i.name==e.name)return null}else if(t.startState.facet(CS)==e.name)return null;return console.log("switching... to "+e.name),{effects:vS.reconfigure(e.plugins)}}return e.name===t.startState.facet(Wa).name?null:(console.log("switching... to "+e.name),{effects:vS.reconfigure(e.plugins)})}));let XS,ZS=null;const AS=t=>{const e=t||XS;return e&&e.viewState?(console.log(),PS(e.state.doc.line(1).text).name):""},TS=t=>{const e=t||XS;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return!1;const n=i[0];return[n.from,n.to]},RS=t=>{const e=t||XS;return e&&e.viewState?e.state.doc.toString():""},ES=t=>{const e=t||XS;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return"";const n=i[0];return console.log("yoko"),console.log(n),console.log(e.state.doc.toString().slice(n.from,n.to)),console.log("processing"),e.state.doc.toString().slice(n.from,n.to)},VS=(t,e)=>{const i=e||XS;if(!i)return;if(!i.viewState)return;const n=i.viewState.state.selection.ranges;if(!n.length)return;const s=n[0];console.log("result"),console.log(t),i.dispatch({changes:{...s,insert:t}})},MS=()=>XS,DS=(t,e)=>{const i=e||XS;i&&i.viewState&&(console.log("result"),console.log(t),i.dispatch({changes:{from:0,to:i.viewState.state.doc.length,insert:t}}))};ZS=t=>{let e=new Ts({doc:t.doc,extensions:[Ys.of([{key:"Tab",run:function(t,e){return sd(t)}},{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,LS,Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(XS=e.view)}))],parent:t.parent});return e.viewState.state.config.eval=t.eval,e},ZS.state=t=>{let e=xt.create({doc:t.doc,extensions:[Ys.of([{key:"Tab",run:function(t,e){return sd(t)}},{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,LS,Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(XS=e.view)}))]});return e.config.eval=t.eval,e};const WS={transaction:(t,e,i,n)=>{if(console.log(e.dom.ocellref),e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:DropEvent"]')}},file:(t,e,i,n,s)=>{console.log(e.dom.ocellref),e.dom.ocellref&&server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},US={transaction:(t,e,i,n)=>{if(console.log(e.dom.ocellref),e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:PasteEvent"]')}},file:(t,e,i,n,s)=>{console.log(e.dom.ocellref),e.dom.ocellref&&server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},YS=[Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Cm(WS,US)];let qS=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"}}),LS=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"},".cm-scroller":{"line-height":"inherit","overflow-x":"overlay","overflow-y":"overlay","align-items":"initial"},".cm-content":{padding:"0px 0"},".rainbow-bracket-red":{color:"var(--editor-bracket-1)"},".rainbow-bracket-orange":{color:"var(--editor-bracket-2)"},".rainbow-bracket-yellow":{color:"var(--editor-bracket-3)"},".rainbow-bracket-green":{color:"var(--editor-bracket-4)"},".rainbow-bracket-blue":{color:"var(--editor-bracket-5)"},".rainbow-bracket-indigo":{color:"var(--editor-bracket-6)"},".rainbow-bracket-violet":{color:"var(--editor-bracket-7)"},".rainbow-bracket-red > span":{color:"var(--editor-bracket-1-a)"},".rainbow-bracket-orange > span":{color:"var(--editor-bracket-2-a)"},".rainbow-bracket-yellow > span":{color:"var(--editor-bracket-3-a)"},".rainbow-bracket-green > span":{color:"var(--editor-bracket-4-a)"},".rainbow-bracket-blue > span":{color:"var(--editor-bracket-5-a)"},".rainbow-bracket-indigo > span":{color:"var(--editor-bracket-6-a)"},".rainbow-bracket-violet > span":{color:"var(--editor-bracket-7-a)"}}),zS=!1;const IS=[()=>vr(),()=>Sh(),()=>ir(),()=>dr(),()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xS,{fallback:!1}),()=>tu()],BS={},jS=[()=>vr(),()=>Sh(),()=>ir(),()=>dr(),t=>NS.of(t),()=>BS.gutter?function(t={}){return[eo.of(t),jr(),so]}():[],()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xS,{fallback:!1}),()=>tu(),()=>bS,()=>function(t){return _i.fromClass(class{constructor(e){this.view=e,this.placeholder=ni.set([ni.widget({widget:new kr(t),side:1}).range(0)])}get decorations(){return this.view.state.doc.length?ni.none:this.placeholder}},{decorations:t=>t.decorations})}("Type WL Expression / .md / .js"),()=>xt.allowMultipleSelections.of(!0),(t,e)=>vS.of(e),()=>yS.of(xt.readOnly.of(!1)),()=>_S,()=>{return t?[ou.of(t),Yu]:Yu;var t},(t,e)=>Ys.of([{key:"Tab",run:function(t,e){const i=sd(t);return i||Rc(t)},shift:Ec},{key:"Backspace",run:function(e,i){if(0===e.state.doc.length)return t.origin.remove(),!0}},{key:"ArrowLeft",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus prev"),t.origin.focusPrev(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus next"),t.origin.focusNext(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"Shift-Enter",preventDefault:!0,run:function(e,i){console.log(e.state.doc.toString()),t.origin.eval(e.state.doc.toString())}},...Vc,...Wh,...Ru]),(t,e)=>Ts.updateListener.of((e=>{e.docChanged&&t.origin.save(encodeURIComponent(e.state.doc.toString())),e.selectionSet&&(XS=e.view)})),()=>qS];const NS=E.define();function GS(t){return t.replace(/\\\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\\\:/g,""),16))})).replaceAll("\\:F74E","I").replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))}function FS(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(t=>(+t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+t/4).toString(16)))}core.ReadOnly=()=>"ReadOnly",core.EditorView=async(t,e)=>{let i=await interpretate(t[0],e);i=GS(i),console.log("UNICODE Disaster");const n=await core._getRules(t,e);let s=()=>{},r=()=>{},o=i;const a=[];n.ReadOnly&&a.push(xt.readOnly.of(!0)),n.ForceUpdate&&(e.local.forceUpdate=n.ForceUpdate),n.Event&&(r=t=>{o=t,console.log("editor view emitt data: "+t),server.kernel.emitt(n.Event,'"'+t.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Input")},s=()=>{server.kernel.emitt(n.Event,'"'+o.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Evaluate")}),e.local?e.local.editor=ZS({doc:i,parent:e.element,eval:s,update:r,extensions:a}):ZS({doc:i,parent:e.element,eval:s,update:r,extensions:a}),e.element.style.verticalAlign="inherit"},core.StripOnInput=async()=>{},core.EditorView.update=async(t,e)=>{if(!e.local.editor)return;const i=GS(await interpretate(t[0],e));console.log("editor view: dispatch"),e.local.forceUpdate,e.local.editor.dispatch({changes:{from:0,to:e.local.editor.state.doc.length,insert:i}})},core.EditorView.destroy=async(t,e)=>{await interpretate(t[0],e),e.local&&e.local.editor&&e.local.editor.destroy()},core.EditorView.virtual=!0,core.PreviewCell=(t,e)=>{},window.SupportedLanguages.push({check:t=>null===t,legacy:!0,plugins:YS,name:"mathematica"}),window.SupportedLanguages.push({check:t=>null!=t[0].match(/\w+\.(wl|wls)$/),plugins:YS,legacy:!0,name:"mathematica"}),window.SupportedCells.codemirror={view:class{origin={};editor={};trash=[];forceFocusNext(){zS=!0}focus(t){t>0?this.editor.dispatch({selection:{anchor:0}}):t<0&&this.editor.dispatch({selection:{anchor:this.editor.state.doc.length}}),this.editor.focus()}setContent(t){if(console.warn("content mutation!"),!this.editor.viewState)return;const e=this.editor;console.log("result"),console.log(t),this.editor.dispatch({changes:{from:0,to:e.viewState.state.doc.length,insert:t}})}addDisposable(t){this.trash.push(t)}dispose(){this.editor.destroy()}readOnly(t){this.editor.dispatch({effects:yS.reconfigure(xt.readOnly.of(t))})}constructor(t,e){this.origin=t;const i=this.origin,n=PS(e).plugins,s=this;this.origin.element.ocellref=s;const r=new Ts({doc:(o=e,o.replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))),extensions:jS.map((t=>t(s,n))),parent:this.origin.element});var o;return this.editor=r,this.editor.dom.ocellref=s,this.editor.viewState.state.config.eval=()=>{i.eval(this.editor.state.doc.toString())},zS&&r.focus(),zS=!1,this}},context:{EditorAutocomplete:kS,javascriptLanguage:qf,javascript:Nf,markdownLanguage:rm,markdown:function(t={}){let{codeLanguages:e,defaultCodeLanguage:i,addKeymap:n=!0,base:{parser:s}=sm}=t;if(!(s instanceof Zp))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let r,o=t.extensions?[t.extensions]:[],a=[dm.support];i instanceof Ua?(a.push(i.support),r=i.language):i&&(r=i);let l=e||r?(h=e,c=r,t=>{if(t&&h){let e=null;if(t=/\S*/.exec(t)[0],e="function"==typeof h?h(t):Ya.matchLanguageName(h,t,!0),e instanceof Ya)return e.support?e.support.language.parser:Ta.getSkippingParser(e.load());if(e)return e.parser}return c?c.parser:null}):void 0;var h,c;return o.push(function(t){let{codeParser:e,htmlParser:i}=t,n=Do(((t,n)=>{let s=t.type.id;if(!e||s!=Kf.CodeBlock&&s!=Kf.FencedCode){if(i&&(s==Kf.HTMLBlock||s==Kf.HTMLTag))return{parser:i,overlay:rO(t.node,t.from,t.to)}}else{let i="";if(s==Kf.FencedCode){let e=t.node.getChild(Kf.CodeInfo);e&&(i=n.read(e.from,e.to))}let r=e(i);if(r)return{parser:r,overlay:t=>t.type.id==Kf.CodeText}}return null}));return{wrap:n}}({codeParser:l,htmlParser:dm.language.parser})),n&&a.push(N.high(Ys.of(um))),new Ua(nm(s.configure(o)),a)},htmlLanguage:jg,html:Ng,cssLanguage:kg,css:Qg,EditorView:Ts,EditorState:xt,highlightSpecialChars:vr,syntaxHighlighting:$l,defaultHighlightStyle:xS,editorCustomTheme:qS,foldGutter:function(t={}){let e=Object.assign(Object.assign({},wl),t),i=new vl(e,!0),n=new vl(e,!1),s=_i.fromClass(class{constructor(t){this.from=t.viewport.from,this.markers=this.buildMarkers(t)}update(t){(t.docChanged||t.viewportChanged||t.startState.facet(Wa)!=t.state.facet(Wa)||t.startState.field(dl,!1)!=t.state.field(dl,!1)||Xa(t.startState)!=Xa(t.state)||e.foldingChanged(t))&&(this.markers=this.buildMarkers(t.view))}buildMarkers(t){let e=new Xt;for(let s of t.viewportLineBlocks){let r=fl(t.state,s.from,s.to)?n:ll(t.state,s.from,s.to)?i:null;r&&e.add(s.from,s.from,r)}return e.finish()}}),{domEventHandlers:r}=e;return[s,Ir({class:"cm-foldGutter",markers(t){var e;return(null===(e=t.plugin(s))||void 0===e?void 0:e.markers)||_t.empty},initialSpacer:()=>new vl(e,!1),domEventHandlers:Object.assign(Object.assign({},r),{click:(t,e,i)=>{if(r.click&&r.click(t,e,i))return!0;let n=fl(t.state,e.from,e.to);if(n)return t.dispatch({effects:ul.of(n)}),!0;let s=ll(t.state,e.from,e.to);return!!s&&(t.dispatch({effects:cl.of(s)}),!0)}})}),ml()]},Facet:E,Compartment:F,mathematicaPlugins:YS,legacyLangNameFacet:CS,DropPasteHandlers:Cm,EditorExtensionsMinimal:IS,EditorParameters:BS,EditorExtensions:jS,StateField:q,Decoration:ni,ViewPlugin:_i,WidgetType:ei,originFacet:NS,MatchDecorator:pr}},window.OfflineMode&&SS.push(xt.readOnly.of(!0)),core.CellView=async(t,e)=>{const i=await core._getRules(t,e);i.Display||(i.Display="codemirror");const n=await interpretate(t[0],e),s={element:e.element,uid:FS()};i.Style&&(e.element.style=i.Style),i.Class&&e.element.classList.add(...i.Class.split(" ")),i.ImageSize&&(Array.isArray(i.ImageSize)?(e.element.style.width=i.ImageSize[0]+"px",e.element.style.height=i.ImageSize[1]+"px"):e.element.style.width=i.ImageSize+"px"),new window.SupportedCells[i.Display].view(s,n)};const HS={};core.FrontEditorSelected=async(t,e)=>{console.log("check");const i=await interpretate(t[0],e),n=await core._getRules(t,e);let s;switch(n.Editor&&(s=HS[n.Editor],console.log("Editor"),console.log(n.Editor),console.log(s)),i){case"Get":return ES(s);case"Set":let i=await interpretate(t[1],e);VS(i,s);break;case"GetDoc":return RS(s);case"SetDoc":let n=await interpretate(t[1],e);DS(n,s);break;case"Cursor":return TS(s);case"Type":return AS(s);case"Editor":const r=FS();return HS[r]=MS(),r}}; +class t{constructor(){}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 a(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}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 l(n,o,i,r);n=o+1,i++}}decompose(t,i,r,o){let a=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(a.text,t.text.slice(),0,a.length);if(i.length<=32)r.push(new e(i,t.length+a.length));else{let t=i.length>>1;r.push(new e(i.slice(0,t)),new e(i.slice(t)))}}else r.push(a)}replace(t,r,o){if(!(o instanceof e))return super.replace(t,r,o);let a=n(this.text,n(o.text,s(this.text,0,t)),r),l=this.length+o.length-(r-t);return a.length<=32?new e(a,l):i.from(e.split(a,[]),l)}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=a+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,a=i+r.lines-1;if((e?a:o)>=t)return r.lineInner(t,e,i,n);n=o+1,i=a+1}}decompose(t,e,i,n){for(let s=0,r=0;r<=e&&s=r){let s=n&((r<=t?1:0)|(a>=e?2:0));r>=t&&a<=e&&!s?i.push(o):o.decompose(t-r,e-r,i,s)}r=a+1}}replace(t,e,n){if(n.lines=r&&e<=a){let l=o.replace(t-r,e-r,n),h=this.lines-o.lines+l.lines;if(l.lines>4&&l.lines>h>>6){let r=this.children.slice();return r[s]=l,new i(r,this.length-(e-t)+n.length)}return super.replace(r,a,l)}r=a+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=a+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,a]=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==a)return n;let i=this.children[s],l=t.children[r];if(i!=l)return n+i.scanIdentical(l,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,a=r>>1,l=[],h=0,c=-1,u=[];function d(t){let n;if(t.lines>o&&t instanceof i)for(let e of t.children)d(e);else t.lines>a&&(h>a||!h)?(f(),l.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&&f(),h+=t.lines,c+=t.length+1,u.push(t))}function f(){0!=h&&(l.push(1==u.length?u[0]:i.from(u,c)),c=-1,h=u.length=0)}for(let e of t)d(e);return f(),1==l.length?l[0]:new i(l,n)}}function n(t,e,i=0,n=1e9){for(let s=0,r=0,o=!0;r=i&&(l>n&&(a=a.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,a=s instanceof e?s.text.length:s.children.length;if(o==(i>0?a: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 a{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]=a.prototype[Symbol.iterator]=function(){return this});let l=class{constructor(t,e,i,n){this.from=t,this.to=e,this.number=i,this.text=n}get length(){return this.to-this.from}},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 d=8205;function f(t,e,i=!0,n=!0){return(i?p:O)(t,e,n)}function p(t,e,i){if(e==t.length)return e;e&&g(t.charCodeAt(e))&&m(t.charCodeAt(e-1))&&e--;let n=b(t,e);for(e+=v(n);e=0&&u(b(t,n));)i++,n-=2;if(i%2==0)break;e+=2}}}return e}function O(t,e,i){for(;e>0;){let n=p(t,e-2,i);if(n=56320&&t<57344}function m(t){return t>=55296&&t<56320}function b(t,e){let i=t.charCodeAt(e);if(!m(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return g(n)?n-56320+(i-55296<<10)+65536:i}function w(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function v(t){return t<65536?1:2}const y=/\r\n?|\n/;var S=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(S||(S={}));class x{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;et)return s+(t-n);s+=o}else{if(i!=S.Simple&&l>=t&&(i==S.TrackDel&&nt||i==S.TrackBefore&&nt))return null;if(l>t||l==t&&e<0&&!o)return t==n||e<0?s:s+a;s+=a}n=l}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 x(t)}static create(t){return new x(t)}}class k extends x{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 P(this,((e,i,n,s,r)=>t=t.replace(n,n+(i-e),r)),!1),t}mapDesc(t,e=!1){return C(this,t,e,!0)}invert(e){let i=this.sections.slice(),n=[];for(let s=0,r=0;s=0){i[s]=a,i[s+1]=o;let l=s>>1;for(;n.length0&&$(i,e,s.text),s.forward(t),o+=t}let l=t[r++];for(;o>1].toJSON()))}return t}static of(e,i,n){let s=[],r=[],o=0,a=null;function l(t=!1){if(!t&&!s.length)return;oa||e<0||a>i)throw new RangeError(`Invalid change range ${e} to ${a} (in doc of length ${i})`);let u=c?"string"==typeof c?t.of(c.split(n||y)):c:t.empty,d=u.length;if(e==a&&0==d)return;eo&&Q(s,e-o,-1),Q(s,a-e,d),$(r,s,u),o=a}}(e),l(!a),a}static empty(t){return new k(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 $(e,i,n){if(0==n.length)return;let s=i.length-2>>1;if(s>1])),!(n||a==e.sections.length||e.sections[a+1]<0);)l=e.sections[a++],h=e.sections[a++];i(r,c,o,u,d),r=c,o=u}}}function C(t,e,i,n=!1){let s=[],r=n?[]:null,o=new X(t),a=new X(e);for(let t=-1;;)if(-1==o.ins&&-1==a.ins){let t=Math.min(o.len,a.len);Q(s,t,-1),o.forward(t),a.forward(t)}else if(a.ins>=0&&(o.ins<0||t==o.i||0==o.off&&(a.len=0&&t=0)){if(o.done&&a.done)return r?k.createSet(s,r):x.create(s);throw new Error("Mismatched change set lengths")}{let e=0,i=o.len;for(;i;)if(-1==a.ins){let t=Math.min(i,a.len);e+=t,i-=t,a.forward(t)}else{if(!(0==a.ins&&a.lene||o.ins>=0&&o.len>e)&&(t||n.length>i),r.forward2(e),o.forward(e)}}else Q(n,0,o.ins,t),s&&$(s,n,o.text),o.next()}}class X{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 Z{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 Z(i,n,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return A.range(t,e);let i=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return A.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 A.range(t.anchor,t.head)}static create(t,e,i){return new Z(t,e,i)}}class A{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:A.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 A(t.ranges.map((t=>Z.fromJSON(t))),t.main)}static single(t,e=t){return new A([A.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?A.range(o,r):A.range(r,o))}}return new A(t,e)}}function T(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let R=0;class E{constructor(t,e,i,n,s){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=n,this.id=R++,this.default=t([]),this.extensions="function"==typeof s?s(this):s}static define(t={}){return new E(t.combine||(t=>t),t.compareInput||((t,e)=>t===e),t.compare||(t.combine?(t,e)=>t===e:V),!!t.static,t.enables)}of(t){return new M([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,2,e)}from(t,e){return e||(e=t=>t),this.compute([t],(i=>e(i.field(t))))}}function V(t,e){return t==e||t.length==e.length&&t.every(((t,i)=>t===e[i]))}class M{constructor(t,e,i,n){this.dependencies=t,this.facet=e,this.type=i,this.value=n,this.id=R++}dynamicSlot(t){var e;let i=this.value,n=this.facet.compareInput,s=this.id,r=t[s]>>1,o=2==this.type,a=!1,l=!1,h=[];for(let i of this.dependencies)"doc"==i?a=!0:"selection"==i?l=!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(a&&e.docChanged||l&&(e.docChanged||e.selection)||W(t,h)){let e=i(t);if(o?!D(e,t.values[r],n):!n(e,t.values[r]))return t.values[r]=e,1}return 0},reconfigure:(t,e)=>{let a,l=e.config.address[s];if(null!=l){let s=tt(e,l);if(this.dependencies.every((i=>i instanceof E?e.facet(i)===t.facet(i):!(i instanceof q)||e.field(i,!1)==t.field(i,!1)))||(o?D(a=i(t),s,n):n(a=i(t),s)))return t.values[r]=s,0}else a=i(t);return t.values[r]=a,1}}}}function D(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 a(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(Y).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,Y.of({field:this,create:t})]}get extension(){return this}}const L=4,z=3,I=2,B=1;function j(t){return e=>new G(e,t)}const N={highest:j(0),high:j(B),default:j(I),low:j(z),lowest:j(L)};class G{constructor(t,e){this.inner=t,this.prec=e}}class F{of(t){return new H(this,t)}reconfigure(t){return F.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class H{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;function r(t,o){let a=s.get(t);if(null!=a){if(a<=o)return;let e=n[a].indexOf(t);e>-1&&n[a].splice(e,1),t instanceof H&&i.delete(t.compartment)}if(s.set(t,o),Array.isArray(t))for(let e of t)r(e,o);else if(t instanceof H){if(i.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");let n=e.get(t.compartment)||t.inner;i.set(t.compartment,n),r(n,o)}else if(t instanceof G)r(t.inner,t.prec);else if(t instanceof q)n[o].push(t),t.provides&&r(t.provides,o);else if(t instanceof M)n[o].push(t),t.facet.extensions&&r(t.facet.extensions,I);else{let e=t.extension;if(!e)throw new Error(`Unrecognized extension value in extension set (${t}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(e,o)}}return r(t,I),n.reduce(((t,e)=>t.concat(e)))}(t,e,r))i instanceof q?n.push(i):(s[i.facet.id]||(s[i.facet.id]=[])).push(i);let o=Object.create(null),a=[],l=[];for(let t of n)o[t.id]=l.length<<1,l.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]=a.length<<1|1,V(r,e))a.push(i.facet(n));else{let t=n.combine(e.map((t=>t.value)));a.push(i&&n.compare(t,i.facet(n))?i.facet(n):t)}else{for(let t of e)0==t.type?(o[t.id]=a.length<<1|1,a.push(t.value)):(o[t.id]=l.length<<1,l.push((e=>t.dynamicSlot(e))));o[n.id]=l.length<<1,l.push((t=>U(t,n,e)))}}let c=l.map((t=>t(o)));return new J(t,r,c,o,a,s)}}function K(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 tt(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}const et=E.define(),it=E.define({combine:t=>t.some((t=>t)),static:!0}),nt=E.define({combine:t=>t.length?t[0]:void 0,static:!0}),st=E.define(),rt=E.define(),ot=E.define(),at=E.define({combine:t=>!!t.length&&t[0]});class lt{constructor(t,e){this.type=t,this.value=e}static define(){return new ht}}class ht{of(t){return new lt(this,t)}}class ct{constructor(t){this.map=t}of(t){return new ut(this,t)}}class ut{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 ut(this.type,e)}is(t){return this.type==t}static define(t={}){return new ct(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}}ut.reconfigure=ut.define(),ut.appendConfig=ut.define();class dt{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&&T(i,e.newLength),s.some((t=>t.type==dt.time))||(this.annotations=s.concat(dt.time.of(Date.now())))}static create(t,e,i,n,s,r){return new dt(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(dt.userEvent);return!(!e||!(e==t||e.length>t.length&&e.slice(0,t.length)==t&&"."==e[t.length]))}}function ft(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=pt(n,Ot(e,r,t.changes.newLength),!0))}return n==t?t:dt.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(st)){let e=n(t);if(!1===e){i=!1;break}Array.isArray(e)&&(i=!0===i?e:ft(i,e))}if(!0!==i){let n,s;if(!1===i)s=t.changes.invertedDesc,n=k.empty(e.doc.length);else{let e=t.changes.filter(i);n=e.changes,s=e.filtered.mapDesc(e.changes).invertedDesc}t=dt.create(e,n,t.selection&&t.selection.map(s),ut.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let n=e.facet(rt);for(let i=n.length-1;i>=0;i--){let s=n[i](t);t=s instanceof dt?s:Array.isArray(s)&&1==s.length&&s[0]instanceof dt?s[0]:gt(e,bt(s),!1)}return t}(s):s)}dt.time=lt.define(),dt.userEvent=lt.define(),dt.addToHistory=lt.define(),dt.remote=lt.define();const mt=[];function bt(t){return null==t?mt:Array.isArray(t)?t:[t]}var wt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(wt||(wt={}));const vt=/[\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){}function St(t){return e=>{if(!/\S/.test(e))return wt.Space;if(function(t){if(yt)return yt.test(t);for(let e=0;e"€"&&(i.toUpperCase()!=i.toLowerCase()||vt.test(i)))return!0}return!1}(e))return wt.Word;for(let i=0;i-1)return wt.Word;return wt.Other}}class xt{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(ut.reconfigure)?(i=null,n=e.value):e.is(ut.appendConfig)&&(i=null,n=bt(n).concat(e.value));if(i)e=t.startState.values.slice();else{i=J.resolve(n,s,this),e=new xt(i,this.doc,this.selection,i.dynamicSlots.map((()=>null)),((t,e)=>e.reconfigure(t,this)),null).values}new xt(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:A.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=bt(i.effects);for(let i=1;is.spec.fromJSON(r,t))))}return xt.create({doc:t.doc,selection:A.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(xt.lineSeparator)||y)),s=e.selection?e.selection instanceof A?e.selection:A.single(e.selection.anchor,e.selection.head):A.single(0);return T(s,n.length),i.staticFacet(it)||(s=s.asSingle()),new xt(i,n,s,i.dynamicSlots.map((()=>null)),((t,e)=>e.create(t)),null)}get tabSize(){return this.facet(xt.tabSize)}get lineBreak(){return this.facet(xt.lineSeparator)||"\n"}get readOnly(){return this.facet(at)}phrase(t,...e){for(let e of this.facet(xt.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(et))for(let r of s(this,e,i))Object.prototype.hasOwnProperty.call(r,t)&&n.push(r[t]);return n}charCategorizer(t){return St(this.languageDataAt("wordChars",t).join(""))}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=f(e,r,!1);if(s(e.slice(t,r))!=wt.Word)break;r=t}for(;ot.length?t[0]:4}),xt.lineSeparator=nt,xt.readOnly=at,xt.phrases=E.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]))}}),xt.languageData=et,xt.changeFilter=st,xt.transactionFilter=rt,xt.transactionExtender=ot,F.reconfigure=ut.define();class Qt{eq(t){return this==t}range(t,e=t){return $t.create(t,e,this)}}Qt.prototype.startSide=Qt.prototype.endSide=0,Qt.prototype.point=!1,Qt.prototype.mapMode=S.TrackDel;let $t=class t{constructor(t,e,i){this.from=t,this.to=e,this.value=i}static create(e,i,n){return new t(e,i,n)}};function Pt(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Ct{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,a=s[n]-t||(i?this.value[n].endSide:this.value[n].startSide)-e;if(n==r)return a>=0?r:o;a>=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||l==h&&c.startSide>0&&c.endSide<=0)continue;(h-l||c.endSide-c.startSide)<0||(r<0&&(r=l),c.point&&(o=Math.max(o,h-l)),i.push(c),n.push(l-r),s.push(h-r))}return{mapped:i.length?new Ct(n,s,i,o):null,pos:r}}}class _t{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 _t(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(Pt)),this.isEmpty)return e.length?_t.of(e):this;let o=new At(this,null,-1).goto(0),a=0,l=[],h=new Xt;for(;o.value||a=0){let t=e[a++];h.addInner(t.from,t.to,t.value)||l.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 Tt.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return Tt.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)),a=Zt(r,o,i),l=new Et(r,a,s),h=new Et(o,a,s);i.iterGaps(((t,e,i)=>Vt(l,t,h,e,i,n))),i.empty&&0==i.length&&Vt(l,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=Zt(s,r),a=new Et(s,o,0).goto(i),l=new Et(r,o,0).goto(i);for(;;){if(a.to!=l.to||!Mt(a.active,l.active)||a.point&&(!l.point||!a.point.eq(l.point)))return!1;if(a.to>n)return!0;a.next(),l.next()}}static spans(t,e,i,n,s=-1){let r=new Et(t,null,s).goto(e),o=e,a=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,a),a=r.openEnd(t));if(r.to>i)return a+(r.point&&r.to>i?1:0);o=r.to,r.next()}}static of(t,e=!1){let i=new Xt;for(let n of t instanceof $t?[t]:e?function(t){if(t.length>1)for(let e=t[0],i=1;i0)return t.slice().sort(Pt);e=n}return t}(t):t)i.add(n.from,n.to,n.value);return i.finish()}}_t.empty=new _t([],[],null,-1),_t.empty.nextLayer=_t.empty;class Xt{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}finishChunk(t){this.chunks.push(new Ct(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=[])}add(t,e,i){this.addInner(t,e,i)||(this.nextLayer||(this.nextLayer=new Xt)).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(_t.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;let e=_t.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function Zt(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 At(r,e,i,s));return 1==n.length?n[0]:new Tt(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--)Rt(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--)Rt(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(),Rt(this.heap,0)}}}function Rt(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 Et{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=Tt.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){Dt(this.active,t),Dt(this.activeTo,t),Dt(this.activeRank,t),this.minActive=Ut(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&&Dt(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 Vt(t,e,i,n,s,r){t.goto(e),i.goto(n);let o=n+s,a=n,l=n-e;for(;;){let e=t.to+l-i.to||t.endSide-i.endSide,n=e<0?t.to+l: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))&&Mt(t.activeForPoint(t.to+l),i.activeForPoint(i.to))||r.comparePoint(a,s,t.point,i.point):s>a&&!Mt(t.active,i.active)&&r.compareRange(a,s,t.active,i.active),n>o)break;a=n,e<=0&&t.next(),e>=0&&i.next()}}function Mt(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 Ut(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(!l)throw new RangeError("The value of a property ("+i+") should be a primitive value.");s(n(i),o,a,h)}else null!=o&&a.push(i.replace(/_.*/,"").replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))+": "+o+";")}(a.length||h)&&r.push((!i||l||o?t:t.map(i)).join(", ")+" {"+a.join(" ")+"}")}for(let e in t)s(n(e),t[e],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let t=zt[qt]||1;return zt[qt]=t+1,"ͼ"+t.toString(36)}static mount(t,e){(t[Lt]||new jt(t)).mount(Array.isArray(e)?e:[e])}}let Bt=new Map;class jt{constructor(t){let e=t.ownerDocument||t,i=e.defaultView;if(!t.head&&t.adoptedStyleSheets&&i.CSSStyleSheet){let n=Bt.get(e);if(n)return t.adoptedStyleSheets=[n.sheet,...t.adoptedStyleSheets],t[Lt]=n;this.sheet=new i.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets],Bt.set(e,this)}else{this.styleTag=e.createElement("style");let i=t.head||t;i.insertBefore(this.styleTag,i.firstChild)}this.modules=[],t[Lt]=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:'"'},Ft="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),Ht="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Jt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Kt=Ht||Ft&&+Ft[1]<57,te=0;te<10;te++)Nt[48+te]=Nt[96+te]=String(te);for(te=1;te<=24;te++)Nt[te+111]="F"+te;for(te=65;te<=90;te++)Nt[te]=String.fromCharCode(te+32),Gt[te]=String.fromCharCode(te);for(var ee in Nt)Gt.hasOwnProperty(ee)||(Gt[ee]=Nt[ee]);function ie(t){let e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection()}function ne(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function se(t,e){if(!e.anchorNode)return!1;try{return ne(t,e.anchorNode)}catch(t){return!1}}function re(t){return 3==t.nodeType?me(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function oe(t,e,i,n){return!!i&&(le(t,e,i,n,-1)||le(t,e,i,n,1))}function ae(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function le(t,e,i,n,s){for(;;){if(t==i&&e==n)return!0;if(e==(s<0?0:he(t))){if("DIV"==t.nodeName)return!1;let i=t.parentNode;if(!i||1!=i.nodeType)return!1;e=ae(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?he(t):0}}}function he(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}const ce={left:0,right:0,top:0,bottom:0};function ue(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function de(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}class fe{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){this.set(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset)}set(t,e,i,n){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=n}}let pe,Oe=null;function ge(t){if(t.setActive)return t.setActive();if(Oe)return t.focus(Oe);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==Oe?{get preventScroll(){return Oe={preventScroll:!0},!0}}:void 0),!Oe){Oe=!1;for(let t=0;te)return i.domBoundsAround(t,e,l);if(c>=t&&-1==n&&(n=a,s=l),l>e&&i.dom.parentNode==this.dom){r=a,o=h;break}h=c,l=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.dirty|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.dirty|=2),1&e.dirty)return;e.dirty|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,this.dirty&&this.markParentsDirty(!0))}setDOM(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=ye){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 Qe(t,e,i,n,s,r,o,a,l){let{children:h}=t,c=h.length?h[e]:null,u=r.length?r[r.length-1]:null,d=u?u.breakAfter:o;if(!(e==n&&c&&!o&&!d&&r.length<2&&c.merge(i,s,r.length?u:null,0==i,a,l))){if(n0&&(!o&&r.length&&c.merge(i,c.length,r[0],!1,a,0)?c.breakAfter=r.shift().breakAfter:(i2);var De={mac:Me||/Mac/.test(Pe.platform),windows:/Win/.test(Pe.platform),linux:/Linux|X11/.test(Pe.platform),ie:Ae,ie_version:Xe?Ce.documentMode||6:Ze?+Ze[1]:_e?+_e[1]:0,gecko:Te,gecko_version:Te?+(/Firefox\/(\d+)/.exec(Pe.userAgent)||[0,0])[1]:0,chrome:!!Re,chrome_version:Re?+Re[1]:0,ios:Me,android:/Android\b/.test(Pe.userAgent),webkit:Ee,safari:Ve,webkit_version:Ee?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Ce.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class We extends Se{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(!i||i instanceof We&&!(this.length-(e-t)+i.length>256))&&(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),!0)}split(t){let e=new We(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new ve(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 Ye(this.dom,t,e)}}class Ue extends Se{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(we(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}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.dirty|=6)}sync(t,e){this.dom?4&this.dirty&&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 Ue&&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 Ue(this.mark,e,r)}domAtPos(t){return Ge(this,t)}coordsAt(t,e){return He(this,t,e)}}function Ye(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?De.chrome||De.gecko||(e?(s--,o=1):r=0)?0:a.length-1];return De.safari&&!o&&0==l.width&&(l=Array.prototype.find.call(a,(t=>t.width))||l),o?ue(l,o<0):l||null}class qe extends Se{constructor(t,e,i){super(),this.widget=t,this.length=e,this.side=i,this.prevWidget=null}static create(t,e,i){return new(t.customView||qe)(t,e,i)}split(t){let e=qe.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 qe&&this.widget.compare(i.widget))||t>0&&s<=0||e0)?ve.before(this.dom):ve.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let i=this.dom.getClientRects(),n=null;if(!i.length)return ce;for(let e=t>0?i.length-1:0;n=i[e],!(t>0?0==e:e==i.length-1||n.top0?-1:1);return this.length?n:ue(n,this.side>0)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class Le extends qe{domAtPos(t){let{topView:e,text:i}=this.widget;return e?ze(t,0,e,i,this.length-e.length,((t,e)=>t.domAtPos(e)),((t,e)=>new ve(t,Math.min(e,t.nodeValue.length)))):new ve(i,Math.min(t,i.nodeValue.length))}sync(){this.setDOM(this.widget.toDOM())}localPosFromDOM(t,e){let{topView:i,text:n}=this.widget;return i?Be(t,e,i,n,this.length-i.length):Math.min(e,this.length)}ignoreMutation(){return!1}get overrideDOMText(){return null}coordsAt(t,e){let{topView:i,text:n}=this.widget;return i?ze(t,e,i,n,this.length-i.length,((t,e,i)=>t.coordsAt(e,i)),((t,e,i)=>Ye(t,e,i))):Ye(n,t,e)}destroy(){var t;super.destroy(),null===(t=this.widget.topView)||void 0===t||t.destroy()}get isEditable(){return!0}canReuseDOM(){return!0}}function ze(t,e,i,n,s,r,o){if(i instanceof Ue){for(let a=i.dom.firstChild;a;a=a.nextSibling){let i=Se.get(a);if(i){let l=ne(a,n),h=i.length+(l?s:0);if(t0?ve.before(this.dom):ve.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){let e=this.dom.getBoundingClientRect(),i=function(t,e){let i=t.parent,n=i?i.children.indexOf(t):-1;for(;i&&n>=0;)if(e<0?n>0:n0?-1:1);return i&&i.tope.top?{left:e.left,right:e.right,top:i.top,bottom:i.bottom}:e}get overrideDOMText(){return t.empty}get isHidden(){return!0}}function Ge(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 Ue&&s.length&&(n=s[s.length-1])instanceof Ue&&n.mark.eq(e.mark)?Fe(n,e.children[0],i-1):(s.push(e),e.setParent(t)),t.length+=e.length}function He(t,e,i){let n=null,s=-1,r=null,o=-1;!function t(e,a){for(let l=0,h=0;l=a&&(c.children.length?t(c,a-h):(!r||r instanceof Ne&&i>0)&&(u>a||h==u&&c.getSide()>0)?(r=c,o=a-h):(h0?3e8:-4e8:e>0?1e8:-1e8,new oi(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}=ai(t,n);e=(s?n?-3e8:-1:5e8)-1,i=1+(r?n?2e8:1:-6e8)}return new oi(t,e,i,n,t.widget||null,!0)}static line(t){return new ri(t)}static set(t,e=!1){return _t.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}ni.none=_t.empty;class si extends ni{constructor(t){let{start:e,end:i}=ai(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){return this==t||t instanceof si&&this.tagName==t.tagName&&this.class==t.class&&Ke(this.attrs,t.attrs)}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}si.prototype.point=!1;class ri extends ni{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof ri&&this.spec.class==t.spec.class&&Ke(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)}}ri.prototype.mapMode=S.TrackBefore,ri.prototype.point=!0;class oi extends ni{constructor(t,e,i,n,s,r){super(e,i,s,t),this.block=n,this.isReplace=r,this.mapMode=n?e<=0?S.TrackBefore:S.TrackAfter:S.TrackDel}get type(){return this.startSide=5}eq(t){return t instanceof oi&&(e=this.widget,i=t.widget,e==i||!!(e&&i&&e.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var e,i}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 ai(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 li(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)}oi.prototype.point=!0;class hi extends Se{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 hi))return!1;this.dom||i.transferDOM(this)}return n&&this.setDeco(i?i.attrs:null),$e(this,t,e,i?i.children:[],s,r),!0}split(t){let e=new hi;if(e.breakAfter=this.breakAfter,0==this.length)return e;let{i: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){Ke(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){Fe(this,t,e)}addLineDeco(t){let e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=Je(e,this.attrs||{})),i&&(this.attrs=Je({class:i},this.attrs||{}))}domAtPos(t){return Ge(this,t)}reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.dirty|=6)}sync(t,e){var i;this.dom?4&this.dirty&&(we(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&&(ti(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&&Se.get(n)instanceof Ue;)n=n.lastChild;if(!(n&&this.length&&("BR"==n.nodeName||0!=(null===(i=Se.get(n))||void 0===i?void 0:i.isEditable)||De.ios&&this.children.some((t=>t instanceof We))))){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 We)||/[^ -~]/.test(i.text))return null;let n=re(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=He(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 hi)return s;if(r>e)break}n=r+s.breakAfter}return null}}class ci extends Se{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 ci&&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(di(new We(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 oi){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let o=e-t;if(i instanceof oi)if(i.block){let{type:t}=i;t!=ii.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new ci(i.widget||new fi("div"),o,t))}else{let r=qe.create(i.widget||new fi("span"),o,o?0:i.startSide),a=this.atCursorPos&&!r.isEditable&&s<=n.length&&(t0),l=!r.isEditable&&(tn.length||i.startSide<=0),h=this.getLine();2!=this.pendingBuffer||a||r.isEditable||(this.pendingBuffer=0),this.flushBuffer(n),a&&(h.append(di(new Ne(1),n),s),s=n.length+Math.max(0,s-n.length)),h.append(di(r,n),s),this.atCursorPos=l,this.pendingBuffer=l?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 ui(t,e,i,s);return r.openEnd=_t.spans(n,e,i,r),r.openStart<0&&(r.openStart=r.openEnd),r.finish(r.openEnd),r}}function di(t,e){for(let i of e)t=new Ue(i,[t],t.length);return t}class fi extends ei{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 pi=E.define(),Oi=E.define(),gi=E.define(),mi=E.define(),bi=E.define(),wi=E.define(),vi=E.define(),yi=E.define({combine:t=>t.some((t=>t))}),Si=E.define({combine:t=>t.some((t=>t))});class xi{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 xi(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin)}}const ki=ut.define({map:(t,e)=>t.map(e)});function Qi(t,e,i){let n=t.facet(mi);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 $i=E.define({combine:t=>!t.length||t[0]});let Pi=0;const Ci=E.define();class _i{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 _i(Pi++,t,i,(t=>{let e=[Ci.of(t)];return s&&e.push(Ti.of((e=>{let i=e.plugin(t);return i?s(i):ni.none}))),n&&e.push(n(t)),e}))}static fromClass(t,e){return _i.define((e=>new t(e)),e)}}class Xi{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(Qi(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){Qi(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){Qi(t.state,e,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Zi=E.define(),Ai=E.define(),Ti=E.define(),Ri=E.define(),Ei=E.define(),Vi=E.define();class Mi{constructor(t,e,i,n){this.fromA=t,this.toA=e,this.fromB=i,this.toB=n}join(t){return new Mi(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(!a)return i;new Mi(a.fromA,a.toA,a.fromB,a.toB).addToSet(i),r=a.toA,o=a.toB}}}class Di{constructor(t,e,i){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=k.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 Mi(t,e,i,s)))),this.changedRanges=n}static create(t,e,i){return new Di(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 Wi=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Wi||(Wi={}));const Ui=Wi.LTR,Yi=Wi.RTL;function qi(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}}const Gi=[];function Fi(t){return[new Ni(0,t,0)]}let Hi="";function Ji(t,e,i,n,s){var r;let o=n.head-t.from,a=-1;if(0==o){if(!s||!t.length)return null;e[0].level!=i&&(o=e[0].side(!1,i),a=0)}else if(o==t.length){if(s)return null;let t=e[e.length-1];t.level!=i&&(o=t.side(!0,i),a=e.length-1)}a<0&&(a=Ni.find(e,o,null!==(r=n.bidiLevel)&&void 0!==r?r:-1,n.assoc));let l=e[a];o==l.side(s,i)&&(l=e[a+=s?1:-1],o=l.side(!s,i));let h=s==(l.dir==i),c=f(t.text,o,h);if(Hi=t.text.slice(Math.min(o,c),Math.max(o,c)),c!=l.side(s,i))return A.cursor(c+t.from,h?-1:1,l.level);let u=a==(s?e.length-1:0)?null:e[a+(s?1:-1)];return u||l.level==i?u&&u.level1)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=Se.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 en(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}class nn{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class sn extends Se{constructor(t){super(),this.view=t,this.compositionDeco=ni.none,this.decorations=[],this.dynamicDecorationMap=[],this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(t.contentDOM),this.children=[new hi],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Mi(0,0,0,t.state.doc.length)],0)}get length(){return this.view.state.doc.length}update(t){let e=t.changedRanges;this.minWidth>0&&e.length&&(e.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),this.view.inputState.composing<0?this.compositionDeco=ni.none:(t.transactions.length||this.dirty)&&(this.compositionDeco=function(t,e){let i=on(t);if(!i)return ni.none;let{from:n,to:s,node:r,text:o}=i,a=e.mapPos(n,1),l=Math.max(a,e.mapPos(s,-1)),{state:h}=t,c=3==r.nodeType?r.nodeValue:new tn([],h).readRange(r.firstChild,null).text;if(l-a{this.dom.style.height=this.view.viewState.contentHeight+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let t=De.chrome||De.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,t),this.dirty=0,t&&(t.written||i.selectionRange.focusNode!=t.node)&&(this.forceSelection=!0),this.dom.style.height=""}));let n=[];if(this.view.viewport.from||this.view.viewport.to=0?t[e]:null;if(!n)break;let{fromA:s,toA:r,fromB:o,toB:a}=n,{content:l,breakAtStart:h,openStart:c,openEnd:u}=ui.build(this.view.state.doc,o,a,this.decorations,this.dynamicDecorationMap),{i:d,off:f}=i.findPos(r,1),{i:p,off:O}=i.findPos(s,-1);Qe(this,p,O,d,f,l,h,c,u)}}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&&se(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,a=this.domAtPos(o.anchor),l=o.empty?a:this.domAtPos(o.head);if(De.gecko&&o.empty&&!this.compositionDeco.size&&(1==(h=a).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((()=>a.node.insertBefore(t,a.node.childNodes[a.offset]||null))),a=l=new ve(t,0),r=!0}var h;let c=this.view.observer.selectionRange;!r&&c.focusNode&&oe(a.node,a.offset,c.anchorNode,c.anchorOffset)&&oe(l.node,l.offset,c.focusNode,c.focusOffset)||(this.view.observer.ignore((()=>{De.android&&De.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=ie(this.view.root);if(t)if(o.empty){if(De.gecko){let t=(e=a.node,n=a.offset,1!=e.nodeType?0:(n&&"false"==e.childNodes[n-1].contentEditable?1:0)|(no.head&&([a,l]=[l,a]),e.setEnd(l.node,l.offset),e.setStart(a.node,a.offset),t.removeAllRanges(),t.addRange(e)}else;var e,n;s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())})),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new ve(c.anchorNode,c.anchorOffset),this.impreciseHead=l.precise?null:new ve(c.focusNode,c.focusOffset)}enforceCursorAssoc(){if(this.compositionDeco.size)return;let{view:t}=this,e=t.state.selection.main,i=ie(t.root),{anchorNode:n,anchorOffset:s}=t.observer.selectionRange;if(!(i&&e.empty&&e.assoc&&i.modify))return;let r=hi.find(this,e.head);if(!r)return;let o=r.posAtStart;if(e.head==o||e.head==o+r.length)return;let a=this.coordsAt(e.head,-1),l=this.coordsAt(e.head,1);if(!a||!l||a.bottom>l.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)}nearest(t){for(let e=t;e;){let t=Se.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!=ii.WidgetBefore&&s.type!=ii.WidgetAfter&&(!n||2==e||this.children[n-1].breakAfter||this.children[n-1].type==ii.WidgetBefore&&e>-2))return s.coordsAt(t-r,e);i=r}}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,a=this.view.textDirection==Wi.LTR;for(let t=0,l=0;ln)break;if(t>=i){let i=h.dom.getBoundingClientRect();if(e.push(i.height),r){let e=h.dom.lastChild,n=e?re(e):[];if(n.length){let e=n[n.length-1],r=a?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?Wi.RTL:Wi.LTR}measureTextSize(){for(let t of this.children)if(t instanceof hi){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.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(n);let s=re(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 ke(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;t.push(ni.replace({widget:new rn(n),block:!0,inclusive:!0,isBlockGap:!0}).range(i,r))}if(!s)break;i=s.to+1}return ni.set(t)}updateDeco(){let t=this.view.state.facet(Ti).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=0,r=0,o=0,a=0;for(let t of this.view.state.facet(Ei).map((t=>t(this.view))))if(t){let{left:e,right:i,top:n,bottom:l}=t;null!=e&&(s=Math.max(s,e)),null!=i&&(r=Math.max(r,i)),null!=n&&(o=Math.max(o,n)),null!=l&&(a=Math.max(a,l))}let l={left:n.left-s,top:n.top-o,right:n.right+r,bottom:n.bottom+a};!function(t,e,i,n,s,r,o,a){let l=t.ownerDocument,h=l.defaultView||window;for(let c=t;c;)if(1==c.nodeType){let t,u=c==l.body;if(u)t=de(h);else{if(c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let e=c.getBoundingClientRect();t={left:e.left,right:e.left+c.clientWidth,top:e.top,bottom:e.top+c.clientHeight}}let d=0,f=0;if("nearest"==s)e.top0&&e.bottom>t.bottom+f&&(f=e.bottom-t.bottom+f+o)):e.bottom>t.bottom&&(f=e.bottom-t.bottom+o,i<0&&e.top-f0&&e.right>t.right+d&&(d=e.right-t.right+d+r)):e.right>t.right&&(d=e.right-t.right+r,i<0&&e.left0))break;i=i.childNodes[n-1],n=he(i)}if(i>=0)for(let n=t,s=e;;){if(3==n.nodeType)return n;if(!(1==n.nodeType&&s=0))break;n=n.childNodes[s],s=0}return null}class hn{constructor(){this.changes=[]}compareRange(t,e){li(t,e,this.changes)}comparePoint(t,e){li(t,e,this.changes)}}function cn(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function un(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function dn(t,e){return t.tope.top+1}function fn(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,a,l,h,c,u=!1;for(let d=t.firstChild;d;d=d.nextSibling){let t=re(d);for(let f=0;fg||o==g&&r>O){n=d,s=p,r=O,o=g;let a=g?i0?f0)}0==O?i>p.bottom&&(!h||h.bottomp.top)&&(l=d,c=p):h&&dn(h,p)?h=pn(h,p.bottom):c&&dn(c,p)&&(c=fn(c,p.top))}}if(h&&h.bottom>=i?(n=a,s=h):c&&c.top<=i&&(n=l,s=c),!n)return{node:t,offset:0};let d=Math.max(s.left,Math.min(s.right,e));return 3==n.nodeType?gn(n,d,i):u&&"false"!=n.contentEditable?On(n,d,i):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,n)+(e>=(s.left+s.right)/2?1:0)}}function gn(t,e,i){let n=t.nodeValue.length,s=-1,r=1e9,o=0;for(let a=0;ai?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(De.chrome||De.gecko){me(t,a).getBoundingClientRect().left==h.right&&(n=!i)}if(c<=0)return{node:t,offset:a+(n?1:0)};s=a+(n?1:0),r=c}}}return{node:t,offset:s>-1?s:o>0?t.nodeValue.length:0}}function mn(t,e,i,n=-1){var s,r;let o,a=t.contentDOM.getBoundingClientRect(),l=a.top+t.viewState.paddingTop,{docHeight:h}=t.viewState,{x:c,y:u}=e,d=u-l;if(d<0)return 0;if(d>h)return t.state.doc.length;for(let e=t.defaultLineHeight/2,s=!1;o=t.elementAtHeight(d),o.type!=ii.Text;)for(;d=n>0?o.bottom+e:o.top-e,!(d>=0&&d<=h);){if(s)return i?null:0;s=!0,n=-n}u=l+d;let f=o.from;if(ft.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:bn(t,a,o,c,u);let p=t.dom.ownerDocument,O=t.root.elementFromPoint?t.root:p,g=O.elementFromPoint(c,u);g&&!t.contentDOM.contains(g)&&(g=null),g||(c=Math.max(a.left+1,Math.min(a.right-1,c)),g=O.elementFromPoint(c,u),g&&!t.contentDOM.contains(g)&&(g=null));let m,b=-1;if(g&&0!=(null===(s=t.docView.nearest(g))||void 0===s?void 0:s.isEditable))if(p.caretPositionFromPoint){let t=p.caretPositionFromPoint(c,u);t&&({offsetNode:m,offset:b}=t)}else if(p.caretRangeFromPoint){let e=p.caretRangeFromPoint(c,u);e&&(({startContainer:m,startOffset:b}=e),(!t.contentDOM.contains(m)||De.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 me(t,n-1,n).getBoundingClientRect().left>i}(m,b,c)||De.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}let n=1==t.nodeType?t.getBoundingClientRect():me(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return i-n.left>5}(m,b,c))&&(m=void 0))}if(!m||!t.docView.dom.contains(m)){let e=hi.find(t.docView,f);if(!e)return d>o.top+o.height/2?o.to:o.from;({node:m,offset:b}=On(e.dom,c,u))}let w=t.docView.nearest(m);if(!w)return null;if(w.isWidget&&1==(null===(r=w.dom)||void 0===r?void 0:r.nodeType)){let t=w.dom.getBoundingClientRect();return e.y1.5*t.defaultLineHeight){r+=Math.floor((s-i.top)/t.defaultLineHeight)*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=f(t,n)}return!0===n?-1:t.length}(o,r,t.state.tabSize)}function wn(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=t.bidiSpans(s),o=t.textDirectionAt(s.from);for(let a=e,l=null;;){let e=Ji(s,r,o,a,i),h=Hi;if(!e){if(s.number==(i?t.state.doc.lines:1))return a;h="\n",s=t.state.doc.line(s.number+(i?1:-1)),r=t.bidiSpans(s),e=A.cursor(i?s.from:s.to)}if(l){if(!l(h))return a}else{if(!n)return e;l=n(h)}a=e}}function vn(t,e,i,n){let s=t.state.facet(Ri).map((e=>e(t)));for(;;){let t=!1;for(let r of s)r.between(i.from-1,i.from+1,((s,r,o)=>{i.from>s&&i.fromi.from?A.cursor(s,1):A.cursor(r,-1),t=!0,o.widget.skipPosition&&(i=o.widget.skipPosition(i,e,n)))}));if(!t)return i}}class yn{constructor(t){this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null;let e=(e,i)=>{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 Cn){let n=Cn[i];t.contentDOM.addEventListener(i,(i=>{Pn(t,i)&&e(n,i)}),_n[i]),this.registeredEvents.push(i)}t.scrollDOM.addEventListener("mousedown",(i=>{if(i.target==t.scrollDOM&&i.clientY>t.contentDOM.getBoundingClientRect().bottom&&(e(Cn.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)}})),De.chrome&&102==De.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,De.safari&&t.contentDOM.addEventListener("input",(()=>null))}setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}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=>{Pn(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){Qi(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){Qi(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||xn.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,be(t.contentDOM,e.key,e.keyCode))}ignoreDuringComposition(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(De.safari&&!De.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 Sn=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],xn="dthko",kn=[16,17,18,20,91,92,224,225];function Qn(t){return.7*Math.max(0,t)+8}class $n{constructor(t,e,i,n){this.view=t,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);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(xt.allowMultipleSelections)&&function(t,e){let i=t.state.facet(pi);return i.length?i[0](e):(De.mac,e.altKey)}(t,e),this.dragMove=function(t,e){let i=t.state.facet(Oi);return i.length?i[0](e):De.mac?!e.altKey:!e.ctrlKey}(t,e),this.dragging=!(!function(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let n=ie(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!=Yn(e))&&null}start(t){!1===this.dragging&&(t.preventDefault(),this.select(t))}move(t){var e;if(0==t.buttons)return this.destroy();if(!1!==this.dragging)return;this.select(this.lastEvent=t);let i=0,n=0,s=(null===(e=this.scrollParent)||void 0===e?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight};t.clientX<=s.left+6?i=-Qn(s.left-t.clientX):t.clientX>=s.right-6&&(i=Qn(t.clientX-s.right)),t.clientY<=s.top+6?n=-Qn(s.top-t.clientY):t.clientY>=s.bottom-6&&(n=Qn(t.clientY-s.bottom)),this.setScrollSpeed(i,n)}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)}select(t){let e=this.style.get(t,this.extend,this.multiple);!this.mustSelect&&e.eq(this.view.state.selection)&&e.main.assoc==this.view.state.selection.main.assoc||this.view.dispatch({selection:e,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.docChanged&&this.dragging&&(this.dragging=this.dragging.map(t.changes)),this.style.update(t)&&setTimeout((()=>this.select(this.lastEvent)),20)}}function Pn(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=Se.get(n))&&i.ignoreEvent(e))return!1;return!0}const Cn=Object.create(null),_n=Object.create(null),Xn=De.ie&&De.ie_version<15||De.ios&&De.webkit_version<604;function Zn(t,e){let i,{state:n}=t,s=1,r=n.toText(e),o=r.lines==n.selection.ranges.length;if(null!=Ln&&n.selection.ranges.every((t=>t.empty))&&Ln==r.toString()){let t=-1;i=n.changeByRange((i=>{let a=n.doc.lineAt(i.from);if(a.from==t)return{range:i};t=a.from;let l=n.toText((o?r.line(s++).text:e)+n.lineBreak);return{changes:{from:a.from,insert:l},range:A.cursor(i.from+l.length)}}))}else i=o?n.changeByRange((t=>{let e=r.line(s++);return{changes:{from:t.from,to:t.to,insert:e.text},range:A.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 A.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 A.cursor(e);0==r?i=1:r==s.length&&(i=-1);let o=r,a=r;i<0?o=f(s.text,r,!1):a=f(s.text,r);let l=n(s.text.slice(o,a));for(;o>0;){let t=f(s.text,o,!1);if(n(s.text.slice(t,o))!=l)break;o=t}for(;a{t.inputState.setSelectionOrigin("select"),27==e.keyCode&&(t.inputState.lastEscPress=Date.now())},Cn.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},Cn.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},_n.touchstart=_n.touchmove={passive:!0},Cn.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return;let i=null;for(let n of t.state.facet(gi))if(i=n(t,e),i)break;if(i||0!=e.button||(i=function(t,e){let i=Vn(t,e),n=Yn(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 a,l=Vn(t,e),h=An(t,l.pos,l.bias,n);if(i.pos!=l.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&&(a=function(t,e){for(let i=0;i=e)return A.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,l.pos))?a:o?s.addRange(h):A.create([h])}}}(t,e)),i){let n=t.root.activeElement!=t.contentDOM;t.inputState.startMouseSelection(new $n(t,e,i,n)),n&&t.observer.ignore((()=>ge(t.contentDOM))),t.inputState.mouseSelection&&t.inputState.mouseSelection.start(e)}};let Tn=(t,e)=>t>=e.top&&t<=e.bottom,Rn=(t,e,i)=>Tn(e,i)&&t>=i.left&&t<=i.right;function En(t,e,i,n){let s=hi.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&&Rn(i,n,o))return-1;let a=s.coordsAt(r,1);return a&&Rn(i,n,a)?1:o&&Tn(n,o)?-1:1}function Vn(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:En(t,i,e.clientX,e.clientY)}}const Mn=De.ie&&De.ie_version<=11;let Dn=null,Wn=0,Un=0;function Yn(t){if(!Mn)return t.detail;let e=Dn,i=Un;return Dn=t,Un=Date.now(),Wn=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Wn+1)%3:1}function qn(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&&r.dragMove?{from:r.dragging.from,to:r.dragging.to}:null,a={from:s,insert:i},l=t.state.changes(o?[o,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(s,-1),head:l.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"})}Cn.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")},Cn.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&&qn(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 qn(t,e,e.dataTransfer.getData("Text"),!0)},Cn.paste=(t,e)=>{if(t.state.readOnly)return e.preventDefault();t.observer.flush();let i=Xn?null:e.clipboardData;i?(Zn(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(),Zn(t,i.value)}),50)}(t)};let Ln=null;Cn.copy=Cn.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;Ln=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 zn=lt.define();function In(t,e){let i=[];for(let n of t.facet(vi)){let s=n(t,e);s&&i.push(s)}return i?t.update({effects:i,annotations:zn.of(!0)}):null}function Bn(t){setTimeout((()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=In(t.state,e);i?t.dispatch(i):t.update([])}}),10)}Cn.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),Bn(t)},Cn.blur=t=>{t.observer.clearSelectionRange(),Bn(t)},Cn.compositionstart=Cn.compositionupdate=t=>{null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},Cn.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,De.chrome&&De.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then((()=>t.observer.flush())):setTimeout((()=>{t.inputState.composing<0&&t.docView.compositionDeco.size&&t.update([])}),50)},Cn.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},Cn.beforeinput=(t,e)=>{var i;let n;if(De.chrome&&De.android&&(n=Sn.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 jn=["pre-wrap","normal","pre-line","break-spaces"];class Nn{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){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return jn.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i-1,a=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,a){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)>Jn&&(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:a,toA:l,fromB:h,toB:c}=n[o],u=s.lineAt(a,Hn.ByPosNoHeight,i.setDoc(e),0,0),d=u.to>=l?u:s.lineAt(l,Hn.ByPosNoHeight,i,0,0);for(c+=d.to-l,l=d.to;o>0&&u.from<=n[o-1].toA;)a=n[o-1].fromA,h=n[o-1].fromB,o--,a2*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 es extends ts{constructor(t,e){super(t,e,ii.Text),this.collapsed=0,this.widgetHeight=0}replace(t,e,i){let n=i[0];return 1==i.length&&(n instanceof es||n instanceof is&&4&n.flags)&&Math.abs(this.length-n.length)<10?(n instanceof is?n=new es(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.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class is 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:a}=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),l=o+r.length*a,h=Math.max(i,t-l/2);return new Fn(r.from,r.length,h,l,ii.Text)}{let n=Math.max(0,Math.min(r-s,Math.floor((t-i)/o))),{from:a,length:l}=e.doc.line(s+n);return new Fn(a,l,i+o*n,o,ii.Text)}}lineAt(t,e,i,n,s){if(e==Hn.ByHeight)return this.blockAt(t,i,n,s);if(e==Hn.ByPosNoHeight){let{from:e,to:n}=i.doc.lineAt(t);return new Fn(e,n-e,0,0,ii.Text)}let{firstLine:r,perLine:o,perChar:a}=this.heightMetrics(i,s),l=i.doc.lineAt(t),h=o+l.length*a,c=l.number-r,u=n+o*c+a*(l.from-s-c);return new Fn(l.from,l.length,Math.max(n,Math.min(u,n+this.height-h)),h,ii.Text)}forEachLine(t,e,i,n,s,r){t=Math.max(t,s),e=Math.min(e,s+this.length);let{firstLine:o,perLine:a,perChar:l}=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+=a*i+l*(t-s-i)}let n=a+l*e.length;r(new Fn(e.from,e.length,c,n,ii.Text)),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 is?i[i.length-1]=new is(t.length+n):i.push(null,new is(n-1))}if(t>0){let e=i[0];e instanceof is?i[0]=new is(t+e.length):i.unshift(new is(t-1),null)}return Kn.of(i)}decomposeLeft(t,e){e.push(new is(t-1),null)}decomposeRight(t,e){e.push(null,new is(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 is(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)>=Jn&&(o=-2);let a=new es(e,s);a.outdated=!1,i.push(a),r+=e+1}r<=s&&i.push(null,new is(s-r).updateHeight(t,r));let a=Kn.of(i);return(o<0||Math.abs(a.height-this.height)>=Jn||Math.abs(o-this.heightMetrics(t,e).perLine)>=Jn)&&(t.heightChanged=!0),a}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class ns 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 l;let h=e==Hn.ByPosNoHeight?Hn.ByPosNoHeight:Hn.ByPos;return a?l.join(this.right.lineAt(o,h,i,r,o)):this.left.lineAt(o,h,i,n,s).join(l)}forEachLine(t,e,i,n,s,r){let o=n+this.left.height,a=s+this.left.length+this.break;if(this.break)t=a&&this.right.forEachLine(t,e,i,o,a,r);else{let l=this.lineAt(a,Hn.ByPos,i,n,s);t=t&&l.from<=e&&r(l),e>l.to&&this.right.forEachLine(l.to+1,e,i,o,a,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&&ss(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,a=null;return n&&n.from<=e+s.length&&n.more?a=s=s.updateHeight(t,e,i,n):s.updateHeight(t,e,i),n&&n.from<=o+r.length&&n.more?a=r=r.updateHeight(t,o,i,n):r.updateHeight(t,o,i),a?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 ss(t,e){let i,n;null==t[e]&&(i=t[e-1])instanceof is&&(n=t[e+1])instanceof is&&t.splice(e-1,3,new is(i.length+1+n.length))}class rs{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 es?i.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new es(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)}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 es(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let i=new is(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 es)return t;let e=new es(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine(),t.type!=ii.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,t.type!=ii.WidgetBefore&&(this.covering=t)}addLineDeco(t,e){let i=this.ensureLine();i.length+=e,i.collapsed+=e,i.widgetHeight=Math.max(i.widgetHeight,t),this.writtenTo=this.pos=this.pos+e}finish(t){let e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof es||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),a=Math.max(a,n.top),l=e==t.parentNode?n.bottom:Math.min(l,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:a-(i.top+e),bottom:Math.max(a,l)-(i.top+e)}}function ls(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class hs{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 Nn(i),this.stateDeco=e.facet(Ti).filter((t=>"function"!=typeof t)),this.heightMap=Kn.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle.setDoc(e.doc),[new Mi(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ni.set(this.lineGaps.map((t=>t.draw(!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 ds(e,i))}}this.viewports=t.sort(((t,e)=>t.from-e.from)),this.scaler=this.heightMap.height<=7e6?gs:new ms(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:bs(t,this.scaler))}))}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=this.state.facet(Ti).filter((t=>"function"!=typeof t));let n=t.changedRanges,s=Mi.extendWithRanges(n,function(t,e,i){let n=new os;return _t.compare(t,e,i,n,0),n.changes}(i,this.stateDeco,t?t.changes:k.empty(this.state.doc.length))),r=this.heightMap.height;this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),s),this.heightMap.height!=r&&(t.flags|=2);let o=s.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.heado.to)||!this.viewportIsAppropriate(o))&&(o=this.getViewport(0,e));let a=!t.changes.empty||2&t.flags||o.from!=this.viewport.from||o.to!=this.viewport.to;this.viewport=o,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(Si)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let i=e.contentDOM,n=window.getComputedStyle(i),s=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Wi.RTL:Wi.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),a=i.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let h=0,c=0,u=parseInt(n.paddingTop)||0,d=parseInt(n.paddingBottom)||0;this.paddingTop==u&&this.paddingBottom==d||(this.paddingTop=u,this.paddingBottom=d,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let f=(this.printing?ls:as)(i,this.paddingTop),p=f.top-this.pixelViewport.top,O=f.bottom-this.pixelViewport.bottom;this.pixelViewport=f;let g=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(g!=this.inView&&(this.inView=g,g&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let m=a.width;if(this.contentDOMWidth==m&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,h|=8),l){let i=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(i)&&(o=!0),o||s.lineWrapping&&Math.abs(m-this.contentDOMWidth)>s.charWidth){let{lineHeight:t,charWidth:n,textHeight:a}=e.docView.measureTextSize();o=t>0&&s.refresh(r,t,n,a,m/n,i),o&&(e.docView.minWidth=0,h|=8)}p>0&&O>0?c=Math.max(p,O):p<0&&O<0&&(c=Math.min(p,O)),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 Mi(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new Gn(n.from,r))}s.heightChanged&&(h|=2)}let b=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return b&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(2&h||b)&&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,a=new ds(n.lineAt(r-1e3*i,Hn.ByHeight,s,0,0).from,n.lineAt(o+1e3*(1-i),Hn.ByHeight,s,0,0).to);if(e){let{head:t}=e.range;if(ta.to){let i,r=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=n.lineAt(t,Hn.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!=Wi.LTR&&!i)return[];let o=[],a=(n,r,l,h)=>{if(r-nn&&tt.from>=l.from&&t.to<=l.to&&Math.abs(t.from-n)t.frome))));if(!d){if(rt.from<=r&&t.to>=r))){let t=e.moveToLineBoundary(A.cursor(r),!1,!0).head;t>n&&(r=t)}d=new hs(n,r,this.gapSize(l,n,r,h))}o.push(d)};for(let t of this.viewportLines){if(t.lengtht.from&&a(t.from,s,t,e),ot.draw(this.heightOracle.lineWrapping)))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];_t.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))||bs(this.heightMap.lineAt(t,Hn.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return bs(this.heightMap.lineAt(this.scaler.fromDOM(t),Hn.ByHeight,this.heightOracle,0,0),this.scaler)}elementAtHeight(t){return bs(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 ds{constructor(t,e){this.from=t,this.to=e}}function fs(t,e,i){let n=[],s=t,r=0;return _t.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 Os(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 gs={toDOM:t=>t,fromDOM:t=>t,scale:1};class ms{constructor(t,e,i){let n=0,s=0,r=0;this.viewports=i.map((({from:i,to:s})=>{let r=e.lineAt(i,Hn.ByPos,t,0,0).top,o=e.lineAt(s,Hn.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=ebs(t,e))):t.type)}const ws=E.define({combine:t=>t.join(" ")}),vs=E.define({combine:t=>t.indexOf(!0)>-1}),ys=It.newName(),Ss=It.newName(),xs=It.newName(),ks={"&light":"."+Ss,"&dark":"."+xs};function Qs(t,e,i){return new It(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 $s=Qs("."+ys,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",borderRadius:"4px",marginTop:"0.5rem",width:"30%",minWidth:"190px",marginLeft:"auto",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&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:"#333338",fontSize:"70%",padding:".2em 1em",borderRadius:"4px"},"&light .cm-button":{background:"#eee"},"&dark .cm-button":{background:"#eee"},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",borderRadius:"0.25rem",border:"1px solid silver",padding:".0em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},ks);class Ps{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;i&&(e.push(new nn(i,n)),s==i&&r==n||e.push(new nn(s,r)));return e}(t),i=new tn(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?A.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||!ne(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||!ne(t.contentDOM,e.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(e.anchorNode,e.anchorOffset);this.newSel=A.single(n,i)}}}function Cs(e,i){let n,{newSel:s}=i,r=e.state.selection.main;if(i.bounds){let{from:s,to:o}=i.bounds,a=r.from,l=null;(8===e.inputState.lastKeyCode&&e.inputState.lastKeyTime>Date.now()-100||De.android&&i.text.length0&&a>0&&t.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if("end"==n){i-=o+Math.max(0,r-Math.min(o,a))-r}if(o=o?r-i:0,a=r+(a-o),o=r}else if(a=a?r-i:0,o=r+(o-a),a=r}return{from:r,toA:o,toB:a}}(e.state.doc.sliceString(s,o,Ki),i.text,a-s,l);h&&(De.chrome&&13==e.inputState.lastKeyCode&&h.toB==h.from+2&&i.text.slice(h.from,h.toB)==Ki+Ki&&h.toB--,n={from:s+h.from,to:s+h.toA,insert:t.of(i.text.slice(h.from,h.toB).split(Ki))})}else s&&(!e.hasFocus&&e.state.facet($i)||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))}:(De.mac||De.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=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}):De.chrome&&n&&n.from==n.to&&n.from==r.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(s&&(s=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}),n){let t=e.state;if(De.ios&&e.inputState.flushIOSKey(e))return!0;if(De.android&&(n.from==r.from&&n.to==r.to&&1==n.insert.length&&2==n.insert.lines&&be(e.contentDOM,"Enter",13)||n.from==r.from-1&&n.to==r.to&&0==n.insert.length&&be(e.contentDOM,"Backspace",8)||n.from==r.from&&n.to==r.to+1&&0==n.insert.length&&be(e.contentDOM,"Delete",46)))return!0;let i,o=n.insert.toString();if(e.state.facet(wi).some((t=>t(e,n.from,n.to,o))))return!0;if(e.inputState.composing>=0&&e.inputState.composing++,n.from>=r.from&&n.to<=r.to&&n.to-n.from>=(r.to-r.from)/3&&(!s||s.main.empty&&s.main.from==n.from+n.insert.length)&&e.inputState.composing<0){let s=r.fromn.to?t.sliceDoc(n.to,r.to):"";i=t.replaceSelection(e.state.toText(s+n.insert.sliceString(0,void 0,e.state.lineBreak)+o))}else{let o=t.changes(n),a=s&&s.main.to<=o.newLength?s.main:void 0;if(t.selection.ranges.length>1&&e.inputState.composing>=0&&n.to<=r.to&&n.to>=r.to-10){let s=e.state.sliceDoc(n.from,n.to),l=on(e)||e.state.doc.lineAt(r.head),h=r.to-n.to,c=r.to-r.from;i=t.changeByRange((i=>{if(i.from==r.from&&i.to==r.to)return{changes:o,range:a||i.map(o)};let u=i.to-h,d=u-s.length;if(i.to-i.from!=c||e.state.sliceDoc(d,u)!=s||l&&i.to>=l.from&&i.from<=l.to)return{range:i};let f=t.changes({from:d,to:u,insert:n.insert}),p=i.to-r.to;return{changes:f,range:a?A.range(Math.max(0,a.anchor+p),Math.max(0,a.head+p)):i.map(f)}}))}else i={changes:o,selection:a&&t.selection.replaceRange(a)}}let a="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,a+=".compose",e.inputState.compositionFirstChange&&(a+=".start",e.inputState.compositionFirstChange=!1)),e.dispatch(i,{scrollIntoView:!0,userEvent:a}),!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 _s={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Xs=De.ie&&De.ie_version<=11;class Zs{constructor(t){this.view=t,this.active=!1,this.selectionRange=new fe,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);(De.ie&&De.ie_version<=11||De.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()})),Xs&&(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")))}),{}),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($i)?i.root.activeElement!=this.dom:!se(i.dom,n))return;let s=n.anchorNode&&i.docView.nearest(n.anchorNode);s&&s.ignoreEvent(t)?e||(this.selectionChanged=!1):(De.ie&&De.ie_version<=11||De.android&&De.chrome)&&!i.state.selection.main.empty&&n.focusNode&&oe(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=De.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,a=t.docView.domAtPos(t.state.selection.main.anchor);oe(a.node,a.offset,r,o)&&([n,s,r,o]=[r,o,n,s]);return{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:o}}(this.view)||ie(t.root);if(!e||this.selectionRange.eq(e))return!1;let i=se(this.dom,e);return i&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let t=this.delayedAndroidKey;t&&(this.clearDelayedAndroidKey(),!this.flush()&&t.force&&be(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&&se(this.dom,this.selectionRange);return t<0&&!n?null:(t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new Ps(this.view,t,e,i))}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=Cs(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.dirty|=4),"childList"==t.type){let i=As(e,t.previousSibling||t.target.previousSibling,-1),n=As(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 As(t,e,i){for(;e;){let n=Se.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 Ts{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),this._dispatch=t.dispatch||(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 us(t.state||xt.create(t)),this.plugins=this.state.facet(Ci).map((t=>new Xi(t)));for(let t of this.plugins)t.update(this);this.observer=new Zs(this),this.inputState=new yn(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new sn(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),t.parent&&t.parent.appendChild(this.dom)}get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}dispatch(...t){this._dispatch(1==t.length&&t[0]instanceof dt?t[0]:this.state.update(...t))}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,a=null;t.some((t=>t.annotation(zn)))?(this.inputState.notifiedFocused=r,o=1):r!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=r,a=In(s,r),a||(o=1));let l=this.observer.delayedAndroidKey,h=null;if(l?(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(xt.phrases)!=this.state.facet(xt.phrases))return this.setState(s);e=Di.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 xi(t.empty?t:A.cursor(t.head,t.head>t.anchor?-1:1))}for(let t of e.effects)t.is(ki)&&(c=t.value)}this.viewState.update(e,c),this.bidiCache=Vs.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),i=this.docView.update(e),this.state.facet(Vi)!=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(ws)!=e.state.facet(ws)&&(this.viewState.mustMeasureContent=!0),(i||n||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!e.empty)for(let t of this.state.facet(bi))t(e);(a||h)&&Promise.resolve().then((()=>{a&&this.state==a.startState&&this.dispatch(a),h&&!Cs(this,h)&&l.force&&be(this.contentDOM,l.key,l.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 us(t),this.plugins=t.facet(Ci).map((t=>new Xi(t))),this.pluginMap.clear();for(let t of this.plugins)t.update(this);this.docView=new sn(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(Ci),i=t.state.facet(Ci);if(e!=i){let n=[];for(let s of i){let i=e.indexOf(s);if(i<0)n.push(new Xi(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.measureScheduled=0,t&&this.observer.forceFlush();let e=null,{scrollHeight:i,scrollTop:n,clientHeight:s}=this.scrollDOM,r=n>i-s-4?i:n;try{for(let t=0;;t++){this.updateState=1;let i=this.viewport,n=this.viewState.lineBlockAtHeight(r),s=this.viewState.measure(this);if(!s&&!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 o=[];4&s||([this.measureRequests,o]=[o,this.measureRequests]);let a=o.map((t=>{try{return t.read(this)}catch(t){return Qi(this.state,t),Es}})),l=Di.create(this,this.state,[]),h=!1,c=!1;l.flags|=s,e?e.flags|=s:e=l,this.updateState=2,l.empty||(this.updatePlugins(l),this.inputState.update(l),this.updateAttrs(),h=this.docView.update(l));for(let t=0;t1||t<-1)&&(this.scrollDOM.scrollTop+=t,c=!0)}if(h&&this.docView.updateSelection(!0),this.viewport.from==i.from&&this.viewport.to==i.to&&!c&&0==this.measureRequests.length)break}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let t of this.state.facet(bi))t(e)}get themeClasses(){return ys+" "+(this.state.facet(vs)?xs:Ss)+" "+this.state.facet(ws)}updateAttrs(){let t=Ms(this,Zi,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet($i)?"true":"false",class:"cm-content",style:`${De.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Ms(this,Ai,e);let i=this.observer.ignore((()=>{let i=ti(this.contentDOM,this.contentAttrs,e),n=ti(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)if(t.is(Ts.announce)){e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(Vi),It.mount(this.root,this.styleModules.concat($s).reverse())}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}}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 vn(this,t,wn(this,t,e,i))}moveByCharSelected(t,e,i){return vn(this,t,wn(this,t,e,i),!0)}moveByGroup(t,e){return vn(this,t,wn(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==wt.Space&&(s=e),s==e}}(this,t.head,e))))}moveToLineBoundary(t,e,i=!0){return function(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=n&&t.lineWrapping?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==Wi.LTR)?e.right-1:e.left+1,y:(r.top+r.bottom)/2});if(null!=o)return A.cursor(o,i?-1:1)}let o=hi.find(t.docView,e.head),a=o?i?o.posAtEnd:o.posAtStart:i?s.to:s.from;return A.cursor(a,i?-1:1)}(this,t,e,i)}moveVertically(t,e,i){return vn(this,t,function(t,e,i,n){let s=e.head,r=i?1:-1;if(s==(i?t.state.doc.length:0))return A.cursor(s,e.assoc);let o,a=e.goalColumn,l=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s),c=t.documentTop;if(h)null==a&&(a=h.left-l.left),o=r<0?h.top:h.bottom;else{let e=t.viewState.lineBlockAt(s);null==a&&(a=Math.min(l.right-l.left,t.defaultCharacterWidth*(s-e.from))),o=(r<0?e.top:e.bottom)+c}let u=l.left+a,d=null!=n?n:t.defaultLineHeight>>1;for(let i=0;;i+=10){let n=o+(d+i)*r,h=mn(t,{x:u,y:n},!1,r);if(nl.bottom||(r<0?hs))return A.cursor(h,e.assoc,void 0,a)}}(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(),mn(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 ue(i,s[Ni.find(s,t-n.from,-1,e)].dir==Wi.LTR==e>0)}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(yi)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Rs)return Fi(t.length);let e=this.textDirectionAt(t.from);for(let i of this.bidiCache)if(i.from==t.from&&i.dir==e)return i.order;let i=function(t,e){let i=t.length,n=e==Ui?1:2,s=e==Ui?2:1;if(!t||1==n&&!ji.test(t))return Fi(i);for(let e=0,s=n,o=n;e=0;t-=3)if(Bi[t+1]==-r){let e=Bi[t+2],i=2&e?n:4&e?1&e?s:n:0;i&&(Gi[a]=Gi[Bi[t]]=i),l=t;break}}else{if(189==Bi.length)break;Bi[l++]=a,Bi[l++]=e,Bi[l++]=h}else if(2==(o=Gi[a])||1==o){let t=o==n;h=t?0:1;for(let e=l-3;e>=0;e-=3){let i=Bi[e+2];if(2&i)break;if(t)Bi[e+2]|=2;else{if(4&i)break;Bi[e+2]|=4}}}for(let t=0;te;){let t=i,n=2!=Gi[--i];for(;i>e&&n==(2!=Gi[i-1]);)i--;o.push(new Ni(i,t,n?2:1))}else o.push(new Ni(e,t,0))}else for(let t=0;tDate.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{ge(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 ki.of(new xi("number"==typeof t?A.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}static domEventHandlers(t){return _i.define((()=>({})),{eventHandlers:t})}static theme(t,e){let i=It.newName(),n=[ws.of(i),Vi.of(Qs(`.${i}`,t))];return e&&e.dark&&n.push(vs.of(!0)),n}static baseTheme(t){return N.lowest(Vi.of(Qs("."+ys,t,ks)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),n=i&&Se.get(i)||Se.get(t);return(null===(e=null==n?void 0:n.rootView)||void 0===e?void 0:e.view)||null}}Ts.styleModule=Vi,Ts.inputHandler=wi,Ts.focusChangeEffect=vi,Ts.perLineTextDirection=yi,Ts.exceptionSink=mi,Ts.updateListener=bi,Ts.editable=$i,Ts.mouseSelectionStyle=gi,Ts.dragMovesSelection=Oi,Ts.clickAddsSelectionRange=pi,Ts.decorations=Ti,Ts.atomicRanges=Ri,Ts.scrollMargins=Ei,Ts.darkTheme=vs,Ts.contentAttributes=Ai,Ts.editorAttributes=Zi,Ts.lineWrapping=Ts.contentAttributes.of({class:"cm-lineWrapping"}),Ts.announce=ut.define();const Rs=4096,Es={};class Vs{constructor(t,e,i,n){this.from=t,this.to=e,this.dir=i,this.order=n}static update(t,e){if(e.empty)return t;let i=[],n=t.length?t[t.length-1].dir:Wi.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&&Je(r,i)}return i}const Ds=De.mac?"mac":De.windows?"win":De.linux?"linux":"key";function Ws(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 Us=N.default(Ts.domEventHandlers({keydown:(t,e)=>Bs(Ls(e.state),t,e,"editor")})),Ys=E.define({enables:Us}),qs=new WeakMap;function Ls(t){let e=t.facet(Ys),i=qs.get(e);return i||qs.set(e,i=function(t,e=Ds){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)=>{var a,l;let h=i[t]||(i[t]=Object.create(null)),c=n.split(/ (?!$)/).map((t=>function(t,e){const i=t.split(/-(?!$)/);let n,s,r,o,a=i[i.length-1];"Space"==a&&(a=" ");for(let t=0;t{let n=zs={view:e,prefix:i,scope:t};return setTimeout((()=>{zs==n&&(zs=null)}),Is),!0}]})}let u=c.join(" ");s(u,!1);let d=h[u]||(h[u]={preventDefault:!1,run:(null===(l=null===(a=h._any)||void 0===a?void 0:a.run)||void 0===l?void 0:l.slice())||[]});r&&d.run.push(r),o&&(d.preventDefault=!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,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.shift&&r(e,"Shift-"+s,n.shift,n.preventDefault)}return i}(e.reduce(((t,e)=>t.concat(e)),[]))),i}let zs=null;const Is=4e3;function Bs(t,e,i,n){let s=function(t){var e=!(Kt&&(t.ctrlKey||t.altKey||t.metaKey)||Jt&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?Gt:Nt)[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=v(b(s,0))==s.length&&" "!=s,o="",a=!1;zs&&zs.view==i&&zs.scope==n&&(o=zs.prefix+" ",(a=kn.indexOf(e.keyCode)<0)&&(zs=null));let l,h,c=new Set,u=t=>{if(t){for(let n of t.run)if(!c.has(n)&&(c.add(n),n(i,e)))return!0;t.preventDefault&&(a=!0)}return!1},d=t[n];if(d){if(u(d[o+Ws(s,e,!r)]))return!0;if(r&&(e.altKey||e.metaKey||e.ctrlKey)&&!(De.windows&&e.ctrlKey&&e.altKey)&&(l=Nt[e.keyCode])&&l!=s){if(u(d[o+Ws(l,e,!0)]))return!0;if(e.shiftKey&&(h=Gt[e.keyCode])!=s&&h!=l&&u(d[o+Ws(h,e,!1)]))return!0}else if(r&&e.shiftKey&&u(d[o+Ws(s,e,!0)]))return!0;if(u(d._any))return!0}return a}class js{constructor(t,e,i,n,s){this.className=t,this.left=e,this.top=i,this.width=n,this.height=s}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className==this.className&&(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",null!=this.width&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,i){if(i.empty){let n=t.coordsAtPos(i.head,i.assoc||1);if(!n)return[];let s=Ns(t);return[new js(e,n.left-s.left,n.top-s.top,null,n.bottom-n.top)]}return function(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];let n=Math.max(i.from,t.viewport.from),s=Math.min(i.to,t.viewport.to),r=t.textDirection==Wi.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=Ns(t),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),u=a.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),d=a.right-(c?parseInt(c.paddingRight):0),f=Fs(t,n),p=Fs(t,s),O=f.type==ii.Text?f:null,g=p.type==ii.Text?p:null;t.lineWrapping&&(O&&(O=Gs(t,n,O)),g&&(g=Gs(t,s,g)));if(O&&g&&O.from==g.from)return b(w(i.from,i.to,O));{let e=O?w(i.from,null,O):v(f,!1),n=g?w(null,i.to,g):v(p,!0),s=[];return(O||f).to<(g||p).from-1?s.push(m(u,e.bottom,d,n.top)):e.bottomh&&n.from=r)break;a>s&&l(Math.max(t,s),null==e&&t<=h,Math.min(a,r),null==i&&a>=c,o.dir)}if(s=n.to+1,s>=r)break}return 0==a.length&&l(h,null==e,c,null==i,t.textDirection),{top:s,bottom:o,horizontal:a}}function v(t,e){let i=a.top+(e?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]}}}(t,e,i)}}function Ns(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Wi.LTR?e.left:e.right-t.scrollDOM.clientWidth)-t.scrollDOM.scrollLeft,top:e.top-t.scrollDOM.scrollTop}}function Gs(t,e,i){let n=A.cursor(e);return{from:Math.max(i.from,t.moveToLineBoundary(n,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(n,!0,!0).from),type:ii.Text}}function Fs(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==ii.Text))return t;return i}class Hs{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),e.above&&this.dom.classList.add("cm-layer-above"),e.class&&this.dom.classList.add(e.class),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(Js)!=t.state.facet(Js)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&t.view.requestMeasure(this.measureReq)}setOrder(t){let e=0,i=t.facet(Js);for(;e{return i=t,n=this.drawn[e],!(i.constructor==n.constructor&&i.eq(n));var i,n}))){let e=this.dom.firstChild,i=0;for(let n of t)n.update&&e&&n.constructor&&this.drawn[i].constructor&&n.update(e,this.drawn[i])?(e=e.nextSibling,i++):this.dom.insertBefore(n.draw(),e);for(;e;){let t=e.nextSibling;e.remove(),e=t}this.drawn=t}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Js=E.define();function Ks(t){return[_i.define((e=>new Hs(e,t))),Js.of(t)]}const tr=!De.ios,er=E.define({combine:t=>kt(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})});function ir(t={}){return[er.of(t),sr,or,lr,Si.of(!0)]}function nr(t){return t.startState.facet(er)!=t.state.facet(er)}const sr=Ks({above:!0,markers(t){let{state:e}=t,i=e.facet(er),n=[];for(let s of e.selection.ranges){let r=s==e.selection.main;if(s.empty?!r||tr:i.drawRangeCursor){let e=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",i=s.empty?s:A.cursor(s.head,s.head>s.anchor?-1:1);for(let s of js.forRange(t,e,i))n.push(s)}}return n},update(t,e){t.transactions.some((t=>t.selection))&&(e.style.animationName="cm-blink"==e.style.animationName?"cm-blink2":"cm-blink");let i=nr(t);return i&&rr(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){rr(e.state,t)},class:"cm-cursorLayer"});function rr(t,e){e.style.animationDuration=t.facet(er).cursorBlinkRate+"ms"}const or=Ks({above:!1,markers:t=>t.state.selection.ranges.map((e=>e.empty?[]:js.forRange(t,"cm-selectionBackground",e))).reduce(((t,e)=>t.concat(e))),update:(t,e)=>t.docChanged||t.selectionSet||t.viewportChanged||nr(t),class:"cm-selectionLayer"}),ar={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};tr&&(ar[".cm-line"].caretColor="transparent !important");const lr=N.highest(Ts.theme(ar)),hr=ut.define({map:(t,e)=>null==t?null:e.mapPos(t)}),cr=q.define({create:()=>null,update:(t,e)=>(null!=t&&(t=e.changes.mapPos(t)),e.effects.reduce(((t,e)=>e.is(hr)?e.value:t),t))}),ur=_i.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let i=t.state.field(cr);null==i?null!=this.cursor&&(null===(e=this.cursor)||void 0===e||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(cr)!=i||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let t=this.view.state.field(cr),e=null!=t&&this.view.coordsAtPos(t);if(!e)return null;let i=this.view.scrollDOM.getBoundingClientRect();return{left:e.left-i.left+this.view.scrollDOM.scrollLeft,top:e.top-i.top+this.view.scrollDOM.scrollTop,height:e.bottom-e.top}}drawCursor(t){this.cursor&&(t?(this.cursor.style.left=t.left+"px",this.cursor.style.top=t.top+"px",this.cursor.style.height=t.height+"px"):this.cursor.style.left="-100000px")}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(cr)!=t&&this.view.dispatch({effects:hr.of(t)})}},{eventHandlers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){t.target!=this.view.contentDOM&&this.view.contentDOM.contains(t.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function dr(){return[cr,ur]}function fr(t,e,i,n,s){e.lastIndex=0;for(let r,o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)if(!o.lineBreak)for(;r=e.exec(o.value);)s(a+r.index,r)}class pr{constructor(t){const{regexp:e,decoration:i,decorate:n,boundary:s,maxLength:r=1e3}=t;if(!e.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=e,n)this.addMatch=(t,e,i,s)=>n(s,i,i+t[0].length,t,e);else if("function"==typeof i)this.addMatch=(t,e,n,s)=>{let r=i(t,e,n);r&&s(n,n+t[0].length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(t,e,n,s)=>s(n,n+t[0].length,i)}this.boundary=s,this.maxLength=r}createDeco(t){let e=new Xt,i=e.add.bind(e);for(let{from:e,to:n}of function(t,e){let i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;let n=[];for(let{from:s,to:r}of i)s=Math.max(t.state.doc.lineAt(s).from,s-e),r=Math.min(t.state.doc.lineAt(r).to,r+e),n.length&&n[n.length-1].to>=s?n[n.length-1].to=r:n.push({from:s,to:r});return n}(t,this.maxLength))fr(t.state.doc,this.regexp,e,n,((e,n)=>this.addMatch(n,t,e,i)));return e.finish()}updateDeco(t,e){let i=1e9,n=-1;return t.docChanged&&t.changes.iterChanges(((e,s,r,o)=>{o>t.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e}updateRange(t,e,i,n){for(let s of t.visibleRanges){let r=Math.max(s.from,i),o=Math.min(s.to,n);if(o>r){let i=t.state.doc.lineAt(r),n=i.toi.from;r--)if(this.boundary.test(i.text[r-1-i.from])){a=r;break}for(;oc.push(i.range(t,e));if(i==n)for(this.regexp.lastIndex=a-i.from;(h=this.regexp.exec(i.text))&&h.indexthis.addMatch(i,t,e,u)));e=e.update({filterFrom:a,filterTo:l,filter:(t,e)=>tl,add:c})}}return e}}const Or=null!=/x/.unicode?"gu":"g",gr=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",Or),mr={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let br=null;const wr=E.define({combine(t){let e=kt(t,{render:null,specialChars:gr,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==br&&"undefined"!=typeof document&&document.body){let e=document.body.style;br=null!=(null!==(t=e.tabSize)&&void 0!==t?t:e.MozTabSize)}return br||!1}())&&(e.specialChars=new RegExp("\t|"+e.specialChars.source,Or)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Or)),e}});function vr(t={}){return[wr.of(t),yr||(yr=_i.fromClass(class{constructor(t){this.view=t,this.decorations=ni.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(wr)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new pr({regexp:t.specialChars,decoration:(e,i,n)=>{let{doc:s}=i.state,r=b(e[0],0);if(9==r){let t=s.lineAt(n),e=i.state.tabSize,r=Yt(t.text,e,n-t.from);return ni.replace({widget:new xr((e-r%e)*this.view.defaultCharacterWidth)})}return this.decorationCache[r]||(this.decorationCache[r]=ni.replace({widget:new Sr(t,r)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(wr);t.startState.facet(wr)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))]}let yr=null;class Sr extends ei{constructor(t,e){super(),this.options=t,this.code=e}eq(t){return t.code==this.code}toDOM(t){let e=function(t){return t>=32?"•":10==t?"␤":String.fromCharCode(9216+t)}(this.code),i=t.state.phrase("Control character")+" "+(mr[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,i,e);if(n)return n;let s=document.createElement("span");return s.textContent=e,s.title=i,s.setAttribute("aria-label",i),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class xr extends ei{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent="\t",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}class kr extends ei{constructor(t){super(),this.content=t}toDOM(){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):this.content),"string"==typeof this.content?t.setAttribute("aria-label","placeholder "+this.content):t.setAttribute("aria-hidden","true"),t}ignoreEvent(){return!1}}const Qr="-10000px";class $r{constructor(t,e,i){this.facet=e,this.createTooltipView=i,this.input=t.state.facet(e),this.tooltips=this.input.filter((t=>t)),this.tooltipViews=this.tooltips.map(i)}update(t){var e;let i=t.state.facet(this.facet),n=i.filter((t=>t));if(i===this.input){for(let e of this.tooltipViews)e.update&&e.update(t);return!1}let s=[];for(let e=0;e{var e,i,n;return{position:De.ios?"absolute":(null===(e=t.find((t=>t.position)))||void 0===e?void 0:e.position)||"fixed",parent:(null===(i=t.find((t=>t.parent)))||void 0===i?void 0:i.parent)||null,tooltipSpace:(null===(n=t.find((t=>t.tooltipSpace)))||void 0===n?void 0:n.tooltipSpace)||Pr}}}),_r=new WeakMap,Xr=_i.fromClass(class{constructor(t){this.view=t,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(Cr);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new $r(t,Tr,(t=>this.createTooltip(t))),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout((()=>{this.measureTimeout=-1,this.maybeMeasure()}),50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t);e&&this.observeIntersection();let i=e||t.geometryChanged,n=t.state.facet(Cr);if(n.position!=this.position){this.position=n.position;for(let t of this.manager.tooltipViews)t.dom.style.position=this.position;i=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let t of this.manager.tooltipViews)this.container.appendChild(t.dom);i=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure()}createTooltip(t){let e=t.create(this.view);if(e.dom.classList.add("cm-tooltip"),t.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",e.dom.appendChild(t)}return e.dom.style.position=this.position,e.dom.style.top=Qr,this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var t,e;this.view.win.removeEventListener("resize",this.measureSoon);for(let e of this.manager.tooltipViews)e.dom.remove(),null===(t=e.destroy)||void 0===t||t.call(e);null===(e=this.intersectionObserver)||void 0===e||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=this.view.dom.getBoundingClientRect();return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map(((t,e)=>{let i=this.manager.tooltipViews[e];return i.getCoords?i.getCoords(t.pos):this.view.coordsAtPos(t.pos)})),size:this.manager.tooltipViews.map((({dom:t})=>t.getBoundingClientRect())),space:this.view.state.facet(Cr).tooltipSpace(this.view)}}writeMeasure(t){var e;let{editor:i,space:n}=t,s=[];for(let r=0;r=Math.min(i.bottom,n.bottom)||h.rightMath.min(i.right,n.right)+.1){l.style.top=Qr;continue}let u=o.arrow?a.dom.querySelector(".cm-tooltip-arrow"):null,d=u?7:0,f=c.right-c.left,p=null!==(e=_r.get(a))&&void 0!==e?e:c.bottom-c.top,O=a.offset||Ar,g=this.view.textDirection==Wi.LTR,m=c.width>n.right-n.left?g?n.left:n.right-c.width:g?Math.min(h.left-(u?14:0)+O.x,n.right-f):Math.max(n.left,h.left-f+(u?14:0)-O.x),b=!!o.above;!o.strictSide&&(b?h.top-(c.bottom-c.top)-O.yn.bottom)&&b==n.bottom-h.bottom>h.top-n.top&&(b=!b);let w=(b?h.top-n.top:n.bottom-h.bottom)-d;if(wm&&t.topv&&(v=b?t.top-p-2-d:t.bottom+d+2);"absolute"==this.position?(l.style.top=v-t.parent.top+"px",l.style.left=m-t.parent.left+"px"):(l.style.top=v+"px",l.style.left=m+"px"),u&&(u.style.left=h.left+(g?O.x:-O.x)-(m+14-7)+"px"),!0!==a.overlap&&s.push({left:m,top:v,right:y,bottom:v+p}),l.classList.toggle("cm-tooltip-above",b),l.classList.toggle("cm-tooltip-below",!b),a.positioned&&a.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=Qr}},{eventHandlers:{scroll(){this.maybeMeasure()}}}),Zr=Ts.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Ar={x:0,y:0},Tr=E.define({enables:[Xr,Zr]});function Rr(t,e){let i=t.plugin(Xr);if(!i)return null;let n=i.manager.tooltips.indexOf(e);return n<0?null:i.manager.tooltipViews[n]}const Er=E.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 Vr(t,e){let i=t.plugin(Mr),n=i?i.specs.indexOf(e):-1;return n>-1?i.panels[n]:null}const Mr=_i.fromClass(class{constructor(t){this.input=t.state.facet(Ur),this.specs=this.input.filter((t=>t)),this.panels=this.specs.map((e=>e(t)));let e=t.state.facet(Er);this.top=new Dr(t,!0,e.topContainer),this.bottom=new Dr(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(Er);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Dr(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Dr(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(Ur);if(i!=this.input){let e=i.filter((t=>t)),n=[],s=[],r=[],o=[];for(let i of e){let e,a=this.specs.indexOf(i);a<0?(e=i(t.view),o.push(e)):(e=this.panels[a],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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}}))});class Dr{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=Wr(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=Wr(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 Wr(t){let e=t.nextSibling;return t.remove(),e}const Ur=E.define({enables:Mr});class Yr extends Qt{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Yr.prototype.elementClass="",Yr.prototype.toDOM=void 0,Yr.prototype.mapMode=S.TrackBefore,Yr.prototype.startSide=Yr.prototype.endSide=-1,Yr.prototype.point=!0;const qr=E.define(),Lr={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>_t.empty,lineMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},zr=E.define();function Ir(t){return[jr(),zr.of(Object.assign(Object.assign({},Lr),t))]}const Br=E.define({combine:t=>t.some((t=>t))});function jr(t){let e=[Nr];return t&&!1===t.fixed&&e.push(Br.of(!0)),e}const Nr=_i.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+"px",this.gutters=t.state.facet(zr).map((e=>new Jr(t,e)));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!t.state.facet(Br),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(Br)!=!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=_t.iter(this.view.state.facet(qr),this.view.viewport.from),n=[],s=this.gutters.map((t=>new Hr(t,this.view.viewport,-this.view.documentPadding.top)));for(let t of this.view.viewportLineBlocks){let e;if(Array.isArray(t.type)){for(let i of t.type)if(i.type==ii.Text){e=i;break}}else e=t.type==ii.Text?t:void 0;if(e){n.length&&(n=[]),Fr(i,n,t.from);for(let t of s)t.line(this.view,e,n)}}for(let t of s)t.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(zr),i=t.state.facet(zr),n=t.docChanged||t.heightChanged||t.viewportChanged||!_t.eq(t.startState.facet(qr),t.state.facet(qr),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 Jr(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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&0!=i.gutters.length&&i.fixed?e.textDirection==Wi.LTR?{left:i.dom.offsetWidth}:{right:i.dom.offsetWidth}:null}))});function Gr(t){return Array.isArray(t)?t:[t]}function Fr(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class Hr{constructor(t,e,i){this.gutter=t,this.height=i,this.i=0,this.cursor=_t.iter(t.markers,e.from)}line(t,e,i){let n=[];Fr(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;if(0==n.length&&!r.config.renderEmptyElements)return;let o=e.top-this.height;if(this.i==r.elements.length){let i=new Kr(t,e.height,o,n);r.elements.push(i),r.dom.appendChild(i.dom)}else r.elements[this.i].update(t,e.height,o,n);this.height=e.bottom,this.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 Jr{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=Gr(e.markers(t)),e.initialSpacer&&(this.spacer=new Kr(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=Gr(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!_t.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 Kr{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.dom.style.height=(this.height=e)+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),function(t,e){if(t.length!=e.length)return!1;for(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 io extends Yr{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function no(t,e){return t.state.facet(eo).formatNumber(e,t.state)}const so=zr.compute([eo],(t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:t=>t.state.facet(to),lineMarker:(t,e,i)=>i.some((t=>t.toDOM))?null:new io(no(t,t.state.doc.lineAt(e.from).number)),lineMarkerChange:t=>t.startState.facet(eo)!=t.state.facet(eo),initialSpacer:t=>new io(no(t,ro(t.state.doc.lines))),updateSpacer(t,e){let i=no(e.view,ro(e.view.state.doc.lines));return i==t.number?t:new io(i)},domEventHandlers:t.facet(eo).domEventHandlers})));function ro(t){let e=9;for(;e{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=fo.match(t)),e=>{let i=t(e);return void 0===i?null:[this,i]}}}ho.closedBy=new ho({deserialize:t=>t.split(" ")}),ho.openedBy=new ho({deserialize:t=>t.split(" ")}),ho.group=new ho({deserialize:t=>t.split(" ")}),ho.contextHash=new ho({perNode:!0}),ho.lookAhead=new ho({perNode:!0}),ho.mounted=new ho({perNode:!0});class co{constructor(t,e,i){this.tree=t,this.overlay=e,this.parser=i}}const uo=Object.create(null);class fo{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):uo,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),n=new fo(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(ho.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(ho.group),n=-1;n<(i?i.length:0);n++){let s=e[n<0?t.name:i[n]];if(s)return s}}}}fo.none=new fo("",Object.create(null),0,8);class po{constructor(t){this.types=t;for(let e=0;e=n&&(r.type.isAnonymous||!1!==e(r))){if(r.firstChild())continue;t=!0}for(;t&&i&&!r.type.isAnonymous&&i(r),!r.nextSibling();){if(!r.parent())return;t=!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:To(fo.none,this.children,this.positions,0,this.children.length,0,this.length,((t,e,i)=>new bo(this.type,t,e,i,this.propValues)),t.makeTree||((t,e,i)=>new bo(fo.none,t,e,i)))}static build(t){return function(t){var e;let{buffer:i,nodeSet:n,maxBufferLength:s=oo,reused:r=[],minRepeatType:o=n.types.length}=t,a=Array.isArray(i)?new wo(i,i.length):i,l=n.types,h=0,c=0;function u(t,e,i,m,b){let{id:w,start:v,end:y,size:S}=a,x=c;for(;S<0;){if(a.next(),-1==S){let e=r[w];return i.push(e),void m.push(v-t)}if(-3==S)return void(h=w);if(-4==S)return void(c=w);throw new RangeError(`Unrecognized record size: ${S}`)}let k,Q,$=l[w],P=v-t;if(y-v<=s&&(Q=O(a.pos-e,b))){let e=new Uint16Array(Q.size-Q.skip),i=a.pos-Q.size,s=e.length;for(;a.pos>i;)s=g(Q.start,e,s);k=new vo(e,y-Q.start,n),P=Q.start-t}else{let t=a.pos-S;a.next();let e=[],i=[],n=w>=o?w:-1,r=0,l=y;for(;a.pos>t;)n>=0&&a.id==n&&a.size>=0?(a.end<=l-s&&(f(e,i,v,r,a.end,l,n,x),r=e.length,l=a.end),a.next()):u(v,t,e,i,n);if(n>=0&&r>0&&r-1&&r>0){let t=d($);k=To($,e,i,0,e.length,0,y-v,t,t)}else k=p($,e,i,y-v,x-y)}i.push(k),m.push(P)}function d(t){return(e,i,n)=>{let s,r,o=0,a=e.length-1;if(a>=0&&(s=e[a])instanceof bo){if(!a&&s.type==t&&s.length==n)return s;(r=s.prop(ho.lookAhead))&&(o=i[a]+s.length+r)}return p(t,e,i,n,o)}}function f(t,e,i,s,r,o,a,l){let h=[],c=[];for(;t.length>s;)h.push(t.pop()),c.push(e.pop()+i-r);t.push(p(n.types[a],h,c,o-r,l-o)),e.push(r-i)}function p(t,e,i,n,s=0,r){if(h){let t=[ho.contextHash,h];r=r?[t].concat(r):[t]}if(s>25){let t=[ho.lookAhead,s];r=r?[t].concat(r):[t]}return new bo(t,e,i,n,r)}function O(t,e){let i=a.fork(),n=0,r=0,l=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=l,l+=4,n+=4,i.next();continue}let a=i.pos-t;if(t<0||a=o?4:0,d=i.start;for(i.next();i.pos>a;){if(i.size<0){if(-3!=i.size)break t;u+=4}else i.id>=o&&(u+=4);i.next()}r=d,n+=t,l+=u}return(e<0||n==t)&&(c.size=n,c.start=r,c.skip=l),c.size>4?c:void 0}function g(t,e,i){let{id:n,start:s,end:r,size:l}=a;if(a.next(),l>=0&&n4){let n=a.pos-(l-4);for(;a.pos>n;)i=g(t,e,i)}e[--i]=o,e[--i]=r-t,e[--i]=s-t,e[--i]=n}else-3==l?h=n:-4==l&&(c=n);return i}let m=[],b=[];for(;a.pos>0;)u(t.start||0,t.bufferStart||0,m,b,-1);let w=null!==(e=t.length)&&void 0!==e?e:m.length?b[0]+m[0].length:0;return new bo(l[t.topID],m.reverse(),b.reverse(),w)}(t)}}bo.empty=new bo(fo.none,[],[],0);class wo{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 wo(this.buffer,this.index)}}class vo{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return fo.none}toString(){let t=[];for(let e=0;e0));a=r[a+3]);return o}slice(t,e,i){let n=this.buffer,s=new Uint16Array(e-t),r=0;for(let o=t,a=0;o=e&&ie;case 1:return i<=e&&n>e;case 2:return n>e;case 4:return!0}}function So(t,e){let i=t.childBefore(e);for(;i;){let e=i.lastChild;if(!e||e.to!=i.to)break;e.type.isError&&e.from==e.to?(t=i,i=e.prevSibling):i=e}return t}function xo(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!=l;t+=e){let l=o[t],h=a[t]+r.from;if(yo(n,i,h,h+l.length))if(l instanceof vo){if(s&mo.ExcludeBuffers)continue;let o=l.findChild(0,l.buffer.length,e,i-h,n);if(o>-1)return new Co(new Po(r,l,t,h),null,o)}else if(s&mo.IncludeAnonymous||!l.type.isAnonymous||Xo(l)){let o;if(!(s&mo.IgnoreMounts)&&l.props&&(o=l.prop(ho.mounted))&&!o.overlay)return new ko(o.tree,h,t,r);let a=new ko(l,h,t,r);return s&mo.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(e<0?l.children.length-1:0,e,i,n)}}if(s&mo.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&mo.IgnoreOverlays)&&(n=this._tree.prop(ho.mounted))&&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 ko(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}cursor(t=0){return new _o(this,t)}get tree(){return this._tree}toTree(){return this._tree}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return So(this,t)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}toString(){return this._tree.toString()}get node(){return this}matchContext(t){return $o(this,t)}}function Qo(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 $o(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 Po{constructor(t,e,i,n){this.parent=t,this.buffer=e,this.index=i,this.start=n}}class Co{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){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 Co(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&mo.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 Co(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 Co(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 Co(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}cursor(t=0){return new _o(this,t)}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 bo(this.type,t,e,this.to-this.from)}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return So(this,t)}toString(){return this.context.buffer.childString(this.index)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}get node(){return this}matchContext(t){return $o(this,t)}}class _o{get name(){return this.type.name}constructor(t,e=0){if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof ko)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let e=t._parent;e;e=e._parent)this.stack.unshift(e.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return!!t&&(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0)}yieldBuf(t,e){this.index=t;let{start:i,buffer:n}=this.buffer;return this.type=e||n.set.types[n.buffer[t]],this.from=i+n.buffer[t+1],this.to=i+n.buffer[t+2],!0}yield(t){return!!t&&(t instanceof ko?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,i){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,i,this.mode));let{buffer:n}=this.buffer,s=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.buffer.start,i);return!(s<0)&&(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,i=this.mode){return this.buffer?!(i&mo.ExcludeBuffers)&&this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&mo.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&mo.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode));let{buffer:e}=this.buffer,i=this.stack.length-1;if(t<0){let t=i<0?0:this.stack[i]+4;if(this.index!=t)return this.yieldBuf(e.findChild(t,this.index,-1,0,4))}else{let t=e.buffer[this.index+3];if(t<(i<0?e.buffer.length:e.buffer[this.stack[i]+3]))return this.yieldBuf(t)}return i<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,i,{buffer:n}=this;if(n){if(t>0){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&mo.IncludeAnonymous||t instanceof vo||!t.type.isAnonymous||Xo(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 $o(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 Xo(t){return t.children.some((t=>t instanceof vo||!t.type.isAnonymous||Xo(t)))}const Zo=new WeakMap;function Ao(t,e){if(!t.isAnonymous||e instanceof vo||e.type!=t)return 1;let i=Zo.get(e);if(null==i){i=1;for(let n of e.children){if(n.type!=t||!(n instanceof bo)){i=1;break}i+=Ao(t,n)}Zo.set(e,i)}return i}function To(t,e,i,n,s,r,o,a,l){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]+a);continue}u.push(i[s])}else{let e=n[h-1]+i[h-1].length-f;u.push(To(t,i,n,s,h,f,e,null,l))}d.push(f+a-r)}}(e,i,n,s,0),(a||l)(u,d,o)}class Ro{constructor(){this.map=new WeakMap}setBuffer(t,e,i){let n=this.map.get(t);n||this.map.set(t,n=new Map),n.set(e,i)}getBuffer(t,e){let i=this.map.get(t);return i&&i.get(e)}set(t,e){t instanceof Co?this.setBuffer(t.context.buffer,t.index,e):t instanceof ko&&this.map.set(t.tree,e)}get(t){return t instanceof Co?this.getBuffer(t.context.buffer,t.index):t instanceof ko?this.map.get(t.tree):void 0}cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}}class Eo{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 Eo(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,a=0,l=0;;o++){let h=o=i)for(;r&&r.from=e.from||c<=e.to||l){let t=Math.max(e.from,a)-l,i=Math.min(e.to,c)-l;e=t>=i?null:new Eo(t,i,e.tree,e.offset+l,o>0,!!h)}if(e&&n.push(e),r.to>c)break;r=snew lo(t.from,t.to))):[new lo(0,0)]:[new lo(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 Mo{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)}}function Do(t){return(e,i,n,s)=>new qo(e,t,i,n,s)}class Wo{constructor(t,e,i,n,s){this.parser=t,this.parse=e,this.overlay=i,this.target=n,this.ranges=s}}class Uo{constructor(t,e,i,n,s,r,o){this.parser=t,this.predicate=e,this.mounts=i,this.index=n,this.start=s,this.target=r,this.prev=o,this.depth=0,this.ranges=[]}}const Yo=new ho({perNode:!0});class qo{constructor(t,e,i,n,s){this.nest=e,this.input=i,this.fragments=n,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=t}advance(){if(this.baseParse){let t=this.baseParse.advance();if(!t)return null;if(this.baseParse=null,this.baseTree=t,this.startInner(),null!=this.stoppedAt)for(let t of this.inner)t.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let t=this.baseTree;return null!=this.stoppedAt&&(t=new bo(t.type,t.children,t.positions,t.length,t.propValues.concat([[Yo,this.stoppedAt]]))),t}let t=this.inner[this.innerDone],e=t.parse.advance();if(e){this.innerDone++;let i=Object.assign(Object.create(null),t.target.props);i[ho.mounted.id]=new co(e,t.overlay,t.parser),t.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let t=this.input.length;for(let e=this.innerDone;et.frag.from<=n.from&&t.frag.to>=n.to&&t.mount.overlay));if(t)for(let i of t.mount.overlay){let s=i.from+t.pos,r=i.to+t.pos;s>=n.from&&r<=n.to&&!e.ranges.some((t=>t.froms))&&e.ranges.push({from:s,to:r})}}a=!1}else if(i&&(r=Lo(i.ranges,n.from,n.to)))a=2!=r;else if(!n.type.isAnonymous&&n.fromnew lo(t.from-n.from,t.to-n.from))):null,n.tree,t)),s.overlay?t.length&&(i={ranges:t,depth:0,prev:i}):a=!1}}else e&&(o=e.predicate(n))&&(!0===o&&(o=new lo(n.from,n.to)),o.fromnew lo(t.from-e.start,t.to-e.start))),e.target,t)),e=e.prev}i&&! --i.depth&&(i=i.prev)}}}}function Lo(t,e,i){for(let n of t){if(n.from>=i)break;if(n.to>e)return n.from<=e&&n.to>=i?2:1}return 0}function zo(t,e,i,n,s,r){if(e=e.to);n++);let o=s.children[n],a=o.buffer;s.children[n]=function t(i,n,s,l,h){let c=i;for(;a[c+2]+r<=e.from;)c=a[c+3];let u=[],d=[];zo(o,i,c,u,d,l);let f=a[c+1],p=a[c+2],O=f+r==e.from&&p+r==e.to&&a[c]==e.type.id;return u.push(O?e.toTree():t(c+4,a[c+3],o.set.types[a[c]],f,p-f)),d.push(f-l),zo(o,a[c+3],n,u,d,l),new bo(s,u,d,h)}(0,a.length,fo.none,0,o.length);for(let n=0;n<=i;n++)t.childAfter(e.from)}class Bo{constructor(t,e){this.offset=e,this.done=!1,this.cursor=t.cursor(mo.IncludeAnonymous|mo.IgnoreMounts)}moveTo(t){let{cursor:e}=this,i=t-this.offset;for(;!this.done&&e.from=t&&e.enter(i,1,mo.IgnoreOverlays|mo.ExcludeBuffers)||e.next(!1)||(this.done=!0)}hasNode(t){if(this.moveTo(t.from),!this.done&&this.cursor.from+this.offset==t.from&&this.cursor.tree)for(let e=this.cursor.tree;;){if(e==t.tree)return!0;if(!(e.children.length&&0==e.positions[0]&&e.children[0]instanceof bo))break;e=e.children[0]}return!1}}let jo=class{constructor(t){var e;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){let i=this.curFrag=t[0];this.curTo=null!==(e=i.tree.prop(Yo))&&void 0!==e?e:i.to,this.inner=new Bo(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t)}nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=null!==(t=e.tree.prop(Yo))&&void 0!==t?t:e.to,this.inner=new Bo(e.tree,-e.offset)}}findMounts(t,e){var i;let n=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let t=this.inner.cursor.node;t;t=t.parent){let s=null===(i=t.tree)||void 0===i?void 0:i.prop(ho.mounted);if(s&&s.parser==e)for(let e=this.fragI;e=t.to)break;i.tree==this.curFrag.tree&&n.push({frag:i,pos:t.from-i.offset,mount:s})}}}return n}};function No(t,e){let i=null,n=e;for(let s=1,r=0;s=a)break;t.to<=o||(i||(n=i=e.slice()),t.froma&&i.splice(r+1,0,new lo(a,t.to))):t.to>a?i[r--]=new lo(a,t.to):i.splice(r--,1))}}return n}function Go(t,e,i,n){let s=0,r=0,o=!1,a=!1,l=-1e9,h=[];for(;;){let c=s==t.length?1e9:o?t[s].to:t[s].from,u=r==e.length?1e9:a?e[r].to:e[r].from;if(o!=a){let t=Math.max(l,i),e=Math.min(c,u,n);tnew lo(t.from+n,t.to+n))),a,l);for(let e=0,n=a;;e++){let a=e==o.length,h=a?l:o[e].from;if(h>n&&i.push(new Eo(n,h,s.tree,-t,r.from>=n||r.openStart,r.to<=h||r.openEnd)),a)break;n=o[e].to}}else i.push(new Eo(a,l,s.tree,-t,r.from>=t||r.openStart,r.to<=o||r.openEnd))}return i}let Ho=0;class Jo{constructor(t,e,i){this.set=t,this.base=e,this.modified=i,this.id=Ho++}static define(t){if(null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let e=new Jo([],null,[]);if(e.set.push(e),t)for(let i of t.set)e.set.push(i);return e}static defineModifier(){let t=new ta;return e=>e.modified.indexOf(t)>-1?e:ta.get(e.base||e,e.modified.concat(t).sort(((t,e)=>t.id-e.id)))}}let Ko=0;class ta{constructor(){this.instances=[],this.id=Ko++}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 Jo(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(ta.get(e,t));return s}}function ea(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,a=i[o];if(!a)throw new RangeError("Invalid path: "+t);let l=new na(n,s,o>0?i.slice(0,o):null);e[a]=l.sort(e[a])}}return ia.add(e)}const ia=new ho;class na{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 ra(t,e,i,n=0,s=t.length){let r=new oa(n,Array.isArray(e)?e:[e],i);r.highlightRange(t.cursor(),n,s,"",r.highlighters),r.flush(s)}na.empty=new na([],2,null);class oa{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:a}=t;if(o>=i||a<=e)return;r.isTop&&(s=this.highlighters.filter((t=>!t.scope||t.scope(r))));let l=n,h=function(t){let e=t.type.prop(ia);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}(t)||na.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&&(l&&(l+=" "),l+=c,1==h.mode&&(n+=(n?" ":"")+c)),this.startSpan(t.from,l),h.opaque)return;let u=t.tree&&t.tree.prop(ho.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 d=0,f=o;;d++){let p=d=O)&&t.nextSibling()););if(!p||O>i)break;f=p.to+o,f>e&&(this.highlightRange(r.cursor(),Math.max(e,p.from+o),Math.min(i,f),n,h),this.startSpan(f,l))}c&&t.parent()}else if(t.firstChild()){do{if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,n,s),this.startSpan(Math.min(i,t.to),l)}}while(t.nextSibling());t.parent()}}}const aa=Jo.define,la=aa(),ha=aa(),ca=aa(ha),ua=aa(ha),da=aa(),fa=aa(da),pa=aa(da),Oa=aa(),ga=aa(Oa),ma=aa(),ba=aa(),wa=aa(),va=aa(wa),ya=aa(),Sa={comment:la,lineComment:aa(la),blockComment:aa(la),docComment:aa(la),name:ha,variableName:aa(ha),typeName:ca,tagName:aa(ca),propertyName:ua,attributeName:aa(ua),className:aa(ha),labelName:aa(ha),namespace:aa(ha),macroName:aa(ha),literal:da,string:fa,docString:aa(fa),character:aa(fa),attributeValue:aa(fa),number:pa,integer:aa(pa),float:aa(pa),bool:aa(da),regexp:aa(da),escape:aa(da),color:aa(da),url:aa(da),keyword:ma,self:aa(ma),null:aa(ma),atom:aa(ma),unit:aa(ma),modifier:aa(ma),operatorKeyword:aa(ma),controlKeyword:aa(ma),definitionKeyword:aa(ma),moduleKeyword:aa(ma),operator:ba,derefOperator:aa(ba),arithmeticOperator:aa(ba),logicOperator:aa(ba),bitwiseOperator:aa(ba),compareOperator:aa(ba),updateOperator:aa(ba),definitionOperator:aa(ba),typeOperator:aa(ba),controlOperator:aa(ba),punctuation:wa,separator:aa(wa),bracket:va,angleBracket:aa(va),squareBracket:aa(va),paren:aa(va),brace:aa(va),content:Oa,heading:ga,heading1:aa(ga),heading2:aa(ga),heading3:aa(ga),heading4:aa(ga),heading5:aa(ga),heading6:aa(ga),contentSeparator:aa(Oa),list:aa(Oa),quote:aa(Oa),emphasis:aa(Oa),strong:aa(Oa),link:aa(Oa),monospace:aa(Oa),strikethrough:aa(Oa),inserted:aa(),deleted:aa(),changed:aa(),invalid:aa(),meta:ya,documentMeta:aa(ya),annotation:aa(ya),processingInstruction:aa(ya),definition:Jo.defineModifier(),constant:Jo.defineModifier(),function:Jo.defineModifier(),standard:Jo.defineModifier(),local:Jo.defineModifier(),special:Jo.defineModifier()};var xa;sa([{tag:Sa.link,class:"tok-link"},{tag:Sa.heading,class:"tok-heading"},{tag:Sa.emphasis,class:"tok-emphasis"},{tag:Sa.strong,class:"tok-strong"},{tag:Sa.keyword,class:"tok-keyword"},{tag:Sa.atom,class:"tok-atom"},{tag:Sa.bool,class:"tok-bool"},{tag:Sa.url,class:"tok-url"},{tag:Sa.labelName,class:"tok-labelName"},{tag:Sa.inserted,class:"tok-inserted"},{tag:Sa.deleted,class:"tok-deleted"},{tag:Sa.literal,class:"tok-literal"},{tag:Sa.string,class:"tok-string"},{tag:Sa.number,class:"tok-number"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],class:"tok-string2"},{tag:Sa.variableName,class:"tok-variableName"},{tag:Sa.local(Sa.variableName),class:"tok-variableName tok-local"},{tag:Sa.definition(Sa.variableName),class:"tok-variableName tok-definition"},{tag:Sa.special(Sa.variableName),class:"tok-variableName2"},{tag:Sa.definition(Sa.propertyName),class:"tok-propertyName tok-definition"},{tag:Sa.typeName,class:"tok-typeName"},{tag:Sa.namespace,class:"tok-namespace"},{tag:Sa.className,class:"tok-className"},{tag:Sa.macroName,class:"tok-macroName"},{tag:Sa.propertyName,class:"tok-propertyName"},{tag:Sa.operator,class:"tok-operator"},{tag:Sa.comment,class:"tok-comment"},{tag:Sa.meta,class:"tok-meta"},{tag:Sa.invalid,class:"tok-invalid"},{tag:Sa.punctuation,class:"tok-punctuation"}]);const ka=new ho;function Qa(t){return E.define({combine:t?e=>e.concat(t):void 0})}const $a=new ho;class Pa{constructor(t,e,i=[],n=""){this.data=t,this.name=n,xt.prototype.hasOwnProperty("tree")||Object.defineProperty(xt.prototype,"tree",{get(){return Xa(this)}}),this.parser=e,this.extension=[Wa.of(this),xt.languageData.of(((t,e,i)=>{let n=Ca(t,e,i),s=n.type.prop(ka);if(!s)return[];let r=t.facet(s),o=n.type.prop($a);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 Ca(t,e,i).type.prop(ka)==this.data}findRegions(t){let e=t.facet(Wa);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(ka)==this.data)return void i.push({from:e,to:e+t.length});let s=t.prop(ho.mounted);if(s){if(s.tree.prop(ka)==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;it.isTop?e:void 0))]}),t.name)}configure(t,e){return new _a(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Xa(t){let e=t.field(Pa.state,!1);return e?e.tree:bo.empty}class Za{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let i=this.cursorPos-this.string.length;return t=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i)}}let Aa=null;class Ta{constructor(t,e,i=[],n,s,r,o,a){this.parser=t,this.state=e,this.fragments=i,this.tree=n,this.treeLen=s,this.viewport=r,this.skipped=o,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(t,e,i){return new Ta(t,e,[],bo.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Za(this.state.doc),this.fragments)}work(t,e){return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=bo.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(Eo.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Aa;Aa=this;try{return t()}finally{Aa=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=Ra(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=Eo.applyChanges(i,e),n=bo.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=Ra(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 Vo{createParse(e,i,n){let s=n[0].from,r=n[n.length-1].to;return{parsedPos:s,advance(){let e=Aa;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 bo(fo.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 Aa}}function Ra(t,e,i){return Eo.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class Ea{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 Ea(e)}static init(t){let e=Math.min(3e3,t.doc.length),i=Ta.create(t.facet(Wa).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new Ea(i)}}Pa.state=q.define({create:Ea.init,update(t,e){for(let t of e.effects)if(t.is(Pa.setState))return t.value;return e.startState.facet(Wa)!=e.state.facet(Wa)?Ea.init(e.state):t.apply(e)}});let Va=t=>{let e=setTimeout((()=>t()),500);return()=>clearTimeout(e)};"undefined"!=typeof requestIdleCallback&&(Va=t=>{let e=-1,i=setTimeout((()=>{e=requestIdleCallback(t,{timeout:400})}),100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const Ma="undefined"!=typeof navigator&&(null===(xa=navigator.scheduling)||void 0===xa?void 0:xa.isInputPending)?()=>navigator.scheduling.isInputPending():null,Da=_i.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(Pa.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),t.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(Pa.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=Va(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEndn+1e3,a=s.context.work((()=>Ma&&Ma()||Date.now()>r),n+(o?0:1e5));this.chunkBudget-=Date.now()-e,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Pa.setState.of(new Ea(s.context))})),this.chunkBudget>0&&(!a||o)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then((()=>this.scheduleWork())).catch((t=>Qi(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()}}}),Wa=E.define({combine:t=>t.length?t[0]:null,enables:t=>[Pa.state,Da,Ts.contentAttributes.compute([t],(e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}}))]});class Ua{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}class Ya{constructor(t,e,i,n,s,r=void 0){this.name=t,this.alias=e,this.extensions=i,this.filename=n,this.loadFunc=s,this.support=r,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then((t=>this.support=t),(t=>{throw this.loading=null,t})))}static of(t){let{load:e,support:i}=t;if(!e){if(!i)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");e=()=>Promise.resolve(i)}return new Ya(t.name,(t.alias||[]).concat(t.name).map((t=>t.toLowerCase())),t.extensions||[],t.filename,e,i)}static matchFilename(t,e){for(let i of t)if(i.filename&&i.filename.test(e))return i;let i=/\.([^.]+)$/.exec(e);if(i)for(let e of t)if(e.extensions.indexOf(i[1])>-1)return e;return null}static matchLanguageName(t,e,i=!0){e=e.toLowerCase();for(let i of t)if(i.alias.some((t=>t==e)))return i;if(i)for(let i of t)for(let t of i.alias){let n=e.indexOf(t);if(n>-1&&(t.length>2||!/\w/.test(e[n-1])&&!/\w/.test(e[n+t.length])))return i}return null}}const qa=E.define(),La=E.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 za(t){let e=t.facet(La);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function Ia(t,e){let i="",n=t.tabSize,s=t.facet(La)[0];if("\t"==s){for(;e>=n;)i+="\t",e-=n;s=" "}for(let t=0;t=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 Yt(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 Na=new ho;function Ga(t){let e=t.type.prop(Na);if(e)return e;let i,n=t.firstChild;if(n&&(i=n.type.prop(ho.closedBy))){let e=t.lastChild,n=e&&i.indexOf(e.name)>-1;return t=>el(t,!0,1,void 0,n&&!function(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}(t)?e.from:void 0)}return null==t.parent?Ha:null}function Fa(t,e,i){for(;t;t=t.parent){let n=Ga(t);if(n)return n(Ja.create(i,e,t))}return null}function Ha(){return 0}class Ja extends ja{constructor(t,e,i){super(t.state,t.options),this.base=t,this.pos=e,this.node=i}static create(t,e,i){return new Ja(t,e,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){let t=this.state.doc.lineAt(this.node.from);for(;;){let e=this.node.resolve(t.from);for(;e.parent&&e.parent.from==e.from;)e=e.parent;if(Ka(e,this.node))break;t=this.state.doc.lineAt(e.from)}return this.lineIndent(t.from)}continue(){let t=this.node.parent;return t?Fa(t,this.pos,this.base):0}}function Ka(t,e){for(let i=e;i;i=i.parent)if(t==i)return!0;return!1}function tl({closing:t,align:e=!0,units:i=1}){return n=>el(n,e,i,t)}function el(t,e,i,n,s){let r=t.textAfter,o=r.match(/^\s*/)[0].length,a=n&&r.slice(o,o+n.length)==n||s==t.pos+o,l=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.from{let n=t&&t.test(i.textAfter);return i.baseIndent+(n?0:e*i.unit)}}function nl(){return xt.transactionFilter.of((t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let i=t.newDoc,{head:n}=t.newSelection.main,s=i.lineAt(n);if(n>s.from+200)return t;let r=i.sliceString(s.from,n);if(!e.some((t=>t.test(r))))return t;let{state:o}=t,a=-1,l=[];for(let{head:t}of o.selection.ranges){let e=o.doc.lineAt(t);if(e.from==a)continue;a=e.from;let i=Ba(o,e.from);if(null==i)continue;let n=/^\s*/.exec(e.text)[0],s=Ia(o,i);n!=s&&l.push({from:e.from,to:e.from+n.length,insert:s})}return l.length?[t,{changes:l,sequential:!0}]:t}))}const sl=E.define(),rl=new ho;function ol(t){let e=t.firstChild,i=t.lastChild;return e&&e.toi)continue;if(s&&r.from=e&&n.to>i&&(s=n)}}return s}(t,e,i)}function hl(t,e){let i=e.mapPos(t.from,1),n=e.mapPos(t.to,-1);return i>=n?void 0:{from:i,to:n}}const cl=ut.define({map:hl}),ul=ut.define({map:hl}),dl=q.define({create:()=>ni.none,update(t,e){t=t.map(e.changes);for(let i of e.effects)i.is(cl)&&!pl(t,i.value.from,i.value.to)?t=t.update({add:[bl.range(i.value.from,i.value.to)]}):i.is(ul)&&(t=t.update({filter:(t,e)=>i.value.from!=t||i.value.to!=e,filterFrom:i.value.from,filterTo:i.value.to}));if(e.selection){let i=!1,{head:n}=e.selection.main;t.between(n,n,((t,e)=>{tn&&(i=!0)})),i&&(t=t.update({filterFrom:n,filterTo:n,filter:(t,e)=>e<=n||t>=n}))}return t},provide:t=>Ts.decorations.from(t),toJSON(t,e){let i=[];return t.between(0,e.doc.length,((t,e)=>{i.push(t,e)})),i},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let i=0;i{(!s||s.from>t)&&(s={from:t,to:e})})),s}function pl(t,e,i){let n=!1;return t.between(e,e,((t,s)=>{t==e&&s==i&&(n=!0)})),n}const Ol={placeholderDOM:null,placeholderText:"…"},gl=E.define({combine:t=>kt(t,Ol)});function ml(t){let e=[dl,yl];return t&&e.push(gl.of(t)),e}const bl=ni.replace({widget:new class extends ei{toDOM(t){let{state:e}=t,i=e.facet(gl),n=e=>{let i=t.lineBlockAt(t.posAtDOM(e.target)),n=fl(t.state,i.from,i.to);n&&t.dispatch({effects:ul.of(n)}),e.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(t,n);let s=document.createElement("span");return s.textContent=i.placeholderText,s.setAttribute("aria-label",e.phrase("folded code")),s.title=e.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=n,s}}}),wl={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class vl extends Yr{constructor(t,e){super(),this.config=t,this.open=e}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let e=document.createElement("span");return e.textContent=this.open?this.config.openText:this.config.closedText,e.title=t.state.phrase(this.open?"Fold line":"Unfold line"),e}}const yl=Ts.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Sl{constructor(t,e){let i;function n(t){let e=It.newName();return(i||(i=Object.create(null)))["."+e]=t,e}this.specs=t;const s="string"==typeof e.all?e.all:e.all?n(e.all):void 0,r=e.scope;this.scope=r instanceof Pa?t=>t.prop(ka)==r.data:r?t=>t==r:void 0,this.style=sa(t.map((t=>({tag:t.tag,class:t.class||n(Object.assign({},t,{tag:null}))}))),{all:s}).style,this.module=i?new It(i):null,this.themeType=e.themeType}static define(t,e){return new Sl(t,e||{})}}const xl=E.define(),kl=E.define({combine:t=>t.length?[t[0]]:null});function Ql(t){let e=t.facet(xl);return e.length?e:t.facet(kl)}function $l(t,e){let i,n=[Cl];return t instanceof Sl&&(t.module&&n.push(Ts.styleModule.of(t.module)),i=t.themeType),(null==e?void 0:e.fallback)?n.push(kl.of(t)):i?n.push(xl.computeN([Ts.darkTheme],(e=>e.facet(Ts.darkTheme)==("dark"==i)?[t]:[]))):n.push(xl.of(t)),n}class Pl{constructor(t){this.markCache=Object.create(null),this.tree=Xa(t.state),this.decorations=this.buildDeco(t,Ql(t.state))}update(t){let e=Xa(t.state),i=Ql(t.state),n=i!=Ql(t.startState);e.length{i.add(t,e,this.markCache[n]||(this.markCache[n]=ni.mark({class:n})))}),n,s);return i.finish()}}const Cl=N.high(_i.fromClass(Pl,{decorations:t=>t.decorations})),_l=Sl.define([{tag:Sa.meta,color:"#404740"},{tag:Sa.link,textDecoration:"underline"},{tag:Sa.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Sa.emphasis,fontStyle:"italic"},{tag:Sa.strong,fontWeight:"bold"},{tag:Sa.strikethrough,textDecoration:"line-through"},{tag:Sa.keyword,color:"#708"},{tag:[Sa.atom,Sa.bool,Sa.url,Sa.contentSeparator,Sa.labelName],color:"#219"},{tag:[Sa.literal,Sa.inserted],color:"#164"},{tag:[Sa.string,Sa.deleted],color:"#a11"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],color:"#e40"},{tag:Sa.definition(Sa.variableName),color:"#00f"},{tag:Sa.local(Sa.variableName),color:"#30a"},{tag:[Sa.typeName,Sa.namespace],color:"#085"},{tag:Sa.className,color:"#167"},{tag:[Sa.special(Sa.variableName),Sa.macroName],color:"#256"},{tag:Sa.definition(Sa.propertyName),color:"#00c"},{tag:Sa.comment,color:"#940"},{tag:Sa.invalid,color:"#f00"}]),Xl=Ts.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Zl=1e4,Al="()[]{}",Tl=E.define({combine:t=>kt(t,{afterCursor:!0,brackets:Al,maxScanDistance:Zl,renderMatch:Vl})}),Rl=ni.mark({class:"cm-matchingBracket"}),El=ni.mark({class:"cm-nonmatchingBracket"});function Vl(t){let e=[],i=t.matched?Rl:El;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 Ml=q.define({create:()=>ni.none,update(t,e){if(!e.docChanged&&!e.selection)return t;let i=[],n=e.state.facet(Tl);for(let t of e.state.selection.ranges){if(!t.empty)continue;let s=Ll(e.state,t.head,-1,n)||t.head>0&&Ll(e.state,t.head-1,1,n)||n.afterCursor&&(Ll(e.state,t.head,1,n)||t.headTs.decorations.from(t)}),Dl=[Ml,Xl];function Wl(t={}){return[Tl.of(t),Dl]}const Ul=new ho;function Yl(t,e,i){let n=t.prop(e<0?ho.openedBy:ho.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 ql(t){let e=t.type.prop(Ul);return e?e(t.node):t}function Ll(t,e,i,n={}){let s=n.maxScanDistance||Zl,r=n.brackets||Al,o=Xa(t),a=o.resolveInner(e,i);for(let n=a;n;n=n.parent){let s=Yl(n.type,i,r);if(s&&n.from0?e>=o.from&&eo.from&&e<=o.to))return zl(t,e,i,n,o,s,r)}}return function(t,e,i,n,s,r,o){let a=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%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 a=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(a+t,1).type!=s))if(e%2==0==i>0)u++;else{if(1==u)return{start:h,end:{from:a+t,to:a+t+1},matched:e>>1==l>>1};u--}}i>0&&(t+=r.length)}return c.done?{start:h,matched:!1}:null}(t,e,i,o,a.type,s,r)}function zl(t,e,i,n,s,r,o){let a=n.parent,l={from:s.from,to:s.to},h=0,c=null==a?void 0:a.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 jl(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 Nl=new WeakMap;class Gl extends Pa{constructor(t){let e,i=Qa(t.languageData),n={name:(s=t).name||"",token:s.token,blankLine:s.blankLine||(()=>{}),startState:s.startState||(()=>!0),copyState:s.copyState||jl,indent:s.indent||(()=>null),languageData:s.languageData||{},tokenTable:s.tokenTable||th};var s;super(i,new class extends Vo{createParse(t,i,n){return new Jl(e,t,i,n)}},[qa.of(((t,e)=>this.getIndent(t,e)))],t.name),this.topNode=function(t){let e=fo.define({id:eh.length,name:"Document",props:[ka.add((()=>t))]});return eh.push(e),e}(i),e=this,this.streamParser=n,this.stateAfter=new ho({perNode:!0}),this.tokenTable=t.tokenTable?new rh(n.tokenTable):oh}static define(t){return new Gl(t)}getIndent(t,e){let i,n=Xa(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=Nl.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],a=i+e.positions[r],l=o instanceof bo&&a=e.length)return e;s||e.type!=t.topNode||(s=!0);for(let r=e.children.length-1;r>=0;r--){let o,a=e.positions[r],l=e.children[r];if(ai&&Fl(t,n.tree,0-n.offset,i,r);if(o&&(e=Hl(t,n.tree,i+n.offset,o.pos+n.offset,!1)))return{state:o.state,tree:e}}return{state:t.streamParser.startState(n?za(n):4),tree:bo.empty}}(t,i,r,null==s?void 0:s.state);this.state=o,this.parsedPos=this.chunkStart=r+a.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 Bl(e,t?t.state.tabSize:4,t?za(t.state):2);if(r.eol())s.blankLine(this.state,r.indentUnit);else for(;!r.eol();){let t=Kl(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 th=Object.create(null),eh=[fo.none],ih=new po(eh),nh=[],sh=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"]])sh[t]=lh(th,e);class rh{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),sh)}resolve(t){return t?this.table[t]||(this.table[t]=lh(this.extra,t)):0}}const oh=new rh(th);function ah(t,e){nh.indexOf(t)>-1||(nh.push(t),console.warn(e))}function lh(t,e){let i=null;for(let n of e.split(".")){let e=t[n]||Sa[n];e?"function"==typeof e?i?i=e(i):ah(n,`Modifier ${n} used at start of tag`):i?ah(n,`Tag ${n} used as modifier`):i=e:ah(n,`Unknown highlighting tag ${n}`)}if(!i)return 0;let n=e.replace(/ /g,"_"),s=fo.define({id:eh.length,name:n,props:[ea({[n]:i})]});return eh.push(s),s.id}function hh(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 ch=hh(gh,0),uh=hh(Oh,0),dh=hh(((t,e)=>Oh(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 fh(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}const ph=50;function Oh(t,e,i=e.selection.ranges){let n=i.map((t=>fh(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,a=t.sliceDoc(n-ph,n),l=t.sliceDoc(s,s+ph),h=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(l)[0].length,u=a.length-h;if(a.slice(u-e.length,u)==e&&l.slice(c,c+i.length)==i)return{open:{pos:n-h,margin:h&&1},close:{pos:s+c,margin:c&&1}};s-n<=2*ph?r=o=t.sliceDoc(n,s):(r=t.sliceDoc(n,n+ph),o=t.sliceDoc(s-ph,s));let d=/^\s*/.exec(r)[0].length,f=/\s*$/.exec(o)[0].length,p=o.length-f-i.length;return r.slice(d,d+e.length)==e&&o.slice(p,p+i.length)==i?{open:{pos:n+d+e.length,margin:/\s/.test(r.charAt(d+e.length))?1:0},close:{pos:s-f-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>l.from)){s=l.from;let t=/^\s*/.exec(l.text)[0].length,e=t==l.length,i=l.text.slice(t,t+a.length)==a?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 mh=lt.define(),bh=lt.define(),wh=E.define(),vh=E.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)})});const yh=q.define({create:()=>Dh.empty,update(t,e){let i=e.state.facet(vh),n=e.annotation(mh);if(n){let s=e.docChanged?A.single(function(t){let e=0;return t.iterChangedRanges(((t,i)=>e=i)),e}(e.changes)):void 0,r=Ch.fromTransaction(e,s),o=n.side,a=0==o?t.undone:t.done;return a=r?_h(a,a.length,i.minDepth,r):Th(a,e.startState.selection),new Dh(0==o?n.rest:a,0==o?a:n.rest)}let s=e.annotation(bh);if("full"!=s&&"before"!=s||(t=t.isolate()),!1===e.annotation(dt.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);let r=Ch.fromTransaction(e),o=e.annotation(dt.time),a=e.annotation(dt.userEvent);return r?t=t.addChanges(r,o,a,i,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,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 Dh(t.done.map(Ch.fromJSON),t.undone.map(Ch.fromJSON))});function Sh(t={}){return[yh,vh.of(t),Ts.domEventHandlers({beforeinput(t,e){let i="historyUndo"==t.inputType?kh:"historyRedo"==t.inputType?Qh:null;return!!i&&(t.preventDefault(),i(e))}})]}function xh(t,e){return function({state:i,dispatch:n}){if(!e&&i.readOnly)return!1;let s=i.field(yh,!1);if(!s)return!1;let r=s.pop(t,i,e);return!!r&&(n(r),!0)}}const kh=xh(0,!1),Qh=xh(1,!1),$h=xh(0,!0),Ph=xh(1,!0);class Ch{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 Ch(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 Ch(t.changes&&k.fromJSON(t.changes),[],t.mapped&&x.fromJSON(t.mapped),t.startSelection&&A.fromJSON(t.startSelection),t.selectionsAfter.map(A.fromJSON))}static fromTransaction(t,e){let i=Zh;for(let e of t.startState.facet(wh)){let n=e(t);n.length&&(i=i.concat(n))}return!i.length&&t.changes.empty?null:new Ch(t.changes.invert(t.startState.doc),i,void 0,e||t.startState.selection,Zh)}static selection(t){return new Ch(void 0,Zh,void 0,void 0,t)}}function _h(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 Xh(t,e){return t.length?e.length?t.concat(e):t:e}const Zh=[],Ah=200;function Th(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-Ah));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),_h(t,t.length-1,1e9,i.setSelAfter(n)))}return[Ch.selection([e])]}function Rh(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 Eh(t,e){if(!t.length)return t;let i=t.length,n=Zh;for(;i;){let s=Vh(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?[Ch.selection(n)]:Zh}function Vh(t,e,i){let n=Xh(t.selectionsAfter.length?t.selectionsAfter.map((t=>t.map(e))):Zh,i);if(!t.changes)return Ch.selection(n);let s=t.changes.map(e),r=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(r):r;return new Ch(s,ut.mapEffects(t.effects,e),o,t.startSelection.map(r),n)}const Mh=/^(input\.type|delete)($|\.)/;class Dh{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 Dh(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||Mh.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)?_h(r,r.length-1,n.minDepth,new Ch(t.changes.compose(o.changes),Xh(t.effects,o.effects),o.mapped,o.startSelection,Zh)):_h(r,r.length,n.minDepth,t),new Dh(r,Zh,e,i)}addSelection(t,e,i,n){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Zh;return s.length>0&&e-this.prevTimet.empty!=o.ranges[e].empty)).length)?this:new Dh(Th(this.done,t),this.undone,e,i);var r,o}addMapping(t){return new Dh(Eh(this.done,t),Eh(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:mh.of({side:t,rest:Rh(n)}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let i=1==n.length?Zh:n.slice(0,n.length-1);return s.mapped&&(i=Eh(i,s.mapped)),e.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:mh.of({side:t,rest:i}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}}Dh.empty=new Dh(Zh,Zh);const Wh=[{key:"Mod-z",run:kh,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Qh,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Qh,preventDefault:!0},{key:"Mod-u",run:$h,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Ph,preventDefault:!0}];function Uh(t,e){return A.create(t.ranges.map(e),t.mainIndex)}function Yh(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function qh({state:t,dispatch:e},i){let n=Uh(t.selection,i);return!n.eq(t.selection)&&(e(Yh(t,n)),!0)}function Lh(t,e){return A.cursor(e?t.to:t.from)}function zh(t,e){return qh(t,(i=>i.empty?t.moveByChar(i,e):Lh(i,e)))}function Ih(t){return t.textDirectionAt(t.state.selection.main.head)==Wi.LTR}const Bh=t=>zh(t,!Ih(t)),jh=t=>zh(t,Ih(t));function Nh(t,e){return qh(t,(i=>i.empty?t.moveByGroup(i,e):Lh(i,e)))}function Gh(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 Fh(t,e,i){let n,s,r=Xa(t).resolveInner(e.head),o=i?ho.closedBy:ho.openedBy;for(let n=e.head;;){let e=i?r.childAfter(n):r.childBefore(n);if(!e)break;Gh(t,e,o)?r=e:n=i?e.to:e.from}return s=r.type.prop(o)&&(n=i?Ll(t,r.from,1):Ll(t,r.to,-1))&&n.matched?i?n.end.to:n.end.from:i?r.to:r.from,A.cursor(s,i?-1:1)}function Hh(t,e){return qh(t,(i=>{if(!i.empty)return Lh(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)}))}const Jh=t=>Hh(t,!1),Kh=t=>Hh(t,!0);function tc(t){let e,i=t.scrollDOM.clientHeighti.empty?t.moveVertically(i,e,n.height):Lh(i,e)));if(r.eq(s.selection))return!1;if(n.selfScroll){let e=t.coordsAtPos(s.selection.main.head),o=t.scrollDOM.getBoundingClientRect(),a=o.top+n.marginTop,l=o.bottom-n.marginBottom;e&&e.top>a&&e.bottomec(t,!1),nc=t=>ec(t,!0);function sc(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=A.cursor(n.from+i))}return s}function rc(t,e){let i=Uh(t.state.selection,(t=>{let i=e(t);return A.range(t.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)}));return!i.eq(t.state.selection)&&(t.dispatch(Yh(t.state,i)),!0)}function oc(t,e){return console.log("Select!"),rc(t,(i=>t.moveByCharSelected(i,e)))}const ac=t=>oc(t,!Ih(t)),lc=t=>oc(t,Ih(t));function hc(t,e){return rc(t,(i=>t.moveByGroup(i,e)))}function cc(t,e){return rc(t,(i=>t.moveVertically(i,e)))}const uc=t=>cc(t,!1),dc=t=>cc(t,!0);function fc(t,e){return rc(t,(i=>t.moveVertically(i,e,tc(t).height)))}const pc=t=>fc(t,!1),Oc=t=>fc(t,!0),gc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:0})),!0),mc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.doc.length})),!0),bc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:0})),!0),wc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0);function vc(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=yc(t,n,!0)),s=Math.min(s,n),r=Math.max(r,n)}else s=yc(t,s,!1),r=yc(t,r,!0);return s==r?{range:n}:{changes:{from:s,to:r},range:A.cursor(s)}}));return!s.changes.empty&&(t.dispatch(n.update(s,{scrollIntoView:!0,userEvent:i,effects:"delete.selection"==i?Ts.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function yc(t,e,i){if(t instanceof Ts)for(let n of t.state.facet(Ts.atomicRanges).map((e=>e(t))))n.between(e,e,((t,n)=>{te&&(e=i?n:t)}));return e}const Sc=(t,e)=>vc(t,(i=>{let n,s,{state:r}=t,o=r.doc.lineAt(i);if(!e&&i>o.from&&iSc(t,!1),kc=t=>Sc(t,!0),Qc=(t,e)=>vc(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 a=f(r.text,n-r.from,e)+r.from,l=r.text.slice(Math.min(n,a)-r.from,Math.max(n,a)-r.from),h=o(l);if(null!=t&&h!=t)break;" "==l&&n==i||(t=h),n=a}return n})),$c=t=>Qc(t,!1),Pc=t=>vc(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 _c(t,e,i){if(t.readOnly)return!1;let n=[],s=[];for(let e of Cc(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(A.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(A.range(t.anchor-o,t.head-o))}}return!!n.length&&(e(t.update({changes:n,scrollIntoView:!0,selection:A.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0)}function Xc(t,e,i){if(t.readOnly)return!1;let n=[];for(let e of Cc(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 Zc=Ac(!1);function Ac(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),a=!e&&s==r&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i,n=Xa(t).resolveInner(e),s=n.childBefore(e),r=n.childAfter(e);return s&&r&&s.to<=e&&r.from>=e&&(i=s.type.prop(ho.closedBy))&&i.indexOf(r.name)>-1&&t.doc.lineAt(s.to).from==t.doc.lineAt(r.from).from?{from:s.to,to:r.from}:null}(i,s);e&&(s=r=(r<=o.to?o:i.doc.lineAt(r)).to);let l=new ja(i,{simulateBreak:s,simulateDoubleBreak:!!a}),h=Ba(l,s);for(null==h&&(h=/^\s*/.exec(i.doc.lineAt(s).text)[0].length);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:A.range(r.mapPos(n.anchor,1),r.mapPos(n.head,1))}}))}const Rc=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{i.push({from:e.from,insert:t.facet(La)})})),{userEvent:"input.indent"})),!0),Ec=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{let n=/^\s*/.exec(e.text)[0];if(!n)return;let s=Yt(n,t.tabSize),r=0,o=Ia(t,Math.max(0,s-za(t)));for(;rqh(t,(e=>Fh(t.state,e,!Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,!Ih(t))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:t=>qh(t,(e=>Fh(t.state,e,Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,Ih(t))))},{key:"Alt-ArrowUp",run:({state:t,dispatch:e})=>_c(t,e,!1)},{key:"Shift-Alt-ArrowUp",run:({state:t,dispatch:e})=>Xc(t,e,!1)},{key:"Alt-ArrowDown",run:({state:t,dispatch:e})=>_c(t,e,!0)},{key:"Shift-Alt-ArrowDown",run:({state:t,dispatch:e})=>Xc(t,e,!0)},{key:"Escape",run:({state:t,dispatch:e})=>{let i=t.selection,n=null;return i.ranges.length>1?n=A.create([i.main]):i.main.empty||(n=A.create([A.cursor(i.main.head)])),!!n&&(e(Yh(t,n)),!0)}},{key:"Mod-Enter",run:Ac(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:t,dispatch:e})=>{let i=Cc(t).map((({from:e,to:i})=>A.range(e,Math.min(i+1,t.doc.length))));return e(t.update({selection:A.create(i),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:t,dispatch:e})=>{let i=Uh(t.selection,(e=>{var i;let n=Xa(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 A.range(n.to,n.from)}));return e(Yh(t,i)),!0},preventDefault:!0},{key:"Mod-[",run:Ec},{key:"Mod-]",run:Rc},{key:"Mod-Alt-\\",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new ja(t,{overrideIndentation:t=>{let e=i[t];return null==e?-1:e}}),s=Tc(t,((e,s,r)=>{let o=Ba(n,e.from);if(null==o)return;/\S/.test(e.text)||(o=0);let a=/^\s*/.exec(e.text)[0],l=Ia(t,o);(a!=l||r.from{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(Cc(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=Uh(t.selection,(e=>{let s=Ll(t,e.head,-1)||Ll(t,e.head,1)||e.head>0&&Ll(t,e.head-1,1)||e.head{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=fh(t.state,i.from);return n.line?ch(t):!!n.block&&dh(t)}},{key:"Alt-A",run:uh}].concat([{key:"ArrowLeft",run:Bh,shift:ac,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:t=>Nh(t,!Ih(t)),shift:t=>hc(t,!Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:t=>qh(t,(e=>sc(t,e,!Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,!Ih(t)))),preventDefault:!0},{key:"ArrowRight",run:jh,shift:lc,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:t=>Nh(t,Ih(t)),shift:t=>hc(t,Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:t=>qh(t,(e=>sc(t,e,Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,Ih(t)))),preventDefault:!0},{key:"ArrowUp",run:Jh,shift:uc,preventDefault:!0},{mac:"Cmd-ArrowUp",run:gc,shift:bc},{mac:"Ctrl-ArrowUp",run:ic,shift:pc},{key:"ArrowDown",run:Kh,shift:dc,preventDefault:!0},{mac:"Cmd-ArrowDown",run:mc,shift:wc},{mac:"Ctrl-ArrowDown",run:nc,shift:Oc},{key:"PageUp",run:ic,shift:pc},{key:"PageDown",run:nc,shift:Oc},{key:"Home",run:t=>qh(t,(e=>sc(t,e,!1))),shift:t=>rc(t,(e=>sc(t,e,!1))),preventDefault:!0},{key:"Mod-Home",run:gc,shift:bc},{key:"End",run:t=>qh(t,(e=>sc(t,e,!0))),shift:t=>rc(t,(e=>sc(t,e,!0))),preventDefault:!0},{key:"Mod-End",run:mc,shift:wc},{key:"Enter",run:Zc},{key:"Mod-a",run:({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:xc,shift:xc},{key:"Delete",run:kc},{key:"Mod-Backspace",mac:"Alt-Backspace",run:$c},{key:"Mod-Delete",mac:"Alt-Delete",run:t=>Qc(t,!0)},{mac:"Mod-Backspace",run:t=>vc(t,(e=>{let i=t.lineBlockAt(e).from;return e>i?i:Math.max(0,e-1)}))},{mac:"Mod-Delete",run:Pc}].concat([{key:"Ctrl-b",run:Bh,shift:ac,preventDefault:!0},{key:"Ctrl-f",run:jh,shift:lc},{key:"Ctrl-p",run:Jh,shift:uc},{key:"Ctrl-n",run:Kh,shift:dc},{key:"Ctrl-a",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).from,1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).from)))},{key:"Ctrl-e",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).to,-1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).to)))},{key:"Ctrl-d",run:kc},{key:"Ctrl-h",run:xc},{key:"Ctrl-k",run:Pc},{key:"Ctrl-Alt-h",run:$c},{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:A.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:f(n.text,i-n.from,!1)+n.from,r=i==n.to?i+1:f(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:A.cursor(r)}}));return!i.changes.empty&&(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:nc}].map((t=>({mac:t.key,run:t.run,shift:t.shift})))));function Mc(){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 Uc{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(Wc(t)):Wc,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 b(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=w(t),i=this.bufferStart+this.bufferPos;this.bufferPos+=v(t);let n=this.normalize(e);for(let t=0,s=i;;t++){let r=n.charCodeAt(t),o=this.match(r,s);if(o)return this.value=o,this;if(t==n.length-1)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=jc(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 Ic(e,t.sliceString(e,i));return zc.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=jc(this.text,i+(t==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ic.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function jc(t,e){if(e>=t.length)return e;let i,n=t.lineAt(e);for(;e=56320&&i<57344;)e++;return e}function Nc(t){let e=Mc("input",{class:"cm-textfield",name:"line"});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,a,l]=i,h=a?+a.slice(1):0,c=o?+o:s.number;if(o&&l){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)));t.dispatch({effects:Gc.of(!1),selection:A.cursor(u.from+Math.max(0,Math.min(h,u.length))),scrollIntoView:!0}),t.focus()}return{dom:Mc("form",{class:"cm-gotoLine",onkeydown:e=>{27==e.keyCode?(e.preventDefault(),t.dispatch({effects:Gc.of(!1)}),t.focus()):13==e.keyCode&&(e.preventDefault(),i())},onsubmit:t=>{t.preventDefault(),i()}},Mc("label",t.state.phrase("Go to line"),": ",e)," ",Mc("button",{class:"cm-button",type:"submit"},t.state.phrase("go")))}}"undefined"!=typeof Symbol&&(Lc.prototype[Symbol.iterator]=Bc.prototype[Symbol.iterator]=function(){return this});const Gc=ut.define(),Fc=q.define({create:()=>!0,update(t,e){for(let i of e.effects)i.is(Gc)&&(t=i.value);return t},provide:t=>Ur.from(t,(t=>t?Nc:null))}),Hc=Ts.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),Jc={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Kc=E.define({combine:t=>kt(t,Jc,{highlightWordAroundCursor:(t,e)=>t||e,minSelectionLength:Math.min,maxMatches:Math.min})});function tu(t){let e=[ru,su];return t&&e.push(Kc.of(t)),e}const eu=ni.mark({class:"cm-selectionMatch"}),iu=ni.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function nu(t,e,i,n){return!(0!=i&&t(e.sliceDoc(i-1,i))==wt.Word||n!=e.doc.length&&t(e.sliceDoc(n,n+1))==wt.Word)}const su=_i.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(Kc),{state:i}=t,n=i.selection;if(n.ranges.length>1)return ni.none;let s,r=n.main,o=null;if(r.empty){if(!e.highlightWordAroundCursor)return ni.none;let t=i.wordAt(r.head);if(!t)return ni.none;o=i.charCategorizer(r.head),s=i.sliceDoc(t.from,t.to)}else{let t=r.to-r.from;if(t200)return ni.none;if(e.wholeWords){if(s=i.sliceDoc(r.from,r.to),o=i.charCategorizer(r.head),!nu(o,i,r.from,r.to)||!function(t,e,i,n){return t(e.sliceDoc(i,i+1))==wt.Word&&t(e.sliceDoc(n-1,n))==wt.Word}(o,i,r.from,r.to))return ni.none}else if(s=i.sliceDoc(r.from,r.to).trim(),!s)return ni.none}let a=[];for(let n of t.visibleRanges){let t=new Uc(i.doc,s,n.from,n.to);for(;!t.next().done;){let{from:n,to:s}=t.value;if((!o||nu(o,i,n,s))&&(r.empty&&n<=r.from&&s>=r.to?a.push(iu.range(n,s)):(n>=r.to||s<=r.from)&&a.push(eu.range(n,s)),a.length>e.maxMatches))return ni.none}}return ni.set(a)}},{decorations:t=>t.decorations}),ru=Ts.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});const ou=E.define({combine:t=>kt(t,{top:!1,caseSensitive:!1,literal:!1,wholeWord:!1,createPanel:t=>new Eu(t),scrollToMatch:t=>Ts.scrollIntoView(t)})});class au{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,qc),!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 pu(this):new cu(this)}getCursor(t,e=0,i){let n=t.doc?t:xt.create({doc:t});return null==i&&(i=n.doc.length),this.regexp?uu(this,n,e,i):hu(this,n,e,i)}}class lu{constructor(t){this.spec=t}}function hu(t,e,i,n){return new Uc(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=hu(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 uu(t,e,i,n){return new Lc(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?(s=e.charCategorizer(e.selection.main.head),(t,e,i)=>!i[0].length||(s(du(i.input,i.index))!=wt.Word||s(fu(i.input,i.index))!=wt.Word)&&(s(fu(i.input,i.index+i[0].length))!=wt.Word||s(du(i.input,i.index+i[0].length))!=wt.Word)):void 0},i,n);var s}function du(t,e){return t.slice(f(t,e,!1),e)}function fu(t,e){return t.slice(e,f(t,e))}class pu extends lu{nextMatch(t,e,i){let n=uu(this.spec,t,i,t.doc.length).next();return n.done&&(n=uu(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=uu(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=uu(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 Ou=ut.define(),gu=ut.define(),mu=q.define({create:t=>new bu(_u(t).create(),null),update(t,e){for(let i of e.effects)i.is(Ou)?t=new bu(i.value.create(),t.panel):i.is(gu)&&(t=new bu(t.query,i.value?Cu:null));return t},provide:t=>Ur.from(t,(t=>t.panel))});class bu{constructor(t,e){this.query=t,this.panel=e}}const wu=ni.mark({class:"cm-searchMatch"}),vu=ni.mark({class:"cm-searchMatch cm-searchMatch-selected"}),yu=_i.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(mu))}update(t){let e=t.state.field(mu);(e!=t.startState.field(mu)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ni.none;let{view:i}=this,n=new Xt;for(let e=0,s=i.visibleRanges,r=s.length;es[e+1].from-500;)a=s[++e].to;t.highlight(i.state,o,a,((t,e)=>{let s=i.state.selection.ranges.some((i=>i.from==t&&i.to==e));n.add(t,e,s?vu:wu)}))}return n.finish()}},{decorations:t=>t.decorations});function Su(t){return e=>{let i=e.state.field(mu,!1);return i&&i.query.spec.valid?t(e,i):Au(e)}}const xu=Su(((t,{query:e})=>{let{to:i}=t.state.selection.main,n=e.nextMatch(t.state,i,i);if(!n)return!1;let s=A.single(n.from,n.to),r=t.state.facet(ou);return t.dispatch({selection:s,effects:[Wu(t,n),r.scrollToMatch(s.main,t)],userEvent:"select.search"}),Zu(t),!0})),ku=Su(((t,{query:e})=>{let{state:i}=t,{from:n}=i.selection.main,s=e.prevMatch(i,n,n);if(!s)return!1;let r=A.single(s.from,s.to),o=t.state.facet(ou);return t.dispatch({selection:r,effects:[Wu(t,s),o.scrollToMatch(r.main,t)],userEvent:"select.search"}),Zu(t),!0})),Qu=Su(((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!(!i||!i.length)&&(t.dispatch({selection:A.create(i.map((t=>A.range(t.from,t.to)))),userEvent:"select.search.matches"}),!0)})),$u=Su(((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,a,l=[],h=[];if(r.from==n&&r.to==s&&(a=i.toText(e.getReplacement(r)),l.push({from:r.from,to:r.to,insert:a}),r=e.nextMatch(i,r.from,r.to),h.push(Ts.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(n).number)+"."))),r){let e=0==l.length||l[0].from>=r.to?0:r.to-r.from-a.length;o=A.single(r.from-e,r.to-e),h.push(Wu(t,r)),h.push(i.facet(ou).scrollToMatch(o.main,t))}return t.dispatch({changes:l,selection:o,effects:h,userEvent:"input.replace"}),!0})),Pu=Su(((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:Ts.announce.of(n),userEvent:"input.replace.all"}),!0}));function Cu(t){return t.state.facet(ou).createPanel(t)}function _u(t,e){var i,n,s,r;let o=t.selection.main,a=o.empty||o.to>o.from+100?"":t.sliceDoc(o.from,o.to);if(e&&!a)return e;let l=t.facet(ou);return new au({search:(null!==(i=null==e?void 0:e.literal)&&void 0!==i?i:l.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:null!==(n=null==e?void 0:e.caseSensitive)&&void 0!==n?n:l.caseSensitive,literal:null!==(s=null==e?void 0:e.literal)&&void 0!==s?s:l.literal,wholeWord:null!==(r=null==e?void 0:e.wholeWord)&&void 0!==r?r:l.wholeWord})}function Xu(t){let e=Vr(t,Cu);return e&&e.dom.querySelector("[main-field]")}function Zu(t){let e=Xu(t);e&&e==t.root.activeElement&&e.select()}const Au=t=>{let e=t.state.field(mu,!1);if(e&&e.panel){let i=Xu(t);if(i&&i!=t.root.activeElement){let n=_u(t.state,e.query.spec);n.valid&&t.dispatch({effects:Ou.of(n)}),i.focus(),i.select()}}else t.dispatch({effects:[gu.of(!0),e?Ou.of(_u(t.state,e.query.spec)):ut.appendConfig.of(Yu)]});return!0},Tu=t=>{let e=t.state.field(mu,!1);if(!e||!e.panel)return!1;let i=Vr(t,Cu);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:gu.of(!1)}),!0},Ru=[{key:"Mod-f",run:Au,scope:"editor search-panel"},{key:"F3",run:xu,shift:ku,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:xu,shift:ku,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Tu,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 Uc(t.doc,t.sliceDoc(n,s));!e.next().done;){if(r.length>1e3)return!1;e.value.from==n&&(o=r.length),r.push(A.range(e.value.from,e.value.to))}return e(t.update({selection:A.create(r,o),userEvent:"select.search.matches"})),!0}},{key:"Alt-g",run:t=>{let e=Vr(t,Nc);if(!e){let i=[Gc.of(!0)];null==t.state.field(Fc,!1)&&i.push(ut.appendConfig.of([Fc,Hc])),t.dispatch({effects:i}),e=Vr(t,Nc)}return e&&e.dom.querySelector("input").focus(),!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=A.create(i.ranges.map((e=>t.wordAt(e.head)||A.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 Uc(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 Uc(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(A.range(s.from,s.to),!1),effects:Ts.scrollIntoView(s.to)})),!0)},preventDefault:!0}];class Eu{constructor(t){this.view=t;let e=this.query=t.state.field(mu).query.spec;function i(t,e,i){return Mc("button",{class:"cm-button",name:t,onclick:e,type:"button"},i)}this.commit=this.commit.bind(this),this.searchField=Mc("input",{value:e.search,placeholder:Vu(t,"Find"),"aria-label":Vu(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Mc("input",{value:e.replace,placeholder:Vu(t,"Replace"),"aria-label":Vu(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Mc("input",{type:"checkbox",name:"case",form:"",checked:e.caseSensitive,onchange:this.commit}),this.reField=Mc("input",{type:"checkbox",name:"re",form:"",checked:e.regexp,onchange:this.commit}),this.wordField=Mc("input",{type:"checkbox",name:"word",form:"",checked:e.wholeWord,onchange:this.commit}),this.dom=Mc("div",{onkeydown:t=>this.keydown(t),class:"cm-search"},[this.searchField,i("next",(()=>xu(t)),[Vu(t,"next")]),i("prev",(()=>ku(t)),[Vu(t,"previous")]),i("select",(()=>Qu(t)),[Vu(t,"all")]),...t.state.readOnly?[]:[Mc("br"),this.replaceField,i("replace",(()=>$u(t)),[Vu(t,"replace")]),i("replaceAll",(()=>Pu(t)),[Vu(t,"replace all")])],Mc("button",{name:"close",onclick:()=>Tu(t),"aria-label":Vu(t,"close"),type:"button"},["×"])])}commit(){let t=new au({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:Ou.of(t)}))}keydown(t){var e,i,n;e=this.view,i=t,n="search-panel",Bs(Ls(e.state),i,e,n)?t.preventDefault():13==t.keyCode&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?ku:xu)(this.view)):13==t.keyCode&&t.target==this.replaceField&&(t.preventDefault(),$u(this.view))}update(t){for(let e of t.transactions)for(let t of e.effects)t.is(Ou)&&!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(ou).top}}function Vu(t,e){return t.state.phrase(e)}const Mu=30,Du=/[\s\.,:;?!]/;function Wu(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-Mu),o=Math.min(s,i+Mu),a=t.state.sliceDoc(r,o);if(r!=n.from)for(let t=0;ta.length-Mu;t--)if(!Du.test(a[t-1])&&Du.test(a[t])){a=a.slice(0,t);break}return Ts.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${n.number}.`)}const Uu=Ts.baseTheme({".cm-panel.cm-search":{padding:"0.25rem 0.5rem 0.25rem 0.5rem",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"0.5rem",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"}}),Yu=[mu,N.lowest(yu),Uu];class qu{constructor(t,e,i){this.state=t,this.pos=e,this.explicit=i,this.abortListeners=[]}tokenBefore(t){let e=Xa(this.state).resolveInner(this.pos,-1);for(;e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null}matchBefore(t){let e=this.state.doc.lineAt(this.pos),i=Math.max(e.from,this.pos-250),n=e.text.slice(i-e.from,this.pos-e.from),s=n.search(ju(t,!1));return s<0?null:{from:i+s,to:this.pos,text:n.slice(s)}}get aborted(){return null==this.abortListeners}addEventListener(t,e){"abort"==t&&this.abortListeners&&this.abortListeners.push(e)}}function Lu(t){let e=Object.keys(t).join(""),i=/\w/.test(e);return i&&(e=e.replace(/\w/g,"")),`[${i?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function zu(t){let e=t.map((t=>"string"==typeof t?{label:t}:t)),[i,n]=e.every((t=>/^\w+$/.test(t.label)))?[/\w*$/,/\w+$/]:function(t){let e=Object.create(null),i=Object.create(null);for(let{label:n}of t){e[n[0]]=!0;for(let t=1;t{let s=t.matchBefore(n);return s||t.explicit?{from:s?s.from:t.pos,options:e,validFor:i}:null}}class Iu{constructor(t,e,i,n){this.completion=t,this.source=e,this.match=i,this.score=n}}function Bu(t){return t.selection.main.from}function ju(t,e){var i;let{source:n}=t,s=e&&"^"!=n[0],r="$"!=n[n.length-1];return s||r?new RegExp(`${s?"^":""}(?:${n})${r?"$":""}`,null!==(i=t.flags)&&void 0!==i?i:t.ignoreCase?"i":""):t}const Nu=lt.define();const Gu=new WeakMap;function Fu(t){if(!Array.isArray(t))return t;let e=Gu.get(t);return e||Gu.set(t,e=zu(t)),e}const Hu=ut.define(),Ju=ut.define();class Ku{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[];for(let e=0;e=48&&l<=57||l>=97&&l<=122?2:l>=65&&l<=90?1:0:(y=w(l))!=y.toLowerCase()?1:y!=y.toUpperCase()?2:0;(!n||1==S&&O||0==m&&0!=S)&&(e[c]==l||i[c]==l&&(u=!0)?r[c++]=n:r.length&&(g=!1)),m=S,n+=v(l)}return c==a&&0==r[0]&&g?this.result((u?-200:0)-100,r,t):d==a&&0==f?[-200-t.length+(p==t.length?0:-100),0,p]:o>-1?[-700-t.length,o,o+this.pattern.length]:d==a?[-900-t.length,f,p]:c==a?this.result((u?-200:0)-100-700+(g?0:-1100),r,t):2==e.length?null:this.result((n[0]?-700:0)-200-1100,n,t)}result(t,e,i){let n=[t-i.length],s=1;for(let t of e){let e=t+(this.astral?v(b(i,t)):1);s>1&&n[s-1]==t?n[s-1]=e:(n[s++]=t,n[s++]=e)}return n}}const td=E.define({combine:t=>kt(t,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:id,compareCompletions:(t,e)=>t.label.localeCompare(e.label),interactionDelay:75},{defaultKeymap:(t,e)=>t&&e,closeOnBlur:(t,e)=>t&&e,icons:(t,e)=>t&&e,tooltipClass:(t,e)=>i=>ed(t(i),e(i)),optionClass:(t,e)=>i=>ed(t(i),e(i)),addToOptions:(t,e)=>t.concat(e)})});function ed(t,e){return t?e?t+" "+e:t:e}function id(t,e,i,n,s){let r,o,a=t.textDirection==Wi.RTL,l=a,h=!1,c="top",u=e.left-s.left,d=s.right-e.right,f=n.right-n.left,p=n.bottom-n.top;if(l&&u=p||t>e.top?r=i.bottom-e.top:(c="bottom",r=e.bottom-i.top)}return{style:`${c}: ${r}px; max-width: ${o}px`,class:"cm-completionInfo-"+(h?a?"left-narrow":"right-narrow":l?"left":"right")}}function nd(t,e="option"){return i=>{let n=i.state.field(yd,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp-1?n.open.selected+r*(t?1:-1):t?0:o-1;return a<0?a="page"==e?0:o-1:a>=o&&(a="page"==e?o-1:0),i.dispatch({effects:vd.of(a)}),!0}}const sd=t=>{let e=t.state.field(yd,!1);return!(t.state.readOnly||!e||!e.open||e.open.selected<0||Date.now()-e.open.timestamp(t.selection||t.docChanged)&&!gd(t)));for(let e=0;e50&&Date.now()-n.time>1e3){for(let t of n.context.abortListeners)try{t()}catch(t){Qi(this.view.state,t)}n.context.abortListeners=null,this.running.splice(e--,1)}else n.updates.push(...t.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some((t=>1==t.state&&!this.running.some((e=>e.active.source==t.source))))?setTimeout((()=>this.startUpdate()),50):-1,0!=this.composing)for(let e of t.transactions)"input"==gd(e)?this.composing=2:2==this.composing&&e.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:t}=this.view,e=t.field(yd);for(let t of e.active)1!=t.state||this.running.some((e=>e.active.source==t.source))||this.startQuery(t)}startQuery(t){let{state:e}=this.view,i=Bu(e),n=new qu(e,i,t.explicitPos==i),s=new rd(t,n);this.running.push(s),Promise.resolve(t.source(n)).then((t=>{s.context.aborted||(s.done=t||null,this.scheduleAccept())}),(t=>{this.view.dispatch({effects:Ju.of(null)}),Qi(this.view.state,t)}))}scheduleAccept(){this.running.every((t=>void 0!==t.done))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((()=>this.accept()),50))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],i=this.view.state.facet(td);for(let n=0;nt.source==s.active.source));if(r&&1==r.state)if(null==s.done){let t=new md(s.active.source,0);for(let e of s.updates)t=t.update(e,i);1!=t.state&&e.push(t)}else this.startQuery(r)}e.length&&this.view.dispatch({effects:wd.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(yd,!1);if(e&&e.tooltip&&this.view.state.facet(td).closeOnBlur){let i=e.open&&Rr(this.view,e.open.tooltip);i&&i.dom.contains(t.relatedTarget)||this.view.dispatch({effects:Ju.of(null)})}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout((()=>this.view.dispatch({effects:Hu.of(!1)})),20),this.composing=0}}});function ad(t,e){const i=e.completion.apply||e.completion.label;let n=t.state.field(yd).active.find((t=>t.source==e.source));return n instanceof bd&&("string"==typeof i?t.dispatch(Object.assign(Object.assign({},function(t,e,i,n){let{main:s}=t.selection,r=i-s.from,o=n-s.from;return Object.assign(Object.assign({},t.changeByRange((a=>a!=s&&i!=n&&t.sliceDoc(a.from+r,a.from+o)!=t.sliceDoc(i,n)?{range:a}:{changes:{from:a.from+r,to:n==s.from?a.to:a.from+o,insert:e},range:A.cursor(a.from+r+e.length)}))),{userEvent:"input.complete"})}(t.state,i,n.from,n.to)),{annotations:Nu.of(e.completion)})):i(t,e.completion,n.from,n.to),!0)}function ld(t,e,i){if(t<=i)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let t=Math.floor(e/i);return{from:t*i,to:(t+1)*i}}let n=Math.floor((t-e)/i);return{from:t-(n+1)*i,to:t-n*i}}class hd{constructor(t,e){this.view=t,this.stateField=e,this.info=null,this.placeInfoReq={read:()=>this.measureInfo(),write:t=>this.placeInfo(t),key:this},this.space=null,this.currentClass="";let i=t.state.field(e),{options:n,selected:s}=i.open,r=t.state.facet(td);this.optionContent=function(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(t){let e=document.createElement("div");return e.classList.add("cm-completionIcon"),t.type&&e.classList.add(...t.type.split(/\s+/g).map((t=>"cm-completionIcon-"+t))),e.setAttribute("aria-hidden","true"),e},position:20}),e.push({render(t,e,i){let n=document.createElement("span");n.className="cm-completionLabel";let{label:s}=t,r=0;for(let t=1;tr&&n.appendChild(document.createTextNode(s.slice(r,e)));let a=n.appendChild(document.createElement("span"));a.appendChild(document.createTextNode(s.slice(e,o))),a.className="cm-completionMatchedText",r=o}return rt.position-e.position)).map((t=>t.render))}(r),this.optionClass=r.optionClass,this.tooltipClass=r.tooltipClass,this.range=ld(n.length,s,r.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",(e=>{for(let i,s=e.target;s&&s!=this.dom;s=s.parentNode)if("LI"==s.nodeName&&(i=/-(\d+)$/.exec(s.id))&&+i[1]{let i=t.state.field(this.stateField,!1);i&&i.tooltip&&t.state.facet(td).closeOnBlur&&e.relatedTarget!=t.contentDOM&&t.dispatch({effects:Ju.of(null)})})),this.list=this.dom.appendChild(this.createListBox(n,i.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))}mount(){this.updateSel()}update(t){var e,i,n;let s=t.state.field(this.stateField),r=t.startState.field(this.stateField);this.updateTooltipClass(t.state),s!=r&&(this.updateSel(),(null===(e=s.open)||void 0===e?void 0:e.disabled)!=(null===(i=r.open)||void 0===i?void 0:i.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!(null===(n=s.open)||void 0===n?void 0:n.disabled)))}updateTooltipClass(t){let e=this.tooltipClass(t);if(e!=this.currentClass){for(let t of this.currentClass.split(" "))t&&this.dom.classList.remove(t);for(let t of e.split(" "))t&&this.dom.classList.add(t);this.currentClass=e}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),e=t.open;if((e.selected>-1&&e.selected=this.range.to)&&(this.range=ld(e.options.length,e.selected,this.view.state.facet(td).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e.options,t.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))),this.updateSelectedOption(e.selected)){this.info&&(this.info.remove(),this.info=null);let{completion:i}=e.options[e.selected],{info:n,label:s,c:r}=i;if(!n)return;let o="string"==typeof n?document.createTextNode(n+" "):n(i);if(!o)return;if(!r){const t=document.createElement("span");t.appendChild(o),o=t;const e=document.createElement("a");e.innerText="🔎",e.href="/docFind/"+s,e.target="blank",o.appendChild(e)}if(!o)return;"then"in o?o.then((e=>{e&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(e)})).catch((t=>Qi(this.view.state,t,"completion info"))):this.addInfoPane(o)}}addInfoPane(t){let e=this.info=document.createElement("div");e.className="cm-tooltip cm-completionInfo",e.appendChild(t),this.dom.appendChild(e),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let e=null;for(let i=this.list.firstChild,n=this.range.from;i;i=i.nextSibling,n++)"LI"==i.nodeName&&i.id?n==t?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),e=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected"):n--;return e&&function(t,e){let i=t.getBoundingClientRect(),n=e.getBoundingClientRect();n.topi.bottom&&(t.scrollTop+=n.bottom-i.bottom)}(this.list,e),e}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let e=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),n=t.getBoundingClientRect(),s=this.space;if(!s){let t=this.dom.ownerDocument.defaultView||window;s={left:0,top:0,right:t.innerWidth,bottom:t.innerHeight}}return n.top>Math.min(s.bottom,e.bottom)-10||n.bottomi.from||0==i.from))if(s=t,"string"!=typeof l&&l.header)n.appendChild(l.header(l));else{n.appendChild(document.createElement("completion-section")).textContent=t}}const h=n.appendChild(document.createElement("li"));h.id=e+"-"+r,h.setAttribute("role","option");let c=this.optionClass(o);c&&(h.className=c);for(let t of this.optionContent){let e=t(o,this.view.state,a);e&&h.appendChild(e)}}return i.from&&n.classList.add("cm-completionListIncompleteTop"),i.to=this.options.length?this:new ud(this.options,pd(e,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,e,i,n,s){let r=function(t,e){let i=[],n=null,s=t=>{i.push(t);let{section:e}=t.completion;if(e){n||(n=[]);let t="string"==typeof e?e:e.name;n.some((e=>e.name==t))||n.push("string"==typeof e?{name:t}:e)}};for(let n of t)if(n.hasResult())if(!1===n.result.filter){let t=n.result.getMatch;for(let e of n.result.options){let r=[1e9-i.length];if(t)for(let i of t(e))r.push(i);s(new Iu(e,n.source,r,r[0]))}}else{let t,i=new Ku(e.sliceDoc(n.from,n.to));for(let e of n.result.options)(t=i.match(e.label))&&s(new Iu(e,n.source,t,t[0]+(e.boost||0)))}if(n){let t=Object.create(null),e=0,s=(t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:1e9)-(null!==(n=e.rank)&&void 0!==n?n:1e9)||(t.namee.score-t.score||a(t.completion,e.completion))))!o||o.label!=t.completion.label||o.detail!=t.completion.detail||null!=o.type&&null!=t.completion.type&&o.type!=t.completion.type||o.apply!=t.completion.apply?r.push(t):cd(t.completion)>cd(o)&&(r[r.length-1]=t),o=t.completion;return r}(t,e);if(!r.length)return n&&t.some((t=>1==t.state))?new ud(n.options,n.attrs,n.tooltip,n.timestamp,n.selected,!0):null;let o=e.facet(td).selectOnOpen?0:-1;if(n&&n.selected!=o&&-1!=n.selected){let t=n.options[n.selected].completion;for(let e=0;ee.hasResult()?Math.min(t,e.from):t),1e8),create:(a=yd,t=>new hd(t,a)),above:s.aboveCursor},n?n.timestamp:Date.now(),o,!1);var a}map(t){return new ud(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class dd{constructor(t,e,i){this.active=t,this.id=e,this.open=i}static start(){return new dd(Od,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(t){let{state:e}=t,i=e.facet(td),n=(i.override||e.languageDataAt("autocomplete",Bu(e)).map(Fu)).map((e=>(this.active.find((t=>t.source==e))||new md(e,this.active.some((t=>0!=t.state))?1:0)).update(t,i)));n.length==this.active.length&&n.every(((t,e)=>t==this.active[e]))&&(n=this.active);let s=this.open;s&&t.docChanged&&(s=s.map(t.changes)),t.selection||n.some((e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to)))||!function(t,e){if(t==e)return!0;for(let i=0,n=0;;){for(;i1==t.state))&&(s=null),!s&&n.every((t=>1!=t.state))&&n.some((t=>t.hasResult()))&&(n=n.map((t=>t.hasResult()?new md(t.source,0):t)));for(let e of t.effects)e.is(vd)&&(s=s&&s.setSelected(e.value,this.id));return n==this.active&&s==this.open?this:new dd(n,this.id,s)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:fd}}const fd={"aria-autocomplete":"list"};function pd(t,e){let i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(i["aria-activedescendant"]=t+"-"+e),i}const Od=[];function gd(t){return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null}class md{constructor(t,e,i=-1){this.source=t,this.state=e,this.explicitPos=i}hasResult(){return!1}update(t,e){let i=gd(t),n=this;i?n=n.handleUserEvent(t,i,e):t.docChanged?n=n.handleChange(t):t.selection&&0!=n.state&&(n=new md(n.source,0));for(let e of t.effects)if(e.is(Hu))n=new md(n.source,1,e.value?Bu(t.state):-1);else if(e.is(Ju))n=new md(n.source,0);else if(e.is(wd))for(let t of e.value)t.source==n.source&&(n=t);return n}handleUserEvent(t,e,i){return"delete"!=e&&i.activateOnTyping?new md(this.source,1):this.map(t.changes)}handleChange(t){return t.changes.touchesRange(Bu(t.startState))?new md(this.source,0):this.map(t.changes)}map(t){return t.empty||this.explicitPos<0?this:new md(this.source,this.state,t.mapPos(this.explicitPos))}}class bd extends md{constructor(t,e,i,n,s){super(t,2,e),this.result=i,this.from=n,this.to=s}hasResult(){return!0}handleUserEvent(t,e,i){var n;let s=t.changes.mapPos(this.from),r=t.changes.mapPos(this.to,1),o=Bu(t.state);if((this.explicitPos<0?o<=s:or||"delete"==e&&Bu(t.startState)==this.from)return new md(this.source,"input"==e&&i.activateOnTyping?1:0);let a,l=this.explicitPos<0?-1:t.changes.mapPos(this.explicitPos);return function(t,e,i,n){if(!t)return!1;let s=e.sliceDoc(i,n);return"function"==typeof t?t(s,i,n,e):ju(t,!0).test(s)}(this.result.validFor,t.state,s,r)?new bd(this.source,l,this.result,s,r):this.result.update&&(a=this.result.update(this.result,s,r,new qu(t.state,o,l>=0)))?new bd(this.source,l,a,a.from,null!==(n=a.to)&&void 0!==n?n:Bu(t.state)):new md(this.source,1,l)}handleChange(t){return t.changes.touchesRange(this.from,this.to)?new md(this.source,0):this.map(t.changes)}map(t){return t.empty?this:new bd(this.source,this.explicitPos<0?-1:t.mapPos(this.explicitPos),this.result,t.mapPos(this.from),t.mapPos(this.to,1))}}const wd=ut.define({map:(t,e)=>t.map((t=>t.map(e)))}),vd=ut.define(),yd=q.define({create:()=>dd.start(),update:(t,e)=>t.update(e),provide:t=>[Tr.from(t,(t=>t.tooltip)),Ts.contentAttributes.from(t,(t=>t.attrs))]}),Sd=Ts.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class xd{constructor(t,e,i,n){this.field=t,this.line=e,this.from=i,this.to=n}}class kd{constructor(t,e,i){this.field=t,this.from=e,this.to=i}map(t){let e=t.mapPos(this.from,-1,S.TrackDel),i=t.mapPos(this.to,1,S.TrackDel);return null==e||null==i?null:new kd(this.field,e,i)}}class Qd{constructor(t,e){this.lines=t,this.fieldPositions=e}instantiate(t,e){let i=[],n=[e],s=t.doc.lineAt(e),r=/^\s*/.exec(s.text)[0];for(let s of this.lines){if(i.length){let i=r,o=/^\t*/.exec(s)[0].length;for(let e=0;enew kd(t.field,n[t.line]+t.from,n[t.line]+t.to)));return{text:i,ranges:o}}static parse(t){let e,i=[],n=[],s=[];for(let r of t.split(/\r\n?|\n/)){for(;e=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(r);){let t=e[1]?+e[1]:null,o=e[2]||e[3]||"",a=-1;for(let e=0;e=a&&t.field++}s.push(new xd(a,n.length,e.index,e.index+o.length)),r=r.slice(0,e.index)+o+r.slice(e.index+e[0].length)}for(let t;t=/\\([{}])/.exec(r);){r=r.slice(0,t.index)+t[1]+r.slice(t.index+t[0].length);for(let e of s)e.line==n.length&&e.from>t.index&&(e.from--,e.to--)}n.push(r)}return new Qd(n,s)}}let $d=ni.widget({widget:new class extends ei{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),Pd=ni.mark({class:"cm-snippetField"});class Cd{constructor(t,e){this.ranges=t,this.active=e,this.deco=ni.set(t.map((t=>(t.from==t.to?$d:Pd).range(t.from,t.to))))}map(t){let e=[];for(let i of this.ranges){let n=i.map(t);if(!n)return null;e.push(n)}return new Cd(e,this.active)}selectionInsideField(t){return t.ranges.every((t=>this.ranges.some((e=>e.field==this.active&&e.from<=t.from&&e.to>=t.to))))}}const _d=ut.define({map:(t,e)=>t&&t.map(e)}),Xd=ut.define(),Zd=q.define({create:()=>null,update(t,e){for(let i of e.effects){if(i.is(_d))return i.value;if(i.is(Xd)&&t)return new Cd(t.ranges,i.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>Ts.decorations.from(t,(t=>t?t.deco:ni.none))});function Ad(t,e){return A.create(t.filter((t=>t.field==e)).map((t=>A.range(t.from,t.to))))}function Td(e){let i=Qd.parse(e);return(e,n,s,r)=>{let{text:o,ranges:a}=i.instantiate(e.state,s),l={changes:{from:s,to:r,insert:t.of(o)},scrollIntoView:!0,annotations:n?Nu.of(n):void 0};if(a.length&&(l.selection=Ad(a,0)),a.length>1){let t=new Cd(a,0),i=l.effects=[_d.of(t)];void 0===e.state.field(Zd,!1)&&i.push(ut.appendConfig.of([Zd,Md,Wd,Sd]))}e.dispatch(e.state.update(l))}}function Rd(t){return({state:e,dispatch:i})=>{let n=e.field(Zd,!1);if(!n||t<0&&0==n.active)return!1;let s=n.active+t,r=t>0&&!n.ranges.some((e=>e.field==s+t));return i(e.update({selection:Ad(n.ranges,s),effects:_d.of(r?null:new Cd(n.ranges,s))})),!0}}const Ed=[{key:"Tab",run:Rd(1),shift:Rd(-1)},{key:"Escape",run:({state:t,dispatch:e})=>!!t.field(Zd,!1)&&(e(t.update({effects:_d.of(null)})),!0)}],Vd=E.define({combine:t=>t.length?t[0]:Ed}),Md=N.highest(Ys.compute([Vd],(t=>t.facet(Vd))));function Dd(t,e){return Object.assign(Object.assign({},e),{apply:Td(t)})}const Wd=Ts.domEventHandlers({mousedown(t,e){let i,n=e.state.field(Zd,!1);if(!n||null==(i=e.posAtCoords({x:t.clientX,y:t.clientY})))return!1;let s=n.ranges.find((t=>t.from<=i&&t.to>=i));return!(!s||s.field==n.active)&&(e.dispatch({selection:Ad(n.ranges,s.field),effects:_d.of(n.ranges.some((t=>t.field>s.field))?new Cd(n.ranges,s.field):null)}),!0)}}),Ud=new class extends Qt{};function Yd(t={}){return[yd,td.of(t),od,Ld,Sd]}Ud.startSide=1,Ud.endSide=-1;const qd=[{key:"Ctrl-Space",run:t=>!!t.state.field(yd,!1)&&(t.dispatch({effects:Hu.of(!0)}),!0)},{key:"Escape",run:t=>{let e=t.state.field(yd,!1);return!(!e||!e.active.some((t=>0!=t.state)))&&(t.dispatch({effects:Ju.of(null)}),!0)}},{key:"ArrowDown",run:nd(!0)},{key:"ArrowUp",run:nd(!1)},{key:"PageDown",run:nd(!0,"page")},{key:"PageUp",run:nd(!1,"page")},{key:"Enter",run:sd}],Ld=N.highest(Ys.computeN([td],(t=>t.facet(td).defaultKeymap?[qd]:[]))),zd=(()=>[vr(),Sh(),ir(),$l(_l,{fallback:!0}),Ys.of([...Vc,...Wh])])();class Id{constructor(t,e,i,n,s,r,o,a,l,h=0,c){this.p=t,this.stack=e,this.state=i,this.reducePos=n,this.pos=s,this.score=r,this.buffer=o,this.bufferBase=a,this.curContext=l,this.lookAhead=h,this.parent=c}toString(){return`[${this.stack.filter(((t,e)=>e%3==0)).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,i=0){let n=t.parser.context;return new Id(t,[],e,i,i,0,[],0,n?new Bd(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let i=t>>19,n=65535&t,{parser:s}=this.p,r=s.dynamicPrecedence(n);if(r&&(this.score+=r),0==i)return this.pushState(s.getGoto(this.state,n,!0),this.reducePos),n=2e3&&!(null===(e=this.p.parser.nodeSet.types[n])||void 0===e?void 0:e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=l):this.p.lastBigReductionSizeo;)this.stack.pop();this.reduceContext(n,a)}storeNode(t,e,i,n=4,s=!1){if(0==t&&(!this.stack.length||this.stack[this.stack.length-1]0&&0==t.buffer[n-4]&&t.buffer[n-1]>-1){if(e==i)return;if(t.buffer[n-2]>=e)return void(t.buffer[n-2]=i)}}if(s&&this.pos!=i){let s=this.buffer.length;if(s>0&&0!=this.buffer[s-4])for(;s>0&&this.buffer[s-2]>i;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,n>4&&(n-=4);this.buffer[s]=t,this.buffer[s+1]=e,this.buffer[s+2]=i,this.buffer[s+3]=n}else this.buffer.push(t,e,i,n)}shift(t,e,i){let n=this.pos;if(131072&t)this.pushState(65535&t,this.pos);else if(0==(262144&t)){let s=t,{parser:r}=this.p;(i>this.pos||e<=r.maxNode)&&(this.pos=i,r.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,n),this.shiftContext(e,n),e<=r.maxNode&&this.buffer.push(e,n,i,4)}else this.pos=i,this.shiftContext(e,n),e<=this.p.parser.maxNode&&this.buffer.push(e,n,i,4)}apply(t,e,i){65536&t?this.reduce(t):this.shift(t,e,i)}useNode(t,e){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=t)&&(this.p.reused.push(t),i++);let n=this.pos;this.reducePos=this.pos=n+t.length,this.pushState(e,n),this.buffer.push(i,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let i=t.buffer.slice(e),n=t.bufferBase+e;for(;t&&n==t.bufferBase;)t=t.parent;return new Id(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,n,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let i=t<=this.p.parser.maxNode;i&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,i?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new Nd(this);;){let i=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(0==i)return!1;if(0==(65536&i))return!0;e.reduce(i)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let n,s=0;s1&e&&t==n))||i.push(e[t],n)}e=i}let i=[];for(let t=0;t>19,n=65535&t,s=this.stack.length-3*i;if(s<0||e.getGoto(this.stack[s],n,!1)<0)return!1;this.storeNode(0,this.reducePos,this.reducePos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:t}=this.p;return 65535==t.data[t.stateSlot(this.state,1)]&&!t.stateSlot(this.state,4)}restart(){this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;ethis.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Bd{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}var jd;!function(t){t[t.Insert=200]="Insert",t[t.Delete=190]="Delete",t[t.Reduce=100]="Reduce",t[t.MaxNext=4]="MaxNext",t[t.MaxInsertStackDepth=300]="MaxInsertStackDepth",t[t.DampenInsertStackDepth=120]="DampenInsertStackDepth",t[t.MinBigReduction=2e3]="MinBigReduction"}(jd||(jd={}));class Nd{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=65535&t,i=t>>19;0==i?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(i-1);let n=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=n}}class Gd{constructor(t,e,i){this.stack=t,this.pos=e,this.index=i,this.buffer=t.buffer,0==this.index&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new Gd(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;null!=t&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new Gd(this.stack,this.pos,this.index)}}function Fd(t,e=Uint16Array){if("string"!=typeof t)return t;let i=null;for(let n=0,s=0;n=92&&e--,e>=34&&e--;let s=e-32;if(s>=46&&(s-=46,i=!0),r+=s,i)break;r*=46}i?i[s++]=r:i=new e(r)}return i}class Hd{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Jd=new Hd;class Kd{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Jd,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let i=this.range,n=this.rangeIndex,s=this.pos+t;for(;si.to:s>=i.to;){if(n==this.ranges.length-1)return null;let t=this.ranges[++n];s+=t.from-i.to,i=t}return s}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,e.from);return this.end}peek(t){let e,i,n=this.chunkOff+t;if(n>=0&&n=this.chunk2Pos&&en.to&&(this.chunk2=this.chunk2.slice(0,n.to-e)),i=this.chunk2.charCodeAt(0)}}return e>=this.token.lookAhead&&(this.token.lookAhead=e+1),i}acceptToken(t,e=0){let i=e?this.resolveOffset(e,-1):this.pos;if(null==i||i=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=Jd,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let i="";for(let n of this.ranges){if(n.from>=e)break;n.to>t&&(i+=this.input.read(Math.max(n.from,t),Math.min(n.to,e)))}return i}}class tf{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:i}=e.p;sf(this.data,t,e,this.id,i.data,i.tokenPrecTable)}}tf.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class ef{constructor(t,e,i){this.precTable=e,this.elseToken=i,this.data="string"==typeof t?Fd(t):t}token(t,e){let i=t.pos,n=0;for(;sf(this.data,t,e,0,this.data,this.precTable),!(t.token.value>-1);){if(null==this.elseToken)return;if(t.next<0)break;t.advance(),t.reset(t.pos,t.token),n++}n&&(t.reset(i,t.token),t.acceptToken(this.elseToken,n))}}ef.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class nf{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function sf(t,e,i,n,s,r){let o=0,a=1<0){let i=t[n];if(l.allows(i)&&(-1==e.token.value||e.token.value==i||of(i,e.token.value,s,r))){e.acceptToken(i);break}}let n=e.next,h=0,c=t[o+2];if(!(e.next<0&&c>h&&65535==t[i+3*c-3]&&65535==t[i+3*c-3])){for(;h>1,r=i+s+(s<<1),a=t[r],l=t[r+1]||65536;if(n=l)){o=t[r+2],e.advance();continue t}h=s+1}}break}o=t[i+3*c-1]}}function rf(t,e,i){for(let n,s=e;65535!=(n=t[s]);s++)if(n==i)return s-e;return-1}function of(t,e,i,n){let s=rf(i,n,e);return s<0||rf(i,n,t)e)&&!n.type.isError)return i<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(t.length,Math.max(n.from+1,e+25));if(i<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return i<0?0:t.length}}!function(t){t[t.Margin=25]="Margin"}(hf||(hf={}));let uf=class{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?cf(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?cf(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=r,null;if(s instanceof bo){if(r==t){if(r=Math.max(this.safeFrom,t)&&(this.trees.push(s),this.start.push(r),this.index.push(0))}else this.index[e]++,this.nextStart=r+s.length}}};class df{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map((t=>new Hd))}getActions(t){let e=0,i=null,{parser:n}=t.p,{tokenizers:s}=n,r=n.stateSlot(t.state,3),o=t.curContext?t.curContext.hash:0,a=0;for(let n=0;nh.end+25&&(a=Math.max(h.lookAhead,a)),0!=h.value)){let n=e;if(h.extended>-1&&(e=this.addActions(t,h.extended,h.end,e)),e=this.addActions(t,h.value,h.end,e),!l.extend&&(i=h,e>n))break}}for(;this.actions.length>e;)this.actions.pop();return a&&t.setLookAhead(a),i||t.pos!=this.stream.end||(i=new Hd,i.value=t.p.parser.eofTerm,i.start=i.end=t.pos,e=this.addActions(t,i.value,i.end,e)),this.mainToken=i,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new Hd,{pos:i,p:n}=t;return e.start=i,e.end=Math.min(i+1,n.stream.end),e.value=i==n.stream.end?n.parser.eofTerm:0,e}updateCachedToken(t,e,i){let n=this.stream.clipPos(i.pos);if(e.token(this.stream.reset(n,t),i),t.value>-1){let{parser:e}=i.p;for(let n=0;n=0&&i.p.parser.dialect.allows(s>>1)){0==(1&s)?t.value=s>>1:t.extended=s>>1;break}}}else t.value=0,t.end=this.stream.clipPos(n+1)}putAction(t,e,i,n){for(let e=0;e4*t.bufferLength?new uf(i,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t,e,i=this.stacks,n=this.minStackPos,s=this.stacks=[];if(this.bigReductionCount>300&&1==i.length){let[t]=i;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;rn)s.push(o);else{if(this.advanceStack(o,s,i))continue;{t||(t=[],e=[]),t.push(o);let i=this.tokens.getMainToken(o);e.push(i.value,i.end)}}break}}if(!s.length){let e=t&&function(t){let e=null;for(let i of t){let t=i.p.stoppedAt;(i.pos==i.p.stream.end||null!=t&&i.pos>t)&&i.p.parser.stateFlag(i.state,2)&&(!e||e.scorethis.stoppedAt?t[0]:this.runRecovery(t,e,s);if(i)return this.stackToTree(i.forceAll())}if(this.recovering){let t=1==this.recovering?1:3*this.recovering;if(s.length>t)for(s.sort(((t,e)=>e.score-t.score));s.length>t;)s.pop();s.some((t=>t.reducePos>n))&&this.recovering--}else if(s.length>1){t:for(let t=0;t500&&n.buffer.length>500){if(!((e.score-n.score||e.buffer.length-n.buffer.length)>0)){s.splice(t--,1);continue t}s.splice(i--,1)}}}s.length>12&&s.splice(12,s.length-12)}this.minStackPos=s[0].pos;for(let t=1;t ":"";if(null!=this.stoppedAt&&n>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let e=t.curContext&&t.curContext.tracker.strict,i=e?t.curContext.hash:0;for(let o=this.fragments.nodeAt(n);o;){let n=this.parser.nodeSet.types[o.type.id]==o.type?s.getGoto(t.state,o.type.id):-1;if(n>-1&&o.length&&(!e||(o.prop(ho.contextHash)||0)==i))return t.useNode(o,n),af&&console.log(r+this.stackID(t)+` (via reuse of ${s.getName(o.type.id)})`),!0;if(!(o instanceof bo)||0==o.children.length||o.positions[0]>0)break;let a=o.children[0];if(!(a instanceof bo&&0==o.positions[0]))break;o=a}}let o=s.stateSlot(t.state,4);if(o>0)return t.reduce(o),af&&console.log(r+this.stackID(t)+` (via always-reduce ${s.getName(65535&o)})`),!0;if(t.stack.length>=15e3)for(;t.stack.length>9e3&&t.forceReduce(););let a=this.tokens.getActions(t);for(let o=0;on?e.push(d):i.push(d)}return!1}advanceFully(t,e){let i=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>i)return Of(t,e),!0}}runRecovery(t,e,i){let n=null,s=!1;for(let r=0;r ":"";if(o.deadEnd){if(s)continue;if(s=!0,o.restart(),af&&console.log(h+this.stackID(o)+" (restarted)"),this.advanceFully(o,i))continue}let c=o.split(),u=h;for(let t=0;c.forceReduce()&&t<10;t++){if(af&&console.log(u+this.stackID(c)+" (via force-reduce)"),this.advanceFully(c,i))break;af&&(u=this.stackID(c)+" -> ")}for(let t of o.recoverByInsert(a))af&&console.log(h+this.stackID(t)+" (via recover-insert)"),this.advanceFully(t,i);this.stream.end>o.pos?(l==o.pos&&(l++,a=0),o.recoverByDelete(a,l),af&&console.log(h+this.stackID(o)+` (via recover-delete ${this.parser.getName(a)})`),Of(o,i)):(!n||n.scoret;class bf{constructor(t){this.start=t.start,this.shift=t.shift||mf,this.reduce=t.reduce||mf,this.reuse=t.reuse||mf,this.hash=t.hash||(()=>0),this.strict=!1!==t.strict}}class wf extends Vo{constructor(t){if(super(),this.wrappers=[],14!=t.version)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let i=0;it.topRules[e][1])),n=[];for(let t=0;t=0)s(n,t,e[i++]);else{let r=e[i+-n];for(let o=-n;o>0;o--)s(e[i++],t,r);i++}}}this.nodeSet=new po(e.map(((e,s)=>fo.define({name:s>=this.minRepeatTerm?void 0:e,id:s,props:n[s],top:i.indexOf(s)>-1,error:0==s,skipped:t.skippedNodes&&t.skippedNodes.indexOf(s)>-1})))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=oo;let r=Fd(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let t=0;t"number"==typeof t?new tf(r,t):t)),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,i){let n=new pf(this,t,e,i);for(let s of this.wrappers)n=s(n,t,e,i);return n}getGoto(t,e,i=!1){let n=this.goto;if(e>=n[0])return-1;for(let s=n[e+1];;){let e=n[s++],r=1&e,o=n[s++];if(r&&i)return o;for(let i=s+(e>>1);s0}validAction(t,e){if(e==this.stateSlot(t,4))return!0;for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])return!1;i=vf(this.data,i+2)}if(e==vf(this.data,i+1))return!0}}nextStates(t){let e=[];for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])break;i=vf(this.data,i+2)}if(0==(1&this.data[i+2])){let t=this.data[i+1];e.some(((e,i)=>1&i&&e==t))||e.push(this.data[i],t)}}return e}configure(t){let e=Object.assign(Object.create(wf.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let i=this.topRules[t.top];if(!i)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=i}return t.tokenizers&&(e.tokenizers=this.tokenizers.map((e=>{let i=t.tokenizers.find((t=>t.from==e));return i?i.to:e}))),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map(((i,n)=>{let s=t.specializers.find((t=>t.from==i.external));if(!s)return i;let r=Object.assign(Object.assign({},i),{external:s.to});return e.specializers[n]=yf(r),r}))),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),null!=t.strict&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),null!=t.bufferLength&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return null==e?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),i=e.map((()=>!1));if(t)for(let n of t.split(" ")){let t=e.indexOf(n);t>=0&&(i[t]=!0)}let n=null;for(let t=0;tt.external(i,n)<<1|e}return t.get}const Sf=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],xf=new bf({start:!1,shift:(t,e)=>3==e||4==e||305==e?t:306==e,strict:!1}),kf=new nf(((t,e)=>{let{next:i}=t;(125==i||-1==i||e.context)&&e.canShift(303)&&t.acceptToken(303)}),{contextual:!0,fallback:!0}),Qf=new nf(((t,e)=>{let i,{next:n}=t;Sf.indexOf(n)>-1||(47!=n||47!=(i=t.peek(1))&&42!=i)&&125!=n&&59!=n&&-1!=n&&!e.context&&e.canShift(302)&&t.acceptToken(302)}),{contextual:!0}),$f=new nf(((t,e)=>{let{next:i}=t;if((43==i||45==i)&&(t.advance(),i==t.next)){t.advance();let i=!e.context&&e.canShift(1);t.acceptToken(i?1:2)}}),{contextual:!0}),Pf=ea({"get set async static":Sa.modifier,"for while do if else switch try catch finally return throw break continue default case":Sa.controlKeyword,"in of await yield void typeof delete instanceof":Sa.operatorKeyword,"let var const function class extends":Sa.definitionKeyword,"import export from":Sa.moduleKeyword,"with debugger as new":Sa.keyword,TemplateString:Sa.special(Sa.string),super:Sa.atom,BooleanLiteral:Sa.bool,this:Sa.self,null:Sa.null,Star:Sa.modifier,VariableName:Sa.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":Sa.function(Sa.variableName),VariableDefinition:Sa.definition(Sa.variableName),Label:Sa.labelName,PropertyName:Sa.propertyName,PrivatePropertyName:Sa.special(Sa.propertyName),"CallExpression/MemberExpression/PropertyName":Sa.function(Sa.propertyName),"FunctionDeclaration/VariableDefinition":Sa.function(Sa.definition(Sa.variableName)),"ClassDeclaration/VariableDefinition":Sa.definition(Sa.className),PropertyDefinition:Sa.definition(Sa.propertyName),PrivatePropertyDefinition:Sa.definition(Sa.special(Sa.propertyName)),UpdateOp:Sa.updateOperator,LineComment:Sa.lineComment,BlockComment:Sa.blockComment,Number:Sa.number,String:Sa.string,Escape:Sa.escape,ArithOp:Sa.arithmeticOperator,LogicOp:Sa.logicOperator,BitOp:Sa.bitwiseOperator,CompareOp:Sa.compareOperator,RegExp:Sa.regexp,Equals:Sa.definitionOperator,Arrow:Sa.function(Sa.punctuation),": Spread":Sa.punctuation,"( )":Sa.paren,"[ ]":Sa.squareBracket,"{ }":Sa.brace,"InterpolationStart InterpolationEnd":Sa.special(Sa.brace),".":Sa.derefOperator,", ;":Sa.separator,"@":Sa.meta,TypeName:Sa.typeName,TypeDefinition:Sa.definition(Sa.typeName),"type enum interface implements namespace module declare":Sa.definitionKeyword,"abstract global Privacy readonly override":Sa.modifier,"is keyof unique infer":Sa.operatorKeyword,JSXAttributeValue:Sa.attributeValue,JSXText:Sa.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":Sa.angleBracket,"JSXIdentifier JSXNameSpacedName":Sa.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":Sa.attributeName,"JSXBuiltin/JSXIdentifier":Sa.standard(Sa.tagName)}),Cf={__proto__:null,export:14,as:19,from:27,default:30,async:35,function:36,extends:46,this:50,true:58,false:58,null:70,void:74,typeof:78,super:96,new:130,delete:146,yield:155,await:159,class:164,public:221,private:221,protected:221,readonly:223,instanceof:242,satisfies:245,in:246,const:248,import:280,keyof:335,unique:339,infer:345,is:381,abstract:401,implements:403,type:405,let:408,var:410,interface:417,enum:421,namespace:427,module:429,declare:433,global:437,for:456,of:465,while:468,with:472,do:476,if:480,else:482,switch:486,case:492,try:498,catch:502,finally:506,return:510,throw:514,break:518,continue:522,debugger:526},_f={__proto__:null,async:117,get:119,set:121,declare:181,public:183,private:183,protected:183,static:185,abstract:187,override:189,readonly:195,accessor:197,new:385},Xf={__proto__:null,"<":137},Zf=wf.deserialize({version:14,states:"$6[O`QUOOO%QQUOOO'TQWOOP(bOSOOO*pQ(CjO'#CfO*wOpO'#CgO+VO!bO'#CgO+eO07`O'#DZO-vQUO'#DaO.WQUO'#DlO%QQUO'#DvO0[QUO'#EOOOQ(CY'#EW'#EWO0uQSO'#ETOOQO'#Ei'#EiOOQO'#Ib'#IbO0}QSO'#GkO1YQSO'#EhO1_QSO'#EhO3aQ(CjO'#JcO6QQ(CjO'#JdO6nQSO'#FWO6sQ#tO'#FoOOQ(CY'#F`'#F`O7OO&jO'#F`O7^Q,UO'#FvO8tQSO'#FuOOQ(CY'#Jd'#JdOOQ(CW'#Jc'#JcOOQQ'#KO'#KOO8yQSO'#IOO9OQ(C[O'#IPOOQQ'#JP'#JPOOQQ'#IT'#ITQ`QUOOO%QQUO'#DnO9WQUO'#DzO%QQUO'#D|O9_QSO'#GkO9dQ,UO'#ClO9rQSO'#EgO9}QSO'#ErO:SQ,UO'#F_O:qQSO'#GkO:vQSO'#GoO;RQSO'#GoO;aQSO'#GrO;aQSO'#GsO;aQSO'#GuO9_QSO'#GxOQQSO'#HnO>VQ(C]O'#HtO%QQUO'#Hv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xQ2{9yQ2|9zQ2}9{Q3O9|Q3P9}Q3Q:OQ3R:PQ3S.dQ3V:UQ3W:_Q3]:QQ4O/zQ4V0XQ5i:`Q5o2WQ5t2^Q6Q2rQ6R:aQ6W:cQ6X:jQ7P4kQ7n5gQ7r5pQ7{:kQ8P:pQ8Q:qQ8v7tQ9U8cQ9]8tQ9n#OR;Q;^R#WWR&{!cY!qQ'Q,}0u4pS&w!c,uQ']!oS'g!r!uS'i!v4rS,r&x'PS-^'^'_Q-`'`Q1{,{R2Z-_R(k#tR(n#uQ!dQT,|'Q,}]!nQ!o'Q,}0u4pQ#l]R'Z9mT#gZ%ZS#fZ%ZU%y|},ZU(W#d#e#hS-r(X(YQ-v(ZQ0h+hQ2`-sU2a-t-u-wS5v2b2cR7u5w`#YW#S#V%v't'}+e-mt#cZ|}#d#e#h%Z(X(Y(Z+h-s-t-u-w2b2c5wQ1_,ZQ1r,oQ5e1jQ7m5fT:x&y+fT#]W%vS#[W%vS'u#S'}S'z#V+eS,t&y+fT-h't-mT'O!c%wQ$hfR)j$mT)_$h)`R3Z.kT*O$u*QR*W$xQ/}*zQ2e.OQ4s0wQ5{2iQ7X4vQ7x5zQ8e7WQ8w7wQ9W8gQ9`8yQ9e9XR9h9alpOXr!X#`%]&d&f&g&i,],b1b1eQ&^!TR,Q&ZV%z|},ZR0q+qR,P&XQ%szR+c%tR+X%nT&b!U&eT&c!U&eT1d,b1e",nodeNames:"⚠ ArithOp ArithOp LineComment BlockComment Script ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXStartTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:364,context:xf,nodeProps:[["group",-26,6,14,16,62,199,203,206,207,209,212,215,225,227,233,235,237,239,242,248,254,256,258,260,262,264,265,"Statement",-32,10,11,25,28,29,35,45,48,49,51,56,64,72,76,78,80,81,103,104,113,114,131,134,136,137,138,139,141,142,162,163,165,"Expression",-23,24,26,30,34,36,38,166,168,170,171,173,174,175,177,178,179,181,182,183,193,195,197,198,"Type",-3,84,96,102,"ClassItem"],["openedBy",31,"InterpolationStart",50,"[",54,"{",69,"(",143,"JSXStartTag",155,"JSXStartTag JSXStartCloseTag"],["closedBy",33,"InterpolationEnd",44,"]",55,"}",70,")",144,"JSXSelfCloseEndTag JSXEndTag",160,"JSXEndTag"]],propSources:[Pf],skippedNodes:[0,3,4,268],repeatNodeCount:33,tokenData:"$>y(CSR!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tu>PuvBavwDxwxGgxyMvyz! Qz{!![{|!%O|}!&]}!O!%O!O!P!'g!P!Q!1w!Q!R#0t!R![#3T![!]#@T!]!^#Aa!^!_#Bk!_!`#GS!`!a#In!a!b#N{!b!c$$z!c!}>P!}#O$&U#O#P$'`#P#Q$,w#Q#R$.R#R#S>P#S#T$/`#T#o$0j#o#p$4z#p#q$5p#q#r$7Q#r#s$8^#s$f%Z$f$g+g$g#BY>P#BY#BZ$9h#BZ$IS>P$IS$I_$9h$I_$I|>P$I|$I}$P$JT$JU$9h$JU$KV>P$KV$KW$9h$KW&FU>P&FU&FV$9h&FV;'S>P;'S;=`BZ<%l?HT>P?HT?HU$9h?HUO>P(n%d_$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$d&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$d&j'z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU'z!bOY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izers:[Qf,$f,2,3,4,5,6,7,8,9,10,11,12,13,kf,new ef("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOq~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!O~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(T~~",141,326),new ef("j~RQYZXz{^~^O'q~~aP!P!Qd~iO'r~~",25,308)],topRules:{Script:[0,5],SingleExpression:[1,266],SingleClassItem:[2,267]},dialects:{jsx:12686,ts:12688},dynamicPrecedences:{76:1,78:1,163:1,191:1},specialized:[{term:312,get:t=>Cf[t]||-1},{term:328,get:t=>_f[t]||-1},{term:67,get:t=>Xf[t]||-1}],tokenPrec:12712}),Af=[Dd("function ${name}(${params}) {\n\t${}\n}",{label:"function",detail:"definition",type:"keyword"}),Dd("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n\t${}\n}",{label:"for",detail:"loop",type:"keyword"}),Dd("for (let ${name} of ${collection}) {\n\t${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Dd("do {\n\t${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),Dd("while (${}) {\n\t${}\n}",{label:"while",detail:"loop",type:"keyword"}),Dd("try {\n\t${}\n} catch (${error}) {\n\t${}\n}",{label:"try",detail:"/ catch block",type:"keyword"}),Dd("if (${}) {\n\t${}\n}",{label:"if",detail:"block",type:"keyword"}),Dd("if (${}) {\n\t${}\n} else {\n\t${}\n}",{label:"if",detail:"/ else block",type:"keyword"}),Dd("class ${name} {\n\tconstructor(${params}) {\n\t\t${}\n\t}\n}",{label:"class",detail:"definition",type:"keyword"}),Dd('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Dd('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Tf=new Ro,Rf=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Ef(t){return(e,i)=>{let n=e.node.getChild("VariableDefinition");return n&&i(n,t),!0}}const Vf=["FunctionDeclaration"],Mf={FunctionDeclaration:Ef("function"),ClassDeclaration:Ef("class"),ClassExpression:()=>!0,EnumDeclaration:Ef("constant"),TypeAliasDeclaration:Ef("type"),NamespaceDeclaration:Ef("namespace"),VariableDefinition(t,e){t.matchContext(Vf)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function Df(t,e){let i=Tf.get(e);if(i)return i;let n=[],s=!0;function r(e,i){let s=t.sliceString(e.from,e.to);n.push({label:s,type:i})}return e.cursor(mo.IncludeAnonymous).iterate((e=>{if(s)s=!1;else if(e.name){let t=Mf[e.name];if(t&&t(e,r)||Rf.has(e.name))return!1}else if(e.to-e.from>8192){for(let i of Df(t,e.node))n.push(i);return!1}})),Tf.set(e,n),n}const Wf=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Uf=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName"];function Yf(t){let e=Xa(t.state).resolveInner(t.pos,-1);if(Uf.indexOf(e.name)>-1)return null;let i="VariableName"==e.name||e.to-e.from<20&&Wf.test(t.state.sliceDoc(e.from,e.to));if(!i&&!t.explicit)return null;let n=[];for(let i=e;i;i=i.parent)Rf.has(i.name)&&(n=n.concat(Df(t.state.doc,i)));return{options:n,from:i?e.from:t.pos,validFor:Wf}}const qf=_a.define({name:"javascript",parser:Zf.configure({props:[Na.add({IfStatement:il({except:/^\s*({|else\b)/}),TryStatement:il({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:t=>t.baseIndent,SwitchBody:t=>{let e=t.textAfter,i=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return t.baseIndent+(i?0:n?1:2)*t.unit},Block:tl({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":il({except:/^{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag":t=>t.column(t.node.from)+t.unit}),rl.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression":ol,BlockComment:t=>({from:t.from+2,to:t.to-2})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Lf={test:t=>/^JSX/.test(t.name),facet:Qa({commentTokens:{block:{open:"{/*",close:"*/}"}}})},zf=qf.configure({dialect:"ts"},"typescript"),If=qf.configure({dialect:"jsx",props:[$a.add((t=>t.isTop?[Lf]:void 0))]}),Bf=qf.configure({dialect:"jsx ts",props:[$a.add((t=>t.isTop?[Lf]:void 0))]},"typescript"),jf="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map((t=>({label:t,type:"keyword"})));function Nf(t={}){let e=t.jsx?t.typescript?Bf:If:t.typescript?zf:qf;return new Ua(e,[qf.data.of({autocomplete:(i=Uf,n=zu(Af.concat(jf)),t=>{for(let e=Xa(t.state).resolveInner(t.pos,-1);e;e=e.parent){if(i.indexOf(e.name)>-1)return null;if(e.type.isTop)break}return n(t)})}),qf.data.of({autocomplete:Yf}),t.jsx?Hf:[]]);var i,n}function Gf(t,e,i=t.length){for(let n=null==e?void 0:e.firstChild;n;n=n.nextSibling)if("JSXIdentifier"==n.name||"JSXBuiltin"==n.name||"JSXNamespacedName"==n.name||"JSXMemberExpression"==n.name)return t.sliceString(n.from,Math.min(n.to,i));return""}const Ff="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),Hf=Ts.inputHandler.of(((t,e,i,n)=>{if((Ff?t.composing:t.compositionStarted)||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!qf.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((t=>{var e,i;let r,{head:o}=t,a=Xa(s).resolveInner(o,-1);if("JSXStartTag"==a.name&&(a=a.parent),">"==n&&"JSXFragmentTag"==a.name)return{range:A.cursor(o+1),changes:{from:o,insert:">"}};if("/"==n&&"JSXFragmentTag"==a.name){let t=a.parent,i=null==t?void 0:t.parent;if(t.from==o-1&&"JSXEndTag"!=(null===(e=i.lastChild)||void 0===e?void 0:e.name)&&(r=Gf(s.doc,null==i?void 0:i.firstChild,o))){let t=`/${r}>`;return{range:A.cursor(o+t.length),changes:{from:o,insert:t}}}}else if(">"==n){let t=function(t){for(;;){if("JSXOpenTag"==t.name||"JSXSelfClosingTag"==t.name||"JSXFragmentTag"==t.name)return t;if(!t.parent)return null;t=t.parent}}(a);if(t&&"JSXEndTag"!=(null===(i=t.lastChild)||void 0===i?void 0:i.name)&&"`}}}return{range:t}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)}));class Jf{constructor(t,e,i,n,s,r,o){this.type=t,this.value=e,this.from=i,this.hash=n,this.end=s,this.children=r,this.positions=o,this.hashProp=[[ho.contextHash,n]]}static create(t,e,i,n,s){return new Jf(t,e,i,n+(n<<8)+t+(e<<4)|0,s,[],[])}addChild(t,e){t.prop(ho.contextHash)!=this.hash&&(t=new bo(t.type,t.children,t.positions,t.length,this.hashProp)),this.children.push(t),this.positions.push(e)}toTree(t,e=this.end){let i=this.children.length-1;return i>=0&&(e=Math.max(e,this.positions[i]+this.children[i].length+this.from)),new bo(t.types[this.type],this.children,this.positions,e-this.from).balance({makeTree:(t,e,i)=>new bo(fo.none,t,e,i,this.hashProp)})}}var Kf;!function(t){t[t.Document=1]="Document",t[t.CodeBlock=2]="CodeBlock",t[t.FencedCode=3]="FencedCode",t[t.Blockquote=4]="Blockquote",t[t.HorizontalRule=5]="HorizontalRule",t[t.BulletList=6]="BulletList",t[t.OrderedList=7]="OrderedList",t[t.ListItem=8]="ListItem",t[t.ATXHeading1=9]="ATXHeading1",t[t.ATXHeading2=10]="ATXHeading2",t[t.ATXHeading3=11]="ATXHeading3",t[t.ATXHeading4=12]="ATXHeading4",t[t.ATXHeading5=13]="ATXHeading5",t[t.ATXHeading6=14]="ATXHeading6",t[t.SetextHeading1=15]="SetextHeading1",t[t.SetextHeading2=16]="SetextHeading2",t[t.HTMLBlock=17]="HTMLBlock",t[t.LinkReference=18]="LinkReference",t[t.Paragraph=19]="Paragraph",t[t.CommentBlock=20]="CommentBlock",t[t.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",t[t.Escape=22]="Escape",t[t.Entity=23]="Entity",t[t.HardBreak=24]="HardBreak",t[t.Emphasis=25]="Emphasis",t[t.StrongEmphasis=26]="StrongEmphasis",t[t.Link=27]="Link",t[t.Image=28]="Image",t[t.InlineCode=29]="InlineCode",t[t.HTMLTag=30]="HTMLTag",t[t.Comment=31]="Comment",t[t.ProcessingInstruction=32]="ProcessingInstruction",t[t.URL=33]="URL",t[t.HeaderMark=34]="HeaderMark",t[t.QuoteMark=35]="QuoteMark",t[t.ListMark=36]="ListMark",t[t.LinkMark=37]="LinkMark",t[t.EmphasisMark=38]="EmphasisMark",t[t.CodeMark=39]="CodeMark",t[t.CodeText=40]="CodeText",t[t.CodeInfo=41]="CodeInfo",t[t.LinkTitle=42]="LinkTitle",t[t.LinkLabel=43]="LinkLabel"}(Kf||(Kf={}));class tp{constructor(t,e){this.start=t,this.content=e,this.marks=[],this.parsers=[]}}class ep{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let t=this.skipSpace(this.basePos);this.indent=this.countIndent(t,this.pos,this.indent),this.pos=t,this.next=t==this.text.length?-1:this.text.charCodeAt(t)}skipSpace(t){return rp(this.text,t)}reset(t){for(this.text=t,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(t){this.basePos=t,this.baseIndent=this.countIndent(t,this.pos,this.indent)}moveBaseColumn(t){this.baseIndent=t,this.basePos=this.findColumn(t)}addMarker(t){this.markers.push(t)}countIndent(t,e=0,i=0){for(let n=e;n=e.stack[i.depth+1].value+i.baseIndent)return!0;if(i.indent>=i.baseIndent+4)return!1;let n=(t.type==Kf.OrderedList?dp:up)(i,e,!1);return n>0&&(t.type!=Kf.BulletList||hp(i,e,!1)<0)&&i.text.charCodeAt(i.pos+n-1)==t.value}const np={[Kf.Blockquote]:(t,e,i)=>62==i.next&&(i.markers.push(Up(Kf.QuoteMark,e.lineStart+i.pos,e.lineStart+i.pos+1)),i.moveBase(i.pos+(sp(i.text.charCodeAt(i.pos+1))?2:1)),t.end=e.lineStart+i.text.length,!0),[Kf.ListItem]:(t,e,i)=>!(i.indent-1)&&(i.moveBaseColumn(i.baseIndent+t.value),!0),[Kf.OrderedList]:ip,[Kf.BulletList]:ip,[Kf.Document]:()=>!0};function sp(t){return 32==t||9==t||10==t||13==t}function rp(t,e=0){for(;ei&&sp(t.charCodeAt(e-1));)e--;return e}function ap(t){if(96!=t.next&&126!=t.next)return-1;let e=t.pos+1;for(;e-1&&t.depth==e.stack.length||n<3?-1:1}function cp(t,e){for(let i=t.stack.length-1;i>=0;i--)if(t.stack[i].type==e)return!0;return!1}function up(t,e,i){return 45!=t.next&&43!=t.next&&42!=t.next||t.pos!=t.text.length-1&&!sp(t.text.charCodeAt(t.pos+1))||!(!i||cp(e,Kf.BulletList)||t.skipSpace(t.pos+2)=48&&s<=57;){if(n++,n==t.text.length)return-1;s=t.text.charCodeAt(n)}return n==t.pos||n>t.pos+9||46!=s&&41!=s||nt.pos+1||49!=t.next)?-1:n+1-t.pos}function fp(t){if(35!=t.next)return-1;let e=t.pos+1;for(;e6?-1:i}function pp(t){if(45!=t.next&&61!=t.next||t.indent>=t.baseIndent+4)return-1;let e=t.pos+1;for(;e/,mp=/\?>/,bp=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*/i.exec(n);if(r)return t.append(Up(Kf.Comment,i,i+1+r[0].length));let o=/^\?[^]*?\?>/.exec(n);if(o)return t.append(Up(Kf.ProcessingInstruction,i,i+1+o[0].length));let a=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(n);return a?t.append(Up(Kf.HTMLTag,i,i+1+a[0].length)):-1},Emphasis(t,e,i){if(95!=e&&42!=e)return-1;let n=i+1;for(;t.char(n)==e;)n++;let s=t.slice(i-1,i),r=t.slice(n,n+1),o=jp.test(s),a=jp.test(r),l=/\s|^$/.test(s),h=/\s|^$/.test(r),c=!h&&(!a||l||o),u=!l&&(!o||h||a),d=c&&(42==e||!u||o),f=u&&(42==e||!c||a);return t.append(new Ip(95==e?Yp:qp,i,n,(d?1:0)|(f?2:0)))},HardBreak(t,e,i){if(92==e&&10==t.char(i+1))return t.append(Up(Kf.HardBreak,i,i+2));if(32==e){let e=i+1;for(;32==t.char(e);)e++;if(10==t.char(e)&&e>=i+2)return t.append(Up(Kf.HardBreak,i,e+1))}return-1},Link:(t,e,i)=>91==e?t.append(new Ip(Lp,i,i+1,1)):-1,Image:(t,e,i)=>33==e&&91==t.char(i+1)?t.append(new Ip(zp,i,i+2,1)):-1,LinkEnd(t,e,i){if(93!=e)return-1;for(let e=t.parts.length-1;e>=0;e--){let n=t.parts[e];if(n instanceof Ip&&(n.type==Lp||n.type==zp)){if(!n.side||t.skipSpace(n.to)==i&&!/[(\[]/.test(t.slice(i+1,i+2)))return t.parts[e]=null,-1;let s=t.takeContent(e),r=t.parts[e]=Gp(t,s,n.type==Lp?Kf.Link:Kf.Image,n.from,i+1);if(n.type==Lp)for(let i=0;ie?Up(Kf.URL,e+i,s+i):s==t.length&&null}}function Hp(t,e,i){let n=t.charCodeAt(e);if(39!=n&&34!=n&&40!=n)return!1;let s=40==n?41:n;for(let n=e+1,r=!1;n=this.end?-1:this.text.charCodeAt(t-this.offset)}get end(){return this.offset+this.text.length}slice(t,e){return this.text.slice(t-this.offset,e-this.offset)}append(t){return this.parts.push(t),t.to}addDelimiter(t,e,i,n,s){return this.append(new Ip(t,e,i,(n?1:0)|(s?2:0)))}addElement(t){return this.append(t)}resolveMarkers(t){for(let e=t;e=t;o--){let t=this.parts[o];if(t instanceof Ip&&1&t.side&&t.type==i.type&&!(s&&(1&i.side||2&t.side)&&(t.to-t.from+r)%3==0&&((t.to-t.from)%3||r%3))){n=t;break}}if(!n)continue;let a=i.type.resolve,l=[],h=n.from,c=i.to;if(s){let t=Math.min(2,n.to-n.from,r);h=n.to-t,c=i.from+t,a=1==t?"Emphasis":"StrongEmphasis"}n.type.mark&&l.push(this.elt(n.type.mark,h,n.to));for(let t=o+1;t=0;e--){let i=this.parts[e];if(i instanceof Ip&&i.type==t)return e}return null}takeContent(t){let e=this.resolveMarkers(t);return this.parts.length=t,e}skipSpace(t){return rp(this.text,t-this.offset)+this.offset}elt(t,e,i,n){return"string"==typeof t?Up(this.parser.getNodeType(t),e,i,n):new Wp(t,e)}}function tO(t,e){if(!e.length)return t;if(!t.length)return e;let i=t.slice(),n=0;for(let t of e){for(;n(t?t-1:0))return!1;if(this.fragmentEnd<0){let t=this.fragment.to;for(;t>0&&"\n"!=this.input.read(t-1,t);)t--;this.fragmentEnd=t?t-1:0}let i=this.cursor;i||(i=this.cursor=this.fragment.tree.cursor(),i.firstChild());let n=t+this.fragment.offset;for(;i.to<=n;)if(!i.parent())return!1;for(;;){if(i.from>=n)return this.fragment.from<=e;if(!i.childAfter(n))return!1}}matches(t){let e=this.cursor.tree;return e&&e.prop(ho.contextHash)==t}takeNodes(t){let e=this.cursor,i=this.fragment.offset,n=this.fragmentEnd-(this.fragment.openEnd?1:0),s=t.absoluteLineStart,r=s,o=t.block.children.length,a=r,l=o;for(;;){if(e.to-i>n){if(e.type.isAnonymous&&e.firstChild())continue;break}if(t.dontInject.add(e.tree),t.addNode(e.tree,e.from-i),e.type.is("Block")&&(eO.indexOf(e.type.id)<0?(r=e.to-i,o=t.block.children.length):(r=a,o=l,a=e.to-i,l=t.block.children.length)),!e.nextSibling())break}for(;t.block.children.length>o;)t.block.children.pop(),t.block.positions.pop();return r-s}}const nO=ea({"Blockquote/...":Sa.quote,HorizontalRule:Sa.contentSeparator,"ATXHeading1/... SetextHeading1/...":Sa.heading1,"ATXHeading2/... SetextHeading2/...":Sa.heading2,"ATXHeading3/...":Sa.heading3,"ATXHeading4/...":Sa.heading4,"ATXHeading5/...":Sa.heading5,"ATXHeading6/...":Sa.heading6,"Comment CommentBlock":Sa.comment,Escape:Sa.escape,Entity:Sa.character,"Emphasis/...":Sa.emphasis,"StrongEmphasis/...":Sa.strong,"Link/... Image/...":Sa.link,"OrderedList/... BulletList/...":Sa.list,"BlockQuote/...":Sa.quote,"InlineCode CodeText":Sa.monospace,URL:Sa.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":Sa.processingInstruction,"CodeInfo LinkLabel":Sa.labelName,LinkTitle:Sa.string,Paragraph:Sa.content}),sO=new Zp(new po(Ep).extend(nO),Object.keys(Sp).map((t=>Sp[t])),Object.keys(Sp).map((t=>$p[t])),Object.keys(Sp),Pp,np,Object.keys(Np).map((t=>Np[t])),Object.keys(Np),[]);function rO(t,e,i){let n=[];for(let s=t.firstChild,r=e;;s=s.nextSibling){let t=s?s.from:i;if(t>r&&n.push({from:r,to:t}),!s)break;r=s.to}return n}const oO={resolve:"Strikethrough",mark:"StrikethroughMark"},aO={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":Sa.strikethrough}},{name:"StrikethroughMark",style:Sa.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,i){if(126!=e||126!=t.char(i+1)||126==t.char(i+2))return-1;let n=t.slice(i-1,i),s=t.slice(i+2,i+3),r=/\s|^$/.test(n),o=/\s|^$/.test(s),a=jp.test(n),l=jp.test(s);return t.addDelimiter(oO,i,i+2,!o&&(!l||r||a),!r&&(!a||o||l))},after:"Emphasis"}]};function lO(t,e,i=0,n,s=0){let r=0,o=!0,a=-1,l=-1,h=!1,c=()=>{n.push(t.elt("TableCell",s+a,s+l,t.parser.parseInline(e.slice(a,l),s+a)))};for(let u=i;u-1)&&r++,o=!1,n&&(a>-1&&c(),n.push(t.elt("TableDelimiter",u+s,u+s+1))),a=l=-1),h=!h&&92==i}return a>-1&&(r++,n&&c()),r}function hO(t,e){for(let i=e;ihO(e.content,0)?new uO:null,endLeaf(t,e,i){if(i.parsers.some((t=>t instanceof uO))||!hO(e.text,e.basePos))return!1;let n=t.scanLine(t.absoluteLineEnd+1).text;return cO.test(n)&&lO(t,e.text,e.basePos)==lO(t,n,e.basePos)},before:"SetextHeading"}]};class fO{nextLine(){return!1}finish(t,e){return t.addLeafElement(e,t.elt("Task",e.start,e.start+e.content.length,[t.elt("TaskMarker",e.start,e.start+3),...t.parser.parseInline(e.content.slice(3),e.start+3)])),!0}}const pO=[dO,{defineNodes:[{name:"Task",block:!0,style:Sa.list},{name:"TaskMarker",style:Sa.atom}],parseBlock:[{name:"TaskList",leaf:(t,e)=>/^\[[ xX]\]/.test(e.content)&&"ListItem"==t.parentType().name?new fO:null,after:"SetextHeading"}]},aO];function OO(t,e,i){return(n,s,r)=>{if(s!=t||n.char(r+1)==t)return-1;let o=[n.elt(i,r,r+1)];for(let s=r+1;s=65&&r<=90||95==r||r>=97&&r<=122||r>=161;)s+=String.fromCharCode(n),n=t.peek(++e);var r;return RO=t,EO=i,TO=s?s.toLowerCase():n==MO||n==DO?void 0:null}const MO=63,DO=33;function WO(t,e){this.name=t,this.parent=e,this.hash=e?e.hash:0;for(let e=0;eUO.indexOf(e)>-1?new WO(VO(n,1)||"",t):t,reduce:(t,e)=>e==wO&&t?t.parent:t,reuse(t,e,i,n){let s=e.type.id;return 6==s||36==s?new WO(VO(n,1)||"",t):t},hash:t=>t?t.hash:0,strict:!1}),qO=new nf(((t,e)=>{if(60!=t.next)return void(t.next<0&&e.context&&t.acceptToken(57));t.advance();let i=47==t.next;i&&t.advance();let n=VO(t,0);if(void 0===n)return;if(!n)return t.acceptToken(i?14:6);let s=e.context?e.context.name:null;if(i){if(n==s)return t.acceptToken(11);if(s&&XO[s])return t.acceptToken(57,-2);if(e.dialectEnabled(0))return t.acceptToken(12);for(let t=e.context;t;t=t.parent)if(t.name==n)return;t.acceptToken(13)}else{if("script"==n)return t.acceptToken(7);if("style"==n)return t.acceptToken(8);if("textarea"==n)return t.acceptToken(9);if(_O.hasOwnProperty(n))return t.acceptToken(10);s&&ZO[s]&&ZO[s][n]?t.acceptToken(57,-1):t.acceptToken(6)}}),{contextual:!0}),LO=new nf((t=>{for(let e=0,i=0;;i++){if(t.next<0){i&&t.acceptToken(58);break}if(45==t.next)e++;else{if(62==t.next&&e>=2){i>3&&t.acceptToken(58,-2);break}e=0}t.advance()}}));const zO=new nf(((t,e)=>{if(47==t.next&&62==t.peek(1)){let i=e.dialectEnabled(1)||function(t){for(;t;t=t.parent)if("svg"==t.name||"math"==t.name)return!0;return!1}(e.context);t.acceptToken(i?5:4,2)}else 62==t.next&&t.acceptToken(4,1)}));function IO(t,e,i){let n=2+t.length;return new nf((s=>{for(let r=0,o=0,a=0;;a++){if(s.next<0){a&&s.acceptToken(e);break}if(0==r&&60==s.next||1==r&&47==s.next||r>=2&&ro?s.acceptToken(e,-o):s.acceptToken(i,-(o-2));break}if((10==s.next||13==s.next)&&a){s.acceptToken(e,1);break}r=o=0}else o++;s.advance()}}))}const BO=IO("script",54,1),jO=IO("style",55,2),NO=IO("textarea",56,3),GO=ea({"Text RawText":Sa.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":Sa.angleBracket,TagName:Sa.tagName,"MismatchedCloseTag/TagName":[Sa.tagName,Sa.invalid],AttributeName:Sa.attributeName,"AttributeValue UnquotedAttributeValue":Sa.attributeValue,Is:Sa.definitionOperator,"EntityReference CharacterReference":Sa.character,Comment:Sa.blockComment,ProcessingInst:Sa.processingInstruction,DoctypeDecl:Sa.documentMeta}),FO=wf.deserialize({version:14,states:",xOVO!rOOO!WQ#tO'#CqO!]Q#tO'#CzO!bQ#tO'#C}O!gQ#tO'#DQO!lQ#tO'#DSO!qOaO'#CpO!|ObO'#CpO#XOdO'#CpO$eO!rO'#CpOOO`'#Cp'#CpO$lO$fO'#DTO$tQ#tO'#DVO$yQ#tO'#DWOOO`'#Dk'#DkOOO`'#DY'#DYQVO!rOOO%OQ&rO,59]O%WQ&rO,59fO%`Q&rO,59iO%hQ&rO,59lO%sQ&rO,59nOOOa'#D^'#D^O%{OaO'#CxO&WOaO,59[OOOb'#D_'#D_O&`ObO'#C{O&kObO,59[OOOd'#D`'#D`O&sOdO'#DOO'OOdO,59[OOO`'#Da'#DaO'WO!rO,59[O'_Q#tO'#DROOO`,59[,59[OOOp'#Db'#DbO'dO$fO,59oOOO`,59o,59oO'lQ#|O,59qO'qQ#|O,59rOOO`-E7W-E7WO'vQ&rO'#CsOOQW'#DZ'#DZO(UQ&rO1G.wOOOa1G.w1G.wO(^Q&rO1G/QOOOb1G/Q1G/QO(fQ&rO1G/TOOOd1G/T1G/TO(nQ&rO1G/WOOO`1G/W1G/WOOO`1G/Y1G/YO(yQ&rO1G/YOOOa-E7[-E7[O)RQ#tO'#CyOOO`1G.v1G.vOOOb-E7]-E7]O)WQ#tO'#C|OOOd-E7^-E7^O)]Q#tO'#DPOOO`-E7_-E7_O)bQ#|O,59mOOOp-E7`-E7`OOO`1G/Z1G/ZOOO`1G/]1G/]OOO`1G/^1G/^O)gQ,UO,59_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hXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ}bQ!PcQ!RdQ!UeZ!e{}!P!R!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:67,context:YO,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,21,30,33,36,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,29,32,35,37,"OpenTag"],["group",-9,14,17,18,19,20,39,40,41,42,"Entity",16,"Entity TextContent",-3,28,31,34,"TextContent Entity"]],propSources:[GO],skippedNodes:[0],repeatNodeCount:9,tokenData:"#%g!aR!YOX$qXY,QYZ,QZ[$q[]&X]^,Q^p$qpq,Qqr-_rs4ysv-_vw5iwxJ^x}-_}!OKP!O!P-_!P!Q$q!Q![-_![!]!!O!]!^-_!^!_!&W!_!`#$o!`!a&X!a!c-_!c!}!!O!}#R-_#R#S!!O#S#T3V#T#o!!O#o#s-_#s$f$q$f%W-_%W%o!!O%o%p-_%p&a!!O&a&b-_&b1p!!O1p4U-_4U4d!!O4d4e-_4e$IS!!O$IS$I`-_$I`$Ib!!O$Ib$Kh-_$Kh%#t!!O%#t&/x-_&/x&Et!!O&Et&FV-_&FV;'S!!O;'S;:j!&Q;:j;=`4s<%l?&r-_?&r?Ah!!O?Ah?BY$q?BY?Mn!!O?MnO$q!Z$|c`PkW!a`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&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X",tokenizers:[BO,jO,NO,zO,qO,LO,0,1,2,3,4,5],topRules:{Document:[0,15]},dialects:{noMatch:0,selfClosing:485},tokenPrec:487});function HO(t,e){let i=Object.create(null);for(let n of t.getChildren(yO)){let t=n.getChild(SO),s=n.getChild(xO)||n.getChild(kO);t&&(i[e.read(t.from,t.to)]=s?s.type.id==xO?e.read(s.from+1,s.to-1):e.read(s.from,s.to):"")}return i}function JO(t,e){let i=t.getChild(vO);return i?e.read(i.from,i.to):" "}function KO(t,e,i){let n;for(let s of i)if(!s.attrs||s.attrs(n||(n=HO(t.node.parent.firstChild,e))))return{parser:s.parser};return null}function tg(t=[],e=[]){let i=[],n=[],s=[],r=[];for(let e of t){("script"==e.tag?i:"style"==e.tag?n:"textarea"==e.tag?s:r).push(e)}let o=e.length?Object.create(null):null;for(let t of e)(o[t.name]||(o[t.name]=[])).push(t);return Do(((t,e)=>{let a=t.type.id;if(a==QO)return KO(t,e,i);if(a==$O)return KO(t,e,n);if(a==PO)return KO(t,e,s);if(a==wO&&r.length){let i,n=t.node,s=n.firstChild,o=s&&JO(s,e);if(o)for(let t of r)if(t.tag==o&&(!t.attrs||t.attrs(i||(i=HO(n,e))))){let e=n.lastChild;return{parser:t.parser,overlay:[{from:s.to,to:e.type.id==CO?e.from:n.to}]}}}if(o&&a==yO){let i,n=t.node;if(i=n.firstChild){let t=o[e.read(i.from,i.to)];if(t)for(let i of t){if(i.tagName&&i.tagName!=JO(n.parent,e))continue;let t=n.lastChild;if(t.type.id==xO){let e=t.from+1,n=t.lastChild,s=t.to-(n&&n.isError?0:1);if(s>e)return{parser:i.parser,overlay:[{from:e,to:s}]}}else if(t.type.id==kO)return{parser:i.parser,overlay:[{from:t.from,to:t.to}]}}}}return null}))}const eg=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288];function ig(t){return t>=65&&t<=90||t>=97&&t<=122||t>=161}const ng=new nf(((t,e)=>{for(let n=!1,s=0,r=0;;r++){let{next:o}=t;if(!(ig(o)||45==o||95==o||n&&(i=o,i>=48&&i<=57))){n&&t.acceptToken(40==o?95:2==s&&e.canShift(2)?2:96);break}!n&&(45!=o||r>0)&&(n=!0),s===r&&45==o&&s++,t.advance()}var i})),sg=new nf((t=>{if(eg.includes(t.peek(-1))){let{next:e}=t;(ig(e)||95==e||35==e||46==e||91==e||58==e||45==e)&&t.acceptToken(94)}})),rg=new nf((t=>{if(!eg.includes(t.peek(-1))){let{next:e}=t;if(37==e&&(t.advance(),t.acceptToken(1)),ig(e)){do{t.advance()}while(ig(t.next));t.acceptToken(1)}}})),og=ea({"AtKeyword import charset namespace keyframes media supports":Sa.definitionKeyword,"from to selector":Sa.keyword,NamespaceName:Sa.namespace,KeyframeName:Sa.labelName,TagName:Sa.tagName,ClassName:Sa.className,PseudoClassName:Sa.constant(Sa.className),IdName:Sa.labelName,"FeatureName PropertyName":Sa.propertyName,AttributeName:Sa.attributeName,NumberLiteral:Sa.number,KeywordQuery:Sa.keyword,UnaryQueryOp:Sa.operatorKeyword,"CallTag ValueName":Sa.atom,VariableName:Sa.variableName,Callee:Sa.operatorKeyword,Unit:Sa.unit,"UniversalSelector NestingSelector":Sa.definitionOperator,MatchOp:Sa.compareOperator,"ChildOp SiblingOp, LogicOp":Sa.logicOperator,BinOp:Sa.arithmeticOperator,Important:Sa.modifier,Comment:Sa.blockComment,ParenthesizedContent:Sa.special(Sa.name),ColorLiteral:Sa.color,StringLiteral:Sa.string,":":Sa.punctuation,"PseudoOp #":Sa.derefOperator,"; ,":Sa.separator,"( )":Sa.paren,"[ ]":Sa.squareBracket,"{ }":Sa.brace}),ag={__proto__:null,lang:32,"nth-child":32,"nth-last-child":32,"nth-of-type":32,"nth-last-of-type":32,dir:32,"host-context":32,url:60,"url-prefix":60,domain:60,regexp:60,selector:134},lg={__proto__:null,"@import":114,"@media":138,"@charset":142,"@namespace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[0,4],Styles:[1,84]},specialized:[{term:95,get:t=>ag[t]||-1},{term:56,get:t=>lg[t]||-1},{term:96,get:t=>hg[t]||-1}],tokenPrec:1123});let ug=null;function dg(){if(!ug&&"object"==typeof document&&document.body){let{style:t}=document.body,e=[],i=new Set;for(let n in t)"cssText"!=n&&"cssFloat"!=n&&"string"==typeof t[n]&&(/[A-Z]/.test(n)&&(n=n.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))),i.has(n)||(e.push(n),i.add(n)));ug=e.sort().map((t=>({type:"property",label:t})))}return ug||[]}const fg=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map((t=>({type:"class",label:t}))),pg=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map((t=>({type:"keyword",label:t}))).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map((t=>({type:"constant",label:t})))),Og=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map((t=>({type:"type",label:t}))),gg=/^(\w[\w-]*|-\w[\w-]*|)$/,mg=/^-(-[\w-]*)?$/;const bg=new Ro,wg=["Declaration"];function vg(t){for(let e=t;;){if(e.type.isTop)return e;if(!(e=e.parent))return t}}function yg(t,e,i){if(e.to-e.from>4096){let n=bg.get(e);if(n)return n;let s=[],r=new Set,o=e.cursor(mo.IncludeAnonymous);if(o.firstChild())do{for(let e of yg(t,o.node,i))r.has(e.label)||(r.add(e.label),s.push(e))}while(o.nextSibling());return bg.set(e,s),s}{let n=[],s=new Set;return e.cursor().iterate((e=>{var r;if(i(e)&&e.matchContext(wg)&&":"==(null===(r=e.node.nextSibling)||void 0===r?void 0:r.name)){let i=t.sliceString(e.from,e.to);s.has(i)||(s.add(i),n.push({label:i,type:"variable"}))}})),n}}const Sg=t=>e=>{let{state:i,pos:n}=e,s=Xa(i).resolveInner(n,-1),r=s.type.isError&&s.from==s.to-1&&"-"==i.doc.sliceString(s.from,s.to);if("PropertyName"==s.name||(r||"TagName"==s.name)&&/^(Block|Styles)$/.test(s.resolve(s.to).name))return{from:s.from,options:dg(),validFor:gg};if("ValueName"==s.name)return{from:s.from,options:pg,validFor:gg};if("PseudoClassName"==s.name)return{from:s.from,options:fg,validFor:gg};if(t(s)||(e.explicit||r)&&function(t,e){var i;if(("("==t.name||t.type.isError)&&(t=t.parent||t),"ArgList"!=t.name)return!1;let n=null===(i=t.parent)||void 0===i?void 0:i.firstChild;return"Callee"==(null==n?void 0:n.name)&&"var"==e.sliceString(n.from,n.to)}(s,i.doc))return{from:t(s)||r?s.from:n,options:yg(i.doc,vg(s),t),validFor:mg};if("TagName"==s.name){for(let{parent:t}=s;t;t=t.parent)if("Block"==t.name)return{from:s.from,options:dg(),validFor:gg};return{from:s.from,options:Og,validFor:gg}}if(!e.explicit)return null;let o=s.resolve(n),a=o.childBefore(n);return a&&":"==a.name&&"PseudoClassSelector"==o.name?{from:n,options:fg,validFor:gg}:a&&":"==a.name&&"Declaration"==o.name||"ArgList"==o.name?{from:n,options:pg,validFor:gg}:"Block"==o.name||"Styles"==o.name?{from:n,options:dg(),validFor:gg}:null},xg=Sg((t=>"VariableName"==t.name)),kg=_a.define({name:"css",parser:cg.configure({props:[Na.add({Declaration:il()}),rl.add({"Block KeyframeList":ol})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function Qg(){return new Ua(kg,kg.data.of({autocomplete:xg}))}const $g=["_blank","_self","_top","_parent"],Pg=["ascii","utf-8","utf-16","latin1","latin1"],Cg=["get","post","put","delete"],_g=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Xg=["true","false"],Zg={},Ag={a:{attrs:{href:null,ping:null,type:null,media:null,target:$g,hreflang:null}},abbr:Zg,address:Zg,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Zg,aside:Zg,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Zg,base:{attrs:{href:null,target:$g}},bdi:Zg,bdo:Zg,blockquote:{attrs:{cite:null}},body:Zg,br:Zg,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Zg,center:Zg,cite:Zg,code:Zg,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:Zg,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Zg,div:Zg,dl:Zg,dt:Zg,em:Zg,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Zg,figure:Zg,footer:Zg,form:{attrs:{action:null,name:null,"accept-charset":Pg,autocomplete:["on","off"],enctype:_g,method:Cg,novalidate:["novalidate"],target:$g}},h1:Zg,h2:Zg,h3:Zg,h4:Zg,h5:Zg,h6:Zg,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Zg,hgroup:Zg,hr:Zg,html:{attrs:{manifest:null}},i:Zg,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:Zg,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Zg,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:Zg,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Pg,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:Zg,noscript:Zg,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:Zg,param:{attrs:{name:null,value:null}},pre:Zg,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Zg,rt:Zg,ruby:Zg,samp:Zg,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Pg}},section:Zg,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Zg,source:{attrs:{src:null,type:null,media:null}},span:Zg,strong:Zg,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Zg,summary:Zg,sup:Zg,table:Zg,tbody:Zg,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Zg,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:Zg,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Zg,time:{attrs:{datetime:null}},title:Zg,tr:Zg,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Zg,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:Zg},Tg={accesskey:null,class:null,contenteditable:Xg,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Xg,autocorrect:Xg,autocapitalize:Xg,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Xg,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Xg,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Xg,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Xg,"aria-hidden":Xg,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Xg,"aria-multiselectable":Xg,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Xg,"aria-relevant":null,"aria-required":Xg,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},Rg="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map((t=>"on"+t));for(let t of Rg)Tg[t]=null;class Eg{constructor(t,e){this.tags=Object.assign(Object.assign({},Ag),t),this.globalAttrs=Object.assign(Object.assign({},Tg),e),this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}function Vg(t,e,i=t.length){if(!e)return"";let n=e.firstChild,s=n&&n.getChild("TagName");return s?t.sliceString(s.from,Math.min(s.to,i)):""}function Mg(t,e=!1){for(let i=t.parent;i;i=i.parent)if("Element"==i.name){if(!e)return i;e=!1}return null}function Dg(t,e,i){let n=i.tags[Vg(t,Mg(e,!0))];return(null==n?void 0:n.children)||i.allTags}function Wg(t,e){let i=[];for(let n=e;n=Mg(n);){let s=Vg(t,n);if(s&&"CloseTag"==n.lastChild.name)break;s&&i.indexOf(s)<0&&("EndTag"==e.name||e.from>=n.firstChild.to)&&i.push(s)}return i}Eg.default=new Eg;const Ug=/^[:\-\.\w\u00b7-\uffff]*$/;function Yg(t,e,i,n,s){let r=/\s*>/.test(t.sliceDoc(s,s+5))?"":">";return{from:n,to:s,options:Dg(t.doc,i,e).map((t=>({label:t,type:"type"}))).concat(Wg(t.doc,i).map(((t,e)=>({label:"/"+t,apply:"/"+t+r,type:"type",boost:99-e})))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function qg(t,e,i,n){let s=/\s*>/.test(t.sliceDoc(n,n+5))?"":">";return{from:i,to:n,options:Wg(t.doc,e).map(((t,e)=>({label:t,apply:t+s,type:"type",boost:99-e}))),validFor:Ug}}function Lg(t,e){let{state:i,pos:n}=e,s=Xa(i).resolveInner(n),r=s.resolve(n,-1);for(let t,e=n;s==r&&(t=r.childBefore(e));){let i=t.lastChild;if(!i||!i.type.isError||i.from({label:t,type:"property"}))),validFor:Ug}}(i,t,r,"AttributeName"==r.name?r.from:n,n):"Is"==r.name||"AttributeValue"==r.name||"UnquotedAttributeValue"==r.name?function(t,e,i,n,s){var r;let o,a=null===(r=i.parent)||void 0===r?void 0:r.getChild("AttributeName"),l=[];if(a){let r=t.sliceDoc(a.from,a.to),h=e.globalAttrs[r];if(!h){let n=Mg(i),s=n?e.tags[Vg(t.doc,n)]:null;h=(null==s?void 0:s.attrs)&&s.attrs[r]}if(h){let e=t.sliceDoc(n,s).toLowerCase(),i='"',r='"';/^['"]/.test(e)?(o='"'==e[0]?/^[^"]*$/:/^[^']*$/,i="",r=t.sliceDoc(s,s+1)==e[0]?"":e[0],e=e.slice(1),n++):o=/^[^\s<>='"]*$/;for(let t of h)l.push({label:t,apply:i+t+r,type:"constant"})}}return{from:n,to:s,options:l,validFor:o}}(i,t,r,"Is"==r.name?n:r.from,n):!e.explicit||"Element"!=s.name&&"Text"!=s.name&&"Document"!=s.name?null:function(t,e,i,n){let s=[],r=0;for(let n of Dg(t.doc,i,e))s.push({label:"<"+n,type:"type"});for(let e of Wg(t.doc,i))s.push({label:"",type:"type",boost:99-r++});return{from:n,to:n,options:s,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}(i,t,r,n)}function zg(t){let{extraTags:e,extraGlobalAttributes:i}=t,n=i||e?new Eg(e,i):Eg.default;return t=>Lg(n,t)}const Ig=[{tag:"script",attrs:t=>"text/typescript"==t.type||"ts"==t.lang,parser:zf.parser},{tag:"script",attrs:t=>"text/babel"==t.type||"text/jsx"==t.type,parser:If.parser},{tag:"script",attrs:t=>"text/typescript-jsx"==t.type,parser:Bf.parser},{tag:"script",attrs:t=>!t.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(t.type),parser:qf.parser},{tag:"style",attrs:t=>(!t.lang||"css"==t.lang)&&(!t.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(t.type)),parser:kg.parser}],Bg=[{name:"style",parser:kg.parser.configure({top:"Styles"})}].concat(Rg.map((t=>({name:t,parser:qf.parser})))),jg=_a.define({name:"html",parser:FO.configure({props:[Na.add({Element(t){let e=/^(\s*)(<\/)?/.exec(t.textAfter);return t.node.to<=t.pos+e[0].length?t.continue():t.lineIndent(t.node.from)+(e[2]?0:t.unit)},"OpenTag CloseTag SelfClosingTag":t=>t.column(t.node.from)+t.unit,Document(t){if(t.pos+/\s*/.exec(t.textAfter)[0].lengtht.getChild("TagName")})],wrap:tg(Ig,Bg)}),languageData:{commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-._"}});function Ng(t={}){let e,i="";!1===t.matchClosingTags&&(i="noMatch"),!0===t.selfClosingTags&&(i=(i?i+" ":"")+"selfClosing"),(t.nestedLanguages&&t.nestedLanguages.length||t.nestedAttributes&&t.nestedAttributes.length)&&(e=tg((t.nestedLanguages||[]).concat(Ig),(t.nestedAttributes||[]).concat(Bg)));let n=e||i?jg.configure({dialect:i,wrap:e}):jg;return new Ua(n,[jg.data.of({autocomplete:zg(t)}),!1!==t.autoCloseTags?Fg:[],Nf().support,Qg().support])}const Gg=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),Fg=Ts.inputHandler.of(((t,e,i,n)=>{if(t.composing||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!jg.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((e=>{var i,r,o;let a,{head:l}=e,h=Xa(s).resolveInner(l,-1);if("TagName"!=h.name&&"StartTag"!=h.name||(h=h.parent),">"==n&&"OpenTag"==h.name){if("CloseTag"!=(null===(r=null===(i=h.parent)||void 0===i?void 0:i.lastChild)||void 0===r?void 0:r.name)&&(a=Vg(s.doc,h.parent,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`${e?"":">"}`;return{range:A.cursor(l+1),changes:{from:l+(e?1:0),insert:i}}}}else if("/"==n&&"OpenTag"==h.name){let e=h.parent,i=null==e?void 0:e.parent;if(e.from==l-1&&"CloseTag"!=(null===(o=i.lastChild)||void 0===o?void 0:o.name)&&(a=Vg(s.doc,i,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`/${a}${e?"":">"}`,n=l+i.length+(e?1:0);return{range:A.cursor(n),changes:{from:l,insert:i}}}}return{range:e}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)})),Hg=Qa({commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}}}),Jg=new ho,Kg=sO.configure({props:[rl.add((t=>!t.is("Block")||t.is("Document")||null!=tm(t)?void 0:(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to}))),Jg.add(tm),Na.add({Document:()=>null}),ka.add({Document:Hg})]});function tm(t){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(t.name);return e?+e[1]:void 0}function em(t,e){let i=t;for(;;){let t,n=i.nextSibling;if(!n||null!=(t=tm(n.type))&&t<=e)break;i=n}return i.to}const im=sl.of(((t,e,i)=>{for(let n=Xa(t).resolveInner(i,-1);n&&!(n.fromi)return{from:i,to:e}}return null}));function nm(t){return new Pa(Hg,t,[im],"markdown")}const sm=nm(Kg),rm=nm(Kg.configure([pO,mO,gO,bO]));class om{constructor(t,e,i,n,s,r,o){this.node=t,this.from=e,this.to=i,this.spaceBefore=n,this.spaceAfter=s,this.type=r,this.item=o}blank(t,e=!0){let i=this.spaceBefore+("Blockquote"==this.node.name?">":"");if(null!=t){for(;i.length0;t--)i+=" ";return i+(e?this.spaceAfter:"")}marker(t,e){let i="OrderedList"==this.node.name?String(+lm(this.item,t)[2]+e):"";return this.spaceBefore+i+this.type+this.spaceAfter}}function am(t,e){let i=[];for(let e=t;e&&"Document"!=e.name;e=e.parent)"ListItem"!=e.name&&"Blockquote"!=e.name&&"FencedCode"!=e.name||i.push(e);let n=[];for(let t=i.length-1;t>=0;t--){let s,r=i[t],o=e.lineAt(r.from),a=r.from-o.from;if("FencedCode"==r.name)n.push(new om(r,a,a,"","","",null));else if("Blockquote"==r.name&&(s=/^[ \t]*>( ?)/.exec(o.text.slice(a))))n.push(new om(r,a,a+s[0].length,"",s[1],">",null));else if("ListItem"==r.name&&"OrderedList"==r.parent.name&&(s=/^([ \t]*)\d+([.)])([ \t]*)/.exec(o.text.slice(a)))){let t=s[3],e=s[0].length;t.length>=4&&(t=t.slice(0,t.length-4),e-=4),n.push(new om(r.parent,a,a+e,s[1],t,s[2],r))}else if("ListItem"==r.name&&"BulletList"==r.parent.name&&(s=/^([ \t]*)([-+*])([ \t]{1,4}\[[ xX]\])?([ \t]+)/.exec(o.text.slice(a)))){let t=s[4],e=s[0].length;t.length>4&&(t=t.slice(0,t.length-4),e-=4);let i=s[2];s[3]&&(i+=s[3].replace(/[xX]/," ")),n.push(new om(r.parent,a,a+e,s[1],t,i,r))}}return n}function lm(t,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(t.from,t.from+10))}function hm(t,e,i,n=0){for(let s=-1,r=t;;){if("ListItem"==r.name){let t=lm(r,e),o=+t[2];if(s>=0){if(o!=s+1)return;i.push({from:r.from+t[1].length,to:r.from+t[0].length,insert:String(s+2+n)})}s=o}let t=r.nextSibling;if(!t)break;r=t}}function cm(t){return"QuoteMark"==t.name||"ListMark"==t.name}const um=[{key:"Enter",run:({state:t,dispatch:e})=>{let i=Xa(t),{doc:n}=t,s=null,r=t.changeByRange((e=>{if(!e.empty||!rm.isActiveAt(t,e.from))return s={range:e};let r=e.from,o=n.lineAt(r),a=am(i.resolveInner(r,-1),n);for(;a.length&&a[a.length-1].from>r-o.from;)a.pop();if(!a.length)return s={range:e};let l=a[a.length-1];if(l.to-l.spaceAfter.length>r-o.from)return s={range:e};let h=r>=l.to-l.spaceAfter.length&&!/\S/.test(o.text.slice(l.to));if(l.item&&h){if(l.node.firstChild.to>=r||o.from>0&&!/[^\s>]/.test(n.lineAt(o.from-1).text)){let t,e=a.length>1?a[a.length-2]:null,i="";e&&e.item?(t=o.from+e.from,i=e.marker(n,1)):t=o.from+(e?e.to:0);let s=[{from:t,to:r,insert:i}];return"OrderedList"==l.node.name&&hm(l.item,n,s,-2),e&&"OrderedList"==e.node.name&&hm(e.item,n,s),{range:A.cursor(t+i.length),changes:s}}{let e="";for(let t=0,i=a.length-2;t<=i;t++)e+=a[t].blank(t\s*$/.exec(i.text);if(s&&s.index==l.from){let n=t.changes([{from:i.from+s.index,to:i.to},{from:o.from+l.from,to:o.to}]);return{range:e.map(n),changes:n}}}let c=[];"OrderedList"==l.node.name&&hm(l.item,n,c);let u=l.item&&l.item.from]*/.exec(o.text)[0].length>=l.to)for(let t=0,e=a.length-1;t<=e;t++)d+=t!=e||u?a[t].blank(to.from&&/\s/.test(o.text.charAt(f-o.from-1));)f--;return d=t.lineBreak+d,c.push({from:f,to:r,insert:d}),{range:A.cursor(f+d.length),changes:c}}));return!s&&(e(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0)}},{key:"Backspace",run:({state:t,dispatch:e})=>{let i=Xa(t),n=null,s=t.changeByRange((e=>{let s=e.from,{doc:r}=t;if(e.empty&&rm.isActiveAt(t,e.from)){let t=r.lineAt(s),n=am(function(t,e){let i=t.resolveInner(e,-1),n=e;cm(i)&&(n=i.from,i=i.parent);for(let t;t=i.childBefore(n);)if(cm(t))n=t.from;else{if("OrderedList"!=t.name&&"BulletList"!=t.name)break;i=t.lastChild,n=i.to}return i}(i,s),r);if(n.length){let i=n[n.length-1],r=i.to-i.spaceAfter.length+(i.spaceAfter?1:0);if(s-t.from>r&&!/\S/.test(t.text.slice(r,s-t.from)))return{range:A.cursor(t.from+r),changes:{from:t.from+r,to:s}};if(s-t.from==r&&(!i.item||t.from<=i.item.from||!/\S/.test(t.text.slice(0,i.to)))){let n=t.from+i.from;if(i.item&&i.node.fromt.from-e.from||t.startSide-e.startSide)),ni.set(i)}getMatchingBracket(t){switch(t){case")":return"(";case"]":return"[";case"}":return"{";default:return null}}},{decorations:t=>t.decorations});var fm="[a-zA-Z\\$][a-zA-Z0-9\\$]*",pm="(?:\\.\\d+|\\d+\\.\\d*|\\d+)",Om="(?:`(?:`?"+pm+")?)",gm=new RegExp("(?:(?:\\d+)(?:\\^\\^(?:\\.\\w+|\\w+\\.\\w*|\\w+)"+Om+"?(?:\\*\\^[+-]?\\d+)?))"),mm=new RegExp("(?:"+pm+Om+"?(?:\\*\\^[+-]?\\d+)?)"),bm=new RegExp("(?:`?)(?:"+fm+")(?:`(?:"+fm+"))*(?:`?)");let wm=[];const vm=["True","False","All","None","Null","Full","$Failed","$Aborted"];function ym(t,e){var i;return'"'===(i=t.next())?(e.tokenize=Sm,e.tokenize(t,e)):"("===i&&t.eat("*")?(e.commentLevel++,e.tokenize=xm,e.tokenize(t,e)):(t.backUp(1),t.match(gm,!0,!1)||t.match(mm,!0,!1)?"number":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::usage)/,!0,!1)?"meta":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::[a-zA-Z\$][a-zA-Z0-9\$]*):?/,!0,!1)?"string.special":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*\s*:)(?:(?:[a-zA-Z\$][a-zA-Z0-9\$]*)|(?:[^:=>~@\^\&\*\)\[\]'\?,\|])).*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+/,!0,!1)||t.match(/_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)?"variableName.special":t.match(/\\\[[a-zA-Z\$][a-zA-Z0-9\$]*\]/,!0,!1)?"character":t.match(/(?:\[|\]|{|}|\(|\))/,!0,!1)?"bracket":t.match(/(?:#[a-zA-Z\$][a-zA-Z0-9\$]*|#+[0-9]?)/,!0,!1)?"variableName.constant":t.match(bm,!0,!1)?vm.indexOf(t.current())>-1?"number":wm.indexOf(t.current())>-1||0==wm.length?"keyword":t.current()in e.localVars?"atom":(e.localVars[t.current()]=!0,"function"):t.match(/(?:\\|\+|\-|\*|\/|,|;|\.|:|@|~|=|>|<|&|\||_|`|'|\^|\?|!|%)/,!0,!1)?"operator":(t.next(),"error"))}function Sm(t,e){for(var i,n=!1,s=!1;null!=(i=t.next());){if('"'===i&&!s){n=!0;break}s=!s&&"\\"===i}return n&&!s&&(e.tokenize=ym),"string"}function xm(t,e){for(var i,n;e.commentLevel>0&&null!=(n=t.next());)"("===i&&"*"===n&&e.commentLevel++,"*"===i&&")"===n&&e.commentLevel--,i=n;return e.commentLevel<=0&&(e.tokenize=ym),"comment"}const km={name:"mathematica",extendVariables:function(t){},startState:function(){return{tokenize:ym,commentLevel:0,localVars:{}}},token:function(t,e){return t.eatSpace()?null:e.tokenize(t,e)},languageData:{commentTokens:{block:{open:"(*",close:"*)"}}}};let Qm={of:t=>[Gl.define(km),Yd({override:[async e=>function(t,e){let i=t.matchBefore(/\w*/);return i.from!==i.to||t.explicit?{from:i.from,options:e.data}:null}(e,t)]}),Ys.of([{key:"Escape",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((t=>{let{from:e,to:i}=t;return{changes:{from:e,to:i,insert:"EC"},range:A.cursor(e+2)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])],reBuild:t=>{wm=t.map((t=>t.label))}};const $m=(t,e,i,n)=>{if(0==t.length)return;const s=(new Date).valueOf();let r=0;i.dom.loadingMark=!0;const o=i.dom.style.background;let a=0;console.log("Start animation");const l=setInterval((()=>{i.dom.style.setProperty("background","hsl("+a+"deg 100% 97%)","important"),a+=2,a>360&&(a=0)}),30);n.transaction(e,i,s,t.length);for(const a of t)Pm(a,((a,h)=>{n.file(e,i,s,a,h),r++,r>=t.length&&i.dom&&i.dom.loadingMark&&(i.dom.loadingMark=!1,setTimeout((()=>{i.dom.style.background=o,clearInterval(l),console.log("Stop animation")}),2e3))}),(()=>{console.warn("Fauilure");const t=i.dom.style.background;i.dom.style.background="rgb(255 189 189 / 97%)";let e=97;const n=setInterval((()=>{i.dom.style.background="rgb(255 189 189 / "+Math.round(e)+"%)",e*=.95}),30);clearInterval(l),setTimeout((()=>{clearInterval(n),i.dom.style.background=t}),3e3)}))};function Pm(t,e,i){const n=new FileReader;n.addEventListener("load",(n=>{const s=n.target.result;if(s.byteLength/1024/1024>15)return alert("Files > 15Mb are not supported for drag and drop"),void i();let r=base64ArrayBuffer(s);e(t.name,r)})),n.addEventListener("progress",(t=>{if(t.loaded&&t.total){const e=t.loaded/t.total*100;console.log(e)}})),n.readAsArrayBuffer(t)}const Cm=(t,e)=>Ts.domEventHandlers({drop(e,i){e.preventDefault();const n=[];e.dataTransfer.items?[...e.dataTransfer.items].forEach(((t,e)=>{if("file"===t.kind){const i=t.getAsFile();console.log(`… file[${e}].name = ${i.name}`),n.push(i)}})):[...e.dataTransfer.files].forEach(((t,e)=>{console.log(`… file[${e}].name = ${t.name}`),n.push(t)})),$m(n,e,i,t)},paste(t,i){let n=t.clipboardData||window.clipboardData;for(const s of n.items)if("string"===s.kind)switch(s.type){case"text/plain":break;case"image/png":t.preventDefault(),$m([s.getAsFile()],t,i,e)}else t.preventDefault(),$m([s.getAsFile()],t,i,e)}}),_m=new pr({regexp:/\\\[(\w+)\]/g,decoration:t=>ni.replace({widget:new Zm(t[1])})}),Xm=_i.fromClass(class{constructor(t){this.Greekholder=_m.createDeco(t)}update(t){this.Greekholder=_m.updateDeco(t,this.Greekholder)}},{decorations:t=>t.Greekholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Greekholder||ni.none))});class Zm extends ei{constructor(t){super(),this.name=t}eq(t){return this.name===t.name}toDOM(){let t=document.createElement("span");return t.innerHTML="&"+this.name.toLowerCase().replace("sqrt","radic").replace("undirectededge","harr").replace("directededge","rarr").replace(/capital(.*)/,((t,e)=>e.charAt(0).toUpperCase()+e.slice(1))).replace(/curly(.*)/,((t,e)=>e)).replace(/script(.*)/,((t,e)=>"el"+e.toLowerCase())).replace("transpose","#7488").replace("degree","deg")+";",t}ignoreEvent(){return!1}}const Am=new pr({regexp:/(->|<-)/g,decoration:t=>ni.replace({widget:new Tm(t[1])})});_i.fromClass(class{constructor(t){this.Arrowholder=Am.createDeco(t)}update(t){this.Arrowholder=Am.updateDeco(t,this.Arrowholder)}},{decorations:t=>t.Arrowholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Arrowholder||ni.none))});class Tm extends ei{constructor(t){super(),this.dir=t}eq(t){return this.dir===t.dir}toDOM(){let t=document.createElement("span");return"->"===this.dir?t.innerText="→":t.innerText="←",t}ignoreEvent(){return!1}}function Rm(t){if(!(t=t||{}).open)throw new Error('Balanced: please provide a "open" property');if(!t.close)throw new Error('Balanced: please provide a "close" property');if(this.balance=t.balance||!1,this.exceptions=t.exceptions||!1,this.caseInsensitive=t.caseInsensitive,this.head=t.head||t.open,this.head=Array.isArray(this.head)?this.head:[this.head],this.open=Array.isArray(t.open)?t.open:[t.open],this.close=Array.isArray(t.close)?t.close:[t.close],!Array.isArray(this.head)||!Array.isArray(this.open)||!Array.isArray(this.close)||this.head.length!==this.open.length||this.open.length!==this.close.length)throw new Error('Balanced: if you use arrays for a "head,open,close" you must use matching arrays for all options');var e=Dm(this.head.map(this.regExpFromArrayGroupedMap,this)),i=Dm(this.open.map(this.regExpFromArrayGroupedMap,this)),n=Dm(this.close.map(this.regExpFromArrayGroupedMap,this));this.regExp=Dm([e,i,n],"g"+(this.caseInsensitive?"i":"")),this.regExpGroupLength=this.head.length}function Em(t,e,i){for(var n=Mm(e.substr(0,i+1),/^.*\n?$/gim),s=Mm(e,/^.*\n?$/gim),r=n.length-1,o=i+1-(n.length?n[n.length-1].index:0),a="",l=2;l>=0;l--)r-l>=0&&s[r-l]&&(a+=e.substr(s[r-l].index,s[r-l].length)+"\n");for(l=0;l=0&&s[r+l]&&(a+=e.substr(s[r+l].index,s[r+l].length)+"\n");a=a.replace(/\t/g," ").replace(/\n$/,"");var h=new Error(t+" at "+(r+1)+":"+o+"\n\n"+a);return h.line=r+1,h.column=o,h.index=i,h}function Vm(t,e){return t>=e.index&&t<=e.index+e.length-1}function Mm(t,e){var i,n=new RegExp(e),s=[];if(t)for(;i=n.exec(t);)s.push({index:i.index,length:i[0].length,match:i[0]}),i[0].length||n.lastIndex++;return s}function Dm(t,e,i){var n=t.map((function(t){return t instanceof RegExp?t.source:function(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}(t)}),this).join("|");return n=i?"("+n+")":"(?:"+n+")",new RegExp(n,e||void 0)}Rm.prototype={regExpFromArrayGroupedMap:function(t){return Dm([t],null,!0)},matchContentsInBetweenBrackets:function(t,e){for(var i,n=new RegExp(this.regExp),s=[],r=[],o=null,a=!0;i=n.exec(t);){if(e){for(var l=!1,h=0;h{const i=((t,e,i)=>{var n,s=new RegExp(t),r=[];if(e)for(;n=s.exec(e);){if(i){for(var o=!1,a=0;a{new qm({open:"(*"+t+"[*)",close:"(*]"+t+"*)",balance:!1}).matchContentsInBetweenBrackets(e.value,[]).forEach((function(t){const s=e.value.slice(t.index+t.head.length,t.index+t.length-t.tail.length);n(i+t.index,{length:t.length,pos:i+t.index,argsPos:i+t.index+t.head.length,str:s})}))})(e,t,i,s)},o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)r(o,a)}var Im,Bm=function(){function t(t){var e=t.tag,i=t.decoration,n=t.decorate,s=t.boundary,r=t.maxLength,o=void 0===r?1e3:r;if(this.tag=e,n)this.addMatch=function(t,e,i,s){return n(s,i,i+t.length,t,e)};else if("function"==typeof i)this.addMatch=function(t,e,n,s){var r=i(t,e,n);r&&s(n,n+t.length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=function(t,e,n,s){return s(n,n+t.length,i)}}this.boundary=s,this.maxLength=o}return t.prototype.createDeco=function(t){for(var e=this,i=new Xt,n=i.add.bind(i),s=0,r=function(t,e){var i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;for(var n=[],s=0,r=i;s=a?n[n.length-1].to=l:n.push({from:a,to:l})}return n}(t,this.maxLength);st.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e},t.prototype.updateRange=function(t,e,i,n){for(var s=this,r=function(r){var a=Math.max(r.from,i),l=Math.min(r.to,n);if(l>a){var h=t.state.doc.lineAt(a),c=h.toh.from;a--)if(o.boundary.test(h.text[a-1-h.from])){u=a;break}for(;ld},add:f})}},o=this,a=0,l=t.visibleRanges;a{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*FB[*)((_)(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*FB[*)(("+s+")(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let Nm=class{constructor(t,e,i,n,s,r){this.view=e,this.visibleValue=t,this.placeholder=r,console.log(r),this.args=Lm(t.str,/\(\*,\*\)/gm);const o=this;let a,l;console.log("creating InstanceWidget"),a=Im({doc:o.args[0].body.slice(2,-1),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(o.visibleValue.pos),e.dispatch({selection:{anchor:o.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return l.dispatch({selection:{anchor:0}}),l.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){l.focus(),t.editorLastCursor=void 0}}])]}),l=Im({doc:o.args[2].body.slice(1,-2),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:a.state.doc.length}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:o.visibleValue.pos+o.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus(),t.editorLastCursor=void 0}}])]}),o.args[0].length=o.args[0].body.length,o.args[2].length=o.args[2].body.length,delete o.args[2].body,delete o.args[1].body,delete o.args[0].body,this.topEditor=a,this.bottomEditor=l}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="(("+t+")",s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length));const r=e.length-i[0].length;i[0].to=i[0].to+r,i[2].from=i[2].from+r,i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e="("+t+"))",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length));const r=e.length-i[2].length;i[2].to=i[2].to+r,i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t,e){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm),console.log("recreating InstanceWidget"),n=Im.state({doc:e.args[0].body.slice(2,-1),update:t=>e.applyChanges(t,0),eval:()=>{i.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(e.visibleValue.pos),i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus(),t.editorLastCursor=void 0}}])]}),s=Im.state({doc:e.args[2].body.slice(1,-2),update:t=>e.applyChanges(t,2),eval:()=>{e.view.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus(),t.editorLastCursor=void 0}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),console.log(e),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.placeholder=e,this.visibleValue.argsPos=t.argsPos}destroy(){this.topEditor.destroy(),this.bottomEditor.destroy()}},Gm=class extends ei{constructor(t,e,i,n){super(),this.view=i,this.visibleValue=t,this.reference=e,this.placeholder=n}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue,this),!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("fraction");const i=document.createElement("table");i.classList.add("container"),e.appendChild(i);const n=document.createElement("tbody");i.appendChild(n);const s=document.createElement("tr"),r=document.createElement("tr");n.appendChild(s),n.appendChild(r);const o=document.createElement("td");o.classList.add("enumenator"),s.appendChild(o);const a=document.createElement("td");r.appendChild(a);const l=this;return e.EditorWidget=new Nm(this.visibleValue,t,o,a,[],this),this.DOMElement=e,this.reference.push({destroy:()=>{l.destroy(e)}}),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const Fm=(t,e,i)=>new Bm({tag:"FB",decoration:n=>ni.replace({widget:new Gm(n,t,e,i)})}),Hm=t=>_i.fromClass(class{constructor(e){this.disposable=[],this.placeholder=Fm(this.disposable,e,this).createDeco(e),t.placeholder=this}update(t){this.placeholder=Fm(this.disposable,t,this).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var Jm;function Km(t){return Jm=t,[nb,Ys.of([{key:"Ctrl-2",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt[_](*]SqB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt["+s+"](*]SqB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let tb=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;this.sliceRanges=n,this.length=t.str.length,console.log("creating InstanceWidget"),this.editor=Jm({doc:t.str.slice(...n),parent:i,update:t=>r.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]})}applyChanges(t){const e=t,i={from:this.visibleValue.argsPos+5,to:this.visibleValue.argsPos+this.length-1,insert:e};console.log(this.visibleValue);const n=e.length+6-this.length;this.length=this.length+n,this.visibleValue.length=this.visibleValue.length+n,this.visibleValue.str="Sqrt["+e+"]",this.view.dispatch({changes:i})}update(t){if(this.visibleValue.str==t.str)this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos;else{console.warn("Out of sync"),this.visibleValue=t;const e=this.sliceRanges,i=this.editor,n=this,s=this.view;this.length=t.str.length;const r=Jm.state({doc:t.str.slice(...e),update:t=>n.applyChanges(t),eval:()=>{s.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos+n.visibleValue.length}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]});i.setState(r)}}destroy(){console.warn("destroy Instance of Widget!"),this.editor.destroy()}},eb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("sqroot");const i=this,n=document.createElement("span");return n.classList.add("radicand"),e.EditorWidget=new tb(this.visibleValue,t,n,[5,-1],[]),e.appendChild(n),this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const ib=(t,e)=>new Bm({tag:"SqB",decoration:i=>ni.replace({widget:new eb(i,t,e)})}),nb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=ib(this.disposable,t).createDeco(t)}update(t){this.placeholder=ib(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var sb;function rb(t){return sb=t,[hb,Ys.of([{key:"Ctrl--",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SbB[*)Subscript[_(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SbB[*)Subscript["+s+"(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let ob=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),console.log(r.visibleValue),o=sb({doc:r.args[0].body.slice(10),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){a.focus()}}])]}),a=sb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Subscript["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),console.log(e.visibleValue),n=sb.state({doc:e.args[0].body.slice(10),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus()}}])]}),s=sb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},ab=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sub");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new ob(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const lb=(t,e)=>new Bm({tag:"SbB",decoration:i=>ni.replace({widget:new ab(i,t,e)})}),hb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=lb(this.disposable,t).createDeco(t)}update(t){this.placeholder=lb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var cb;function ub(t){return cb=t,[Ob,Ys.of([{key:"Ctrl-6",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SpB[*)Power[_(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SpB[*)Power["+s+"(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let db=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),o=cb({doc:r.args[0].body.slice(6),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus()}}])]}),a=cb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Power["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),n=cb.state({doc:e.args[0].body.slice(6),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.bottomEditor.focus()}}])]}),s=cb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},fb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sup");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new db(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}destroy(t){t.EditorWidget.destroy()}};const pb=(t,e)=>new Bm({tag:"SpB",decoration:i=>ni.replace({widget:new fb(i,t,e)})}),Ob=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=pb(this.disposable,t).createDeco(t)}update(t){this.placeholder=pb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var gb={},mb={},bb={},wb={};function vb(t){let e=t.length;for(;--e>=0;)t[e]=0}const yb=256,Sb=286,xb=30,kb=15,Qb=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),$b=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Pb=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Cb=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_b=new Array(576);vb(_b);const Xb=new Array(60);vb(Xb);const Zb=new Array(512);vb(Zb);const Ab=new Array(256);vb(Ab);const Tb=new Array(29);vb(Tb);const Rb=new Array(xb);function Eb(t,e,i,n,s){this.static_tree=t,this.extra_bits=e,this.extra_base=i,this.elems=n,this.max_length=s,this.has_stree=t&&t.length}let Vb,Mb,Db;function Wb(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}vb(Rb);const Ub=t=>t<256?Zb[t]:Zb[256+(t>>>7)],Yb=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},qb=(t,e,i)=>{t.bi_valid>16-i?(t.bi_buf|=e<>16-t.bi_valid,t.bi_valid+=i-16):(t.bi_buf|=e<{qb(t,i[2*e],i[2*e+1])},zb=(t,e)=>{let i=0;do{i|=1&t,t>>>=1,i<<=1}while(--e>0);return i>>>1},Ib=(t,e,i)=>{const n=new Array(16);let s,r,o=0;for(s=1;s<=kb;s++)o=o+i[s-1]<<1,n[s]=o;for(r=0;r<=e;r++){let e=t[2*r+1];0!==e&&(t[2*r]=zb(n[e]++,e))}},Bb=t=>{let e;for(e=0;e{t.bi_valid>8?Yb(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},Nb=(t,e,i,n)=>{const s=2*e,r=2*i;return t[s]{const n=t.heap[i];let s=i<<1;for(;s<=t.heap_len&&(s{let n,s,r,o,a=0;if(0!==t.sym_next)do{n=255&t.pending_buf[t.sym_buf+a++],n+=(255&t.pending_buf[t.sym_buf+a++])<<8,s=t.pending_buf[t.sym_buf+a++],0===n?Lb(t,s,e):(r=Ab[s],Lb(t,r+yb+1,e),o=Qb[r],0!==o&&(s-=Tb[r],qb(t,s,o)),n--,r=Ub(n),Lb(t,r,i),o=$b[r],0!==o&&(n-=Rb[r],qb(t,n,o)))}while(a{const i=e.dyn_tree,n=e.stat_desc.static_tree,s=e.stat_desc.has_stree,r=e.stat_desc.elems;let o,a,l,h=-1;for(t.heap_len=0,t.heap_max=573,o=0;o>1;o>=1;o--)Gb(t,i,o);l=r;do{o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Gb(t,i,1),a=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=a,i[2*l]=i[2*o]+i[2*a],t.depth[l]=(t.depth[o]>=t.depth[a]?t.depth[o]:t.depth[a])+1,i[2*o+1]=i[2*a+1]=l,t.heap[1]=l++,Gb(t,i,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const i=e.dyn_tree,n=e.max_code,s=e.stat_desc.static_tree,r=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,l=e.stat_desc.max_length;let h,c,u,d,f,p,O=0;for(d=0;d<=kb;d++)t.bl_count[d]=0;for(i[2*t.heap[t.heap_max]+1]=0,h=t.heap_max+1;h<573;h++)c=t.heap[h],d=i[2*i[2*c+1]+1]+1,d>l&&(d=l,O++),i[2*c+1]=d,c>n||(t.bl_count[d]++,f=0,c>=a&&(f=o[c-a]),p=i[2*c],t.opt_len+=p*(d+f),r&&(t.static_len+=p*(s[2*c+1]+f)));if(0!==O){do{for(d=l-1;0===t.bl_count[d];)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[l]--,O-=2}while(O>0);for(d=l;0!==d;d--)for(c=t.bl_count[d];0!==c;)u=t.heap[--h],u>n||(i[2*u+1]!==d&&(t.opt_len+=(d-i[2*u+1])*i[2*u],i[2*u+1]=d),c--)}})(t,e),Ib(i,h,t.bl_count)},Jb=(t,e,i)=>{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),e[2*(i+1)+1]=65535,n=0;n<=i;n++)s=o,o=e[2*(n+1)+1],++a{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),n=0;n<=i;n++)if(s=o,o=e[2*(n+1)+1],!(++a{qb(t,0+(n?1:0),3),jb(t),Yb(t,i),Yb(t,~i),i&&t.pending_buf.set(t.window.subarray(e,e+i),t.pending),t.pending+=i};wb._tr_init=t=>{tw||((()=>{let t,e,i,n,s;const r=new Array(16);for(i=0,n=0;n<28;n++)for(Tb[n]=i,t=0;t<1<>=7;n{let s,r,o=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e{let e;for(Jb(t,t.dyn_ltree,t.l_desc.max_code),Jb(t,t.dyn_dtree,t.d_desc.max_code),Hb(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*Cb[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=i+5,i+4<=s&&-1!==e?ew(t,e,i,n):4===t.strategy||r===s?(qb(t,2+(n?1:0),3),Fb(t,_b,Xb)):(qb(t,4+(n?1:0),3),((t,e,i,n)=>{let s;for(qb(t,e-257,5),qb(t,i-1,5),qb(t,n-4,4),s=0;s(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=i,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(Ab[i]+yb+1)]++,t.dyn_dtree[2*Ub(e)]++),t.sym_next===t.sym_end),wb._tr_align=t=>{qb(t,2,3),Lb(t,256,_b),(t=>{16===t.bi_valid?(Yb(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)};var iw=(t,e,i,n)=>{let s=65535&t|0,r=t>>>16&65535|0,o=0;for(;0!==i;){o=i>2e3?2e3:i,i-=o;do{s=s+e[n++]|0,r=r+s|0}while(--o);s%=65521,r%=65521}return s|r<<16|0};const nw=new Uint32Array((()=>{let t,e=[];for(var i=0;i<256;i++){t=i;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e})());var sw=(t,e,i,n)=>{const s=nw,r=n+i;t^=-1;for(let i=n;i>>8^s[255&(t^e[i])];return-1^t},rw={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},ow={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:aw,_tr_stored_block:lw,_tr_flush_block:hw,_tr_tally:cw,_tr_align:uw}=wb,dw=iw,fw=sw,pw=rw,{Z_NO_FLUSH:Ow,Z_PARTIAL_FLUSH:gw,Z_FULL_FLUSH:mw,Z_FINISH:bw,Z_BLOCK:ww,Z_OK:vw,Z_STREAM_END:yw,Z_STREAM_ERROR:Sw,Z_DATA_ERROR:xw,Z_BUF_ERROR:kw,Z_DEFAULT_COMPRESSION:Qw,Z_FILTERED:$w,Z_HUFFMAN_ONLY:Pw,Z_RLE:Cw,Z_FIXED:_w,Z_DEFAULT_STRATEGY:Xw,Z_UNKNOWN:Zw,Z_DEFLATED:Aw}=ow,Tw=258,Rw=262,Ew=42,Vw=113,Mw=666,Dw=(t,e)=>(t.msg=pw[e],e),Ww=t=>2*t-(t>4?9:0),Uw=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Yw=t=>{let e,i,n,s=t.w_size;e=t.hash_size,n=e;do{i=t.head[--n],t.head[n]=i>=s?i-s:0}while(--e);e=s,n=e;do{i=t.prev[--n],t.prev[n]=i>=s?i-s:0}while(--e)};let qw=(t,e,i)=>(e<{const e=t.state;let i=e.pending;i>t.avail_out&&(i=t.avail_out),0!==i&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+i),t.next_out),t.next_out+=i,e.pending_out+=i,t.total_out+=i,t.avail_out-=i,e.pending-=i,0===e.pending&&(e.pending_out=0))},zw=(t,e)=>{hw(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Lw(t.strm)},Iw=(t,e)=>{t.pending_buf[t.pending++]=e},Bw=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},jw=(t,e,i,n)=>{let s=t.avail_in;return s>n&&(s=n),0===s?0:(t.avail_in-=s,e.set(t.input.subarray(t.next_in,t.next_in+s),i),1===t.state.wrap?t.adler=dw(t.adler,e,s,i):2===t.state.wrap&&(t.adler=fw(t.adler,e,s,i)),t.next_in+=s,t.total_in+=s,s)},Nw=(t,e)=>{let i,n,s=t.max_chain_length,r=t.strstart,o=t.prev_length,a=t.nice_match;const l=t.strstart>t.w_size-Rw?t.strstart-(t.w_size-Rw):0,h=t.window,c=t.w_mask,u=t.prev,d=t.strstart+Tw;let f=h[r+o-1],p=h[r+o];t.prev_length>=t.good_match&&(s>>=2),a>t.lookahead&&(a=t.lookahead);do{if(i=e,h[i+o]===p&&h[i+o-1]===f&&h[i]===h[r]&&h[++i]===h[r+1]){r+=2,i++;do{}while(h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&ro){if(t.match_start=e,o=n,n>=a)break;f=h[r+o-1],p=h[r+o]}}}while((e=u[e&c])>l&&0!=--s);return o<=t.lookahead?o:t.lookahead},Gw=t=>{const e=t.w_size;let i,n,s;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Rw)&&(t.window.set(t.window.subarray(e,e+e-n),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Yw(t),n+=e),0===t.strm.avail_in)break;if(i=jw(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=i,t.lookahead+t.insert>=3)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=qw(t,t.ins_h,t.window[s+1]);t.insert&&(t.ins_h=qw(t,t.ins_h,t.window[s+3-1]),t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead{let i,n,s,r=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,o=0,a=t.strm.avail_in;do{if(i=65535,s=t.bi_valid+42>>3,t.strm.avail_outn+t.strm.avail_in&&(i=n+t.strm.avail_in),i>s&&(i=s),i>8,t.pending_buf[t.pending-2]=~i,t.pending_buf[t.pending-1]=~i>>8,Lw(t.strm),n&&(n>i&&(n=i),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+n),t.strm.next_out),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n,t.block_start+=n,i-=n),i&&(jw(t.strm,t.strm.output,t.strm.next_out,i),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i)}while(0===o);return a-=t.strm.avail_in,a&&(a>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=a&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-a,t.strm.next_in),t.strstart),t.strstart+=a,t.insert+=a>t.w_size-t.insert?t.w_size-t.insert:a),t.block_start=t.strstart),t.high_waters&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,s+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),s>t.strm.avail_in&&(s=t.strm.avail_in),s&&(jw(t.strm,t.window,t.strstart,s),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.high_water>3,s=t.pending_buf_size-s>65535?65535:t.pending_buf_size-s,r=s>t.w_size?t.w_size:s,n=t.strstart-t.block_start,(n>=r||(n||e===bw)&&e!==Ow&&0===t.strm.avail_in&&n<=s)&&(i=n>s?s:n,o=e===bw&&0===t.strm.avail_in&&i===n?1:0,lw(t,t.block_start,i,o),t.block_start+=i,Lw(t.strm)),o?3:1)},Hw=(t,e)=>{let i,n;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==i&&t.strstart-i<=t.w_size-Rw&&(t.match_length=Nw(t,i)),t.match_length>=3)if(n=cw(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=qw(t,t.ins_h,t.window[t.strstart+1]);else n=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2},Jw=(t,e)=>{let i,n,s;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==i&&t.prev_length4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){s=t.strstart+t.lookahead-3,n=cw(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=s&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(zw(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(n=cw(t,0,t.window[t.strstart-1]),n&&zw(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=cw(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2};function Kw(t,e,i,n,s){this.good_length=t,this.max_lazy=e,this.nice_length=i,this.max_chain=n,this.func=s}const tv=[new Kw(0,0,0,0,Fw),new Kw(4,4,8,4,Hw),new Kw(4,5,16,8,Hw),new Kw(4,6,32,32,Hw),new Kw(4,4,16,16,Jw),new Kw(8,16,32,32,Jw),new Kw(8,16,128,128,Jw),new Kw(8,32,128,256,Jw),new Kw(32,128,258,1024,Jw),new Kw(32,258,258,4096,Jw)];function ev(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Aw,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Uw(this.dyn_ltree),Uw(this.dyn_dtree),Uw(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Uw(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Uw(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const iv=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==Ew&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==Vw&&e.status!==Mw?1:0},nv=t=>{if(iv(t))return Dw(t,Sw);t.total_in=t.total_out=0,t.data_type=Zw;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?Ew:Vw,t.adler=2===e.wrap?0:1,e.last_flush=-2,aw(e),vw},sv=t=>{const e=nv(t);var i;return e===vw&&((i=t.state).window_size=2*i.w_size,Uw(i.head),i.max_lazy_match=tv[i.level].max_lazy,i.good_match=tv[i.level].good_length,i.nice_match=tv[i.level].nice_length,i.max_chain_length=tv[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=2,i.match_available=0,i.ins_h=0),e},rv=(t,e,i,n,s,r)=>{if(!t)return Sw;let o=1;if(e===Qw&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),s<1||s>9||i!==Aw||n<8||n>15||e<0||e>9||r<0||r>_w||8===n&&1!==o)return Dw(t,Sw);8===n&&(n=9);const a=new ev;return t.state=a,a.strm=t,a.status=Ew,a.wrap=o,a.gzhead=null,a.w_bits=n,a.w_size=1<rv(t,e,Aw,15,8,Xw),bb.deflateInit2=rv,bb.deflateReset=sv,bb.deflateResetKeep=nv,bb.deflateSetHeader=(t,e)=>iv(t)||2!==t.state.wrap?Sw:(t.state.gzhead=e,vw),bb.deflate=(t,e)=>{if(iv(t)||e>ww||e<0)return t?Dw(t,Sw):Sw;const i=t.state;if(!t.output||0!==t.avail_in&&!t.input||i.status===Mw&&e!==bw)return Dw(t,0===t.avail_out?kw:Sw);const n=i.last_flush;if(i.last_flush=e,0!==i.pending){if(Lw(t),0===t.avail_out)return i.last_flush=-1,vw}else if(0===t.avail_in&&Ww(e)<=Ww(n)&&e!==bw)return Dw(t,kw);if(i.status===Mw&&0!==t.avail_in)return Dw(t,kw);if(i.status===Ew&&0===i.wrap&&(i.status=Vw),i.status===Ew){let e=Aw+(i.w_bits-8<<4)<<8,n=-1;if(n=i.strategy>=Pw||i.level<2?0:i.level<6?1:6===i.level?2:3,e|=n<<6,0!==i.strstart&&(e|=32),e+=31-e%31,Bw(i,e),0!==i.strstart&&(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),t.adler=1,i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(57===i.status)if(t.adler=0,Iw(i,31),Iw(i,139),Iw(i,8),i.gzhead)Iw(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),Iw(i,255&i.gzhead.time),Iw(i,i.gzhead.time>>8&255),Iw(i,i.gzhead.time>>16&255),Iw(i,i.gzhead.time>>24&255),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(Iw(i,255&i.gzhead.extra.length),Iw(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=fw(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if(Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,3),i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw;if(69===i.status){if(i.gzhead.extra){let e=i.pending,n=(65535&i.gzhead.extra.length)-i.gzindex;for(;i.pending+n>i.pending_buf_size;){let s=i.pending_buf_size-i.pending;if(i.pending_buf.set(i.gzhead.extra.subarray(i.gzindex,i.gzindex+s),i.pending),i.pending=i.pending_buf_size,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex+=s,Lw(t),0!==i.pending)return i.last_flush=-1,vw;e=0,n-=s}let s=new Uint8Array(i.gzhead.extra);i.pending_buf.set(s.subarray(i.gzindex,i.gzindex+n),i.pending),i.pending+=n,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex=0}i.status=73}if(73===i.status){if(i.gzhead.name){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),i.gzindex=0}i.status=91}if(91===i.status){if(i.gzhead.comment){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n))}i.status=103}if(103===i.status){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size&&(Lw(t),0!==i.pending))return i.last_flush=-1,vw;Iw(i,255&t.adler),Iw(i,t.adler>>8&255),t.adler=0}if(i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(0!==t.avail_in||0!==i.lookahead||e!==Ow&&i.status!==Mw){let n=0===i.level?Fw(i,e):i.strategy===Pw?((t,e)=>{let i;for(;;){if(0===t.lookahead&&(Gw(t),0===t.lookahead)){if(e===Ow)return 1;break}if(t.match_length=0,i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):i.strategy===Cw?((t,e)=>{let i,n,s,r;const o=t.window;for(;;){if(t.lookahead<=Tw){if(Gw(t),t.lookahead<=Tw&&e===Ow)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(s=t.strstart-1,n=o[s],n===o[++s]&&n===o[++s]&&n===o[++s])){r=t.strstart+Tw;do{}while(n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&st.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(i=cw(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):tv[i.level].func(i,e);if(3!==n&&4!==n||(i.status=Mw),1===n||3===n)return 0===t.avail_out&&(i.last_flush=-1),vw;if(2===n&&(e===gw?uw(i):e!==ww&&(lw(i,0,0,!1),e===mw&&(Uw(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),Lw(t),0===t.avail_out))return i.last_flush=-1,vw}return e!==bw?vw:i.wrap<=0?yw:(2===i.wrap?(Iw(i,255&t.adler),Iw(i,t.adler>>8&255),Iw(i,t.adler>>16&255),Iw(i,t.adler>>24&255),Iw(i,255&t.total_in),Iw(i,t.total_in>>8&255),Iw(i,t.total_in>>16&255),Iw(i,t.total_in>>24&255)):(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),Lw(t),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?vw:yw)},bb.deflateEnd=t=>{if(iv(t))return Sw;const e=t.state.status;return t.state=null,e===Vw?Dw(t,xw):vw},bb.deflateSetDictionary=(t,e)=>{let i=e.length;if(iv(t))return Sw;const n=t.state,s=n.wrap;if(2===s||1===s&&n.status!==Ew||n.lookahead)return Sw;if(1===s&&(t.adler=dw(t.adler,e,i,0)),n.wrap=0,i>=n.w_size){0===s&&(Uw(n.head),n.strstart=0,n.block_start=0,n.insert=0);let t=new Uint8Array(n.w_size);t.set(e.subarray(i-n.w_size,i),0),e=t,i=n.w_size}const r=t.avail_in,o=t.next_in,a=t.input;for(t.avail_in=i,t.next_in=0,t.input=e,Gw(n);n.lookahead>=3;){let t=n.strstart,e=n.lookahead-2;do{n.ins_h=qw(n,n.ins_h,n.window[t+3-1]),n.prev[t&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=t,t++}while(--e);n.strstart=t,n.lookahead=2,Gw(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,t.next_in=o,t.input=a,t.avail_in=r,n.wrap=s,vw},bb.deflateInfo="pako deflate (from Nodeca project)";var ov={};const av=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);ov.assign=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const e in i)av(i,e)&&(t[e]=i[e])}}return t},ov.flattenChunks=t=>{let e=0;for(let i=0,n=t.length;i=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;cv[254]=cv[254]=1,lv.string2buf=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,i,n,s,r,o=t.length,a=0;for(s=0;s>>6,e[r++]=128|63&i):i<65536?(e[r++]=224|i>>>12,e[r++]=128|i>>>6&63,e[r++]=128|63&i):(e[r++]=240|i>>>18,e[r++]=128|i>>>12&63,e[r++]=128|i>>>6&63,e[r++]=128|63&i);return e};lv.buf2string=(t,e)=>{const i=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let n,s;const r=new Array(2*i);for(s=0,n=0;n4)r[s++]=65533,n+=o-1;else{for(e&=2===o?31:3===o?15:7;o>1&&n1?r[s++]=65533:e<65536?r[s++]=e:(e-=65536,r[s++]=55296|e>>10&1023,r[s++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&hv)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let i="";for(let n=0;n{(e=e||t.length)>t.length&&(e=t.length);let i=e-1;for(;i>=0&&128==(192&t[i]);)i--;return i<0||0===i?e:i+cv[t[i]]>e?i:e};var uv=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const dv=bb,fv=ov,pv=lv,Ov=rw,gv=uv,mv=Object.prototype.toString,{Z_NO_FLUSH:bv,Z_SYNC_FLUSH:wv,Z_FULL_FLUSH:vv,Z_FINISH:yv,Z_OK:Sv,Z_STREAM_END:xv,Z_DEFAULT_COMPRESSION:kv,Z_DEFAULT_STRATEGY:Qv,Z_DEFLATED:$v}=ow;function Pv(t){this.options=fv.assign({level:kv,method:$v,chunkSize:16384,windowBits:15,memLevel:8,strategy:Qv},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new gv,this.strm.avail_out=0;let i=dv.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(i!==Sv)throw new Error(Ov[i]);if(e.header&&dv.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?pv.string2buf(e.dictionary):"[object ArrayBuffer]"===mv.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,i=dv.deflateSetDictionary(this.strm,t),i!==Sv)throw new Error(Ov[i]);this._dict_set=!0}}function Cv(t,e){const i=new Pv(e);if(i.push(t,!0),i.err)throw i.msg||Ov[i.err];return i.result}Pv.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize;let s,r;if(this.ended)return!1;for(r=e===~~e?e:!0===e?yv:bv,"string"==typeof t?i.input=pv.string2buf(t):"[object ArrayBuffer]"===mv.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),(r===wv||r===vv)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(s=dv.deflate(i,r),s===xv)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),s=dv.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===Sv;if(0!==i.avail_out){if(r>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},Pv.prototype.onData=function(t){this.chunks.push(t)},Pv.prototype.onEnd=function(t){t===Sv&&(this.result=fv.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},mb.Deflate=Pv,mb.deflate=Cv,mb.deflateRaw=function(t,e){return(e=e||{}).raw=!0,Cv(t,e)},mb.gzip=function(t,e){return(e=e||{}).gzip=!0,Cv(t,e)},mb.constants=ow;var _v={},Xv={};const Zv=16209;const Av=15,Tv=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Rv=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Ev=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Vv=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Mv=(t,e,i,n,s,r,o,a)=>{const l=a.bits;let h,c,u,d,f,p,O=0,g=0,m=0,b=0,w=0,v=0,y=0,S=0,x=0,k=0,Q=null;const $=new Uint16Array(16),P=new Uint16Array(16);let C,_,X,Z=null;for(O=0;O<=Av;O++)$[O]=0;for(g=0;g=1&&0===$[b];b--);if(w>b&&(w=b),0===b)return s[r++]=20971520,s[r++]=20971520,a.bits=1,0;for(m=1;m0&&(0===t||1!==b))return-1;for(P[1]=0,O=1;O852||2===t&&x>592)return 1;for(;;){C=O-y,o[g]+1=p?(_=Z[o[g]-p],X=Q[o[g]-p]):(_=96,X=0),h=1<>y)+c]=C<<24|_<<16|X|0}while(0!==c);for(h=1<>=1;if(0!==h?(k&=h-1,k+=h):k=0,g++,0==--$[O]){if(O===b)break;O=e[i+o[g]]}if(O>w&&(k&d)!==u){for(0===y&&(y=w),f+=m,v=O-y,S=1<852||2===t&&x>592)return 1;u=k&d,s[u]=w<<24|v<<16|f-r|0}}return 0!==k&&(s[f+k]=O-y<<24|64<<16|0),a.bits=w,0};const Dv=iw,Wv=sw,Uv=function(t,e){let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,y,S,x,k,Q;const $=t.state;i=t.next_in,k=t.input,n=i+(t.avail_in-5),s=t.next_out,Q=t.output,r=s-(e-t.avail_out),o=s+(t.avail_out-257),a=$.dmax,l=$.wsize,h=$.whave,c=$.wnext,u=$.window,d=$.hold,f=$.bits,p=$.lencode,O=$.distcode,g=(1<<$.lenbits)-1,m=(1<<$.distbits)-1;t:do{f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,0===w)Q[s++]=65535&b;else{if(!(16&w)){if(0==(64&w)){b=p[(65535&b)+(d&(1<>>=w,f-=w),f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,!(16&w)){if(0==(64&w)){b=O[(65535&b)+(d&(1<a){t.msg="invalid distance too far back",$.mode=Zv;break t}if(d>>>=w,f-=w,w=s-r,y>w){if(w=y-w,w>h&&$.sane){t.msg="invalid distance too far back",$.mode=Zv;break t}if(S=0,x=u,0===c){if(S+=l-w,w2;)Q[s++]=x[S++],Q[s++]=x[S++],Q[s++]=x[S++],v-=3;v&&(Q[s++]=x[S++],v>1&&(Q[s++]=x[S++]))}else{S=s-y;do{Q[s++]=Q[S++],Q[s++]=Q[S++],Q[s++]=Q[S++],v-=3}while(v>2);v&&(Q[s++]=Q[S++],v>1&&(Q[s++]=Q[S++]))}break}}break}}while(i>3,i-=v,f-=v<<3,d&=(1<(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function hy(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const cy=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode16211?1:0},uy=t=>{if(cy(t))return Nv;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Kv,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,Iv},dy=t=>{if(cy(t))return Nv;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,uy(t)},fy=(t,e)=>{let i;if(cy(t))return Nv;const n=t.state;return e<0?(i=0,e=-e):(i=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?Nv:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=i,n.wbits=e,dy(t))},py=(t,e)=>{if(!t)return Nv;const i=new hy;t.state=i,i.strm=t,i.window=null,i.mode=Kv;const n=fy(t,e);return n!==Iv&&(t.state=null),n};let Oy,gy,my=!0;const by=t=>{if(my){Oy=new Int32Array(512),gy=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Yv(1,t.lens,0,288,Oy,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Yv(2,t.lens,0,32,gy,0,t.work,{bits:5}),my=!1}t.lencode=Oy,t.lenbits=9,t.distcode=gy,t.distbits=5},wy=(t,e,i,n)=>{let s;const r=t.state;return null===r.window&&(r.wsize=1<=r.wsize?(r.window.set(e.subarray(i-r.wsize,i),0),r.wnext=0,r.whave=r.wsize):(s=r.wsize-r.wnext,s>n&&(s=n),r.window.set(e.subarray(i-n,i-n+s),r.wnext),(n-=s)?(r.window.set(e.subarray(i-n,i),0),r.wnext=n,r.whave=r.wsize):(r.wnext+=s,r.wnext===r.wsize&&(r.wnext=0),r.whavepy(t,15),Xv.inflateInit2=py,Xv.inflate=(t,e)=>{let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,y,S,x,k=0;const Q=new Uint8Array(4);let $,P;const C=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(cy(t)||!t.output||!t.input&&0!==t.avail_in)return Nv;i=t.state,i.mode===ey&&(i.mode=iy),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,u=a,d=l,x=Iv;t:for(;;)switch(i.mode){case Kv:if(0===i.wrap){i.mode=iy;break}for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0),h=0,c=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",i.mode=ay;break}if((15&h)!==Jv){t.msg="unknown compression method",i.mode=ay;break}if(h>>>=4,c-=4,S=8+(15&h),0===i.wbits&&(i.wbits=S),S>15||S>i.wbits){t.msg="invalid window size",i.mode=ay;break}i.dmax=1<>8&1),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16182;case 16182:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>8&255,Q[2]=h>>>16&255,Q[3]=h>>>24&255,i.check=Wv(i.check,Q,4,0)),h=0,c=0,i.mode=16183;case 16183:for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>8),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16184;case 16184:if(1024&i.flags){for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(f=i.length,f>a&&(f=a),f&&(i.head&&(S=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(n.subarray(r,r+f),S)),512&i.flags&&4&i.wrap&&(i.check=Wv(i.check,n,f,r)),a-=f,r+=f,i.length-=f),i.length))break t;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===a)break t;f=0;do{S=n[r+f++],i.head&&S&&i.length<65536&&(i.head.name+=String.fromCharCode(S))}while(S&&f>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=ey;break;case 16189:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>=7&c,c-=7&c,i.mode=oy;break}for(;c<3;){if(0===a)break t;a--,h+=n[r++]<>>=1,c-=1,3&h){case 0:i.mode=16193;break;case 1:if(by(i),i.mode=sy,e===zv){h>>>=2,c-=2;break t}break;case 2:i.mode=16196;break;case 3:t.msg="invalid block type",i.mode=ay}h>>>=2,c-=2;break;case 16193:for(h>>>=7&c,c-=7&c;c<32;){if(0===a)break t;a--,h+=n[r++]<>>16^65535)){t.msg="invalid stored block lengths",i.mode=ay;break}if(i.length=65535&h,h=0,c=0,i.mode=ny,e===zv)break t;case ny:i.mode=16195;case 16195:if(f=i.length,f){if(f>a&&(f=a),f>l&&(f=l),0===f)break t;s.set(n.subarray(r,r+f),o),a-=f,r+=f,l-=f,o+=f,i.length-=f;break}i.mode=ey;break;case 16196:for(;c<14;){if(0===a)break t;a--,h+=n[r++]<>>=5,c-=5,i.ndist=1+(31&h),h>>>=5,c-=5,i.ncode=4+(15&h),h>>>=4,c-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=ay;break}i.have=0,i.mode=16197;case 16197:for(;i.have>>=3,c-=3}for(;i.have<19;)i.lens[C[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,$={bits:i.lenbits},x=Yv(0,i.lens,0,19,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid code lengths set",i.mode=ay;break}i.have=0,i.mode=16198;case 16198:for(;i.have>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=g,c-=g,i.lens[i.have++]=b;else{if(16===b){for(P=g+2;c>>=g,c-=g,0===i.have){t.msg="invalid bit length repeat",i.mode=ay;break}S=i.lens[i.have-1],f=3+(3&h),h>>>=2,c-=2}else if(17===b){for(P=g+3;c>>=g,c-=g,S=0,f=3+(7&h),h>>>=3,c-=3}else{for(P=g+7;c>>=g,c-=g,S=0,f=11+(127&h),h>>>=7,c-=7}if(i.have+f>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=ay;break}for(;f--;)i.lens[i.have++]=S}}if(i.mode===ay)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=ay;break}if(i.lenbits=9,$={bits:i.lenbits},x=Yv(1,i.lens,0,i.nlen,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid literal/lengths set",i.mode=ay;break}if(i.distbits=6,i.distcode=i.distdyn,$={bits:i.distbits},x=Yv(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,$),i.distbits=$.bits,x){t.msg="invalid distances set",i.mode=ay;break}if(i.mode=sy,e===zv)break t;case sy:i.mode=ry;case ry:if(a>=6&&l>=258){t.next_out=o,t.avail_out=l,t.next_in=r,t.avail_in=a,i.hold=h,i.bits=c,Uv(t,d),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,i.mode===ey&&(i.back=-1);break}for(i.back=0;k=i.lencode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,i.length=b,0===m){i.mode=16205;break}if(32&m){i.back=-1,i.mode=ey;break}if(64&m){t.msg="invalid literal/length code",i.mode=ay;break}i.extra=15&m,i.mode=16201;case 16201:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;k=i.distcode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,64&m){t.msg="invalid distance code",i.mode=ay;break}i.offset=b,i.extra=15&m,i.mode=16203;case 16203:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=ay;break}i.mode=16204;case 16204:if(0===l)break t;if(f=d-l,i.offset>f){if(f=i.offset-f,f>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=ay;break}f>i.wnext?(f-=i.wnext,p=i.wsize-f):p=i.wnext-f,f>i.length&&(f=i.length),O=i.window}else O=s,p=o-i.offset,f=i.length;f>l&&(f=l),l-=f,i.length-=f;do{s[o++]=O[p++]}while(--f);0===i.length&&(i.mode=ry);break;case 16205:if(0===l)break t;s[o++]=i.length,l--,i.mode=ry;break;case oy:if(i.wrap){for(;c<32;){if(0===a)break t;a--,h|=n[r++]<{if(cy(t))return Nv;let e=t.state;return e.window&&(e.window=null),t.state=null,Iv},Xv.inflateGetHeader=(t,e)=>{if(cy(t))return Nv;const i=t.state;return 0==(2&i.wrap)?Nv:(i.head=e,e.done=!1,Iv)},Xv.inflateSetDictionary=(t,e)=>{const i=e.length;let n,s,r;return cy(t)?Nv:(n=t.state,0!==n.wrap&&n.mode!==ty?Nv:n.mode===ty&&(s=1,s=Dv(s,e,i,0),s!==n.check)?Gv:(r=wy(t,e,i,i),r?(n.mode=16210,Fv):(n.havedict=1,Iv)))},Xv.inflateInfo="pako inflate (from Nodeca project)";const vy=Xv,yy=ov,Sy=lv,xy=rw,ky=uv,Qy=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},$y=Object.prototype.toString,{Z_NO_FLUSH:Py,Z_FINISH:Cy,Z_OK:_y,Z_STREAM_END:Xy,Z_NEED_DICT:Zy,Z_STREAM_ERROR:Ay,Z_DATA_ERROR:Ty,Z_MEM_ERROR:Ry}=ow;function Ey(t){this.options=yy.assign({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ky,this.strm.avail_out=0;let i=vy.inflateInit2(this.strm,e.windowBits);if(i!==_y)throw new Error(xy[i]);if(this.header=new Qy,vy.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=Sy.string2buf(e.dictionary):"[object ArrayBuffer]"===$y.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(i=vy.inflateSetDictionary(this.strm,e.dictionary),i!==_y)))throw new Error(xy[i])}function Vy(t,e){const i=new Ey(e);if(i.push(t),i.err)throw i.msg||xy[i.err];return i.result}Ey.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize,s=this.options.dictionary;let r,o,a;if(this.ended)return!1;for(o=e===~~e?e:!0===e?Cy:Py,"[object ArrayBuffer]"===$y.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),r=vy.inflate(i,o),r===Zy&&s&&(r=vy.inflateSetDictionary(i,s),r===_y?r=vy.inflate(i,o):r===Ty&&(r=Zy));i.avail_in>0&&r===Xy&&i.state.wrap>0&&0!==t[i.next_in];)vy.inflateReset(i),r=vy.inflate(i,o);switch(r){case Ay:case Ty:case Zy:case Ry:return this.onEnd(r),this.ended=!0,!1}if(a=i.avail_out,i.next_out&&(0===i.avail_out||r===Xy))if("string"===this.options.to){let t=Sy.utf8border(i.output,i.next_out),e=i.next_out-t,s=Sy.buf2string(i.output,t);i.next_out=e,i.avail_out=n-e,e&&i.output.set(i.output.subarray(t,t+e),0),this.onData(s)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(r!==_y||0!==a){if(r===Xy)return r=vy.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},Ey.prototype.onData=function(t){this.chunks.push(t)},Ey.prototype.onEnd=function(t){t===_y&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=yy.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},_v.Inflate=Ey,_v.inflate=Vy,_v.inflateRaw=function(t,e){return(e=e||{}).raw=!0,Vy(t,e)},_v.ungzip=Vy,_v.constants=ow;const{Deflate:My,deflate:Dy,deflateRaw:Wy,gzip:Uy}=mb,{Inflate:Yy,inflate:qy,inflateRaw:Ly,ungzip:zy}=_v,Iy=ow;gb.Deflate=My,gb.deflate=Dy,gb.deflateRaw=Wy,gb.gzip=Uy,gb.Inflate=Yy,gb.inflate=qy,gb.inflateRaw=Ly,gb.ungzip=zy,gb.constants=Iy;const By=gb;let jy={};var Ny;function Gy(t){return Ny=t,[tS]}jy.Util={},jy.Decode={},jy.Messages=[],jy.Log=function(t){jy.Messages.push(["I",t]),console.log("Mma.js INFO: ",t)},jy.Warn=function(t){jy.Messages.push(["W",t]),console.log("Mma.js WARNING: ",t)},jy.Fail=function(t){throw jy.Messages.push(["E",t]),"Mma.js ERROR: "+t},jy.Util.Base64Decode=function(t){for(var e=atob(t),i=e.length>>>0,n=new Uint8Array(i),s=0;s1&&0===t[0]&&jy.Fail("IntegerAP: input starts with 0: "+String(t)),this.nstring=t}else void 0===t?this.nstring=void 0:jy.Fail("Integer: invalid input: "+String(t))},jy.RealMP=function(t){"number"==typeof t?this.n=t:void 0===t?this.n=void 0:jy.Fail("RealMP: invalid input")},jy.RealAP=function(t){"string"==typeof t?(t.length>1&&0===t[0]&&jy.Fail("RealAP: input starts with 0: "+String(t)),this.nstring=t):void 0===t?this.nstring=void 0:jy.Fail("RealAP: invalid input: "+String(t))},jy.Symbol=function(t){"string"==typeof t?this.name=t:void 0===t?this.name=void 0:jy.Fail("Symbol: invalid input: "+String(t))},jy.String=function(t){"string"==typeof t?this.str=t:void 0===t?this.str=void 0:jy.Fail("String: invalid input: "+String(t))},jy.Expression=function(t,e){t instanceof jy.Symbol||jy.Fail("Expression: head must be an Mma.Symbol"),e instanceof Array||jy.Fail("Expression: parts must be an Array"),this.head=t,this.parts=e},jy.Decode.Int32=function(t,e){try{return new DataView(t.buffer).getInt32(e,!0)}catch(t){return 0}},jy.Decode.Float64=function(t,e){try{return new DataView(t.buffer).getFloat64(e,!0)}catch(t){return 0}},jy.Decode.String=function(t,e,i){return void 0===e&&(e=0),void 0===i&&(i=t.length),jy.Util.U8ArrayToString(t.slice(e,e+i))},jy.Decode.StringEntry=function(t,e){void 0===e&&(e=0);var i=jy.Decode.Int32(t,e);return{length:i,string:jy.Decode.String(t,e+4,i),bytesRead:i+4}},jy.Decode.Any=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=1/0);var n=e;for(var s=0,r=[];ee%2!=0?t:{...t,body:Lm(t.body,/\(\*\|\*\)/gm)})),Array.isArray(this.args[this.args.length-1].body)||(this.decorator=this.args.pop());const r=this.args;console.log("creating InstanceWidget");for(let t=0;t{e.viewState.state.config.eval()},update:e=>this.applyChanges(e,t,i),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i-2>=0?(o[i-2].editor.dispatch({selection:{anchor:o[i-2].editor.state.doc.length}}),o[i-2].editor.focus(),void(t.editorLastCursor=void 0)):(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0));t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i+2=0)return r[t-2].body[i].editor.focus(),void(e.editorLastCursor=void 0)}},{key:"ArrowDown",run:function(e,n){if(t+2{},focus:()=>{},dispatch:()=>{}};const t=l.match(Fy);if(t){a.innerHTML=t[1];const e=jy.DecompressDecode(t[2]),i=jy.toArray(e.parts[0]),n=uuidv4();interpretate(i,{global:{call:n},element:a})}else a.innerHTML=l.slice(1,-1)}delete o[i].body,n.appendChild(a)}i.appendChild(n)}if(this.decorator){const t=jy.DecompressDecode(this.decorator.body.slice(2,-2)),e=jy.toArray(t.parts[0]);let n={global:{call:uuidv4(),EditorWidget:s},element:i};this.interpretated=interpretate(e,n)}}applyChanges(t,e,i){const n=this.args,s=this.args[e].body,r=this.visibleValue.argsPos,o=this.args[e].from;let a=t;0==i&&0==e&&(a="{{"+a),0==i&&0!=e&&(a="{"+a),i==s.length-1&&e==n.length-1&&(a+="}}"),i==s.length-1&&e!=n.length-1&&(a+="}");const l=s[i].length,h={from:r+o+s[i].from,to:r+o+s[i].from+l,insert:a},c=a.length-l;for(let t=i+1;t{s.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.args[0].body[0].editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.args[0].body[0].editor.focus();else{const t=this.DOMElement.EditorWidget.args,e=t[t.length-1].body[t[t.length-1].body.length-1].editor;e.dispatch({selection:{anchor:e.state.doc.length}}),e.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const Ky=(t,e)=>new Bm({tag:"GB",decoration:i=>ni.replace({widget:new Jy(i,t,e)})}),tS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=Ky(this.disposable,t).createDeco(t)}update(t){this.placeholder=Ky(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});function eS(t){return[rS]}let iS=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.span=i,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this,r=this.args[1].body.slice(3,-3),o=jy.DecompressDecode(r),a=jy.toArray(o.parts[0]);this.data=a;const l="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}));this.cuid=l;let h={call:l,EditorWidget:s},c={global:h,element:i};this.expression=a,this.env=c,this.interpretated=interpretate(a,c),this.interpretated.then((()=>{if(c.options?.Event){console.warn("Event listeners are enabled!"),s.events=c.options.Event;let t=c;if(h.stack){const e=Object.values(h.stack);e.length>0&&(console.log("Attaching first found instance..."),t=e[0].env)}interpretate(["MetaMarker","'"+l+"'"],t).then((()=>{server.kernel.emitt(s.events,'"'+l+'"',"Mounted")}))}}))}getDoc(){return this.args[0].body.slice(1,-1)}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+t+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].length=s.length,this.view.dispatch({changes:r})}applyOuterChanges(t){const e=this.visibleValue,i=t,n={from:e.pos,to:e.pos+e.length,insert:i};this.view.dispatch({changes:n})}update(t){if(!this.deactivated){if(t.str!=this.visibleValue.str){console.warn("Out of sync"),console.log("recreate..."),this.destroy();const e=this.span;return e.replaceChildren(),void this._construct(t,this.view,e)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}}destroy(t){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.events&&server.kernel.emitt(this.events,'"'+this.cuid+'"',"Destroy"),delete this.data}},nS=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=this;let i=document.createElement("span");return i.classList.add("frontend-view"),i.EditorWidget=new iS(this.visibleValue,t,i),this.reference.push({destroy:()=>{e.destroy(i)}}),i}ignoreEvent(){return!0}destroy(t){console.log("destroy in general*"),t.EditorWidget.destroy()}};const sS=(t,e)=>new Bm({tag:"VB",decoration:i=>ni.replace({widget:new nS(i,t,e)})}),rS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=sS(this.disposable,t).createDeco(t)}update(t){this.placeholder=sS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var oS;function aS(t){return oS=t,[uS]}let lS=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.span=i,this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this;this.epilog={offset:0,string:""},this.prolog={offset:0,string:""};const r=this.args[1].body.slice(3,-3),o=jy.DecompressDecode(r),a=jy.toArray(o.parts[0]);this.data=a;let l={global:{call:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)})),element:i,origin:s},element:i};this.env=l,interpretate(a,l).then((()=>{if(l.options?.Head&&(s.prolog.offset=l.options.Head.length+1,s.prolog.string=l.options.Head+"[",s.epilog.offset=1,s.epilog.string="]"),l.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=l.options.Event),l.options?.String){s.prolog.offset=1,s.prolog.string='"',s.epilog.offset=1,s.epilog.string='"',l.options?.HeadString&&(s.prolog.string=l.options.HeadString,s.prolog.offset=s.prolog.string.length),l.options?.TailString&&(s.epilog.string=l.options.TailString,s.epilog.offset=s.epilog.string.length),s.editor={destroy:()=>{console.log("Nothing to destroy, this is just a text field.")}};const t=document.createElement("span");return this.aa,t.onkeydown=function(t){13===t.keyCode&&t.preventDefault()},t.contentEditable="plaintext-only",t.innerText=s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),t.addEventListener("input",console.log),t.addEventListener("input",(()=>{console.log("Update"),console.log(t.innerText),this.applyChanges(t.innerText)})),l.global.element.appendChild(t),void(s.events&&server.kernel.emitt(s.events,"Null","Mounted"))}s.editor=oS({doc:s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),parent:l.global.element,update:t=>this.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos+s.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]}),s.events&&server.kernel.emitt(s.events,"Null","Mounted")}))}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+this.prolog.string+t+this.epilog.string+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length));const o=s.length-i[0].length;i[0].length=s.length,this.visibleValue.length=this.visibleValue.length+o,this.view.dispatch({changes:r})}update(t){if(this.visibleValue.str!=t.str)return console.warn("Out of sync"),console.log("recreating InstanceWidget"),this.destroy(),this.span.replaceChildren(),void this._construct(t,this.view,this.span);this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.editor.destroy(),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}},hS=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("subscript-tail"),e.EditorWidget=new lS(this.visibleValue,t,e,[]);const i=this;return this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const cS=(t,e)=>new Bm({tag:"BB",decoration:i=>ni.replace({widget:new hS(i,t,e)})}),uS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=cS(this.disposable,t).createDeco(t)}update(t){this.placeholder=cS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var dS;function fS(t){return dS=t,[mS]}class pS{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm);const s=this,r=Array.from({length:Math.ceil((s.args.length-3)/2)},((t,e)=>2*e+1));s.indexes=r;const o=[];this.span=i,this.spans=o;for(let t=0;t{c.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=c.options.Event),s.editors=r.map(((t,i)=>dS({doc:s.args[t].body,parent:o[i],update:e=>this.applyChanges(e,t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i>0?s.editors[i-1].focus():(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus()),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return it.destroy())),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}}class OS extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("inline-flex"),e.EditorWidget=new pS(this.visibleValue,t,e,[]);const i=this;return this.DOMElement=e,this.reference.push({destroy:()=>{i.destroy(e)}}),e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;const n=this.DOMElement.EditorWidget.editors;return t.from-e.from<0?(n[n.length-1].dispatch({selection:{anchor:n[n.length-1].state.doc.length}}),n[n.length-1].focus()):(n[0].dispatch({selection:{anchor:0}}),n[0].focus()),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}}const gS=(t,e)=>new Bm({tag:"TB",decoration:i=>ni.replace({widget:new OS(i,t,e)})}),mS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=gS(this.disposable,t).createDeco(t)}update(t){this.placeholder=gS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});const bS=_i.fromClass(class{decorations=ni.none;constructor(t){this.view=t,this.recompute()}recompute(t){let e,i,n=[];for(let{from:t,to:e}of this.view.visibleRanges)this.getDecorationsFor(t,e,n);this.decorations=ni.set(n,!0),this.decorations=this.decorations.update({filter:(n,s)=>!(n>e&&s=e&&s.selection.main.head<=i)return!0;if(!n&&s.selection.main.head>e&&s.selection.main.headt.decorations});class wS extends ei{constructor(t,e){super(),this.rawValue=t,this.visibleValue=e}eq(t){return this.rawValue===t.rawValue}toDOM(){let t=document.createElement("div");t.classList.add("cell-type-widget");const e=this.rawValue.split(" "),i=e[0].split(".");if(console.log(i),t.classList.add("cell-type-"+i[1].trim()),t.innerText=e[0].trim(),e.length>1){const n=e.slice(1),s=document.createElement("span");return s.appendChild(t),n.forEach((t=>{const e=document.createElement("span");e.innerText=t,e.classList.add("cell-type-"+i[1].trim()+"-"+t.split("=")[0]),s.appendChild(e)})),s}return t}ignoreEvent(){return!1}}const vS=new F,yS=new F,SS=[],xS=Sl.define([{tag:Sa.meta,color:"var(--editor-key-meta)"},{tag:Sa.link,textDecoration:"underline"},{tag:Sa.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Sa.emphasis,fontStyle:"italic"},{tag:Sa.strong,fontWeight:"bold"},{tag:Sa.strikethrough,textDecoration:"line-through"},{tag:Sa.keyword,color:"var(--editor-key-keyword)"},{tag:[Sa.atom,Sa.bool,Sa.url,Sa.contentSeparator,Sa.labelName],color:"var(--editor-key-atom)"},{tag:[Sa.literal,Sa.inserted],color:"var(--editor-key-literal)"},{tag:[Sa.string,Sa.deleted],color:"var(--editor-key-string)"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],color:"var(--editor-key-escape)"},{tag:Sa.definition(Sa.variableName),color:"var(--editor-key-variable)"},{tag:Sa.local(Sa.variableName),color:"var(--editor-local-variable)"},{tag:[Sa.typeName,Sa.namespace],color:"var(--editor-key-type)"},{tag:Sa.className,color:"var(--editor-key-class)"},{tag:[Sa.special(Sa.variableName),Sa.macroName],color:"var(--editor-special-variable)"},{tag:Sa.definition(Sa.propertyName),color:"var(--editor-key-property)"},{tag:Sa.comment,color:"var(--editor-key-comment)"},{tag:Sa.invalid,color:"var(--editor-key-invalid)"}]),kS={data:[],extend:t=>{kS.data.push(...t),Qm.reBuild(kS.data)},replaceAll:t=>{kS.data=t,Qm.reBuild(kS.data)}},QS=Gl.define({name:"spreadsheet",startState:function(){return{stringType:null,stack:[]}},token:function(t,e){if(t){switch(0===e.stack.length&&('"'!=t.peek()&&"'"!=t.peek()||(e.stringType=t.peek(),t.next(),e.stack.unshift("string"))),e.stack[0]){case"string":for(;"string"===e.stack[0]&&!t.eol();)t.peek()===e.stringType?(t.next(),e.stack.shift()):"\\"===t.peek()?(t.next(),t.next()):t.match(/^.[^\\\"\']*/);return"string";case"characterClass":for(;"characterClass"===e.stack[0]&&!t.eol();)t.match(/^[^\]\\]+/)||t.match(/^\\./)||e.stack.shift();return"operator"}var i=t.peek();switch(i){case"[":return t.next(),e.stack.unshift("characterClass"),"bracket";case":":return t.next(),"operator";case"\\":return t.match(/\\[a-z]+/)?"string.special":(t.next(),"atom");case".":case",":case";":case"*":case"-":case"+":case"^":case"<":case"/":case"=":return t.next(),"atom";case"$":return t.next(),"builtin"}return t.match(/\d+/)?t.match(/^\w+/)?"error":"number":t.match(/^[a-zA-Z_]\w*/)?t.match(/(?=[\(.])/,!1)?"keyword":"variable":-1!=["[","]","(",")","{","}"].indexOf(i)?(t.next(),"bracket"):(t.eatSpace()||t.next(),null)}}}),$S=new RegExp(/^[\w]*\.[\w]+/);function PS(t){const e=$S.exec(t),i=Object.values(window.SupportedLanguages);for(let t=0;t{if(!t.docChanged)return null;let e=PS(t.newDoc.line(1).text);if(e.legacy){const i=t.startState.facet(Wa);if(i){if(i.name==e.name)return null}else if(t.startState.facet(CS)==e.name)return null;return console.log("switching... to "+e.name),{effects:vS.reconfigure(e.plugins)}}return e.name===t.startState.facet(Wa).name?null:(console.log("switching... to "+e.name),{effects:vS.reconfigure(e.plugins)})}));let XS,ZS=null;const AS=t=>{const e=t||XS;return e&&e.viewState?(console.log(),PS(e.state.doc.line(1).text).name):""},TS=t=>{const e=t||XS;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return!1;const n=i[0];return[n.from,n.to]},RS=t=>{const e=t||XS;return e&&e.viewState?e.state.doc.toString():""},ES=t=>{const e=t||XS;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return"";const n=i[0];return console.log("yoko"),console.log(n),console.log(e.state.doc.toString().slice(n.from,n.to)),console.log("processing"),e.state.doc.toString().slice(n.from,n.to)},VS=(t,e)=>{const i=e||XS;if(!i)return;if(!i.viewState)return;const n=i.viewState.state.selection.ranges;if(!n.length)return;const s=n[0];console.log("result"),console.log(t),i.dispatch({changes:{...s,insert:t}})},MS=()=>XS,DS=(t,e)=>{const i=e||XS;i&&i.viewState&&(console.log("result"),console.log(t),i.dispatch({changes:{from:0,to:i.viewState.state.doc.length,insert:t}}))};ZS=t=>{let e=new Ts({doc:t.doc,extensions:[Ys.of([{key:"Tab",run:function(t,e){return sd(t)}},{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,LS,Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(XS=e.view)}))],parent:t.parent});return e.viewState.state.config.eval=t.eval,e},ZS.state=t=>{let e=xt.create({doc:t.doc,extensions:[Ys.of([{key:"Tab",run:function(t,e){return sd(t)}},{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,LS,Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(XS=e.view)}))]});return e.config.eval=t.eval,e};const WS={transaction:(t,e,i,n)=>{if(console.log(e.dom.ocellref),e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:DropEvent"]')}},file:(t,e,i,n,s)=>{console.log(e.dom.ocellref),e.dom.ocellref&&server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},US={transaction:(t,e,i,n)=>{if(console.log(e.dom.ocellref),e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:PasteEvent"]')}},file:(t,e,i,n,s)=>{console.log(e.dom.ocellref),e.dom.ocellref&&server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},YS=[Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Cm(WS,US)];let qS=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"}}),LS=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"},".cm-scroller":{"line-height":"inherit","overflow-x":"overlay","overflow-y":"overlay","align-items":"initial"},".cm-content":{padding:"0px 0"},".rainbow-bracket-red":{color:"var(--editor-bracket-1)"},".rainbow-bracket-orange":{color:"var(--editor-bracket-2)"},".rainbow-bracket-yellow":{color:"var(--editor-bracket-3)"},".rainbow-bracket-green":{color:"var(--editor-bracket-4)"},".rainbow-bracket-blue":{color:"var(--editor-bracket-5)"},".rainbow-bracket-indigo":{color:"var(--editor-bracket-6)"},".rainbow-bracket-violet":{color:"var(--editor-bracket-7)"},".rainbow-bracket-red > span":{color:"var(--editor-bracket-1-a)"},".rainbow-bracket-orange > span":{color:"var(--editor-bracket-2-a)"},".rainbow-bracket-yellow > span":{color:"var(--editor-bracket-3-a)"},".rainbow-bracket-green > span":{color:"var(--editor-bracket-4-a)"},".rainbow-bracket-blue > span":{color:"var(--editor-bracket-5-a)"},".rainbow-bracket-indigo > span":{color:"var(--editor-bracket-6-a)"},".rainbow-bracket-violet > span":{color:"var(--editor-bracket-7-a)"}}),zS=!1;const IS=[()=>vr(),()=>Sh(),()=>ir(),()=>dr(),()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xS,{fallback:!1}),()=>tu()],BS={},jS=[()=>vr(),()=>Sh(),()=>ir(),()=>dr(),t=>NS.of(t),()=>BS.gutter?function(t={}){return[eo.of(t),jr(),so]}():[],()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xS,{fallback:!1}),()=>tu(),()=>bS,()=>function(t){return _i.fromClass(class{constructor(e){this.view=e,this.placeholder=ni.set([ni.widget({widget:new kr(t),side:1}).range(0)])}get decorations(){return this.view.state.doc.length?ni.none:this.placeholder}},{decorations:t=>t.decorations})}("Type WL Expression / .md / .js"),()=>xt.allowMultipleSelections.of(!0),(t,e)=>vS.of(e),()=>yS.of(xt.readOnly.of(!1)),()=>_S,()=>{return t?[ou.of(t),Yu]:Yu;var t},(t,e)=>Ys.of([{key:"Tab",run:function(t,e){const i=sd(t);return i||Rc(t)},shift:Ec},{key:"Backspace",run:function(e,i){if(0===e.state.doc.length)return t.origin.remove(),!0}},{key:"ArrowLeft",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus prev"),t.origin.focusPrev(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus next"),t.origin.focusNext(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"Shift-Enter",preventDefault:!0,run:function(e,i){console.log(e.state.doc.toString()),t.origin.eval(e.state.doc.toString())}},...Vc,...Wh,...Ru]),(t,e)=>Ts.updateListener.of((e=>{e.docChanged&&t.origin.save(encodeURIComponent(e.state.doc.toString())),e.selectionSet&&(XS=e.view)})),()=>qS];const NS=E.define();function GS(t){return t.replace(/\\\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\\\:/g,""),16))})).replaceAll("\\:F74E","I").replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))}function FS(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(t=>(+t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+t/4).toString(16)))}core.ReadOnly=()=>"ReadOnly",core.EditorView=async(t,e)=>{let i=await interpretate(t[0],e);i=GS(i),console.log("UNICODE Disaster");const n=await core._getRules(t,e);let s=()=>{},r=()=>{},o=i;const a=[];n.ReadOnly&&a.push(xt.readOnly.of(!0)),n.ForceUpdate&&(e.local.forceUpdate=n.ForceUpdate),n.Event&&(r=t=>{o=t,console.log("editor view emitt data: "+t),server.kernel.emitt(n.Event,'"'+t.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Input")},s=()=>{server.kernel.emitt(n.Event,'"'+o.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Evaluate")}),e.local?e.local.editor=ZS({doc:i,parent:e.element,eval:s,update:r,extensions:a}):ZS({doc:i,parent:e.element,eval:s,update:r,extensions:a}),e.element.style.verticalAlign="inherit"},core.StripOnInput=async()=>{},core.EditorView.update=async(t,e)=>{if(!e.local.editor)return;const i=GS(await interpretate(t[0],e));console.log("editor view: dispatch"),e.local.forceUpdate,e.local.editor.dispatch({changes:{from:0,to:e.local.editor.state.doc.length,insert:i}})},core.EditorView.destroy=async(t,e)=>{await interpretate(t[0],e),e.local&&e.local.editor&&e.local.editor.destroy()},core.EditorView.virtual=!0,core.PreviewCell=(t,e)=>{},window.SupportedLanguages.push({check:t=>null===t,legacy:!0,plugins:YS,name:"mathematica"}),window.SupportedLanguages.push({check:t=>null!=t[0].match(/\w+\.(wl|wls)$/),plugins:YS,legacy:!0,name:"mathematica"}),window.SupportedCells.codemirror={view:class{origin={};editor={};trash=[];forceFocusNext(){zS=!0}focus(t){t>0?this.editor.dispatch({selection:{anchor:0}}):t<0&&this.editor.dispatch({selection:{anchor:this.editor.state.doc.length}}),this.editor.focus()}setContent(t){if(console.warn("content mutation!"),!this.editor.viewState)return;const e=this.editor;console.log("result"),console.log(t),this.editor.dispatch({changes:{from:0,to:e.viewState.state.doc.length,insert:t}})}addDisposable(t){this.trash.push(t)}dispose(){this.editor.destroy()}readOnly(t){this.editor.dispatch({effects:yS.reconfigure(xt.readOnly.of(t))})}constructor(t,e){this.origin=t;const i=this.origin,n=PS(e).plugins,s=this;this.origin.element.ocellref=s;const r=new Ts({doc:(o=e,o.replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))),extensions:jS.map((t=>t(s,n))),parent:this.origin.element});var o;return this.editor=r,this.editor.dom.ocellref=s,this.editor.viewState.state.config.eval=()=>{i.eval(this.editor.state.doc.toString())},zS&&r.focus(),zS=!1,this}},context:{EditorAutocomplete:kS,javascriptLanguage:qf,javascript:Nf,markdownLanguage:rm,markdown:function(t={}){let{codeLanguages:e,defaultCodeLanguage:i,addKeymap:n=!0,base:{parser:s}=sm}=t;if(!(s instanceof Zp))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let r,o=t.extensions?[t.extensions]:[],a=[dm.support];i instanceof Ua?(a.push(i.support),r=i.language):i&&(r=i);let l=e||r?(h=e,c=r,t=>{if(t&&h){let e=null;if(t=/\S*/.exec(t)[0],e="function"==typeof h?h(t):Ya.matchLanguageName(h,t,!0),e instanceof Ya)return e.support?e.support.language.parser:Ta.getSkippingParser(e.load());if(e)return e.parser}return c?c.parser:null}):void 0;var h,c;return o.push(function(t){let{codeParser:e,htmlParser:i}=t,n=Do(((t,n)=>{let s=t.type.id;if(!e||s!=Kf.CodeBlock&&s!=Kf.FencedCode){if(i&&(s==Kf.HTMLBlock||s==Kf.HTMLTag))return{parser:i,overlay:rO(t.node,t.from,t.to)}}else{let i="";if(s==Kf.FencedCode){let e=t.node.getChild(Kf.CodeInfo);e&&(i=n.read(e.from,e.to))}let r=e(i);if(r)return{parser:r,overlay:t=>t.type.id==Kf.CodeText}}return null}));return{wrap:n}}({codeParser:l,htmlParser:dm.language.parser})),n&&a.push(N.high(Ys.of(um))),new Ua(nm(s.configure(o)),a)},htmlLanguage:jg,html:Ng,cssLanguage:kg,css:Qg,EditorView:Ts,EditorState:xt,highlightSpecialChars:vr,syntaxHighlighting:$l,defaultHighlightStyle:xS,editorCustomTheme:qS,foldGutter:function(t={}){let e=Object.assign(Object.assign({},wl),t),i=new vl(e,!0),n=new vl(e,!1),s=_i.fromClass(class{constructor(t){this.from=t.viewport.from,this.markers=this.buildMarkers(t)}update(t){(t.docChanged||t.viewportChanged||t.startState.facet(Wa)!=t.state.facet(Wa)||t.startState.field(dl,!1)!=t.state.field(dl,!1)||Xa(t.startState)!=Xa(t.state)||e.foldingChanged(t))&&(this.markers=this.buildMarkers(t.view))}buildMarkers(t){let e=new Xt;for(let s of t.viewportLineBlocks){let r=fl(t.state,s.from,s.to)?n:ll(t.state,s.from,s.to)?i:null;r&&e.add(s.from,s.from,r)}return e.finish()}}),{domEventHandlers:r}=e;return[s,Ir({class:"cm-foldGutter",markers(t){var e;return(null===(e=t.plugin(s))||void 0===e?void 0:e.markers)||_t.empty},initialSpacer:()=>new vl(e,!1),domEventHandlers:Object.assign(Object.assign({},r),{click:(t,e,i)=>{if(r.click&&r.click(t,e,i))return!0;let n=fl(t.state,e.from,e.to);if(n)return t.dispatch({effects:ul.of(n)}),!0;let s=ll(t.state,e.from,e.to);return!!s&&(t.dispatch({effects:cl.of(s)}),!0)}})}),ml()]},Facet:E,Compartment:F,mathematicaPlugins:YS,legacyLangNameFacet:CS,DropPasteHandlers:Cm,EditorExtensionsMinimal:IS,EditorParameters:BS,EditorExtensions:jS,StateField:q,Decoration:ni,ViewPlugin:_i,WidgetType:ei,originFacet:NS,MatchDecorator:pr}},window.OfflineMode&&SS.push(xt.readOnly.of(!0)),core.CellView=async(t,e)=>{const i=await core._getRules(t,e);i.Display||(i.Display="codemirror");const n=await interpretate(t[0],e),s={element:e.element,uid:FS()};i.Style&&(e.element.style=i.Style),i.Class&&e.element.classList.add(...i.Class.split(" ")),i.ImageSize&&(Array.isArray(i.ImageSize)?(e.element.style.width=i.ImageSize[0]+"px",e.element.style.height=i.ImageSize[1]+"px"):e.element.style.width=i.ImageSize+"px"),new window.SupportedCells[i.Display].view(s,n)};const HS={};core.FrontEditorSelected=async(t,e)=>{console.log("check");const i=await interpretate(t[0],e),n=await core._getRules(t,e);let s;switch(n.Editor&&(s=HS[n.Editor],console.log("Editor"),console.log(n.Editor),console.log(s)),i){case"Get":return ES(s);case"Set":let i=await interpretate(t[1],e);VS(i,s);break;case"GetDoc":return RS(s);case"SetDoc":let n=await interpretate(t[1],e);DS(n,s);break;case"Cursor":return TS(s);case"Type":return AS(s);case"Editor":const r=FS();return HS[r]=MS(),r}}; diff --git a/libs/priceless-mathematica/src/mathematica/dropevents.js b/libs/priceless-mathematica/src/mathematica/dropevents.js index 15b9f3c..47b8e8d 100644 --- a/libs/priceless-mathematica/src/mathematica/dropevents.js +++ b/libs/priceless-mathematica/src/mathematica/dropevents.js @@ -14,6 +14,19 @@ import { }; + view.dom.loadingMark = true; + const originalColor = view.dom.style.background; + + let hue = 0; + + console.log('Start animation'); + + const loaderAnimation = setInterval(() => { + view.dom.style.setProperty("background", 'hsl('+hue+'deg 100% 97%)', "important"); + hue = hue + 2; + if (hue > 360) hue = 0; + }, 30); + progress(0); handler.transaction(ev, view, id, list.length); // server.kernel.emitt('', `<|"Id" -> "${id}", "Length" -> ${list.length}|>`, 'Transaction'); @@ -24,15 +37,51 @@ import { //server.kernel.emitt('id', `<|"Transaction" -> "${id}", "Name" -> "${name}", "Data" -> "${result}"|>`, 'File'); count++; progress(count); + if (count >= list.length && view.dom) { + if (view.dom.loadingMark) { + view.dom.loadingMark = false; + setTimeout(() => { + view.dom.style.background = originalColor; + clearInterval(loaderAnimation); + console.log('Stop animation'); + }, 2000); + } + } + }, () => { + console.warn('Fauilure'); + const original = view.dom.style.background; + view.dom.style.background = 'rgb(255 189 189 / 97%)'; + let opacity = 97; + const interval = setInterval(() => { + view.dom.style.background = 'rgb(255 189 189 / '+Math.round(opacity)+'%)'; + opacity = opacity * 0.95; + }, 30); + + + clearInterval(loaderAnimation); + + setTimeout(() => { + clearInterval(interval); + view.dom.style.background = original; + }, 3000); }) } } -function readFile(file, cbk) { +function readFile(file, cbk, fail) { const reader = new FileReader(); + reader.addEventListener('load', (event) => { - let compressedData = base64ArrayBuffer(event.target.result); + const payload = event.target.result; + if (payload.byteLength / 1024 / 1024 > 15) { + alert('Files > 15Mb are not supported for drag and drop'); + fail(); + return; + //throw 'Files > 15Mb are not supported for drag and drop'; + } + + let compressedData = base64ArrayBuffer(payload); //console.log(compressedData); cbk(file.name, compressedData); }); diff --git a/package.json b/package.json index 1fd2125..b955c57 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wljs-editor", - "version": "1.2.1", + "version": "1.2.2", "description": "WLJS Code editor", "scripts": { "build": "node --max-old-space-size=8192 ./node_modules/.bin/rollup --config rollup.config.mjs", diff --git a/src/AutocompleteDefaults.wl b/src/AutocompleteDefaults.wl index a58b0cd..b7474fd 100644 --- a/src/AutocompleteDefaults.wl +++ b/src/AutocompleteDefaults.wl @@ -1,4 +1,8 @@ -{<|"label"->"Differences", "type"->"keyword", "info"->"Differences[list] gives the successive differences, Differences[list, n], Differences[list, n, s]"|>, <|"label"->"Drop", "type"->"keyword", "info"->"Drop[list, n] gives list with its first n elements dropped."|>, <|"label"->"NotebookDirectory", "type"->"keyword", "info"->"NotebookDirectory[] returns a path to a directory of the current notebook"|>, <|"label"->"EvaluationCell", "type"->"keyword", "info"->"EvaluationCell[] returns a reference to the current input cell"|>, <|"label"->"SystemOpen", "type"->"keyword", "info"->"SystemOpen[path_String | _File | _URL] opens a path using system call"|>, <|"label" -> "Annotation", "type" -> "keyword", +{ + <|"label"->"ByteCount", "type"->"keyword", "info"->"ByteCount[expr] gives the number of bytes used internally by the Wolfram System"|>, + <|"label"->"Sum", "type"->"keyword", "info"->"Sum[f,{i,imax}] evaluates the sum. Sum[f,{i,imax, di}] with a step di"|>, + <|"label"->"Product", "type"->"keyword", "info"->"Product[f,{i,imax}] evaluates the product. Product[f,{i,imax, di}] with a step di"|>, + <|"label"->"Differences", "type"->"keyword", "info"->"Differences[list] gives the successive differences, Differences[list, n], Differences[list, n, s]"|>, <|"label"->"Drop", "type"->"keyword", "info"->"Drop[list, n] gives list with its first n elements dropped."|>, <|"label"->"NotebookDirectory", "type"->"keyword", "info"->"NotebookDirectory[] returns a path to a directory of the current notebook"|>, <|"label"->"EvaluationCell", "type"->"keyword", "info"->"EvaluationCell[] returns a reference to the current input cell"|>, <|"label"->"SystemOpen", "type"->"keyword", "info"->"SystemOpen[path_String | _File | _URL] opens a path using system call"|>, <|"label" -> "Annotation", "type" -> "keyword", "info" -> "Annotation[expr, data] annotates arbitary expression with data (invisible on output). Annotation[edge_, key_->value_] annotates edge of a graph"|>, <|"label" -> "Integrate", "type" -> "keyword", "info" -> "Integrate[f[x], x] gives the indefinite integral. Integrate[f[x], {x, min, max}] gives the definite integral..."|>, <|"label" -> "TableForm", "type" -> "keyword", "info" -> "TableForm[expr_List] formats list of lists as table"|>, <|"label" -> "Item", "type" -> "keyword", "info" -> "Use it inside Grid, TableForm to color or stylize font of expression. Accepts the same options as Style[]"|>, <|"label" -> "ToExpression", "type" -> "keyword", "info" -> "gives the expression obtained by interpreting strings as Wolfram \ Language input"|>, <|"label" -> "MakeBoxes", "type" -> "keyword", From cc5f10a0d4d18f3f604f828860bd7903179afd4e Mon Sep 17 00:00:00 2001 From: Kirill Vasin Date: Sun, 27 Oct 2024 20:11:58 +0100 Subject: [PATCH 06/26] fix output length --- package.json | 2 +- src/BoxesWorkarounds.wl | 6 +++--- src/Frontend.wl | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index b955c57..c679935 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wljs-editor", - "version": "1.2.2", + "version": "1.2.3", "description": "WLJS Code editor", "scripts": { "build": "node --max-old-space-size=8192 ./node_modules/.bin/rollup --config rollup.config.mjs", diff --git a/src/BoxesWorkarounds.wl b/src/BoxesWorkarounds.wl index 1aad1af..dbcac4e 100644 --- a/src/BoxesWorkarounds.wl +++ b/src/BoxesWorkarounds.wl @@ -385,7 +385,7 @@ System`IconizedFile; System`Iconized; Iconize[expr_, opts: OptionsPattern[] ] := With[{UID = OptionValue["UID"]}, - If[ByteCount[expr] > 30000, + If[ByteCount[expr] > 3000, With[{name = "iconized-"<>StringTake[UID, 4]<>".wl"}, If[!DirectoryQ[".iconized"], CreateDirectory[FileNameJoin[{Directory[], ".iconized"}] ] ]; Put[expr, FileNameJoin[{".iconized", name}] ]; @@ -397,7 +397,7 @@ Iconize[expr_, opts: OptionsPattern[] ] := With[{UID = OptionValue["UID"]}, ] Iconize[expr_, title_String] := With[{}, - If[ByteCount[expr] > 30000, + If[ByteCount[expr] > 3000, With[{name = title<>"-"<>StringTake[CreateUUID[], 4]<>".wl"}, If[!DirectoryQ[".iconized"], CreateDirectory[FileNameJoin[{Directory[], ".iconized"}] ] ]; Put[expr, FileNameJoin[{".iconized", name}] ]; @@ -694,7 +694,7 @@ BoundaryMeshRegion /: MakeBoxes[b_BoundaryMeshRegion, StandardForm] := With[{r = Unprotect[MeshRegion] MeshRegion /: MakeBoxes[b_MeshRegion, StandardForm] := With[{r = If[RegionDimension[b] == 3, RegionPlot3D[b, ImageSize->200], Insert[RegionPlot[b, ImageSize->200, Axes->False, Frame->False, ImagePadding->10], JerryI`Notebook`Graphics2D`Controls->False, {2,-1}]] // CreateFrontEndObject}, - If[ByteCount[b] > 5250, + If[ByteCount[b] > 3250, LeakyModule[{temporal}, With[{v = ViewBox[temporal, r]}, AppendTo[Kernel`Internal`garbage, Hold[temporal]]; diff --git a/src/Frontend.wl b/src/Frontend.wl index 55f59c6..a6366cd 100644 --- a/src/Frontend.wl +++ b/src/Frontend.wl @@ -15,6 +15,7 @@ NotebookEditorChannel::usage = "used to transfer extra events" Begin["`Internal`"] + truncatedTemplate = ImportComponent[ FileNameJoin[{$InputFileName // DirectoryName // ParentDirectory, "templates", "truncated.wlx"}] ]; truncatedTemplate = truncatedTemplate["Data"->"``", "Size"->"``"]; @@ -105,6 +106,7 @@ init[k_] := Module[{}, Kernel`Init[k, Print["Init internal communication"]; Internal`Kernel`TruncatedOutputTemplate = tt; + Notebook`Editor`$OutputCharactersLimit = 5000; Internal`Kernel`CommunicationChannel = Internal`Kernel`Stdout[channel]; ]; ]; @@ -121,7 +123,7 @@ init[k_] := Module[{}, , (* check length *) With[{string = ToString[result, StandardForm]}, - If[StringLength[string] < 30000, + If[StringLength[string] < Notebook`Editor`$OutputCharactersLimit, EventFire[Internal`Kernel`Stdout[ t["Hash"] ], "Result", <|"Data" -> string, "Meta"->Sequence["Hash"->hash] |> ]; , With[{truncated = ToString[result, InputForm]}, From 8f6def723d8e2c623a19a6fd3677bccd23c0b1ed Mon Sep 17 00:00:00 2001 From: Kirill Vasin Date: Fri, 1 Nov 2024 12:03:54 +0100 Subject: [PATCH 07/26] hot fix --- package.json | 2 +- src/BoxesWorkarounds.wl | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index c679935..069ae90 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wljs-editor", - "version": "1.2.3", + "version": "1.2.4", "description": "WLJS Code editor", "scripts": { "build": "node --max-old-space-size=8192 ./node_modules/.bin/rollup --config rollup.config.mjs", diff --git a/src/BoxesWorkarounds.wl b/src/BoxesWorkarounds.wl index dbcac4e..327db6d 100644 --- a/src/BoxesWorkarounds.wl +++ b/src/BoxesWorkarounds.wl @@ -475,6 +475,19 @@ Legended /: MakeBoxes[Legended[expr_, Placed[LineLegend[l_, names_List, opts__], Legended /: MakeBoxes[Legended[expr_, {Placed[BarLegend[a__], n__]} ], f: StandardForm] := MakeBoxes[Legended[expr, Placed[BarLegend[a], n] ], f] +Legended /: MakeBoxes[Legended[expr_, PointLegend[colors_, labels_] ], f: StandardForm] := With[{ + o = Row[{expr, Grid[{colors, Style[#, Bold]& /@ labels} // Transpose]}] +}, + MakeBoxes[o, f] +] + +Legended /: MakeBoxes[Legended[expr_, {Placed[PointLegend[colors_, labels_], _, Identity]} ], f: StandardForm] := With[{ + o = Row[{expr, Grid[{colors, Style[#, Bold]& /@ labels} // Transpose]}] +}, + MakeBoxes[o, f] +] + + From 9baa5fb4f7de5afd31bb6021fefc9e242e75e229 Mon Sep 17 00:00:00 2001 From: Kirill Vasin Date: Sun, 3 Nov 2024 18:59:58 +0100 Subject: [PATCH 08/26] fix boxes --- .DS_Store | Bin 10244 -> 8196 bytes src/BoxesWorkarounds.wl | 8 ++++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.DS_Store b/.DS_Store index 2fed01c6a5d4fe61e5f5b7674237b080947a6ef6..99a99208cbf17138a4c94de8f9f6e19cfee154de 100644 GIT binary patch delta 97 zcmZn(XmOBWU|?W$DortDU;r^WfEYvza8E20o2aMAD7rCVH$S83W*&jfjGH+nJ=g@9 lfzm)A!3`u_K`J*EerKM{uM)_?2+_|lIi6?6W-l2QW&jse5O)9o literal 10244 zcmeGhTWl0n^qgsd83*XJ6bnm>D^-e6%N7c@D6oBrP@uIB+VU#9JJT{UJ5zUNTd<4HJaduJk+Q^hNy`#5gQ{!BOm@4G0Kk#n4ss*on3afkC;fHiE}q|&%O6N z?mg$8bLZSy0KkT%S`82c0FfRBmDyBHP#B&)L`jtTlm#OrYgUCSgR5%qIb0bWsblS$)oTwQmc;qxEAMUZJ7C03 z>j+mB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<@T%KAFtgvq$nu8lcX76a$@nhk@JY}P z%}@_bu#I39y~ow;nFN*9^qleLYw`jK=_QpmzblHi Identity)} /.{Directive[_, color_RGBColor, ___] :> color }) //Transpose// Grid} // Row, StandardForm] // EditorView // CreateFrontEndObject}, MakeBoxes[o, f] ] -Legended /: MakeBoxes[Legended[expr_, {Placed[LineLegend[l_, names_List, opts__], _, Identity]}], f: WLXForm] := With[{o = ToString[{expr, ({l, Internal`RawText /@ (names /. HoldForm -> Identity)} /.{Directive[_, color_RGBColor, ___] :> color }) //Transpose// Grid} // Row, StandardForm] // EditorView // CreateFrontEndObject}, MakeBoxes[o, f] ] +Legended /: MakeBoxes[Legended[expr_, {Placed[PointLegend[l_List, names_List, opts__], _, Identity]} ], f: WLXForm] := With[{o = ToString[{expr, ({l, Internal`RawText /@ (names /. HoldForm -> Identity)} /.{Directive[_, color_RGBColor, ___] :> color }) //Transpose// Grid} // Row, StandardForm] // EditorView // CreateFrontEndObject}, MakeBoxes[o, f] ] -Legended /: MakeBoxes[Legended[expr_, Placed[LineLegend[l_, names_List, opts__], _, Identity] ], f: WLXForm] := With[{o = ToString[{expr, ({l, Internal`RawText /@ (names /. HoldForm -> Identity)} /.{Directive[_, color_RGBColor, ___] :> color }) //Transpose// Grid} // Row, StandardForm] // EditorView // CreateFrontEndObject}, MakeBoxes[o, f] ] +Legended /: MakeBoxes[Legended[expr_, PointLegend[l_List, names_List, opts___] ], f: WLXForm] := With[{o = ToString[{expr, ({l, Internal`RawText /@ (names /. HoldForm -> Identity)} /.{Directive[_, color_RGBColor, ___] :> color }) //Transpose// Grid} // Row, StandardForm] // EditorView // CreateFrontEndObject}, MakeBoxes[o, f] ] + +Legended /: MakeBoxes[Legended[expr_, {Placed[LineLegend[l_, names_List, opts___], _, Identity]}], f: WLXForm] := With[{o = ToString[{expr, ({l, Internal`RawText /@ (names /. HoldForm -> Identity)} /.{Directive[_, color_RGBColor, ___] :> color }) //Transpose// Grid} // Row, StandardForm] // EditorView // CreateFrontEndObject}, MakeBoxes[o, f] ] + +Legended /: MakeBoxes[Legended[expr_, Placed[LineLegend[l_, names_List, opts___], _, Identity] ], f: WLXForm] := With[{o = ToString[{expr, ({l, Internal`RawText /@ (names /. HoldForm -> Identity)} /.{Directive[_, color_RGBColor, ___] :> color }) //Transpose// Grid} // Row, StandardForm] // EditorView // CreateFrontEndObject}, MakeBoxes[o, f] ] Legended /: MakeBoxes[Legended[expr_, Placed[BarLegend[{cf_, range_List}, opts___Rule, ___] , _, Identity] ], f: (StandardForm | WLXForm)] := With[{ From 57dc161f0df992e8d4457872ea1076d750469427 Mon Sep 17 00:00:00 2001 From: Kirill Vasin Date: Sun, 10 Nov 2024 12:14:50 +0100 Subject: [PATCH 09/26] window obj added --- src/RemoteCells.wl | 56 +++++++++++++++++++++++++++++++++++----- src/RemoteCellsKernel.wl | 11 +++++++- 2 files changed, 59 insertions(+), 8 deletions(-) diff --git a/src/RemoteCells.wl b/src/RemoteCells.wl index 1235cd7..b799970 100644 --- a/src/RemoteCells.wl +++ b/src/RemoteCells.wl @@ -1,6 +1,8 @@ BeginPackage["Notebook`Editor`RemoteCells`", { "Notebook`Editor`", "JerryI`Notebook`", + "JerryI`Notebook`Windows`", + "JerryI`WLX`WebUI`", "JerryI`Notebook`Kernel`", "JerryI`Notebook`Evaluator`", "JerryI`Misc`Events`", @@ -14,7 +16,17 @@ EventHandler[NotebookEditorChannel // EventClone, { "DeleteCellByHash" -> Function[uid, Echo["Delete object "<>uid]; - Delete[ CellObj`HashMap[uid] ] + With[{target = Lookup[CellObj`HashMap, uid, WindowObj`HashMap[uid] ]}, + If[MatchQ[target, _CellObj], + Delete[ target ] + ]; + + If[MatchQ[target, _WindowObj], + WebUIClose[target["Socket"] ]; + Delete[target]; + ]; + ] + ], "SetCellData" -> Function[assoc, @@ -76,15 +88,45 @@ EventHandler[NotebookEditorChannel // EventClone, ]; ], + "EvaluateCellByHash" -> Function[assoc, + With[{cell = CellObj`HashMap[ assoc["UId"] ], target = assoc["Target"]}, + If[MatchQ[cell, _CellObj], + With[{controller = cell["Notebook"]["Controller"]}, + If[MatchQ[target, "Notebook" | "" | "Parent" | "Same" | Null], + EventFire[controller, "NotebookCellEvaluate", cell] + , + EventFire[controller, "NotebookCellProject", cell] + ] + + ] + ]; + ] + ], + "PrintNewCell" -> Function[t, Print["!!!!!"]; - With[{reference = CellObj`HashMap[ t["Ref"] ]}, + With[{reference = CellObj`HashMap[ t["Ref"] ], target = Lookup[t["Meta"], "Target", "Notebook"]}, Echo[reference]; - CellObj @@ Join[{"Notebook" -> reference["Notebook"], "Data" -> t["Data"]}, - ReplaceAll[ - Normal[t["Meta"] ] - , {Notebook`CellOperations`RemoteCellObj -> CellObj`HashMap}] - ]; + If[!MatchQ[reference, _CellObj], Return[] ]; + + If[MatchQ[target, "Notebook" | Null | Automatic], + CellObj @@ Join[{"Notebook" -> reference["Notebook"], "Data" -> t["Data"]}, + ReplaceAll[ + Normal[t["Meta"] ] + , {Notebook`CellOperations`RemoteCellObj -> CellObj`HashMap}] + ]; + , + With[{controller = reference["Notebook"]["Controller"]}, + EventFire[controller, "NotebookCellDataProject", <| + "Cell" -> reference, + "Hash" -> t["Meta", "Hash"], + "Data" -> t["Data"], + "Display" -> "codemirror" + |>] + ] + + ] + ] ], diff --git a/src/RemoteCellsKernel.wl b/src/RemoteCellsKernel.wl index 2563d85..f3173ad 100644 --- a/src/RemoteCellsKernel.wl +++ b/src/RemoteCellsKernel.wl @@ -8,6 +8,8 @@ RemoteNotebook::usage = "Internal representation of remote notebook object on Ke ResultCell::usage = "An access to an output cell generated during the evaluation" +EvaluateCell::usage = "EvaluateCell[cell_RemoteCellObj, opts___] programmatically evaluates a cell" + Begin["`Private`"] Unprotect[EvaluationCell]; @@ -54,6 +56,7 @@ RemoteNotebook /: Set[RemoteNotebook[uid_][field_], value_] := With[{}, ] + (* FIXME!!! NOT EFFICIENT!*) (* DO NOT USE BLANK PATTERN !!! *) RemoteNotebook /: EventHandler[ RemoteNotebook[uid_], list_] := With[{virtual = CreateUUID[]}, @@ -73,6 +76,12 @@ RemoteNotebook /: EventClone[ RemoteNotebook[uid_] ] := With[{virtual = CreateUU EventObject[<|"Id"->cloned|>] ] +RemoteCellObj /: EvaluateCell[ RemoteCellObj[uid_] , OptionsPattern[] ] := With[{target = OptionValue["Target"]}, + EventFire[Internal`Kernel`CommunicationChannel, "EvaluateCellByHash", <|"UId" -> uid, "Target" -> target|>]; +] + +Options[EvaluateCell] = {"Target" -> "Notebook"} + RemoteCellObj /: EventHandler[ RemoteCellObj[uid_], list_] := With[{virtual = CreateUUID[]}, EventHandler[virtual, list]; EventFire[Internal`Kernel`CommunicationChannel, "CellSubscribe", <|"CellHash" -> uid, "Callback" -> virtual, "Kernel"->Internal`Kernel`Hash|>]; @@ -92,7 +101,7 @@ CellPrint[str_String, opts___] := With[{hash = CreateUUID[], list = Association[ EventFire[Internal`Kernel`CommunicationChannel, "PrintNewCell", <|"Data" -> str, "Ref"->r, "Meta"-><|"Hash"->hash, "Type"->"Output", "After"->RemoteCellObj[ r ], opts|> |> ]; ]; , - With[{r = list["After"] // First}, + With[{r = If[StringQ[#], #, list["Reference"] // First] &@ list["After"] // First}, EventFire[Internal`Kernel`CommunicationChannel, "PrintNewCell", <|"Data" -> str, "Ref"->r, "Meta"-><|"Hash"->hash, "Type"->"Output", "After"->RemoteCellObj[ r ], opts|> |> ]; ]; ]; From c24194c9eda48a961977d9e0898db1663b1c6f40 Mon Sep 17 00:00:00 2001 From: Kirill Vasin Date: Sun, 10 Nov 2024 12:31:27 +0100 Subject: [PATCH 10/26] qfix --- src/RemoteCellsKernel.wl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/RemoteCellsKernel.wl b/src/RemoteCellsKernel.wl index f3173ad..738aac7 100644 --- a/src/RemoteCellsKernel.wl +++ b/src/RemoteCellsKernel.wl @@ -101,7 +101,7 @@ CellPrint[str_String, opts___] := With[{hash = CreateUUID[], list = Association[ EventFire[Internal`Kernel`CommunicationChannel, "PrintNewCell", <|"Data" -> str, "Ref"->r, "Meta"-><|"Hash"->hash, "Type"->"Output", "After"->RemoteCellObj[ r ], opts|> |> ]; ]; , - With[{r = If[StringQ[#], #, list["Reference"] // First] &@ list["After"] // First}, + With[{r = If[StringQ[#], #, list["Reference"] // First] &@ (list["After"] // First)}, EventFire[Internal`Kernel`CommunicationChannel, "PrintNewCell", <|"Data" -> str, "Ref"->r, "Meta"-><|"Hash"->hash, "Type"->"Output", "After"->RemoteCellObj[ r ], opts|> |> ]; ]; ]; From 23987b4259779005e2766680501bed28a0cb08fd Mon Sep 17 00:00:00 2001 From: Kirill Vasin Date: Fri, 15 Nov 2024 09:56:45 +0100 Subject: [PATCH 11/26] added origin to window obj --- package.json | 2 +- src/FrontSubmit.wl | 2 ++ src/FrontSubmitKernel.wl | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 069ae90..4cb80d7 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wljs-editor", - "version": "1.2.4", + "version": "1.2.5", "description": "WLJS Code editor", "scripts": { "build": "node --max-old-space-size=8192 ./node_modules/.bin/rollup --config rollup.config.mjs", diff --git a/src/FrontSubmit.wl b/src/FrontSubmit.wl index 9520375..99dba03 100644 --- a/src/FrontSubmit.wl +++ b/src/FrontSubmit.wl @@ -25,6 +25,7 @@ attachListeners[notebook_Notebook] := With[{}, Echo["Requesting socket object for client..."]; Then[WebUIFetch[Global`FSAskKernelSocket[], payload["Client"] ], Function[data, notebook["EvaluationContext", "KernelWebSocket"] = data; + notebook["EvaluationContext", "OriginKernelWebSocket"] = data; EventFire[p, Resolve, True]; ] ]; p @@ -39,6 +40,7 @@ attachListeners[notebook_Notebook] := With[{}, Echo["Requesting socket object for client window object..."]; With[{p = Promise[]}, Then[WebUIFetch[Global`FSAskKernelSocket[], data["Client"] ], Function[dp, + win["EvaluationContext", "OriginKernelWebSocket"] = win["EvaluationContext", "KernelWebSocket"]; win["EvaluationContext", "KernelWebSocket"] = dp; Echo["Obtained!"]; EventFire[p, Resolve, True]; diff --git a/src/FrontSubmitKernel.wl b/src/FrontSubmitKernel.wl index 3e985ac..736a1d9 100644 --- a/src/FrontSubmitKernel.wl +++ b/src/FrontSubmitKernel.wl @@ -25,6 +25,8 @@ WindowObj::usage = "Internal represenation of a current window" Begin["`Private`"] CurrentWindow[] := WindowObj[<|"Socket" -> Global`$EvaluationContext["KernelWebSocket"]|>] +CurrentWindow["Origin"] := WindowObj[<|"Socket" -> Global`$EvaluationContext["OriginKernelWebSocket"]|>] + WindowObj[data_][key_String] := data[key] From d6bb4ecf8cfef8ebcc55a7c8854feb23c9f88805 Mon Sep 17 00:00:00 2001 From: Kirill Vasin Date: Fri, 15 Nov 2024 19:34:52 +0100 Subject: [PATCH 12/26] fixed gridbox --- .DS_Store | Bin 8196 -> 10244 bytes dist/kernel.js | 13 ++++++++----- dist/kernel.min.js | 2 +- .../src/boxes/gridbox.js | 13 ++++++++----- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.DS_Store b/.DS_Store index 99a99208cbf17138a4c94de8f9f6e19cfee154de..2fed01c6a5d4fe61e5f5b7674237b080947a6ef6 100644 GIT binary patch literal 10244 zcmeGhTWl0n^qgsd83*XJ6bnm>D^-e6%N7c@D6oBrP@uIB+VU#9JJT{UJ5zUNTd<4HJaduJk+Q^hNy`#5gQ{!BOm@4G0Kk#n4ss*on3afkC;fHiE}q|&%O6N z?mg$8bLZSy0KkT%S`82c0FfRBmDyBHP#B&)L`jtTlm#OrYgUCSgR5%qIb0bWsblS$)oTwQmc;qxEAMUZJ7C03 z>j+mBz2gGr@P4{JO0Bd$#z1vP%!&`X*oq$*OylBKQuVRp&Dt5f0! z_h-t!z@|v^4s|3t4BCe%*g5;~9^o?gVK$gx(Vl702XVKRBu)+No4qeJ zt7|KRYeH-PA@b4gm}Mm6CSeL=5hIo)Vy)gVI`l_4bu3{S zMw?~pj&7N~J&tzJVK^oz3)QpJwh~UGE38K+`JAeV&Cxo@nC%@}!X_w5$LE%m-hSuu zl{Izi8}8q-eXKw!ESgs=%R4CyOh@n6wM5sjt~&dBBX&$PRoxuu9@1?+YG|EiB(4== zr6jpr3l;_fJ;|v4a8h>;DdnO#R-_ab$cyEmq@0v?tE9{}OJx#Omww6OKwuXeZA@rX ztHi)2Us@56J8e=+iHKbAib`4TJV0@(*xpp3YB|tlM53CZs1j#evsMmt4{@!O7H@D} zu^i~3V2hI~wl}t6V<51XO}jN>JFSD7sj12r-rS9Z+iCBQB(&CHIw!o*O*HCm7L7Be zW>t5r6tac1=w;&SRn^sjDII7Fw2R7Fk#=1-hjcod$kzOb63dxGu~Hsh&Ks^B%flhw zE9M|wvt*?VLeKzPU@r{9Avg-p!K-irPQocT17E{A_z8Z2OYkRLhAZ$F=HnbJKm`ji zfQzsU7vl=7!7$ci1GZorwqpl&;vS5miW>H#g-IO7gLnv^#3T4LK7-HV^LPwj!`Ja$ z{0KkBPw-Rx9M9snIEFvs@AwB^!Ye|)FhiIr6bOn?B+L_*3Kc>~s1r5_oA}y=)N$CG z*2QfIJp`tTDDSuz-k3O|N;f^QY4etrX&X`J=JFVte``sQ1y=3)`m_&nr%m~3ruVxp zpA{so%e%gjAX^TqBZy76f4?6k%gu*i&HO=?+__glo`BRA>SoZlqfTK zx3aWKR8ESD;CAKe($x}0pOQDWXklQ%8VWxJDe~B~@;doGiQ-Vn=iM?nEJ+G*F^#3o zBE^y-US}u&63)W+Z~-oolV8O=6tM(@xD2bX7B}EVa_dHH#_iaO50Y~;*WQc!FoH2O zFi!40hzT6QNAWRy9G}Q=@fYw#dv1^#Hv=@22;t<@T%KAFtgvq$nu8lcX76a$@nhk@JY}P z%}@_bu#I39y~ow;nFN*9^qleLYw`jK=_QpmzblHi= 0) { cols[j-2].editor.dispatch({selection:{anchor:cols[j-2].editor.state.doc.length}}); cols[j-2].editor.focus(); @@ -38604,7 +38604,7 @@ var compactCMEditor$2; editor.editorLastCursor = editor.state.selection.ranges[0].to; } }, { key: "ArrowRight", run: function (editor, key) { - if (editor?.editorLastCursor === editor.state.selection.ranges[0].to) + if (editor?.editorLastCursor === editor.state.selection.ranges[0].to && !editor.stringOnly) if (j + 2 < cols.length) { cols[j+2].editor.dispatch({selection:{anchor:0}}); cols[j+2].editor.focus(); @@ -38648,14 +38648,17 @@ var compactCMEditor$2; cols[j].editor = { destroy: () => {}, focus: () => {}, - dispatch: () => {} + dispatch: () => {}, + stringOnly: true }; const itemDesc = text.match(itemBox); - if (itemDesc) { + if (itemDesc) { td.innerHTML = itemDesc[1]; + //throw(itemDesc); + const decoded = Mma.DecompressDecode(itemDesc[2]); const json = Mma.toArray(decoded.parts[0]); const cuid = uuidv4(); diff --git a/dist/kernel.min.js b/dist/kernel.min.js index a5646d9..e14b576 100644 --- a/dist/kernel.min.js +++ b/dist/kernel.min.js @@ -1 +1 @@ -class t{constructor(){}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 a(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}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 l(n,o,i,r);n=o+1,i++}}decompose(t,i,r,o){let a=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(a.text,t.text.slice(),0,a.length);if(i.length<=32)r.push(new e(i,t.length+a.length));else{let t=i.length>>1;r.push(new e(i.slice(0,t)),new e(i.slice(t)))}}else r.push(a)}replace(t,r,o){if(!(o instanceof e))return super.replace(t,r,o);let a=n(this.text,n(o.text,s(this.text,0,t)),r),l=this.length+o.length-(r-t);return a.length<=32?new e(a,l):i.from(e.split(a,[]),l)}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=a+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,a=i+r.lines-1;if((e?a:o)>=t)return r.lineInner(t,e,i,n);n=o+1,i=a+1}}decompose(t,e,i,n){for(let s=0,r=0;r<=e&&s=r){let s=n&((r<=t?1:0)|(a>=e?2:0));r>=t&&a<=e&&!s?i.push(o):o.decompose(t-r,e-r,i,s)}r=a+1}}replace(t,e,n){if(n.lines=r&&e<=a){let l=o.replace(t-r,e-r,n),h=this.lines-o.lines+l.lines;if(l.lines>4&&l.lines>h>>6){let r=this.children.slice();return r[s]=l,new i(r,this.length-(e-t)+n.length)}return super.replace(r,a,l)}r=a+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=a+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,a]=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==a)return n;let i=this.children[s],l=t.children[r];if(i!=l)return n+i.scanIdentical(l,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,a=r>>1,l=[],h=0,c=-1,u=[];function d(t){let n;if(t.lines>o&&t instanceof i)for(let e of t.children)d(e);else t.lines>a&&(h>a||!h)?(f(),l.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&&f(),h+=t.lines,c+=t.length+1,u.push(t))}function f(){0!=h&&(l.push(1==u.length?u[0]:i.from(u,c)),c=-1,h=u.length=0)}for(let e of t)d(e);return f(),1==l.length?l[0]:new i(l,n)}}function n(t,e,i=0,n=1e9){for(let s=0,r=0,o=!0;r=i&&(l>n&&(a=a.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,a=s instanceof e?s.text.length:s.children.length;if(o==(i>0?a: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 a{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]=a.prototype[Symbol.iterator]=function(){return this});let l=class{constructor(t,e,i,n){this.from=t,this.to=e,this.number=i,this.text=n}get length(){return this.to-this.from}},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 d=8205;function f(t,e,i=!0,n=!0){return(i?p:O)(t,e,n)}function p(t,e,i){if(e==t.length)return e;e&&g(t.charCodeAt(e))&&m(t.charCodeAt(e-1))&&e--;let n=b(t,e);for(e+=v(n);e=0&&u(b(t,n));)i++,n-=2;if(i%2==0)break;e+=2}}}return e}function O(t,e,i){for(;e>0;){let n=p(t,e-2,i);if(n=56320&&t<57344}function m(t){return t>=55296&&t<56320}function b(t,e){let i=t.charCodeAt(e);if(!m(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return g(n)?n-56320+(i-55296<<10)+65536:i}function w(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function v(t){return t<65536?1:2}const y=/\r\n?|\n/;var S=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(S||(S={}));class x{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;et)return s+(t-n);s+=o}else{if(i!=S.Simple&&l>=t&&(i==S.TrackDel&&nt||i==S.TrackBefore&&nt))return null;if(l>t||l==t&&e<0&&!o)return t==n||e<0?s:s+a;s+=a}n=l}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 x(t)}static create(t){return new x(t)}}class k extends x{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 P(this,((e,i,n,s,r)=>t=t.replace(n,n+(i-e),r)),!1),t}mapDesc(t,e=!1){return C(this,t,e,!0)}invert(e){let i=this.sections.slice(),n=[];for(let s=0,r=0;s=0){i[s]=a,i[s+1]=o;let l=s>>1;for(;n.length0&&$(i,e,s.text),s.forward(t),o+=t}let l=t[r++];for(;o>1].toJSON()))}return t}static of(e,i,n){let s=[],r=[],o=0,a=null;function l(t=!1){if(!t&&!s.length)return;oa||e<0||a>i)throw new RangeError(`Invalid change range ${e} to ${a} (in doc of length ${i})`);let u=c?"string"==typeof c?t.of(c.split(n||y)):c:t.empty,d=u.length;if(e==a&&0==d)return;eo&&Q(s,e-o,-1),Q(s,a-e,d),$(r,s,u),o=a}}(e),l(!a),a}static empty(t){return new k(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 $(e,i,n){if(0==n.length)return;let s=i.length-2>>1;if(s>1])),!(n||a==e.sections.length||e.sections[a+1]<0);)l=e.sections[a++],h=e.sections[a++];i(r,c,o,u,d),r=c,o=u}}}function C(t,e,i,n=!1){let s=[],r=n?[]:null,o=new X(t),a=new X(e);for(let t=-1;;)if(-1==o.ins&&-1==a.ins){let t=Math.min(o.len,a.len);Q(s,t,-1),o.forward(t),a.forward(t)}else if(a.ins>=0&&(o.ins<0||t==o.i||0==o.off&&(a.len=0&&t=0)){if(o.done&&a.done)return r?k.createSet(s,r):x.create(s);throw new Error("Mismatched change set lengths")}{let e=0,i=o.len;for(;i;)if(-1==a.ins){let t=Math.min(i,a.len);e+=t,i-=t,a.forward(t)}else{if(!(0==a.ins&&a.lene||o.ins>=0&&o.len>e)&&(t||n.length>i),r.forward2(e),o.forward(e)}}else Q(n,0,o.ins,t),s&&$(s,n,o.text),o.next()}}class X{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 Z{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 Z(i,n,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return A.range(t,e);let i=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return A.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 A.range(t.anchor,t.head)}static create(t,e,i){return new Z(t,e,i)}}class A{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:A.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 A(t.ranges.map((t=>Z.fromJSON(t))),t.main)}static single(t,e=t){return new A([A.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?A.range(o,r):A.range(r,o))}}return new A(t,e)}}function T(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let R=0;class E{constructor(t,e,i,n,s){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=n,this.id=R++,this.default=t([]),this.extensions="function"==typeof s?s(this):s}static define(t={}){return new E(t.combine||(t=>t),t.compareInput||((t,e)=>t===e),t.compare||(t.combine?(t,e)=>t===e:V),!!t.static,t.enables)}of(t){return new M([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,2,e)}from(t,e){return e||(e=t=>t),this.compute([t],(i=>e(i.field(t))))}}function V(t,e){return t==e||t.length==e.length&&t.every(((t,i)=>t===e[i]))}class M{constructor(t,e,i,n){this.dependencies=t,this.facet=e,this.type=i,this.value=n,this.id=R++}dynamicSlot(t){var e;let i=this.value,n=this.facet.compareInput,s=this.id,r=t[s]>>1,o=2==this.type,a=!1,l=!1,h=[];for(let i of this.dependencies)"doc"==i?a=!0:"selection"==i?l=!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(a&&e.docChanged||l&&(e.docChanged||e.selection)||W(t,h)){let e=i(t);if(o?!D(e,t.values[r],n):!n(e,t.values[r]))return t.values[r]=e,1}return 0},reconfigure:(t,e)=>{let a,l=e.config.address[s];if(null!=l){let s=tt(e,l);if(this.dependencies.every((i=>i instanceof E?e.facet(i)===t.facet(i):!(i instanceof q)||e.field(i,!1)==t.field(i,!1)))||(o?D(a=i(t),s,n):n(a=i(t),s)))return t.values[r]=s,0}else a=i(t);return t.values[r]=a,1}}}}function D(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 a(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(Y).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,Y.of({field:this,create:t})]}get extension(){return this}}const L=4,z=3,I=2,B=1;function j(t){return e=>new G(e,t)}const N={highest:j(0),high:j(B),default:j(I),low:j(z),lowest:j(L)};class G{constructor(t,e){this.inner=t,this.prec=e}}class F{of(t){return new H(this,t)}reconfigure(t){return F.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class H{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;function r(t,o){let a=s.get(t);if(null!=a){if(a<=o)return;let e=n[a].indexOf(t);e>-1&&n[a].splice(e,1),t instanceof H&&i.delete(t.compartment)}if(s.set(t,o),Array.isArray(t))for(let e of t)r(e,o);else if(t instanceof H){if(i.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");let n=e.get(t.compartment)||t.inner;i.set(t.compartment,n),r(n,o)}else if(t instanceof G)r(t.inner,t.prec);else if(t instanceof q)n[o].push(t),t.provides&&r(t.provides,o);else if(t instanceof M)n[o].push(t),t.facet.extensions&&r(t.facet.extensions,I);else{let e=t.extension;if(!e)throw new Error(`Unrecognized extension value in extension set (${t}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(e,o)}}return r(t,I),n.reduce(((t,e)=>t.concat(e)))}(t,e,r))i instanceof q?n.push(i):(s[i.facet.id]||(s[i.facet.id]=[])).push(i);let o=Object.create(null),a=[],l=[];for(let t of n)o[t.id]=l.length<<1,l.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]=a.length<<1|1,V(r,e))a.push(i.facet(n));else{let t=n.combine(e.map((t=>t.value)));a.push(i&&n.compare(t,i.facet(n))?i.facet(n):t)}else{for(let t of e)0==t.type?(o[t.id]=a.length<<1|1,a.push(t.value)):(o[t.id]=l.length<<1,l.push((e=>t.dynamicSlot(e))));o[n.id]=l.length<<1,l.push((t=>U(t,n,e)))}}let c=l.map((t=>t(o)));return new J(t,r,c,o,a,s)}}function K(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 tt(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}const et=E.define(),it=E.define({combine:t=>t.some((t=>t)),static:!0}),nt=E.define({combine:t=>t.length?t[0]:void 0,static:!0}),st=E.define(),rt=E.define(),ot=E.define(),at=E.define({combine:t=>!!t.length&&t[0]});class lt{constructor(t,e){this.type=t,this.value=e}static define(){return new ht}}class ht{of(t){return new lt(this,t)}}class ct{constructor(t){this.map=t}of(t){return new ut(this,t)}}class ut{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 ut(this.type,e)}is(t){return this.type==t}static define(t={}){return new ct(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}}ut.reconfigure=ut.define(),ut.appendConfig=ut.define();class dt{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&&T(i,e.newLength),s.some((t=>t.type==dt.time))||(this.annotations=s.concat(dt.time.of(Date.now())))}static create(t,e,i,n,s,r){return new dt(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(dt.userEvent);return!(!e||!(e==t||e.length>t.length&&e.slice(0,t.length)==t&&"."==e[t.length]))}}function ft(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=pt(n,Ot(e,r,t.changes.newLength),!0))}return n==t?t:dt.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(st)){let e=n(t);if(!1===e){i=!1;break}Array.isArray(e)&&(i=!0===i?e:ft(i,e))}if(!0!==i){let n,s;if(!1===i)s=t.changes.invertedDesc,n=k.empty(e.doc.length);else{let e=t.changes.filter(i);n=e.changes,s=e.filtered.mapDesc(e.changes).invertedDesc}t=dt.create(e,n,t.selection&&t.selection.map(s),ut.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let n=e.facet(rt);for(let i=n.length-1;i>=0;i--){let s=n[i](t);t=s instanceof dt?s:Array.isArray(s)&&1==s.length&&s[0]instanceof dt?s[0]:gt(e,bt(s),!1)}return t}(s):s)}dt.time=lt.define(),dt.userEvent=lt.define(),dt.addToHistory=lt.define(),dt.remote=lt.define();const mt=[];function bt(t){return null==t?mt:Array.isArray(t)?t:[t]}var wt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(wt||(wt={}));const vt=/[\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){}function St(t){return e=>{if(!/\S/.test(e))return wt.Space;if(function(t){if(yt)return yt.test(t);for(let e=0;e"€"&&(i.toUpperCase()!=i.toLowerCase()||vt.test(i)))return!0}return!1}(e))return wt.Word;for(let i=0;i-1)return wt.Word;return wt.Other}}class xt{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(ut.reconfigure)?(i=null,n=e.value):e.is(ut.appendConfig)&&(i=null,n=bt(n).concat(e.value));if(i)e=t.startState.values.slice();else{i=J.resolve(n,s,this),e=new xt(i,this.doc,this.selection,i.dynamicSlots.map((()=>null)),((t,e)=>e.reconfigure(t,this)),null).values}new xt(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:A.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=bt(i.effects);for(let i=1;is.spec.fromJSON(r,t))))}return xt.create({doc:t.doc,selection:A.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(xt.lineSeparator)||y)),s=e.selection?e.selection instanceof A?e.selection:A.single(e.selection.anchor,e.selection.head):A.single(0);return T(s,n.length),i.staticFacet(it)||(s=s.asSingle()),new xt(i,n,s,i.dynamicSlots.map((()=>null)),((t,e)=>e.create(t)),null)}get tabSize(){return this.facet(xt.tabSize)}get lineBreak(){return this.facet(xt.lineSeparator)||"\n"}get readOnly(){return this.facet(at)}phrase(t,...e){for(let e of this.facet(xt.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(et))for(let r of s(this,e,i))Object.prototype.hasOwnProperty.call(r,t)&&n.push(r[t]);return n}charCategorizer(t){return St(this.languageDataAt("wordChars",t).join(""))}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=f(e,r,!1);if(s(e.slice(t,r))!=wt.Word)break;r=t}for(;ot.length?t[0]:4}),xt.lineSeparator=nt,xt.readOnly=at,xt.phrases=E.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]))}}),xt.languageData=et,xt.changeFilter=st,xt.transactionFilter=rt,xt.transactionExtender=ot,F.reconfigure=ut.define();class Qt{eq(t){return this==t}range(t,e=t){return $t.create(t,e,this)}}Qt.prototype.startSide=Qt.prototype.endSide=0,Qt.prototype.point=!1,Qt.prototype.mapMode=S.TrackDel;let $t=class t{constructor(t,e,i){this.from=t,this.to=e,this.value=i}static create(e,i,n){return new t(e,i,n)}};function Pt(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Ct{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,a=s[n]-t||(i?this.value[n].endSide:this.value[n].startSide)-e;if(n==r)return a>=0?r:o;a>=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||l==h&&c.startSide>0&&c.endSide<=0)continue;(h-l||c.endSide-c.startSide)<0||(r<0&&(r=l),c.point&&(o=Math.max(o,h-l)),i.push(c),n.push(l-r),s.push(h-r))}return{mapped:i.length?new Ct(n,s,i,o):null,pos:r}}}class _t{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 _t(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(Pt)),this.isEmpty)return e.length?_t.of(e):this;let o=new At(this,null,-1).goto(0),a=0,l=[],h=new Xt;for(;o.value||a=0){let t=e[a++];h.addInner(t.from,t.to,t.value)||l.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 Tt.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return Tt.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)),a=Zt(r,o,i),l=new Et(r,a,s),h=new Et(o,a,s);i.iterGaps(((t,e,i)=>Vt(l,t,h,e,i,n))),i.empty&&0==i.length&&Vt(l,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=Zt(s,r),a=new Et(s,o,0).goto(i),l=new Et(r,o,0).goto(i);for(;;){if(a.to!=l.to||!Mt(a.active,l.active)||a.point&&(!l.point||!a.point.eq(l.point)))return!1;if(a.to>n)return!0;a.next(),l.next()}}static spans(t,e,i,n,s=-1){let r=new Et(t,null,s).goto(e),o=e,a=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,a),a=r.openEnd(t));if(r.to>i)return a+(r.point&&r.to>i?1:0);o=r.to,r.next()}}static of(t,e=!1){let i=new Xt;for(let n of t instanceof $t?[t]:e?function(t){if(t.length>1)for(let e=t[0],i=1;i0)return t.slice().sort(Pt);e=n}return t}(t):t)i.add(n.from,n.to,n.value);return i.finish()}}_t.empty=new _t([],[],null,-1),_t.empty.nextLayer=_t.empty;class Xt{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}finishChunk(t){this.chunks.push(new Ct(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=[])}add(t,e,i){this.addInner(t,e,i)||(this.nextLayer||(this.nextLayer=new Xt)).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(_t.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;let e=_t.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function Zt(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 At(r,e,i,s));return 1==n.length?n[0]:new Tt(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--)Rt(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--)Rt(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(),Rt(this.heap,0)}}}function Rt(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 Et{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=Tt.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){Dt(this.active,t),Dt(this.activeTo,t),Dt(this.activeRank,t),this.minActive=Ut(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&&Dt(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 Vt(t,e,i,n,s,r){t.goto(e),i.goto(n);let o=n+s,a=n,l=n-e;for(;;){let e=t.to+l-i.to||t.endSide-i.endSide,n=e<0?t.to+l: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))&&Mt(t.activeForPoint(t.to+l),i.activeForPoint(i.to))||r.comparePoint(a,s,t.point,i.point):s>a&&!Mt(t.active,i.active)&&r.compareRange(a,s,t.active,i.active),n>o)break;a=n,e<=0&&t.next(),e>=0&&i.next()}}function Mt(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 Ut(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(!l)throw new RangeError("The value of a property ("+i+") should be a primitive value.");s(n(i),o,a,h)}else null!=o&&a.push(i.replace(/_.*/,"").replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))+": "+o+";")}(a.length||h)&&r.push((!i||l||o?t:t.map(i)).join(", ")+" {"+a.join(" ")+"}")}for(let e in t)s(n(e),t[e],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let t=zt[qt]||1;return zt[qt]=t+1,"ͼ"+t.toString(36)}static mount(t,e){(t[Lt]||new jt(t)).mount(Array.isArray(e)?e:[e])}}let Bt=new Map;class jt{constructor(t){let e=t.ownerDocument||t,i=e.defaultView;if(!t.head&&t.adoptedStyleSheets&&i.CSSStyleSheet){let n=Bt.get(e);if(n)return t.adoptedStyleSheets=[n.sheet,...t.adoptedStyleSheets],t[Lt]=n;this.sheet=new i.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets],Bt.set(e,this)}else{this.styleTag=e.createElement("style");let i=t.head||t;i.insertBefore(this.styleTag,i.firstChild)}this.modules=[],t[Lt]=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:'"'},Ft="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),Ht="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Jt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Kt=Ht||Ft&&+Ft[1]<57,te=0;te<10;te++)Nt[48+te]=Nt[96+te]=String(te);for(te=1;te<=24;te++)Nt[te+111]="F"+te;for(te=65;te<=90;te++)Nt[te]=String.fromCharCode(te+32),Gt[te]=String.fromCharCode(te);for(var ee in Nt)Gt.hasOwnProperty(ee)||(Gt[ee]=Nt[ee]);function ie(t){let e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection()}function ne(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function se(t,e){if(!e.anchorNode)return!1;try{return ne(t,e.anchorNode)}catch(t){return!1}}function re(t){return 3==t.nodeType?me(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function oe(t,e,i,n){return!!i&&(le(t,e,i,n,-1)||le(t,e,i,n,1))}function ae(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function le(t,e,i,n,s){for(;;){if(t==i&&e==n)return!0;if(e==(s<0?0:he(t))){if("DIV"==t.nodeName)return!1;let i=t.parentNode;if(!i||1!=i.nodeType)return!1;e=ae(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?he(t):0}}}function he(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}const ce={left:0,right:0,top:0,bottom:0};function ue(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function de(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}class fe{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){this.set(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset)}set(t,e,i,n){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=n}}let pe,Oe=null;function ge(t){if(t.setActive)return t.setActive();if(Oe)return t.focus(Oe);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==Oe?{get preventScroll(){return Oe={preventScroll:!0},!0}}:void 0),!Oe){Oe=!1;for(let t=0;te)return i.domBoundsAround(t,e,l);if(c>=t&&-1==n&&(n=a,s=l),l>e&&i.dom.parentNode==this.dom){r=a,o=h;break}h=c,l=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.dirty|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.dirty|=2),1&e.dirty)return;e.dirty|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,this.dirty&&this.markParentsDirty(!0))}setDOM(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=ye){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 Qe(t,e,i,n,s,r,o,a,l){let{children:h}=t,c=h.length?h[e]:null,u=r.length?r[r.length-1]:null,d=u?u.breakAfter:o;if(!(e==n&&c&&!o&&!d&&r.length<2&&c.merge(i,s,r.length?u:null,0==i,a,l))){if(n0&&(!o&&r.length&&c.merge(i,c.length,r[0],!1,a,0)?c.breakAfter=r.shift().breakAfter:(i2);var De={mac:Me||/Mac/.test(Pe.platform),windows:/Win/.test(Pe.platform),linux:/Linux|X11/.test(Pe.platform),ie:Ae,ie_version:Xe?Ce.documentMode||6:Ze?+Ze[1]:_e?+_e[1]:0,gecko:Te,gecko_version:Te?+(/Firefox\/(\d+)/.exec(Pe.userAgent)||[0,0])[1]:0,chrome:!!Re,chrome_version:Re?+Re[1]:0,ios:Me,android:/Android\b/.test(Pe.userAgent),webkit:Ee,safari:Ve,webkit_version:Ee?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Ce.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class We extends Se{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(!i||i instanceof We&&!(this.length-(e-t)+i.length>256))&&(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),!0)}split(t){let e=new We(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new ve(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 Ye(this.dom,t,e)}}class Ue extends Se{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(we(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}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.dirty|=6)}sync(t,e){this.dom?4&this.dirty&&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 Ue&&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 Ue(this.mark,e,r)}domAtPos(t){return Ge(this,t)}coordsAt(t,e){return He(this,t,e)}}function Ye(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?De.chrome||De.gecko||(e?(s--,o=1):r=0)?0:a.length-1];return De.safari&&!o&&0==l.width&&(l=Array.prototype.find.call(a,(t=>t.width))||l),o?ue(l,o<0):l||null}class qe extends Se{constructor(t,e,i){super(),this.widget=t,this.length=e,this.side=i,this.prevWidget=null}static create(t,e,i){return new(t.customView||qe)(t,e,i)}split(t){let e=qe.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 qe&&this.widget.compare(i.widget))||t>0&&s<=0||e0)?ve.before(this.dom):ve.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let i=this.dom.getClientRects(),n=null;if(!i.length)return ce;for(let e=t>0?i.length-1:0;n=i[e],!(t>0?0==e:e==i.length-1||n.top0?-1:1);return this.length?n:ue(n,this.side>0)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class Le extends qe{domAtPos(t){let{topView:e,text:i}=this.widget;return e?ze(t,0,e,i,this.length-e.length,((t,e)=>t.domAtPos(e)),((t,e)=>new ve(t,Math.min(e,t.nodeValue.length)))):new ve(i,Math.min(t,i.nodeValue.length))}sync(){this.setDOM(this.widget.toDOM())}localPosFromDOM(t,e){let{topView:i,text:n}=this.widget;return i?Be(t,e,i,n,this.length-i.length):Math.min(e,this.length)}ignoreMutation(){return!1}get overrideDOMText(){return null}coordsAt(t,e){let{topView:i,text:n}=this.widget;return i?ze(t,e,i,n,this.length-i.length,((t,e,i)=>t.coordsAt(e,i)),((t,e,i)=>Ye(t,e,i))):Ye(n,t,e)}destroy(){var t;super.destroy(),null===(t=this.widget.topView)||void 0===t||t.destroy()}get isEditable(){return!0}canReuseDOM(){return!0}}function ze(t,e,i,n,s,r,o){if(i instanceof Ue){for(let a=i.dom.firstChild;a;a=a.nextSibling){let i=Se.get(a);if(i){let l=ne(a,n),h=i.length+(l?s:0);if(t0?ve.before(this.dom):ve.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){let e=this.dom.getBoundingClientRect(),i=function(t,e){let i=t.parent,n=i?i.children.indexOf(t):-1;for(;i&&n>=0;)if(e<0?n>0:n0?-1:1);return i&&i.tope.top?{left:e.left,right:e.right,top:i.top,bottom:i.bottom}:e}get overrideDOMText(){return t.empty}get isHidden(){return!0}}function Ge(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 Ue&&s.length&&(n=s[s.length-1])instanceof Ue&&n.mark.eq(e.mark)?Fe(n,e.children[0],i-1):(s.push(e),e.setParent(t)),t.length+=e.length}function He(t,e,i){let n=null,s=-1,r=null,o=-1;!function t(e,a){for(let l=0,h=0;l=a&&(c.children.length?t(c,a-h):(!r||r instanceof Ne&&i>0)&&(u>a||h==u&&c.getSide()>0)?(r=c,o=a-h):(h0?3e8:-4e8:e>0?1e8:-1e8,new oi(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}=ai(t,n);e=(s?n?-3e8:-1:5e8)-1,i=1+(r?n?2e8:1:-6e8)}return new oi(t,e,i,n,t.widget||null,!0)}static line(t){return new ri(t)}static set(t,e=!1){return _t.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}ni.none=_t.empty;class si extends ni{constructor(t){let{start:e,end:i}=ai(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){return this==t||t instanceof si&&this.tagName==t.tagName&&this.class==t.class&&Ke(this.attrs,t.attrs)}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}si.prototype.point=!1;class ri extends ni{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof ri&&this.spec.class==t.spec.class&&Ke(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)}}ri.prototype.mapMode=S.TrackBefore,ri.prototype.point=!0;class oi extends ni{constructor(t,e,i,n,s,r){super(e,i,s,t),this.block=n,this.isReplace=r,this.mapMode=n?e<=0?S.TrackBefore:S.TrackAfter:S.TrackDel}get type(){return this.startSide=5}eq(t){return t instanceof oi&&(e=this.widget,i=t.widget,e==i||!!(e&&i&&e.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var e,i}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 ai(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 li(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)}oi.prototype.point=!0;class hi extends Se{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 hi))return!1;this.dom||i.transferDOM(this)}return n&&this.setDeco(i?i.attrs:null),$e(this,t,e,i?i.children:[],s,r),!0}split(t){let e=new hi;if(e.breakAfter=this.breakAfter,0==this.length)return e;let{i: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){Ke(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){Fe(this,t,e)}addLineDeco(t){let e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=Je(e,this.attrs||{})),i&&(this.attrs=Je({class:i},this.attrs||{}))}domAtPos(t){return Ge(this,t)}reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.dirty|=6)}sync(t,e){var i;this.dom?4&this.dirty&&(we(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&&(ti(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&&Se.get(n)instanceof Ue;)n=n.lastChild;if(!(n&&this.length&&("BR"==n.nodeName||0!=(null===(i=Se.get(n))||void 0===i?void 0:i.isEditable)||De.ios&&this.children.some((t=>t instanceof We))))){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 We)||/[^ -~]/.test(i.text))return null;let n=re(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=He(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 hi)return s;if(r>e)break}n=r+s.breakAfter}return null}}class ci extends Se{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 ci&&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(di(new We(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 oi){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let o=e-t;if(i instanceof oi)if(i.block){let{type:t}=i;t!=ii.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new ci(i.widget||new fi("div"),o,t))}else{let r=qe.create(i.widget||new fi("span"),o,o?0:i.startSide),a=this.atCursorPos&&!r.isEditable&&s<=n.length&&(t0),l=!r.isEditable&&(tn.length||i.startSide<=0),h=this.getLine();2!=this.pendingBuffer||a||r.isEditable||(this.pendingBuffer=0),this.flushBuffer(n),a&&(h.append(di(new Ne(1),n),s),s=n.length+Math.max(0,s-n.length)),h.append(di(r,n),s),this.atCursorPos=l,this.pendingBuffer=l?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 ui(t,e,i,s);return r.openEnd=_t.spans(n,e,i,r),r.openStart<0&&(r.openStart=r.openEnd),r.finish(r.openEnd),r}}function di(t,e){for(let i of e)t=new Ue(i,[t],t.length);return t}class fi extends ei{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 pi=E.define(),Oi=E.define(),gi=E.define(),mi=E.define(),bi=E.define(),wi=E.define(),vi=E.define(),yi=E.define({combine:t=>t.some((t=>t))}),Si=E.define({combine:t=>t.some((t=>t))});class xi{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 xi(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin)}}const ki=ut.define({map:(t,e)=>t.map(e)});function Qi(t,e,i){let n=t.facet(mi);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 $i=E.define({combine:t=>!t.length||t[0]});let Pi=0;const Ci=E.define();class _i{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 _i(Pi++,t,i,(t=>{let e=[Ci.of(t)];return s&&e.push(Ti.of((e=>{let i=e.plugin(t);return i?s(i):ni.none}))),n&&e.push(n(t)),e}))}static fromClass(t,e){return _i.define((e=>new t(e)),e)}}class Xi{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(Qi(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){Qi(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){Qi(t.state,e,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Zi=E.define(),Ai=E.define(),Ti=E.define(),Ri=E.define(),Ei=E.define(),Vi=E.define();class Mi{constructor(t,e,i,n){this.fromA=t,this.toA=e,this.fromB=i,this.toB=n}join(t){return new Mi(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(!a)return i;new Mi(a.fromA,a.toA,a.fromB,a.toB).addToSet(i),r=a.toA,o=a.toB}}}class Di{constructor(t,e,i){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=k.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 Mi(t,e,i,s)))),this.changedRanges=n}static create(t,e,i){return new Di(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 Wi=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Wi||(Wi={}));const Ui=Wi.LTR,Yi=Wi.RTL;function qi(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}}const Gi=[];function Fi(t){return[new Ni(0,t,0)]}let Hi="";function Ji(t,e,i,n,s){var r;let o=n.head-t.from,a=-1;if(0==o){if(!s||!t.length)return null;e[0].level!=i&&(o=e[0].side(!1,i),a=0)}else if(o==t.length){if(s)return null;let t=e[e.length-1];t.level!=i&&(o=t.side(!0,i),a=e.length-1)}a<0&&(a=Ni.find(e,o,null!==(r=n.bidiLevel)&&void 0!==r?r:-1,n.assoc));let l=e[a];o==l.side(s,i)&&(l=e[a+=s?1:-1],o=l.side(!s,i));let h=s==(l.dir==i),c=f(t.text,o,h);if(Hi=t.text.slice(Math.min(o,c),Math.max(o,c)),c!=l.side(s,i))return A.cursor(c+t.from,h?-1:1,l.level);let u=a==(s?e.length-1:0)?null:e[a+(s?1:-1)];return u||l.level==i?u&&u.level1)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=Se.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 en(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}class nn{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class sn extends Se{constructor(t){super(),this.view=t,this.compositionDeco=ni.none,this.decorations=[],this.dynamicDecorationMap=[],this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(t.contentDOM),this.children=[new hi],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Mi(0,0,0,t.state.doc.length)],0)}get length(){return this.view.state.doc.length}update(t){let e=t.changedRanges;this.minWidth>0&&e.length&&(e.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),this.view.inputState.composing<0?this.compositionDeco=ni.none:(t.transactions.length||this.dirty)&&(this.compositionDeco=function(t,e){let i=on(t);if(!i)return ni.none;let{from:n,to:s,node:r,text:o}=i,a=e.mapPos(n,1),l=Math.max(a,e.mapPos(s,-1)),{state:h}=t,c=3==r.nodeType?r.nodeValue:new tn([],h).readRange(r.firstChild,null).text;if(l-a{this.dom.style.height=this.view.viewState.contentHeight+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let t=De.chrome||De.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,t),this.dirty=0,t&&(t.written||i.selectionRange.focusNode!=t.node)&&(this.forceSelection=!0),this.dom.style.height=""}));let n=[];if(this.view.viewport.from||this.view.viewport.to=0?t[e]:null;if(!n)break;let{fromA:s,toA:r,fromB:o,toB:a}=n,{content:l,breakAtStart:h,openStart:c,openEnd:u}=ui.build(this.view.state.doc,o,a,this.decorations,this.dynamicDecorationMap),{i:d,off:f}=i.findPos(r,1),{i:p,off:O}=i.findPos(s,-1);Qe(this,p,O,d,f,l,h,c,u)}}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&&se(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,a=this.domAtPos(o.anchor),l=o.empty?a:this.domAtPos(o.head);if(De.gecko&&o.empty&&!this.compositionDeco.size&&(1==(h=a).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((()=>a.node.insertBefore(t,a.node.childNodes[a.offset]||null))),a=l=new ve(t,0),r=!0}var h;let c=this.view.observer.selectionRange;!r&&c.focusNode&&oe(a.node,a.offset,c.anchorNode,c.anchorOffset)&&oe(l.node,l.offset,c.focusNode,c.focusOffset)||(this.view.observer.ignore((()=>{De.android&&De.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=ie(this.view.root);if(t)if(o.empty){if(De.gecko){let t=(e=a.node,n=a.offset,1!=e.nodeType?0:(n&&"false"==e.childNodes[n-1].contentEditable?1:0)|(no.head&&([a,l]=[l,a]),e.setEnd(l.node,l.offset),e.setStart(a.node,a.offset),t.removeAllRanges(),t.addRange(e)}else;var e,n;s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())})),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new ve(c.anchorNode,c.anchorOffset),this.impreciseHead=l.precise?null:new ve(c.focusNode,c.focusOffset)}enforceCursorAssoc(){if(this.compositionDeco.size)return;let{view:t}=this,e=t.state.selection.main,i=ie(t.root),{anchorNode:n,anchorOffset:s}=t.observer.selectionRange;if(!(i&&e.empty&&e.assoc&&i.modify))return;let r=hi.find(this,e.head);if(!r)return;let o=r.posAtStart;if(e.head==o||e.head==o+r.length)return;let a=this.coordsAt(e.head,-1),l=this.coordsAt(e.head,1);if(!a||!l||a.bottom>l.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)}nearest(t){for(let e=t;e;){let t=Se.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!=ii.WidgetBefore&&s.type!=ii.WidgetAfter&&(!n||2==e||this.children[n-1].breakAfter||this.children[n-1].type==ii.WidgetBefore&&e>-2))return s.coordsAt(t-r,e);i=r}}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,a=this.view.textDirection==Wi.LTR;for(let t=0,l=0;ln)break;if(t>=i){let i=h.dom.getBoundingClientRect();if(e.push(i.height),r){let e=h.dom.lastChild,n=e?re(e):[];if(n.length){let e=n[n.length-1],r=a?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?Wi.RTL:Wi.LTR}measureTextSize(){for(let t of this.children)if(t instanceof hi){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.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(n);let s=re(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 ke(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;t.push(ni.replace({widget:new rn(n),block:!0,inclusive:!0,isBlockGap:!0}).range(i,r))}if(!s)break;i=s.to+1}return ni.set(t)}updateDeco(){let t=this.view.state.facet(Ti).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=0,r=0,o=0,a=0;for(let t of this.view.state.facet(Ei).map((t=>t(this.view))))if(t){let{left:e,right:i,top:n,bottom:l}=t;null!=e&&(s=Math.max(s,e)),null!=i&&(r=Math.max(r,i)),null!=n&&(o=Math.max(o,n)),null!=l&&(a=Math.max(a,l))}let l={left:n.left-s,top:n.top-o,right:n.right+r,bottom:n.bottom+a};!function(t,e,i,n,s,r,o,a){let l=t.ownerDocument,h=l.defaultView||window;for(let c=t;c;)if(1==c.nodeType){let t,u=c==l.body;if(u)t=de(h);else{if(c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let e=c.getBoundingClientRect();t={left:e.left,right:e.left+c.clientWidth,top:e.top,bottom:e.top+c.clientHeight}}let d=0,f=0;if("nearest"==s)e.top0&&e.bottom>t.bottom+f&&(f=e.bottom-t.bottom+f+o)):e.bottom>t.bottom&&(f=e.bottom-t.bottom+o,i<0&&e.top-f0&&e.right>t.right+d&&(d=e.right-t.right+d+r)):e.right>t.right&&(d=e.right-t.right+r,i<0&&e.left0))break;i=i.childNodes[n-1],n=he(i)}if(i>=0)for(let n=t,s=e;;){if(3==n.nodeType)return n;if(!(1==n.nodeType&&s=0))break;n=n.childNodes[s],s=0}return null}class hn{constructor(){this.changes=[]}compareRange(t,e){li(t,e,this.changes)}comparePoint(t,e){li(t,e,this.changes)}}function cn(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function un(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function dn(t,e){return t.tope.top+1}function fn(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,a,l,h,c,u=!1;for(let d=t.firstChild;d;d=d.nextSibling){let t=re(d);for(let f=0;fg||o==g&&r>O){n=d,s=p,r=O,o=g;let a=g?i0?f0)}0==O?i>p.bottom&&(!h||h.bottomp.top)&&(l=d,c=p):h&&dn(h,p)?h=pn(h,p.bottom):c&&dn(c,p)&&(c=fn(c,p.top))}}if(h&&h.bottom>=i?(n=a,s=h):c&&c.top<=i&&(n=l,s=c),!n)return{node:t,offset:0};let d=Math.max(s.left,Math.min(s.right,e));return 3==n.nodeType?gn(n,d,i):u&&"false"!=n.contentEditable?On(n,d,i):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,n)+(e>=(s.left+s.right)/2?1:0)}}function gn(t,e,i){let n=t.nodeValue.length,s=-1,r=1e9,o=0;for(let a=0;ai?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(De.chrome||De.gecko){me(t,a).getBoundingClientRect().left==h.right&&(n=!i)}if(c<=0)return{node:t,offset:a+(n?1:0)};s=a+(n?1:0),r=c}}}return{node:t,offset:s>-1?s:o>0?t.nodeValue.length:0}}function mn(t,e,i,n=-1){var s,r;let o,a=t.contentDOM.getBoundingClientRect(),l=a.top+t.viewState.paddingTop,{docHeight:h}=t.viewState,{x:c,y:u}=e,d=u-l;if(d<0)return 0;if(d>h)return t.state.doc.length;for(let e=t.defaultLineHeight/2,s=!1;o=t.elementAtHeight(d),o.type!=ii.Text;)for(;d=n>0?o.bottom+e:o.top-e,!(d>=0&&d<=h);){if(s)return i?null:0;s=!0,n=-n}u=l+d;let f=o.from;if(ft.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:bn(t,a,o,c,u);let p=t.dom.ownerDocument,O=t.root.elementFromPoint?t.root:p,g=O.elementFromPoint(c,u);g&&!t.contentDOM.contains(g)&&(g=null),g||(c=Math.max(a.left+1,Math.min(a.right-1,c)),g=O.elementFromPoint(c,u),g&&!t.contentDOM.contains(g)&&(g=null));let m,b=-1;if(g&&0!=(null===(s=t.docView.nearest(g))||void 0===s?void 0:s.isEditable))if(p.caretPositionFromPoint){let t=p.caretPositionFromPoint(c,u);t&&({offsetNode:m,offset:b}=t)}else if(p.caretRangeFromPoint){let e=p.caretRangeFromPoint(c,u);e&&(({startContainer:m,startOffset:b}=e),(!t.contentDOM.contains(m)||De.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 me(t,n-1,n).getBoundingClientRect().left>i}(m,b,c)||De.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}let n=1==t.nodeType?t.getBoundingClientRect():me(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return i-n.left>5}(m,b,c))&&(m=void 0))}if(!m||!t.docView.dom.contains(m)){let e=hi.find(t.docView,f);if(!e)return d>o.top+o.height/2?o.to:o.from;({node:m,offset:b}=On(e.dom,c,u))}let w=t.docView.nearest(m);if(!w)return null;if(w.isWidget&&1==(null===(r=w.dom)||void 0===r?void 0:r.nodeType)){let t=w.dom.getBoundingClientRect();return e.y1.5*t.defaultLineHeight){r+=Math.floor((s-i.top)/t.defaultLineHeight)*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=f(t,n)}return!0===n?-1:t.length}(o,r,t.state.tabSize)}function wn(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=t.bidiSpans(s),o=t.textDirectionAt(s.from);for(let a=e,l=null;;){let e=Ji(s,r,o,a,i),h=Hi;if(!e){if(s.number==(i?t.state.doc.lines:1))return a;h="\n",s=t.state.doc.line(s.number+(i?1:-1)),r=t.bidiSpans(s),e=A.cursor(i?s.from:s.to)}if(l){if(!l(h))return a}else{if(!n)return e;l=n(h)}a=e}}function vn(t,e,i,n){let s=t.state.facet(Ri).map((e=>e(t)));for(;;){let t=!1;for(let r of s)r.between(i.from-1,i.from+1,((s,r,o)=>{i.from>s&&i.fromi.from?A.cursor(s,1):A.cursor(r,-1),t=!0,o.widget.skipPosition&&(i=o.widget.skipPosition(i,e,n)))}));if(!t)return i}}class yn{constructor(t){this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null;let e=(e,i)=>{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 Cn){let n=Cn[i];t.contentDOM.addEventListener(i,(i=>{Pn(t,i)&&e(n,i)}),_n[i]),this.registeredEvents.push(i)}t.scrollDOM.addEventListener("mousedown",(i=>{if(i.target==t.scrollDOM&&i.clientY>t.contentDOM.getBoundingClientRect().bottom&&(e(Cn.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)}})),De.chrome&&102==De.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,De.safari&&t.contentDOM.addEventListener("input",(()=>null))}setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}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=>{Pn(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){Qi(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){Qi(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||xn.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,be(t.contentDOM,e.key,e.keyCode))}ignoreDuringComposition(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(De.safari&&!De.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 Sn=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],xn="dthko",kn=[16,17,18,20,91,92,224,225];function Qn(t){return.7*Math.max(0,t)+8}class $n{constructor(t,e,i,n){this.view=t,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);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(xt.allowMultipleSelections)&&function(t,e){let i=t.state.facet(pi);return i.length?i[0](e):(De.mac,e.altKey)}(t,e),this.dragMove=function(t,e){let i=t.state.facet(Oi);return i.length?i[0](e):De.mac?!e.altKey:!e.ctrlKey}(t,e),this.dragging=!(!function(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let n=ie(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!=Yn(e))&&null}start(t){!1===this.dragging&&(t.preventDefault(),this.select(t))}move(t){var e;if(0==t.buttons)return this.destroy();if(!1!==this.dragging)return;this.select(this.lastEvent=t);let i=0,n=0,s=(null===(e=this.scrollParent)||void 0===e?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight};t.clientX<=s.left+6?i=-Qn(s.left-t.clientX):t.clientX>=s.right-6&&(i=Qn(t.clientX-s.right)),t.clientY<=s.top+6?n=-Qn(s.top-t.clientY):t.clientY>=s.bottom-6&&(n=Qn(t.clientY-s.bottom)),this.setScrollSpeed(i,n)}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)}select(t){let e=this.style.get(t,this.extend,this.multiple);!this.mustSelect&&e.eq(this.view.state.selection)&&e.main.assoc==this.view.state.selection.main.assoc||this.view.dispatch({selection:e,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.docChanged&&this.dragging&&(this.dragging=this.dragging.map(t.changes)),this.style.update(t)&&setTimeout((()=>this.select(this.lastEvent)),20)}}function Pn(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=Se.get(n))&&i.ignoreEvent(e))return!1;return!0}const Cn=Object.create(null),_n=Object.create(null),Xn=De.ie&&De.ie_version<15||De.ios&&De.webkit_version<604;function Zn(t,e){let i,{state:n}=t,s=1,r=n.toText(e),o=r.lines==n.selection.ranges.length;if(null!=Ln&&n.selection.ranges.every((t=>t.empty))&&Ln==r.toString()){let t=-1;i=n.changeByRange((i=>{let a=n.doc.lineAt(i.from);if(a.from==t)return{range:i};t=a.from;let l=n.toText((o?r.line(s++).text:e)+n.lineBreak);return{changes:{from:a.from,insert:l},range:A.cursor(i.from+l.length)}}))}else i=o?n.changeByRange((t=>{let e=r.line(s++);return{changes:{from:t.from,to:t.to,insert:e.text},range:A.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 A.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 A.cursor(e);0==r?i=1:r==s.length&&(i=-1);let o=r,a=r;i<0?o=f(s.text,r,!1):a=f(s.text,r);let l=n(s.text.slice(o,a));for(;o>0;){let t=f(s.text,o,!1);if(n(s.text.slice(t,o))!=l)break;o=t}for(;a{t.inputState.setSelectionOrigin("select"),27==e.keyCode&&(t.inputState.lastEscPress=Date.now())},Cn.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},Cn.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},_n.touchstart=_n.touchmove={passive:!0},Cn.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return;let i=null;for(let n of t.state.facet(gi))if(i=n(t,e),i)break;if(i||0!=e.button||(i=function(t,e){let i=Vn(t,e),n=Yn(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 a,l=Vn(t,e),h=An(t,l.pos,l.bias,n);if(i.pos!=l.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&&(a=function(t,e){for(let i=0;i=e)return A.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,l.pos))?a:o?s.addRange(h):A.create([h])}}}(t,e)),i){let n=t.root.activeElement!=t.contentDOM;t.inputState.startMouseSelection(new $n(t,e,i,n)),n&&t.observer.ignore((()=>ge(t.contentDOM))),t.inputState.mouseSelection&&t.inputState.mouseSelection.start(e)}};let Tn=(t,e)=>t>=e.top&&t<=e.bottom,Rn=(t,e,i)=>Tn(e,i)&&t>=i.left&&t<=i.right;function En(t,e,i,n){let s=hi.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&&Rn(i,n,o))return-1;let a=s.coordsAt(r,1);return a&&Rn(i,n,a)?1:o&&Tn(n,o)?-1:1}function Vn(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:En(t,i,e.clientX,e.clientY)}}const Mn=De.ie&&De.ie_version<=11;let Dn=null,Wn=0,Un=0;function Yn(t){if(!Mn)return t.detail;let e=Dn,i=Un;return Dn=t,Un=Date.now(),Wn=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Wn+1)%3:1}function qn(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&&r.dragMove?{from:r.dragging.from,to:r.dragging.to}:null,a={from:s,insert:i},l=t.state.changes(o?[o,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(s,-1),head:l.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"})}Cn.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")},Cn.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&&qn(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 qn(t,e,e.dataTransfer.getData("Text"),!0)},Cn.paste=(t,e)=>{if(t.state.readOnly)return e.preventDefault();t.observer.flush();let i=Xn?null:e.clipboardData;i?(Zn(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(),Zn(t,i.value)}),50)}(t)};let Ln=null;Cn.copy=Cn.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;Ln=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 zn=lt.define();function In(t,e){let i=[];for(let n of t.facet(vi)){let s=n(t,e);s&&i.push(s)}return i?t.update({effects:i,annotations:zn.of(!0)}):null}function Bn(t){setTimeout((()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=In(t.state,e);i?t.dispatch(i):t.update([])}}),10)}Cn.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),Bn(t)},Cn.blur=t=>{t.observer.clearSelectionRange(),Bn(t)},Cn.compositionstart=Cn.compositionupdate=t=>{null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},Cn.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,De.chrome&&De.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then((()=>t.observer.flush())):setTimeout((()=>{t.inputState.composing<0&&t.docView.compositionDeco.size&&t.update([])}),50)},Cn.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},Cn.beforeinput=(t,e)=>{var i;let n;if(De.chrome&&De.android&&(n=Sn.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 jn=["pre-wrap","normal","pre-line","break-spaces"];class Nn{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){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return jn.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i-1,a=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,a){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)>Jn&&(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:a,toA:l,fromB:h,toB:c}=n[o],u=s.lineAt(a,Hn.ByPosNoHeight,i.setDoc(e),0,0),d=u.to>=l?u:s.lineAt(l,Hn.ByPosNoHeight,i,0,0);for(c+=d.to-l,l=d.to;o>0&&u.from<=n[o-1].toA;)a=n[o-1].fromA,h=n[o-1].fromB,o--,a2*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 es extends ts{constructor(t,e){super(t,e,ii.Text),this.collapsed=0,this.widgetHeight=0}replace(t,e,i){let n=i[0];return 1==i.length&&(n instanceof es||n instanceof is&&4&n.flags)&&Math.abs(this.length-n.length)<10?(n instanceof is?n=new es(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.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class is 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:a}=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),l=o+r.length*a,h=Math.max(i,t-l/2);return new Fn(r.from,r.length,h,l,ii.Text)}{let n=Math.max(0,Math.min(r-s,Math.floor((t-i)/o))),{from:a,length:l}=e.doc.line(s+n);return new Fn(a,l,i+o*n,o,ii.Text)}}lineAt(t,e,i,n,s){if(e==Hn.ByHeight)return this.blockAt(t,i,n,s);if(e==Hn.ByPosNoHeight){let{from:e,to:n}=i.doc.lineAt(t);return new Fn(e,n-e,0,0,ii.Text)}let{firstLine:r,perLine:o,perChar:a}=this.heightMetrics(i,s),l=i.doc.lineAt(t),h=o+l.length*a,c=l.number-r,u=n+o*c+a*(l.from-s-c);return new Fn(l.from,l.length,Math.max(n,Math.min(u,n+this.height-h)),h,ii.Text)}forEachLine(t,e,i,n,s,r){t=Math.max(t,s),e=Math.min(e,s+this.length);let{firstLine:o,perLine:a,perChar:l}=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+=a*i+l*(t-s-i)}let n=a+l*e.length;r(new Fn(e.from,e.length,c,n,ii.Text)),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 is?i[i.length-1]=new is(t.length+n):i.push(null,new is(n-1))}if(t>0){let e=i[0];e instanceof is?i[0]=new is(t+e.length):i.unshift(new is(t-1),null)}return Kn.of(i)}decomposeLeft(t,e){e.push(new is(t-1),null)}decomposeRight(t,e){e.push(null,new is(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 is(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)>=Jn&&(o=-2);let a=new es(e,s);a.outdated=!1,i.push(a),r+=e+1}r<=s&&i.push(null,new is(s-r).updateHeight(t,r));let a=Kn.of(i);return(o<0||Math.abs(a.height-this.height)>=Jn||Math.abs(o-this.heightMetrics(t,e).perLine)>=Jn)&&(t.heightChanged=!0),a}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class ns 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 l;let h=e==Hn.ByPosNoHeight?Hn.ByPosNoHeight:Hn.ByPos;return a?l.join(this.right.lineAt(o,h,i,r,o)):this.left.lineAt(o,h,i,n,s).join(l)}forEachLine(t,e,i,n,s,r){let o=n+this.left.height,a=s+this.left.length+this.break;if(this.break)t=a&&this.right.forEachLine(t,e,i,o,a,r);else{let l=this.lineAt(a,Hn.ByPos,i,n,s);t=t&&l.from<=e&&r(l),e>l.to&&this.right.forEachLine(l.to+1,e,i,o,a,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&&ss(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,a=null;return n&&n.from<=e+s.length&&n.more?a=s=s.updateHeight(t,e,i,n):s.updateHeight(t,e,i),n&&n.from<=o+r.length&&n.more?a=r=r.updateHeight(t,o,i,n):r.updateHeight(t,o,i),a?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 ss(t,e){let i,n;null==t[e]&&(i=t[e-1])instanceof is&&(n=t[e+1])instanceof is&&t.splice(e-1,3,new is(i.length+1+n.length))}class rs{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 es?i.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new es(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)}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 es(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let i=new is(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 es)return t;let e=new es(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine(),t.type!=ii.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,t.type!=ii.WidgetBefore&&(this.covering=t)}addLineDeco(t,e){let i=this.ensureLine();i.length+=e,i.collapsed+=e,i.widgetHeight=Math.max(i.widgetHeight,t),this.writtenTo=this.pos=this.pos+e}finish(t){let e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof es||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),a=Math.max(a,n.top),l=e==t.parentNode?n.bottom:Math.min(l,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:a-(i.top+e),bottom:Math.max(a,l)-(i.top+e)}}function ls(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class hs{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 Nn(i),this.stateDeco=e.facet(Ti).filter((t=>"function"!=typeof t)),this.heightMap=Kn.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle.setDoc(e.doc),[new Mi(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ni.set(this.lineGaps.map((t=>t.draw(!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 ds(e,i))}}this.viewports=t.sort(((t,e)=>t.from-e.from)),this.scaler=this.heightMap.height<=7e6?gs:new ms(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:bs(t,this.scaler))}))}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=this.state.facet(Ti).filter((t=>"function"!=typeof t));let n=t.changedRanges,s=Mi.extendWithRanges(n,function(t,e,i){let n=new os;return _t.compare(t,e,i,n,0),n.changes}(i,this.stateDeco,t?t.changes:k.empty(this.state.doc.length))),r=this.heightMap.height;this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),s),this.heightMap.height!=r&&(t.flags|=2);let o=s.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.heado.to)||!this.viewportIsAppropriate(o))&&(o=this.getViewport(0,e));let a=!t.changes.empty||2&t.flags||o.from!=this.viewport.from||o.to!=this.viewport.to;this.viewport=o,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(Si)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let i=e.contentDOM,n=window.getComputedStyle(i),s=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Wi.RTL:Wi.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),a=i.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let h=0,c=0,u=parseInt(n.paddingTop)||0,d=parseInt(n.paddingBottom)||0;this.paddingTop==u&&this.paddingBottom==d||(this.paddingTop=u,this.paddingBottom=d,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let f=(this.printing?ls:as)(i,this.paddingTop),p=f.top-this.pixelViewport.top,O=f.bottom-this.pixelViewport.bottom;this.pixelViewport=f;let g=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(g!=this.inView&&(this.inView=g,g&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let m=a.width;if(this.contentDOMWidth==m&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,h|=8),l){let i=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(i)&&(o=!0),o||s.lineWrapping&&Math.abs(m-this.contentDOMWidth)>s.charWidth){let{lineHeight:t,charWidth:n,textHeight:a}=e.docView.measureTextSize();o=t>0&&s.refresh(r,t,n,a,m/n,i),o&&(e.docView.minWidth=0,h|=8)}p>0&&O>0?c=Math.max(p,O):p<0&&O<0&&(c=Math.min(p,O)),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 Mi(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new Gn(n.from,r))}s.heightChanged&&(h|=2)}let b=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return b&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(2&h||b)&&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,a=new ds(n.lineAt(r-1e3*i,Hn.ByHeight,s,0,0).from,n.lineAt(o+1e3*(1-i),Hn.ByHeight,s,0,0).to);if(e){let{head:t}=e.range;if(ta.to){let i,r=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=n.lineAt(t,Hn.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!=Wi.LTR&&!i)return[];let o=[],a=(n,r,l,h)=>{if(r-nn&&tt.from>=l.from&&t.to<=l.to&&Math.abs(t.from-n)t.frome))));if(!d){if(rt.from<=r&&t.to>=r))){let t=e.moveToLineBoundary(A.cursor(r),!1,!0).head;t>n&&(r=t)}d=new hs(n,r,this.gapSize(l,n,r,h))}o.push(d)};for(let t of this.viewportLines){if(t.lengtht.from&&a(t.from,s,t,e),ot.draw(this.heightOracle.lineWrapping)))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];_t.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))||bs(this.heightMap.lineAt(t,Hn.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return bs(this.heightMap.lineAt(this.scaler.fromDOM(t),Hn.ByHeight,this.heightOracle,0,0),this.scaler)}elementAtHeight(t){return bs(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 ds{constructor(t,e){this.from=t,this.to=e}}function fs(t,e,i){let n=[],s=t,r=0;return _t.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 Os(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 gs={toDOM:t=>t,fromDOM:t=>t,scale:1};class ms{constructor(t,e,i){let n=0,s=0,r=0;this.viewports=i.map((({from:i,to:s})=>{let r=e.lineAt(i,Hn.ByPos,t,0,0).top,o=e.lineAt(s,Hn.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=ebs(t,e))):t.type)}const ws=E.define({combine:t=>t.join(" ")}),vs=E.define({combine:t=>t.indexOf(!0)>-1}),ys=It.newName(),Ss=It.newName(),xs=It.newName(),ks={"&light":"."+Ss,"&dark":"."+xs};function Qs(t,e,i){return new It(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 $s=Qs("."+ys,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",borderRadius:"4px",marginTop:"0.5rem",width:"30%",minWidth:"190px",marginLeft:"auto",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&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:"#333338",fontSize:"70%",padding:".2em 1em",borderRadius:"4px"},"&light .cm-button":{background:"#eee"},"&dark .cm-button":{background:"#eee"},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",borderRadius:"0.25rem",border:"1px solid silver",padding:".0em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},ks);class Ps{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;i&&(e.push(new nn(i,n)),s==i&&r==n||e.push(new nn(s,r)));return e}(t),i=new tn(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?A.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||!ne(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||!ne(t.contentDOM,e.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(e.anchorNode,e.anchorOffset);this.newSel=A.single(n,i)}}}function Cs(e,i){let n,{newSel:s}=i,r=e.state.selection.main;if(i.bounds){let{from:s,to:o}=i.bounds,a=r.from,l=null;(8===e.inputState.lastKeyCode&&e.inputState.lastKeyTime>Date.now()-100||De.android&&i.text.length0&&a>0&&t.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if("end"==n){i-=o+Math.max(0,r-Math.min(o,a))-r}if(o=o?r-i:0,a=r+(a-o),o=r}else if(a=a?r-i:0,o=r+(o-a),a=r}return{from:r,toA:o,toB:a}}(e.state.doc.sliceString(s,o,Ki),i.text,a-s,l);h&&(De.chrome&&13==e.inputState.lastKeyCode&&h.toB==h.from+2&&i.text.slice(h.from,h.toB)==Ki+Ki&&h.toB--,n={from:s+h.from,to:s+h.toA,insert:t.of(i.text.slice(h.from,h.toB).split(Ki))})}else s&&(!e.hasFocus&&e.state.facet($i)||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))}:(De.mac||De.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=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}):De.chrome&&n&&n.from==n.to&&n.from==r.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(s&&(s=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}),n){let t=e.state;if(De.ios&&e.inputState.flushIOSKey(e))return!0;if(De.android&&(n.from==r.from&&n.to==r.to&&1==n.insert.length&&2==n.insert.lines&&be(e.contentDOM,"Enter",13)||n.from==r.from-1&&n.to==r.to&&0==n.insert.length&&be(e.contentDOM,"Backspace",8)||n.from==r.from&&n.to==r.to+1&&0==n.insert.length&&be(e.contentDOM,"Delete",46)))return!0;let i,o=n.insert.toString();if(e.state.facet(wi).some((t=>t(e,n.from,n.to,o))))return!0;if(e.inputState.composing>=0&&e.inputState.composing++,n.from>=r.from&&n.to<=r.to&&n.to-n.from>=(r.to-r.from)/3&&(!s||s.main.empty&&s.main.from==n.from+n.insert.length)&&e.inputState.composing<0){let s=r.fromn.to?t.sliceDoc(n.to,r.to):"";i=t.replaceSelection(e.state.toText(s+n.insert.sliceString(0,void 0,e.state.lineBreak)+o))}else{let o=t.changes(n),a=s&&s.main.to<=o.newLength?s.main:void 0;if(t.selection.ranges.length>1&&e.inputState.composing>=0&&n.to<=r.to&&n.to>=r.to-10){let s=e.state.sliceDoc(n.from,n.to),l=on(e)||e.state.doc.lineAt(r.head),h=r.to-n.to,c=r.to-r.from;i=t.changeByRange((i=>{if(i.from==r.from&&i.to==r.to)return{changes:o,range:a||i.map(o)};let u=i.to-h,d=u-s.length;if(i.to-i.from!=c||e.state.sliceDoc(d,u)!=s||l&&i.to>=l.from&&i.from<=l.to)return{range:i};let f=t.changes({from:d,to:u,insert:n.insert}),p=i.to-r.to;return{changes:f,range:a?A.range(Math.max(0,a.anchor+p),Math.max(0,a.head+p)):i.map(f)}}))}else i={changes:o,selection:a&&t.selection.replaceRange(a)}}let a="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,a+=".compose",e.inputState.compositionFirstChange&&(a+=".start",e.inputState.compositionFirstChange=!1)),e.dispatch(i,{scrollIntoView:!0,userEvent:a}),!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 _s={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Xs=De.ie&&De.ie_version<=11;class Zs{constructor(t){this.view=t,this.active=!1,this.selectionRange=new fe,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);(De.ie&&De.ie_version<=11||De.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()})),Xs&&(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")))}),{}),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($i)?i.root.activeElement!=this.dom:!se(i.dom,n))return;let s=n.anchorNode&&i.docView.nearest(n.anchorNode);s&&s.ignoreEvent(t)?e||(this.selectionChanged=!1):(De.ie&&De.ie_version<=11||De.android&&De.chrome)&&!i.state.selection.main.empty&&n.focusNode&&oe(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=De.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,a=t.docView.domAtPos(t.state.selection.main.anchor);oe(a.node,a.offset,r,o)&&([n,s,r,o]=[r,o,n,s]);return{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:o}}(this.view)||ie(t.root);if(!e||this.selectionRange.eq(e))return!1;let i=se(this.dom,e);return i&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let t=this.delayedAndroidKey;t&&(this.clearDelayedAndroidKey(),!this.flush()&&t.force&&be(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&&se(this.dom,this.selectionRange);return t<0&&!n?null:(t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new Ps(this.view,t,e,i))}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=Cs(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.dirty|=4),"childList"==t.type){let i=As(e,t.previousSibling||t.target.previousSibling,-1),n=As(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 As(t,e,i){for(;e;){let n=Se.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 Ts{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),this._dispatch=t.dispatch||(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 us(t.state||xt.create(t)),this.plugins=this.state.facet(Ci).map((t=>new Xi(t)));for(let t of this.plugins)t.update(this);this.observer=new Zs(this),this.inputState=new yn(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new sn(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),t.parent&&t.parent.appendChild(this.dom)}get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}dispatch(...t){this._dispatch(1==t.length&&t[0]instanceof dt?t[0]:this.state.update(...t))}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,a=null;t.some((t=>t.annotation(zn)))?(this.inputState.notifiedFocused=r,o=1):r!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=r,a=In(s,r),a||(o=1));let l=this.observer.delayedAndroidKey,h=null;if(l?(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(xt.phrases)!=this.state.facet(xt.phrases))return this.setState(s);e=Di.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 xi(t.empty?t:A.cursor(t.head,t.head>t.anchor?-1:1))}for(let t of e.effects)t.is(ki)&&(c=t.value)}this.viewState.update(e,c),this.bidiCache=Vs.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),i=this.docView.update(e),this.state.facet(Vi)!=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(ws)!=e.state.facet(ws)&&(this.viewState.mustMeasureContent=!0),(i||n||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!e.empty)for(let t of this.state.facet(bi))t(e);(a||h)&&Promise.resolve().then((()=>{a&&this.state==a.startState&&this.dispatch(a),h&&!Cs(this,h)&&l.force&&be(this.contentDOM,l.key,l.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 us(t),this.plugins=t.facet(Ci).map((t=>new Xi(t))),this.pluginMap.clear();for(let t of this.plugins)t.update(this);this.docView=new sn(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(Ci),i=t.state.facet(Ci);if(e!=i){let n=[];for(let s of i){let i=e.indexOf(s);if(i<0)n.push(new Xi(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.measureScheduled=0,t&&this.observer.forceFlush();let e=null,{scrollHeight:i,scrollTop:n,clientHeight:s}=this.scrollDOM,r=n>i-s-4?i:n;try{for(let t=0;;t++){this.updateState=1;let i=this.viewport,n=this.viewState.lineBlockAtHeight(r),s=this.viewState.measure(this);if(!s&&!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 o=[];4&s||([this.measureRequests,o]=[o,this.measureRequests]);let a=o.map((t=>{try{return t.read(this)}catch(t){return Qi(this.state,t),Es}})),l=Di.create(this,this.state,[]),h=!1,c=!1;l.flags|=s,e?e.flags|=s:e=l,this.updateState=2,l.empty||(this.updatePlugins(l),this.inputState.update(l),this.updateAttrs(),h=this.docView.update(l));for(let t=0;t1||t<-1)&&(this.scrollDOM.scrollTop+=t,c=!0)}if(h&&this.docView.updateSelection(!0),this.viewport.from==i.from&&this.viewport.to==i.to&&!c&&0==this.measureRequests.length)break}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let t of this.state.facet(bi))t(e)}get themeClasses(){return ys+" "+(this.state.facet(vs)?xs:Ss)+" "+this.state.facet(ws)}updateAttrs(){let t=Ms(this,Zi,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet($i)?"true":"false",class:"cm-content",style:`${De.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Ms(this,Ai,e);let i=this.observer.ignore((()=>{let i=ti(this.contentDOM,this.contentAttrs,e),n=ti(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)if(t.is(Ts.announce)){e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(Vi),It.mount(this.root,this.styleModules.concat($s).reverse())}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}}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 vn(this,t,wn(this,t,e,i))}moveByCharSelected(t,e,i){return vn(this,t,wn(this,t,e,i),!0)}moveByGroup(t,e){return vn(this,t,wn(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==wt.Space&&(s=e),s==e}}(this,t.head,e))))}moveToLineBoundary(t,e,i=!0){return function(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=n&&t.lineWrapping?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==Wi.LTR)?e.right-1:e.left+1,y:(r.top+r.bottom)/2});if(null!=o)return A.cursor(o,i?-1:1)}let o=hi.find(t.docView,e.head),a=o?i?o.posAtEnd:o.posAtStart:i?s.to:s.from;return A.cursor(a,i?-1:1)}(this,t,e,i)}moveVertically(t,e,i){return vn(this,t,function(t,e,i,n){let s=e.head,r=i?1:-1;if(s==(i?t.state.doc.length:0))return A.cursor(s,e.assoc);let o,a=e.goalColumn,l=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s),c=t.documentTop;if(h)null==a&&(a=h.left-l.left),o=r<0?h.top:h.bottom;else{let e=t.viewState.lineBlockAt(s);null==a&&(a=Math.min(l.right-l.left,t.defaultCharacterWidth*(s-e.from))),o=(r<0?e.top:e.bottom)+c}let u=l.left+a,d=null!=n?n:t.defaultLineHeight>>1;for(let i=0;;i+=10){let n=o+(d+i)*r,h=mn(t,{x:u,y:n},!1,r);if(nl.bottom||(r<0?hs))return A.cursor(h,e.assoc,void 0,a)}}(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(),mn(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 ue(i,s[Ni.find(s,t-n.from,-1,e)].dir==Wi.LTR==e>0)}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(yi)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Rs)return Fi(t.length);let e=this.textDirectionAt(t.from);for(let i of this.bidiCache)if(i.from==t.from&&i.dir==e)return i.order;let i=function(t,e){let i=t.length,n=e==Ui?1:2,s=e==Ui?2:1;if(!t||1==n&&!ji.test(t))return Fi(i);for(let e=0,s=n,o=n;e=0;t-=3)if(Bi[t+1]==-r){let e=Bi[t+2],i=2&e?n:4&e?1&e?s:n:0;i&&(Gi[a]=Gi[Bi[t]]=i),l=t;break}}else{if(189==Bi.length)break;Bi[l++]=a,Bi[l++]=e,Bi[l++]=h}else if(2==(o=Gi[a])||1==o){let t=o==n;h=t?0:1;for(let e=l-3;e>=0;e-=3){let i=Bi[e+2];if(2&i)break;if(t)Bi[e+2]|=2;else{if(4&i)break;Bi[e+2]|=4}}}for(let t=0;te;){let t=i,n=2!=Gi[--i];for(;i>e&&n==(2!=Gi[i-1]);)i--;o.push(new Ni(i,t,n?2:1))}else o.push(new Ni(e,t,0))}else for(let t=0;tDate.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{ge(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 ki.of(new xi("number"==typeof t?A.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}static domEventHandlers(t){return _i.define((()=>({})),{eventHandlers:t})}static theme(t,e){let i=It.newName(),n=[ws.of(i),Vi.of(Qs(`.${i}`,t))];return e&&e.dark&&n.push(vs.of(!0)),n}static baseTheme(t){return N.lowest(Vi.of(Qs("."+ys,t,ks)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),n=i&&Se.get(i)||Se.get(t);return(null===(e=null==n?void 0:n.rootView)||void 0===e?void 0:e.view)||null}}Ts.styleModule=Vi,Ts.inputHandler=wi,Ts.focusChangeEffect=vi,Ts.perLineTextDirection=yi,Ts.exceptionSink=mi,Ts.updateListener=bi,Ts.editable=$i,Ts.mouseSelectionStyle=gi,Ts.dragMovesSelection=Oi,Ts.clickAddsSelectionRange=pi,Ts.decorations=Ti,Ts.atomicRanges=Ri,Ts.scrollMargins=Ei,Ts.darkTheme=vs,Ts.contentAttributes=Ai,Ts.editorAttributes=Zi,Ts.lineWrapping=Ts.contentAttributes.of({class:"cm-lineWrapping"}),Ts.announce=ut.define();const Rs=4096,Es={};class Vs{constructor(t,e,i,n){this.from=t,this.to=e,this.dir=i,this.order=n}static update(t,e){if(e.empty)return t;let i=[],n=t.length?t[t.length-1].dir:Wi.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&&Je(r,i)}return i}const Ds=De.mac?"mac":De.windows?"win":De.linux?"linux":"key";function Ws(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 Us=N.default(Ts.domEventHandlers({keydown:(t,e)=>Bs(Ls(e.state),t,e,"editor")})),Ys=E.define({enables:Us}),qs=new WeakMap;function Ls(t){let e=t.facet(Ys),i=qs.get(e);return i||qs.set(e,i=function(t,e=Ds){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)=>{var a,l;let h=i[t]||(i[t]=Object.create(null)),c=n.split(/ (?!$)/).map((t=>function(t,e){const i=t.split(/-(?!$)/);let n,s,r,o,a=i[i.length-1];"Space"==a&&(a=" ");for(let t=0;t{let n=zs={view:e,prefix:i,scope:t};return setTimeout((()=>{zs==n&&(zs=null)}),Is),!0}]})}let u=c.join(" ");s(u,!1);let d=h[u]||(h[u]={preventDefault:!1,run:(null===(l=null===(a=h._any)||void 0===a?void 0:a.run)||void 0===l?void 0:l.slice())||[]});r&&d.run.push(r),o&&(d.preventDefault=!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,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.shift&&r(e,"Shift-"+s,n.shift,n.preventDefault)}return i}(e.reduce(((t,e)=>t.concat(e)),[]))),i}let zs=null;const Is=4e3;function Bs(t,e,i,n){let s=function(t){var e=!(Kt&&(t.ctrlKey||t.altKey||t.metaKey)||Jt&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?Gt:Nt)[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=v(b(s,0))==s.length&&" "!=s,o="",a=!1;zs&&zs.view==i&&zs.scope==n&&(o=zs.prefix+" ",(a=kn.indexOf(e.keyCode)<0)&&(zs=null));let l,h,c=new Set,u=t=>{if(t){for(let n of t.run)if(!c.has(n)&&(c.add(n),n(i,e)))return!0;t.preventDefault&&(a=!0)}return!1},d=t[n];if(d){if(u(d[o+Ws(s,e,!r)]))return!0;if(r&&(e.altKey||e.metaKey||e.ctrlKey)&&!(De.windows&&e.ctrlKey&&e.altKey)&&(l=Nt[e.keyCode])&&l!=s){if(u(d[o+Ws(l,e,!0)]))return!0;if(e.shiftKey&&(h=Gt[e.keyCode])!=s&&h!=l&&u(d[o+Ws(h,e,!1)]))return!0}else if(r&&e.shiftKey&&u(d[o+Ws(s,e,!0)]))return!0;if(u(d._any))return!0}return a}class js{constructor(t,e,i,n,s){this.className=t,this.left=e,this.top=i,this.width=n,this.height=s}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className==this.className&&(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",null!=this.width&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,i){if(i.empty){let n=t.coordsAtPos(i.head,i.assoc||1);if(!n)return[];let s=Ns(t);return[new js(e,n.left-s.left,n.top-s.top,null,n.bottom-n.top)]}return function(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];let n=Math.max(i.from,t.viewport.from),s=Math.min(i.to,t.viewport.to),r=t.textDirection==Wi.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=Ns(t),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),u=a.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),d=a.right-(c?parseInt(c.paddingRight):0),f=Fs(t,n),p=Fs(t,s),O=f.type==ii.Text?f:null,g=p.type==ii.Text?p:null;t.lineWrapping&&(O&&(O=Gs(t,n,O)),g&&(g=Gs(t,s,g)));if(O&&g&&O.from==g.from)return b(w(i.from,i.to,O));{let e=O?w(i.from,null,O):v(f,!1),n=g?w(null,i.to,g):v(p,!0),s=[];return(O||f).to<(g||p).from-1?s.push(m(u,e.bottom,d,n.top)):e.bottomh&&n.from=r)break;a>s&&l(Math.max(t,s),null==e&&t<=h,Math.min(a,r),null==i&&a>=c,o.dir)}if(s=n.to+1,s>=r)break}return 0==a.length&&l(h,null==e,c,null==i,t.textDirection),{top:s,bottom:o,horizontal:a}}function v(t,e){let i=a.top+(e?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]}}}(t,e,i)}}function Ns(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Wi.LTR?e.left:e.right-t.scrollDOM.clientWidth)-t.scrollDOM.scrollLeft,top:e.top-t.scrollDOM.scrollTop}}function Gs(t,e,i){let n=A.cursor(e);return{from:Math.max(i.from,t.moveToLineBoundary(n,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(n,!0,!0).from),type:ii.Text}}function Fs(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==ii.Text))return t;return i}class Hs{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),e.above&&this.dom.classList.add("cm-layer-above"),e.class&&this.dom.classList.add(e.class),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(Js)!=t.state.facet(Js)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&t.view.requestMeasure(this.measureReq)}setOrder(t){let e=0,i=t.facet(Js);for(;e{return i=t,n=this.drawn[e],!(i.constructor==n.constructor&&i.eq(n));var i,n}))){let e=this.dom.firstChild,i=0;for(let n of t)n.update&&e&&n.constructor&&this.drawn[i].constructor&&n.update(e,this.drawn[i])?(e=e.nextSibling,i++):this.dom.insertBefore(n.draw(),e);for(;e;){let t=e.nextSibling;e.remove(),e=t}this.drawn=t}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Js=E.define();function Ks(t){return[_i.define((e=>new Hs(e,t))),Js.of(t)]}const tr=!De.ios,er=E.define({combine:t=>kt(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})});function ir(t={}){return[er.of(t),sr,or,lr,Si.of(!0)]}function nr(t){return t.startState.facet(er)!=t.state.facet(er)}const sr=Ks({above:!0,markers(t){let{state:e}=t,i=e.facet(er),n=[];for(let s of e.selection.ranges){let r=s==e.selection.main;if(s.empty?!r||tr:i.drawRangeCursor){let e=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",i=s.empty?s:A.cursor(s.head,s.head>s.anchor?-1:1);for(let s of js.forRange(t,e,i))n.push(s)}}return n},update(t,e){t.transactions.some((t=>t.selection))&&(e.style.animationName="cm-blink"==e.style.animationName?"cm-blink2":"cm-blink");let i=nr(t);return i&&rr(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){rr(e.state,t)},class:"cm-cursorLayer"});function rr(t,e){e.style.animationDuration=t.facet(er).cursorBlinkRate+"ms"}const or=Ks({above:!1,markers:t=>t.state.selection.ranges.map((e=>e.empty?[]:js.forRange(t,"cm-selectionBackground",e))).reduce(((t,e)=>t.concat(e))),update:(t,e)=>t.docChanged||t.selectionSet||t.viewportChanged||nr(t),class:"cm-selectionLayer"}),ar={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};tr&&(ar[".cm-line"].caretColor="transparent !important");const lr=N.highest(Ts.theme(ar)),hr=ut.define({map:(t,e)=>null==t?null:e.mapPos(t)}),cr=q.define({create:()=>null,update:(t,e)=>(null!=t&&(t=e.changes.mapPos(t)),e.effects.reduce(((t,e)=>e.is(hr)?e.value:t),t))}),ur=_i.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let i=t.state.field(cr);null==i?null!=this.cursor&&(null===(e=this.cursor)||void 0===e||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(cr)!=i||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let t=this.view.state.field(cr),e=null!=t&&this.view.coordsAtPos(t);if(!e)return null;let i=this.view.scrollDOM.getBoundingClientRect();return{left:e.left-i.left+this.view.scrollDOM.scrollLeft,top:e.top-i.top+this.view.scrollDOM.scrollTop,height:e.bottom-e.top}}drawCursor(t){this.cursor&&(t?(this.cursor.style.left=t.left+"px",this.cursor.style.top=t.top+"px",this.cursor.style.height=t.height+"px"):this.cursor.style.left="-100000px")}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(cr)!=t&&this.view.dispatch({effects:hr.of(t)})}},{eventHandlers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){t.target!=this.view.contentDOM&&this.view.contentDOM.contains(t.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function dr(){return[cr,ur]}function fr(t,e,i,n,s){e.lastIndex=0;for(let r,o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)if(!o.lineBreak)for(;r=e.exec(o.value);)s(a+r.index,r)}class pr{constructor(t){const{regexp:e,decoration:i,decorate:n,boundary:s,maxLength:r=1e3}=t;if(!e.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=e,n)this.addMatch=(t,e,i,s)=>n(s,i,i+t[0].length,t,e);else if("function"==typeof i)this.addMatch=(t,e,n,s)=>{let r=i(t,e,n);r&&s(n,n+t[0].length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(t,e,n,s)=>s(n,n+t[0].length,i)}this.boundary=s,this.maxLength=r}createDeco(t){let e=new Xt,i=e.add.bind(e);for(let{from:e,to:n}of function(t,e){let i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;let n=[];for(let{from:s,to:r}of i)s=Math.max(t.state.doc.lineAt(s).from,s-e),r=Math.min(t.state.doc.lineAt(r).to,r+e),n.length&&n[n.length-1].to>=s?n[n.length-1].to=r:n.push({from:s,to:r});return n}(t,this.maxLength))fr(t.state.doc,this.regexp,e,n,((e,n)=>this.addMatch(n,t,e,i)));return e.finish()}updateDeco(t,e){let i=1e9,n=-1;return t.docChanged&&t.changes.iterChanges(((e,s,r,o)=>{o>t.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e}updateRange(t,e,i,n){for(let s of t.visibleRanges){let r=Math.max(s.from,i),o=Math.min(s.to,n);if(o>r){let i=t.state.doc.lineAt(r),n=i.toi.from;r--)if(this.boundary.test(i.text[r-1-i.from])){a=r;break}for(;oc.push(i.range(t,e));if(i==n)for(this.regexp.lastIndex=a-i.from;(h=this.regexp.exec(i.text))&&h.indexthis.addMatch(i,t,e,u)));e=e.update({filterFrom:a,filterTo:l,filter:(t,e)=>tl,add:c})}}return e}}const Or=null!=/x/.unicode?"gu":"g",gr=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",Or),mr={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let br=null;const wr=E.define({combine(t){let e=kt(t,{render:null,specialChars:gr,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==br&&"undefined"!=typeof document&&document.body){let e=document.body.style;br=null!=(null!==(t=e.tabSize)&&void 0!==t?t:e.MozTabSize)}return br||!1}())&&(e.specialChars=new RegExp("\t|"+e.specialChars.source,Or)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Or)),e}});function vr(t={}){return[wr.of(t),yr||(yr=_i.fromClass(class{constructor(t){this.view=t,this.decorations=ni.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(wr)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new pr({regexp:t.specialChars,decoration:(e,i,n)=>{let{doc:s}=i.state,r=b(e[0],0);if(9==r){let t=s.lineAt(n),e=i.state.tabSize,r=Yt(t.text,e,n-t.from);return ni.replace({widget:new xr((e-r%e)*this.view.defaultCharacterWidth)})}return this.decorationCache[r]||(this.decorationCache[r]=ni.replace({widget:new Sr(t,r)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(wr);t.startState.facet(wr)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))]}let yr=null;class Sr extends ei{constructor(t,e){super(),this.options=t,this.code=e}eq(t){return t.code==this.code}toDOM(t){let e=function(t){return t>=32?"•":10==t?"␤":String.fromCharCode(9216+t)}(this.code),i=t.state.phrase("Control character")+" "+(mr[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,i,e);if(n)return n;let s=document.createElement("span");return s.textContent=e,s.title=i,s.setAttribute("aria-label",i),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class xr extends ei{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent="\t",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}class kr extends ei{constructor(t){super(),this.content=t}toDOM(){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):this.content),"string"==typeof this.content?t.setAttribute("aria-label","placeholder "+this.content):t.setAttribute("aria-hidden","true"),t}ignoreEvent(){return!1}}const Qr="-10000px";class $r{constructor(t,e,i){this.facet=e,this.createTooltipView=i,this.input=t.state.facet(e),this.tooltips=this.input.filter((t=>t)),this.tooltipViews=this.tooltips.map(i)}update(t){var e;let i=t.state.facet(this.facet),n=i.filter((t=>t));if(i===this.input){for(let e of this.tooltipViews)e.update&&e.update(t);return!1}let s=[];for(let e=0;e{var e,i,n;return{position:De.ios?"absolute":(null===(e=t.find((t=>t.position)))||void 0===e?void 0:e.position)||"fixed",parent:(null===(i=t.find((t=>t.parent)))||void 0===i?void 0:i.parent)||null,tooltipSpace:(null===(n=t.find((t=>t.tooltipSpace)))||void 0===n?void 0:n.tooltipSpace)||Pr}}}),_r=new WeakMap,Xr=_i.fromClass(class{constructor(t){this.view=t,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(Cr);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new $r(t,Tr,(t=>this.createTooltip(t))),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout((()=>{this.measureTimeout=-1,this.maybeMeasure()}),50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t);e&&this.observeIntersection();let i=e||t.geometryChanged,n=t.state.facet(Cr);if(n.position!=this.position){this.position=n.position;for(let t of this.manager.tooltipViews)t.dom.style.position=this.position;i=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let t of this.manager.tooltipViews)this.container.appendChild(t.dom);i=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure()}createTooltip(t){let e=t.create(this.view);if(e.dom.classList.add("cm-tooltip"),t.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",e.dom.appendChild(t)}return e.dom.style.position=this.position,e.dom.style.top=Qr,this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var t,e;this.view.win.removeEventListener("resize",this.measureSoon);for(let e of this.manager.tooltipViews)e.dom.remove(),null===(t=e.destroy)||void 0===t||t.call(e);null===(e=this.intersectionObserver)||void 0===e||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=this.view.dom.getBoundingClientRect();return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map(((t,e)=>{let i=this.manager.tooltipViews[e];return i.getCoords?i.getCoords(t.pos):this.view.coordsAtPos(t.pos)})),size:this.manager.tooltipViews.map((({dom:t})=>t.getBoundingClientRect())),space:this.view.state.facet(Cr).tooltipSpace(this.view)}}writeMeasure(t){var e;let{editor:i,space:n}=t,s=[];for(let r=0;r=Math.min(i.bottom,n.bottom)||h.rightMath.min(i.right,n.right)+.1){l.style.top=Qr;continue}let u=o.arrow?a.dom.querySelector(".cm-tooltip-arrow"):null,d=u?7:0,f=c.right-c.left,p=null!==(e=_r.get(a))&&void 0!==e?e:c.bottom-c.top,O=a.offset||Ar,g=this.view.textDirection==Wi.LTR,m=c.width>n.right-n.left?g?n.left:n.right-c.width:g?Math.min(h.left-(u?14:0)+O.x,n.right-f):Math.max(n.left,h.left-f+(u?14:0)-O.x),b=!!o.above;!o.strictSide&&(b?h.top-(c.bottom-c.top)-O.yn.bottom)&&b==n.bottom-h.bottom>h.top-n.top&&(b=!b);let w=(b?h.top-n.top:n.bottom-h.bottom)-d;if(wm&&t.topv&&(v=b?t.top-p-2-d:t.bottom+d+2);"absolute"==this.position?(l.style.top=v-t.parent.top+"px",l.style.left=m-t.parent.left+"px"):(l.style.top=v+"px",l.style.left=m+"px"),u&&(u.style.left=h.left+(g?O.x:-O.x)-(m+14-7)+"px"),!0!==a.overlap&&s.push({left:m,top:v,right:y,bottom:v+p}),l.classList.toggle("cm-tooltip-above",b),l.classList.toggle("cm-tooltip-below",!b),a.positioned&&a.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=Qr}},{eventHandlers:{scroll(){this.maybeMeasure()}}}),Zr=Ts.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Ar={x:0,y:0},Tr=E.define({enables:[Xr,Zr]});function Rr(t,e){let i=t.plugin(Xr);if(!i)return null;let n=i.manager.tooltips.indexOf(e);return n<0?null:i.manager.tooltipViews[n]}const Er=E.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 Vr(t,e){let i=t.plugin(Mr),n=i?i.specs.indexOf(e):-1;return n>-1?i.panels[n]:null}const Mr=_i.fromClass(class{constructor(t){this.input=t.state.facet(Ur),this.specs=this.input.filter((t=>t)),this.panels=this.specs.map((e=>e(t)));let e=t.state.facet(Er);this.top=new Dr(t,!0,e.topContainer),this.bottom=new Dr(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(Er);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Dr(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Dr(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(Ur);if(i!=this.input){let e=i.filter((t=>t)),n=[],s=[],r=[],o=[];for(let i of e){let e,a=this.specs.indexOf(i);a<0?(e=i(t.view),o.push(e)):(e=this.panels[a],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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}}))});class Dr{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=Wr(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=Wr(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 Wr(t){let e=t.nextSibling;return t.remove(),e}const Ur=E.define({enables:Mr});class Yr extends Qt{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Yr.prototype.elementClass="",Yr.prototype.toDOM=void 0,Yr.prototype.mapMode=S.TrackBefore,Yr.prototype.startSide=Yr.prototype.endSide=-1,Yr.prototype.point=!0;const qr=E.define(),Lr={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>_t.empty,lineMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},zr=E.define();function Ir(t){return[jr(),zr.of(Object.assign(Object.assign({},Lr),t))]}const Br=E.define({combine:t=>t.some((t=>t))});function jr(t){let e=[Nr];return t&&!1===t.fixed&&e.push(Br.of(!0)),e}const Nr=_i.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+"px",this.gutters=t.state.facet(zr).map((e=>new Jr(t,e)));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!t.state.facet(Br),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(Br)!=!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=_t.iter(this.view.state.facet(qr),this.view.viewport.from),n=[],s=this.gutters.map((t=>new Hr(t,this.view.viewport,-this.view.documentPadding.top)));for(let t of this.view.viewportLineBlocks){let e;if(Array.isArray(t.type)){for(let i of t.type)if(i.type==ii.Text){e=i;break}}else e=t.type==ii.Text?t:void 0;if(e){n.length&&(n=[]),Fr(i,n,t.from);for(let t of s)t.line(this.view,e,n)}}for(let t of s)t.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(zr),i=t.state.facet(zr),n=t.docChanged||t.heightChanged||t.viewportChanged||!_t.eq(t.startState.facet(qr),t.state.facet(qr),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 Jr(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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&0!=i.gutters.length&&i.fixed?e.textDirection==Wi.LTR?{left:i.dom.offsetWidth}:{right:i.dom.offsetWidth}:null}))});function Gr(t){return Array.isArray(t)?t:[t]}function Fr(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class Hr{constructor(t,e,i){this.gutter=t,this.height=i,this.i=0,this.cursor=_t.iter(t.markers,e.from)}line(t,e,i){let n=[];Fr(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;if(0==n.length&&!r.config.renderEmptyElements)return;let o=e.top-this.height;if(this.i==r.elements.length){let i=new Kr(t,e.height,o,n);r.elements.push(i),r.dom.appendChild(i.dom)}else r.elements[this.i].update(t,e.height,o,n);this.height=e.bottom,this.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 Jr{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=Gr(e.markers(t)),e.initialSpacer&&(this.spacer=new Kr(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=Gr(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!_t.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 Kr{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.dom.style.height=(this.height=e)+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),function(t,e){if(t.length!=e.length)return!1;for(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 io extends Yr{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function no(t,e){return t.state.facet(eo).formatNumber(e,t.state)}const so=zr.compute([eo],(t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:t=>t.state.facet(to),lineMarker:(t,e,i)=>i.some((t=>t.toDOM))?null:new io(no(t,t.state.doc.lineAt(e.from).number)),lineMarkerChange:t=>t.startState.facet(eo)!=t.state.facet(eo),initialSpacer:t=>new io(no(t,ro(t.state.doc.lines))),updateSpacer(t,e){let i=no(e.view,ro(e.view.state.doc.lines));return i==t.number?t:new io(i)},domEventHandlers:t.facet(eo).domEventHandlers})));function ro(t){let e=9;for(;e{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=fo.match(t)),e=>{let i=t(e);return void 0===i?null:[this,i]}}}ho.closedBy=new ho({deserialize:t=>t.split(" ")}),ho.openedBy=new ho({deserialize:t=>t.split(" ")}),ho.group=new ho({deserialize:t=>t.split(" ")}),ho.contextHash=new ho({perNode:!0}),ho.lookAhead=new ho({perNode:!0}),ho.mounted=new ho({perNode:!0});class co{constructor(t,e,i){this.tree=t,this.overlay=e,this.parser=i}}const uo=Object.create(null);class fo{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):uo,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),n=new fo(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(ho.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(ho.group),n=-1;n<(i?i.length:0);n++){let s=e[n<0?t.name:i[n]];if(s)return s}}}}fo.none=new fo("",Object.create(null),0,8);class po{constructor(t){this.types=t;for(let e=0;e=n&&(r.type.isAnonymous||!1!==e(r))){if(r.firstChild())continue;t=!0}for(;t&&i&&!r.type.isAnonymous&&i(r),!r.nextSibling();){if(!r.parent())return;t=!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:To(fo.none,this.children,this.positions,0,this.children.length,0,this.length,((t,e,i)=>new bo(this.type,t,e,i,this.propValues)),t.makeTree||((t,e,i)=>new bo(fo.none,t,e,i)))}static build(t){return function(t){var e;let{buffer:i,nodeSet:n,maxBufferLength:s=oo,reused:r=[],minRepeatType:o=n.types.length}=t,a=Array.isArray(i)?new wo(i,i.length):i,l=n.types,h=0,c=0;function u(t,e,i,m,b){let{id:w,start:v,end:y,size:S}=a,x=c;for(;S<0;){if(a.next(),-1==S){let e=r[w];return i.push(e),void m.push(v-t)}if(-3==S)return void(h=w);if(-4==S)return void(c=w);throw new RangeError(`Unrecognized record size: ${S}`)}let k,Q,$=l[w],P=v-t;if(y-v<=s&&(Q=O(a.pos-e,b))){let e=new Uint16Array(Q.size-Q.skip),i=a.pos-Q.size,s=e.length;for(;a.pos>i;)s=g(Q.start,e,s);k=new vo(e,y-Q.start,n),P=Q.start-t}else{let t=a.pos-S;a.next();let e=[],i=[],n=w>=o?w:-1,r=0,l=y;for(;a.pos>t;)n>=0&&a.id==n&&a.size>=0?(a.end<=l-s&&(f(e,i,v,r,a.end,l,n,x),r=e.length,l=a.end),a.next()):u(v,t,e,i,n);if(n>=0&&r>0&&r-1&&r>0){let t=d($);k=To($,e,i,0,e.length,0,y-v,t,t)}else k=p($,e,i,y-v,x-y)}i.push(k),m.push(P)}function d(t){return(e,i,n)=>{let s,r,o=0,a=e.length-1;if(a>=0&&(s=e[a])instanceof bo){if(!a&&s.type==t&&s.length==n)return s;(r=s.prop(ho.lookAhead))&&(o=i[a]+s.length+r)}return p(t,e,i,n,o)}}function f(t,e,i,s,r,o,a,l){let h=[],c=[];for(;t.length>s;)h.push(t.pop()),c.push(e.pop()+i-r);t.push(p(n.types[a],h,c,o-r,l-o)),e.push(r-i)}function p(t,e,i,n,s=0,r){if(h){let t=[ho.contextHash,h];r=r?[t].concat(r):[t]}if(s>25){let t=[ho.lookAhead,s];r=r?[t].concat(r):[t]}return new bo(t,e,i,n,r)}function O(t,e){let i=a.fork(),n=0,r=0,l=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=l,l+=4,n+=4,i.next();continue}let a=i.pos-t;if(t<0||a=o?4:0,d=i.start;for(i.next();i.pos>a;){if(i.size<0){if(-3!=i.size)break t;u+=4}else i.id>=o&&(u+=4);i.next()}r=d,n+=t,l+=u}return(e<0||n==t)&&(c.size=n,c.start=r,c.skip=l),c.size>4?c:void 0}function g(t,e,i){let{id:n,start:s,end:r,size:l}=a;if(a.next(),l>=0&&n4){let n=a.pos-(l-4);for(;a.pos>n;)i=g(t,e,i)}e[--i]=o,e[--i]=r-t,e[--i]=s-t,e[--i]=n}else-3==l?h=n:-4==l&&(c=n);return i}let m=[],b=[];for(;a.pos>0;)u(t.start||0,t.bufferStart||0,m,b,-1);let w=null!==(e=t.length)&&void 0!==e?e:m.length?b[0]+m[0].length:0;return new bo(l[t.topID],m.reverse(),b.reverse(),w)}(t)}}bo.empty=new bo(fo.none,[],[],0);class wo{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 wo(this.buffer,this.index)}}class vo{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return fo.none}toString(){let t=[];for(let e=0;e0));a=r[a+3]);return o}slice(t,e,i){let n=this.buffer,s=new Uint16Array(e-t),r=0;for(let o=t,a=0;o=e&&ie;case 1:return i<=e&&n>e;case 2:return n>e;case 4:return!0}}function So(t,e){let i=t.childBefore(e);for(;i;){let e=i.lastChild;if(!e||e.to!=i.to)break;e.type.isError&&e.from==e.to?(t=i,i=e.prevSibling):i=e}return t}function xo(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!=l;t+=e){let l=o[t],h=a[t]+r.from;if(yo(n,i,h,h+l.length))if(l instanceof vo){if(s&mo.ExcludeBuffers)continue;let o=l.findChild(0,l.buffer.length,e,i-h,n);if(o>-1)return new Co(new Po(r,l,t,h),null,o)}else if(s&mo.IncludeAnonymous||!l.type.isAnonymous||Xo(l)){let o;if(!(s&mo.IgnoreMounts)&&l.props&&(o=l.prop(ho.mounted))&&!o.overlay)return new ko(o.tree,h,t,r);let a=new ko(l,h,t,r);return s&mo.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(e<0?l.children.length-1:0,e,i,n)}}if(s&mo.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&mo.IgnoreOverlays)&&(n=this._tree.prop(ho.mounted))&&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 ko(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}cursor(t=0){return new _o(this,t)}get tree(){return this._tree}toTree(){return this._tree}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return So(this,t)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}toString(){return this._tree.toString()}get node(){return this}matchContext(t){return $o(this,t)}}function Qo(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 $o(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 Po{constructor(t,e,i,n){this.parent=t,this.buffer=e,this.index=i,this.start=n}}class Co{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){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 Co(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&mo.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 Co(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 Co(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 Co(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}cursor(t=0){return new _o(this,t)}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 bo(this.type,t,e,this.to-this.from)}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return So(this,t)}toString(){return this.context.buffer.childString(this.index)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}get node(){return this}matchContext(t){return $o(this,t)}}class _o{get name(){return this.type.name}constructor(t,e=0){if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof ko)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let e=t._parent;e;e=e._parent)this.stack.unshift(e.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return!!t&&(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0)}yieldBuf(t,e){this.index=t;let{start:i,buffer:n}=this.buffer;return this.type=e||n.set.types[n.buffer[t]],this.from=i+n.buffer[t+1],this.to=i+n.buffer[t+2],!0}yield(t){return!!t&&(t instanceof ko?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,i){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,i,this.mode));let{buffer:n}=this.buffer,s=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.buffer.start,i);return!(s<0)&&(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,i=this.mode){return this.buffer?!(i&mo.ExcludeBuffers)&&this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&mo.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&mo.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode));let{buffer:e}=this.buffer,i=this.stack.length-1;if(t<0){let t=i<0?0:this.stack[i]+4;if(this.index!=t)return this.yieldBuf(e.findChild(t,this.index,-1,0,4))}else{let t=e.buffer[this.index+3];if(t<(i<0?e.buffer.length:e.buffer[this.stack[i]+3]))return this.yieldBuf(t)}return i<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,i,{buffer:n}=this;if(n){if(t>0){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&mo.IncludeAnonymous||t instanceof vo||!t.type.isAnonymous||Xo(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 $o(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 Xo(t){return t.children.some((t=>t instanceof vo||!t.type.isAnonymous||Xo(t)))}const Zo=new WeakMap;function Ao(t,e){if(!t.isAnonymous||e instanceof vo||e.type!=t)return 1;let i=Zo.get(e);if(null==i){i=1;for(let n of e.children){if(n.type!=t||!(n instanceof bo)){i=1;break}i+=Ao(t,n)}Zo.set(e,i)}return i}function To(t,e,i,n,s,r,o,a,l){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]+a);continue}u.push(i[s])}else{let e=n[h-1]+i[h-1].length-f;u.push(To(t,i,n,s,h,f,e,null,l))}d.push(f+a-r)}}(e,i,n,s,0),(a||l)(u,d,o)}class Ro{constructor(){this.map=new WeakMap}setBuffer(t,e,i){let n=this.map.get(t);n||this.map.set(t,n=new Map),n.set(e,i)}getBuffer(t,e){let i=this.map.get(t);return i&&i.get(e)}set(t,e){t instanceof Co?this.setBuffer(t.context.buffer,t.index,e):t instanceof ko&&this.map.set(t.tree,e)}get(t){return t instanceof Co?this.getBuffer(t.context.buffer,t.index):t instanceof ko?this.map.get(t.tree):void 0}cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}}class Eo{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 Eo(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,a=0,l=0;;o++){let h=o=i)for(;r&&r.from=e.from||c<=e.to||l){let t=Math.max(e.from,a)-l,i=Math.min(e.to,c)-l;e=t>=i?null:new Eo(t,i,e.tree,e.offset+l,o>0,!!h)}if(e&&n.push(e),r.to>c)break;r=snew lo(t.from,t.to))):[new lo(0,0)]:[new lo(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 Mo{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)}}function Do(t){return(e,i,n,s)=>new qo(e,t,i,n,s)}class Wo{constructor(t,e,i,n,s){this.parser=t,this.parse=e,this.overlay=i,this.target=n,this.ranges=s}}class Uo{constructor(t,e,i,n,s,r,o){this.parser=t,this.predicate=e,this.mounts=i,this.index=n,this.start=s,this.target=r,this.prev=o,this.depth=0,this.ranges=[]}}const Yo=new ho({perNode:!0});class qo{constructor(t,e,i,n,s){this.nest=e,this.input=i,this.fragments=n,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=t}advance(){if(this.baseParse){let t=this.baseParse.advance();if(!t)return null;if(this.baseParse=null,this.baseTree=t,this.startInner(),null!=this.stoppedAt)for(let t of this.inner)t.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let t=this.baseTree;return null!=this.stoppedAt&&(t=new bo(t.type,t.children,t.positions,t.length,t.propValues.concat([[Yo,this.stoppedAt]]))),t}let t=this.inner[this.innerDone],e=t.parse.advance();if(e){this.innerDone++;let i=Object.assign(Object.create(null),t.target.props);i[ho.mounted.id]=new co(e,t.overlay,t.parser),t.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let t=this.input.length;for(let e=this.innerDone;et.frag.from<=n.from&&t.frag.to>=n.to&&t.mount.overlay));if(t)for(let i of t.mount.overlay){let s=i.from+t.pos,r=i.to+t.pos;s>=n.from&&r<=n.to&&!e.ranges.some((t=>t.froms))&&e.ranges.push({from:s,to:r})}}a=!1}else if(i&&(r=Lo(i.ranges,n.from,n.to)))a=2!=r;else if(!n.type.isAnonymous&&n.fromnew lo(t.from-n.from,t.to-n.from))):null,n.tree,t)),s.overlay?t.length&&(i={ranges:t,depth:0,prev:i}):a=!1}}else e&&(o=e.predicate(n))&&(!0===o&&(o=new lo(n.from,n.to)),o.fromnew lo(t.from-e.start,t.to-e.start))),e.target,t)),e=e.prev}i&&! --i.depth&&(i=i.prev)}}}}function Lo(t,e,i){for(let n of t){if(n.from>=i)break;if(n.to>e)return n.from<=e&&n.to>=i?2:1}return 0}function zo(t,e,i,n,s,r){if(e=e.to);n++);let o=s.children[n],a=o.buffer;s.children[n]=function t(i,n,s,l,h){let c=i;for(;a[c+2]+r<=e.from;)c=a[c+3];let u=[],d=[];zo(o,i,c,u,d,l);let f=a[c+1],p=a[c+2],O=f+r==e.from&&p+r==e.to&&a[c]==e.type.id;return u.push(O?e.toTree():t(c+4,a[c+3],o.set.types[a[c]],f,p-f)),d.push(f-l),zo(o,a[c+3],n,u,d,l),new bo(s,u,d,h)}(0,a.length,fo.none,0,o.length);for(let n=0;n<=i;n++)t.childAfter(e.from)}class Bo{constructor(t,e){this.offset=e,this.done=!1,this.cursor=t.cursor(mo.IncludeAnonymous|mo.IgnoreMounts)}moveTo(t){let{cursor:e}=this,i=t-this.offset;for(;!this.done&&e.from=t&&e.enter(i,1,mo.IgnoreOverlays|mo.ExcludeBuffers)||e.next(!1)||(this.done=!0)}hasNode(t){if(this.moveTo(t.from),!this.done&&this.cursor.from+this.offset==t.from&&this.cursor.tree)for(let e=this.cursor.tree;;){if(e==t.tree)return!0;if(!(e.children.length&&0==e.positions[0]&&e.children[0]instanceof bo))break;e=e.children[0]}return!1}}let jo=class{constructor(t){var e;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){let i=this.curFrag=t[0];this.curTo=null!==(e=i.tree.prop(Yo))&&void 0!==e?e:i.to,this.inner=new Bo(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t)}nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=null!==(t=e.tree.prop(Yo))&&void 0!==t?t:e.to,this.inner=new Bo(e.tree,-e.offset)}}findMounts(t,e){var i;let n=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let t=this.inner.cursor.node;t;t=t.parent){let s=null===(i=t.tree)||void 0===i?void 0:i.prop(ho.mounted);if(s&&s.parser==e)for(let e=this.fragI;e=t.to)break;i.tree==this.curFrag.tree&&n.push({frag:i,pos:t.from-i.offset,mount:s})}}}return n}};function No(t,e){let i=null,n=e;for(let s=1,r=0;s=a)break;t.to<=o||(i||(n=i=e.slice()),t.froma&&i.splice(r+1,0,new lo(a,t.to))):t.to>a?i[r--]=new lo(a,t.to):i.splice(r--,1))}}return n}function Go(t,e,i,n){let s=0,r=0,o=!1,a=!1,l=-1e9,h=[];for(;;){let c=s==t.length?1e9:o?t[s].to:t[s].from,u=r==e.length?1e9:a?e[r].to:e[r].from;if(o!=a){let t=Math.max(l,i),e=Math.min(c,u,n);tnew lo(t.from+n,t.to+n))),a,l);for(let e=0,n=a;;e++){let a=e==o.length,h=a?l:o[e].from;if(h>n&&i.push(new Eo(n,h,s.tree,-t,r.from>=n||r.openStart,r.to<=h||r.openEnd)),a)break;n=o[e].to}}else i.push(new Eo(a,l,s.tree,-t,r.from>=t||r.openStart,r.to<=o||r.openEnd))}return i}let Ho=0;class Jo{constructor(t,e,i){this.set=t,this.base=e,this.modified=i,this.id=Ho++}static define(t){if(null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let e=new Jo([],null,[]);if(e.set.push(e),t)for(let i of t.set)e.set.push(i);return e}static defineModifier(){let t=new ta;return e=>e.modified.indexOf(t)>-1?e:ta.get(e.base||e,e.modified.concat(t).sort(((t,e)=>t.id-e.id)))}}let Ko=0;class ta{constructor(){this.instances=[],this.id=Ko++}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 Jo(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(ta.get(e,t));return s}}function ea(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,a=i[o];if(!a)throw new RangeError("Invalid path: "+t);let l=new na(n,s,o>0?i.slice(0,o):null);e[a]=l.sort(e[a])}}return ia.add(e)}const ia=new ho;class na{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 ra(t,e,i,n=0,s=t.length){let r=new oa(n,Array.isArray(e)?e:[e],i);r.highlightRange(t.cursor(),n,s,"",r.highlighters),r.flush(s)}na.empty=new na([],2,null);class oa{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:a}=t;if(o>=i||a<=e)return;r.isTop&&(s=this.highlighters.filter((t=>!t.scope||t.scope(r))));let l=n,h=function(t){let e=t.type.prop(ia);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}(t)||na.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&&(l&&(l+=" "),l+=c,1==h.mode&&(n+=(n?" ":"")+c)),this.startSpan(t.from,l),h.opaque)return;let u=t.tree&&t.tree.prop(ho.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 d=0,f=o;;d++){let p=d=O)&&t.nextSibling()););if(!p||O>i)break;f=p.to+o,f>e&&(this.highlightRange(r.cursor(),Math.max(e,p.from+o),Math.min(i,f),n,h),this.startSpan(f,l))}c&&t.parent()}else if(t.firstChild()){do{if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,n,s),this.startSpan(Math.min(i,t.to),l)}}while(t.nextSibling());t.parent()}}}const aa=Jo.define,la=aa(),ha=aa(),ca=aa(ha),ua=aa(ha),da=aa(),fa=aa(da),pa=aa(da),Oa=aa(),ga=aa(Oa),ma=aa(),ba=aa(),wa=aa(),va=aa(wa),ya=aa(),Sa={comment:la,lineComment:aa(la),blockComment:aa(la),docComment:aa(la),name:ha,variableName:aa(ha),typeName:ca,tagName:aa(ca),propertyName:ua,attributeName:aa(ua),className:aa(ha),labelName:aa(ha),namespace:aa(ha),macroName:aa(ha),literal:da,string:fa,docString:aa(fa),character:aa(fa),attributeValue:aa(fa),number:pa,integer:aa(pa),float:aa(pa),bool:aa(da),regexp:aa(da),escape:aa(da),color:aa(da),url:aa(da),keyword:ma,self:aa(ma),null:aa(ma),atom:aa(ma),unit:aa(ma),modifier:aa(ma),operatorKeyword:aa(ma),controlKeyword:aa(ma),definitionKeyword:aa(ma),moduleKeyword:aa(ma),operator:ba,derefOperator:aa(ba),arithmeticOperator:aa(ba),logicOperator:aa(ba),bitwiseOperator:aa(ba),compareOperator:aa(ba),updateOperator:aa(ba),definitionOperator:aa(ba),typeOperator:aa(ba),controlOperator:aa(ba),punctuation:wa,separator:aa(wa),bracket:va,angleBracket:aa(va),squareBracket:aa(va),paren:aa(va),brace:aa(va),content:Oa,heading:ga,heading1:aa(ga),heading2:aa(ga),heading3:aa(ga),heading4:aa(ga),heading5:aa(ga),heading6:aa(ga),contentSeparator:aa(Oa),list:aa(Oa),quote:aa(Oa),emphasis:aa(Oa),strong:aa(Oa),link:aa(Oa),monospace:aa(Oa),strikethrough:aa(Oa),inserted:aa(),deleted:aa(),changed:aa(),invalid:aa(),meta:ya,documentMeta:aa(ya),annotation:aa(ya),processingInstruction:aa(ya),definition:Jo.defineModifier(),constant:Jo.defineModifier(),function:Jo.defineModifier(),standard:Jo.defineModifier(),local:Jo.defineModifier(),special:Jo.defineModifier()};var xa;sa([{tag:Sa.link,class:"tok-link"},{tag:Sa.heading,class:"tok-heading"},{tag:Sa.emphasis,class:"tok-emphasis"},{tag:Sa.strong,class:"tok-strong"},{tag:Sa.keyword,class:"tok-keyword"},{tag:Sa.atom,class:"tok-atom"},{tag:Sa.bool,class:"tok-bool"},{tag:Sa.url,class:"tok-url"},{tag:Sa.labelName,class:"tok-labelName"},{tag:Sa.inserted,class:"tok-inserted"},{tag:Sa.deleted,class:"tok-deleted"},{tag:Sa.literal,class:"tok-literal"},{tag:Sa.string,class:"tok-string"},{tag:Sa.number,class:"tok-number"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],class:"tok-string2"},{tag:Sa.variableName,class:"tok-variableName"},{tag:Sa.local(Sa.variableName),class:"tok-variableName tok-local"},{tag:Sa.definition(Sa.variableName),class:"tok-variableName tok-definition"},{tag:Sa.special(Sa.variableName),class:"tok-variableName2"},{tag:Sa.definition(Sa.propertyName),class:"tok-propertyName tok-definition"},{tag:Sa.typeName,class:"tok-typeName"},{tag:Sa.namespace,class:"tok-namespace"},{tag:Sa.className,class:"tok-className"},{tag:Sa.macroName,class:"tok-macroName"},{tag:Sa.propertyName,class:"tok-propertyName"},{tag:Sa.operator,class:"tok-operator"},{tag:Sa.comment,class:"tok-comment"},{tag:Sa.meta,class:"tok-meta"},{tag:Sa.invalid,class:"tok-invalid"},{tag:Sa.punctuation,class:"tok-punctuation"}]);const ka=new ho;function Qa(t){return E.define({combine:t?e=>e.concat(t):void 0})}const $a=new ho;class Pa{constructor(t,e,i=[],n=""){this.data=t,this.name=n,xt.prototype.hasOwnProperty("tree")||Object.defineProperty(xt.prototype,"tree",{get(){return Xa(this)}}),this.parser=e,this.extension=[Wa.of(this),xt.languageData.of(((t,e,i)=>{let n=Ca(t,e,i),s=n.type.prop(ka);if(!s)return[];let r=t.facet(s),o=n.type.prop($a);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 Ca(t,e,i).type.prop(ka)==this.data}findRegions(t){let e=t.facet(Wa);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(ka)==this.data)return void i.push({from:e,to:e+t.length});let s=t.prop(ho.mounted);if(s){if(s.tree.prop(ka)==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;it.isTop?e:void 0))]}),t.name)}configure(t,e){return new _a(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Xa(t){let e=t.field(Pa.state,!1);return e?e.tree:bo.empty}class Za{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let i=this.cursorPos-this.string.length;return t=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i)}}let Aa=null;class Ta{constructor(t,e,i=[],n,s,r,o,a){this.parser=t,this.state=e,this.fragments=i,this.tree=n,this.treeLen=s,this.viewport=r,this.skipped=o,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(t,e,i){return new Ta(t,e,[],bo.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Za(this.state.doc),this.fragments)}work(t,e){return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=bo.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(Eo.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Aa;Aa=this;try{return t()}finally{Aa=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=Ra(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=Eo.applyChanges(i,e),n=bo.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=Ra(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 Vo{createParse(e,i,n){let s=n[0].from,r=n[n.length-1].to;return{parsedPos:s,advance(){let e=Aa;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 bo(fo.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 Aa}}function Ra(t,e,i){return Eo.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class Ea{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 Ea(e)}static init(t){let e=Math.min(3e3,t.doc.length),i=Ta.create(t.facet(Wa).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new Ea(i)}}Pa.state=q.define({create:Ea.init,update(t,e){for(let t of e.effects)if(t.is(Pa.setState))return t.value;return e.startState.facet(Wa)!=e.state.facet(Wa)?Ea.init(e.state):t.apply(e)}});let Va=t=>{let e=setTimeout((()=>t()),500);return()=>clearTimeout(e)};"undefined"!=typeof requestIdleCallback&&(Va=t=>{let e=-1,i=setTimeout((()=>{e=requestIdleCallback(t,{timeout:400})}),100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const Ma="undefined"!=typeof navigator&&(null===(xa=navigator.scheduling)||void 0===xa?void 0:xa.isInputPending)?()=>navigator.scheduling.isInputPending():null,Da=_i.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(Pa.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),t.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(Pa.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=Va(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEndn+1e3,a=s.context.work((()=>Ma&&Ma()||Date.now()>r),n+(o?0:1e5));this.chunkBudget-=Date.now()-e,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Pa.setState.of(new Ea(s.context))})),this.chunkBudget>0&&(!a||o)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then((()=>this.scheduleWork())).catch((t=>Qi(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()}}}),Wa=E.define({combine:t=>t.length?t[0]:null,enables:t=>[Pa.state,Da,Ts.contentAttributes.compute([t],(e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}}))]});class Ua{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}class Ya{constructor(t,e,i,n,s,r=void 0){this.name=t,this.alias=e,this.extensions=i,this.filename=n,this.loadFunc=s,this.support=r,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then((t=>this.support=t),(t=>{throw this.loading=null,t})))}static of(t){let{load:e,support:i}=t;if(!e){if(!i)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");e=()=>Promise.resolve(i)}return new Ya(t.name,(t.alias||[]).concat(t.name).map((t=>t.toLowerCase())),t.extensions||[],t.filename,e,i)}static matchFilename(t,e){for(let i of t)if(i.filename&&i.filename.test(e))return i;let i=/\.([^.]+)$/.exec(e);if(i)for(let e of t)if(e.extensions.indexOf(i[1])>-1)return e;return null}static matchLanguageName(t,e,i=!0){e=e.toLowerCase();for(let i of t)if(i.alias.some((t=>t==e)))return i;if(i)for(let i of t)for(let t of i.alias){let n=e.indexOf(t);if(n>-1&&(t.length>2||!/\w/.test(e[n-1])&&!/\w/.test(e[n+t.length])))return i}return null}}const qa=E.define(),La=E.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 za(t){let e=t.facet(La);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function Ia(t,e){let i="",n=t.tabSize,s=t.facet(La)[0];if("\t"==s){for(;e>=n;)i+="\t",e-=n;s=" "}for(let t=0;t=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 Yt(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 Na=new ho;function Ga(t){let e=t.type.prop(Na);if(e)return e;let i,n=t.firstChild;if(n&&(i=n.type.prop(ho.closedBy))){let e=t.lastChild,n=e&&i.indexOf(e.name)>-1;return t=>el(t,!0,1,void 0,n&&!function(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}(t)?e.from:void 0)}return null==t.parent?Ha:null}function Fa(t,e,i){for(;t;t=t.parent){let n=Ga(t);if(n)return n(Ja.create(i,e,t))}return null}function Ha(){return 0}class Ja extends ja{constructor(t,e,i){super(t.state,t.options),this.base=t,this.pos=e,this.node=i}static create(t,e,i){return new Ja(t,e,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){let t=this.state.doc.lineAt(this.node.from);for(;;){let e=this.node.resolve(t.from);for(;e.parent&&e.parent.from==e.from;)e=e.parent;if(Ka(e,this.node))break;t=this.state.doc.lineAt(e.from)}return this.lineIndent(t.from)}continue(){let t=this.node.parent;return t?Fa(t,this.pos,this.base):0}}function Ka(t,e){for(let i=e;i;i=i.parent)if(t==i)return!0;return!1}function tl({closing:t,align:e=!0,units:i=1}){return n=>el(n,e,i,t)}function el(t,e,i,n,s){let r=t.textAfter,o=r.match(/^\s*/)[0].length,a=n&&r.slice(o,o+n.length)==n||s==t.pos+o,l=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.from{let n=t&&t.test(i.textAfter);return i.baseIndent+(n?0:e*i.unit)}}function nl(){return xt.transactionFilter.of((t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let i=t.newDoc,{head:n}=t.newSelection.main,s=i.lineAt(n);if(n>s.from+200)return t;let r=i.sliceString(s.from,n);if(!e.some((t=>t.test(r))))return t;let{state:o}=t,a=-1,l=[];for(let{head:t}of o.selection.ranges){let e=o.doc.lineAt(t);if(e.from==a)continue;a=e.from;let i=Ba(o,e.from);if(null==i)continue;let n=/^\s*/.exec(e.text)[0],s=Ia(o,i);n!=s&&l.push({from:e.from,to:e.from+n.length,insert:s})}return l.length?[t,{changes:l,sequential:!0}]:t}))}const sl=E.define(),rl=new ho;function ol(t){let e=t.firstChild,i=t.lastChild;return e&&e.toi)continue;if(s&&r.from=e&&n.to>i&&(s=n)}}return s}(t,e,i)}function hl(t,e){let i=e.mapPos(t.from,1),n=e.mapPos(t.to,-1);return i>=n?void 0:{from:i,to:n}}const cl=ut.define({map:hl}),ul=ut.define({map:hl}),dl=q.define({create:()=>ni.none,update(t,e){t=t.map(e.changes);for(let i of e.effects)i.is(cl)&&!pl(t,i.value.from,i.value.to)?t=t.update({add:[bl.range(i.value.from,i.value.to)]}):i.is(ul)&&(t=t.update({filter:(t,e)=>i.value.from!=t||i.value.to!=e,filterFrom:i.value.from,filterTo:i.value.to}));if(e.selection){let i=!1,{head:n}=e.selection.main;t.between(n,n,((t,e)=>{tn&&(i=!0)})),i&&(t=t.update({filterFrom:n,filterTo:n,filter:(t,e)=>e<=n||t>=n}))}return t},provide:t=>Ts.decorations.from(t),toJSON(t,e){let i=[];return t.between(0,e.doc.length,((t,e)=>{i.push(t,e)})),i},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let i=0;i{(!s||s.from>t)&&(s={from:t,to:e})})),s}function pl(t,e,i){let n=!1;return t.between(e,e,((t,s)=>{t==e&&s==i&&(n=!0)})),n}const Ol={placeholderDOM:null,placeholderText:"…"},gl=E.define({combine:t=>kt(t,Ol)});function ml(t){let e=[dl,yl];return t&&e.push(gl.of(t)),e}const bl=ni.replace({widget:new class extends ei{toDOM(t){let{state:e}=t,i=e.facet(gl),n=e=>{let i=t.lineBlockAt(t.posAtDOM(e.target)),n=fl(t.state,i.from,i.to);n&&t.dispatch({effects:ul.of(n)}),e.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(t,n);let s=document.createElement("span");return s.textContent=i.placeholderText,s.setAttribute("aria-label",e.phrase("folded code")),s.title=e.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=n,s}}}),wl={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class vl extends Yr{constructor(t,e){super(),this.config=t,this.open=e}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let e=document.createElement("span");return e.textContent=this.open?this.config.openText:this.config.closedText,e.title=t.state.phrase(this.open?"Fold line":"Unfold line"),e}}const yl=Ts.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Sl{constructor(t,e){let i;function n(t){let e=It.newName();return(i||(i=Object.create(null)))["."+e]=t,e}this.specs=t;const s="string"==typeof e.all?e.all:e.all?n(e.all):void 0,r=e.scope;this.scope=r instanceof Pa?t=>t.prop(ka)==r.data:r?t=>t==r:void 0,this.style=sa(t.map((t=>({tag:t.tag,class:t.class||n(Object.assign({},t,{tag:null}))}))),{all:s}).style,this.module=i?new It(i):null,this.themeType=e.themeType}static define(t,e){return new Sl(t,e||{})}}const xl=E.define(),kl=E.define({combine:t=>t.length?[t[0]]:null});function Ql(t){let e=t.facet(xl);return e.length?e:t.facet(kl)}function $l(t,e){let i,n=[Cl];return t instanceof Sl&&(t.module&&n.push(Ts.styleModule.of(t.module)),i=t.themeType),(null==e?void 0:e.fallback)?n.push(kl.of(t)):i?n.push(xl.computeN([Ts.darkTheme],(e=>e.facet(Ts.darkTheme)==("dark"==i)?[t]:[]))):n.push(xl.of(t)),n}class Pl{constructor(t){this.markCache=Object.create(null),this.tree=Xa(t.state),this.decorations=this.buildDeco(t,Ql(t.state))}update(t){let e=Xa(t.state),i=Ql(t.state),n=i!=Ql(t.startState);e.length{i.add(t,e,this.markCache[n]||(this.markCache[n]=ni.mark({class:n})))}),n,s);return i.finish()}}const Cl=N.high(_i.fromClass(Pl,{decorations:t=>t.decorations})),_l=Sl.define([{tag:Sa.meta,color:"#404740"},{tag:Sa.link,textDecoration:"underline"},{tag:Sa.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Sa.emphasis,fontStyle:"italic"},{tag:Sa.strong,fontWeight:"bold"},{tag:Sa.strikethrough,textDecoration:"line-through"},{tag:Sa.keyword,color:"#708"},{tag:[Sa.atom,Sa.bool,Sa.url,Sa.contentSeparator,Sa.labelName],color:"#219"},{tag:[Sa.literal,Sa.inserted],color:"#164"},{tag:[Sa.string,Sa.deleted],color:"#a11"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],color:"#e40"},{tag:Sa.definition(Sa.variableName),color:"#00f"},{tag:Sa.local(Sa.variableName),color:"#30a"},{tag:[Sa.typeName,Sa.namespace],color:"#085"},{tag:Sa.className,color:"#167"},{tag:[Sa.special(Sa.variableName),Sa.macroName],color:"#256"},{tag:Sa.definition(Sa.propertyName),color:"#00c"},{tag:Sa.comment,color:"#940"},{tag:Sa.invalid,color:"#f00"}]),Xl=Ts.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Zl=1e4,Al="()[]{}",Tl=E.define({combine:t=>kt(t,{afterCursor:!0,brackets:Al,maxScanDistance:Zl,renderMatch:Vl})}),Rl=ni.mark({class:"cm-matchingBracket"}),El=ni.mark({class:"cm-nonmatchingBracket"});function Vl(t){let e=[],i=t.matched?Rl:El;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 Ml=q.define({create:()=>ni.none,update(t,e){if(!e.docChanged&&!e.selection)return t;let i=[],n=e.state.facet(Tl);for(let t of e.state.selection.ranges){if(!t.empty)continue;let s=Ll(e.state,t.head,-1,n)||t.head>0&&Ll(e.state,t.head-1,1,n)||n.afterCursor&&(Ll(e.state,t.head,1,n)||t.headTs.decorations.from(t)}),Dl=[Ml,Xl];function Wl(t={}){return[Tl.of(t),Dl]}const Ul=new ho;function Yl(t,e,i){let n=t.prop(e<0?ho.openedBy:ho.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 ql(t){let e=t.type.prop(Ul);return e?e(t.node):t}function Ll(t,e,i,n={}){let s=n.maxScanDistance||Zl,r=n.brackets||Al,o=Xa(t),a=o.resolveInner(e,i);for(let n=a;n;n=n.parent){let s=Yl(n.type,i,r);if(s&&n.from0?e>=o.from&&eo.from&&e<=o.to))return zl(t,e,i,n,o,s,r)}}return function(t,e,i,n,s,r,o){let a=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%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 a=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(a+t,1).type!=s))if(e%2==0==i>0)u++;else{if(1==u)return{start:h,end:{from:a+t,to:a+t+1},matched:e>>1==l>>1};u--}}i>0&&(t+=r.length)}return c.done?{start:h,matched:!1}:null}(t,e,i,o,a.type,s,r)}function zl(t,e,i,n,s,r,o){let a=n.parent,l={from:s.from,to:s.to},h=0,c=null==a?void 0:a.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 jl(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 Nl=new WeakMap;class Gl extends Pa{constructor(t){let e,i=Qa(t.languageData),n={name:(s=t).name||"",token:s.token,blankLine:s.blankLine||(()=>{}),startState:s.startState||(()=>!0),copyState:s.copyState||jl,indent:s.indent||(()=>null),languageData:s.languageData||{},tokenTable:s.tokenTable||th};var s;super(i,new class extends Vo{createParse(t,i,n){return new Jl(e,t,i,n)}},[qa.of(((t,e)=>this.getIndent(t,e)))],t.name),this.topNode=function(t){let e=fo.define({id:eh.length,name:"Document",props:[ka.add((()=>t))]});return eh.push(e),e}(i),e=this,this.streamParser=n,this.stateAfter=new ho({perNode:!0}),this.tokenTable=t.tokenTable?new rh(n.tokenTable):oh}static define(t){return new Gl(t)}getIndent(t,e){let i,n=Xa(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=Nl.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],a=i+e.positions[r],l=o instanceof bo&&a=e.length)return e;s||e.type!=t.topNode||(s=!0);for(let r=e.children.length-1;r>=0;r--){let o,a=e.positions[r],l=e.children[r];if(ai&&Fl(t,n.tree,0-n.offset,i,r);if(o&&(e=Hl(t,n.tree,i+n.offset,o.pos+n.offset,!1)))return{state:o.state,tree:e}}return{state:t.streamParser.startState(n?za(n):4),tree:bo.empty}}(t,i,r,null==s?void 0:s.state);this.state=o,this.parsedPos=this.chunkStart=r+a.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 Bl(e,t?t.state.tabSize:4,t?za(t.state):2);if(r.eol())s.blankLine(this.state,r.indentUnit);else for(;!r.eol();){let t=Kl(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 th=Object.create(null),eh=[fo.none],ih=new po(eh),nh=[],sh=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"]])sh[t]=lh(th,e);class rh{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),sh)}resolve(t){return t?this.table[t]||(this.table[t]=lh(this.extra,t)):0}}const oh=new rh(th);function ah(t,e){nh.indexOf(t)>-1||(nh.push(t),console.warn(e))}function lh(t,e){let i=null;for(let n of e.split(".")){let e=t[n]||Sa[n];e?"function"==typeof e?i?i=e(i):ah(n,`Modifier ${n} used at start of tag`):i?ah(n,`Tag ${n} used as modifier`):i=e:ah(n,`Unknown highlighting tag ${n}`)}if(!i)return 0;let n=e.replace(/ /g,"_"),s=fo.define({id:eh.length,name:n,props:[ea({[n]:i})]});return eh.push(s),s.id}function hh(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 ch=hh(gh,0),uh=hh(Oh,0),dh=hh(((t,e)=>Oh(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 fh(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}const ph=50;function Oh(t,e,i=e.selection.ranges){let n=i.map((t=>fh(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,a=t.sliceDoc(n-ph,n),l=t.sliceDoc(s,s+ph),h=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(l)[0].length,u=a.length-h;if(a.slice(u-e.length,u)==e&&l.slice(c,c+i.length)==i)return{open:{pos:n-h,margin:h&&1},close:{pos:s+c,margin:c&&1}};s-n<=2*ph?r=o=t.sliceDoc(n,s):(r=t.sliceDoc(n,n+ph),o=t.sliceDoc(s-ph,s));let d=/^\s*/.exec(r)[0].length,f=/\s*$/.exec(o)[0].length,p=o.length-f-i.length;return r.slice(d,d+e.length)==e&&o.slice(p,p+i.length)==i?{open:{pos:n+d+e.length,margin:/\s/.test(r.charAt(d+e.length))?1:0},close:{pos:s-f-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>l.from)){s=l.from;let t=/^\s*/.exec(l.text)[0].length,e=t==l.length,i=l.text.slice(t,t+a.length)==a?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 mh=lt.define(),bh=lt.define(),wh=E.define(),vh=E.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)})});const yh=q.define({create:()=>Dh.empty,update(t,e){let i=e.state.facet(vh),n=e.annotation(mh);if(n){let s=e.docChanged?A.single(function(t){let e=0;return t.iterChangedRanges(((t,i)=>e=i)),e}(e.changes)):void 0,r=Ch.fromTransaction(e,s),o=n.side,a=0==o?t.undone:t.done;return a=r?_h(a,a.length,i.minDepth,r):Th(a,e.startState.selection),new Dh(0==o?n.rest:a,0==o?a:n.rest)}let s=e.annotation(bh);if("full"!=s&&"before"!=s||(t=t.isolate()),!1===e.annotation(dt.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);let r=Ch.fromTransaction(e),o=e.annotation(dt.time),a=e.annotation(dt.userEvent);return r?t=t.addChanges(r,o,a,i,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,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 Dh(t.done.map(Ch.fromJSON),t.undone.map(Ch.fromJSON))});function Sh(t={}){return[yh,vh.of(t),Ts.domEventHandlers({beforeinput(t,e){let i="historyUndo"==t.inputType?kh:"historyRedo"==t.inputType?Qh:null;return!!i&&(t.preventDefault(),i(e))}})]}function xh(t,e){return function({state:i,dispatch:n}){if(!e&&i.readOnly)return!1;let s=i.field(yh,!1);if(!s)return!1;let r=s.pop(t,i,e);return!!r&&(n(r),!0)}}const kh=xh(0,!1),Qh=xh(1,!1),$h=xh(0,!0),Ph=xh(1,!0);class Ch{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 Ch(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 Ch(t.changes&&k.fromJSON(t.changes),[],t.mapped&&x.fromJSON(t.mapped),t.startSelection&&A.fromJSON(t.startSelection),t.selectionsAfter.map(A.fromJSON))}static fromTransaction(t,e){let i=Zh;for(let e of t.startState.facet(wh)){let n=e(t);n.length&&(i=i.concat(n))}return!i.length&&t.changes.empty?null:new Ch(t.changes.invert(t.startState.doc),i,void 0,e||t.startState.selection,Zh)}static selection(t){return new Ch(void 0,Zh,void 0,void 0,t)}}function _h(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 Xh(t,e){return t.length?e.length?t.concat(e):t:e}const Zh=[],Ah=200;function Th(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-Ah));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),_h(t,t.length-1,1e9,i.setSelAfter(n)))}return[Ch.selection([e])]}function Rh(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 Eh(t,e){if(!t.length)return t;let i=t.length,n=Zh;for(;i;){let s=Vh(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?[Ch.selection(n)]:Zh}function Vh(t,e,i){let n=Xh(t.selectionsAfter.length?t.selectionsAfter.map((t=>t.map(e))):Zh,i);if(!t.changes)return Ch.selection(n);let s=t.changes.map(e),r=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(r):r;return new Ch(s,ut.mapEffects(t.effects,e),o,t.startSelection.map(r),n)}const Mh=/^(input\.type|delete)($|\.)/;class Dh{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 Dh(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||Mh.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)?_h(r,r.length-1,n.minDepth,new Ch(t.changes.compose(o.changes),Xh(t.effects,o.effects),o.mapped,o.startSelection,Zh)):_h(r,r.length,n.minDepth,t),new Dh(r,Zh,e,i)}addSelection(t,e,i,n){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Zh;return s.length>0&&e-this.prevTimet.empty!=o.ranges[e].empty)).length)?this:new Dh(Th(this.done,t),this.undone,e,i);var r,o}addMapping(t){return new Dh(Eh(this.done,t),Eh(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:mh.of({side:t,rest:Rh(n)}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let i=1==n.length?Zh:n.slice(0,n.length-1);return s.mapped&&(i=Eh(i,s.mapped)),e.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:mh.of({side:t,rest:i}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}}Dh.empty=new Dh(Zh,Zh);const Wh=[{key:"Mod-z",run:kh,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Qh,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Qh,preventDefault:!0},{key:"Mod-u",run:$h,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Ph,preventDefault:!0}];function Uh(t,e){return A.create(t.ranges.map(e),t.mainIndex)}function Yh(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function qh({state:t,dispatch:e},i){let n=Uh(t.selection,i);return!n.eq(t.selection)&&(e(Yh(t,n)),!0)}function Lh(t,e){return A.cursor(e?t.to:t.from)}function zh(t,e){return qh(t,(i=>i.empty?t.moveByChar(i,e):Lh(i,e)))}function Ih(t){return t.textDirectionAt(t.state.selection.main.head)==Wi.LTR}const Bh=t=>zh(t,!Ih(t)),jh=t=>zh(t,Ih(t));function Nh(t,e){return qh(t,(i=>i.empty?t.moveByGroup(i,e):Lh(i,e)))}function Gh(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 Fh(t,e,i){let n,s,r=Xa(t).resolveInner(e.head),o=i?ho.closedBy:ho.openedBy;for(let n=e.head;;){let e=i?r.childAfter(n):r.childBefore(n);if(!e)break;Gh(t,e,o)?r=e:n=i?e.to:e.from}return s=r.type.prop(o)&&(n=i?Ll(t,r.from,1):Ll(t,r.to,-1))&&n.matched?i?n.end.to:n.end.from:i?r.to:r.from,A.cursor(s,i?-1:1)}function Hh(t,e){return qh(t,(i=>{if(!i.empty)return Lh(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)}))}const Jh=t=>Hh(t,!1),Kh=t=>Hh(t,!0);function tc(t){let e,i=t.scrollDOM.clientHeighti.empty?t.moveVertically(i,e,n.height):Lh(i,e)));if(r.eq(s.selection))return!1;if(n.selfScroll){let e=t.coordsAtPos(s.selection.main.head),o=t.scrollDOM.getBoundingClientRect(),a=o.top+n.marginTop,l=o.bottom-n.marginBottom;e&&e.top>a&&e.bottomec(t,!1),nc=t=>ec(t,!0);function sc(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=A.cursor(n.from+i))}return s}function rc(t,e){let i=Uh(t.state.selection,(t=>{let i=e(t);return A.range(t.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)}));return!i.eq(t.state.selection)&&(t.dispatch(Yh(t.state,i)),!0)}function oc(t,e){return console.log("Select!"),rc(t,(i=>t.moveByCharSelected(i,e)))}const ac=t=>oc(t,!Ih(t)),lc=t=>oc(t,Ih(t));function hc(t,e){return rc(t,(i=>t.moveByGroup(i,e)))}function cc(t,e){return rc(t,(i=>t.moveVertically(i,e)))}const uc=t=>cc(t,!1),dc=t=>cc(t,!0);function fc(t,e){return rc(t,(i=>t.moveVertically(i,e,tc(t).height)))}const pc=t=>fc(t,!1),Oc=t=>fc(t,!0),gc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:0})),!0),mc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.doc.length})),!0),bc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:0})),!0),wc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0);function vc(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=yc(t,n,!0)),s=Math.min(s,n),r=Math.max(r,n)}else s=yc(t,s,!1),r=yc(t,r,!0);return s==r?{range:n}:{changes:{from:s,to:r},range:A.cursor(s)}}));return!s.changes.empty&&(t.dispatch(n.update(s,{scrollIntoView:!0,userEvent:i,effects:"delete.selection"==i?Ts.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function yc(t,e,i){if(t instanceof Ts)for(let n of t.state.facet(Ts.atomicRanges).map((e=>e(t))))n.between(e,e,((t,n)=>{te&&(e=i?n:t)}));return e}const Sc=(t,e)=>vc(t,(i=>{let n,s,{state:r}=t,o=r.doc.lineAt(i);if(!e&&i>o.from&&iSc(t,!1),kc=t=>Sc(t,!0),Qc=(t,e)=>vc(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 a=f(r.text,n-r.from,e)+r.from,l=r.text.slice(Math.min(n,a)-r.from,Math.max(n,a)-r.from),h=o(l);if(null!=t&&h!=t)break;" "==l&&n==i||(t=h),n=a}return n})),$c=t=>Qc(t,!1),Pc=t=>vc(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 _c(t,e,i){if(t.readOnly)return!1;let n=[],s=[];for(let e of Cc(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(A.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(A.range(t.anchor-o,t.head-o))}}return!!n.length&&(e(t.update({changes:n,scrollIntoView:!0,selection:A.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0)}function Xc(t,e,i){if(t.readOnly)return!1;let n=[];for(let e of Cc(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 Zc=Ac(!1);function Ac(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),a=!e&&s==r&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i,n=Xa(t).resolveInner(e),s=n.childBefore(e),r=n.childAfter(e);return s&&r&&s.to<=e&&r.from>=e&&(i=s.type.prop(ho.closedBy))&&i.indexOf(r.name)>-1&&t.doc.lineAt(s.to).from==t.doc.lineAt(r.from).from?{from:s.to,to:r.from}:null}(i,s);e&&(s=r=(r<=o.to?o:i.doc.lineAt(r)).to);let l=new ja(i,{simulateBreak:s,simulateDoubleBreak:!!a}),h=Ba(l,s);for(null==h&&(h=/^\s*/.exec(i.doc.lineAt(s).text)[0].length);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:A.range(r.mapPos(n.anchor,1),r.mapPos(n.head,1))}}))}const Rc=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{i.push({from:e.from,insert:t.facet(La)})})),{userEvent:"input.indent"})),!0),Ec=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{let n=/^\s*/.exec(e.text)[0];if(!n)return;let s=Yt(n,t.tabSize),r=0,o=Ia(t,Math.max(0,s-za(t)));for(;rqh(t,(e=>Fh(t.state,e,!Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,!Ih(t))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:t=>qh(t,(e=>Fh(t.state,e,Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,Ih(t))))},{key:"Alt-ArrowUp",run:({state:t,dispatch:e})=>_c(t,e,!1)},{key:"Shift-Alt-ArrowUp",run:({state:t,dispatch:e})=>Xc(t,e,!1)},{key:"Alt-ArrowDown",run:({state:t,dispatch:e})=>_c(t,e,!0)},{key:"Shift-Alt-ArrowDown",run:({state:t,dispatch:e})=>Xc(t,e,!0)},{key:"Escape",run:({state:t,dispatch:e})=>{let i=t.selection,n=null;return i.ranges.length>1?n=A.create([i.main]):i.main.empty||(n=A.create([A.cursor(i.main.head)])),!!n&&(e(Yh(t,n)),!0)}},{key:"Mod-Enter",run:Ac(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:t,dispatch:e})=>{let i=Cc(t).map((({from:e,to:i})=>A.range(e,Math.min(i+1,t.doc.length))));return e(t.update({selection:A.create(i),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:t,dispatch:e})=>{let i=Uh(t.selection,(e=>{var i;let n=Xa(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 A.range(n.to,n.from)}));return e(Yh(t,i)),!0},preventDefault:!0},{key:"Mod-[",run:Ec},{key:"Mod-]",run:Rc},{key:"Mod-Alt-\\",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new ja(t,{overrideIndentation:t=>{let e=i[t];return null==e?-1:e}}),s=Tc(t,((e,s,r)=>{let o=Ba(n,e.from);if(null==o)return;/\S/.test(e.text)||(o=0);let a=/^\s*/.exec(e.text)[0],l=Ia(t,o);(a!=l||r.from{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(Cc(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=Uh(t.selection,(e=>{let s=Ll(t,e.head,-1)||Ll(t,e.head,1)||e.head>0&&Ll(t,e.head-1,1)||e.head{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=fh(t.state,i.from);return n.line?ch(t):!!n.block&&dh(t)}},{key:"Alt-A",run:uh}].concat([{key:"ArrowLeft",run:Bh,shift:ac,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:t=>Nh(t,!Ih(t)),shift:t=>hc(t,!Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:t=>qh(t,(e=>sc(t,e,!Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,!Ih(t)))),preventDefault:!0},{key:"ArrowRight",run:jh,shift:lc,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:t=>Nh(t,Ih(t)),shift:t=>hc(t,Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:t=>qh(t,(e=>sc(t,e,Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,Ih(t)))),preventDefault:!0},{key:"ArrowUp",run:Jh,shift:uc,preventDefault:!0},{mac:"Cmd-ArrowUp",run:gc,shift:bc},{mac:"Ctrl-ArrowUp",run:ic,shift:pc},{key:"ArrowDown",run:Kh,shift:dc,preventDefault:!0},{mac:"Cmd-ArrowDown",run:mc,shift:wc},{mac:"Ctrl-ArrowDown",run:nc,shift:Oc},{key:"PageUp",run:ic,shift:pc},{key:"PageDown",run:nc,shift:Oc},{key:"Home",run:t=>qh(t,(e=>sc(t,e,!1))),shift:t=>rc(t,(e=>sc(t,e,!1))),preventDefault:!0},{key:"Mod-Home",run:gc,shift:bc},{key:"End",run:t=>qh(t,(e=>sc(t,e,!0))),shift:t=>rc(t,(e=>sc(t,e,!0))),preventDefault:!0},{key:"Mod-End",run:mc,shift:wc},{key:"Enter",run:Zc},{key:"Mod-a",run:({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:xc,shift:xc},{key:"Delete",run:kc},{key:"Mod-Backspace",mac:"Alt-Backspace",run:$c},{key:"Mod-Delete",mac:"Alt-Delete",run:t=>Qc(t,!0)},{mac:"Mod-Backspace",run:t=>vc(t,(e=>{let i=t.lineBlockAt(e).from;return e>i?i:Math.max(0,e-1)}))},{mac:"Mod-Delete",run:Pc}].concat([{key:"Ctrl-b",run:Bh,shift:ac,preventDefault:!0},{key:"Ctrl-f",run:jh,shift:lc},{key:"Ctrl-p",run:Jh,shift:uc},{key:"Ctrl-n",run:Kh,shift:dc},{key:"Ctrl-a",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).from,1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).from)))},{key:"Ctrl-e",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).to,-1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).to)))},{key:"Ctrl-d",run:kc},{key:"Ctrl-h",run:xc},{key:"Ctrl-k",run:Pc},{key:"Ctrl-Alt-h",run:$c},{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:A.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:f(n.text,i-n.from,!1)+n.from,r=i==n.to?i+1:f(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:A.cursor(r)}}));return!i.changes.empty&&(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:nc}].map((t=>({mac:t.key,run:t.run,shift:t.shift})))));function Mc(){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 Uc{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(Wc(t)):Wc,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 b(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=w(t),i=this.bufferStart+this.bufferPos;this.bufferPos+=v(t);let n=this.normalize(e);for(let t=0,s=i;;t++){let r=n.charCodeAt(t),o=this.match(r,s);if(o)return this.value=o,this;if(t==n.length-1)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=jc(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 Ic(e,t.sliceString(e,i));return zc.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=jc(this.text,i+(t==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ic.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function jc(t,e){if(e>=t.length)return e;let i,n=t.lineAt(e);for(;e=56320&&i<57344;)e++;return e}function Nc(t){let e=Mc("input",{class:"cm-textfield",name:"line"});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,a,l]=i,h=a?+a.slice(1):0,c=o?+o:s.number;if(o&&l){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)));t.dispatch({effects:Gc.of(!1),selection:A.cursor(u.from+Math.max(0,Math.min(h,u.length))),scrollIntoView:!0}),t.focus()}return{dom:Mc("form",{class:"cm-gotoLine",onkeydown:e=>{27==e.keyCode?(e.preventDefault(),t.dispatch({effects:Gc.of(!1)}),t.focus()):13==e.keyCode&&(e.preventDefault(),i())},onsubmit:t=>{t.preventDefault(),i()}},Mc("label",t.state.phrase("Go to line"),": ",e)," ",Mc("button",{class:"cm-button",type:"submit"},t.state.phrase("go")))}}"undefined"!=typeof Symbol&&(Lc.prototype[Symbol.iterator]=Bc.prototype[Symbol.iterator]=function(){return this});const Gc=ut.define(),Fc=q.define({create:()=>!0,update(t,e){for(let i of e.effects)i.is(Gc)&&(t=i.value);return t},provide:t=>Ur.from(t,(t=>t?Nc:null))}),Hc=Ts.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),Jc={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Kc=E.define({combine:t=>kt(t,Jc,{highlightWordAroundCursor:(t,e)=>t||e,minSelectionLength:Math.min,maxMatches:Math.min})});function tu(t){let e=[ru,su];return t&&e.push(Kc.of(t)),e}const eu=ni.mark({class:"cm-selectionMatch"}),iu=ni.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function nu(t,e,i,n){return!(0!=i&&t(e.sliceDoc(i-1,i))==wt.Word||n!=e.doc.length&&t(e.sliceDoc(n,n+1))==wt.Word)}const su=_i.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(Kc),{state:i}=t,n=i.selection;if(n.ranges.length>1)return ni.none;let s,r=n.main,o=null;if(r.empty){if(!e.highlightWordAroundCursor)return ni.none;let t=i.wordAt(r.head);if(!t)return ni.none;o=i.charCategorizer(r.head),s=i.sliceDoc(t.from,t.to)}else{let t=r.to-r.from;if(t200)return ni.none;if(e.wholeWords){if(s=i.sliceDoc(r.from,r.to),o=i.charCategorizer(r.head),!nu(o,i,r.from,r.to)||!function(t,e,i,n){return t(e.sliceDoc(i,i+1))==wt.Word&&t(e.sliceDoc(n-1,n))==wt.Word}(o,i,r.from,r.to))return ni.none}else if(s=i.sliceDoc(r.from,r.to).trim(),!s)return ni.none}let a=[];for(let n of t.visibleRanges){let t=new Uc(i.doc,s,n.from,n.to);for(;!t.next().done;){let{from:n,to:s}=t.value;if((!o||nu(o,i,n,s))&&(r.empty&&n<=r.from&&s>=r.to?a.push(iu.range(n,s)):(n>=r.to||s<=r.from)&&a.push(eu.range(n,s)),a.length>e.maxMatches))return ni.none}}return ni.set(a)}},{decorations:t=>t.decorations}),ru=Ts.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});const ou=E.define({combine:t=>kt(t,{top:!1,caseSensitive:!1,literal:!1,wholeWord:!1,createPanel:t=>new Eu(t),scrollToMatch:t=>Ts.scrollIntoView(t)})});class au{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,qc),!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 pu(this):new cu(this)}getCursor(t,e=0,i){let n=t.doc?t:xt.create({doc:t});return null==i&&(i=n.doc.length),this.regexp?uu(this,n,e,i):hu(this,n,e,i)}}class lu{constructor(t){this.spec=t}}function hu(t,e,i,n){return new Uc(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=hu(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 uu(t,e,i,n){return new Lc(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?(s=e.charCategorizer(e.selection.main.head),(t,e,i)=>!i[0].length||(s(du(i.input,i.index))!=wt.Word||s(fu(i.input,i.index))!=wt.Word)&&(s(fu(i.input,i.index+i[0].length))!=wt.Word||s(du(i.input,i.index+i[0].length))!=wt.Word)):void 0},i,n);var s}function du(t,e){return t.slice(f(t,e,!1),e)}function fu(t,e){return t.slice(e,f(t,e))}class pu extends lu{nextMatch(t,e,i){let n=uu(this.spec,t,i,t.doc.length).next();return n.done&&(n=uu(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=uu(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=uu(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 Ou=ut.define(),gu=ut.define(),mu=q.define({create:t=>new bu(_u(t).create(),null),update(t,e){for(let i of e.effects)i.is(Ou)?t=new bu(i.value.create(),t.panel):i.is(gu)&&(t=new bu(t.query,i.value?Cu:null));return t},provide:t=>Ur.from(t,(t=>t.panel))});class bu{constructor(t,e){this.query=t,this.panel=e}}const wu=ni.mark({class:"cm-searchMatch"}),vu=ni.mark({class:"cm-searchMatch cm-searchMatch-selected"}),yu=_i.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(mu))}update(t){let e=t.state.field(mu);(e!=t.startState.field(mu)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ni.none;let{view:i}=this,n=new Xt;for(let e=0,s=i.visibleRanges,r=s.length;es[e+1].from-500;)a=s[++e].to;t.highlight(i.state,o,a,((t,e)=>{let s=i.state.selection.ranges.some((i=>i.from==t&&i.to==e));n.add(t,e,s?vu:wu)}))}return n.finish()}},{decorations:t=>t.decorations});function Su(t){return e=>{let i=e.state.field(mu,!1);return i&&i.query.spec.valid?t(e,i):Au(e)}}const xu=Su(((t,{query:e})=>{let{to:i}=t.state.selection.main,n=e.nextMatch(t.state,i,i);if(!n)return!1;let s=A.single(n.from,n.to),r=t.state.facet(ou);return t.dispatch({selection:s,effects:[Wu(t,n),r.scrollToMatch(s.main,t)],userEvent:"select.search"}),Zu(t),!0})),ku=Su(((t,{query:e})=>{let{state:i}=t,{from:n}=i.selection.main,s=e.prevMatch(i,n,n);if(!s)return!1;let r=A.single(s.from,s.to),o=t.state.facet(ou);return t.dispatch({selection:r,effects:[Wu(t,s),o.scrollToMatch(r.main,t)],userEvent:"select.search"}),Zu(t),!0})),Qu=Su(((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!(!i||!i.length)&&(t.dispatch({selection:A.create(i.map((t=>A.range(t.from,t.to)))),userEvent:"select.search.matches"}),!0)})),$u=Su(((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,a,l=[],h=[];if(r.from==n&&r.to==s&&(a=i.toText(e.getReplacement(r)),l.push({from:r.from,to:r.to,insert:a}),r=e.nextMatch(i,r.from,r.to),h.push(Ts.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(n).number)+"."))),r){let e=0==l.length||l[0].from>=r.to?0:r.to-r.from-a.length;o=A.single(r.from-e,r.to-e),h.push(Wu(t,r)),h.push(i.facet(ou).scrollToMatch(o.main,t))}return t.dispatch({changes:l,selection:o,effects:h,userEvent:"input.replace"}),!0})),Pu=Su(((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:Ts.announce.of(n),userEvent:"input.replace.all"}),!0}));function Cu(t){return t.state.facet(ou).createPanel(t)}function _u(t,e){var i,n,s,r;let o=t.selection.main,a=o.empty||o.to>o.from+100?"":t.sliceDoc(o.from,o.to);if(e&&!a)return e;let l=t.facet(ou);return new au({search:(null!==(i=null==e?void 0:e.literal)&&void 0!==i?i:l.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:null!==(n=null==e?void 0:e.caseSensitive)&&void 0!==n?n:l.caseSensitive,literal:null!==(s=null==e?void 0:e.literal)&&void 0!==s?s:l.literal,wholeWord:null!==(r=null==e?void 0:e.wholeWord)&&void 0!==r?r:l.wholeWord})}function Xu(t){let e=Vr(t,Cu);return e&&e.dom.querySelector("[main-field]")}function Zu(t){let e=Xu(t);e&&e==t.root.activeElement&&e.select()}const Au=t=>{let e=t.state.field(mu,!1);if(e&&e.panel){let i=Xu(t);if(i&&i!=t.root.activeElement){let n=_u(t.state,e.query.spec);n.valid&&t.dispatch({effects:Ou.of(n)}),i.focus(),i.select()}}else t.dispatch({effects:[gu.of(!0),e?Ou.of(_u(t.state,e.query.spec)):ut.appendConfig.of(Yu)]});return!0},Tu=t=>{let e=t.state.field(mu,!1);if(!e||!e.panel)return!1;let i=Vr(t,Cu);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:gu.of(!1)}),!0},Ru=[{key:"Mod-f",run:Au,scope:"editor search-panel"},{key:"F3",run:xu,shift:ku,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:xu,shift:ku,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Tu,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 Uc(t.doc,t.sliceDoc(n,s));!e.next().done;){if(r.length>1e3)return!1;e.value.from==n&&(o=r.length),r.push(A.range(e.value.from,e.value.to))}return e(t.update({selection:A.create(r,o),userEvent:"select.search.matches"})),!0}},{key:"Alt-g",run:t=>{let e=Vr(t,Nc);if(!e){let i=[Gc.of(!0)];null==t.state.field(Fc,!1)&&i.push(ut.appendConfig.of([Fc,Hc])),t.dispatch({effects:i}),e=Vr(t,Nc)}return e&&e.dom.querySelector("input").focus(),!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=A.create(i.ranges.map((e=>t.wordAt(e.head)||A.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 Uc(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 Uc(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(A.range(s.from,s.to),!1),effects:Ts.scrollIntoView(s.to)})),!0)},preventDefault:!0}];class Eu{constructor(t){this.view=t;let e=this.query=t.state.field(mu).query.spec;function i(t,e,i){return Mc("button",{class:"cm-button",name:t,onclick:e,type:"button"},i)}this.commit=this.commit.bind(this),this.searchField=Mc("input",{value:e.search,placeholder:Vu(t,"Find"),"aria-label":Vu(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Mc("input",{value:e.replace,placeholder:Vu(t,"Replace"),"aria-label":Vu(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Mc("input",{type:"checkbox",name:"case",form:"",checked:e.caseSensitive,onchange:this.commit}),this.reField=Mc("input",{type:"checkbox",name:"re",form:"",checked:e.regexp,onchange:this.commit}),this.wordField=Mc("input",{type:"checkbox",name:"word",form:"",checked:e.wholeWord,onchange:this.commit}),this.dom=Mc("div",{onkeydown:t=>this.keydown(t),class:"cm-search"},[this.searchField,i("next",(()=>xu(t)),[Vu(t,"next")]),i("prev",(()=>ku(t)),[Vu(t,"previous")]),i("select",(()=>Qu(t)),[Vu(t,"all")]),...t.state.readOnly?[]:[Mc("br"),this.replaceField,i("replace",(()=>$u(t)),[Vu(t,"replace")]),i("replaceAll",(()=>Pu(t)),[Vu(t,"replace all")])],Mc("button",{name:"close",onclick:()=>Tu(t),"aria-label":Vu(t,"close"),type:"button"},["×"])])}commit(){let t=new au({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:Ou.of(t)}))}keydown(t){var e,i,n;e=this.view,i=t,n="search-panel",Bs(Ls(e.state),i,e,n)?t.preventDefault():13==t.keyCode&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?ku:xu)(this.view)):13==t.keyCode&&t.target==this.replaceField&&(t.preventDefault(),$u(this.view))}update(t){for(let e of t.transactions)for(let t of e.effects)t.is(Ou)&&!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(ou).top}}function Vu(t,e){return t.state.phrase(e)}const Mu=30,Du=/[\s\.,:;?!]/;function Wu(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-Mu),o=Math.min(s,i+Mu),a=t.state.sliceDoc(r,o);if(r!=n.from)for(let t=0;ta.length-Mu;t--)if(!Du.test(a[t-1])&&Du.test(a[t])){a=a.slice(0,t);break}return Ts.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${n.number}.`)}const Uu=Ts.baseTheme({".cm-panel.cm-search":{padding:"0.25rem 0.5rem 0.25rem 0.5rem",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"0.5rem",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"}}),Yu=[mu,N.lowest(yu),Uu];class qu{constructor(t,e,i){this.state=t,this.pos=e,this.explicit=i,this.abortListeners=[]}tokenBefore(t){let e=Xa(this.state).resolveInner(this.pos,-1);for(;e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null}matchBefore(t){let e=this.state.doc.lineAt(this.pos),i=Math.max(e.from,this.pos-250),n=e.text.slice(i-e.from,this.pos-e.from),s=n.search(ju(t,!1));return s<0?null:{from:i+s,to:this.pos,text:n.slice(s)}}get aborted(){return null==this.abortListeners}addEventListener(t,e){"abort"==t&&this.abortListeners&&this.abortListeners.push(e)}}function Lu(t){let e=Object.keys(t).join(""),i=/\w/.test(e);return i&&(e=e.replace(/\w/g,"")),`[${i?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function zu(t){let e=t.map((t=>"string"==typeof t?{label:t}:t)),[i,n]=e.every((t=>/^\w+$/.test(t.label)))?[/\w*$/,/\w+$/]:function(t){let e=Object.create(null),i=Object.create(null);for(let{label:n}of t){e[n[0]]=!0;for(let t=1;t{let s=t.matchBefore(n);return s||t.explicit?{from:s?s.from:t.pos,options:e,validFor:i}:null}}class Iu{constructor(t,e,i,n){this.completion=t,this.source=e,this.match=i,this.score=n}}function Bu(t){return t.selection.main.from}function ju(t,e){var i;let{source:n}=t,s=e&&"^"!=n[0],r="$"!=n[n.length-1];return s||r?new RegExp(`${s?"^":""}(?:${n})${r?"$":""}`,null!==(i=t.flags)&&void 0!==i?i:t.ignoreCase?"i":""):t}const Nu=lt.define();const Gu=new WeakMap;function Fu(t){if(!Array.isArray(t))return t;let e=Gu.get(t);return e||Gu.set(t,e=zu(t)),e}const Hu=ut.define(),Ju=ut.define();class Ku{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[];for(let e=0;e=48&&l<=57||l>=97&&l<=122?2:l>=65&&l<=90?1:0:(y=w(l))!=y.toLowerCase()?1:y!=y.toUpperCase()?2:0;(!n||1==S&&O||0==m&&0!=S)&&(e[c]==l||i[c]==l&&(u=!0)?r[c++]=n:r.length&&(g=!1)),m=S,n+=v(l)}return c==a&&0==r[0]&&g?this.result((u?-200:0)-100,r,t):d==a&&0==f?[-200-t.length+(p==t.length?0:-100),0,p]:o>-1?[-700-t.length,o,o+this.pattern.length]:d==a?[-900-t.length,f,p]:c==a?this.result((u?-200:0)-100-700+(g?0:-1100),r,t):2==e.length?null:this.result((n[0]?-700:0)-200-1100,n,t)}result(t,e,i){let n=[t-i.length],s=1;for(let t of e){let e=t+(this.astral?v(b(i,t)):1);s>1&&n[s-1]==t?n[s-1]=e:(n[s++]=t,n[s++]=e)}return n}}const td=E.define({combine:t=>kt(t,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:id,compareCompletions:(t,e)=>t.label.localeCompare(e.label),interactionDelay:75},{defaultKeymap:(t,e)=>t&&e,closeOnBlur:(t,e)=>t&&e,icons:(t,e)=>t&&e,tooltipClass:(t,e)=>i=>ed(t(i),e(i)),optionClass:(t,e)=>i=>ed(t(i),e(i)),addToOptions:(t,e)=>t.concat(e)})});function ed(t,e){return t?e?t+" "+e:t:e}function id(t,e,i,n,s){let r,o,a=t.textDirection==Wi.RTL,l=a,h=!1,c="top",u=e.left-s.left,d=s.right-e.right,f=n.right-n.left,p=n.bottom-n.top;if(l&&u=p||t>e.top?r=i.bottom-e.top:(c="bottom",r=e.bottom-i.top)}return{style:`${c}: ${r}px; max-width: ${o}px`,class:"cm-completionInfo-"+(h?a?"left-narrow":"right-narrow":l?"left":"right")}}function nd(t,e="option"){return i=>{let n=i.state.field(yd,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp-1?n.open.selected+r*(t?1:-1):t?0:o-1;return a<0?a="page"==e?0:o-1:a>=o&&(a="page"==e?o-1:0),i.dispatch({effects:vd.of(a)}),!0}}const sd=t=>{let e=t.state.field(yd,!1);return!(t.state.readOnly||!e||!e.open||e.open.selected<0||Date.now()-e.open.timestamp(t.selection||t.docChanged)&&!gd(t)));for(let e=0;e50&&Date.now()-n.time>1e3){for(let t of n.context.abortListeners)try{t()}catch(t){Qi(this.view.state,t)}n.context.abortListeners=null,this.running.splice(e--,1)}else n.updates.push(...t.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some((t=>1==t.state&&!this.running.some((e=>e.active.source==t.source))))?setTimeout((()=>this.startUpdate()),50):-1,0!=this.composing)for(let e of t.transactions)"input"==gd(e)?this.composing=2:2==this.composing&&e.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:t}=this.view,e=t.field(yd);for(let t of e.active)1!=t.state||this.running.some((e=>e.active.source==t.source))||this.startQuery(t)}startQuery(t){let{state:e}=this.view,i=Bu(e),n=new qu(e,i,t.explicitPos==i),s=new rd(t,n);this.running.push(s),Promise.resolve(t.source(n)).then((t=>{s.context.aborted||(s.done=t||null,this.scheduleAccept())}),(t=>{this.view.dispatch({effects:Ju.of(null)}),Qi(this.view.state,t)}))}scheduleAccept(){this.running.every((t=>void 0!==t.done))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((()=>this.accept()),50))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],i=this.view.state.facet(td);for(let n=0;nt.source==s.active.source));if(r&&1==r.state)if(null==s.done){let t=new md(s.active.source,0);for(let e of s.updates)t=t.update(e,i);1!=t.state&&e.push(t)}else this.startQuery(r)}e.length&&this.view.dispatch({effects:wd.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(yd,!1);if(e&&e.tooltip&&this.view.state.facet(td).closeOnBlur){let i=e.open&&Rr(this.view,e.open.tooltip);i&&i.dom.contains(t.relatedTarget)||this.view.dispatch({effects:Ju.of(null)})}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout((()=>this.view.dispatch({effects:Hu.of(!1)})),20),this.composing=0}}});function ad(t,e){const i=e.completion.apply||e.completion.label;let n=t.state.field(yd).active.find((t=>t.source==e.source));return n instanceof bd&&("string"==typeof i?t.dispatch(Object.assign(Object.assign({},function(t,e,i,n){let{main:s}=t.selection,r=i-s.from,o=n-s.from;return Object.assign(Object.assign({},t.changeByRange((a=>a!=s&&i!=n&&t.sliceDoc(a.from+r,a.from+o)!=t.sliceDoc(i,n)?{range:a}:{changes:{from:a.from+r,to:n==s.from?a.to:a.from+o,insert:e},range:A.cursor(a.from+r+e.length)}))),{userEvent:"input.complete"})}(t.state,i,n.from,n.to)),{annotations:Nu.of(e.completion)})):i(t,e.completion,n.from,n.to),!0)}function ld(t,e,i){if(t<=i)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let t=Math.floor(e/i);return{from:t*i,to:(t+1)*i}}let n=Math.floor((t-e)/i);return{from:t-(n+1)*i,to:t-n*i}}class hd{constructor(t,e){this.view=t,this.stateField=e,this.info=null,this.placeInfoReq={read:()=>this.measureInfo(),write:t=>this.placeInfo(t),key:this},this.space=null,this.currentClass="";let i=t.state.field(e),{options:n,selected:s}=i.open,r=t.state.facet(td);this.optionContent=function(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(t){let e=document.createElement("div");return e.classList.add("cm-completionIcon"),t.type&&e.classList.add(...t.type.split(/\s+/g).map((t=>"cm-completionIcon-"+t))),e.setAttribute("aria-hidden","true"),e},position:20}),e.push({render(t,e,i){let n=document.createElement("span");n.className="cm-completionLabel";let{label:s}=t,r=0;for(let t=1;tr&&n.appendChild(document.createTextNode(s.slice(r,e)));let a=n.appendChild(document.createElement("span"));a.appendChild(document.createTextNode(s.slice(e,o))),a.className="cm-completionMatchedText",r=o}return rt.position-e.position)).map((t=>t.render))}(r),this.optionClass=r.optionClass,this.tooltipClass=r.tooltipClass,this.range=ld(n.length,s,r.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",(e=>{for(let i,s=e.target;s&&s!=this.dom;s=s.parentNode)if("LI"==s.nodeName&&(i=/-(\d+)$/.exec(s.id))&&+i[1]{let i=t.state.field(this.stateField,!1);i&&i.tooltip&&t.state.facet(td).closeOnBlur&&e.relatedTarget!=t.contentDOM&&t.dispatch({effects:Ju.of(null)})})),this.list=this.dom.appendChild(this.createListBox(n,i.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))}mount(){this.updateSel()}update(t){var e,i,n;let s=t.state.field(this.stateField),r=t.startState.field(this.stateField);this.updateTooltipClass(t.state),s!=r&&(this.updateSel(),(null===(e=s.open)||void 0===e?void 0:e.disabled)!=(null===(i=r.open)||void 0===i?void 0:i.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!(null===(n=s.open)||void 0===n?void 0:n.disabled)))}updateTooltipClass(t){let e=this.tooltipClass(t);if(e!=this.currentClass){for(let t of this.currentClass.split(" "))t&&this.dom.classList.remove(t);for(let t of e.split(" "))t&&this.dom.classList.add(t);this.currentClass=e}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),e=t.open;if((e.selected>-1&&e.selected=this.range.to)&&(this.range=ld(e.options.length,e.selected,this.view.state.facet(td).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e.options,t.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))),this.updateSelectedOption(e.selected)){this.info&&(this.info.remove(),this.info=null);let{completion:i}=e.options[e.selected],{info:n,label:s,c:r}=i;if(!n)return;let o="string"==typeof n?document.createTextNode(n+" "):n(i);if(!o)return;if(!r){const t=document.createElement("span");t.appendChild(o),o=t;const e=document.createElement("a");e.innerText="🔎",e.href="/docFind/"+s,e.target="blank",o.appendChild(e)}if(!o)return;"then"in o?o.then((e=>{e&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(e)})).catch((t=>Qi(this.view.state,t,"completion info"))):this.addInfoPane(o)}}addInfoPane(t){let e=this.info=document.createElement("div");e.className="cm-tooltip cm-completionInfo",e.appendChild(t),this.dom.appendChild(e),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let e=null;for(let i=this.list.firstChild,n=this.range.from;i;i=i.nextSibling,n++)"LI"==i.nodeName&&i.id?n==t?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),e=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected"):n--;return e&&function(t,e){let i=t.getBoundingClientRect(),n=e.getBoundingClientRect();n.topi.bottom&&(t.scrollTop+=n.bottom-i.bottom)}(this.list,e),e}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let e=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),n=t.getBoundingClientRect(),s=this.space;if(!s){let t=this.dom.ownerDocument.defaultView||window;s={left:0,top:0,right:t.innerWidth,bottom:t.innerHeight}}return n.top>Math.min(s.bottom,e.bottom)-10||n.bottomi.from||0==i.from))if(s=t,"string"!=typeof l&&l.header)n.appendChild(l.header(l));else{n.appendChild(document.createElement("completion-section")).textContent=t}}const h=n.appendChild(document.createElement("li"));h.id=e+"-"+r,h.setAttribute("role","option");let c=this.optionClass(o);c&&(h.className=c);for(let t of this.optionContent){let e=t(o,this.view.state,a);e&&h.appendChild(e)}}return i.from&&n.classList.add("cm-completionListIncompleteTop"),i.to=this.options.length?this:new ud(this.options,pd(e,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,e,i,n,s){let r=function(t,e){let i=[],n=null,s=t=>{i.push(t);let{section:e}=t.completion;if(e){n||(n=[]);let t="string"==typeof e?e:e.name;n.some((e=>e.name==t))||n.push("string"==typeof e?{name:t}:e)}};for(let n of t)if(n.hasResult())if(!1===n.result.filter){let t=n.result.getMatch;for(let e of n.result.options){let r=[1e9-i.length];if(t)for(let i of t(e))r.push(i);s(new Iu(e,n.source,r,r[0]))}}else{let t,i=new Ku(e.sliceDoc(n.from,n.to));for(let e of n.result.options)(t=i.match(e.label))&&s(new Iu(e,n.source,t,t[0]+(e.boost||0)))}if(n){let t=Object.create(null),e=0,s=(t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:1e9)-(null!==(n=e.rank)&&void 0!==n?n:1e9)||(t.namee.score-t.score||a(t.completion,e.completion))))!o||o.label!=t.completion.label||o.detail!=t.completion.detail||null!=o.type&&null!=t.completion.type&&o.type!=t.completion.type||o.apply!=t.completion.apply?r.push(t):cd(t.completion)>cd(o)&&(r[r.length-1]=t),o=t.completion;return r}(t,e);if(!r.length)return n&&t.some((t=>1==t.state))?new ud(n.options,n.attrs,n.tooltip,n.timestamp,n.selected,!0):null;let o=e.facet(td).selectOnOpen?0:-1;if(n&&n.selected!=o&&-1!=n.selected){let t=n.options[n.selected].completion;for(let e=0;ee.hasResult()?Math.min(t,e.from):t),1e8),create:(a=yd,t=>new hd(t,a)),above:s.aboveCursor},n?n.timestamp:Date.now(),o,!1);var a}map(t){return new ud(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class dd{constructor(t,e,i){this.active=t,this.id=e,this.open=i}static start(){return new dd(Od,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(t){let{state:e}=t,i=e.facet(td),n=(i.override||e.languageDataAt("autocomplete",Bu(e)).map(Fu)).map((e=>(this.active.find((t=>t.source==e))||new md(e,this.active.some((t=>0!=t.state))?1:0)).update(t,i)));n.length==this.active.length&&n.every(((t,e)=>t==this.active[e]))&&(n=this.active);let s=this.open;s&&t.docChanged&&(s=s.map(t.changes)),t.selection||n.some((e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to)))||!function(t,e){if(t==e)return!0;for(let i=0,n=0;;){for(;i1==t.state))&&(s=null),!s&&n.every((t=>1!=t.state))&&n.some((t=>t.hasResult()))&&(n=n.map((t=>t.hasResult()?new md(t.source,0):t)));for(let e of t.effects)e.is(vd)&&(s=s&&s.setSelected(e.value,this.id));return n==this.active&&s==this.open?this:new dd(n,this.id,s)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:fd}}const fd={"aria-autocomplete":"list"};function pd(t,e){let i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(i["aria-activedescendant"]=t+"-"+e),i}const Od=[];function gd(t){return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null}class md{constructor(t,e,i=-1){this.source=t,this.state=e,this.explicitPos=i}hasResult(){return!1}update(t,e){let i=gd(t),n=this;i?n=n.handleUserEvent(t,i,e):t.docChanged?n=n.handleChange(t):t.selection&&0!=n.state&&(n=new md(n.source,0));for(let e of t.effects)if(e.is(Hu))n=new md(n.source,1,e.value?Bu(t.state):-1);else if(e.is(Ju))n=new md(n.source,0);else if(e.is(wd))for(let t of e.value)t.source==n.source&&(n=t);return n}handleUserEvent(t,e,i){return"delete"!=e&&i.activateOnTyping?new md(this.source,1):this.map(t.changes)}handleChange(t){return t.changes.touchesRange(Bu(t.startState))?new md(this.source,0):this.map(t.changes)}map(t){return t.empty||this.explicitPos<0?this:new md(this.source,this.state,t.mapPos(this.explicitPos))}}class bd extends md{constructor(t,e,i,n,s){super(t,2,e),this.result=i,this.from=n,this.to=s}hasResult(){return!0}handleUserEvent(t,e,i){var n;let s=t.changes.mapPos(this.from),r=t.changes.mapPos(this.to,1),o=Bu(t.state);if((this.explicitPos<0?o<=s:or||"delete"==e&&Bu(t.startState)==this.from)return new md(this.source,"input"==e&&i.activateOnTyping?1:0);let a,l=this.explicitPos<0?-1:t.changes.mapPos(this.explicitPos);return function(t,e,i,n){if(!t)return!1;let s=e.sliceDoc(i,n);return"function"==typeof t?t(s,i,n,e):ju(t,!0).test(s)}(this.result.validFor,t.state,s,r)?new bd(this.source,l,this.result,s,r):this.result.update&&(a=this.result.update(this.result,s,r,new qu(t.state,o,l>=0)))?new bd(this.source,l,a,a.from,null!==(n=a.to)&&void 0!==n?n:Bu(t.state)):new md(this.source,1,l)}handleChange(t){return t.changes.touchesRange(this.from,this.to)?new md(this.source,0):this.map(t.changes)}map(t){return t.empty?this:new bd(this.source,this.explicitPos<0?-1:t.mapPos(this.explicitPos),this.result,t.mapPos(this.from),t.mapPos(this.to,1))}}const wd=ut.define({map:(t,e)=>t.map((t=>t.map(e)))}),vd=ut.define(),yd=q.define({create:()=>dd.start(),update:(t,e)=>t.update(e),provide:t=>[Tr.from(t,(t=>t.tooltip)),Ts.contentAttributes.from(t,(t=>t.attrs))]}),Sd=Ts.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class xd{constructor(t,e,i,n){this.field=t,this.line=e,this.from=i,this.to=n}}class kd{constructor(t,e,i){this.field=t,this.from=e,this.to=i}map(t){let e=t.mapPos(this.from,-1,S.TrackDel),i=t.mapPos(this.to,1,S.TrackDel);return null==e||null==i?null:new kd(this.field,e,i)}}class Qd{constructor(t,e){this.lines=t,this.fieldPositions=e}instantiate(t,e){let i=[],n=[e],s=t.doc.lineAt(e),r=/^\s*/.exec(s.text)[0];for(let s of this.lines){if(i.length){let i=r,o=/^\t*/.exec(s)[0].length;for(let e=0;enew kd(t.field,n[t.line]+t.from,n[t.line]+t.to)));return{text:i,ranges:o}}static parse(t){let e,i=[],n=[],s=[];for(let r of t.split(/\r\n?|\n/)){for(;e=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(r);){let t=e[1]?+e[1]:null,o=e[2]||e[3]||"",a=-1;for(let e=0;e=a&&t.field++}s.push(new xd(a,n.length,e.index,e.index+o.length)),r=r.slice(0,e.index)+o+r.slice(e.index+e[0].length)}for(let t;t=/\\([{}])/.exec(r);){r=r.slice(0,t.index)+t[1]+r.slice(t.index+t[0].length);for(let e of s)e.line==n.length&&e.from>t.index&&(e.from--,e.to--)}n.push(r)}return new Qd(n,s)}}let $d=ni.widget({widget:new class extends ei{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),Pd=ni.mark({class:"cm-snippetField"});class Cd{constructor(t,e){this.ranges=t,this.active=e,this.deco=ni.set(t.map((t=>(t.from==t.to?$d:Pd).range(t.from,t.to))))}map(t){let e=[];for(let i of this.ranges){let n=i.map(t);if(!n)return null;e.push(n)}return new Cd(e,this.active)}selectionInsideField(t){return t.ranges.every((t=>this.ranges.some((e=>e.field==this.active&&e.from<=t.from&&e.to>=t.to))))}}const _d=ut.define({map:(t,e)=>t&&t.map(e)}),Xd=ut.define(),Zd=q.define({create:()=>null,update(t,e){for(let i of e.effects){if(i.is(_d))return i.value;if(i.is(Xd)&&t)return new Cd(t.ranges,i.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>Ts.decorations.from(t,(t=>t?t.deco:ni.none))});function Ad(t,e){return A.create(t.filter((t=>t.field==e)).map((t=>A.range(t.from,t.to))))}function Td(e){let i=Qd.parse(e);return(e,n,s,r)=>{let{text:o,ranges:a}=i.instantiate(e.state,s),l={changes:{from:s,to:r,insert:t.of(o)},scrollIntoView:!0,annotations:n?Nu.of(n):void 0};if(a.length&&(l.selection=Ad(a,0)),a.length>1){let t=new Cd(a,0),i=l.effects=[_d.of(t)];void 0===e.state.field(Zd,!1)&&i.push(ut.appendConfig.of([Zd,Md,Wd,Sd]))}e.dispatch(e.state.update(l))}}function Rd(t){return({state:e,dispatch:i})=>{let n=e.field(Zd,!1);if(!n||t<0&&0==n.active)return!1;let s=n.active+t,r=t>0&&!n.ranges.some((e=>e.field==s+t));return i(e.update({selection:Ad(n.ranges,s),effects:_d.of(r?null:new Cd(n.ranges,s))})),!0}}const Ed=[{key:"Tab",run:Rd(1),shift:Rd(-1)},{key:"Escape",run:({state:t,dispatch:e})=>!!t.field(Zd,!1)&&(e(t.update({effects:_d.of(null)})),!0)}],Vd=E.define({combine:t=>t.length?t[0]:Ed}),Md=N.highest(Ys.compute([Vd],(t=>t.facet(Vd))));function Dd(t,e){return Object.assign(Object.assign({},e),{apply:Td(t)})}const Wd=Ts.domEventHandlers({mousedown(t,e){let i,n=e.state.field(Zd,!1);if(!n||null==(i=e.posAtCoords({x:t.clientX,y:t.clientY})))return!1;let s=n.ranges.find((t=>t.from<=i&&t.to>=i));return!(!s||s.field==n.active)&&(e.dispatch({selection:Ad(n.ranges,s.field),effects:_d.of(n.ranges.some((t=>t.field>s.field))?new Cd(n.ranges,s.field):null)}),!0)}}),Ud=new class extends Qt{};function Yd(t={}){return[yd,td.of(t),od,Ld,Sd]}Ud.startSide=1,Ud.endSide=-1;const qd=[{key:"Ctrl-Space",run:t=>!!t.state.field(yd,!1)&&(t.dispatch({effects:Hu.of(!0)}),!0)},{key:"Escape",run:t=>{let e=t.state.field(yd,!1);return!(!e||!e.active.some((t=>0!=t.state)))&&(t.dispatch({effects:Ju.of(null)}),!0)}},{key:"ArrowDown",run:nd(!0)},{key:"ArrowUp",run:nd(!1)},{key:"PageDown",run:nd(!0,"page")},{key:"PageUp",run:nd(!1,"page")},{key:"Enter",run:sd}],Ld=N.highest(Ys.computeN([td],(t=>t.facet(td).defaultKeymap?[qd]:[]))),zd=(()=>[vr(),Sh(),ir(),$l(_l,{fallback:!0}),Ys.of([...Vc,...Wh])])();class Id{constructor(t,e,i,n,s,r,o,a,l,h=0,c){this.p=t,this.stack=e,this.state=i,this.reducePos=n,this.pos=s,this.score=r,this.buffer=o,this.bufferBase=a,this.curContext=l,this.lookAhead=h,this.parent=c}toString(){return`[${this.stack.filter(((t,e)=>e%3==0)).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,i=0){let n=t.parser.context;return new Id(t,[],e,i,i,0,[],0,n?new Bd(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let i=t>>19,n=65535&t,{parser:s}=this.p,r=s.dynamicPrecedence(n);if(r&&(this.score+=r),0==i)return this.pushState(s.getGoto(this.state,n,!0),this.reducePos),n=2e3&&!(null===(e=this.p.parser.nodeSet.types[n])||void 0===e?void 0:e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=l):this.p.lastBigReductionSizeo;)this.stack.pop();this.reduceContext(n,a)}storeNode(t,e,i,n=4,s=!1){if(0==t&&(!this.stack.length||this.stack[this.stack.length-1]0&&0==t.buffer[n-4]&&t.buffer[n-1]>-1){if(e==i)return;if(t.buffer[n-2]>=e)return void(t.buffer[n-2]=i)}}if(s&&this.pos!=i){let s=this.buffer.length;if(s>0&&0!=this.buffer[s-4])for(;s>0&&this.buffer[s-2]>i;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,n>4&&(n-=4);this.buffer[s]=t,this.buffer[s+1]=e,this.buffer[s+2]=i,this.buffer[s+3]=n}else this.buffer.push(t,e,i,n)}shift(t,e,i){let n=this.pos;if(131072&t)this.pushState(65535&t,this.pos);else if(0==(262144&t)){let s=t,{parser:r}=this.p;(i>this.pos||e<=r.maxNode)&&(this.pos=i,r.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,n),this.shiftContext(e,n),e<=r.maxNode&&this.buffer.push(e,n,i,4)}else this.pos=i,this.shiftContext(e,n),e<=this.p.parser.maxNode&&this.buffer.push(e,n,i,4)}apply(t,e,i){65536&t?this.reduce(t):this.shift(t,e,i)}useNode(t,e){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=t)&&(this.p.reused.push(t),i++);let n=this.pos;this.reducePos=this.pos=n+t.length,this.pushState(e,n),this.buffer.push(i,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let i=t.buffer.slice(e),n=t.bufferBase+e;for(;t&&n==t.bufferBase;)t=t.parent;return new Id(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,n,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let i=t<=this.p.parser.maxNode;i&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,i?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new Nd(this);;){let i=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(0==i)return!1;if(0==(65536&i))return!0;e.reduce(i)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let n,s=0;s1&e&&t==n))||i.push(e[t],n)}e=i}let i=[];for(let t=0;t>19,n=65535&t,s=this.stack.length-3*i;if(s<0||e.getGoto(this.stack[s],n,!1)<0)return!1;this.storeNode(0,this.reducePos,this.reducePos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:t}=this.p;return 65535==t.data[t.stateSlot(this.state,1)]&&!t.stateSlot(this.state,4)}restart(){this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;ethis.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Bd{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}var jd;!function(t){t[t.Insert=200]="Insert",t[t.Delete=190]="Delete",t[t.Reduce=100]="Reduce",t[t.MaxNext=4]="MaxNext",t[t.MaxInsertStackDepth=300]="MaxInsertStackDepth",t[t.DampenInsertStackDepth=120]="DampenInsertStackDepth",t[t.MinBigReduction=2e3]="MinBigReduction"}(jd||(jd={}));class Nd{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=65535&t,i=t>>19;0==i?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(i-1);let n=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=n}}class Gd{constructor(t,e,i){this.stack=t,this.pos=e,this.index=i,this.buffer=t.buffer,0==this.index&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new Gd(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;null!=t&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new Gd(this.stack,this.pos,this.index)}}function Fd(t,e=Uint16Array){if("string"!=typeof t)return t;let i=null;for(let n=0,s=0;n=92&&e--,e>=34&&e--;let s=e-32;if(s>=46&&(s-=46,i=!0),r+=s,i)break;r*=46}i?i[s++]=r:i=new e(r)}return i}class Hd{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Jd=new Hd;class Kd{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Jd,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let i=this.range,n=this.rangeIndex,s=this.pos+t;for(;si.to:s>=i.to;){if(n==this.ranges.length-1)return null;let t=this.ranges[++n];s+=t.from-i.to,i=t}return s}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,e.from);return this.end}peek(t){let e,i,n=this.chunkOff+t;if(n>=0&&n=this.chunk2Pos&&en.to&&(this.chunk2=this.chunk2.slice(0,n.to-e)),i=this.chunk2.charCodeAt(0)}}return e>=this.token.lookAhead&&(this.token.lookAhead=e+1),i}acceptToken(t,e=0){let i=e?this.resolveOffset(e,-1):this.pos;if(null==i||i=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=Jd,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let i="";for(let n of this.ranges){if(n.from>=e)break;n.to>t&&(i+=this.input.read(Math.max(n.from,t),Math.min(n.to,e)))}return i}}class tf{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:i}=e.p;sf(this.data,t,e,this.id,i.data,i.tokenPrecTable)}}tf.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class ef{constructor(t,e,i){this.precTable=e,this.elseToken=i,this.data="string"==typeof t?Fd(t):t}token(t,e){let i=t.pos,n=0;for(;sf(this.data,t,e,0,this.data,this.precTable),!(t.token.value>-1);){if(null==this.elseToken)return;if(t.next<0)break;t.advance(),t.reset(t.pos,t.token),n++}n&&(t.reset(i,t.token),t.acceptToken(this.elseToken,n))}}ef.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class nf{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function sf(t,e,i,n,s,r){let o=0,a=1<0){let i=t[n];if(l.allows(i)&&(-1==e.token.value||e.token.value==i||of(i,e.token.value,s,r))){e.acceptToken(i);break}}let n=e.next,h=0,c=t[o+2];if(!(e.next<0&&c>h&&65535==t[i+3*c-3]&&65535==t[i+3*c-3])){for(;h>1,r=i+s+(s<<1),a=t[r],l=t[r+1]||65536;if(n=l)){o=t[r+2],e.advance();continue t}h=s+1}}break}o=t[i+3*c-1]}}function rf(t,e,i){for(let n,s=e;65535!=(n=t[s]);s++)if(n==i)return s-e;return-1}function of(t,e,i,n){let s=rf(i,n,e);return s<0||rf(i,n,t)e)&&!n.type.isError)return i<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(t.length,Math.max(n.from+1,e+25));if(i<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return i<0?0:t.length}}!function(t){t[t.Margin=25]="Margin"}(hf||(hf={}));let uf=class{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?cf(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?cf(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=r,null;if(s instanceof bo){if(r==t){if(r=Math.max(this.safeFrom,t)&&(this.trees.push(s),this.start.push(r),this.index.push(0))}else this.index[e]++,this.nextStart=r+s.length}}};class df{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map((t=>new Hd))}getActions(t){let e=0,i=null,{parser:n}=t.p,{tokenizers:s}=n,r=n.stateSlot(t.state,3),o=t.curContext?t.curContext.hash:0,a=0;for(let n=0;nh.end+25&&(a=Math.max(h.lookAhead,a)),0!=h.value)){let n=e;if(h.extended>-1&&(e=this.addActions(t,h.extended,h.end,e)),e=this.addActions(t,h.value,h.end,e),!l.extend&&(i=h,e>n))break}}for(;this.actions.length>e;)this.actions.pop();return a&&t.setLookAhead(a),i||t.pos!=this.stream.end||(i=new Hd,i.value=t.p.parser.eofTerm,i.start=i.end=t.pos,e=this.addActions(t,i.value,i.end,e)),this.mainToken=i,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new Hd,{pos:i,p:n}=t;return e.start=i,e.end=Math.min(i+1,n.stream.end),e.value=i==n.stream.end?n.parser.eofTerm:0,e}updateCachedToken(t,e,i){let n=this.stream.clipPos(i.pos);if(e.token(this.stream.reset(n,t),i),t.value>-1){let{parser:e}=i.p;for(let n=0;n=0&&i.p.parser.dialect.allows(s>>1)){0==(1&s)?t.value=s>>1:t.extended=s>>1;break}}}else t.value=0,t.end=this.stream.clipPos(n+1)}putAction(t,e,i,n){for(let e=0;e4*t.bufferLength?new uf(i,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t,e,i=this.stacks,n=this.minStackPos,s=this.stacks=[];if(this.bigReductionCount>300&&1==i.length){let[t]=i;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;rn)s.push(o);else{if(this.advanceStack(o,s,i))continue;{t||(t=[],e=[]),t.push(o);let i=this.tokens.getMainToken(o);e.push(i.value,i.end)}}break}}if(!s.length){let e=t&&function(t){let e=null;for(let i of t){let t=i.p.stoppedAt;(i.pos==i.p.stream.end||null!=t&&i.pos>t)&&i.p.parser.stateFlag(i.state,2)&&(!e||e.scorethis.stoppedAt?t[0]:this.runRecovery(t,e,s);if(i)return this.stackToTree(i.forceAll())}if(this.recovering){let t=1==this.recovering?1:3*this.recovering;if(s.length>t)for(s.sort(((t,e)=>e.score-t.score));s.length>t;)s.pop();s.some((t=>t.reducePos>n))&&this.recovering--}else if(s.length>1){t:for(let t=0;t500&&n.buffer.length>500){if(!((e.score-n.score||e.buffer.length-n.buffer.length)>0)){s.splice(t--,1);continue t}s.splice(i--,1)}}}s.length>12&&s.splice(12,s.length-12)}this.minStackPos=s[0].pos;for(let t=1;t ":"";if(null!=this.stoppedAt&&n>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let e=t.curContext&&t.curContext.tracker.strict,i=e?t.curContext.hash:0;for(let o=this.fragments.nodeAt(n);o;){let n=this.parser.nodeSet.types[o.type.id]==o.type?s.getGoto(t.state,o.type.id):-1;if(n>-1&&o.length&&(!e||(o.prop(ho.contextHash)||0)==i))return t.useNode(o,n),af&&console.log(r+this.stackID(t)+` (via reuse of ${s.getName(o.type.id)})`),!0;if(!(o instanceof bo)||0==o.children.length||o.positions[0]>0)break;let a=o.children[0];if(!(a instanceof bo&&0==o.positions[0]))break;o=a}}let o=s.stateSlot(t.state,4);if(o>0)return t.reduce(o),af&&console.log(r+this.stackID(t)+` (via always-reduce ${s.getName(65535&o)})`),!0;if(t.stack.length>=15e3)for(;t.stack.length>9e3&&t.forceReduce(););let a=this.tokens.getActions(t);for(let o=0;on?e.push(d):i.push(d)}return!1}advanceFully(t,e){let i=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>i)return Of(t,e),!0}}runRecovery(t,e,i){let n=null,s=!1;for(let r=0;r ":"";if(o.deadEnd){if(s)continue;if(s=!0,o.restart(),af&&console.log(h+this.stackID(o)+" (restarted)"),this.advanceFully(o,i))continue}let c=o.split(),u=h;for(let t=0;c.forceReduce()&&t<10;t++){if(af&&console.log(u+this.stackID(c)+" (via force-reduce)"),this.advanceFully(c,i))break;af&&(u=this.stackID(c)+" -> ")}for(let t of o.recoverByInsert(a))af&&console.log(h+this.stackID(t)+" (via recover-insert)"),this.advanceFully(t,i);this.stream.end>o.pos?(l==o.pos&&(l++,a=0),o.recoverByDelete(a,l),af&&console.log(h+this.stackID(o)+` (via recover-delete ${this.parser.getName(a)})`),Of(o,i)):(!n||n.scoret;class bf{constructor(t){this.start=t.start,this.shift=t.shift||mf,this.reduce=t.reduce||mf,this.reuse=t.reuse||mf,this.hash=t.hash||(()=>0),this.strict=!1!==t.strict}}class wf extends Vo{constructor(t){if(super(),this.wrappers=[],14!=t.version)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let i=0;it.topRules[e][1])),n=[];for(let t=0;t=0)s(n,t,e[i++]);else{let r=e[i+-n];for(let o=-n;o>0;o--)s(e[i++],t,r);i++}}}this.nodeSet=new po(e.map(((e,s)=>fo.define({name:s>=this.minRepeatTerm?void 0:e,id:s,props:n[s],top:i.indexOf(s)>-1,error:0==s,skipped:t.skippedNodes&&t.skippedNodes.indexOf(s)>-1})))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=oo;let r=Fd(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let t=0;t"number"==typeof t?new tf(r,t):t)),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,i){let n=new pf(this,t,e,i);for(let s of this.wrappers)n=s(n,t,e,i);return n}getGoto(t,e,i=!1){let n=this.goto;if(e>=n[0])return-1;for(let s=n[e+1];;){let e=n[s++],r=1&e,o=n[s++];if(r&&i)return o;for(let i=s+(e>>1);s0}validAction(t,e){if(e==this.stateSlot(t,4))return!0;for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])return!1;i=vf(this.data,i+2)}if(e==vf(this.data,i+1))return!0}}nextStates(t){let e=[];for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])break;i=vf(this.data,i+2)}if(0==(1&this.data[i+2])){let t=this.data[i+1];e.some(((e,i)=>1&i&&e==t))||e.push(this.data[i],t)}}return e}configure(t){let e=Object.assign(Object.create(wf.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let i=this.topRules[t.top];if(!i)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=i}return t.tokenizers&&(e.tokenizers=this.tokenizers.map((e=>{let i=t.tokenizers.find((t=>t.from==e));return i?i.to:e}))),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map(((i,n)=>{let s=t.specializers.find((t=>t.from==i.external));if(!s)return i;let r=Object.assign(Object.assign({},i),{external:s.to});return e.specializers[n]=yf(r),r}))),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),null!=t.strict&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),null!=t.bufferLength&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return null==e?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),i=e.map((()=>!1));if(t)for(let n of t.split(" ")){let t=e.indexOf(n);t>=0&&(i[t]=!0)}let n=null;for(let t=0;tt.external(i,n)<<1|e}return t.get}const Sf=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],xf=new bf({start:!1,shift:(t,e)=>3==e||4==e||305==e?t:306==e,strict:!1}),kf=new nf(((t,e)=>{let{next:i}=t;(125==i||-1==i||e.context)&&e.canShift(303)&&t.acceptToken(303)}),{contextual:!0,fallback:!0}),Qf=new nf(((t,e)=>{let i,{next:n}=t;Sf.indexOf(n)>-1||(47!=n||47!=(i=t.peek(1))&&42!=i)&&125!=n&&59!=n&&-1!=n&&!e.context&&e.canShift(302)&&t.acceptToken(302)}),{contextual:!0}),$f=new nf(((t,e)=>{let{next:i}=t;if((43==i||45==i)&&(t.advance(),i==t.next)){t.advance();let i=!e.context&&e.canShift(1);t.acceptToken(i?1:2)}}),{contextual:!0}),Pf=ea({"get set async static":Sa.modifier,"for while do if else switch try catch finally return throw break continue default case":Sa.controlKeyword,"in of await yield void typeof delete instanceof":Sa.operatorKeyword,"let var const function class extends":Sa.definitionKeyword,"import export from":Sa.moduleKeyword,"with debugger as new":Sa.keyword,TemplateString:Sa.special(Sa.string),super:Sa.atom,BooleanLiteral:Sa.bool,this:Sa.self,null:Sa.null,Star:Sa.modifier,VariableName:Sa.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":Sa.function(Sa.variableName),VariableDefinition:Sa.definition(Sa.variableName),Label:Sa.labelName,PropertyName:Sa.propertyName,PrivatePropertyName:Sa.special(Sa.propertyName),"CallExpression/MemberExpression/PropertyName":Sa.function(Sa.propertyName),"FunctionDeclaration/VariableDefinition":Sa.function(Sa.definition(Sa.variableName)),"ClassDeclaration/VariableDefinition":Sa.definition(Sa.className),PropertyDefinition:Sa.definition(Sa.propertyName),PrivatePropertyDefinition:Sa.definition(Sa.special(Sa.propertyName)),UpdateOp:Sa.updateOperator,LineComment:Sa.lineComment,BlockComment:Sa.blockComment,Number:Sa.number,String:Sa.string,Escape:Sa.escape,ArithOp:Sa.arithmeticOperator,LogicOp:Sa.logicOperator,BitOp:Sa.bitwiseOperator,CompareOp:Sa.compareOperator,RegExp:Sa.regexp,Equals:Sa.definitionOperator,Arrow:Sa.function(Sa.punctuation),": Spread":Sa.punctuation,"( )":Sa.paren,"[ ]":Sa.squareBracket,"{ }":Sa.brace,"InterpolationStart InterpolationEnd":Sa.special(Sa.brace),".":Sa.derefOperator,", ;":Sa.separator,"@":Sa.meta,TypeName:Sa.typeName,TypeDefinition:Sa.definition(Sa.typeName),"type enum interface implements namespace module declare":Sa.definitionKeyword,"abstract global Privacy readonly override":Sa.modifier,"is keyof unique infer":Sa.operatorKeyword,JSXAttributeValue:Sa.attributeValue,JSXText:Sa.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":Sa.angleBracket,"JSXIdentifier JSXNameSpacedName":Sa.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":Sa.attributeName,"JSXBuiltin/JSXIdentifier":Sa.standard(Sa.tagName)}),Cf={__proto__:null,export:14,as:19,from:27,default:30,async:35,function:36,extends:46,this:50,true:58,false:58,null:70,void:74,typeof:78,super:96,new:130,delete:146,yield:155,await:159,class:164,public:221,private:221,protected:221,readonly:223,instanceof:242,satisfies:245,in:246,const:248,import:280,keyof:335,unique:339,infer:345,is:381,abstract:401,implements:403,type:405,let:408,var:410,interface:417,enum:421,namespace:427,module:429,declare:433,global:437,for:456,of:465,while:468,with:472,do:476,if:480,else:482,switch:486,case:492,try:498,catch:502,finally:506,return:510,throw:514,break:518,continue:522,debugger:526},_f={__proto__:null,async:117,get:119,set:121,declare:181,public:183,private:183,protected:183,static:185,abstract:187,override:189,readonly:195,accessor:197,new:385},Xf={__proto__:null,"<":137},Zf=wf.deserialize({version:14,states:"$6[O`QUOOO%QQUOOO'TQWOOP(bOSOOO*pQ(CjO'#CfO*wOpO'#CgO+VO!bO'#CgO+eO07`O'#DZO-vQUO'#DaO.WQUO'#DlO%QQUO'#DvO0[QUO'#EOOOQ(CY'#EW'#EWO0uQSO'#ETOOQO'#Ei'#EiOOQO'#Ib'#IbO0}QSO'#GkO1YQSO'#EhO1_QSO'#EhO3aQ(CjO'#JcO6QQ(CjO'#JdO6nQSO'#FWO6sQ#tO'#FoOOQ(CY'#F`'#F`O7OO&jO'#F`O7^Q,UO'#FvO8tQSO'#FuOOQ(CY'#Jd'#JdOOQ(CW'#Jc'#JcOOQQ'#KO'#KOO8yQSO'#IOO9OQ(C[O'#IPOOQQ'#JP'#JPOOQQ'#IT'#ITQ`QUOOO%QQUO'#DnO9WQUO'#DzO%QQUO'#D|O9_QSO'#GkO9dQ,UO'#ClO9rQSO'#EgO9}QSO'#ErO:SQ,UO'#F_O:qQSO'#GkO:vQSO'#GoO;RQSO'#GoO;aQSO'#GrO;aQSO'#GsO;aQSO'#GuO9_QSO'#GxOQQSO'#HnO>VQ(C]O'#HtO%QQUO'#HvO>bQ(C]O'#HxO>mQ(C]O'#HzO9OQ(C[O'#H|O>xQ(CjO'#CfO?zQWO'#DfQOQSOOO@bQSO'#EPO9dQ,UO'#EgO@mQSO'#EgO@xQ`O'#F_OOQQ'#Cd'#CdOOQ(CW'#Dk'#DkOOQ(CW'#Jg'#JgO%QQUO'#JgOOQO'#Jk'#JkOOQO'#I_'#I_OAxQWO'#E`OOQ(CW'#E_'#E_OBtQ(C`O'#E`OCOQWO'#ESOOQO'#Jj'#JjOCdQWO'#JkODqQWO'#ESOCOQWO'#E`PEOO?MpO'#C`POOO)CDn)CDnOOOO'#IU'#I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O~P'TO^%^O#X2WO'k%^O~O^%^O!a#rO#X2WO'k%^O~O^%^O!a#rO!l2[O#X2WO'k%^O(b'bO~O^%^O'k%^O~P!6UO!V$^Oo$ka~O!S&|i!V&|i~P!6UO!V'vO!S(Xi~O!V'}O!S(fi~O!S(gi!V(gi~P!6UO!V(di!g(di^(di'k(di~P!6UO#X2^O!V(di!g(di^(di'k(di~O!V(ZO!g(ci~O|%vO!X%wO!x]O#b2cO#c2bO't%eO~O|%vO!X%wO#c2bO't%eO~Og2jO!X'QO%a2iO~Og2jO!X'QO%a2iO'}%OO~O#dvaPvaXva^vakva!eva!fva!hva!lva#gva#hva#iva#jva#kva#lva#mva#nva#ova#qva#sva#uva#vva'kva(Rva(bva!gva!Sva'ivaova!Xva%ava!ava~P#L|O#d$laP$laX$la^$lak$laz$la!e$la!f$la!h$la!l$la#g$la#h$la#i$la#j$la#k$la#l$la#m$la#n$la#o$la#q$la#s$la#u$la#v$la'k$la(R$la(b$la!g$la!S$la'i$lao$la!X$la%a$la!a$la~P#MrO#d$naP$naX$na^$nak$naz$na!e$na!f$na!h$na!l$na#g$na#h$na#i$na#j$na#k$na#l$na#m$na#n$na#o$na#q$na#s$na#u$na#v$na'k$na(R$na(b$na!g$na!S$na'i$nao$na!X$na%a$na!a$na~P#NeO#d$|aP$|aX$|a^$|ak$|az$|a!V$|a!e$|a!f$|a!h$|a!l$|a#g$|a#h$|a#i$|a#j$|a#k$|a#l$|a#m$|a#n$|a#o$|a#q$|a#s$|a#u$|a#v$|a'k$|a(R$|a(b$|a!g$|a!S$|a'i$|a#X$|ao$|a!X$|a%a$|a!a$|a~P#)tO^#[q!V#[q'k#[q'i#[q!S#[q!g#[qo#[q!X#[q%a#[q!a#[q~P!6UOd'OX!V'OX~P!'^O!V.YOd([a~O!U2rO!V'PX!g'PX~P%QO!V.]O!g(]a~O!V.]O!g(]a~P!6UO!S2uO~O#y!ja!W!ja~PJ`O#y!ba!V!ba!W!ba~P#@_O#y!na!W!na~P!8o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'Z9mT#gZ%ZS#fZ%ZU%y|},ZU(W#d#e#hS-r(X(YQ-v(ZQ0h+hQ2`-sU2a-t-u-wS5v2b2cR7u5w`#YW#S#V%v't'}+e-mt#cZ|}#d#e#h%Z(X(Y(Z+h-s-t-u-w2b2c5wQ1_,ZQ1r,oQ5e1jQ7m5fT:x&y+fT#]W%vS#[W%vS'u#S'}S'z#V+eS,t&y+fT-h't-mT'O!c%wQ$hfR)j$mT)_$h)`R3Z.kT*O$u*QR*W$xQ/}*zQ2e.OQ4s0wQ5{2iQ7X4vQ7x5zQ8e7WQ8w7wQ9W8gQ9`8yQ9e9XR9h9alpOXr!X#`%]&d&f&g&i,],b1b1eQ&^!TR,Q&ZV%z|},ZR0q+qR,P&XQ%szR+c%tR+X%nT&b!U&eT&c!U&eT1d,b1e",nodeNames:"⚠ ArithOp ArithOp LineComment BlockComment Script ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXStartTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:364,context:xf,nodeProps:[["group",-26,6,14,16,62,199,203,206,207,209,212,215,225,227,233,235,237,239,242,248,254,256,258,260,262,264,265,"Statement",-32,10,11,25,28,29,35,45,48,49,51,56,64,72,76,78,80,81,103,104,113,114,131,134,136,137,138,139,141,142,162,163,165,"Expression",-23,24,26,30,34,36,38,166,168,170,171,173,174,175,177,178,179,181,182,183,193,195,197,198,"Type",-3,84,96,102,"ClassItem"],["openedBy",31,"InterpolationStart",50,"[",54,"{",69,"(",143,"JSXStartTag",155,"JSXStartTag JSXStartCloseTag"],["closedBy",33,"InterpolationEnd",44,"]",55,"}",70,")",144,"JSXSelfCloseEndTag JSXEndTag",160,"JSXEndTag"]],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z{^~^O'q~~aP!P!Qd~iO'r~~",25,308)],topRules:{Script:[0,5],SingleExpression:[1,266],SingleClassItem:[2,267]},dialects:{jsx:12686,ts:12688},dynamicPrecedences:{76:1,78:1,163:1,191:1},specialized:[{term:312,get:t=>Cf[t]||-1},{term:328,get:t=>_f[t]||-1},{term:67,get:t=>Xf[t]||-1}],tokenPrec:12712}),Af=[Dd("function ${name}(${params}) {\n\t${}\n}",{label:"function",detail:"definition",type:"keyword"}),Dd("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n\t${}\n}",{label:"for",detail:"loop",type:"keyword"}),Dd("for (let ${name} of ${collection}) {\n\t${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Dd("do {\n\t${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),Dd("while (${}) {\n\t${}\n}",{label:"while",detail:"loop",type:"keyword"}),Dd("try {\n\t${}\n} catch (${error}) {\n\t${}\n}",{label:"try",detail:"/ catch block",type:"keyword"}),Dd("if (${}) {\n\t${}\n}",{label:"if",detail:"block",type:"keyword"}),Dd("if (${}) {\n\t${}\n} else {\n\t${}\n}",{label:"if",detail:"/ else block",type:"keyword"}),Dd("class ${name} {\n\tconstructor(${params}) {\n\t\t${}\n\t}\n}",{label:"class",detail:"definition",type:"keyword"}),Dd('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Dd('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Tf=new Ro,Rf=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Ef(t){return(e,i)=>{let n=e.node.getChild("VariableDefinition");return n&&i(n,t),!0}}const Vf=["FunctionDeclaration"],Mf={FunctionDeclaration:Ef("function"),ClassDeclaration:Ef("class"),ClassExpression:()=>!0,EnumDeclaration:Ef("constant"),TypeAliasDeclaration:Ef("type"),NamespaceDeclaration:Ef("namespace"),VariableDefinition(t,e){t.matchContext(Vf)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function Df(t,e){let i=Tf.get(e);if(i)return i;let n=[],s=!0;function r(e,i){let s=t.sliceString(e.from,e.to);n.push({label:s,type:i})}return e.cursor(mo.IncludeAnonymous).iterate((e=>{if(s)s=!1;else if(e.name){let t=Mf[e.name];if(t&&t(e,r)||Rf.has(e.name))return!1}else if(e.to-e.from>8192){for(let i of Df(t,e.node))n.push(i);return!1}})),Tf.set(e,n),n}const Wf=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Uf=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName"];function Yf(t){let e=Xa(t.state).resolveInner(t.pos,-1);if(Uf.indexOf(e.name)>-1)return null;let i="VariableName"==e.name||e.to-e.from<20&&Wf.test(t.state.sliceDoc(e.from,e.to));if(!i&&!t.explicit)return null;let n=[];for(let i=e;i;i=i.parent)Rf.has(i.name)&&(n=n.concat(Df(t.state.doc,i)));return{options:n,from:i?e.from:t.pos,validFor:Wf}}const qf=_a.define({name:"javascript",parser:Zf.configure({props:[Na.add({IfStatement:il({except:/^\s*({|else\b)/}),TryStatement:il({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:t=>t.baseIndent,SwitchBody:t=>{let e=t.textAfter,i=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return t.baseIndent+(i?0:n?1:2)*t.unit},Block:tl({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":il({except:/^{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag":t=>t.column(t.node.from)+t.unit}),rl.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression":ol,BlockComment:t=>({from:t.from+2,to:t.to-2})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Lf={test:t=>/^JSX/.test(t.name),facet:Qa({commentTokens:{block:{open:"{/*",close:"*/}"}}})},zf=qf.configure({dialect:"ts"},"typescript"),If=qf.configure({dialect:"jsx",props:[$a.add((t=>t.isTop?[Lf]:void 0))]}),Bf=qf.configure({dialect:"jsx ts",props:[$a.add((t=>t.isTop?[Lf]:void 0))]},"typescript"),jf="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map((t=>({label:t,type:"keyword"})));function Nf(t={}){let e=t.jsx?t.typescript?Bf:If:t.typescript?zf:qf;return new Ua(e,[qf.data.of({autocomplete:(i=Uf,n=zu(Af.concat(jf)),t=>{for(let e=Xa(t.state).resolveInner(t.pos,-1);e;e=e.parent){if(i.indexOf(e.name)>-1)return null;if(e.type.isTop)break}return n(t)})}),qf.data.of({autocomplete:Yf}),t.jsx?Hf:[]]);var i,n}function Gf(t,e,i=t.length){for(let n=null==e?void 0:e.firstChild;n;n=n.nextSibling)if("JSXIdentifier"==n.name||"JSXBuiltin"==n.name||"JSXNamespacedName"==n.name||"JSXMemberExpression"==n.name)return t.sliceString(n.from,Math.min(n.to,i));return""}const Ff="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),Hf=Ts.inputHandler.of(((t,e,i,n)=>{if((Ff?t.composing:t.compositionStarted)||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!qf.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((t=>{var e,i;let r,{head:o}=t,a=Xa(s).resolveInner(o,-1);if("JSXStartTag"==a.name&&(a=a.parent),">"==n&&"JSXFragmentTag"==a.name)return{range:A.cursor(o+1),changes:{from:o,insert:">"}};if("/"==n&&"JSXFragmentTag"==a.name){let t=a.parent,i=null==t?void 0:t.parent;if(t.from==o-1&&"JSXEndTag"!=(null===(e=i.lastChild)||void 0===e?void 0:e.name)&&(r=Gf(s.doc,null==i?void 0:i.firstChild,o))){let t=`/${r}>`;return{range:A.cursor(o+t.length),changes:{from:o,insert:t}}}}else if(">"==n){let t=function(t){for(;;){if("JSXOpenTag"==t.name||"JSXSelfClosingTag"==t.name||"JSXFragmentTag"==t.name)return t;if(!t.parent)return null;t=t.parent}}(a);if(t&&"JSXEndTag"!=(null===(i=t.lastChild)||void 0===i?void 0:i.name)&&"`}}}return{range:t}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)}));class Jf{constructor(t,e,i,n,s,r,o){this.type=t,this.value=e,this.from=i,this.hash=n,this.end=s,this.children=r,this.positions=o,this.hashProp=[[ho.contextHash,n]]}static create(t,e,i,n,s){return new Jf(t,e,i,n+(n<<8)+t+(e<<4)|0,s,[],[])}addChild(t,e){t.prop(ho.contextHash)!=this.hash&&(t=new bo(t.type,t.children,t.positions,t.length,this.hashProp)),this.children.push(t),this.positions.push(e)}toTree(t,e=this.end){let i=this.children.length-1;return i>=0&&(e=Math.max(e,this.positions[i]+this.children[i].length+this.from)),new bo(t.types[this.type],this.children,this.positions,e-this.from).balance({makeTree:(t,e,i)=>new bo(fo.none,t,e,i,this.hashProp)})}}var Kf;!function(t){t[t.Document=1]="Document",t[t.CodeBlock=2]="CodeBlock",t[t.FencedCode=3]="FencedCode",t[t.Blockquote=4]="Blockquote",t[t.HorizontalRule=5]="HorizontalRule",t[t.BulletList=6]="BulletList",t[t.OrderedList=7]="OrderedList",t[t.ListItem=8]="ListItem",t[t.ATXHeading1=9]="ATXHeading1",t[t.ATXHeading2=10]="ATXHeading2",t[t.ATXHeading3=11]="ATXHeading3",t[t.ATXHeading4=12]="ATXHeading4",t[t.ATXHeading5=13]="ATXHeading5",t[t.ATXHeading6=14]="ATXHeading6",t[t.SetextHeading1=15]="SetextHeading1",t[t.SetextHeading2=16]="SetextHeading2",t[t.HTMLBlock=17]="HTMLBlock",t[t.LinkReference=18]="LinkReference",t[t.Paragraph=19]="Paragraph",t[t.CommentBlock=20]="CommentBlock",t[t.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",t[t.Escape=22]="Escape",t[t.Entity=23]="Entity",t[t.HardBreak=24]="HardBreak",t[t.Emphasis=25]="Emphasis",t[t.StrongEmphasis=26]="StrongEmphasis",t[t.Link=27]="Link",t[t.Image=28]="Image",t[t.InlineCode=29]="InlineCode",t[t.HTMLTag=30]="HTMLTag",t[t.Comment=31]="Comment",t[t.ProcessingInstruction=32]="ProcessingInstruction",t[t.URL=33]="URL",t[t.HeaderMark=34]="HeaderMark",t[t.QuoteMark=35]="QuoteMark",t[t.ListMark=36]="ListMark",t[t.LinkMark=37]="LinkMark",t[t.EmphasisMark=38]="EmphasisMark",t[t.CodeMark=39]="CodeMark",t[t.CodeText=40]="CodeText",t[t.CodeInfo=41]="CodeInfo",t[t.LinkTitle=42]="LinkTitle",t[t.LinkLabel=43]="LinkLabel"}(Kf||(Kf={}));class tp{constructor(t,e){this.start=t,this.content=e,this.marks=[],this.parsers=[]}}class ep{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let t=this.skipSpace(this.basePos);this.indent=this.countIndent(t,this.pos,this.indent),this.pos=t,this.next=t==this.text.length?-1:this.text.charCodeAt(t)}skipSpace(t){return rp(this.text,t)}reset(t){for(this.text=t,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(t){this.basePos=t,this.baseIndent=this.countIndent(t,this.pos,this.indent)}moveBaseColumn(t){this.baseIndent=t,this.basePos=this.findColumn(t)}addMarker(t){this.markers.push(t)}countIndent(t,e=0,i=0){for(let n=e;n=e.stack[i.depth+1].value+i.baseIndent)return!0;if(i.indent>=i.baseIndent+4)return!1;let n=(t.type==Kf.OrderedList?dp:up)(i,e,!1);return n>0&&(t.type!=Kf.BulletList||hp(i,e,!1)<0)&&i.text.charCodeAt(i.pos+n-1)==t.value}const np={[Kf.Blockquote]:(t,e,i)=>62==i.next&&(i.markers.push(Up(Kf.QuoteMark,e.lineStart+i.pos,e.lineStart+i.pos+1)),i.moveBase(i.pos+(sp(i.text.charCodeAt(i.pos+1))?2:1)),t.end=e.lineStart+i.text.length,!0),[Kf.ListItem]:(t,e,i)=>!(i.indent-1)&&(i.moveBaseColumn(i.baseIndent+t.value),!0),[Kf.OrderedList]:ip,[Kf.BulletList]:ip,[Kf.Document]:()=>!0};function sp(t){return 32==t||9==t||10==t||13==t}function rp(t,e=0){for(;ei&&sp(t.charCodeAt(e-1));)e--;return e}function ap(t){if(96!=t.next&&126!=t.next)return-1;let e=t.pos+1;for(;e-1&&t.depth==e.stack.length||n<3?-1:1}function cp(t,e){for(let i=t.stack.length-1;i>=0;i--)if(t.stack[i].type==e)return!0;return!1}function up(t,e,i){return 45!=t.next&&43!=t.next&&42!=t.next||t.pos!=t.text.length-1&&!sp(t.text.charCodeAt(t.pos+1))||!(!i||cp(e,Kf.BulletList)||t.skipSpace(t.pos+2)=48&&s<=57;){if(n++,n==t.text.length)return-1;s=t.text.charCodeAt(n)}return n==t.pos||n>t.pos+9||46!=s&&41!=s||nt.pos+1||49!=t.next)?-1:n+1-t.pos}function fp(t){if(35!=t.next)return-1;let e=t.pos+1;for(;e6?-1:i}function pp(t){if(45!=t.next&&61!=t.next||t.indent>=t.baseIndent+4)return-1;let e=t.pos+1;for(;e/,mp=/\?>/,bp=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*/i.exec(n);if(r)return t.append(Up(Kf.Comment,i,i+1+r[0].length));let o=/^\?[^]*?\?>/.exec(n);if(o)return t.append(Up(Kf.ProcessingInstruction,i,i+1+o[0].length));let a=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(n);return a?t.append(Up(Kf.HTMLTag,i,i+1+a[0].length)):-1},Emphasis(t,e,i){if(95!=e&&42!=e)return-1;let n=i+1;for(;t.char(n)==e;)n++;let s=t.slice(i-1,i),r=t.slice(n,n+1),o=jp.test(s),a=jp.test(r),l=/\s|^$/.test(s),h=/\s|^$/.test(r),c=!h&&(!a||l||o),u=!l&&(!o||h||a),d=c&&(42==e||!u||o),f=u&&(42==e||!c||a);return t.append(new Ip(95==e?Yp:qp,i,n,(d?1:0)|(f?2:0)))},HardBreak(t,e,i){if(92==e&&10==t.char(i+1))return t.append(Up(Kf.HardBreak,i,i+2));if(32==e){let e=i+1;for(;32==t.char(e);)e++;if(10==t.char(e)&&e>=i+2)return t.append(Up(Kf.HardBreak,i,e+1))}return-1},Link:(t,e,i)=>91==e?t.append(new Ip(Lp,i,i+1,1)):-1,Image:(t,e,i)=>33==e&&91==t.char(i+1)?t.append(new Ip(zp,i,i+2,1)):-1,LinkEnd(t,e,i){if(93!=e)return-1;for(let e=t.parts.length-1;e>=0;e--){let n=t.parts[e];if(n instanceof Ip&&(n.type==Lp||n.type==zp)){if(!n.side||t.skipSpace(n.to)==i&&!/[(\[]/.test(t.slice(i+1,i+2)))return t.parts[e]=null,-1;let s=t.takeContent(e),r=t.parts[e]=Gp(t,s,n.type==Lp?Kf.Link:Kf.Image,n.from,i+1);if(n.type==Lp)for(let i=0;ie?Up(Kf.URL,e+i,s+i):s==t.length&&null}}function Hp(t,e,i){let n=t.charCodeAt(e);if(39!=n&&34!=n&&40!=n)return!1;let s=40==n?41:n;for(let n=e+1,r=!1;n=this.end?-1:this.text.charCodeAt(t-this.offset)}get end(){return this.offset+this.text.length}slice(t,e){return this.text.slice(t-this.offset,e-this.offset)}append(t){return this.parts.push(t),t.to}addDelimiter(t,e,i,n,s){return this.append(new Ip(t,e,i,(n?1:0)|(s?2:0)))}addElement(t){return this.append(t)}resolveMarkers(t){for(let e=t;e=t;o--){let t=this.parts[o];if(t instanceof Ip&&1&t.side&&t.type==i.type&&!(s&&(1&i.side||2&t.side)&&(t.to-t.from+r)%3==0&&((t.to-t.from)%3||r%3))){n=t;break}}if(!n)continue;let a=i.type.resolve,l=[],h=n.from,c=i.to;if(s){let t=Math.min(2,n.to-n.from,r);h=n.to-t,c=i.from+t,a=1==t?"Emphasis":"StrongEmphasis"}n.type.mark&&l.push(this.elt(n.type.mark,h,n.to));for(let t=o+1;t=0;e--){let i=this.parts[e];if(i instanceof Ip&&i.type==t)return e}return null}takeContent(t){let e=this.resolveMarkers(t);return this.parts.length=t,e}skipSpace(t){return rp(this.text,t-this.offset)+this.offset}elt(t,e,i,n){return"string"==typeof t?Up(this.parser.getNodeType(t),e,i,n):new Wp(t,e)}}function tO(t,e){if(!e.length)return t;if(!t.length)return e;let i=t.slice(),n=0;for(let t of e){for(;n(t?t-1:0))return!1;if(this.fragmentEnd<0){let t=this.fragment.to;for(;t>0&&"\n"!=this.input.read(t-1,t);)t--;this.fragmentEnd=t?t-1:0}let i=this.cursor;i||(i=this.cursor=this.fragment.tree.cursor(),i.firstChild());let n=t+this.fragment.offset;for(;i.to<=n;)if(!i.parent())return!1;for(;;){if(i.from>=n)return this.fragment.from<=e;if(!i.childAfter(n))return!1}}matches(t){let e=this.cursor.tree;return e&&e.prop(ho.contextHash)==t}takeNodes(t){let e=this.cursor,i=this.fragment.offset,n=this.fragmentEnd-(this.fragment.openEnd?1:0),s=t.absoluteLineStart,r=s,o=t.block.children.length,a=r,l=o;for(;;){if(e.to-i>n){if(e.type.isAnonymous&&e.firstChild())continue;break}if(t.dontInject.add(e.tree),t.addNode(e.tree,e.from-i),e.type.is("Block")&&(eO.indexOf(e.type.id)<0?(r=e.to-i,o=t.block.children.length):(r=a,o=l,a=e.to-i,l=t.block.children.length)),!e.nextSibling())break}for(;t.block.children.length>o;)t.block.children.pop(),t.block.positions.pop();return r-s}}const nO=ea({"Blockquote/...":Sa.quote,HorizontalRule:Sa.contentSeparator,"ATXHeading1/... SetextHeading1/...":Sa.heading1,"ATXHeading2/... SetextHeading2/...":Sa.heading2,"ATXHeading3/...":Sa.heading3,"ATXHeading4/...":Sa.heading4,"ATXHeading5/...":Sa.heading5,"ATXHeading6/...":Sa.heading6,"Comment CommentBlock":Sa.comment,Escape:Sa.escape,Entity:Sa.character,"Emphasis/...":Sa.emphasis,"StrongEmphasis/...":Sa.strong,"Link/... Image/...":Sa.link,"OrderedList/... BulletList/...":Sa.list,"BlockQuote/...":Sa.quote,"InlineCode CodeText":Sa.monospace,URL:Sa.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":Sa.processingInstruction,"CodeInfo LinkLabel":Sa.labelName,LinkTitle:Sa.string,Paragraph:Sa.content}),sO=new Zp(new po(Ep).extend(nO),Object.keys(Sp).map((t=>Sp[t])),Object.keys(Sp).map((t=>$p[t])),Object.keys(Sp),Pp,np,Object.keys(Np).map((t=>Np[t])),Object.keys(Np),[]);function rO(t,e,i){let n=[];for(let s=t.firstChild,r=e;;s=s.nextSibling){let t=s?s.from:i;if(t>r&&n.push({from:r,to:t}),!s)break;r=s.to}return n}const oO={resolve:"Strikethrough",mark:"StrikethroughMark"},aO={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":Sa.strikethrough}},{name:"StrikethroughMark",style:Sa.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,i){if(126!=e||126!=t.char(i+1)||126==t.char(i+2))return-1;let n=t.slice(i-1,i),s=t.slice(i+2,i+3),r=/\s|^$/.test(n),o=/\s|^$/.test(s),a=jp.test(n),l=jp.test(s);return t.addDelimiter(oO,i,i+2,!o&&(!l||r||a),!r&&(!a||o||l))},after:"Emphasis"}]};function lO(t,e,i=0,n,s=0){let r=0,o=!0,a=-1,l=-1,h=!1,c=()=>{n.push(t.elt("TableCell",s+a,s+l,t.parser.parseInline(e.slice(a,l),s+a)))};for(let u=i;u-1)&&r++,o=!1,n&&(a>-1&&c(),n.push(t.elt("TableDelimiter",u+s,u+s+1))),a=l=-1),h=!h&&92==i}return a>-1&&(r++,n&&c()),r}function hO(t,e){for(let i=e;ihO(e.content,0)?new uO:null,endLeaf(t,e,i){if(i.parsers.some((t=>t instanceof uO))||!hO(e.text,e.basePos))return!1;let n=t.scanLine(t.absoluteLineEnd+1).text;return cO.test(n)&&lO(t,e.text,e.basePos)==lO(t,n,e.basePos)},before:"SetextHeading"}]};class fO{nextLine(){return!1}finish(t,e){return t.addLeafElement(e,t.elt("Task",e.start,e.start+e.content.length,[t.elt("TaskMarker",e.start,e.start+3),...t.parser.parseInline(e.content.slice(3),e.start+3)])),!0}}const pO=[dO,{defineNodes:[{name:"Task",block:!0,style:Sa.list},{name:"TaskMarker",style:Sa.atom}],parseBlock:[{name:"TaskList",leaf:(t,e)=>/^\[[ xX]\]/.test(e.content)&&"ListItem"==t.parentType().name?new fO:null,after:"SetextHeading"}]},aO];function OO(t,e,i){return(n,s,r)=>{if(s!=t||n.char(r+1)==t)return-1;let o=[n.elt(i,r,r+1)];for(let s=r+1;s=65&&r<=90||95==r||r>=97&&r<=122||r>=161;)s+=String.fromCharCode(n),n=t.peek(++e);var r;return RO=t,EO=i,TO=s?s.toLowerCase():n==MO||n==DO?void 0:null}const MO=63,DO=33;function WO(t,e){this.name=t,this.parent=e,this.hash=e?e.hash:0;for(let e=0;eUO.indexOf(e)>-1?new WO(VO(n,1)||"",t):t,reduce:(t,e)=>e==wO&&t?t.parent:t,reuse(t,e,i,n){let s=e.type.id;return 6==s||36==s?new WO(VO(n,1)||"",t):t},hash:t=>t?t.hash:0,strict:!1}),qO=new nf(((t,e)=>{if(60!=t.next)return void(t.next<0&&e.context&&t.acceptToken(57));t.advance();let i=47==t.next;i&&t.advance();let n=VO(t,0);if(void 0===n)return;if(!n)return t.acceptToken(i?14:6);let s=e.context?e.context.name:null;if(i){if(n==s)return t.acceptToken(11);if(s&&XO[s])return t.acceptToken(57,-2);if(e.dialectEnabled(0))return t.acceptToken(12);for(let t=e.context;t;t=t.parent)if(t.name==n)return;t.acceptToken(13)}else{if("script"==n)return t.acceptToken(7);if("style"==n)return t.acceptToken(8);if("textarea"==n)return t.acceptToken(9);if(_O.hasOwnProperty(n))return t.acceptToken(10);s&&ZO[s]&&ZO[s][n]?t.acceptToken(57,-1):t.acceptToken(6)}}),{contextual:!0}),LO=new nf((t=>{for(let e=0,i=0;;i++){if(t.next<0){i&&t.acceptToken(58);break}if(45==t.next)e++;else{if(62==t.next&&e>=2){i>3&&t.acceptToken(58,-2);break}e=0}t.advance()}}));const zO=new nf(((t,e)=>{if(47==t.next&&62==t.peek(1)){let i=e.dialectEnabled(1)||function(t){for(;t;t=t.parent)if("svg"==t.name||"math"==t.name)return!0;return!1}(e.context);t.acceptToken(i?5:4,2)}else 62==t.next&&t.acceptToken(4,1)}));function IO(t,e,i){let n=2+t.length;return new nf((s=>{for(let r=0,o=0,a=0;;a++){if(s.next<0){a&&s.acceptToken(e);break}if(0==r&&60==s.next||1==r&&47==s.next||r>=2&&ro?s.acceptToken(e,-o):s.acceptToken(i,-(o-2));break}if((10==s.next||13==s.next)&&a){s.acceptToken(e,1);break}r=o=0}else o++;s.advance()}}))}const BO=IO("script",54,1),jO=IO("style",55,2),NO=IO("textarea",56,3),GO=ea({"Text RawText":Sa.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":Sa.angleBracket,TagName:Sa.tagName,"MismatchedCloseTag/TagName":[Sa.tagName,Sa.invalid],AttributeName:Sa.attributeName,"AttributeValue UnquotedAttributeValue":Sa.attributeValue,Is:Sa.definitionOperator,"EntityReference CharacterReference":Sa.character,Comment:Sa.blockComment,ProcessingInst:Sa.processingInstruction,DoctypeDecl:Sa.documentMeta}),FO=wf.deserialize({version:14,states:",xOVO!rOOO!WQ#tO'#CqO!]Q#tO'#CzO!bQ#tO'#C}O!gQ#tO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`^Oa^Ob^Oc^Ox^O{_O!dZO~OfaO~OfbO~OfcO~OfdO~OfeO~O!WfOPlP!ZlP~O!XiOQoP!ZoP~O!YlORrP!ZrP~OUSOVPOWQOXROYTOZqO[]O][O^^O`^Oa^Ob^Oc^Ox^O!dZO~O!ZrO~P#dO![sO!euO~OfvO~OfwO~OS|OhyO~OS!OOhyO~OS!QOhyO~OS!SOT!TOhyO~OS!TOhyO~O!WfOPlX!ZlX~OP!WO!Z!XO~O!XiOQoX!ZoX~OQ!ZO!Z!XO~O!YlORrX!ZrX~OR!]O!Z!XO~O!Z!XO~P#dOf!_O~O![sO!e!aO~OS!bO~OS!cO~Oi!dOSgXhgXTgX~OS!fOhyO~OS!gOhyO~OS!hOhyO~OS!iOT!jOhyO~OS!jOhyO~Of!kO~Of!lO~Of!mO~OS!nO~Ok!qO!`!oO!b!pO~OS!rO~OS!sO~OS!tO~Oa!uOb!uOc!uO!`!wO!a!uO~Oa!xOb!xOc!xO!b!wO!c!xO~Oa!uOb!uOc!uO!`!{O!a!uO~Oa!xOb!xOc!xO!b!{O!c!xO~OT~bac!dx{!d~",goto:"%p!`PPPPPPPPPPPPPPPPPPPP!a!gP!mPP!yP!|#P#S#Y#]#`#f#i#l#r#x!aP!a!aP$O$U$l$r$x%O%U%[%bPPPPPPPP%hX^OX`pXUOX`pezabcde{}!P!R!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ}bQ!PcQ!RdQ!UeZ!e{}!P!R!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:67,context:YO,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,21,30,33,36,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,29,32,35,37,"OpenTag"],["group",-9,14,17,18,19,20,39,40,41,42,"Entity",16,"Entity TextContent",-3,28,31,34,"TextContent Entity"]],propSources:[GO],skippedNodes:[0],repeatNodeCount:9,tokenData:"#%g!aR!YOX$qXY,QYZ,QZ[$q[]&X]^,Q^p$qpq,Qqr-_rs4ysv-_vw5iwxJ^x}-_}!OKP!O!P-_!P!Q$q!Q![-_![!]!!O!]!^-_!^!_!&W!_!`#$o!`!a&X!a!c-_!c!}!!O!}#R-_#R#S!!O#S#T3V#T#o!!O#o#s-_#s$f$q$f%W-_%W%o!!O%o%p-_%p&a!!O&a&b-_&b1p!!O1p4U-_4U4d!!O4d4e-_4e$IS!!O$IS$I`-_$I`$Ib!!O$Ib$Kh-_$Kh%#t!!O%#t&/x-_&/x&Et!!O&Et&FV-_&FV;'S!!O;'S;:j!&Q;:j;=`4s<%l?&r-_?&r?Ah!!O?Ah?BY$q?BY?Mn!!O?MnO$q!Z$|c`PkW!a`!cpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr$qrs&}sv$qvw+Pwx(tx!^$q!^!_*V!_!a&X!a#S$q#S#T&X#T;'S$q;'S;=`+z<%lO$q!R&bX`P!a`!cpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&Xq'UV`P!cpOv&}wx'kx!^&}!^!_(V!_;'S&};'S;=`(n<%lO&}P'pT`POv'kw!^'k!_;'S'k;'S;=`(P<%lO'kP(SP;=`<%l'kp([S!cpOv(Vx;'S(V;'S;=`(h<%lO(Vp(kP;=`<%l(Vq(qP;=`<%l&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jva!LaT!a`xPOr)esv)ew;'S)e;'S;=`)y<%lO)ea!LsP;=`<%l!Jv!R!L}Y!a`!cpOr!G_rs!HUsv!G_vw!Hpwx!Jvx!`!G_!`!a!Mm!a;'S!G_;'S;=`!N]<%lO!G_!R!MvV!a`!cpxPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!N`P;=`<%l!G_T!NhbhSOq!Hpqr!Ncrs!Hpsw!Ncwx!Hpx!P!Nc!P!Q!Hp!Q!_!Nc!_!a!Hp!a!b# p!b#s!Nc#s$f!Hp$f;'S!Nc;'S;=`#!}<%l?Ah!Nc?Ah?BY!Hp?BY?Mn!Nc?MnO!HpT# ubhSOq!Hpqr!Ncrs!Hpsw!Ncwx!Hpx!P!Nc!P!Q!Hp!Q!_!Nc!_!`!Hp!`!a!If!a#s!Nc#s$f!Hp$f;'S!Nc;'S;=`#!}<%l?Ah!Nc?Ah?BY!Hp?BY?Mn!Nc?MnO!HpT##QP;=`<%l!Nc!V##^chS!a`!cpOq!G_qr!Eyrs!HUsv!Eyvw!Ncwx!Jvx!P!Ey!P!Q!G_!Q!_!Ey!_!`!G_!`!a!Mm!a#s!Ey#s$f!G_$f;'S!Ey;'S;=`#$i<%l?Ah!Ey?Ah?BY!G_?BY?Mn!Ey?MnO!G_!V#$lP;=`<%l!Ey!V#$zXiS`P!a`!cpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X",tokenizers:[BO,jO,NO,zO,qO,LO,0,1,2,3,4,5],topRules:{Document:[0,15]},dialects:{noMatch:0,selfClosing:485},tokenPrec:487});function HO(t,e){let i=Object.create(null);for(let n of t.getChildren(yO)){let t=n.getChild(SO),s=n.getChild(xO)||n.getChild(kO);t&&(i[e.read(t.from,t.to)]=s?s.type.id==xO?e.read(s.from+1,s.to-1):e.read(s.from,s.to):"")}return i}function JO(t,e){let i=t.getChild(vO);return i?e.read(i.from,i.to):" "}function KO(t,e,i){let n;for(let s of i)if(!s.attrs||s.attrs(n||(n=HO(t.node.parent.firstChild,e))))return{parser:s.parser};return null}function tg(t=[],e=[]){let i=[],n=[],s=[],r=[];for(let e of t){("script"==e.tag?i:"style"==e.tag?n:"textarea"==e.tag?s:r).push(e)}let o=e.length?Object.create(null):null;for(let t of e)(o[t.name]||(o[t.name]=[])).push(t);return Do(((t,e)=>{let a=t.type.id;if(a==QO)return KO(t,e,i);if(a==$O)return KO(t,e,n);if(a==PO)return KO(t,e,s);if(a==wO&&r.length){let i,n=t.node,s=n.firstChild,o=s&&JO(s,e);if(o)for(let t of r)if(t.tag==o&&(!t.attrs||t.attrs(i||(i=HO(n,e))))){let e=n.lastChild;return{parser:t.parser,overlay:[{from:s.to,to:e.type.id==CO?e.from:n.to}]}}}if(o&&a==yO){let i,n=t.node;if(i=n.firstChild){let t=o[e.read(i.from,i.to)];if(t)for(let i of t){if(i.tagName&&i.tagName!=JO(n.parent,e))continue;let t=n.lastChild;if(t.type.id==xO){let e=t.from+1,n=t.lastChild,s=t.to-(n&&n.isError?0:1);if(s>e)return{parser:i.parser,overlay:[{from:e,to:s}]}}else if(t.type.id==kO)return{parser:i.parser,overlay:[{from:t.from,to:t.to}]}}}}return null}))}const eg=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288];function ig(t){return t>=65&&t<=90||t>=97&&t<=122||t>=161}const ng=new nf(((t,e)=>{for(let n=!1,s=0,r=0;;r++){let{next:o}=t;if(!(ig(o)||45==o||95==o||n&&(i=o,i>=48&&i<=57))){n&&t.acceptToken(40==o?95:2==s&&e.canShift(2)?2:96);break}!n&&(45!=o||r>0)&&(n=!0),s===r&&45==o&&s++,t.advance()}var i})),sg=new nf((t=>{if(eg.includes(t.peek(-1))){let{next:e}=t;(ig(e)||95==e||35==e||46==e||91==e||58==e||45==e)&&t.acceptToken(94)}})),rg=new nf((t=>{if(!eg.includes(t.peek(-1))){let{next:e}=t;if(37==e&&(t.advance(),t.acceptToken(1)),ig(e)){do{t.advance()}while(ig(t.next));t.acceptToken(1)}}})),og=ea({"AtKeyword import charset namespace keyframes media supports":Sa.definitionKeyword,"from to selector":Sa.keyword,NamespaceName:Sa.namespace,KeyframeName:Sa.labelName,TagName:Sa.tagName,ClassName:Sa.className,PseudoClassName:Sa.constant(Sa.className),IdName:Sa.labelName,"FeatureName PropertyName":Sa.propertyName,AttributeName:Sa.attributeName,NumberLiteral:Sa.number,KeywordQuery:Sa.keyword,UnaryQueryOp:Sa.operatorKeyword,"CallTag ValueName":Sa.atom,VariableName:Sa.variableName,Callee:Sa.operatorKeyword,Unit:Sa.unit,"UniversalSelector NestingSelector":Sa.definitionOperator,MatchOp:Sa.compareOperator,"ChildOp SiblingOp, LogicOp":Sa.logicOperator,BinOp:Sa.arithmeticOperator,Important:Sa.modifier,Comment:Sa.blockComment,ParenthesizedContent:Sa.special(Sa.name),ColorLiteral:Sa.color,StringLiteral:Sa.string,":":Sa.punctuation,"PseudoOp #":Sa.derefOperator,"; ,":Sa.separator,"( )":Sa.paren,"[ ]":Sa.squareBracket,"{ }":Sa.brace}),ag={__proto__:null,lang:32,"nth-child":32,"nth-last-child":32,"nth-of-type":32,"nth-last-of-type":32,dir:32,"host-context":32,url:60,"url-prefix":60,domain:60,regexp:60,selector:134},lg={__proto__:null,"@import":114,"@media":138,"@charset":142,"@namespace":146,"@keyframes":152,"@supports":164},hg={__proto__:null,not:128,only:128,from:158,to:160},cg=wf.deserialize({version:14,states:"7WQYQ[OOO#_Q[OOOOQP'#Cd'#CdOOQP'#Cc'#CcO#fQ[O'#CfO$YQXO'#CaO$aQ[O'#ChO$lQ[O'#DPO$qQ[O'#DTOOQP'#Ed'#EdO$vQdO'#DeO%bQ[O'#DrO$vQdO'#DtO%sQ[O'#DvO&OQ[O'#DyO&TQ[O'#EPO&cQ[O'#EROOQS'#Ec'#EcOOQS'#ET'#ETQYQ[OOO&jQXO'#CdO'_QWO'#DaO'dQWO'#EjO'oQ[O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XDuU]POy%^z![%^![!]EX!];'S%^;'S;=`%o<%lO%^XE`S^PoWOy%^z;'S%^;'S;=`%o<%lO%^_EqS!WVOy%^z;'S%^;'S;=`%o<%lO%^YFSSzQOy%^z;'S%^;'S;=`%o<%lO%^XFeU|POy%^z!`%^!`!aFw!a;'S%^;'S;=`%o<%lO%^XGOS|PoWOy%^z;'S%^;'S;=`%o<%lO%^XG_WOy%^z!c%^!c!}Gw!}#T%^#T#oGw#o;'S%^;'S;=`%o<%lO%^XHO[!YPoWOy%^z}%^}!OGw!O!Q%^!Q![Gw![!c%^!c!}Gw!}#T%^#T#oGw#o;'S%^;'S;=`%o<%lO%^XHySxPOy%^z;'S%^;'S;=`%o<%lO%^^I[SvUOy%^z;'S%^;'S;=`%o<%lO%^XIkUOy%^z#b%^#b#cI}#c;'S%^;'S;=`%o<%lO%^XJSUoWOy%^z#W%^#W#XJf#X;'S%^;'S;=`%o<%lO%^XJmS!`PoWOy%^z;'S%^;'S;=`%o<%lO%^XJ|UOy%^z#f%^#f#gJf#g;'S%^;'S;=`%o<%lO%^XKeS!RPOy%^z;'S%^;'S;=`%o<%lO%^_KvS!QVOy%^z;'S%^;'S;=`%o<%lO%^ZLXU!PPOy%^z!_%^!_!`6y!`;'S%^;'S;=`%o<%lO%^WLnP;=`<%l$}",tokenizers:[sg,rg,ng,0,1,2,3],topRules:{StyleSheet:[0,4],Styles:[1,84]},specialized:[{term:95,get:t=>ag[t]||-1},{term:56,get:t=>lg[t]||-1},{term:96,get:t=>hg[t]||-1}],tokenPrec:1123});let ug=null;function dg(){if(!ug&&"object"==typeof document&&document.body){let{style:t}=document.body,e=[],i=new Set;for(let n in t)"cssText"!=n&&"cssFloat"!=n&&"string"==typeof t[n]&&(/[A-Z]/.test(n)&&(n=n.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))),i.has(n)||(e.push(n),i.add(n)));ug=e.sort().map((t=>({type:"property",label:t})))}return ug||[]}const fg=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map((t=>({type:"class",label:t}))),pg=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map((t=>({type:"keyword",label:t}))).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map((t=>({type:"constant",label:t})))),Og=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map((t=>({type:"type",label:t}))),gg=/^(\w[\w-]*|-\w[\w-]*|)$/,mg=/^-(-[\w-]*)?$/;const bg=new Ro,wg=["Declaration"];function vg(t){for(let e=t;;){if(e.type.isTop)return e;if(!(e=e.parent))return t}}function yg(t,e,i){if(e.to-e.from>4096){let n=bg.get(e);if(n)return n;let s=[],r=new Set,o=e.cursor(mo.IncludeAnonymous);if(o.firstChild())do{for(let e of yg(t,o.node,i))r.has(e.label)||(r.add(e.label),s.push(e))}while(o.nextSibling());return bg.set(e,s),s}{let n=[],s=new Set;return e.cursor().iterate((e=>{var r;if(i(e)&&e.matchContext(wg)&&":"==(null===(r=e.node.nextSibling)||void 0===r?void 0:r.name)){let i=t.sliceString(e.from,e.to);s.has(i)||(s.add(i),n.push({label:i,type:"variable"}))}})),n}}const Sg=t=>e=>{let{state:i,pos:n}=e,s=Xa(i).resolveInner(n,-1),r=s.type.isError&&s.from==s.to-1&&"-"==i.doc.sliceString(s.from,s.to);if("PropertyName"==s.name||(r||"TagName"==s.name)&&/^(Block|Styles)$/.test(s.resolve(s.to).name))return{from:s.from,options:dg(),validFor:gg};if("ValueName"==s.name)return{from:s.from,options:pg,validFor:gg};if("PseudoClassName"==s.name)return{from:s.from,options:fg,validFor:gg};if(t(s)||(e.explicit||r)&&function(t,e){var i;if(("("==t.name||t.type.isError)&&(t=t.parent||t),"ArgList"!=t.name)return!1;let n=null===(i=t.parent)||void 0===i?void 0:i.firstChild;return"Callee"==(null==n?void 0:n.name)&&"var"==e.sliceString(n.from,n.to)}(s,i.doc))return{from:t(s)||r?s.from:n,options:yg(i.doc,vg(s),t),validFor:mg};if("TagName"==s.name){for(let{parent:t}=s;t;t=t.parent)if("Block"==t.name)return{from:s.from,options:dg(),validFor:gg};return{from:s.from,options:Og,validFor:gg}}if(!e.explicit)return null;let o=s.resolve(n),a=o.childBefore(n);return a&&":"==a.name&&"PseudoClassSelector"==o.name?{from:n,options:fg,validFor:gg}:a&&":"==a.name&&"Declaration"==o.name||"ArgList"==o.name?{from:n,options:pg,validFor:gg}:"Block"==o.name||"Styles"==o.name?{from:n,options:dg(),validFor:gg}:null},xg=Sg((t=>"VariableName"==t.name)),kg=_a.define({name:"css",parser:cg.configure({props:[Na.add({Declaration:il()}),rl.add({"Block KeyframeList":ol})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function Qg(){return new Ua(kg,kg.data.of({autocomplete:xg}))}const $g=["_blank","_self","_top","_parent"],Pg=["ascii","utf-8","utf-16","latin1","latin1"],Cg=["get","post","put","delete"],_g=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Xg=["true","false"],Zg={},Ag={a:{attrs:{href:null,ping:null,type:null,media:null,target:$g,hreflang:null}},abbr:Zg,address:Zg,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Zg,aside:Zg,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Zg,base:{attrs:{href:null,target:$g}},bdi:Zg,bdo:Zg,blockquote:{attrs:{cite:null}},body:Zg,br:Zg,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Zg,center:Zg,cite:Zg,code:Zg,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:Zg,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Zg,div:Zg,dl:Zg,dt:Zg,em:Zg,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Zg,figure:Zg,footer:Zg,form:{attrs:{action:null,name:null,"accept-charset":Pg,autocomplete:["on","off"],enctype:_g,method:Cg,novalidate:["novalidate"],target:$g}},h1:Zg,h2:Zg,h3:Zg,h4:Zg,h5:Zg,h6:Zg,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Zg,hgroup:Zg,hr:Zg,html:{attrs:{manifest:null}},i:Zg,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:Zg,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Zg,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:Zg,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Pg,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:Zg,noscript:Zg,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:Zg,param:{attrs:{name:null,value:null}},pre:Zg,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Zg,rt:Zg,ruby:Zg,samp:Zg,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Pg}},section:Zg,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Zg,source:{attrs:{src:null,type:null,media:null}},span:Zg,strong:Zg,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Zg,summary:Zg,sup:Zg,table:Zg,tbody:Zg,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Zg,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:Zg,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Zg,time:{attrs:{datetime:null}},title:Zg,tr:Zg,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Zg,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:Zg},Tg={accesskey:null,class:null,contenteditable:Xg,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Xg,autocorrect:Xg,autocapitalize:Xg,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Xg,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Xg,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Xg,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Xg,"aria-hidden":Xg,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Xg,"aria-multiselectable":Xg,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Xg,"aria-relevant":null,"aria-required":Xg,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},Rg="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map((t=>"on"+t));for(let t of Rg)Tg[t]=null;class Eg{constructor(t,e){this.tags=Object.assign(Object.assign({},Ag),t),this.globalAttrs=Object.assign(Object.assign({},Tg),e),this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}function Vg(t,e,i=t.length){if(!e)return"";let n=e.firstChild,s=n&&n.getChild("TagName");return s?t.sliceString(s.from,Math.min(s.to,i)):""}function Mg(t,e=!1){for(let i=t.parent;i;i=i.parent)if("Element"==i.name){if(!e)return i;e=!1}return null}function Dg(t,e,i){let n=i.tags[Vg(t,Mg(e,!0))];return(null==n?void 0:n.children)||i.allTags}function Wg(t,e){let i=[];for(let n=e;n=Mg(n);){let s=Vg(t,n);if(s&&"CloseTag"==n.lastChild.name)break;s&&i.indexOf(s)<0&&("EndTag"==e.name||e.from>=n.firstChild.to)&&i.push(s)}return i}Eg.default=new Eg;const Ug=/^[:\-\.\w\u00b7-\uffff]*$/;function Yg(t,e,i,n,s){let r=/\s*>/.test(t.sliceDoc(s,s+5))?"":">";return{from:n,to:s,options:Dg(t.doc,i,e).map((t=>({label:t,type:"type"}))).concat(Wg(t.doc,i).map(((t,e)=>({label:"/"+t,apply:"/"+t+r,type:"type",boost:99-e})))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function qg(t,e,i,n){let s=/\s*>/.test(t.sliceDoc(n,n+5))?"":">";return{from:i,to:n,options:Wg(t.doc,e).map(((t,e)=>({label:t,apply:t+s,type:"type",boost:99-e}))),validFor:Ug}}function Lg(t,e){let{state:i,pos:n}=e,s=Xa(i).resolveInner(n),r=s.resolve(n,-1);for(let t,e=n;s==r&&(t=r.childBefore(e));){let i=t.lastChild;if(!i||!i.type.isError||i.from({label:t,type:"property"}))),validFor:Ug}}(i,t,r,"AttributeName"==r.name?r.from:n,n):"Is"==r.name||"AttributeValue"==r.name||"UnquotedAttributeValue"==r.name?function(t,e,i,n,s){var r;let o,a=null===(r=i.parent)||void 0===r?void 0:r.getChild("AttributeName"),l=[];if(a){let r=t.sliceDoc(a.from,a.to),h=e.globalAttrs[r];if(!h){let n=Mg(i),s=n?e.tags[Vg(t.doc,n)]:null;h=(null==s?void 0:s.attrs)&&s.attrs[r]}if(h){let e=t.sliceDoc(n,s).toLowerCase(),i='"',r='"';/^['"]/.test(e)?(o='"'==e[0]?/^[^"]*$/:/^[^']*$/,i="",r=t.sliceDoc(s,s+1)==e[0]?"":e[0],e=e.slice(1),n++):o=/^[^\s<>='"]*$/;for(let t of h)l.push({label:t,apply:i+t+r,type:"constant"})}}return{from:n,to:s,options:l,validFor:o}}(i,t,r,"Is"==r.name?n:r.from,n):!e.explicit||"Element"!=s.name&&"Text"!=s.name&&"Document"!=s.name?null:function(t,e,i,n){let s=[],r=0;for(let n of Dg(t.doc,i,e))s.push({label:"<"+n,type:"type"});for(let e of Wg(t.doc,i))s.push({label:"",type:"type",boost:99-r++});return{from:n,to:n,options:s,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}(i,t,r,n)}function zg(t){let{extraTags:e,extraGlobalAttributes:i}=t,n=i||e?new Eg(e,i):Eg.default;return t=>Lg(n,t)}const Ig=[{tag:"script",attrs:t=>"text/typescript"==t.type||"ts"==t.lang,parser:zf.parser},{tag:"script",attrs:t=>"text/babel"==t.type||"text/jsx"==t.type,parser:If.parser},{tag:"script",attrs:t=>"text/typescript-jsx"==t.type,parser:Bf.parser},{tag:"script",attrs:t=>!t.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(t.type),parser:qf.parser},{tag:"style",attrs:t=>(!t.lang||"css"==t.lang)&&(!t.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(t.type)),parser:kg.parser}],Bg=[{name:"style",parser:kg.parser.configure({top:"Styles"})}].concat(Rg.map((t=>({name:t,parser:qf.parser})))),jg=_a.define({name:"html",parser:FO.configure({props:[Na.add({Element(t){let e=/^(\s*)(<\/)?/.exec(t.textAfter);return t.node.to<=t.pos+e[0].length?t.continue():t.lineIndent(t.node.from)+(e[2]?0:t.unit)},"OpenTag CloseTag SelfClosingTag":t=>t.column(t.node.from)+t.unit,Document(t){if(t.pos+/\s*/.exec(t.textAfter)[0].lengtht.getChild("TagName")})],wrap:tg(Ig,Bg)}),languageData:{commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-._"}});function Ng(t={}){let e,i="";!1===t.matchClosingTags&&(i="noMatch"),!0===t.selfClosingTags&&(i=(i?i+" ":"")+"selfClosing"),(t.nestedLanguages&&t.nestedLanguages.length||t.nestedAttributes&&t.nestedAttributes.length)&&(e=tg((t.nestedLanguages||[]).concat(Ig),(t.nestedAttributes||[]).concat(Bg)));let n=e||i?jg.configure({dialect:i,wrap:e}):jg;return new Ua(n,[jg.data.of({autocomplete:zg(t)}),!1!==t.autoCloseTags?Fg:[],Nf().support,Qg().support])}const Gg=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),Fg=Ts.inputHandler.of(((t,e,i,n)=>{if(t.composing||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!jg.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((e=>{var i,r,o;let a,{head:l}=e,h=Xa(s).resolveInner(l,-1);if("TagName"!=h.name&&"StartTag"!=h.name||(h=h.parent),">"==n&&"OpenTag"==h.name){if("CloseTag"!=(null===(r=null===(i=h.parent)||void 0===i?void 0:i.lastChild)||void 0===r?void 0:r.name)&&(a=Vg(s.doc,h.parent,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`${e?"":">"}`;return{range:A.cursor(l+1),changes:{from:l+(e?1:0),insert:i}}}}else if("/"==n&&"OpenTag"==h.name){let e=h.parent,i=null==e?void 0:e.parent;if(e.from==l-1&&"CloseTag"!=(null===(o=i.lastChild)||void 0===o?void 0:o.name)&&(a=Vg(s.doc,i,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`/${a}${e?"":">"}`,n=l+i.length+(e?1:0);return{range:A.cursor(n),changes:{from:l,insert:i}}}}return{range:e}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)})),Hg=Qa({commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}}}),Jg=new ho,Kg=sO.configure({props:[rl.add((t=>!t.is("Block")||t.is("Document")||null!=tm(t)?void 0:(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to}))),Jg.add(tm),Na.add({Document:()=>null}),ka.add({Document:Hg})]});function tm(t){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(t.name);return e?+e[1]:void 0}function em(t,e){let i=t;for(;;){let t,n=i.nextSibling;if(!n||null!=(t=tm(n.type))&&t<=e)break;i=n}return i.to}const im=sl.of(((t,e,i)=>{for(let n=Xa(t).resolveInner(i,-1);n&&!(n.fromi)return{from:i,to:e}}return null}));function nm(t){return new Pa(Hg,t,[im],"markdown")}const sm=nm(Kg),rm=nm(Kg.configure([pO,mO,gO,bO]));class om{constructor(t,e,i,n,s,r,o){this.node=t,this.from=e,this.to=i,this.spaceBefore=n,this.spaceAfter=s,this.type=r,this.item=o}blank(t,e=!0){let i=this.spaceBefore+("Blockquote"==this.node.name?">":"");if(null!=t){for(;i.length0;t--)i+=" ";return i+(e?this.spaceAfter:"")}marker(t,e){let i="OrderedList"==this.node.name?String(+lm(this.item,t)[2]+e):"";return this.spaceBefore+i+this.type+this.spaceAfter}}function am(t,e){let i=[];for(let e=t;e&&"Document"!=e.name;e=e.parent)"ListItem"!=e.name&&"Blockquote"!=e.name&&"FencedCode"!=e.name||i.push(e);let n=[];for(let t=i.length-1;t>=0;t--){let s,r=i[t],o=e.lineAt(r.from),a=r.from-o.from;if("FencedCode"==r.name)n.push(new om(r,a,a,"","","",null));else if("Blockquote"==r.name&&(s=/^[ \t]*>( ?)/.exec(o.text.slice(a))))n.push(new om(r,a,a+s[0].length,"",s[1],">",null));else if("ListItem"==r.name&&"OrderedList"==r.parent.name&&(s=/^([ \t]*)\d+([.)])([ \t]*)/.exec(o.text.slice(a)))){let t=s[3],e=s[0].length;t.length>=4&&(t=t.slice(0,t.length-4),e-=4),n.push(new om(r.parent,a,a+e,s[1],t,s[2],r))}else if("ListItem"==r.name&&"BulletList"==r.parent.name&&(s=/^([ \t]*)([-+*])([ \t]{1,4}\[[ xX]\])?([ \t]+)/.exec(o.text.slice(a)))){let t=s[4],e=s[0].length;t.length>4&&(t=t.slice(0,t.length-4),e-=4);let i=s[2];s[3]&&(i+=s[3].replace(/[xX]/," ")),n.push(new om(r.parent,a,a+e,s[1],t,i,r))}}return n}function lm(t,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(t.from,t.from+10))}function hm(t,e,i,n=0){for(let s=-1,r=t;;){if("ListItem"==r.name){let t=lm(r,e),o=+t[2];if(s>=0){if(o!=s+1)return;i.push({from:r.from+t[1].length,to:r.from+t[0].length,insert:String(s+2+n)})}s=o}let t=r.nextSibling;if(!t)break;r=t}}function cm(t){return"QuoteMark"==t.name||"ListMark"==t.name}const um=[{key:"Enter",run:({state:t,dispatch:e})=>{let i=Xa(t),{doc:n}=t,s=null,r=t.changeByRange((e=>{if(!e.empty||!rm.isActiveAt(t,e.from))return s={range:e};let r=e.from,o=n.lineAt(r),a=am(i.resolveInner(r,-1),n);for(;a.length&&a[a.length-1].from>r-o.from;)a.pop();if(!a.length)return s={range:e};let l=a[a.length-1];if(l.to-l.spaceAfter.length>r-o.from)return s={range:e};let h=r>=l.to-l.spaceAfter.length&&!/\S/.test(o.text.slice(l.to));if(l.item&&h){if(l.node.firstChild.to>=r||o.from>0&&!/[^\s>]/.test(n.lineAt(o.from-1).text)){let t,e=a.length>1?a[a.length-2]:null,i="";e&&e.item?(t=o.from+e.from,i=e.marker(n,1)):t=o.from+(e?e.to:0);let s=[{from:t,to:r,insert:i}];return"OrderedList"==l.node.name&&hm(l.item,n,s,-2),e&&"OrderedList"==e.node.name&&hm(e.item,n,s),{range:A.cursor(t+i.length),changes:s}}{let e="";for(let t=0,i=a.length-2;t<=i;t++)e+=a[t].blank(t\s*$/.exec(i.text);if(s&&s.index==l.from){let n=t.changes([{from:i.from+s.index,to:i.to},{from:o.from+l.from,to:o.to}]);return{range:e.map(n),changes:n}}}let c=[];"OrderedList"==l.node.name&&hm(l.item,n,c);let u=l.item&&l.item.from]*/.exec(o.text)[0].length>=l.to)for(let t=0,e=a.length-1;t<=e;t++)d+=t!=e||u?a[t].blank(to.from&&/\s/.test(o.text.charAt(f-o.from-1));)f--;return d=t.lineBreak+d,c.push({from:f,to:r,insert:d}),{range:A.cursor(f+d.length),changes:c}}));return!s&&(e(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0)}},{key:"Backspace",run:({state:t,dispatch:e})=>{let i=Xa(t),n=null,s=t.changeByRange((e=>{let s=e.from,{doc:r}=t;if(e.empty&&rm.isActiveAt(t,e.from)){let t=r.lineAt(s),n=am(function(t,e){let i=t.resolveInner(e,-1),n=e;cm(i)&&(n=i.from,i=i.parent);for(let t;t=i.childBefore(n);)if(cm(t))n=t.from;else{if("OrderedList"!=t.name&&"BulletList"!=t.name)break;i=t.lastChild,n=i.to}return i}(i,s),r);if(n.length){let i=n[n.length-1],r=i.to-i.spaceAfter.length+(i.spaceAfter?1:0);if(s-t.from>r&&!/\S/.test(t.text.slice(r,s-t.from)))return{range:A.cursor(t.from+r),changes:{from:t.from+r,to:s}};if(s-t.from==r&&(!i.item||t.from<=i.item.from||!/\S/.test(t.text.slice(0,i.to)))){let n=t.from+i.from;if(i.item&&i.node.fromt.from-e.from||t.startSide-e.startSide)),ni.set(i)}getMatchingBracket(t){switch(t){case")":return"(";case"]":return"[";case"}":return"{";default:return null}}},{decorations:t=>t.decorations});var fm="[a-zA-Z\\$][a-zA-Z0-9\\$]*",pm="(?:\\.\\d+|\\d+\\.\\d*|\\d+)",Om="(?:`(?:`?"+pm+")?)",gm=new RegExp("(?:(?:\\d+)(?:\\^\\^(?:\\.\\w+|\\w+\\.\\w*|\\w+)"+Om+"?(?:\\*\\^[+-]?\\d+)?))"),mm=new RegExp("(?:"+pm+Om+"?(?:\\*\\^[+-]?\\d+)?)"),bm=new RegExp("(?:`?)(?:"+fm+")(?:`(?:"+fm+"))*(?:`?)");let wm=[];const vm=["True","False","All","None","Null","Full","$Failed","$Aborted"];function ym(t,e){var i;return'"'===(i=t.next())?(e.tokenize=Sm,e.tokenize(t,e)):"("===i&&t.eat("*")?(e.commentLevel++,e.tokenize=xm,e.tokenize(t,e)):(t.backUp(1),t.match(gm,!0,!1)||t.match(mm,!0,!1)?"number":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::usage)/,!0,!1)?"meta":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::[a-zA-Z\$][a-zA-Z0-9\$]*):?/,!0,!1)?"string.special":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*\s*:)(?:(?:[a-zA-Z\$][a-zA-Z0-9\$]*)|(?:[^:=>~@\^\&\*\)\[\]'\?,\|])).*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+/,!0,!1)||t.match(/_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)?"variableName.special":t.match(/\\\[[a-zA-Z\$][a-zA-Z0-9\$]*\]/,!0,!1)?"character":t.match(/(?:\[|\]|{|}|\(|\))/,!0,!1)?"bracket":t.match(/(?:#[a-zA-Z\$][a-zA-Z0-9\$]*|#+[0-9]?)/,!0,!1)?"variableName.constant":t.match(bm,!0,!1)?vm.indexOf(t.current())>-1?"number":wm.indexOf(t.current())>-1||0==wm.length?"keyword":t.current()in e.localVars?"atom":(e.localVars[t.current()]=!0,"function"):t.match(/(?:\\|\+|\-|\*|\/|,|;|\.|:|@|~|=|>|<|&|\||_|`|'|\^|\?|!|%)/,!0,!1)?"operator":(t.next(),"error"))}function Sm(t,e){for(var i,n=!1,s=!1;null!=(i=t.next());){if('"'===i&&!s){n=!0;break}s=!s&&"\\"===i}return n&&!s&&(e.tokenize=ym),"string"}function xm(t,e){for(var i,n;e.commentLevel>0&&null!=(n=t.next());)"("===i&&"*"===n&&e.commentLevel++,"*"===i&&")"===n&&e.commentLevel--,i=n;return e.commentLevel<=0&&(e.tokenize=ym),"comment"}const km={name:"mathematica",extendVariables:function(t){},startState:function(){return{tokenize:ym,commentLevel:0,localVars:{}}},token:function(t,e){return t.eatSpace()?null:e.tokenize(t,e)},languageData:{commentTokens:{block:{open:"(*",close:"*)"}}}};let Qm={of:t=>[Gl.define(km),Yd({override:[async e=>function(t,e){let i=t.matchBefore(/\w*/);return i.from!==i.to||t.explicit?{from:i.from,options:e.data}:null}(e,t)]}),Ys.of([{key:"Escape",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((t=>{let{from:e,to:i}=t;return{changes:{from:e,to:i,insert:"EC"},range:A.cursor(e+2)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])],reBuild:t=>{wm=t.map((t=>t.label))}};const $m=(t,e,i,n)=>{if(0==t.length)return;const s=(new Date).valueOf();let r=0;i.dom.loadingMark=!0;const o=i.dom.style.background;let a=0;console.log("Start animation");const l=setInterval((()=>{i.dom.style.setProperty("background","hsl("+a+"deg 100% 97%)","important"),a+=2,a>360&&(a=0)}),30);n.transaction(e,i,s,t.length);for(const a of t)Pm(a,((a,h)=>{n.file(e,i,s,a,h),r++,r>=t.length&&i.dom&&i.dom.loadingMark&&(i.dom.loadingMark=!1,setTimeout((()=>{i.dom.style.background=o,clearInterval(l),console.log("Stop animation")}),2e3))}),(()=>{console.warn("Fauilure");const t=i.dom.style.background;i.dom.style.background="rgb(255 189 189 / 97%)";let e=97;const n=setInterval((()=>{i.dom.style.background="rgb(255 189 189 / "+Math.round(e)+"%)",e*=.95}),30);clearInterval(l),setTimeout((()=>{clearInterval(n),i.dom.style.background=t}),3e3)}))};function Pm(t,e,i){const n=new FileReader;n.addEventListener("load",(n=>{const s=n.target.result;if(s.byteLength/1024/1024>15)return alert("Files > 15Mb are not supported for drag and drop"),void i();let r=base64ArrayBuffer(s);e(t.name,r)})),n.addEventListener("progress",(t=>{if(t.loaded&&t.total){const e=t.loaded/t.total*100;console.log(e)}})),n.readAsArrayBuffer(t)}const Cm=(t,e)=>Ts.domEventHandlers({drop(e,i){e.preventDefault();const n=[];e.dataTransfer.items?[...e.dataTransfer.items].forEach(((t,e)=>{if("file"===t.kind){const i=t.getAsFile();console.log(`… file[${e}].name = ${i.name}`),n.push(i)}})):[...e.dataTransfer.files].forEach(((t,e)=>{console.log(`… file[${e}].name = ${t.name}`),n.push(t)})),$m(n,e,i,t)},paste(t,i){let n=t.clipboardData||window.clipboardData;for(const s of n.items)if("string"===s.kind)switch(s.type){case"text/plain":break;case"image/png":t.preventDefault(),$m([s.getAsFile()],t,i,e)}else t.preventDefault(),$m([s.getAsFile()],t,i,e)}}),_m=new pr({regexp:/\\\[(\w+)\]/g,decoration:t=>ni.replace({widget:new Zm(t[1])})}),Xm=_i.fromClass(class{constructor(t){this.Greekholder=_m.createDeco(t)}update(t){this.Greekholder=_m.updateDeco(t,this.Greekholder)}},{decorations:t=>t.Greekholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Greekholder||ni.none))});class Zm extends ei{constructor(t){super(),this.name=t}eq(t){return this.name===t.name}toDOM(){let t=document.createElement("span");return t.innerHTML="&"+this.name.toLowerCase().replace("sqrt","radic").replace("undirectededge","harr").replace("directededge","rarr").replace(/capital(.*)/,((t,e)=>e.charAt(0).toUpperCase()+e.slice(1))).replace(/curly(.*)/,((t,e)=>e)).replace(/script(.*)/,((t,e)=>"el"+e.toLowerCase())).replace("transpose","#7488").replace("degree","deg")+";",t}ignoreEvent(){return!1}}const Am=new pr({regexp:/(->|<-)/g,decoration:t=>ni.replace({widget:new Tm(t[1])})});_i.fromClass(class{constructor(t){this.Arrowholder=Am.createDeco(t)}update(t){this.Arrowholder=Am.updateDeco(t,this.Arrowholder)}},{decorations:t=>t.Arrowholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Arrowholder||ni.none))});class Tm extends ei{constructor(t){super(),this.dir=t}eq(t){return this.dir===t.dir}toDOM(){let t=document.createElement("span");return"->"===this.dir?t.innerText="→":t.innerText="←",t}ignoreEvent(){return!1}}function Rm(t){if(!(t=t||{}).open)throw new Error('Balanced: please provide a "open" property');if(!t.close)throw new Error('Balanced: please provide a "close" property');if(this.balance=t.balance||!1,this.exceptions=t.exceptions||!1,this.caseInsensitive=t.caseInsensitive,this.head=t.head||t.open,this.head=Array.isArray(this.head)?this.head:[this.head],this.open=Array.isArray(t.open)?t.open:[t.open],this.close=Array.isArray(t.close)?t.close:[t.close],!Array.isArray(this.head)||!Array.isArray(this.open)||!Array.isArray(this.close)||this.head.length!==this.open.length||this.open.length!==this.close.length)throw new Error('Balanced: if you use arrays for a "head,open,close" you must use matching arrays for all options');var e=Dm(this.head.map(this.regExpFromArrayGroupedMap,this)),i=Dm(this.open.map(this.regExpFromArrayGroupedMap,this)),n=Dm(this.close.map(this.regExpFromArrayGroupedMap,this));this.regExp=Dm([e,i,n],"g"+(this.caseInsensitive?"i":"")),this.regExpGroupLength=this.head.length}function Em(t,e,i){for(var n=Mm(e.substr(0,i+1),/^.*\n?$/gim),s=Mm(e,/^.*\n?$/gim),r=n.length-1,o=i+1-(n.length?n[n.length-1].index:0),a="",l=2;l>=0;l--)r-l>=0&&s[r-l]&&(a+=e.substr(s[r-l].index,s[r-l].length)+"\n");for(l=0;l=0&&s[r+l]&&(a+=e.substr(s[r+l].index,s[r+l].length)+"\n");a=a.replace(/\t/g," ").replace(/\n$/,"");var h=new Error(t+" at "+(r+1)+":"+o+"\n\n"+a);return h.line=r+1,h.column=o,h.index=i,h}function Vm(t,e){return t>=e.index&&t<=e.index+e.length-1}function Mm(t,e){var i,n=new RegExp(e),s=[];if(t)for(;i=n.exec(t);)s.push({index:i.index,length:i[0].length,match:i[0]}),i[0].length||n.lastIndex++;return s}function Dm(t,e,i){var n=t.map((function(t){return t instanceof RegExp?t.source:function(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}(t)}),this).join("|");return n=i?"("+n+")":"(?:"+n+")",new RegExp(n,e||void 0)}Rm.prototype={regExpFromArrayGroupedMap:function(t){return Dm([t],null,!0)},matchContentsInBetweenBrackets:function(t,e){for(var i,n=new RegExp(this.regExp),s=[],r=[],o=null,a=!0;i=n.exec(t);){if(e){for(var l=!1,h=0;h{const i=((t,e,i)=>{var n,s=new RegExp(t),r=[];if(e)for(;n=s.exec(e);){if(i){for(var o=!1,a=0;a{new qm({open:"(*"+t+"[*)",close:"(*]"+t+"*)",balance:!1}).matchContentsInBetweenBrackets(e.value,[]).forEach((function(t){const s=e.value.slice(t.index+t.head.length,t.index+t.length-t.tail.length);n(i+t.index,{length:t.length,pos:i+t.index,argsPos:i+t.index+t.head.length,str:s})}))})(e,t,i,s)},o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)r(o,a)}var Im,Bm=function(){function t(t){var e=t.tag,i=t.decoration,n=t.decorate,s=t.boundary,r=t.maxLength,o=void 0===r?1e3:r;if(this.tag=e,n)this.addMatch=function(t,e,i,s){return n(s,i,i+t.length,t,e)};else if("function"==typeof i)this.addMatch=function(t,e,n,s){var r=i(t,e,n);r&&s(n,n+t.length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=function(t,e,n,s){return s(n,n+t.length,i)}}this.boundary=s,this.maxLength=o}return t.prototype.createDeco=function(t){for(var e=this,i=new Xt,n=i.add.bind(i),s=0,r=function(t,e){var i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;for(var n=[],s=0,r=i;s=a?n[n.length-1].to=l:n.push({from:a,to:l})}return n}(t,this.maxLength);st.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e},t.prototype.updateRange=function(t,e,i,n){for(var s=this,r=function(r){var a=Math.max(r.from,i),l=Math.min(r.to,n);if(l>a){var h=t.state.doc.lineAt(a),c=h.toh.from;a--)if(o.boundary.test(h.text[a-1-h.from])){u=a;break}for(;ld},add:f})}},o=this,a=0,l=t.visibleRanges;a{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*FB[*)((_)(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*FB[*)(("+s+")(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let Nm=class{constructor(t,e,i,n,s,r){this.view=e,this.visibleValue=t,this.placeholder=r,console.log(r),this.args=Lm(t.str,/\(\*,\*\)/gm);const o=this;let a,l;console.log("creating InstanceWidget"),a=Im({doc:o.args[0].body.slice(2,-1),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(o.visibleValue.pos),e.dispatch({selection:{anchor:o.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return l.dispatch({selection:{anchor:0}}),l.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){l.focus(),t.editorLastCursor=void 0}}])]}),l=Im({doc:o.args[2].body.slice(1,-2),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:a.state.doc.length}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:o.visibleValue.pos+o.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus(),t.editorLastCursor=void 0}}])]}),o.args[0].length=o.args[0].body.length,o.args[2].length=o.args[2].body.length,delete o.args[2].body,delete o.args[1].body,delete o.args[0].body,this.topEditor=a,this.bottomEditor=l}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="(("+t+")",s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length));const r=e.length-i[0].length;i[0].to=i[0].to+r,i[2].from=i[2].from+r,i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e="("+t+"))",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length));const r=e.length-i[2].length;i[2].to=i[2].to+r,i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t,e){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm),console.log("recreating InstanceWidget"),n=Im.state({doc:e.args[0].body.slice(2,-1),update:t=>e.applyChanges(t,0),eval:()=>{i.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(e.visibleValue.pos),i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus(),t.editorLastCursor=void 0}}])]}),s=Im.state({doc:e.args[2].body.slice(1,-2),update:t=>e.applyChanges(t,2),eval:()=>{e.view.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus(),t.editorLastCursor=void 0}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),console.log(e),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.placeholder=e,this.visibleValue.argsPos=t.argsPos}destroy(){this.topEditor.destroy(),this.bottomEditor.destroy()}},Gm=class extends ei{constructor(t,e,i,n){super(),this.view=i,this.visibleValue=t,this.reference=e,this.placeholder=n}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue,this),!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("fraction");const i=document.createElement("table");i.classList.add("container"),e.appendChild(i);const n=document.createElement("tbody");i.appendChild(n);const s=document.createElement("tr"),r=document.createElement("tr");n.appendChild(s),n.appendChild(r);const o=document.createElement("td");o.classList.add("enumenator"),s.appendChild(o);const a=document.createElement("td");r.appendChild(a);const l=this;return e.EditorWidget=new Nm(this.visibleValue,t,o,a,[],this),this.DOMElement=e,this.reference.push({destroy:()=>{l.destroy(e)}}),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const Fm=(t,e,i)=>new Bm({tag:"FB",decoration:n=>ni.replace({widget:new Gm(n,t,e,i)})}),Hm=t=>_i.fromClass(class{constructor(e){this.disposable=[],this.placeholder=Fm(this.disposable,e,this).createDeco(e),t.placeholder=this}update(t){this.placeholder=Fm(this.disposable,t,this).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var Jm;function Km(t){return Jm=t,[nb,Ys.of([{key:"Ctrl-2",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt[_](*]SqB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt["+s+"](*]SqB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let tb=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;this.sliceRanges=n,this.length=t.str.length,console.log("creating InstanceWidget"),this.editor=Jm({doc:t.str.slice(...n),parent:i,update:t=>r.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]})}applyChanges(t){const e=t,i={from:this.visibleValue.argsPos+5,to:this.visibleValue.argsPos+this.length-1,insert:e};console.log(this.visibleValue);const n=e.length+6-this.length;this.length=this.length+n,this.visibleValue.length=this.visibleValue.length+n,this.visibleValue.str="Sqrt["+e+"]",this.view.dispatch({changes:i})}update(t){if(this.visibleValue.str==t.str)this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos;else{console.warn("Out of sync"),this.visibleValue=t;const e=this.sliceRanges,i=this.editor,n=this,s=this.view;this.length=t.str.length;const r=Jm.state({doc:t.str.slice(...e),update:t=>n.applyChanges(t),eval:()=>{s.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos+n.visibleValue.length}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]});i.setState(r)}}destroy(){console.warn("destroy Instance of Widget!"),this.editor.destroy()}},eb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("sqroot");const i=this,n=document.createElement("span");return n.classList.add("radicand"),e.EditorWidget=new tb(this.visibleValue,t,n,[5,-1],[]),e.appendChild(n),this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const ib=(t,e)=>new Bm({tag:"SqB",decoration:i=>ni.replace({widget:new eb(i,t,e)})}),nb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=ib(this.disposable,t).createDeco(t)}update(t){this.placeholder=ib(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var sb;function rb(t){return sb=t,[hb,Ys.of([{key:"Ctrl--",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SbB[*)Subscript[_(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SbB[*)Subscript["+s+"(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let ob=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),console.log(r.visibleValue),o=sb({doc:r.args[0].body.slice(10),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){a.focus()}}])]}),a=sb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Subscript["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),console.log(e.visibleValue),n=sb.state({doc:e.args[0].body.slice(10),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus()}}])]}),s=sb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},ab=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sub");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new ob(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const lb=(t,e)=>new Bm({tag:"SbB",decoration:i=>ni.replace({widget:new ab(i,t,e)})}),hb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=lb(this.disposable,t).createDeco(t)}update(t){this.placeholder=lb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var cb;function ub(t){return cb=t,[Ob,Ys.of([{key:"Ctrl-6",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SpB[*)Power[_(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SpB[*)Power["+s+"(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let db=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),o=cb({doc:r.args[0].body.slice(6),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus()}}])]}),a=cb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Power["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),n=cb.state({doc:e.args[0].body.slice(6),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.bottomEditor.focus()}}])]}),s=cb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},fb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sup");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new db(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}destroy(t){t.EditorWidget.destroy()}};const pb=(t,e)=>new Bm({tag:"SpB",decoration:i=>ni.replace({widget:new fb(i,t,e)})}),Ob=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=pb(this.disposable,t).createDeco(t)}update(t){this.placeholder=pb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var gb={},mb={},bb={},wb={};function vb(t){let e=t.length;for(;--e>=0;)t[e]=0}const yb=256,Sb=286,xb=30,kb=15,Qb=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),$b=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Pb=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Cb=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_b=new Array(576);vb(_b);const Xb=new Array(60);vb(Xb);const Zb=new Array(512);vb(Zb);const Ab=new Array(256);vb(Ab);const Tb=new Array(29);vb(Tb);const Rb=new Array(xb);function Eb(t,e,i,n,s){this.static_tree=t,this.extra_bits=e,this.extra_base=i,this.elems=n,this.max_length=s,this.has_stree=t&&t.length}let Vb,Mb,Db;function Wb(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}vb(Rb);const Ub=t=>t<256?Zb[t]:Zb[256+(t>>>7)],Yb=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},qb=(t,e,i)=>{t.bi_valid>16-i?(t.bi_buf|=e<>16-t.bi_valid,t.bi_valid+=i-16):(t.bi_buf|=e<{qb(t,i[2*e],i[2*e+1])},zb=(t,e)=>{let i=0;do{i|=1&t,t>>>=1,i<<=1}while(--e>0);return i>>>1},Ib=(t,e,i)=>{const n=new Array(16);let s,r,o=0;for(s=1;s<=kb;s++)o=o+i[s-1]<<1,n[s]=o;for(r=0;r<=e;r++){let e=t[2*r+1];0!==e&&(t[2*r]=zb(n[e]++,e))}},Bb=t=>{let e;for(e=0;e{t.bi_valid>8?Yb(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},Nb=(t,e,i,n)=>{const s=2*e,r=2*i;return t[s]{const n=t.heap[i];let s=i<<1;for(;s<=t.heap_len&&(s{let n,s,r,o,a=0;if(0!==t.sym_next)do{n=255&t.pending_buf[t.sym_buf+a++],n+=(255&t.pending_buf[t.sym_buf+a++])<<8,s=t.pending_buf[t.sym_buf+a++],0===n?Lb(t,s,e):(r=Ab[s],Lb(t,r+yb+1,e),o=Qb[r],0!==o&&(s-=Tb[r],qb(t,s,o)),n--,r=Ub(n),Lb(t,r,i),o=$b[r],0!==o&&(n-=Rb[r],qb(t,n,o)))}while(a{const i=e.dyn_tree,n=e.stat_desc.static_tree,s=e.stat_desc.has_stree,r=e.stat_desc.elems;let o,a,l,h=-1;for(t.heap_len=0,t.heap_max=573,o=0;o>1;o>=1;o--)Gb(t,i,o);l=r;do{o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Gb(t,i,1),a=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=a,i[2*l]=i[2*o]+i[2*a],t.depth[l]=(t.depth[o]>=t.depth[a]?t.depth[o]:t.depth[a])+1,i[2*o+1]=i[2*a+1]=l,t.heap[1]=l++,Gb(t,i,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const i=e.dyn_tree,n=e.max_code,s=e.stat_desc.static_tree,r=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,l=e.stat_desc.max_length;let h,c,u,d,f,p,O=0;for(d=0;d<=kb;d++)t.bl_count[d]=0;for(i[2*t.heap[t.heap_max]+1]=0,h=t.heap_max+1;h<573;h++)c=t.heap[h],d=i[2*i[2*c+1]+1]+1,d>l&&(d=l,O++),i[2*c+1]=d,c>n||(t.bl_count[d]++,f=0,c>=a&&(f=o[c-a]),p=i[2*c],t.opt_len+=p*(d+f),r&&(t.static_len+=p*(s[2*c+1]+f)));if(0!==O){do{for(d=l-1;0===t.bl_count[d];)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[l]--,O-=2}while(O>0);for(d=l;0!==d;d--)for(c=t.bl_count[d];0!==c;)u=t.heap[--h],u>n||(i[2*u+1]!==d&&(t.opt_len+=(d-i[2*u+1])*i[2*u],i[2*u+1]=d),c--)}})(t,e),Ib(i,h,t.bl_count)},Jb=(t,e,i)=>{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),e[2*(i+1)+1]=65535,n=0;n<=i;n++)s=o,o=e[2*(n+1)+1],++a{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),n=0;n<=i;n++)if(s=o,o=e[2*(n+1)+1],!(++a{qb(t,0+(n?1:0),3),jb(t),Yb(t,i),Yb(t,~i),i&&t.pending_buf.set(t.window.subarray(e,e+i),t.pending),t.pending+=i};wb._tr_init=t=>{tw||((()=>{let t,e,i,n,s;const r=new Array(16);for(i=0,n=0;n<28;n++)for(Tb[n]=i,t=0;t<1<>=7;n{let s,r,o=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e{let e;for(Jb(t,t.dyn_ltree,t.l_desc.max_code),Jb(t,t.dyn_dtree,t.d_desc.max_code),Hb(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*Cb[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=i+5,i+4<=s&&-1!==e?ew(t,e,i,n):4===t.strategy||r===s?(qb(t,2+(n?1:0),3),Fb(t,_b,Xb)):(qb(t,4+(n?1:0),3),((t,e,i,n)=>{let s;for(qb(t,e-257,5),qb(t,i-1,5),qb(t,n-4,4),s=0;s(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=i,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(Ab[i]+yb+1)]++,t.dyn_dtree[2*Ub(e)]++),t.sym_next===t.sym_end),wb._tr_align=t=>{qb(t,2,3),Lb(t,256,_b),(t=>{16===t.bi_valid?(Yb(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)};var iw=(t,e,i,n)=>{let s=65535&t|0,r=t>>>16&65535|0,o=0;for(;0!==i;){o=i>2e3?2e3:i,i-=o;do{s=s+e[n++]|0,r=r+s|0}while(--o);s%=65521,r%=65521}return s|r<<16|0};const nw=new Uint32Array((()=>{let t,e=[];for(var i=0;i<256;i++){t=i;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e})());var sw=(t,e,i,n)=>{const s=nw,r=n+i;t^=-1;for(let i=n;i>>8^s[255&(t^e[i])];return-1^t},rw={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},ow={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:aw,_tr_stored_block:lw,_tr_flush_block:hw,_tr_tally:cw,_tr_align:uw}=wb,dw=iw,fw=sw,pw=rw,{Z_NO_FLUSH:Ow,Z_PARTIAL_FLUSH:gw,Z_FULL_FLUSH:mw,Z_FINISH:bw,Z_BLOCK:ww,Z_OK:vw,Z_STREAM_END:yw,Z_STREAM_ERROR:Sw,Z_DATA_ERROR:xw,Z_BUF_ERROR:kw,Z_DEFAULT_COMPRESSION:Qw,Z_FILTERED:$w,Z_HUFFMAN_ONLY:Pw,Z_RLE:Cw,Z_FIXED:_w,Z_DEFAULT_STRATEGY:Xw,Z_UNKNOWN:Zw,Z_DEFLATED:Aw}=ow,Tw=258,Rw=262,Ew=42,Vw=113,Mw=666,Dw=(t,e)=>(t.msg=pw[e],e),Ww=t=>2*t-(t>4?9:0),Uw=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Yw=t=>{let e,i,n,s=t.w_size;e=t.hash_size,n=e;do{i=t.head[--n],t.head[n]=i>=s?i-s:0}while(--e);e=s,n=e;do{i=t.prev[--n],t.prev[n]=i>=s?i-s:0}while(--e)};let qw=(t,e,i)=>(e<{const e=t.state;let i=e.pending;i>t.avail_out&&(i=t.avail_out),0!==i&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+i),t.next_out),t.next_out+=i,e.pending_out+=i,t.total_out+=i,t.avail_out-=i,e.pending-=i,0===e.pending&&(e.pending_out=0))},zw=(t,e)=>{hw(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Lw(t.strm)},Iw=(t,e)=>{t.pending_buf[t.pending++]=e},Bw=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},jw=(t,e,i,n)=>{let s=t.avail_in;return s>n&&(s=n),0===s?0:(t.avail_in-=s,e.set(t.input.subarray(t.next_in,t.next_in+s),i),1===t.state.wrap?t.adler=dw(t.adler,e,s,i):2===t.state.wrap&&(t.adler=fw(t.adler,e,s,i)),t.next_in+=s,t.total_in+=s,s)},Nw=(t,e)=>{let i,n,s=t.max_chain_length,r=t.strstart,o=t.prev_length,a=t.nice_match;const l=t.strstart>t.w_size-Rw?t.strstart-(t.w_size-Rw):0,h=t.window,c=t.w_mask,u=t.prev,d=t.strstart+Tw;let f=h[r+o-1],p=h[r+o];t.prev_length>=t.good_match&&(s>>=2),a>t.lookahead&&(a=t.lookahead);do{if(i=e,h[i+o]===p&&h[i+o-1]===f&&h[i]===h[r]&&h[++i]===h[r+1]){r+=2,i++;do{}while(h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&ro){if(t.match_start=e,o=n,n>=a)break;f=h[r+o-1],p=h[r+o]}}}while((e=u[e&c])>l&&0!=--s);return o<=t.lookahead?o:t.lookahead},Gw=t=>{const e=t.w_size;let i,n,s;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Rw)&&(t.window.set(t.window.subarray(e,e+e-n),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Yw(t),n+=e),0===t.strm.avail_in)break;if(i=jw(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=i,t.lookahead+t.insert>=3)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=qw(t,t.ins_h,t.window[s+1]);t.insert&&(t.ins_h=qw(t,t.ins_h,t.window[s+3-1]),t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead{let i,n,s,r=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,o=0,a=t.strm.avail_in;do{if(i=65535,s=t.bi_valid+42>>3,t.strm.avail_outn+t.strm.avail_in&&(i=n+t.strm.avail_in),i>s&&(i=s),i>8,t.pending_buf[t.pending-2]=~i,t.pending_buf[t.pending-1]=~i>>8,Lw(t.strm),n&&(n>i&&(n=i),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+n),t.strm.next_out),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n,t.block_start+=n,i-=n),i&&(jw(t.strm,t.strm.output,t.strm.next_out,i),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i)}while(0===o);return a-=t.strm.avail_in,a&&(a>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=a&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-a,t.strm.next_in),t.strstart),t.strstart+=a,t.insert+=a>t.w_size-t.insert?t.w_size-t.insert:a),t.block_start=t.strstart),t.high_waters&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,s+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),s>t.strm.avail_in&&(s=t.strm.avail_in),s&&(jw(t.strm,t.window,t.strstart,s),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.high_water>3,s=t.pending_buf_size-s>65535?65535:t.pending_buf_size-s,r=s>t.w_size?t.w_size:s,n=t.strstart-t.block_start,(n>=r||(n||e===bw)&&e!==Ow&&0===t.strm.avail_in&&n<=s)&&(i=n>s?s:n,o=e===bw&&0===t.strm.avail_in&&i===n?1:0,lw(t,t.block_start,i,o),t.block_start+=i,Lw(t.strm)),o?3:1)},Hw=(t,e)=>{let i,n;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==i&&t.strstart-i<=t.w_size-Rw&&(t.match_length=Nw(t,i)),t.match_length>=3)if(n=cw(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=qw(t,t.ins_h,t.window[t.strstart+1]);else n=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2},Jw=(t,e)=>{let i,n,s;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==i&&t.prev_length4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){s=t.strstart+t.lookahead-3,n=cw(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=s&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(zw(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(n=cw(t,0,t.window[t.strstart-1]),n&&zw(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=cw(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2};function Kw(t,e,i,n,s){this.good_length=t,this.max_lazy=e,this.nice_length=i,this.max_chain=n,this.func=s}const tv=[new Kw(0,0,0,0,Fw),new Kw(4,4,8,4,Hw),new Kw(4,5,16,8,Hw),new Kw(4,6,32,32,Hw),new Kw(4,4,16,16,Jw),new Kw(8,16,32,32,Jw),new Kw(8,16,128,128,Jw),new Kw(8,32,128,256,Jw),new Kw(32,128,258,1024,Jw),new Kw(32,258,258,4096,Jw)];function ev(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Aw,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Uw(this.dyn_ltree),Uw(this.dyn_dtree),Uw(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Uw(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Uw(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const iv=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==Ew&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==Vw&&e.status!==Mw?1:0},nv=t=>{if(iv(t))return Dw(t,Sw);t.total_in=t.total_out=0,t.data_type=Zw;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?Ew:Vw,t.adler=2===e.wrap?0:1,e.last_flush=-2,aw(e),vw},sv=t=>{const e=nv(t);var i;return e===vw&&((i=t.state).window_size=2*i.w_size,Uw(i.head),i.max_lazy_match=tv[i.level].max_lazy,i.good_match=tv[i.level].good_length,i.nice_match=tv[i.level].nice_length,i.max_chain_length=tv[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=2,i.match_available=0,i.ins_h=0),e},rv=(t,e,i,n,s,r)=>{if(!t)return Sw;let o=1;if(e===Qw&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),s<1||s>9||i!==Aw||n<8||n>15||e<0||e>9||r<0||r>_w||8===n&&1!==o)return Dw(t,Sw);8===n&&(n=9);const a=new ev;return t.state=a,a.strm=t,a.status=Ew,a.wrap=o,a.gzhead=null,a.w_bits=n,a.w_size=1<rv(t,e,Aw,15,8,Xw),bb.deflateInit2=rv,bb.deflateReset=sv,bb.deflateResetKeep=nv,bb.deflateSetHeader=(t,e)=>iv(t)||2!==t.state.wrap?Sw:(t.state.gzhead=e,vw),bb.deflate=(t,e)=>{if(iv(t)||e>ww||e<0)return t?Dw(t,Sw):Sw;const i=t.state;if(!t.output||0!==t.avail_in&&!t.input||i.status===Mw&&e!==bw)return Dw(t,0===t.avail_out?kw:Sw);const n=i.last_flush;if(i.last_flush=e,0!==i.pending){if(Lw(t),0===t.avail_out)return i.last_flush=-1,vw}else if(0===t.avail_in&&Ww(e)<=Ww(n)&&e!==bw)return Dw(t,kw);if(i.status===Mw&&0!==t.avail_in)return Dw(t,kw);if(i.status===Ew&&0===i.wrap&&(i.status=Vw),i.status===Ew){let e=Aw+(i.w_bits-8<<4)<<8,n=-1;if(n=i.strategy>=Pw||i.level<2?0:i.level<6?1:6===i.level?2:3,e|=n<<6,0!==i.strstart&&(e|=32),e+=31-e%31,Bw(i,e),0!==i.strstart&&(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),t.adler=1,i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(57===i.status)if(t.adler=0,Iw(i,31),Iw(i,139),Iw(i,8),i.gzhead)Iw(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),Iw(i,255&i.gzhead.time),Iw(i,i.gzhead.time>>8&255),Iw(i,i.gzhead.time>>16&255),Iw(i,i.gzhead.time>>24&255),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(Iw(i,255&i.gzhead.extra.length),Iw(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=fw(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if(Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,3),i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw;if(69===i.status){if(i.gzhead.extra){let e=i.pending,n=(65535&i.gzhead.extra.length)-i.gzindex;for(;i.pending+n>i.pending_buf_size;){let s=i.pending_buf_size-i.pending;if(i.pending_buf.set(i.gzhead.extra.subarray(i.gzindex,i.gzindex+s),i.pending),i.pending=i.pending_buf_size,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex+=s,Lw(t),0!==i.pending)return i.last_flush=-1,vw;e=0,n-=s}let s=new Uint8Array(i.gzhead.extra);i.pending_buf.set(s.subarray(i.gzindex,i.gzindex+n),i.pending),i.pending+=n,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex=0}i.status=73}if(73===i.status){if(i.gzhead.name){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),i.gzindex=0}i.status=91}if(91===i.status){if(i.gzhead.comment){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n))}i.status=103}if(103===i.status){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size&&(Lw(t),0!==i.pending))return i.last_flush=-1,vw;Iw(i,255&t.adler),Iw(i,t.adler>>8&255),t.adler=0}if(i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(0!==t.avail_in||0!==i.lookahead||e!==Ow&&i.status!==Mw){let n=0===i.level?Fw(i,e):i.strategy===Pw?((t,e)=>{let i;for(;;){if(0===t.lookahead&&(Gw(t),0===t.lookahead)){if(e===Ow)return 1;break}if(t.match_length=0,i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):i.strategy===Cw?((t,e)=>{let i,n,s,r;const o=t.window;for(;;){if(t.lookahead<=Tw){if(Gw(t),t.lookahead<=Tw&&e===Ow)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(s=t.strstart-1,n=o[s],n===o[++s]&&n===o[++s]&&n===o[++s])){r=t.strstart+Tw;do{}while(n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&st.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(i=cw(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):tv[i.level].func(i,e);if(3!==n&&4!==n||(i.status=Mw),1===n||3===n)return 0===t.avail_out&&(i.last_flush=-1),vw;if(2===n&&(e===gw?uw(i):e!==ww&&(lw(i,0,0,!1),e===mw&&(Uw(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),Lw(t),0===t.avail_out))return i.last_flush=-1,vw}return e!==bw?vw:i.wrap<=0?yw:(2===i.wrap?(Iw(i,255&t.adler),Iw(i,t.adler>>8&255),Iw(i,t.adler>>16&255),Iw(i,t.adler>>24&255),Iw(i,255&t.total_in),Iw(i,t.total_in>>8&255),Iw(i,t.total_in>>16&255),Iw(i,t.total_in>>24&255)):(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),Lw(t),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?vw:yw)},bb.deflateEnd=t=>{if(iv(t))return Sw;const e=t.state.status;return t.state=null,e===Vw?Dw(t,xw):vw},bb.deflateSetDictionary=(t,e)=>{let i=e.length;if(iv(t))return Sw;const n=t.state,s=n.wrap;if(2===s||1===s&&n.status!==Ew||n.lookahead)return Sw;if(1===s&&(t.adler=dw(t.adler,e,i,0)),n.wrap=0,i>=n.w_size){0===s&&(Uw(n.head),n.strstart=0,n.block_start=0,n.insert=0);let t=new Uint8Array(n.w_size);t.set(e.subarray(i-n.w_size,i),0),e=t,i=n.w_size}const r=t.avail_in,o=t.next_in,a=t.input;for(t.avail_in=i,t.next_in=0,t.input=e,Gw(n);n.lookahead>=3;){let t=n.strstart,e=n.lookahead-2;do{n.ins_h=qw(n,n.ins_h,n.window[t+3-1]),n.prev[t&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=t,t++}while(--e);n.strstart=t,n.lookahead=2,Gw(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,t.next_in=o,t.input=a,t.avail_in=r,n.wrap=s,vw},bb.deflateInfo="pako deflate (from Nodeca project)";var ov={};const av=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);ov.assign=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const e in i)av(i,e)&&(t[e]=i[e])}}return t},ov.flattenChunks=t=>{let e=0;for(let i=0,n=t.length;i=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;cv[254]=cv[254]=1,lv.string2buf=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,i,n,s,r,o=t.length,a=0;for(s=0;s>>6,e[r++]=128|63&i):i<65536?(e[r++]=224|i>>>12,e[r++]=128|i>>>6&63,e[r++]=128|63&i):(e[r++]=240|i>>>18,e[r++]=128|i>>>12&63,e[r++]=128|i>>>6&63,e[r++]=128|63&i);return e};lv.buf2string=(t,e)=>{const i=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let n,s;const r=new Array(2*i);for(s=0,n=0;n4)r[s++]=65533,n+=o-1;else{for(e&=2===o?31:3===o?15:7;o>1&&n1?r[s++]=65533:e<65536?r[s++]=e:(e-=65536,r[s++]=55296|e>>10&1023,r[s++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&hv)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let i="";for(let n=0;n{(e=e||t.length)>t.length&&(e=t.length);let i=e-1;for(;i>=0&&128==(192&t[i]);)i--;return i<0||0===i?e:i+cv[t[i]]>e?i:e};var uv=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const dv=bb,fv=ov,pv=lv,Ov=rw,gv=uv,mv=Object.prototype.toString,{Z_NO_FLUSH:bv,Z_SYNC_FLUSH:wv,Z_FULL_FLUSH:vv,Z_FINISH:yv,Z_OK:Sv,Z_STREAM_END:xv,Z_DEFAULT_COMPRESSION:kv,Z_DEFAULT_STRATEGY:Qv,Z_DEFLATED:$v}=ow;function Pv(t){this.options=fv.assign({level:kv,method:$v,chunkSize:16384,windowBits:15,memLevel:8,strategy:Qv},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new gv,this.strm.avail_out=0;let i=dv.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(i!==Sv)throw new Error(Ov[i]);if(e.header&&dv.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?pv.string2buf(e.dictionary):"[object ArrayBuffer]"===mv.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,i=dv.deflateSetDictionary(this.strm,t),i!==Sv)throw new Error(Ov[i]);this._dict_set=!0}}function Cv(t,e){const i=new Pv(e);if(i.push(t,!0),i.err)throw i.msg||Ov[i.err];return i.result}Pv.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize;let s,r;if(this.ended)return!1;for(r=e===~~e?e:!0===e?yv:bv,"string"==typeof t?i.input=pv.string2buf(t):"[object ArrayBuffer]"===mv.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),(r===wv||r===vv)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(s=dv.deflate(i,r),s===xv)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),s=dv.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===Sv;if(0!==i.avail_out){if(r>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},Pv.prototype.onData=function(t){this.chunks.push(t)},Pv.prototype.onEnd=function(t){t===Sv&&(this.result=fv.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},mb.Deflate=Pv,mb.deflate=Cv,mb.deflateRaw=function(t,e){return(e=e||{}).raw=!0,Cv(t,e)},mb.gzip=function(t,e){return(e=e||{}).gzip=!0,Cv(t,e)},mb.constants=ow;var _v={},Xv={};const Zv=16209;const Av=15,Tv=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Rv=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Ev=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Vv=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Mv=(t,e,i,n,s,r,o,a)=>{const l=a.bits;let h,c,u,d,f,p,O=0,g=0,m=0,b=0,w=0,v=0,y=0,S=0,x=0,k=0,Q=null;const $=new Uint16Array(16),P=new Uint16Array(16);let C,_,X,Z=null;for(O=0;O<=Av;O++)$[O]=0;for(g=0;g=1&&0===$[b];b--);if(w>b&&(w=b),0===b)return s[r++]=20971520,s[r++]=20971520,a.bits=1,0;for(m=1;m0&&(0===t||1!==b))return-1;for(P[1]=0,O=1;O852||2===t&&x>592)return 1;for(;;){C=O-y,o[g]+1=p?(_=Z[o[g]-p],X=Q[o[g]-p]):(_=96,X=0),h=1<>y)+c]=C<<24|_<<16|X|0}while(0!==c);for(h=1<>=1;if(0!==h?(k&=h-1,k+=h):k=0,g++,0==--$[O]){if(O===b)break;O=e[i+o[g]]}if(O>w&&(k&d)!==u){for(0===y&&(y=w),f+=m,v=O-y,S=1<852||2===t&&x>592)return 1;u=k&d,s[u]=w<<24|v<<16|f-r|0}}return 0!==k&&(s[f+k]=O-y<<24|64<<16|0),a.bits=w,0};const Dv=iw,Wv=sw,Uv=function(t,e){let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,y,S,x,k,Q;const $=t.state;i=t.next_in,k=t.input,n=i+(t.avail_in-5),s=t.next_out,Q=t.output,r=s-(e-t.avail_out),o=s+(t.avail_out-257),a=$.dmax,l=$.wsize,h=$.whave,c=$.wnext,u=$.window,d=$.hold,f=$.bits,p=$.lencode,O=$.distcode,g=(1<<$.lenbits)-1,m=(1<<$.distbits)-1;t:do{f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,0===w)Q[s++]=65535&b;else{if(!(16&w)){if(0==(64&w)){b=p[(65535&b)+(d&(1<>>=w,f-=w),f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,!(16&w)){if(0==(64&w)){b=O[(65535&b)+(d&(1<a){t.msg="invalid distance too far back",$.mode=Zv;break t}if(d>>>=w,f-=w,w=s-r,y>w){if(w=y-w,w>h&&$.sane){t.msg="invalid distance too far back",$.mode=Zv;break t}if(S=0,x=u,0===c){if(S+=l-w,w2;)Q[s++]=x[S++],Q[s++]=x[S++],Q[s++]=x[S++],v-=3;v&&(Q[s++]=x[S++],v>1&&(Q[s++]=x[S++]))}else{S=s-y;do{Q[s++]=Q[S++],Q[s++]=Q[S++],Q[s++]=Q[S++],v-=3}while(v>2);v&&(Q[s++]=Q[S++],v>1&&(Q[s++]=Q[S++]))}break}}break}}while(i>3,i-=v,f-=v<<3,d&=(1<(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function hy(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const cy=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode16211?1:0},uy=t=>{if(cy(t))return Nv;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Kv,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,Iv},dy=t=>{if(cy(t))return Nv;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,uy(t)},fy=(t,e)=>{let i;if(cy(t))return Nv;const n=t.state;return e<0?(i=0,e=-e):(i=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?Nv:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=i,n.wbits=e,dy(t))},py=(t,e)=>{if(!t)return Nv;const i=new hy;t.state=i,i.strm=t,i.window=null,i.mode=Kv;const n=fy(t,e);return n!==Iv&&(t.state=null),n};let Oy,gy,my=!0;const by=t=>{if(my){Oy=new Int32Array(512),gy=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Yv(1,t.lens,0,288,Oy,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Yv(2,t.lens,0,32,gy,0,t.work,{bits:5}),my=!1}t.lencode=Oy,t.lenbits=9,t.distcode=gy,t.distbits=5},wy=(t,e,i,n)=>{let s;const r=t.state;return null===r.window&&(r.wsize=1<=r.wsize?(r.window.set(e.subarray(i-r.wsize,i),0),r.wnext=0,r.whave=r.wsize):(s=r.wsize-r.wnext,s>n&&(s=n),r.window.set(e.subarray(i-n,i-n+s),r.wnext),(n-=s)?(r.window.set(e.subarray(i-n,i),0),r.wnext=n,r.whave=r.wsize):(r.wnext+=s,r.wnext===r.wsize&&(r.wnext=0),r.whavepy(t,15),Xv.inflateInit2=py,Xv.inflate=(t,e)=>{let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,y,S,x,k=0;const Q=new Uint8Array(4);let $,P;const C=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(cy(t)||!t.output||!t.input&&0!==t.avail_in)return Nv;i=t.state,i.mode===ey&&(i.mode=iy),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,u=a,d=l,x=Iv;t:for(;;)switch(i.mode){case Kv:if(0===i.wrap){i.mode=iy;break}for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0),h=0,c=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",i.mode=ay;break}if((15&h)!==Jv){t.msg="unknown compression method",i.mode=ay;break}if(h>>>=4,c-=4,S=8+(15&h),0===i.wbits&&(i.wbits=S),S>15||S>i.wbits){t.msg="invalid window size",i.mode=ay;break}i.dmax=1<>8&1),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16182;case 16182:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>8&255,Q[2]=h>>>16&255,Q[3]=h>>>24&255,i.check=Wv(i.check,Q,4,0)),h=0,c=0,i.mode=16183;case 16183:for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>8),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16184;case 16184:if(1024&i.flags){for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(f=i.length,f>a&&(f=a),f&&(i.head&&(S=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(n.subarray(r,r+f),S)),512&i.flags&&4&i.wrap&&(i.check=Wv(i.check,n,f,r)),a-=f,r+=f,i.length-=f),i.length))break t;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===a)break t;f=0;do{S=n[r+f++],i.head&&S&&i.length<65536&&(i.head.name+=String.fromCharCode(S))}while(S&&f>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=ey;break;case 16189:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>=7&c,c-=7&c,i.mode=oy;break}for(;c<3;){if(0===a)break t;a--,h+=n[r++]<>>=1,c-=1,3&h){case 0:i.mode=16193;break;case 1:if(by(i),i.mode=sy,e===zv){h>>>=2,c-=2;break t}break;case 2:i.mode=16196;break;case 3:t.msg="invalid block type",i.mode=ay}h>>>=2,c-=2;break;case 16193:for(h>>>=7&c,c-=7&c;c<32;){if(0===a)break t;a--,h+=n[r++]<>>16^65535)){t.msg="invalid stored block lengths",i.mode=ay;break}if(i.length=65535&h,h=0,c=0,i.mode=ny,e===zv)break t;case ny:i.mode=16195;case 16195:if(f=i.length,f){if(f>a&&(f=a),f>l&&(f=l),0===f)break t;s.set(n.subarray(r,r+f),o),a-=f,r+=f,l-=f,o+=f,i.length-=f;break}i.mode=ey;break;case 16196:for(;c<14;){if(0===a)break t;a--,h+=n[r++]<>>=5,c-=5,i.ndist=1+(31&h),h>>>=5,c-=5,i.ncode=4+(15&h),h>>>=4,c-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=ay;break}i.have=0,i.mode=16197;case 16197:for(;i.have>>=3,c-=3}for(;i.have<19;)i.lens[C[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,$={bits:i.lenbits},x=Yv(0,i.lens,0,19,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid code lengths set",i.mode=ay;break}i.have=0,i.mode=16198;case 16198:for(;i.have>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=g,c-=g,i.lens[i.have++]=b;else{if(16===b){for(P=g+2;c>>=g,c-=g,0===i.have){t.msg="invalid bit length repeat",i.mode=ay;break}S=i.lens[i.have-1],f=3+(3&h),h>>>=2,c-=2}else if(17===b){for(P=g+3;c>>=g,c-=g,S=0,f=3+(7&h),h>>>=3,c-=3}else{for(P=g+7;c>>=g,c-=g,S=0,f=11+(127&h),h>>>=7,c-=7}if(i.have+f>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=ay;break}for(;f--;)i.lens[i.have++]=S}}if(i.mode===ay)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=ay;break}if(i.lenbits=9,$={bits:i.lenbits},x=Yv(1,i.lens,0,i.nlen,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid literal/lengths set",i.mode=ay;break}if(i.distbits=6,i.distcode=i.distdyn,$={bits:i.distbits},x=Yv(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,$),i.distbits=$.bits,x){t.msg="invalid distances set",i.mode=ay;break}if(i.mode=sy,e===zv)break t;case sy:i.mode=ry;case ry:if(a>=6&&l>=258){t.next_out=o,t.avail_out=l,t.next_in=r,t.avail_in=a,i.hold=h,i.bits=c,Uv(t,d),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,i.mode===ey&&(i.back=-1);break}for(i.back=0;k=i.lencode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,i.length=b,0===m){i.mode=16205;break}if(32&m){i.back=-1,i.mode=ey;break}if(64&m){t.msg="invalid literal/length code",i.mode=ay;break}i.extra=15&m,i.mode=16201;case 16201:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;k=i.distcode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,64&m){t.msg="invalid distance code",i.mode=ay;break}i.offset=b,i.extra=15&m,i.mode=16203;case 16203:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=ay;break}i.mode=16204;case 16204:if(0===l)break t;if(f=d-l,i.offset>f){if(f=i.offset-f,f>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=ay;break}f>i.wnext?(f-=i.wnext,p=i.wsize-f):p=i.wnext-f,f>i.length&&(f=i.length),O=i.window}else O=s,p=o-i.offset,f=i.length;f>l&&(f=l),l-=f,i.length-=f;do{s[o++]=O[p++]}while(--f);0===i.length&&(i.mode=ry);break;case 16205:if(0===l)break t;s[o++]=i.length,l--,i.mode=ry;break;case oy:if(i.wrap){for(;c<32;){if(0===a)break t;a--,h|=n[r++]<{if(cy(t))return Nv;let e=t.state;return e.window&&(e.window=null),t.state=null,Iv},Xv.inflateGetHeader=(t,e)=>{if(cy(t))return Nv;const i=t.state;return 0==(2&i.wrap)?Nv:(i.head=e,e.done=!1,Iv)},Xv.inflateSetDictionary=(t,e)=>{const i=e.length;let n,s,r;return cy(t)?Nv:(n=t.state,0!==n.wrap&&n.mode!==ty?Nv:n.mode===ty&&(s=1,s=Dv(s,e,i,0),s!==n.check)?Gv:(r=wy(t,e,i,i),r?(n.mode=16210,Fv):(n.havedict=1,Iv)))},Xv.inflateInfo="pako inflate (from Nodeca project)";const vy=Xv,yy=ov,Sy=lv,xy=rw,ky=uv,Qy=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},$y=Object.prototype.toString,{Z_NO_FLUSH:Py,Z_FINISH:Cy,Z_OK:_y,Z_STREAM_END:Xy,Z_NEED_DICT:Zy,Z_STREAM_ERROR:Ay,Z_DATA_ERROR:Ty,Z_MEM_ERROR:Ry}=ow;function Ey(t){this.options=yy.assign({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ky,this.strm.avail_out=0;let i=vy.inflateInit2(this.strm,e.windowBits);if(i!==_y)throw new Error(xy[i]);if(this.header=new Qy,vy.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=Sy.string2buf(e.dictionary):"[object ArrayBuffer]"===$y.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(i=vy.inflateSetDictionary(this.strm,e.dictionary),i!==_y)))throw new Error(xy[i])}function Vy(t,e){const i=new Ey(e);if(i.push(t),i.err)throw i.msg||xy[i.err];return i.result}Ey.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize,s=this.options.dictionary;let r,o,a;if(this.ended)return!1;for(o=e===~~e?e:!0===e?Cy:Py,"[object ArrayBuffer]"===$y.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),r=vy.inflate(i,o),r===Zy&&s&&(r=vy.inflateSetDictionary(i,s),r===_y?r=vy.inflate(i,o):r===Ty&&(r=Zy));i.avail_in>0&&r===Xy&&i.state.wrap>0&&0!==t[i.next_in];)vy.inflateReset(i),r=vy.inflate(i,o);switch(r){case Ay:case Ty:case Zy:case Ry:return this.onEnd(r),this.ended=!0,!1}if(a=i.avail_out,i.next_out&&(0===i.avail_out||r===Xy))if("string"===this.options.to){let t=Sy.utf8border(i.output,i.next_out),e=i.next_out-t,s=Sy.buf2string(i.output,t);i.next_out=e,i.avail_out=n-e,e&&i.output.set(i.output.subarray(t,t+e),0),this.onData(s)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(r!==_y||0!==a){if(r===Xy)return r=vy.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},Ey.prototype.onData=function(t){this.chunks.push(t)},Ey.prototype.onEnd=function(t){t===_y&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=yy.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},_v.Inflate=Ey,_v.inflate=Vy,_v.inflateRaw=function(t,e){return(e=e||{}).raw=!0,Vy(t,e)},_v.ungzip=Vy,_v.constants=ow;const{Deflate:My,deflate:Dy,deflateRaw:Wy,gzip:Uy}=mb,{Inflate:Yy,inflate:qy,inflateRaw:Ly,ungzip:zy}=_v,Iy=ow;gb.Deflate=My,gb.deflate=Dy,gb.deflateRaw=Wy,gb.gzip=Uy,gb.Inflate=Yy,gb.inflate=qy,gb.inflateRaw=Ly,gb.ungzip=zy,gb.constants=Iy;const By=gb;let jy={};var Ny;function Gy(t){return Ny=t,[tS]}jy.Util={},jy.Decode={},jy.Messages=[],jy.Log=function(t){jy.Messages.push(["I",t]),console.log("Mma.js INFO: ",t)},jy.Warn=function(t){jy.Messages.push(["W",t]),console.log("Mma.js WARNING: ",t)},jy.Fail=function(t){throw jy.Messages.push(["E",t]),"Mma.js ERROR: "+t},jy.Util.Base64Decode=function(t){for(var e=atob(t),i=e.length>>>0,n=new Uint8Array(i),s=0;s1&&0===t[0]&&jy.Fail("IntegerAP: input starts with 0: "+String(t)),this.nstring=t}else void 0===t?this.nstring=void 0:jy.Fail("Integer: invalid input: "+String(t))},jy.RealMP=function(t){"number"==typeof t?this.n=t:void 0===t?this.n=void 0:jy.Fail("RealMP: invalid input")},jy.RealAP=function(t){"string"==typeof t?(t.length>1&&0===t[0]&&jy.Fail("RealAP: input starts with 0: "+String(t)),this.nstring=t):void 0===t?this.nstring=void 0:jy.Fail("RealAP: invalid input: "+String(t))},jy.Symbol=function(t){"string"==typeof t?this.name=t:void 0===t?this.name=void 0:jy.Fail("Symbol: invalid input: "+String(t))},jy.String=function(t){"string"==typeof t?this.str=t:void 0===t?this.str=void 0:jy.Fail("String: invalid input: "+String(t))},jy.Expression=function(t,e){t instanceof jy.Symbol||jy.Fail("Expression: head must be an Mma.Symbol"),e instanceof Array||jy.Fail("Expression: parts must be an Array"),this.head=t,this.parts=e},jy.Decode.Int32=function(t,e){try{return new DataView(t.buffer).getInt32(e,!0)}catch(t){return 0}},jy.Decode.Float64=function(t,e){try{return new DataView(t.buffer).getFloat64(e,!0)}catch(t){return 0}},jy.Decode.String=function(t,e,i){return void 0===e&&(e=0),void 0===i&&(i=t.length),jy.Util.U8ArrayToString(t.slice(e,e+i))},jy.Decode.StringEntry=function(t,e){void 0===e&&(e=0);var i=jy.Decode.Int32(t,e);return{length:i,string:jy.Decode.String(t,e+4,i),bytesRead:i+4}},jy.Decode.Any=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=1/0);var n=e;for(var s=0,r=[];ee%2!=0?t:{...t,body:Lm(t.body,/\(\*\|\*\)/gm)})),Array.isArray(this.args[this.args.length-1].body)||(this.decorator=this.args.pop());const r=this.args;console.log("creating InstanceWidget");for(let t=0;t{e.viewState.state.config.eval()},update:e=>this.applyChanges(e,t,i),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i-2>=0?(o[i-2].editor.dispatch({selection:{anchor:o[i-2].editor.state.doc.length}}),o[i-2].editor.focus(),void(t.editorLastCursor=void 0)):(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0));t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i+2=0)return r[t-2].body[i].editor.focus(),void(e.editorLastCursor=void 0)}},{key:"ArrowDown",run:function(e,n){if(t+2{},focus:()=>{},dispatch:()=>{}};const t=l.match(Fy);if(t){a.innerHTML=t[1];const e=jy.DecompressDecode(t[2]),i=jy.toArray(e.parts[0]),n=uuidv4();interpretate(i,{global:{call:n},element:a})}else a.innerHTML=l.slice(1,-1)}delete o[i].body,n.appendChild(a)}i.appendChild(n)}if(this.decorator){const t=jy.DecompressDecode(this.decorator.body.slice(2,-2)),e=jy.toArray(t.parts[0]);let n={global:{call:uuidv4(),EditorWidget:s},element:i};this.interpretated=interpretate(e,n)}}applyChanges(t,e,i){const n=this.args,s=this.args[e].body,r=this.visibleValue.argsPos,o=this.args[e].from;let a=t;0==i&&0==e&&(a="{{"+a),0==i&&0!=e&&(a="{"+a),i==s.length-1&&e==n.length-1&&(a+="}}"),i==s.length-1&&e!=n.length-1&&(a+="}");const l=s[i].length,h={from:r+o+s[i].from,to:r+o+s[i].from+l,insert:a},c=a.length-l;for(let t=i+1;t{s.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.args[0].body[0].editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.args[0].body[0].editor.focus();else{const t=this.DOMElement.EditorWidget.args,e=t[t.length-1].body[t[t.length-1].body.length-1].editor;e.dispatch({selection:{anchor:e.state.doc.length}}),e.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const Ky=(t,e)=>new Bm({tag:"GB",decoration:i=>ni.replace({widget:new Jy(i,t,e)})}),tS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=Ky(this.disposable,t).createDeco(t)}update(t){this.placeholder=Ky(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});function eS(t){return[rS]}let iS=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.span=i,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this,r=this.args[1].body.slice(3,-3),o=jy.DecompressDecode(r),a=jy.toArray(o.parts[0]);this.data=a;const l="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}));this.cuid=l;let h={call:l,EditorWidget:s},c={global:h,element:i};this.expression=a,this.env=c,this.interpretated=interpretate(a,c),this.interpretated.then((()=>{if(c.options?.Event){console.warn("Event listeners are enabled!"),s.events=c.options.Event;let t=c;if(h.stack){const e=Object.values(h.stack);e.length>0&&(console.log("Attaching first found instance..."),t=e[0].env)}interpretate(["MetaMarker","'"+l+"'"],t).then((()=>{server.kernel.emitt(s.events,'"'+l+'"',"Mounted")}))}}))}getDoc(){return this.args[0].body.slice(1,-1)}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+t+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].length=s.length,this.view.dispatch({changes:r})}applyOuterChanges(t){const e=this.visibleValue,i=t,n={from:e.pos,to:e.pos+e.length,insert:i};this.view.dispatch({changes:n})}update(t){if(!this.deactivated){if(t.str!=this.visibleValue.str){console.warn("Out of sync"),console.log("recreate..."),this.destroy();const e=this.span;return e.replaceChildren(),void this._construct(t,this.view,e)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}}destroy(t){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.events&&server.kernel.emitt(this.events,'"'+this.cuid+'"',"Destroy"),delete this.data}},nS=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=this;let i=document.createElement("span");return i.classList.add("frontend-view"),i.EditorWidget=new iS(this.visibleValue,t,i),this.reference.push({destroy:()=>{e.destroy(i)}}),i}ignoreEvent(){return!0}destroy(t){console.log("destroy in general*"),t.EditorWidget.destroy()}};const sS=(t,e)=>new Bm({tag:"VB",decoration:i=>ni.replace({widget:new nS(i,t,e)})}),rS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=sS(this.disposable,t).createDeco(t)}update(t){this.placeholder=sS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var oS;function aS(t){return oS=t,[uS]}let lS=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.span=i,this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this;this.epilog={offset:0,string:""},this.prolog={offset:0,string:""};const r=this.args[1].body.slice(3,-3),o=jy.DecompressDecode(r),a=jy.toArray(o.parts[0]);this.data=a;let l={global:{call:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)})),element:i,origin:s},element:i};this.env=l,interpretate(a,l).then((()=>{if(l.options?.Head&&(s.prolog.offset=l.options.Head.length+1,s.prolog.string=l.options.Head+"[",s.epilog.offset=1,s.epilog.string="]"),l.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=l.options.Event),l.options?.String){s.prolog.offset=1,s.prolog.string='"',s.epilog.offset=1,s.epilog.string='"',l.options?.HeadString&&(s.prolog.string=l.options.HeadString,s.prolog.offset=s.prolog.string.length),l.options?.TailString&&(s.epilog.string=l.options.TailString,s.epilog.offset=s.epilog.string.length),s.editor={destroy:()=>{console.log("Nothing to destroy, this is just a text field.")}};const t=document.createElement("span");return this.aa,t.onkeydown=function(t){13===t.keyCode&&t.preventDefault()},t.contentEditable="plaintext-only",t.innerText=s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),t.addEventListener("input",console.log),t.addEventListener("input",(()=>{console.log("Update"),console.log(t.innerText),this.applyChanges(t.innerText)})),l.global.element.appendChild(t),void(s.events&&server.kernel.emitt(s.events,"Null","Mounted"))}s.editor=oS({doc:s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),parent:l.global.element,update:t=>this.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos+s.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]}),s.events&&server.kernel.emitt(s.events,"Null","Mounted")}))}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+this.prolog.string+t+this.epilog.string+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length));const o=s.length-i[0].length;i[0].length=s.length,this.visibleValue.length=this.visibleValue.length+o,this.view.dispatch({changes:r})}update(t){if(this.visibleValue.str!=t.str)return console.warn("Out of sync"),console.log("recreating InstanceWidget"),this.destroy(),this.span.replaceChildren(),void this._construct(t,this.view,this.span);this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.editor.destroy(),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}},hS=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("subscript-tail"),e.EditorWidget=new lS(this.visibleValue,t,e,[]);const i=this;return this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const cS=(t,e)=>new Bm({tag:"BB",decoration:i=>ni.replace({widget:new hS(i,t,e)})}),uS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=cS(this.disposable,t).createDeco(t)}update(t){this.placeholder=cS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var dS;function fS(t){return dS=t,[mS]}class pS{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm);const s=this,r=Array.from({length:Math.ceil((s.args.length-3)/2)},((t,e)=>2*e+1));s.indexes=r;const o=[];this.span=i,this.spans=o;for(let t=0;t{c.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=c.options.Event),s.editors=r.map(((t,i)=>dS({doc:s.args[t].body,parent:o[i],update:e=>this.applyChanges(e,t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i>0?s.editors[i-1].focus():(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus()),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return it.destroy())),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}}class OS extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("inline-flex"),e.EditorWidget=new pS(this.visibleValue,t,e,[]);const i=this;return this.DOMElement=e,this.reference.push({destroy:()=>{i.destroy(e)}}),e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;const n=this.DOMElement.EditorWidget.editors;return t.from-e.from<0?(n[n.length-1].dispatch({selection:{anchor:n[n.length-1].state.doc.length}}),n[n.length-1].focus()):(n[0].dispatch({selection:{anchor:0}}),n[0].focus()),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}}const gS=(t,e)=>new Bm({tag:"TB",decoration:i=>ni.replace({widget:new OS(i,t,e)})}),mS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=gS(this.disposable,t).createDeco(t)}update(t){this.placeholder=gS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});const bS=_i.fromClass(class{decorations=ni.none;constructor(t){this.view=t,this.recompute()}recompute(t){let e,i,n=[];for(let{from:t,to:e}of this.view.visibleRanges)this.getDecorationsFor(t,e,n);this.decorations=ni.set(n,!0),this.decorations=this.decorations.update({filter:(n,s)=>!(n>e&&s=e&&s.selection.main.head<=i)return!0;if(!n&&s.selection.main.head>e&&s.selection.main.headt.decorations});class wS extends ei{constructor(t,e){super(),this.rawValue=t,this.visibleValue=e}eq(t){return this.rawValue===t.rawValue}toDOM(){let t=document.createElement("div");t.classList.add("cell-type-widget");const e=this.rawValue.split(" "),i=e[0].split(".");if(console.log(i),t.classList.add("cell-type-"+i[1].trim()),t.innerText=e[0].trim(),e.length>1){const n=e.slice(1),s=document.createElement("span");return s.appendChild(t),n.forEach((t=>{const e=document.createElement("span");e.innerText=t,e.classList.add("cell-type-"+i[1].trim()+"-"+t.split("=")[0]),s.appendChild(e)})),s}return t}ignoreEvent(){return!1}}const vS=new F,yS=new F,SS=[],xS=Sl.define([{tag:Sa.meta,color:"var(--editor-key-meta)"},{tag:Sa.link,textDecoration:"underline"},{tag:Sa.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Sa.emphasis,fontStyle:"italic"},{tag:Sa.strong,fontWeight:"bold"},{tag:Sa.strikethrough,textDecoration:"line-through"},{tag:Sa.keyword,color:"var(--editor-key-keyword)"},{tag:[Sa.atom,Sa.bool,Sa.url,Sa.contentSeparator,Sa.labelName],color:"var(--editor-key-atom)"},{tag:[Sa.literal,Sa.inserted],color:"var(--editor-key-literal)"},{tag:[Sa.string,Sa.deleted],color:"var(--editor-key-string)"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],color:"var(--editor-key-escape)"},{tag:Sa.definition(Sa.variableName),color:"var(--editor-key-variable)"},{tag:Sa.local(Sa.variableName),color:"var(--editor-local-variable)"},{tag:[Sa.typeName,Sa.namespace],color:"var(--editor-key-type)"},{tag:Sa.className,color:"var(--editor-key-class)"},{tag:[Sa.special(Sa.variableName),Sa.macroName],color:"var(--editor-special-variable)"},{tag:Sa.definition(Sa.propertyName),color:"var(--editor-key-property)"},{tag:Sa.comment,color:"var(--editor-key-comment)"},{tag:Sa.invalid,color:"var(--editor-key-invalid)"}]),kS={data:[],extend:t=>{kS.data.push(...t),Qm.reBuild(kS.data)},replaceAll:t=>{kS.data=t,Qm.reBuild(kS.data)}},QS=Gl.define({name:"spreadsheet",startState:function(){return{stringType:null,stack:[]}},token:function(t,e){if(t){switch(0===e.stack.length&&('"'!=t.peek()&&"'"!=t.peek()||(e.stringType=t.peek(),t.next(),e.stack.unshift("string"))),e.stack[0]){case"string":for(;"string"===e.stack[0]&&!t.eol();)t.peek()===e.stringType?(t.next(),e.stack.shift()):"\\"===t.peek()?(t.next(),t.next()):t.match(/^.[^\\\"\']*/);return"string";case"characterClass":for(;"characterClass"===e.stack[0]&&!t.eol();)t.match(/^[^\]\\]+/)||t.match(/^\\./)||e.stack.shift();return"operator"}var i=t.peek();switch(i){case"[":return t.next(),e.stack.unshift("characterClass"),"bracket";case":":return t.next(),"operator";case"\\":return t.match(/\\[a-z]+/)?"string.special":(t.next(),"atom");case".":case",":case";":case"*":case"-":case"+":case"^":case"<":case"/":case"=":return t.next(),"atom";case"$":return t.next(),"builtin"}return t.match(/\d+/)?t.match(/^\w+/)?"error":"number":t.match(/^[a-zA-Z_]\w*/)?t.match(/(?=[\(.])/,!1)?"keyword":"variable":-1!=["[","]","(",")","{","}"].indexOf(i)?(t.next(),"bracket"):(t.eatSpace()||t.next(),null)}}}),$S=new RegExp(/^[\w]*\.[\w]+/);function PS(t){const e=$S.exec(t),i=Object.values(window.SupportedLanguages);for(let t=0;t{if(!t.docChanged)return null;let e=PS(t.newDoc.line(1).text);if(e.legacy){const i=t.startState.facet(Wa);if(i){if(i.name==e.name)return null}else if(t.startState.facet(CS)==e.name)return null;return console.log("switching... to "+e.name),{effects:vS.reconfigure(e.plugins)}}return e.name===t.startState.facet(Wa).name?null:(console.log("switching... to "+e.name),{effects:vS.reconfigure(e.plugins)})}));let XS,ZS=null;const AS=t=>{const e=t||XS;return e&&e.viewState?(console.log(),PS(e.state.doc.line(1).text).name):""},TS=t=>{const e=t||XS;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return!1;const n=i[0];return[n.from,n.to]},RS=t=>{const e=t||XS;return e&&e.viewState?e.state.doc.toString():""},ES=t=>{const e=t||XS;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return"";const n=i[0];return console.log("yoko"),console.log(n),console.log(e.state.doc.toString().slice(n.from,n.to)),console.log("processing"),e.state.doc.toString().slice(n.from,n.to)},VS=(t,e)=>{const i=e||XS;if(!i)return;if(!i.viewState)return;const n=i.viewState.state.selection.ranges;if(!n.length)return;const s=n[0];console.log("result"),console.log(t),i.dispatch({changes:{...s,insert:t}})},MS=()=>XS,DS=(t,e)=>{const i=e||XS;i&&i.viewState&&(console.log("result"),console.log(t),i.dispatch({changes:{from:0,to:i.viewState.state.doc.length,insert:t}}))};ZS=t=>{let e=new Ts({doc:t.doc,extensions:[Ys.of([{key:"Tab",run:function(t,e){return sd(t)}},{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,LS,Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(XS=e.view)}))],parent:t.parent});return e.viewState.state.config.eval=t.eval,e},ZS.state=t=>{let e=xt.create({doc:t.doc,extensions:[Ys.of([{key:"Tab",run:function(t,e){return sd(t)}},{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,LS,Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(XS=e.view)}))]});return e.config.eval=t.eval,e};const WS={transaction:(t,e,i,n)=>{if(console.log(e.dom.ocellref),e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:DropEvent"]')}},file:(t,e,i,n,s)=>{console.log(e.dom.ocellref),e.dom.ocellref&&server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},US={transaction:(t,e,i,n)=>{if(console.log(e.dom.ocellref),e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:PasteEvent"]')}},file:(t,e,i,n,s)=>{console.log(e.dom.ocellref),e.dom.ocellref&&server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},YS=[Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Cm(WS,US)];let qS=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"}}),LS=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"},".cm-scroller":{"line-height":"inherit","overflow-x":"overlay","overflow-y":"overlay","align-items":"initial"},".cm-content":{padding:"0px 0"},".rainbow-bracket-red":{color:"var(--editor-bracket-1)"},".rainbow-bracket-orange":{color:"var(--editor-bracket-2)"},".rainbow-bracket-yellow":{color:"var(--editor-bracket-3)"},".rainbow-bracket-green":{color:"var(--editor-bracket-4)"},".rainbow-bracket-blue":{color:"var(--editor-bracket-5)"},".rainbow-bracket-indigo":{color:"var(--editor-bracket-6)"},".rainbow-bracket-violet":{color:"var(--editor-bracket-7)"},".rainbow-bracket-red > span":{color:"var(--editor-bracket-1-a)"},".rainbow-bracket-orange > span":{color:"var(--editor-bracket-2-a)"},".rainbow-bracket-yellow > span":{color:"var(--editor-bracket-3-a)"},".rainbow-bracket-green > span":{color:"var(--editor-bracket-4-a)"},".rainbow-bracket-blue > span":{color:"var(--editor-bracket-5-a)"},".rainbow-bracket-indigo > span":{color:"var(--editor-bracket-6-a)"},".rainbow-bracket-violet > span":{color:"var(--editor-bracket-7-a)"}}),zS=!1;const IS=[()=>vr(),()=>Sh(),()=>ir(),()=>dr(),()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xS,{fallback:!1}),()=>tu()],BS={},jS=[()=>vr(),()=>Sh(),()=>ir(),()=>dr(),t=>NS.of(t),()=>BS.gutter?function(t={}){return[eo.of(t),jr(),so]}():[],()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xS,{fallback:!1}),()=>tu(),()=>bS,()=>function(t){return _i.fromClass(class{constructor(e){this.view=e,this.placeholder=ni.set([ni.widget({widget:new kr(t),side:1}).range(0)])}get decorations(){return this.view.state.doc.length?ni.none:this.placeholder}},{decorations:t=>t.decorations})}("Type WL Expression / .md / .js"),()=>xt.allowMultipleSelections.of(!0),(t,e)=>vS.of(e),()=>yS.of(xt.readOnly.of(!1)),()=>_S,()=>{return t?[ou.of(t),Yu]:Yu;var t},(t,e)=>Ys.of([{key:"Tab",run:function(t,e){const i=sd(t);return i||Rc(t)},shift:Ec},{key:"Backspace",run:function(e,i){if(0===e.state.doc.length)return t.origin.remove(),!0}},{key:"ArrowLeft",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus prev"),t.origin.focusPrev(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus next"),t.origin.focusNext(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"Shift-Enter",preventDefault:!0,run:function(e,i){console.log(e.state.doc.toString()),t.origin.eval(e.state.doc.toString())}},...Vc,...Wh,...Ru]),(t,e)=>Ts.updateListener.of((e=>{e.docChanged&&t.origin.save(encodeURIComponent(e.state.doc.toString())),e.selectionSet&&(XS=e.view)})),()=>qS];const NS=E.define();function GS(t){return t.replace(/\\\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\\\:/g,""),16))})).replaceAll("\\:F74E","I").replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))}function FS(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(t=>(+t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+t/4).toString(16)))}core.ReadOnly=()=>"ReadOnly",core.EditorView=async(t,e)=>{let i=await interpretate(t[0],e);i=GS(i),console.log("UNICODE Disaster");const n=await core._getRules(t,e);let s=()=>{},r=()=>{},o=i;const a=[];n.ReadOnly&&a.push(xt.readOnly.of(!0)),n.ForceUpdate&&(e.local.forceUpdate=n.ForceUpdate),n.Event&&(r=t=>{o=t,console.log("editor view emitt data: "+t),server.kernel.emitt(n.Event,'"'+t.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Input")},s=()=>{server.kernel.emitt(n.Event,'"'+o.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Evaluate")}),e.local?e.local.editor=ZS({doc:i,parent:e.element,eval:s,update:r,extensions:a}):ZS({doc:i,parent:e.element,eval:s,update:r,extensions:a}),e.element.style.verticalAlign="inherit"},core.StripOnInput=async()=>{},core.EditorView.update=async(t,e)=>{if(!e.local.editor)return;const i=GS(await interpretate(t[0],e));console.log("editor view: dispatch"),e.local.forceUpdate,e.local.editor.dispatch({changes:{from:0,to:e.local.editor.state.doc.length,insert:i}})},core.EditorView.destroy=async(t,e)=>{await interpretate(t[0],e),e.local&&e.local.editor&&e.local.editor.destroy()},core.EditorView.virtual=!0,core.PreviewCell=(t,e)=>{},window.SupportedLanguages.push({check:t=>null===t,legacy:!0,plugins:YS,name:"mathematica"}),window.SupportedLanguages.push({check:t=>null!=t[0].match(/\w+\.(wl|wls)$/),plugins:YS,legacy:!0,name:"mathematica"}),window.SupportedCells.codemirror={view:class{origin={};editor={};trash=[];forceFocusNext(){zS=!0}focus(t){t>0?this.editor.dispatch({selection:{anchor:0}}):t<0&&this.editor.dispatch({selection:{anchor:this.editor.state.doc.length}}),this.editor.focus()}setContent(t){if(console.warn("content mutation!"),!this.editor.viewState)return;const e=this.editor;console.log("result"),console.log(t),this.editor.dispatch({changes:{from:0,to:e.viewState.state.doc.length,insert:t}})}addDisposable(t){this.trash.push(t)}dispose(){this.editor.destroy()}readOnly(t){this.editor.dispatch({effects:yS.reconfigure(xt.readOnly.of(t))})}constructor(t,e){this.origin=t;const i=this.origin,n=PS(e).plugins,s=this;this.origin.element.ocellref=s;const r=new Ts({doc:(o=e,o.replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))),extensions:jS.map((t=>t(s,n))),parent:this.origin.element});var o;return this.editor=r,this.editor.dom.ocellref=s,this.editor.viewState.state.config.eval=()=>{i.eval(this.editor.state.doc.toString())},zS&&r.focus(),zS=!1,this}},context:{EditorAutocomplete:kS,javascriptLanguage:qf,javascript:Nf,markdownLanguage:rm,markdown:function(t={}){let{codeLanguages:e,defaultCodeLanguage:i,addKeymap:n=!0,base:{parser:s}=sm}=t;if(!(s instanceof Zp))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let r,o=t.extensions?[t.extensions]:[],a=[dm.support];i instanceof Ua?(a.push(i.support),r=i.language):i&&(r=i);let l=e||r?(h=e,c=r,t=>{if(t&&h){let e=null;if(t=/\S*/.exec(t)[0],e="function"==typeof h?h(t):Ya.matchLanguageName(h,t,!0),e instanceof Ya)return e.support?e.support.language.parser:Ta.getSkippingParser(e.load());if(e)return e.parser}return c?c.parser:null}):void 0;var h,c;return o.push(function(t){let{codeParser:e,htmlParser:i}=t,n=Do(((t,n)=>{let s=t.type.id;if(!e||s!=Kf.CodeBlock&&s!=Kf.FencedCode){if(i&&(s==Kf.HTMLBlock||s==Kf.HTMLTag))return{parser:i,overlay:rO(t.node,t.from,t.to)}}else{let i="";if(s==Kf.FencedCode){let e=t.node.getChild(Kf.CodeInfo);e&&(i=n.read(e.from,e.to))}let r=e(i);if(r)return{parser:r,overlay:t=>t.type.id==Kf.CodeText}}return null}));return{wrap:n}}({codeParser:l,htmlParser:dm.language.parser})),n&&a.push(N.high(Ys.of(um))),new Ua(nm(s.configure(o)),a)},htmlLanguage:jg,html:Ng,cssLanguage:kg,css:Qg,EditorView:Ts,EditorState:xt,highlightSpecialChars:vr,syntaxHighlighting:$l,defaultHighlightStyle:xS,editorCustomTheme:qS,foldGutter:function(t={}){let e=Object.assign(Object.assign({},wl),t),i=new vl(e,!0),n=new vl(e,!1),s=_i.fromClass(class{constructor(t){this.from=t.viewport.from,this.markers=this.buildMarkers(t)}update(t){(t.docChanged||t.viewportChanged||t.startState.facet(Wa)!=t.state.facet(Wa)||t.startState.field(dl,!1)!=t.state.field(dl,!1)||Xa(t.startState)!=Xa(t.state)||e.foldingChanged(t))&&(this.markers=this.buildMarkers(t.view))}buildMarkers(t){let e=new Xt;for(let s of t.viewportLineBlocks){let r=fl(t.state,s.from,s.to)?n:ll(t.state,s.from,s.to)?i:null;r&&e.add(s.from,s.from,r)}return e.finish()}}),{domEventHandlers:r}=e;return[s,Ir({class:"cm-foldGutter",markers(t){var e;return(null===(e=t.plugin(s))||void 0===e?void 0:e.markers)||_t.empty},initialSpacer:()=>new vl(e,!1),domEventHandlers:Object.assign(Object.assign({},r),{click:(t,e,i)=>{if(r.click&&r.click(t,e,i))return!0;let n=fl(t.state,e.from,e.to);if(n)return t.dispatch({effects:ul.of(n)}),!0;let s=ll(t.state,e.from,e.to);return!!s&&(t.dispatch({effects:cl.of(s)}),!0)}})}),ml()]},Facet:E,Compartment:F,mathematicaPlugins:YS,legacyLangNameFacet:CS,DropPasteHandlers:Cm,EditorExtensionsMinimal:IS,EditorParameters:BS,EditorExtensions:jS,StateField:q,Decoration:ni,ViewPlugin:_i,WidgetType:ei,originFacet:NS,MatchDecorator:pr}},window.OfflineMode&&SS.push(xt.readOnly.of(!0)),core.CellView=async(t,e)=>{const i=await core._getRules(t,e);i.Display||(i.Display="codemirror");const n=await interpretate(t[0],e),s={element:e.element,uid:FS()};i.Style&&(e.element.style=i.Style),i.Class&&e.element.classList.add(...i.Class.split(" ")),i.ImageSize&&(Array.isArray(i.ImageSize)?(e.element.style.width=i.ImageSize[0]+"px",e.element.style.height=i.ImageSize[1]+"px"):e.element.style.width=i.ImageSize+"px"),new window.SupportedCells[i.Display].view(s,n)};const HS={};core.FrontEditorSelected=async(t,e)=>{console.log("check");const i=await interpretate(t[0],e),n=await core._getRules(t,e);let s;switch(n.Editor&&(s=HS[n.Editor],console.log("Editor"),console.log(n.Editor),console.log(s)),i){case"Get":return ES(s);case"Set":let i=await interpretate(t[1],e);VS(i,s);break;case"GetDoc":return RS(s);case"SetDoc":let n=await interpretate(t[1],e);DS(n,s);break;case"Cursor":return TS(s);case"Type":return AS(s);case"Editor":const r=FS();return HS[r]=MS(),r}}; +class t{constructor(){}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 a(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}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 l(n,o,i,r);n=o+1,i++}}decompose(t,i,r,o){let a=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(a.text,t.text.slice(),0,a.length);if(i.length<=32)r.push(new e(i,t.length+a.length));else{let t=i.length>>1;r.push(new e(i.slice(0,t)),new e(i.slice(t)))}}else r.push(a)}replace(t,r,o){if(!(o instanceof e))return super.replace(t,r,o);let a=n(this.text,n(o.text,s(this.text,0,t)),r),l=this.length+o.length-(r-t);return a.length<=32?new e(a,l):i.from(e.split(a,[]),l)}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=a+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,a=i+r.lines-1;if((e?a:o)>=t)return r.lineInner(t,e,i,n);n=o+1,i=a+1}}decompose(t,e,i,n){for(let s=0,r=0;r<=e&&s=r){let s=n&((r<=t?1:0)|(a>=e?2:0));r>=t&&a<=e&&!s?i.push(o):o.decompose(t-r,e-r,i,s)}r=a+1}}replace(t,e,n){if(n.lines=r&&e<=a){let l=o.replace(t-r,e-r,n),h=this.lines-o.lines+l.lines;if(l.lines>4&&l.lines>h>>6){let r=this.children.slice();return r[s]=l,new i(r,this.length-(e-t)+n.length)}return super.replace(r,a,l)}r=a+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=a+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,a]=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==a)return n;let i=this.children[s],l=t.children[r];if(i!=l)return n+i.scanIdentical(l,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,a=r>>1,l=[],h=0,c=-1,u=[];function d(t){let n;if(t.lines>o&&t instanceof i)for(let e of t.children)d(e);else t.lines>a&&(h>a||!h)?(f(),l.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&&f(),h+=t.lines,c+=t.length+1,u.push(t))}function f(){0!=h&&(l.push(1==u.length?u[0]:i.from(u,c)),c=-1,h=u.length=0)}for(let e of t)d(e);return f(),1==l.length?l[0]:new i(l,n)}}function n(t,e,i=0,n=1e9){for(let s=0,r=0,o=!0;r=i&&(l>n&&(a=a.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,a=s instanceof e?s.text.length:s.children.length;if(o==(i>0?a: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 a{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]=a.prototype[Symbol.iterator]=function(){return this});let l=class{constructor(t,e,i,n){this.from=t,this.to=e,this.number=i,this.text=n}get length(){return this.to-this.from}},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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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 d=8205;function f(t,e,i=!0,n=!0){return(i?p:O)(t,e,n)}function p(t,e,i){if(e==t.length)return e;e&&g(t.charCodeAt(e))&&m(t.charCodeAt(e-1))&&e--;let n=b(t,e);for(e+=v(n);e=0&&u(b(t,n));)i++,n-=2;if(i%2==0)break;e+=2}}}return e}function O(t,e,i){for(;e>0;){let n=p(t,e-2,i);if(n=56320&&t<57344}function m(t){return t>=55296&&t<56320}function b(t,e){let i=t.charCodeAt(e);if(!m(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return g(n)?n-56320+(i-55296<<10)+65536:i}function w(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function v(t){return t<65536?1:2}const y=/\r\n?|\n/;var S=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(S||(S={}));class x{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;et)return s+(t-n);s+=o}else{if(i!=S.Simple&&l>=t&&(i==S.TrackDel&&nt||i==S.TrackBefore&&nt))return null;if(l>t||l==t&&e<0&&!o)return t==n||e<0?s:s+a;s+=a}n=l}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 x(t)}static create(t){return new x(t)}}class k extends x{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 P(this,((e,i,n,s,r)=>t=t.replace(n,n+(i-e),r)),!1),t}mapDesc(t,e=!1){return C(this,t,e,!0)}invert(e){let i=this.sections.slice(),n=[];for(let s=0,r=0;s=0){i[s]=a,i[s+1]=o;let l=s>>1;for(;n.length0&&$(i,e,s.text),s.forward(t),o+=t}let l=t[r++];for(;o>1].toJSON()))}return t}static of(e,i,n){let s=[],r=[],o=0,a=null;function l(t=!1){if(!t&&!s.length)return;oa||e<0||a>i)throw new RangeError(`Invalid change range ${e} to ${a} (in doc of length ${i})`);let u=c?"string"==typeof c?t.of(c.split(n||y)):c:t.empty,d=u.length;if(e==a&&0==d)return;eo&&Q(s,e-o,-1),Q(s,a-e,d),$(r,s,u),o=a}}(e),l(!a),a}static empty(t){return new k(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 $(e,i,n){if(0==n.length)return;let s=i.length-2>>1;if(s>1])),!(n||a==e.sections.length||e.sections[a+1]<0);)l=e.sections[a++],h=e.sections[a++];i(r,c,o,u,d),r=c,o=u}}}function C(t,e,i,n=!1){let s=[],r=n?[]:null,o=new X(t),a=new X(e);for(let t=-1;;)if(-1==o.ins&&-1==a.ins){let t=Math.min(o.len,a.len);Q(s,t,-1),o.forward(t),a.forward(t)}else if(a.ins>=0&&(o.ins<0||t==o.i||0==o.off&&(a.len=0&&t=0)){if(o.done&&a.done)return r?k.createSet(s,r):x.create(s);throw new Error("Mismatched change set lengths")}{let e=0,i=o.len;for(;i;)if(-1==a.ins){let t=Math.min(i,a.len);e+=t,i-=t,a.forward(t)}else{if(!(0==a.ins&&a.lene||o.ins>=0&&o.len>e)&&(t||n.length>i),r.forward2(e),o.forward(e)}}else Q(n,0,o.ins,t),s&&$(s,n,o.text),o.next()}}class X{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 Z{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 Z(i,n,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return A.range(t,e);let i=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return A.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 A.range(t.anchor,t.head)}static create(t,e,i){return new Z(t,e,i)}}class A{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:A.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 A(t.ranges.map((t=>Z.fromJSON(t))),t.main)}static single(t,e=t){return new A([A.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?A.range(o,r):A.range(r,o))}}return new A(t,e)}}function T(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let R=0;class E{constructor(t,e,i,n,s){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=n,this.id=R++,this.default=t([]),this.extensions="function"==typeof s?s(this):s}static define(t={}){return new E(t.combine||(t=>t),t.compareInput||((t,e)=>t===e),t.compare||(t.combine?(t,e)=>t===e:V),!!t.static,t.enables)}of(t){return new M([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,2,e)}from(t,e){return e||(e=t=>t),this.compute([t],(i=>e(i.field(t))))}}function V(t,e){return t==e||t.length==e.length&&t.every(((t,i)=>t===e[i]))}class M{constructor(t,e,i,n){this.dependencies=t,this.facet=e,this.type=i,this.value=n,this.id=R++}dynamicSlot(t){var e;let i=this.value,n=this.facet.compareInput,s=this.id,r=t[s]>>1,o=2==this.type,a=!1,l=!1,h=[];for(let i of this.dependencies)"doc"==i?a=!0:"selection"==i?l=!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(a&&e.docChanged||l&&(e.docChanged||e.selection)||W(t,h)){let e=i(t);if(o?!D(e,t.values[r],n):!n(e,t.values[r]))return t.values[r]=e,1}return 0},reconfigure:(t,e)=>{let a,l=e.config.address[s];if(null!=l){let s=tt(e,l);if(this.dependencies.every((i=>i instanceof E?e.facet(i)===t.facet(i):!(i instanceof q)||e.field(i,!1)==t.field(i,!1)))||(o?D(a=i(t),s,n):n(a=i(t),s)))return t.values[r]=s,0}else a=i(t);return t.values[r]=a,1}}}}function D(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 a(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(Y).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,Y.of({field:this,create:t})]}get extension(){return this}}const L=4,z=3,I=2,B=1;function j(t){return e=>new G(e,t)}const N={highest:j(0),high:j(B),default:j(I),low:j(z),lowest:j(L)};class G{constructor(t,e){this.inner=t,this.prec=e}}class F{of(t){return new H(this,t)}reconfigure(t){return F.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class H{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;function r(t,o){let a=s.get(t);if(null!=a){if(a<=o)return;let e=n[a].indexOf(t);e>-1&&n[a].splice(e,1),t instanceof H&&i.delete(t.compartment)}if(s.set(t,o),Array.isArray(t))for(let e of t)r(e,o);else if(t instanceof H){if(i.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");let n=e.get(t.compartment)||t.inner;i.set(t.compartment,n),r(n,o)}else if(t instanceof G)r(t.inner,t.prec);else if(t instanceof q)n[o].push(t),t.provides&&r(t.provides,o);else if(t instanceof M)n[o].push(t),t.facet.extensions&&r(t.facet.extensions,I);else{let e=t.extension;if(!e)throw new Error(`Unrecognized extension value in extension set (${t}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(e,o)}}return r(t,I),n.reduce(((t,e)=>t.concat(e)))}(t,e,r))i instanceof q?n.push(i):(s[i.facet.id]||(s[i.facet.id]=[])).push(i);let o=Object.create(null),a=[],l=[];for(let t of n)o[t.id]=l.length<<1,l.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]=a.length<<1|1,V(r,e))a.push(i.facet(n));else{let t=n.combine(e.map((t=>t.value)));a.push(i&&n.compare(t,i.facet(n))?i.facet(n):t)}else{for(let t of e)0==t.type?(o[t.id]=a.length<<1|1,a.push(t.value)):(o[t.id]=l.length<<1,l.push((e=>t.dynamicSlot(e))));o[n.id]=l.length<<1,l.push((t=>U(t,n,e)))}}let c=l.map((t=>t(o)));return new J(t,r,c,o,a,s)}}function K(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 tt(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}const et=E.define(),it=E.define({combine:t=>t.some((t=>t)),static:!0}),nt=E.define({combine:t=>t.length?t[0]:void 0,static:!0}),st=E.define(),rt=E.define(),ot=E.define(),at=E.define({combine:t=>!!t.length&&t[0]});class lt{constructor(t,e){this.type=t,this.value=e}static define(){return new ht}}class ht{of(t){return new lt(this,t)}}class ct{constructor(t){this.map=t}of(t){return new ut(this,t)}}class ut{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 ut(this.type,e)}is(t){return this.type==t}static define(t={}){return new ct(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}}ut.reconfigure=ut.define(),ut.appendConfig=ut.define();class dt{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&&T(i,e.newLength),s.some((t=>t.type==dt.time))||(this.annotations=s.concat(dt.time.of(Date.now())))}static create(t,e,i,n,s,r){return new dt(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(dt.userEvent);return!(!e||!(e==t||e.length>t.length&&e.slice(0,t.length)==t&&"."==e[t.length]))}}function ft(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=pt(n,Ot(e,r,t.changes.newLength),!0))}return n==t?t:dt.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(st)){let e=n(t);if(!1===e){i=!1;break}Array.isArray(e)&&(i=!0===i?e:ft(i,e))}if(!0!==i){let n,s;if(!1===i)s=t.changes.invertedDesc,n=k.empty(e.doc.length);else{let e=t.changes.filter(i);n=e.changes,s=e.filtered.mapDesc(e.changes).invertedDesc}t=dt.create(e,n,t.selection&&t.selection.map(s),ut.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let n=e.facet(rt);for(let i=n.length-1;i>=0;i--){let s=n[i](t);t=s instanceof dt?s:Array.isArray(s)&&1==s.length&&s[0]instanceof dt?s[0]:gt(e,bt(s),!1)}return t}(s):s)}dt.time=lt.define(),dt.userEvent=lt.define(),dt.addToHistory=lt.define(),dt.remote=lt.define();const mt=[];function bt(t){return null==t?mt:Array.isArray(t)?t:[t]}var wt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(wt||(wt={}));const vt=/[\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){}function St(t){return e=>{if(!/\S/.test(e))return wt.Space;if(function(t){if(yt)return yt.test(t);for(let e=0;e"€"&&(i.toUpperCase()!=i.toLowerCase()||vt.test(i)))return!0}return!1}(e))return wt.Word;for(let i=0;i-1)return wt.Word;return wt.Other}}class xt{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(ut.reconfigure)?(i=null,n=e.value):e.is(ut.appendConfig)&&(i=null,n=bt(n).concat(e.value));if(i)e=t.startState.values.slice();else{i=J.resolve(n,s,this),e=new xt(i,this.doc,this.selection,i.dynamicSlots.map((()=>null)),((t,e)=>e.reconfigure(t,this)),null).values}new xt(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:A.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=bt(i.effects);for(let i=1;is.spec.fromJSON(r,t))))}return xt.create({doc:t.doc,selection:A.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(xt.lineSeparator)||y)),s=e.selection?e.selection instanceof A?e.selection:A.single(e.selection.anchor,e.selection.head):A.single(0);return T(s,n.length),i.staticFacet(it)||(s=s.asSingle()),new xt(i,n,s,i.dynamicSlots.map((()=>null)),((t,e)=>e.create(t)),null)}get tabSize(){return this.facet(xt.tabSize)}get lineBreak(){return this.facet(xt.lineSeparator)||"\n"}get readOnly(){return this.facet(at)}phrase(t,...e){for(let e of this.facet(xt.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(et))for(let r of s(this,e,i))Object.prototype.hasOwnProperty.call(r,t)&&n.push(r[t]);return n}charCategorizer(t){return St(this.languageDataAt("wordChars",t).join(""))}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=f(e,r,!1);if(s(e.slice(t,r))!=wt.Word)break;r=t}for(;ot.length?t[0]:4}),xt.lineSeparator=nt,xt.readOnly=at,xt.phrases=E.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]))}}),xt.languageData=et,xt.changeFilter=st,xt.transactionFilter=rt,xt.transactionExtender=ot,F.reconfigure=ut.define();class Qt{eq(t){return this==t}range(t,e=t){return $t.create(t,e,this)}}Qt.prototype.startSide=Qt.prototype.endSide=0,Qt.prototype.point=!1,Qt.prototype.mapMode=S.TrackDel;let $t=class t{constructor(t,e,i){this.from=t,this.to=e,this.value=i}static create(e,i,n){return new t(e,i,n)}};function Pt(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Ct{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,a=s[n]-t||(i?this.value[n].endSide:this.value[n].startSide)-e;if(n==r)return a>=0?r:o;a>=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||l==h&&c.startSide>0&&c.endSide<=0)continue;(h-l||c.endSide-c.startSide)<0||(r<0&&(r=l),c.point&&(o=Math.max(o,h-l)),i.push(c),n.push(l-r),s.push(h-r))}return{mapped:i.length?new Ct(n,s,i,o):null,pos:r}}}class _t{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 _t(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(Pt)),this.isEmpty)return e.length?_t.of(e):this;let o=new At(this,null,-1).goto(0),a=0,l=[],h=new Xt;for(;o.value||a=0){let t=e[a++];h.addInner(t.from,t.to,t.value)||l.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 Tt.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return Tt.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)),a=Zt(r,o,i),l=new Et(r,a,s),h=new Et(o,a,s);i.iterGaps(((t,e,i)=>Vt(l,t,h,e,i,n))),i.empty&&0==i.length&&Vt(l,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=Zt(s,r),a=new Et(s,o,0).goto(i),l=new Et(r,o,0).goto(i);for(;;){if(a.to!=l.to||!Mt(a.active,l.active)||a.point&&(!l.point||!a.point.eq(l.point)))return!1;if(a.to>n)return!0;a.next(),l.next()}}static spans(t,e,i,n,s=-1){let r=new Et(t,null,s).goto(e),o=e,a=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,a),a=r.openEnd(t));if(r.to>i)return a+(r.point&&r.to>i?1:0);o=r.to,r.next()}}static of(t,e=!1){let i=new Xt;for(let n of t instanceof $t?[t]:e?function(t){if(t.length>1)for(let e=t[0],i=1;i0)return t.slice().sort(Pt);e=n}return t}(t):t)i.add(n.from,n.to,n.value);return i.finish()}}_t.empty=new _t([],[],null,-1),_t.empty.nextLayer=_t.empty;class Xt{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}finishChunk(t){this.chunks.push(new Ct(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=[])}add(t,e,i){this.addInner(t,e,i)||(this.nextLayer||(this.nextLayer=new Xt)).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(_t.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;let e=_t.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function Zt(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 At(r,e,i,s));return 1==n.length?n[0]:new Tt(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--)Rt(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--)Rt(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(),Rt(this.heap,0)}}}function Rt(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 Et{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=Tt.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){Dt(this.active,t),Dt(this.activeTo,t),Dt(this.activeRank,t),this.minActive=Ut(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&&Dt(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 Vt(t,e,i,n,s,r){t.goto(e),i.goto(n);let o=n+s,a=n,l=n-e;for(;;){let e=t.to+l-i.to||t.endSide-i.endSide,n=e<0?t.to+l: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))&&Mt(t.activeForPoint(t.to+l),i.activeForPoint(i.to))||r.comparePoint(a,s,t.point,i.point):s>a&&!Mt(t.active,i.active)&&r.compareRange(a,s,t.active,i.active),n>o)break;a=n,e<=0&&t.next(),e>=0&&i.next()}}function Mt(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 Ut(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(!l)throw new RangeError("The value of a property ("+i+") should be a primitive value.");s(n(i),o,a,h)}else null!=o&&a.push(i.replace(/_.*/,"").replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))+": "+o+";")}(a.length||h)&&r.push((!i||l||o?t:t.map(i)).join(", ")+" {"+a.join(" ")+"}")}for(let e in t)s(n(e),t[e],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let t=zt[qt]||1;return zt[qt]=t+1,"ͼ"+t.toString(36)}static mount(t,e){(t[Lt]||new jt(t)).mount(Array.isArray(e)?e:[e])}}let Bt=new Map;class jt{constructor(t){let e=t.ownerDocument||t,i=e.defaultView;if(!t.head&&t.adoptedStyleSheets&&i.CSSStyleSheet){let n=Bt.get(e);if(n)return t.adoptedStyleSheets=[n.sheet,...t.adoptedStyleSheets],t[Lt]=n;this.sheet=new i.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets],Bt.set(e,this)}else{this.styleTag=e.createElement("style");let i=t.head||t;i.insertBefore(this.styleTag,i.firstChild)}this.modules=[],t[Lt]=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:'"'},Ft="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),Ht="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Jt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Kt=Ht||Ft&&+Ft[1]<57,te=0;te<10;te++)Nt[48+te]=Nt[96+te]=String(te);for(te=1;te<=24;te++)Nt[te+111]="F"+te;for(te=65;te<=90;te++)Nt[te]=String.fromCharCode(te+32),Gt[te]=String.fromCharCode(te);for(var ee in Nt)Gt.hasOwnProperty(ee)||(Gt[ee]=Nt[ee]);function ie(t){let e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection()}function ne(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function se(t,e){if(!e.anchorNode)return!1;try{return ne(t,e.anchorNode)}catch(t){return!1}}function re(t){return 3==t.nodeType?me(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function oe(t,e,i,n){return!!i&&(le(t,e,i,n,-1)||le(t,e,i,n,1))}function ae(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function le(t,e,i,n,s){for(;;){if(t==i&&e==n)return!0;if(e==(s<0?0:he(t))){if("DIV"==t.nodeName)return!1;let i=t.parentNode;if(!i||1!=i.nodeType)return!1;e=ae(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?he(t):0}}}function he(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}const ce={left:0,right:0,top:0,bottom:0};function ue(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function de(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}class fe{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){this.set(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset)}set(t,e,i,n){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=n}}let pe,Oe=null;function ge(t){if(t.setActive)return t.setActive();if(Oe)return t.focus(Oe);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==Oe?{get preventScroll(){return Oe={preventScroll:!0},!0}}:void 0),!Oe){Oe=!1;for(let t=0;te)return i.domBoundsAround(t,e,l);if(c>=t&&-1==n&&(n=a,s=l),l>e&&i.dom.parentNode==this.dom){r=a,o=h;break}h=c,l=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.dirty|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.dirty|=2),1&e.dirty)return;e.dirty|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,this.dirty&&this.markParentsDirty(!0))}setDOM(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=ye){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 Qe(t,e,i,n,s,r,o,a,l){let{children:h}=t,c=h.length?h[e]:null,u=r.length?r[r.length-1]:null,d=u?u.breakAfter:o;if(!(e==n&&c&&!o&&!d&&r.length<2&&c.merge(i,s,r.length?u:null,0==i,a,l))){if(n0&&(!o&&r.length&&c.merge(i,c.length,r[0],!1,a,0)?c.breakAfter=r.shift().breakAfter:(i2);var De={mac:Me||/Mac/.test(Pe.platform),windows:/Win/.test(Pe.platform),linux:/Linux|X11/.test(Pe.platform),ie:Ae,ie_version:Xe?Ce.documentMode||6:Ze?+Ze[1]:_e?+_e[1]:0,gecko:Te,gecko_version:Te?+(/Firefox\/(\d+)/.exec(Pe.userAgent)||[0,0])[1]:0,chrome:!!Re,chrome_version:Re?+Re[1]:0,ios:Me,android:/Android\b/.test(Pe.userAgent),webkit:Ee,safari:Ve,webkit_version:Ee?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Ce.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class We extends Se{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(!i||i instanceof We&&!(this.length-(e-t)+i.length>256))&&(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),!0)}split(t){let e=new We(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new ve(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 Ye(this.dom,t,e)}}class Ue extends Se{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(we(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}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.dirty|=6)}sync(t,e){this.dom?4&this.dirty&&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 Ue&&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 Ue(this.mark,e,r)}domAtPos(t){return Ge(this,t)}coordsAt(t,e){return He(this,t,e)}}function Ye(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?De.chrome||De.gecko||(e?(s--,o=1):r=0)?0:a.length-1];return De.safari&&!o&&0==l.width&&(l=Array.prototype.find.call(a,(t=>t.width))||l),o?ue(l,o<0):l||null}class qe extends Se{constructor(t,e,i){super(),this.widget=t,this.length=e,this.side=i,this.prevWidget=null}static create(t,e,i){return new(t.customView||qe)(t,e,i)}split(t){let e=qe.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 qe&&this.widget.compare(i.widget))||t>0&&s<=0||e0)?ve.before(this.dom):ve.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let i=this.dom.getClientRects(),n=null;if(!i.length)return ce;for(let e=t>0?i.length-1:0;n=i[e],!(t>0?0==e:e==i.length-1||n.top0?-1:1);return this.length?n:ue(n,this.side>0)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class Le extends qe{domAtPos(t){let{topView:e,text:i}=this.widget;return e?ze(t,0,e,i,this.length-e.length,((t,e)=>t.domAtPos(e)),((t,e)=>new ve(t,Math.min(e,t.nodeValue.length)))):new ve(i,Math.min(t,i.nodeValue.length))}sync(){this.setDOM(this.widget.toDOM())}localPosFromDOM(t,e){let{topView:i,text:n}=this.widget;return i?Be(t,e,i,n,this.length-i.length):Math.min(e,this.length)}ignoreMutation(){return!1}get overrideDOMText(){return null}coordsAt(t,e){let{topView:i,text:n}=this.widget;return i?ze(t,e,i,n,this.length-i.length,((t,e,i)=>t.coordsAt(e,i)),((t,e,i)=>Ye(t,e,i))):Ye(n,t,e)}destroy(){var t;super.destroy(),null===(t=this.widget.topView)||void 0===t||t.destroy()}get isEditable(){return!0}canReuseDOM(){return!0}}function ze(t,e,i,n,s,r,o){if(i instanceof Ue){for(let a=i.dom.firstChild;a;a=a.nextSibling){let i=Se.get(a);if(i){let l=ne(a,n),h=i.length+(l?s:0);if(t0?ve.before(this.dom):ve.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){let e=this.dom.getBoundingClientRect(),i=function(t,e){let i=t.parent,n=i?i.children.indexOf(t):-1;for(;i&&n>=0;)if(e<0?n>0:n0?-1:1);return i&&i.tope.top?{left:e.left,right:e.right,top:i.top,bottom:i.bottom}:e}get overrideDOMText(){return t.empty}get isHidden(){return!0}}function Ge(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 Ue&&s.length&&(n=s[s.length-1])instanceof Ue&&n.mark.eq(e.mark)?Fe(n,e.children[0],i-1):(s.push(e),e.setParent(t)),t.length+=e.length}function He(t,e,i){let n=null,s=-1,r=null,o=-1;!function t(e,a){for(let l=0,h=0;l=a&&(c.children.length?t(c,a-h):(!r||r instanceof Ne&&i>0)&&(u>a||h==u&&c.getSide()>0)?(r=c,o=a-h):(h0?3e8:-4e8:e>0?1e8:-1e8,new oi(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}=ai(t,n);e=(s?n?-3e8:-1:5e8)-1,i=1+(r?n?2e8:1:-6e8)}return new oi(t,e,i,n,t.widget||null,!0)}static line(t){return new ri(t)}static set(t,e=!1){return _t.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}ni.none=_t.empty;class si extends ni{constructor(t){let{start:e,end:i}=ai(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){return this==t||t instanceof si&&this.tagName==t.tagName&&this.class==t.class&&Ke(this.attrs,t.attrs)}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}si.prototype.point=!1;class ri extends ni{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof ri&&this.spec.class==t.spec.class&&Ke(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)}}ri.prototype.mapMode=S.TrackBefore,ri.prototype.point=!0;class oi extends ni{constructor(t,e,i,n,s,r){super(e,i,s,t),this.block=n,this.isReplace=r,this.mapMode=n?e<=0?S.TrackBefore:S.TrackAfter:S.TrackDel}get type(){return this.startSide=5}eq(t){return t instanceof oi&&(e=this.widget,i=t.widget,e==i||!!(e&&i&&e.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var e,i}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 ai(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 li(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)}oi.prototype.point=!0;class hi extends Se{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 hi))return!1;this.dom||i.transferDOM(this)}return n&&this.setDeco(i?i.attrs:null),$e(this,t,e,i?i.children:[],s,r),!0}split(t){let e=new hi;if(e.breakAfter=this.breakAfter,0==this.length)return e;let{i: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){Ke(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){Fe(this,t,e)}addLineDeco(t){let e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=Je(e,this.attrs||{})),i&&(this.attrs=Je({class:i},this.attrs||{}))}domAtPos(t){return Ge(this,t)}reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.dirty|=6)}sync(t,e){var i;this.dom?4&this.dirty&&(we(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&&(ti(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&&Se.get(n)instanceof Ue;)n=n.lastChild;if(!(n&&this.length&&("BR"==n.nodeName||0!=(null===(i=Se.get(n))||void 0===i?void 0:i.isEditable)||De.ios&&this.children.some((t=>t instanceof We))))){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 We)||/[^ -~]/.test(i.text))return null;let n=re(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=He(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 hi)return s;if(r>e)break}n=r+s.breakAfter}return null}}class ci extends Se{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 ci&&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(di(new We(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 oi){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let o=e-t;if(i instanceof oi)if(i.block){let{type:t}=i;t!=ii.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new ci(i.widget||new fi("div"),o,t))}else{let r=qe.create(i.widget||new fi("span"),o,o?0:i.startSide),a=this.atCursorPos&&!r.isEditable&&s<=n.length&&(t0),l=!r.isEditable&&(tn.length||i.startSide<=0),h=this.getLine();2!=this.pendingBuffer||a||r.isEditable||(this.pendingBuffer=0),this.flushBuffer(n),a&&(h.append(di(new Ne(1),n),s),s=n.length+Math.max(0,s-n.length)),h.append(di(r,n),s),this.atCursorPos=l,this.pendingBuffer=l?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 ui(t,e,i,s);return r.openEnd=_t.spans(n,e,i,r),r.openStart<0&&(r.openStart=r.openEnd),r.finish(r.openEnd),r}}function di(t,e){for(let i of e)t=new Ue(i,[t],t.length);return t}class fi extends ei{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 pi=E.define(),Oi=E.define(),gi=E.define(),mi=E.define(),bi=E.define(),wi=E.define(),vi=E.define(),yi=E.define({combine:t=>t.some((t=>t))}),Si=E.define({combine:t=>t.some((t=>t))});class xi{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 xi(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin)}}const ki=ut.define({map:(t,e)=>t.map(e)});function Qi(t,e,i){let n=t.facet(mi);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 $i=E.define({combine:t=>!t.length||t[0]});let Pi=0;const Ci=E.define();class _i{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 _i(Pi++,t,i,(t=>{let e=[Ci.of(t)];return s&&e.push(Ti.of((e=>{let i=e.plugin(t);return i?s(i):ni.none}))),n&&e.push(n(t)),e}))}static fromClass(t,e){return _i.define((e=>new t(e)),e)}}class Xi{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(Qi(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){Qi(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){Qi(t.state,e,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Zi=E.define(),Ai=E.define(),Ti=E.define(),Ri=E.define(),Ei=E.define(),Vi=E.define();class Mi{constructor(t,e,i,n){this.fromA=t,this.toA=e,this.fromB=i,this.toB=n}join(t){return new Mi(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(!a)return i;new Mi(a.fromA,a.toA,a.fromB,a.toB).addToSet(i),r=a.toA,o=a.toB}}}class Di{constructor(t,e,i){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=k.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 Mi(t,e,i,s)))),this.changedRanges=n}static create(t,e,i){return new Di(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 Wi=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Wi||(Wi={}));const Ui=Wi.LTR,Yi=Wi.RTL;function qi(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}}const Gi=[];function Fi(t){return[new Ni(0,t,0)]}let Hi="";function Ji(t,e,i,n,s){var r;let o=n.head-t.from,a=-1;if(0==o){if(!s||!t.length)return null;e[0].level!=i&&(o=e[0].side(!1,i),a=0)}else if(o==t.length){if(s)return null;let t=e[e.length-1];t.level!=i&&(o=t.side(!0,i),a=e.length-1)}a<0&&(a=Ni.find(e,o,null!==(r=n.bidiLevel)&&void 0!==r?r:-1,n.assoc));let l=e[a];o==l.side(s,i)&&(l=e[a+=s?1:-1],o=l.side(!s,i));let h=s==(l.dir==i),c=f(t.text,o,h);if(Hi=t.text.slice(Math.min(o,c),Math.max(o,c)),c!=l.side(s,i))return A.cursor(c+t.from,h?-1:1,l.level);let u=a==(s?e.length-1:0)?null:e[a+(s?1:-1)];return u||l.level==i?u&&u.level1)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=Se.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 en(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}class nn{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class sn extends Se{constructor(t){super(),this.view=t,this.compositionDeco=ni.none,this.decorations=[],this.dynamicDecorationMap=[],this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(t.contentDOM),this.children=[new hi],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Mi(0,0,0,t.state.doc.length)],0)}get length(){return this.view.state.doc.length}update(t){let e=t.changedRanges;this.minWidth>0&&e.length&&(e.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),this.view.inputState.composing<0?this.compositionDeco=ni.none:(t.transactions.length||this.dirty)&&(this.compositionDeco=function(t,e){let i=on(t);if(!i)return ni.none;let{from:n,to:s,node:r,text:o}=i,a=e.mapPos(n,1),l=Math.max(a,e.mapPos(s,-1)),{state:h}=t,c=3==r.nodeType?r.nodeValue:new tn([],h).readRange(r.firstChild,null).text;if(l-a{this.dom.style.height=this.view.viewState.contentHeight+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let t=De.chrome||De.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,t),this.dirty=0,t&&(t.written||i.selectionRange.focusNode!=t.node)&&(this.forceSelection=!0),this.dom.style.height=""}));let n=[];if(this.view.viewport.from||this.view.viewport.to=0?t[e]:null;if(!n)break;let{fromA:s,toA:r,fromB:o,toB:a}=n,{content:l,breakAtStart:h,openStart:c,openEnd:u}=ui.build(this.view.state.doc,o,a,this.decorations,this.dynamicDecorationMap),{i:d,off:f}=i.findPos(r,1),{i:p,off:O}=i.findPos(s,-1);Qe(this,p,O,d,f,l,h,c,u)}}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&&se(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,a=this.domAtPos(o.anchor),l=o.empty?a:this.domAtPos(o.head);if(De.gecko&&o.empty&&!this.compositionDeco.size&&(1==(h=a).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((()=>a.node.insertBefore(t,a.node.childNodes[a.offset]||null))),a=l=new ve(t,0),r=!0}var h;let c=this.view.observer.selectionRange;!r&&c.focusNode&&oe(a.node,a.offset,c.anchorNode,c.anchorOffset)&&oe(l.node,l.offset,c.focusNode,c.focusOffset)||(this.view.observer.ignore((()=>{De.android&&De.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=ie(this.view.root);if(t)if(o.empty){if(De.gecko){let t=(e=a.node,n=a.offset,1!=e.nodeType?0:(n&&"false"==e.childNodes[n-1].contentEditable?1:0)|(no.head&&([a,l]=[l,a]),e.setEnd(l.node,l.offset),e.setStart(a.node,a.offset),t.removeAllRanges(),t.addRange(e)}else;var e,n;s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())})),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new ve(c.anchorNode,c.anchorOffset),this.impreciseHead=l.precise?null:new ve(c.focusNode,c.focusOffset)}enforceCursorAssoc(){if(this.compositionDeco.size)return;let{view:t}=this,e=t.state.selection.main,i=ie(t.root),{anchorNode:n,anchorOffset:s}=t.observer.selectionRange;if(!(i&&e.empty&&e.assoc&&i.modify))return;let r=hi.find(this,e.head);if(!r)return;let o=r.posAtStart;if(e.head==o||e.head==o+r.length)return;let a=this.coordsAt(e.head,-1),l=this.coordsAt(e.head,1);if(!a||!l||a.bottom>l.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)}nearest(t){for(let e=t;e;){let t=Se.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!=ii.WidgetBefore&&s.type!=ii.WidgetAfter&&(!n||2==e||this.children[n-1].breakAfter||this.children[n-1].type==ii.WidgetBefore&&e>-2))return s.coordsAt(t-r,e);i=r}}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,a=this.view.textDirection==Wi.LTR;for(let t=0,l=0;ln)break;if(t>=i){let i=h.dom.getBoundingClientRect();if(e.push(i.height),r){let e=h.dom.lastChild,n=e?re(e):[];if(n.length){let e=n[n.length-1],r=a?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?Wi.RTL:Wi.LTR}measureTextSize(){for(let t of this.children)if(t instanceof hi){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.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(n);let s=re(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 ke(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;t.push(ni.replace({widget:new rn(n),block:!0,inclusive:!0,isBlockGap:!0}).range(i,r))}if(!s)break;i=s.to+1}return ni.set(t)}updateDeco(){let t=this.view.state.facet(Ti).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=0,r=0,o=0,a=0;for(let t of this.view.state.facet(Ei).map((t=>t(this.view))))if(t){let{left:e,right:i,top:n,bottom:l}=t;null!=e&&(s=Math.max(s,e)),null!=i&&(r=Math.max(r,i)),null!=n&&(o=Math.max(o,n)),null!=l&&(a=Math.max(a,l))}let l={left:n.left-s,top:n.top-o,right:n.right+r,bottom:n.bottom+a};!function(t,e,i,n,s,r,o,a){let l=t.ownerDocument,h=l.defaultView||window;for(let c=t;c;)if(1==c.nodeType){let t,u=c==l.body;if(u)t=de(h);else{if(c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let e=c.getBoundingClientRect();t={left:e.left,right:e.left+c.clientWidth,top:e.top,bottom:e.top+c.clientHeight}}let d=0,f=0;if("nearest"==s)e.top0&&e.bottom>t.bottom+f&&(f=e.bottom-t.bottom+f+o)):e.bottom>t.bottom&&(f=e.bottom-t.bottom+o,i<0&&e.top-f0&&e.right>t.right+d&&(d=e.right-t.right+d+r)):e.right>t.right&&(d=e.right-t.right+r,i<0&&e.left0))break;i=i.childNodes[n-1],n=he(i)}if(i>=0)for(let n=t,s=e;;){if(3==n.nodeType)return n;if(!(1==n.nodeType&&s=0))break;n=n.childNodes[s],s=0}return null}class hn{constructor(){this.changes=[]}compareRange(t,e){li(t,e,this.changes)}comparePoint(t,e){li(t,e,this.changes)}}function cn(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function un(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function dn(t,e){return t.tope.top+1}function fn(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,a,l,h,c,u=!1;for(let d=t.firstChild;d;d=d.nextSibling){let t=re(d);for(let f=0;fg||o==g&&r>O){n=d,s=p,r=O,o=g;let a=g?i0?f0)}0==O?i>p.bottom&&(!h||h.bottomp.top)&&(l=d,c=p):h&&dn(h,p)?h=pn(h,p.bottom):c&&dn(c,p)&&(c=fn(c,p.top))}}if(h&&h.bottom>=i?(n=a,s=h):c&&c.top<=i&&(n=l,s=c),!n)return{node:t,offset:0};let d=Math.max(s.left,Math.min(s.right,e));return 3==n.nodeType?gn(n,d,i):u&&"false"!=n.contentEditable?On(n,d,i):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,n)+(e>=(s.left+s.right)/2?1:0)}}function gn(t,e,i){let n=t.nodeValue.length,s=-1,r=1e9,o=0;for(let a=0;ai?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(De.chrome||De.gecko){me(t,a).getBoundingClientRect().left==h.right&&(n=!i)}if(c<=0)return{node:t,offset:a+(n?1:0)};s=a+(n?1:0),r=c}}}return{node:t,offset:s>-1?s:o>0?t.nodeValue.length:0}}function mn(t,e,i,n=-1){var s,r;let o,a=t.contentDOM.getBoundingClientRect(),l=a.top+t.viewState.paddingTop,{docHeight:h}=t.viewState,{x:c,y:u}=e,d=u-l;if(d<0)return 0;if(d>h)return t.state.doc.length;for(let e=t.defaultLineHeight/2,s=!1;o=t.elementAtHeight(d),o.type!=ii.Text;)for(;d=n>0?o.bottom+e:o.top-e,!(d>=0&&d<=h);){if(s)return i?null:0;s=!0,n=-n}u=l+d;let f=o.from;if(ft.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:bn(t,a,o,c,u);let p=t.dom.ownerDocument,O=t.root.elementFromPoint?t.root:p,g=O.elementFromPoint(c,u);g&&!t.contentDOM.contains(g)&&(g=null),g||(c=Math.max(a.left+1,Math.min(a.right-1,c)),g=O.elementFromPoint(c,u),g&&!t.contentDOM.contains(g)&&(g=null));let m,b=-1;if(g&&0!=(null===(s=t.docView.nearest(g))||void 0===s?void 0:s.isEditable))if(p.caretPositionFromPoint){let t=p.caretPositionFromPoint(c,u);t&&({offsetNode:m,offset:b}=t)}else if(p.caretRangeFromPoint){let e=p.caretRangeFromPoint(c,u);e&&(({startContainer:m,startOffset:b}=e),(!t.contentDOM.contains(m)||De.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 me(t,n-1,n).getBoundingClientRect().left>i}(m,b,c)||De.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}let n=1==t.nodeType?t.getBoundingClientRect():me(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return i-n.left>5}(m,b,c))&&(m=void 0))}if(!m||!t.docView.dom.contains(m)){let e=hi.find(t.docView,f);if(!e)return d>o.top+o.height/2?o.to:o.from;({node:m,offset:b}=On(e.dom,c,u))}let w=t.docView.nearest(m);if(!w)return null;if(w.isWidget&&1==(null===(r=w.dom)||void 0===r?void 0:r.nodeType)){let t=w.dom.getBoundingClientRect();return e.y1.5*t.defaultLineHeight){r+=Math.floor((s-i.top)/t.defaultLineHeight)*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=f(t,n)}return!0===n?-1:t.length}(o,r,t.state.tabSize)}function wn(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=t.bidiSpans(s),o=t.textDirectionAt(s.from);for(let a=e,l=null;;){let e=Ji(s,r,o,a,i),h=Hi;if(!e){if(s.number==(i?t.state.doc.lines:1))return a;h="\n",s=t.state.doc.line(s.number+(i?1:-1)),r=t.bidiSpans(s),e=A.cursor(i?s.from:s.to)}if(l){if(!l(h))return a}else{if(!n)return e;l=n(h)}a=e}}function vn(t,e,i,n){let s=t.state.facet(Ri).map((e=>e(t)));for(;;){let t=!1;for(let r of s)r.between(i.from-1,i.from+1,((s,r,o)=>{i.from>s&&i.fromi.from?A.cursor(s,1):A.cursor(r,-1),t=!0,o.widget.skipPosition&&(i=o.widget.skipPosition(i,e,n)))}));if(!t)return i}}class yn{constructor(t){this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null;let e=(e,i)=>{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 Cn){let n=Cn[i];t.contentDOM.addEventListener(i,(i=>{Pn(t,i)&&e(n,i)}),_n[i]),this.registeredEvents.push(i)}t.scrollDOM.addEventListener("mousedown",(i=>{if(i.target==t.scrollDOM&&i.clientY>t.contentDOM.getBoundingClientRect().bottom&&(e(Cn.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)}})),De.chrome&&102==De.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,De.safari&&t.contentDOM.addEventListener("input",(()=>null))}setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}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=>{Pn(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){Qi(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){Qi(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||xn.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,be(t.contentDOM,e.key,e.keyCode))}ignoreDuringComposition(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(De.safari&&!De.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 Sn=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],xn="dthko",kn=[16,17,18,20,91,92,224,225];function Qn(t){return.7*Math.max(0,t)+8}class $n{constructor(t,e,i,n){this.view=t,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);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(xt.allowMultipleSelections)&&function(t,e){let i=t.state.facet(pi);return i.length?i[0](e):(De.mac,e.altKey)}(t,e),this.dragMove=function(t,e){let i=t.state.facet(Oi);return i.length?i[0](e):De.mac?!e.altKey:!e.ctrlKey}(t,e),this.dragging=!(!function(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let n=ie(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!=Yn(e))&&null}start(t){!1===this.dragging&&(t.preventDefault(),this.select(t))}move(t){var e;if(0==t.buttons)return this.destroy();if(!1!==this.dragging)return;this.select(this.lastEvent=t);let i=0,n=0,s=(null===(e=this.scrollParent)||void 0===e?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight};t.clientX<=s.left+6?i=-Qn(s.left-t.clientX):t.clientX>=s.right-6&&(i=Qn(t.clientX-s.right)),t.clientY<=s.top+6?n=-Qn(s.top-t.clientY):t.clientY>=s.bottom-6&&(n=Qn(t.clientY-s.bottom)),this.setScrollSpeed(i,n)}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)}select(t){let e=this.style.get(t,this.extend,this.multiple);!this.mustSelect&&e.eq(this.view.state.selection)&&e.main.assoc==this.view.state.selection.main.assoc||this.view.dispatch({selection:e,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.docChanged&&this.dragging&&(this.dragging=this.dragging.map(t.changes)),this.style.update(t)&&setTimeout((()=>this.select(this.lastEvent)),20)}}function Pn(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=Se.get(n))&&i.ignoreEvent(e))return!1;return!0}const Cn=Object.create(null),_n=Object.create(null),Xn=De.ie&&De.ie_version<15||De.ios&&De.webkit_version<604;function Zn(t,e){let i,{state:n}=t,s=1,r=n.toText(e),o=r.lines==n.selection.ranges.length;if(null!=Ln&&n.selection.ranges.every((t=>t.empty))&&Ln==r.toString()){let t=-1;i=n.changeByRange((i=>{let a=n.doc.lineAt(i.from);if(a.from==t)return{range:i};t=a.from;let l=n.toText((o?r.line(s++).text:e)+n.lineBreak);return{changes:{from:a.from,insert:l},range:A.cursor(i.from+l.length)}}))}else i=o?n.changeByRange((t=>{let e=r.line(s++);return{changes:{from:t.from,to:t.to,insert:e.text},range:A.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 A.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 A.cursor(e);0==r?i=1:r==s.length&&(i=-1);let o=r,a=r;i<0?o=f(s.text,r,!1):a=f(s.text,r);let l=n(s.text.slice(o,a));for(;o>0;){let t=f(s.text,o,!1);if(n(s.text.slice(t,o))!=l)break;o=t}for(;a{t.inputState.setSelectionOrigin("select"),27==e.keyCode&&(t.inputState.lastEscPress=Date.now())},Cn.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},Cn.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},_n.touchstart=_n.touchmove={passive:!0},Cn.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return;let i=null;for(let n of t.state.facet(gi))if(i=n(t,e),i)break;if(i||0!=e.button||(i=function(t,e){let i=Vn(t,e),n=Yn(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 a,l=Vn(t,e),h=An(t,l.pos,l.bias,n);if(i.pos!=l.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&&(a=function(t,e){for(let i=0;i=e)return A.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,l.pos))?a:o?s.addRange(h):A.create([h])}}}(t,e)),i){let n=t.root.activeElement!=t.contentDOM;t.inputState.startMouseSelection(new $n(t,e,i,n)),n&&t.observer.ignore((()=>ge(t.contentDOM))),t.inputState.mouseSelection&&t.inputState.mouseSelection.start(e)}};let Tn=(t,e)=>t>=e.top&&t<=e.bottom,Rn=(t,e,i)=>Tn(e,i)&&t>=i.left&&t<=i.right;function En(t,e,i,n){let s=hi.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&&Rn(i,n,o))return-1;let a=s.coordsAt(r,1);return a&&Rn(i,n,a)?1:o&&Tn(n,o)?-1:1}function Vn(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:En(t,i,e.clientX,e.clientY)}}const Mn=De.ie&&De.ie_version<=11;let Dn=null,Wn=0,Un=0;function Yn(t){if(!Mn)return t.detail;let e=Dn,i=Un;return Dn=t,Un=Date.now(),Wn=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Wn+1)%3:1}function qn(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&&r.dragMove?{from:r.dragging.from,to:r.dragging.to}:null,a={from:s,insert:i},l=t.state.changes(o?[o,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(s,-1),head:l.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"})}Cn.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")},Cn.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&&qn(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 qn(t,e,e.dataTransfer.getData("Text"),!0)},Cn.paste=(t,e)=>{if(t.state.readOnly)return e.preventDefault();t.observer.flush();let i=Xn?null:e.clipboardData;i?(Zn(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(),Zn(t,i.value)}),50)}(t)};let Ln=null;Cn.copy=Cn.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;Ln=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 zn=lt.define();function In(t,e){let i=[];for(let n of t.facet(vi)){let s=n(t,e);s&&i.push(s)}return i?t.update({effects:i,annotations:zn.of(!0)}):null}function Bn(t){setTimeout((()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=In(t.state,e);i?t.dispatch(i):t.update([])}}),10)}Cn.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),Bn(t)},Cn.blur=t=>{t.observer.clearSelectionRange(),Bn(t)},Cn.compositionstart=Cn.compositionupdate=t=>{null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},Cn.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,De.chrome&&De.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then((()=>t.observer.flush())):setTimeout((()=>{t.inputState.composing<0&&t.docView.compositionDeco.size&&t.update([])}),50)},Cn.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},Cn.beforeinput=(t,e)=>{var i;let n;if(De.chrome&&De.android&&(n=Sn.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 jn=["pre-wrap","normal","pre-line","break-spaces"];class Nn{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){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return jn.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i-1,a=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,a){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)>Jn&&(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:a,toA:l,fromB:h,toB:c}=n[o],u=s.lineAt(a,Hn.ByPosNoHeight,i.setDoc(e),0,0),d=u.to>=l?u:s.lineAt(l,Hn.ByPosNoHeight,i,0,0);for(c+=d.to-l,l=d.to;o>0&&u.from<=n[o-1].toA;)a=n[o-1].fromA,h=n[o-1].fromB,o--,a2*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 es extends ts{constructor(t,e){super(t,e,ii.Text),this.collapsed=0,this.widgetHeight=0}replace(t,e,i){let n=i[0];return 1==i.length&&(n instanceof es||n instanceof is&&4&n.flags)&&Math.abs(this.length-n.length)<10?(n instanceof is?n=new es(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.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class is 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:a}=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),l=o+r.length*a,h=Math.max(i,t-l/2);return new Fn(r.from,r.length,h,l,ii.Text)}{let n=Math.max(0,Math.min(r-s,Math.floor((t-i)/o))),{from:a,length:l}=e.doc.line(s+n);return new Fn(a,l,i+o*n,o,ii.Text)}}lineAt(t,e,i,n,s){if(e==Hn.ByHeight)return this.blockAt(t,i,n,s);if(e==Hn.ByPosNoHeight){let{from:e,to:n}=i.doc.lineAt(t);return new Fn(e,n-e,0,0,ii.Text)}let{firstLine:r,perLine:o,perChar:a}=this.heightMetrics(i,s),l=i.doc.lineAt(t),h=o+l.length*a,c=l.number-r,u=n+o*c+a*(l.from-s-c);return new Fn(l.from,l.length,Math.max(n,Math.min(u,n+this.height-h)),h,ii.Text)}forEachLine(t,e,i,n,s,r){t=Math.max(t,s),e=Math.min(e,s+this.length);let{firstLine:o,perLine:a,perChar:l}=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+=a*i+l*(t-s-i)}let n=a+l*e.length;r(new Fn(e.from,e.length,c,n,ii.Text)),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 is?i[i.length-1]=new is(t.length+n):i.push(null,new is(n-1))}if(t>0){let e=i[0];e instanceof is?i[0]=new is(t+e.length):i.unshift(new is(t-1),null)}return Kn.of(i)}decomposeLeft(t,e){e.push(new is(t-1),null)}decomposeRight(t,e){e.push(null,new is(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 is(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)>=Jn&&(o=-2);let a=new es(e,s);a.outdated=!1,i.push(a),r+=e+1}r<=s&&i.push(null,new is(s-r).updateHeight(t,r));let a=Kn.of(i);return(o<0||Math.abs(a.height-this.height)>=Jn||Math.abs(o-this.heightMetrics(t,e).perLine)>=Jn)&&(t.heightChanged=!0),a}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class ns 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 l;let h=e==Hn.ByPosNoHeight?Hn.ByPosNoHeight:Hn.ByPos;return a?l.join(this.right.lineAt(o,h,i,r,o)):this.left.lineAt(o,h,i,n,s).join(l)}forEachLine(t,e,i,n,s,r){let o=n+this.left.height,a=s+this.left.length+this.break;if(this.break)t=a&&this.right.forEachLine(t,e,i,o,a,r);else{let l=this.lineAt(a,Hn.ByPos,i,n,s);t=t&&l.from<=e&&r(l),e>l.to&&this.right.forEachLine(l.to+1,e,i,o,a,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&&ss(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,a=null;return n&&n.from<=e+s.length&&n.more?a=s=s.updateHeight(t,e,i,n):s.updateHeight(t,e,i),n&&n.from<=o+r.length&&n.more?a=r=r.updateHeight(t,o,i,n):r.updateHeight(t,o,i),a?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 ss(t,e){let i,n;null==t[e]&&(i=t[e-1])instanceof is&&(n=t[e+1])instanceof is&&t.splice(e-1,3,new is(i.length+1+n.length))}class rs{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 es?i.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new es(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)}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 es(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let i=new is(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 es)return t;let e=new es(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine(),t.type!=ii.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,t.type!=ii.WidgetBefore&&(this.covering=t)}addLineDeco(t,e){let i=this.ensureLine();i.length+=e,i.collapsed+=e,i.widgetHeight=Math.max(i.widgetHeight,t),this.writtenTo=this.pos=this.pos+e}finish(t){let e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof es||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),a=Math.max(a,n.top),l=e==t.parentNode?n.bottom:Math.min(l,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:a-(i.top+e),bottom:Math.max(a,l)-(i.top+e)}}function ls(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class hs{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 Nn(i),this.stateDeco=e.facet(Ti).filter((t=>"function"!=typeof t)),this.heightMap=Kn.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle.setDoc(e.doc),[new Mi(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ni.set(this.lineGaps.map((t=>t.draw(!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 ds(e,i))}}this.viewports=t.sort(((t,e)=>t.from-e.from)),this.scaler=this.heightMap.height<=7e6?gs:new ms(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:bs(t,this.scaler))}))}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=this.state.facet(Ti).filter((t=>"function"!=typeof t));let n=t.changedRanges,s=Mi.extendWithRanges(n,function(t,e,i){let n=new os;return _t.compare(t,e,i,n,0),n.changes}(i,this.stateDeco,t?t.changes:k.empty(this.state.doc.length))),r=this.heightMap.height;this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),s),this.heightMap.height!=r&&(t.flags|=2);let o=s.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.heado.to)||!this.viewportIsAppropriate(o))&&(o=this.getViewport(0,e));let a=!t.changes.empty||2&t.flags||o.from!=this.viewport.from||o.to!=this.viewport.to;this.viewport=o,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(Si)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let i=e.contentDOM,n=window.getComputedStyle(i),s=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Wi.RTL:Wi.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),a=i.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let h=0,c=0,u=parseInt(n.paddingTop)||0,d=parseInt(n.paddingBottom)||0;this.paddingTop==u&&this.paddingBottom==d||(this.paddingTop=u,this.paddingBottom=d,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let f=(this.printing?ls:as)(i,this.paddingTop),p=f.top-this.pixelViewport.top,O=f.bottom-this.pixelViewport.bottom;this.pixelViewport=f;let g=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(g!=this.inView&&(this.inView=g,g&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let m=a.width;if(this.contentDOMWidth==m&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,h|=8),l){let i=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(i)&&(o=!0),o||s.lineWrapping&&Math.abs(m-this.contentDOMWidth)>s.charWidth){let{lineHeight:t,charWidth:n,textHeight:a}=e.docView.measureTextSize();o=t>0&&s.refresh(r,t,n,a,m/n,i),o&&(e.docView.minWidth=0,h|=8)}p>0&&O>0?c=Math.max(p,O):p<0&&O<0&&(c=Math.min(p,O)),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 Mi(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new Gn(n.from,r))}s.heightChanged&&(h|=2)}let b=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return b&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(2&h||b)&&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,a=new ds(n.lineAt(r-1e3*i,Hn.ByHeight,s,0,0).from,n.lineAt(o+1e3*(1-i),Hn.ByHeight,s,0,0).to);if(e){let{head:t}=e.range;if(ta.to){let i,r=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=n.lineAt(t,Hn.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!=Wi.LTR&&!i)return[];let o=[],a=(n,r,l,h)=>{if(r-nn&&tt.from>=l.from&&t.to<=l.to&&Math.abs(t.from-n)t.frome))));if(!d){if(rt.from<=r&&t.to>=r))){let t=e.moveToLineBoundary(A.cursor(r),!1,!0).head;t>n&&(r=t)}d=new hs(n,r,this.gapSize(l,n,r,h))}o.push(d)};for(let t of this.viewportLines){if(t.lengtht.from&&a(t.from,s,t,e),ot.draw(this.heightOracle.lineWrapping)))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];_t.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))||bs(this.heightMap.lineAt(t,Hn.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return bs(this.heightMap.lineAt(this.scaler.fromDOM(t),Hn.ByHeight,this.heightOracle,0,0),this.scaler)}elementAtHeight(t){return bs(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 ds{constructor(t,e){this.from=t,this.to=e}}function fs(t,e,i){let n=[],s=t,r=0;return _t.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 Os(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 gs={toDOM:t=>t,fromDOM:t=>t,scale:1};class ms{constructor(t,e,i){let n=0,s=0,r=0;this.viewports=i.map((({from:i,to:s})=>{let r=e.lineAt(i,Hn.ByPos,t,0,0).top,o=e.lineAt(s,Hn.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=ebs(t,e))):t.type)}const ws=E.define({combine:t=>t.join(" ")}),vs=E.define({combine:t=>t.indexOf(!0)>-1}),ys=It.newName(),Ss=It.newName(),xs=It.newName(),ks={"&light":"."+Ss,"&dark":"."+xs};function Qs(t,e,i){return new It(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 $s=Qs("."+ys,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",borderRadius:"4px",marginTop:"0.5rem",width:"30%",minWidth:"190px",marginLeft:"auto",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&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:"#333338",fontSize:"70%",padding:".2em 1em",borderRadius:"4px"},"&light .cm-button":{background:"#eee"},"&dark .cm-button":{background:"#eee"},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",borderRadius:"0.25rem",border:"1px solid silver",padding:".0em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},ks);class Ps{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;i&&(e.push(new nn(i,n)),s==i&&r==n||e.push(new nn(s,r)));return e}(t),i=new tn(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?A.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||!ne(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||!ne(t.contentDOM,e.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(e.anchorNode,e.anchorOffset);this.newSel=A.single(n,i)}}}function Cs(e,i){let n,{newSel:s}=i,r=e.state.selection.main;if(i.bounds){let{from:s,to:o}=i.bounds,a=r.from,l=null;(8===e.inputState.lastKeyCode&&e.inputState.lastKeyTime>Date.now()-100||De.android&&i.text.length0&&a>0&&t.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if("end"==n){i-=o+Math.max(0,r-Math.min(o,a))-r}if(o=o?r-i:0,a=r+(a-o),o=r}else if(a=a?r-i:0,o=r+(o-a),a=r}return{from:r,toA:o,toB:a}}(e.state.doc.sliceString(s,o,Ki),i.text,a-s,l);h&&(De.chrome&&13==e.inputState.lastKeyCode&&h.toB==h.from+2&&i.text.slice(h.from,h.toB)==Ki+Ki&&h.toB--,n={from:s+h.from,to:s+h.toA,insert:t.of(i.text.slice(h.from,h.toB).split(Ki))})}else s&&(!e.hasFocus&&e.state.facet($i)||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))}:(De.mac||De.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=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}):De.chrome&&n&&n.from==n.to&&n.from==r.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(s&&(s=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}),n){let t=e.state;if(De.ios&&e.inputState.flushIOSKey(e))return!0;if(De.android&&(n.from==r.from&&n.to==r.to&&1==n.insert.length&&2==n.insert.lines&&be(e.contentDOM,"Enter",13)||n.from==r.from-1&&n.to==r.to&&0==n.insert.length&&be(e.contentDOM,"Backspace",8)||n.from==r.from&&n.to==r.to+1&&0==n.insert.length&&be(e.contentDOM,"Delete",46)))return!0;let i,o=n.insert.toString();if(e.state.facet(wi).some((t=>t(e,n.from,n.to,o))))return!0;if(e.inputState.composing>=0&&e.inputState.composing++,n.from>=r.from&&n.to<=r.to&&n.to-n.from>=(r.to-r.from)/3&&(!s||s.main.empty&&s.main.from==n.from+n.insert.length)&&e.inputState.composing<0){let s=r.fromn.to?t.sliceDoc(n.to,r.to):"";i=t.replaceSelection(e.state.toText(s+n.insert.sliceString(0,void 0,e.state.lineBreak)+o))}else{let o=t.changes(n),a=s&&s.main.to<=o.newLength?s.main:void 0;if(t.selection.ranges.length>1&&e.inputState.composing>=0&&n.to<=r.to&&n.to>=r.to-10){let s=e.state.sliceDoc(n.from,n.to),l=on(e)||e.state.doc.lineAt(r.head),h=r.to-n.to,c=r.to-r.from;i=t.changeByRange((i=>{if(i.from==r.from&&i.to==r.to)return{changes:o,range:a||i.map(o)};let u=i.to-h,d=u-s.length;if(i.to-i.from!=c||e.state.sliceDoc(d,u)!=s||l&&i.to>=l.from&&i.from<=l.to)return{range:i};let f=t.changes({from:d,to:u,insert:n.insert}),p=i.to-r.to;return{changes:f,range:a?A.range(Math.max(0,a.anchor+p),Math.max(0,a.head+p)):i.map(f)}}))}else i={changes:o,selection:a&&t.selection.replaceRange(a)}}let a="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,a+=".compose",e.inputState.compositionFirstChange&&(a+=".start",e.inputState.compositionFirstChange=!1)),e.dispatch(i,{scrollIntoView:!0,userEvent:a}),!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 _s={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Xs=De.ie&&De.ie_version<=11;class Zs{constructor(t){this.view=t,this.active=!1,this.selectionRange=new fe,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);(De.ie&&De.ie_version<=11||De.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()})),Xs&&(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")))}),{}),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($i)?i.root.activeElement!=this.dom:!se(i.dom,n))return;let s=n.anchorNode&&i.docView.nearest(n.anchorNode);s&&s.ignoreEvent(t)?e||(this.selectionChanged=!1):(De.ie&&De.ie_version<=11||De.android&&De.chrome)&&!i.state.selection.main.empty&&n.focusNode&&oe(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=De.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,a=t.docView.domAtPos(t.state.selection.main.anchor);oe(a.node,a.offset,r,o)&&([n,s,r,o]=[r,o,n,s]);return{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:o}}(this.view)||ie(t.root);if(!e||this.selectionRange.eq(e))return!1;let i=se(this.dom,e);return i&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let t=this.delayedAndroidKey;t&&(this.clearDelayedAndroidKey(),!this.flush()&&t.force&&be(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&&se(this.dom,this.selectionRange);return t<0&&!n?null:(t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new Ps(this.view,t,e,i))}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=Cs(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.dirty|=4),"childList"==t.type){let i=As(e,t.previousSibling||t.target.previousSibling,-1),n=As(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 As(t,e,i){for(;e;){let n=Se.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 Ts{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),this._dispatch=t.dispatch||(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 us(t.state||xt.create(t)),this.plugins=this.state.facet(Ci).map((t=>new Xi(t)));for(let t of this.plugins)t.update(this);this.observer=new Zs(this),this.inputState=new yn(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new sn(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),t.parent&&t.parent.appendChild(this.dom)}get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}dispatch(...t){this._dispatch(1==t.length&&t[0]instanceof dt?t[0]:this.state.update(...t))}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,a=null;t.some((t=>t.annotation(zn)))?(this.inputState.notifiedFocused=r,o=1):r!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=r,a=In(s,r),a||(o=1));let l=this.observer.delayedAndroidKey,h=null;if(l?(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(xt.phrases)!=this.state.facet(xt.phrases))return this.setState(s);e=Di.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 xi(t.empty?t:A.cursor(t.head,t.head>t.anchor?-1:1))}for(let t of e.effects)t.is(ki)&&(c=t.value)}this.viewState.update(e,c),this.bidiCache=Vs.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),i=this.docView.update(e),this.state.facet(Vi)!=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(ws)!=e.state.facet(ws)&&(this.viewState.mustMeasureContent=!0),(i||n||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!e.empty)for(let t of this.state.facet(bi))t(e);(a||h)&&Promise.resolve().then((()=>{a&&this.state==a.startState&&this.dispatch(a),h&&!Cs(this,h)&&l.force&&be(this.contentDOM,l.key,l.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 us(t),this.plugins=t.facet(Ci).map((t=>new Xi(t))),this.pluginMap.clear();for(let t of this.plugins)t.update(this);this.docView=new sn(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(Ci),i=t.state.facet(Ci);if(e!=i){let n=[];for(let s of i){let i=e.indexOf(s);if(i<0)n.push(new Xi(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.measureScheduled=0,t&&this.observer.forceFlush();let e=null,{scrollHeight:i,scrollTop:n,clientHeight:s}=this.scrollDOM,r=n>i-s-4?i:n;try{for(let t=0;;t++){this.updateState=1;let i=this.viewport,n=this.viewState.lineBlockAtHeight(r),s=this.viewState.measure(this);if(!s&&!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 o=[];4&s||([this.measureRequests,o]=[o,this.measureRequests]);let a=o.map((t=>{try{return t.read(this)}catch(t){return Qi(this.state,t),Es}})),l=Di.create(this,this.state,[]),h=!1,c=!1;l.flags|=s,e?e.flags|=s:e=l,this.updateState=2,l.empty||(this.updatePlugins(l),this.inputState.update(l),this.updateAttrs(),h=this.docView.update(l));for(let t=0;t1||t<-1)&&(this.scrollDOM.scrollTop+=t,c=!0)}if(h&&this.docView.updateSelection(!0),this.viewport.from==i.from&&this.viewport.to==i.to&&!c&&0==this.measureRequests.length)break}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let t of this.state.facet(bi))t(e)}get themeClasses(){return ys+" "+(this.state.facet(vs)?xs:Ss)+" "+this.state.facet(ws)}updateAttrs(){let t=Ms(this,Zi,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet($i)?"true":"false",class:"cm-content",style:`${De.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Ms(this,Ai,e);let i=this.observer.ignore((()=>{let i=ti(this.contentDOM,this.contentAttrs,e),n=ti(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)if(t.is(Ts.announce)){e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(Vi),It.mount(this.root,this.styleModules.concat($s).reverse())}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}}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 vn(this,t,wn(this,t,e,i))}moveByCharSelected(t,e,i){return vn(this,t,wn(this,t,e,i),!0)}moveByGroup(t,e){return vn(this,t,wn(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==wt.Space&&(s=e),s==e}}(this,t.head,e))))}moveToLineBoundary(t,e,i=!0){return function(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=n&&t.lineWrapping?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==Wi.LTR)?e.right-1:e.left+1,y:(r.top+r.bottom)/2});if(null!=o)return A.cursor(o,i?-1:1)}let o=hi.find(t.docView,e.head),a=o?i?o.posAtEnd:o.posAtStart:i?s.to:s.from;return A.cursor(a,i?-1:1)}(this,t,e,i)}moveVertically(t,e,i){return vn(this,t,function(t,e,i,n){let s=e.head,r=i?1:-1;if(s==(i?t.state.doc.length:0))return A.cursor(s,e.assoc);let o,a=e.goalColumn,l=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s),c=t.documentTop;if(h)null==a&&(a=h.left-l.left),o=r<0?h.top:h.bottom;else{let e=t.viewState.lineBlockAt(s);null==a&&(a=Math.min(l.right-l.left,t.defaultCharacterWidth*(s-e.from))),o=(r<0?e.top:e.bottom)+c}let u=l.left+a,d=null!=n?n:t.defaultLineHeight>>1;for(let i=0;;i+=10){let n=o+(d+i)*r,h=mn(t,{x:u,y:n},!1,r);if(nl.bottom||(r<0?hs))return A.cursor(h,e.assoc,void 0,a)}}(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(),mn(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 ue(i,s[Ni.find(s,t-n.from,-1,e)].dir==Wi.LTR==e>0)}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(yi)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Rs)return Fi(t.length);let e=this.textDirectionAt(t.from);for(let i of this.bidiCache)if(i.from==t.from&&i.dir==e)return i.order;let i=function(t,e){let i=t.length,n=e==Ui?1:2,s=e==Ui?2:1;if(!t||1==n&&!ji.test(t))return Fi(i);for(let e=0,s=n,o=n;e=0;t-=3)if(Bi[t+1]==-r){let e=Bi[t+2],i=2&e?n:4&e?1&e?s:n:0;i&&(Gi[a]=Gi[Bi[t]]=i),l=t;break}}else{if(189==Bi.length)break;Bi[l++]=a,Bi[l++]=e,Bi[l++]=h}else if(2==(o=Gi[a])||1==o){let t=o==n;h=t?0:1;for(let e=l-3;e>=0;e-=3){let i=Bi[e+2];if(2&i)break;if(t)Bi[e+2]|=2;else{if(4&i)break;Bi[e+2]|=4}}}for(let t=0;te;){let t=i,n=2!=Gi[--i];for(;i>e&&n==(2!=Gi[i-1]);)i--;o.push(new Ni(i,t,n?2:1))}else o.push(new Ni(e,t,0))}else for(let t=0;tDate.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{ge(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 ki.of(new xi("number"==typeof t?A.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}static domEventHandlers(t){return _i.define((()=>({})),{eventHandlers:t})}static theme(t,e){let i=It.newName(),n=[ws.of(i),Vi.of(Qs(`.${i}`,t))];return e&&e.dark&&n.push(vs.of(!0)),n}static baseTheme(t){return N.lowest(Vi.of(Qs("."+ys,t,ks)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),n=i&&Se.get(i)||Se.get(t);return(null===(e=null==n?void 0:n.rootView)||void 0===e?void 0:e.view)||null}}Ts.styleModule=Vi,Ts.inputHandler=wi,Ts.focusChangeEffect=vi,Ts.perLineTextDirection=yi,Ts.exceptionSink=mi,Ts.updateListener=bi,Ts.editable=$i,Ts.mouseSelectionStyle=gi,Ts.dragMovesSelection=Oi,Ts.clickAddsSelectionRange=pi,Ts.decorations=Ti,Ts.atomicRanges=Ri,Ts.scrollMargins=Ei,Ts.darkTheme=vs,Ts.contentAttributes=Ai,Ts.editorAttributes=Zi,Ts.lineWrapping=Ts.contentAttributes.of({class:"cm-lineWrapping"}),Ts.announce=ut.define();const Rs=4096,Es={};class Vs{constructor(t,e,i,n){this.from=t,this.to=e,this.dir=i,this.order=n}static update(t,e){if(e.empty)return t;let i=[],n=t.length?t[t.length-1].dir:Wi.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&&Je(r,i)}return i}const Ds=De.mac?"mac":De.windows?"win":De.linux?"linux":"key";function Ws(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 Us=N.default(Ts.domEventHandlers({keydown:(t,e)=>Bs(Ls(e.state),t,e,"editor")})),Ys=E.define({enables:Us}),qs=new WeakMap;function Ls(t){let e=t.facet(Ys),i=qs.get(e);return i||qs.set(e,i=function(t,e=Ds){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)=>{var a,l;let h=i[t]||(i[t]=Object.create(null)),c=n.split(/ (?!$)/).map((t=>function(t,e){const i=t.split(/-(?!$)/);let n,s,r,o,a=i[i.length-1];"Space"==a&&(a=" ");for(let t=0;t{let n=zs={view:e,prefix:i,scope:t};return setTimeout((()=>{zs==n&&(zs=null)}),Is),!0}]})}let u=c.join(" ");s(u,!1);let d=h[u]||(h[u]={preventDefault:!1,run:(null===(l=null===(a=h._any)||void 0===a?void 0:a.run)||void 0===l?void 0:l.slice())||[]});r&&d.run.push(r),o&&(d.preventDefault=!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,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.shift&&r(e,"Shift-"+s,n.shift,n.preventDefault)}return i}(e.reduce(((t,e)=>t.concat(e)),[]))),i}let zs=null;const Is=4e3;function Bs(t,e,i,n){let s=function(t){var e=!(Kt&&(t.ctrlKey||t.altKey||t.metaKey)||Jt&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?Gt:Nt)[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=v(b(s,0))==s.length&&" "!=s,o="",a=!1;zs&&zs.view==i&&zs.scope==n&&(o=zs.prefix+" ",(a=kn.indexOf(e.keyCode)<0)&&(zs=null));let l,h,c=new Set,u=t=>{if(t){for(let n of t.run)if(!c.has(n)&&(c.add(n),n(i,e)))return!0;t.preventDefault&&(a=!0)}return!1},d=t[n];if(d){if(u(d[o+Ws(s,e,!r)]))return!0;if(r&&(e.altKey||e.metaKey||e.ctrlKey)&&!(De.windows&&e.ctrlKey&&e.altKey)&&(l=Nt[e.keyCode])&&l!=s){if(u(d[o+Ws(l,e,!0)]))return!0;if(e.shiftKey&&(h=Gt[e.keyCode])!=s&&h!=l&&u(d[o+Ws(h,e,!1)]))return!0}else if(r&&e.shiftKey&&u(d[o+Ws(s,e,!0)]))return!0;if(u(d._any))return!0}return a}class js{constructor(t,e,i,n,s){this.className=t,this.left=e,this.top=i,this.width=n,this.height=s}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className==this.className&&(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",null!=this.width&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,i){if(i.empty){let n=t.coordsAtPos(i.head,i.assoc||1);if(!n)return[];let s=Ns(t);return[new js(e,n.left-s.left,n.top-s.top,null,n.bottom-n.top)]}return function(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];let n=Math.max(i.from,t.viewport.from),s=Math.min(i.to,t.viewport.to),r=t.textDirection==Wi.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=Ns(t),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),u=a.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),d=a.right-(c?parseInt(c.paddingRight):0),f=Fs(t,n),p=Fs(t,s),O=f.type==ii.Text?f:null,g=p.type==ii.Text?p:null;t.lineWrapping&&(O&&(O=Gs(t,n,O)),g&&(g=Gs(t,s,g)));if(O&&g&&O.from==g.from)return b(w(i.from,i.to,O));{let e=O?w(i.from,null,O):v(f,!1),n=g?w(null,i.to,g):v(p,!0),s=[];return(O||f).to<(g||p).from-1?s.push(m(u,e.bottom,d,n.top)):e.bottomh&&n.from=r)break;a>s&&l(Math.max(t,s),null==e&&t<=h,Math.min(a,r),null==i&&a>=c,o.dir)}if(s=n.to+1,s>=r)break}return 0==a.length&&l(h,null==e,c,null==i,t.textDirection),{top:s,bottom:o,horizontal:a}}function v(t,e){let i=a.top+(e?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]}}}(t,e,i)}}function Ns(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Wi.LTR?e.left:e.right-t.scrollDOM.clientWidth)-t.scrollDOM.scrollLeft,top:e.top-t.scrollDOM.scrollTop}}function Gs(t,e,i){let n=A.cursor(e);return{from:Math.max(i.from,t.moveToLineBoundary(n,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(n,!0,!0).from),type:ii.Text}}function Fs(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==ii.Text))return t;return i}class Hs{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),e.above&&this.dom.classList.add("cm-layer-above"),e.class&&this.dom.classList.add(e.class),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(Js)!=t.state.facet(Js)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&t.view.requestMeasure(this.measureReq)}setOrder(t){let e=0,i=t.facet(Js);for(;e{return i=t,n=this.drawn[e],!(i.constructor==n.constructor&&i.eq(n));var i,n}))){let e=this.dom.firstChild,i=0;for(let n of t)n.update&&e&&n.constructor&&this.drawn[i].constructor&&n.update(e,this.drawn[i])?(e=e.nextSibling,i++):this.dom.insertBefore(n.draw(),e);for(;e;){let t=e.nextSibling;e.remove(),e=t}this.drawn=t}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Js=E.define();function Ks(t){return[_i.define((e=>new Hs(e,t))),Js.of(t)]}const tr=!De.ios,er=E.define({combine:t=>kt(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})});function ir(t={}){return[er.of(t),sr,or,lr,Si.of(!0)]}function nr(t){return t.startState.facet(er)!=t.state.facet(er)}const sr=Ks({above:!0,markers(t){let{state:e}=t,i=e.facet(er),n=[];for(let s of e.selection.ranges){let r=s==e.selection.main;if(s.empty?!r||tr:i.drawRangeCursor){let e=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",i=s.empty?s:A.cursor(s.head,s.head>s.anchor?-1:1);for(let s of js.forRange(t,e,i))n.push(s)}}return n},update(t,e){t.transactions.some((t=>t.selection))&&(e.style.animationName="cm-blink"==e.style.animationName?"cm-blink2":"cm-blink");let i=nr(t);return i&&rr(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){rr(e.state,t)},class:"cm-cursorLayer"});function rr(t,e){e.style.animationDuration=t.facet(er).cursorBlinkRate+"ms"}const or=Ks({above:!1,markers:t=>t.state.selection.ranges.map((e=>e.empty?[]:js.forRange(t,"cm-selectionBackground",e))).reduce(((t,e)=>t.concat(e))),update:(t,e)=>t.docChanged||t.selectionSet||t.viewportChanged||nr(t),class:"cm-selectionLayer"}),ar={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};tr&&(ar[".cm-line"].caretColor="transparent !important");const lr=N.highest(Ts.theme(ar)),hr=ut.define({map:(t,e)=>null==t?null:e.mapPos(t)}),cr=q.define({create:()=>null,update:(t,e)=>(null!=t&&(t=e.changes.mapPos(t)),e.effects.reduce(((t,e)=>e.is(hr)?e.value:t),t))}),ur=_i.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let i=t.state.field(cr);null==i?null!=this.cursor&&(null===(e=this.cursor)||void 0===e||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(cr)!=i||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let t=this.view.state.field(cr),e=null!=t&&this.view.coordsAtPos(t);if(!e)return null;let i=this.view.scrollDOM.getBoundingClientRect();return{left:e.left-i.left+this.view.scrollDOM.scrollLeft,top:e.top-i.top+this.view.scrollDOM.scrollTop,height:e.bottom-e.top}}drawCursor(t){this.cursor&&(t?(this.cursor.style.left=t.left+"px",this.cursor.style.top=t.top+"px",this.cursor.style.height=t.height+"px"):this.cursor.style.left="-100000px")}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(cr)!=t&&this.view.dispatch({effects:hr.of(t)})}},{eventHandlers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){t.target!=this.view.contentDOM&&this.view.contentDOM.contains(t.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function dr(){return[cr,ur]}function fr(t,e,i,n,s){e.lastIndex=0;for(let r,o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)if(!o.lineBreak)for(;r=e.exec(o.value);)s(a+r.index,r)}class pr{constructor(t){const{regexp:e,decoration:i,decorate:n,boundary:s,maxLength:r=1e3}=t;if(!e.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=e,n)this.addMatch=(t,e,i,s)=>n(s,i,i+t[0].length,t,e);else if("function"==typeof i)this.addMatch=(t,e,n,s)=>{let r=i(t,e,n);r&&s(n,n+t[0].length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(t,e,n,s)=>s(n,n+t[0].length,i)}this.boundary=s,this.maxLength=r}createDeco(t){let e=new Xt,i=e.add.bind(e);for(let{from:e,to:n}of function(t,e){let i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;let n=[];for(let{from:s,to:r}of i)s=Math.max(t.state.doc.lineAt(s).from,s-e),r=Math.min(t.state.doc.lineAt(r).to,r+e),n.length&&n[n.length-1].to>=s?n[n.length-1].to=r:n.push({from:s,to:r});return n}(t,this.maxLength))fr(t.state.doc,this.regexp,e,n,((e,n)=>this.addMatch(n,t,e,i)));return e.finish()}updateDeco(t,e){let i=1e9,n=-1;return t.docChanged&&t.changes.iterChanges(((e,s,r,o)=>{o>t.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e}updateRange(t,e,i,n){for(let s of t.visibleRanges){let r=Math.max(s.from,i),o=Math.min(s.to,n);if(o>r){let i=t.state.doc.lineAt(r),n=i.toi.from;r--)if(this.boundary.test(i.text[r-1-i.from])){a=r;break}for(;oc.push(i.range(t,e));if(i==n)for(this.regexp.lastIndex=a-i.from;(h=this.regexp.exec(i.text))&&h.indexthis.addMatch(i,t,e,u)));e=e.update({filterFrom:a,filterTo:l,filter:(t,e)=>tl,add:c})}}return e}}const Or=null!=/x/.unicode?"gu":"g",gr=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",Or),mr={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let br=null;const wr=E.define({combine(t){let e=kt(t,{render:null,specialChars:gr,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==br&&"undefined"!=typeof document&&document.body){let e=document.body.style;br=null!=(null!==(t=e.tabSize)&&void 0!==t?t:e.MozTabSize)}return br||!1}())&&(e.specialChars=new RegExp("\t|"+e.specialChars.source,Or)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Or)),e}});function vr(t={}){return[wr.of(t),yr||(yr=_i.fromClass(class{constructor(t){this.view=t,this.decorations=ni.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(wr)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new pr({regexp:t.specialChars,decoration:(e,i,n)=>{let{doc:s}=i.state,r=b(e[0],0);if(9==r){let t=s.lineAt(n),e=i.state.tabSize,r=Yt(t.text,e,n-t.from);return ni.replace({widget:new xr((e-r%e)*this.view.defaultCharacterWidth)})}return this.decorationCache[r]||(this.decorationCache[r]=ni.replace({widget:new Sr(t,r)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(wr);t.startState.facet(wr)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))]}let yr=null;class Sr extends ei{constructor(t,e){super(),this.options=t,this.code=e}eq(t){return t.code==this.code}toDOM(t){let e=function(t){return t>=32?"•":10==t?"␤":String.fromCharCode(9216+t)}(this.code),i=t.state.phrase("Control character")+" "+(mr[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,i,e);if(n)return n;let s=document.createElement("span");return s.textContent=e,s.title=i,s.setAttribute("aria-label",i),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class xr extends ei{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent="\t",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}class kr extends ei{constructor(t){super(),this.content=t}toDOM(){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):this.content),"string"==typeof this.content?t.setAttribute("aria-label","placeholder "+this.content):t.setAttribute("aria-hidden","true"),t}ignoreEvent(){return!1}}const Qr="-10000px";class $r{constructor(t,e,i){this.facet=e,this.createTooltipView=i,this.input=t.state.facet(e),this.tooltips=this.input.filter((t=>t)),this.tooltipViews=this.tooltips.map(i)}update(t){var e;let i=t.state.facet(this.facet),n=i.filter((t=>t));if(i===this.input){for(let e of this.tooltipViews)e.update&&e.update(t);return!1}let s=[];for(let e=0;e{var e,i,n;return{position:De.ios?"absolute":(null===(e=t.find((t=>t.position)))||void 0===e?void 0:e.position)||"fixed",parent:(null===(i=t.find((t=>t.parent)))||void 0===i?void 0:i.parent)||null,tooltipSpace:(null===(n=t.find((t=>t.tooltipSpace)))||void 0===n?void 0:n.tooltipSpace)||Pr}}}),_r=new WeakMap,Xr=_i.fromClass(class{constructor(t){this.view=t,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(Cr);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new $r(t,Tr,(t=>this.createTooltip(t))),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout((()=>{this.measureTimeout=-1,this.maybeMeasure()}),50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t);e&&this.observeIntersection();let i=e||t.geometryChanged,n=t.state.facet(Cr);if(n.position!=this.position){this.position=n.position;for(let t of this.manager.tooltipViews)t.dom.style.position=this.position;i=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let t of this.manager.tooltipViews)this.container.appendChild(t.dom);i=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure()}createTooltip(t){let e=t.create(this.view);if(e.dom.classList.add("cm-tooltip"),t.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",e.dom.appendChild(t)}return e.dom.style.position=this.position,e.dom.style.top=Qr,this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var t,e;this.view.win.removeEventListener("resize",this.measureSoon);for(let e of this.manager.tooltipViews)e.dom.remove(),null===(t=e.destroy)||void 0===t||t.call(e);null===(e=this.intersectionObserver)||void 0===e||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=this.view.dom.getBoundingClientRect();return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map(((t,e)=>{let i=this.manager.tooltipViews[e];return i.getCoords?i.getCoords(t.pos):this.view.coordsAtPos(t.pos)})),size:this.manager.tooltipViews.map((({dom:t})=>t.getBoundingClientRect())),space:this.view.state.facet(Cr).tooltipSpace(this.view)}}writeMeasure(t){var e;let{editor:i,space:n}=t,s=[];for(let r=0;r=Math.min(i.bottom,n.bottom)||h.rightMath.min(i.right,n.right)+.1){l.style.top=Qr;continue}let u=o.arrow?a.dom.querySelector(".cm-tooltip-arrow"):null,d=u?7:0,f=c.right-c.left,p=null!==(e=_r.get(a))&&void 0!==e?e:c.bottom-c.top,O=a.offset||Ar,g=this.view.textDirection==Wi.LTR,m=c.width>n.right-n.left?g?n.left:n.right-c.width:g?Math.min(h.left-(u?14:0)+O.x,n.right-f):Math.max(n.left,h.left-f+(u?14:0)-O.x),b=!!o.above;!o.strictSide&&(b?h.top-(c.bottom-c.top)-O.yn.bottom)&&b==n.bottom-h.bottom>h.top-n.top&&(b=!b);let w=(b?h.top-n.top:n.bottom-h.bottom)-d;if(wm&&t.topv&&(v=b?t.top-p-2-d:t.bottom+d+2);"absolute"==this.position?(l.style.top=v-t.parent.top+"px",l.style.left=m-t.parent.left+"px"):(l.style.top=v+"px",l.style.left=m+"px"),u&&(u.style.left=h.left+(g?O.x:-O.x)-(m+14-7)+"px"),!0!==a.overlap&&s.push({left:m,top:v,right:y,bottom:v+p}),l.classList.toggle("cm-tooltip-above",b),l.classList.toggle("cm-tooltip-below",!b),a.positioned&&a.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=Qr}},{eventHandlers:{scroll(){this.maybeMeasure()}}}),Zr=Ts.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Ar={x:0,y:0},Tr=E.define({enables:[Xr,Zr]});function Rr(t,e){let i=t.plugin(Xr);if(!i)return null;let n=i.manager.tooltips.indexOf(e);return n<0?null:i.manager.tooltipViews[n]}const Er=E.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 Vr(t,e){let i=t.plugin(Mr),n=i?i.specs.indexOf(e):-1;return n>-1?i.panels[n]:null}const Mr=_i.fromClass(class{constructor(t){this.input=t.state.facet(Ur),this.specs=this.input.filter((t=>t)),this.panels=this.specs.map((e=>e(t)));let e=t.state.facet(Er);this.top=new Dr(t,!0,e.topContainer),this.bottom=new Dr(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(Er);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Dr(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Dr(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(Ur);if(i!=this.input){let e=i.filter((t=>t)),n=[],s=[],r=[],o=[];for(let i of e){let e,a=this.specs.indexOf(i);a<0?(e=i(t.view),o.push(e)):(e=this.panels[a],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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}}))});class Dr{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=Wr(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=Wr(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 Wr(t){let e=t.nextSibling;return t.remove(),e}const Ur=E.define({enables:Mr});class Yr extends Qt{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Yr.prototype.elementClass="",Yr.prototype.toDOM=void 0,Yr.prototype.mapMode=S.TrackBefore,Yr.prototype.startSide=Yr.prototype.endSide=-1,Yr.prototype.point=!0;const qr=E.define(),Lr={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>_t.empty,lineMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},zr=E.define();function Ir(t){return[jr(),zr.of(Object.assign(Object.assign({},Lr),t))]}const Br=E.define({combine:t=>t.some((t=>t))});function jr(t){let e=[Nr];return t&&!1===t.fixed&&e.push(Br.of(!0)),e}const Nr=_i.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+"px",this.gutters=t.state.facet(zr).map((e=>new Jr(t,e)));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!t.state.facet(Br),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(Br)!=!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=_t.iter(this.view.state.facet(qr),this.view.viewport.from),n=[],s=this.gutters.map((t=>new Hr(t,this.view.viewport,-this.view.documentPadding.top)));for(let t of this.view.viewportLineBlocks){let e;if(Array.isArray(t.type)){for(let i of t.type)if(i.type==ii.Text){e=i;break}}else e=t.type==ii.Text?t:void 0;if(e){n.length&&(n=[]),Fr(i,n,t.from);for(let t of s)t.line(this.view,e,n)}}for(let t of s)t.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(zr),i=t.state.facet(zr),n=t.docChanged||t.heightChanged||t.viewportChanged||!_t.eq(t.startState.facet(qr),t.state.facet(qr),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 Jr(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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&0!=i.gutters.length&&i.fixed?e.textDirection==Wi.LTR?{left:i.dom.offsetWidth}:{right:i.dom.offsetWidth}:null}))});function Gr(t){return Array.isArray(t)?t:[t]}function Fr(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class Hr{constructor(t,e,i){this.gutter=t,this.height=i,this.i=0,this.cursor=_t.iter(t.markers,e.from)}line(t,e,i){let n=[];Fr(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;if(0==n.length&&!r.config.renderEmptyElements)return;let o=e.top-this.height;if(this.i==r.elements.length){let i=new Kr(t,e.height,o,n);r.elements.push(i),r.dom.appendChild(i.dom)}else r.elements[this.i].update(t,e.height,o,n);this.height=e.bottom,this.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 Jr{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=Gr(e.markers(t)),e.initialSpacer&&(this.spacer=new Kr(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=Gr(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!_t.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 Kr{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.dom.style.height=(this.height=e)+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),function(t,e){if(t.length!=e.length)return!1;for(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 io extends Yr{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function no(t,e){return t.state.facet(eo).formatNumber(e,t.state)}const so=zr.compute([eo],(t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:t=>t.state.facet(to),lineMarker:(t,e,i)=>i.some((t=>t.toDOM))?null:new io(no(t,t.state.doc.lineAt(e.from).number)),lineMarkerChange:t=>t.startState.facet(eo)!=t.state.facet(eo),initialSpacer:t=>new io(no(t,ro(t.state.doc.lines))),updateSpacer(t,e){let i=no(e.view,ro(e.view.state.doc.lines));return i==t.number?t:new io(i)},domEventHandlers:t.facet(eo).domEventHandlers})));function ro(t){let e=9;for(;e{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=fo.match(t)),e=>{let i=t(e);return void 0===i?null:[this,i]}}}ho.closedBy=new ho({deserialize:t=>t.split(" ")}),ho.openedBy=new ho({deserialize:t=>t.split(" ")}),ho.group=new ho({deserialize:t=>t.split(" ")}),ho.contextHash=new ho({perNode:!0}),ho.lookAhead=new ho({perNode:!0}),ho.mounted=new ho({perNode:!0});class co{constructor(t,e,i){this.tree=t,this.overlay=e,this.parser=i}}const uo=Object.create(null);class fo{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):uo,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),n=new fo(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(ho.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(ho.group),n=-1;n<(i?i.length:0);n++){let s=e[n<0?t.name:i[n]];if(s)return s}}}}fo.none=new fo("",Object.create(null),0,8);class po{constructor(t){this.types=t;for(let e=0;e=n&&(r.type.isAnonymous||!1!==e(r))){if(r.firstChild())continue;t=!0}for(;t&&i&&!r.type.isAnonymous&&i(r),!r.nextSibling();){if(!r.parent())return;t=!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:To(fo.none,this.children,this.positions,0,this.children.length,0,this.length,((t,e,i)=>new bo(this.type,t,e,i,this.propValues)),t.makeTree||((t,e,i)=>new bo(fo.none,t,e,i)))}static build(t){return function(t){var e;let{buffer:i,nodeSet:n,maxBufferLength:s=oo,reused:r=[],minRepeatType:o=n.types.length}=t,a=Array.isArray(i)?new wo(i,i.length):i,l=n.types,h=0,c=0;function u(t,e,i,m,b){let{id:w,start:v,end:y,size:S}=a,x=c;for(;S<0;){if(a.next(),-1==S){let e=r[w];return i.push(e),void m.push(v-t)}if(-3==S)return void(h=w);if(-4==S)return void(c=w);throw new RangeError(`Unrecognized record size: ${S}`)}let k,Q,$=l[w],P=v-t;if(y-v<=s&&(Q=O(a.pos-e,b))){let e=new Uint16Array(Q.size-Q.skip),i=a.pos-Q.size,s=e.length;for(;a.pos>i;)s=g(Q.start,e,s);k=new vo(e,y-Q.start,n),P=Q.start-t}else{let t=a.pos-S;a.next();let e=[],i=[],n=w>=o?w:-1,r=0,l=y;for(;a.pos>t;)n>=0&&a.id==n&&a.size>=0?(a.end<=l-s&&(f(e,i,v,r,a.end,l,n,x),r=e.length,l=a.end),a.next()):u(v,t,e,i,n);if(n>=0&&r>0&&r-1&&r>0){let t=d($);k=To($,e,i,0,e.length,0,y-v,t,t)}else k=p($,e,i,y-v,x-y)}i.push(k),m.push(P)}function d(t){return(e,i,n)=>{let s,r,o=0,a=e.length-1;if(a>=0&&(s=e[a])instanceof bo){if(!a&&s.type==t&&s.length==n)return s;(r=s.prop(ho.lookAhead))&&(o=i[a]+s.length+r)}return p(t,e,i,n,o)}}function f(t,e,i,s,r,o,a,l){let h=[],c=[];for(;t.length>s;)h.push(t.pop()),c.push(e.pop()+i-r);t.push(p(n.types[a],h,c,o-r,l-o)),e.push(r-i)}function p(t,e,i,n,s=0,r){if(h){let t=[ho.contextHash,h];r=r?[t].concat(r):[t]}if(s>25){let t=[ho.lookAhead,s];r=r?[t].concat(r):[t]}return new bo(t,e,i,n,r)}function O(t,e){let i=a.fork(),n=0,r=0,l=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=l,l+=4,n+=4,i.next();continue}let a=i.pos-t;if(t<0||a=o?4:0,d=i.start;for(i.next();i.pos>a;){if(i.size<0){if(-3!=i.size)break t;u+=4}else i.id>=o&&(u+=4);i.next()}r=d,n+=t,l+=u}return(e<0||n==t)&&(c.size=n,c.start=r,c.skip=l),c.size>4?c:void 0}function g(t,e,i){let{id:n,start:s,end:r,size:l}=a;if(a.next(),l>=0&&n4){let n=a.pos-(l-4);for(;a.pos>n;)i=g(t,e,i)}e[--i]=o,e[--i]=r-t,e[--i]=s-t,e[--i]=n}else-3==l?h=n:-4==l&&(c=n);return i}let m=[],b=[];for(;a.pos>0;)u(t.start||0,t.bufferStart||0,m,b,-1);let w=null!==(e=t.length)&&void 0!==e?e:m.length?b[0]+m[0].length:0;return new bo(l[t.topID],m.reverse(),b.reverse(),w)}(t)}}bo.empty=new bo(fo.none,[],[],0);class wo{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 wo(this.buffer,this.index)}}class vo{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return fo.none}toString(){let t=[];for(let e=0;e0));a=r[a+3]);return o}slice(t,e,i){let n=this.buffer,s=new Uint16Array(e-t),r=0;for(let o=t,a=0;o=e&&ie;case 1:return i<=e&&n>e;case 2:return n>e;case 4:return!0}}function So(t,e){let i=t.childBefore(e);for(;i;){let e=i.lastChild;if(!e||e.to!=i.to)break;e.type.isError&&e.from==e.to?(t=i,i=e.prevSibling):i=e}return t}function xo(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!=l;t+=e){let l=o[t],h=a[t]+r.from;if(yo(n,i,h,h+l.length))if(l instanceof vo){if(s&mo.ExcludeBuffers)continue;let o=l.findChild(0,l.buffer.length,e,i-h,n);if(o>-1)return new Co(new Po(r,l,t,h),null,o)}else if(s&mo.IncludeAnonymous||!l.type.isAnonymous||Xo(l)){let o;if(!(s&mo.IgnoreMounts)&&l.props&&(o=l.prop(ho.mounted))&&!o.overlay)return new ko(o.tree,h,t,r);let a=new ko(l,h,t,r);return s&mo.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(e<0?l.children.length-1:0,e,i,n)}}if(s&mo.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&mo.IgnoreOverlays)&&(n=this._tree.prop(ho.mounted))&&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 ko(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}cursor(t=0){return new _o(this,t)}get tree(){return this._tree}toTree(){return this._tree}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return So(this,t)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}toString(){return this._tree.toString()}get node(){return this}matchContext(t){return $o(this,t)}}function Qo(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 $o(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 Po{constructor(t,e,i,n){this.parent=t,this.buffer=e,this.index=i,this.start=n}}class Co{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){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 Co(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&mo.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 Co(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 Co(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 Co(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}cursor(t=0){return new _o(this,t)}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 bo(this.type,t,e,this.to-this.from)}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return So(this,t)}toString(){return this.context.buffer.childString(this.index)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}get node(){return this}matchContext(t){return $o(this,t)}}class _o{get name(){return this.type.name}constructor(t,e=0){if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof ko)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let e=t._parent;e;e=e._parent)this.stack.unshift(e.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return!!t&&(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0)}yieldBuf(t,e){this.index=t;let{start:i,buffer:n}=this.buffer;return this.type=e||n.set.types[n.buffer[t]],this.from=i+n.buffer[t+1],this.to=i+n.buffer[t+2],!0}yield(t){return!!t&&(t instanceof ko?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,i){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,i,this.mode));let{buffer:n}=this.buffer,s=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.buffer.start,i);return!(s<0)&&(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,i=this.mode){return this.buffer?!(i&mo.ExcludeBuffers)&&this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&mo.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&mo.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode));let{buffer:e}=this.buffer,i=this.stack.length-1;if(t<0){let t=i<0?0:this.stack[i]+4;if(this.index!=t)return this.yieldBuf(e.findChild(t,this.index,-1,0,4))}else{let t=e.buffer[this.index+3];if(t<(i<0?e.buffer.length:e.buffer[this.stack[i]+3]))return this.yieldBuf(t)}return i<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,i,{buffer:n}=this;if(n){if(t>0){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&mo.IncludeAnonymous||t instanceof vo||!t.type.isAnonymous||Xo(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 $o(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 Xo(t){return t.children.some((t=>t instanceof vo||!t.type.isAnonymous||Xo(t)))}const Zo=new WeakMap;function Ao(t,e){if(!t.isAnonymous||e instanceof vo||e.type!=t)return 1;let i=Zo.get(e);if(null==i){i=1;for(let n of e.children){if(n.type!=t||!(n instanceof bo)){i=1;break}i+=Ao(t,n)}Zo.set(e,i)}return i}function To(t,e,i,n,s,r,o,a,l){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]+a);continue}u.push(i[s])}else{let e=n[h-1]+i[h-1].length-f;u.push(To(t,i,n,s,h,f,e,null,l))}d.push(f+a-r)}}(e,i,n,s,0),(a||l)(u,d,o)}class Ro{constructor(){this.map=new WeakMap}setBuffer(t,e,i){let n=this.map.get(t);n||this.map.set(t,n=new Map),n.set(e,i)}getBuffer(t,e){let i=this.map.get(t);return i&&i.get(e)}set(t,e){t instanceof Co?this.setBuffer(t.context.buffer,t.index,e):t instanceof ko&&this.map.set(t.tree,e)}get(t){return t instanceof Co?this.getBuffer(t.context.buffer,t.index):t instanceof ko?this.map.get(t.tree):void 0}cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}}class Eo{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 Eo(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,a=0,l=0;;o++){let h=o=i)for(;r&&r.from=e.from||c<=e.to||l){let t=Math.max(e.from,a)-l,i=Math.min(e.to,c)-l;e=t>=i?null:new Eo(t,i,e.tree,e.offset+l,o>0,!!h)}if(e&&n.push(e),r.to>c)break;r=snew lo(t.from,t.to))):[new lo(0,0)]:[new lo(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 Mo{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)}}function Do(t){return(e,i,n,s)=>new qo(e,t,i,n,s)}class Wo{constructor(t,e,i,n,s){this.parser=t,this.parse=e,this.overlay=i,this.target=n,this.ranges=s}}class Uo{constructor(t,e,i,n,s,r,o){this.parser=t,this.predicate=e,this.mounts=i,this.index=n,this.start=s,this.target=r,this.prev=o,this.depth=0,this.ranges=[]}}const Yo=new ho({perNode:!0});class qo{constructor(t,e,i,n,s){this.nest=e,this.input=i,this.fragments=n,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=t}advance(){if(this.baseParse){let t=this.baseParse.advance();if(!t)return null;if(this.baseParse=null,this.baseTree=t,this.startInner(),null!=this.stoppedAt)for(let t of this.inner)t.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let t=this.baseTree;return null!=this.stoppedAt&&(t=new bo(t.type,t.children,t.positions,t.length,t.propValues.concat([[Yo,this.stoppedAt]]))),t}let t=this.inner[this.innerDone],e=t.parse.advance();if(e){this.innerDone++;let i=Object.assign(Object.create(null),t.target.props);i[ho.mounted.id]=new co(e,t.overlay,t.parser),t.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let t=this.input.length;for(let e=this.innerDone;et.frag.from<=n.from&&t.frag.to>=n.to&&t.mount.overlay));if(t)for(let i of t.mount.overlay){let s=i.from+t.pos,r=i.to+t.pos;s>=n.from&&r<=n.to&&!e.ranges.some((t=>t.froms))&&e.ranges.push({from:s,to:r})}}a=!1}else if(i&&(r=Lo(i.ranges,n.from,n.to)))a=2!=r;else if(!n.type.isAnonymous&&n.fromnew lo(t.from-n.from,t.to-n.from))):null,n.tree,t)),s.overlay?t.length&&(i={ranges:t,depth:0,prev:i}):a=!1}}else e&&(o=e.predicate(n))&&(!0===o&&(o=new lo(n.from,n.to)),o.fromnew lo(t.from-e.start,t.to-e.start))),e.target,t)),e=e.prev}i&&! --i.depth&&(i=i.prev)}}}}function Lo(t,e,i){for(let n of t){if(n.from>=i)break;if(n.to>e)return n.from<=e&&n.to>=i?2:1}return 0}function zo(t,e,i,n,s,r){if(e=e.to);n++);let o=s.children[n],a=o.buffer;s.children[n]=function t(i,n,s,l,h){let c=i;for(;a[c+2]+r<=e.from;)c=a[c+3];let u=[],d=[];zo(o,i,c,u,d,l);let f=a[c+1],p=a[c+2],O=f+r==e.from&&p+r==e.to&&a[c]==e.type.id;return u.push(O?e.toTree():t(c+4,a[c+3],o.set.types[a[c]],f,p-f)),d.push(f-l),zo(o,a[c+3],n,u,d,l),new bo(s,u,d,h)}(0,a.length,fo.none,0,o.length);for(let n=0;n<=i;n++)t.childAfter(e.from)}class Bo{constructor(t,e){this.offset=e,this.done=!1,this.cursor=t.cursor(mo.IncludeAnonymous|mo.IgnoreMounts)}moveTo(t){let{cursor:e}=this,i=t-this.offset;for(;!this.done&&e.from=t&&e.enter(i,1,mo.IgnoreOverlays|mo.ExcludeBuffers)||e.next(!1)||(this.done=!0)}hasNode(t){if(this.moveTo(t.from),!this.done&&this.cursor.from+this.offset==t.from&&this.cursor.tree)for(let e=this.cursor.tree;;){if(e==t.tree)return!0;if(!(e.children.length&&0==e.positions[0]&&e.children[0]instanceof bo))break;e=e.children[0]}return!1}}let jo=class{constructor(t){var e;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){let i=this.curFrag=t[0];this.curTo=null!==(e=i.tree.prop(Yo))&&void 0!==e?e:i.to,this.inner=new Bo(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t)}nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=null!==(t=e.tree.prop(Yo))&&void 0!==t?t:e.to,this.inner=new Bo(e.tree,-e.offset)}}findMounts(t,e){var i;let n=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let t=this.inner.cursor.node;t;t=t.parent){let s=null===(i=t.tree)||void 0===i?void 0:i.prop(ho.mounted);if(s&&s.parser==e)for(let e=this.fragI;e=t.to)break;i.tree==this.curFrag.tree&&n.push({frag:i,pos:t.from-i.offset,mount:s})}}}return n}};function No(t,e){let i=null,n=e;for(let s=1,r=0;s=a)break;t.to<=o||(i||(n=i=e.slice()),t.froma&&i.splice(r+1,0,new lo(a,t.to))):t.to>a?i[r--]=new lo(a,t.to):i.splice(r--,1))}}return n}function Go(t,e,i,n){let s=0,r=0,o=!1,a=!1,l=-1e9,h=[];for(;;){let c=s==t.length?1e9:o?t[s].to:t[s].from,u=r==e.length?1e9:a?e[r].to:e[r].from;if(o!=a){let t=Math.max(l,i),e=Math.min(c,u,n);tnew lo(t.from+n,t.to+n))),a,l);for(let e=0,n=a;;e++){let a=e==o.length,h=a?l:o[e].from;if(h>n&&i.push(new Eo(n,h,s.tree,-t,r.from>=n||r.openStart,r.to<=h||r.openEnd)),a)break;n=o[e].to}}else i.push(new Eo(a,l,s.tree,-t,r.from>=t||r.openStart,r.to<=o||r.openEnd))}return i}let Ho=0;class Jo{constructor(t,e,i){this.set=t,this.base=e,this.modified=i,this.id=Ho++}static define(t){if(null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let e=new Jo([],null,[]);if(e.set.push(e),t)for(let i of t.set)e.set.push(i);return e}static defineModifier(){let t=new ta;return e=>e.modified.indexOf(t)>-1?e:ta.get(e.base||e,e.modified.concat(t).sort(((t,e)=>t.id-e.id)))}}let Ko=0;class ta{constructor(){this.instances=[],this.id=Ko++}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 Jo(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(ta.get(e,t));return s}}function ea(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,a=i[o];if(!a)throw new RangeError("Invalid path: "+t);let l=new na(n,s,o>0?i.slice(0,o):null);e[a]=l.sort(e[a])}}return ia.add(e)}const ia=new ho;class na{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 ra(t,e,i,n=0,s=t.length){let r=new oa(n,Array.isArray(e)?e:[e],i);r.highlightRange(t.cursor(),n,s,"",r.highlighters),r.flush(s)}na.empty=new na([],2,null);class oa{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:a}=t;if(o>=i||a<=e)return;r.isTop&&(s=this.highlighters.filter((t=>!t.scope||t.scope(r))));let l=n,h=function(t){let e=t.type.prop(ia);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}(t)||na.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&&(l&&(l+=" "),l+=c,1==h.mode&&(n+=(n?" ":"")+c)),this.startSpan(t.from,l),h.opaque)return;let u=t.tree&&t.tree.prop(ho.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 d=0,f=o;;d++){let p=d=O)&&t.nextSibling()););if(!p||O>i)break;f=p.to+o,f>e&&(this.highlightRange(r.cursor(),Math.max(e,p.from+o),Math.min(i,f),n,h),this.startSpan(f,l))}c&&t.parent()}else if(t.firstChild()){do{if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,n,s),this.startSpan(Math.min(i,t.to),l)}}while(t.nextSibling());t.parent()}}}const aa=Jo.define,la=aa(),ha=aa(),ca=aa(ha),ua=aa(ha),da=aa(),fa=aa(da),pa=aa(da),Oa=aa(),ga=aa(Oa),ma=aa(),ba=aa(),wa=aa(),va=aa(wa),ya=aa(),Sa={comment:la,lineComment:aa(la),blockComment:aa(la),docComment:aa(la),name:ha,variableName:aa(ha),typeName:ca,tagName:aa(ca),propertyName:ua,attributeName:aa(ua),className:aa(ha),labelName:aa(ha),namespace:aa(ha),macroName:aa(ha),literal:da,string:fa,docString:aa(fa),character:aa(fa),attributeValue:aa(fa),number:pa,integer:aa(pa),float:aa(pa),bool:aa(da),regexp:aa(da),escape:aa(da),color:aa(da),url:aa(da),keyword:ma,self:aa(ma),null:aa(ma),atom:aa(ma),unit:aa(ma),modifier:aa(ma),operatorKeyword:aa(ma),controlKeyword:aa(ma),definitionKeyword:aa(ma),moduleKeyword:aa(ma),operator:ba,derefOperator:aa(ba),arithmeticOperator:aa(ba),logicOperator:aa(ba),bitwiseOperator:aa(ba),compareOperator:aa(ba),updateOperator:aa(ba),definitionOperator:aa(ba),typeOperator:aa(ba),controlOperator:aa(ba),punctuation:wa,separator:aa(wa),bracket:va,angleBracket:aa(va),squareBracket:aa(va),paren:aa(va),brace:aa(va),content:Oa,heading:ga,heading1:aa(ga),heading2:aa(ga),heading3:aa(ga),heading4:aa(ga),heading5:aa(ga),heading6:aa(ga),contentSeparator:aa(Oa),list:aa(Oa),quote:aa(Oa),emphasis:aa(Oa),strong:aa(Oa),link:aa(Oa),monospace:aa(Oa),strikethrough:aa(Oa),inserted:aa(),deleted:aa(),changed:aa(),invalid:aa(),meta:ya,documentMeta:aa(ya),annotation:aa(ya),processingInstruction:aa(ya),definition:Jo.defineModifier(),constant:Jo.defineModifier(),function:Jo.defineModifier(),standard:Jo.defineModifier(),local:Jo.defineModifier(),special:Jo.defineModifier()};var xa;sa([{tag:Sa.link,class:"tok-link"},{tag:Sa.heading,class:"tok-heading"},{tag:Sa.emphasis,class:"tok-emphasis"},{tag:Sa.strong,class:"tok-strong"},{tag:Sa.keyword,class:"tok-keyword"},{tag:Sa.atom,class:"tok-atom"},{tag:Sa.bool,class:"tok-bool"},{tag:Sa.url,class:"tok-url"},{tag:Sa.labelName,class:"tok-labelName"},{tag:Sa.inserted,class:"tok-inserted"},{tag:Sa.deleted,class:"tok-deleted"},{tag:Sa.literal,class:"tok-literal"},{tag:Sa.string,class:"tok-string"},{tag:Sa.number,class:"tok-number"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],class:"tok-string2"},{tag:Sa.variableName,class:"tok-variableName"},{tag:Sa.local(Sa.variableName),class:"tok-variableName tok-local"},{tag:Sa.definition(Sa.variableName),class:"tok-variableName tok-definition"},{tag:Sa.special(Sa.variableName),class:"tok-variableName2"},{tag:Sa.definition(Sa.propertyName),class:"tok-propertyName tok-definition"},{tag:Sa.typeName,class:"tok-typeName"},{tag:Sa.namespace,class:"tok-namespace"},{tag:Sa.className,class:"tok-className"},{tag:Sa.macroName,class:"tok-macroName"},{tag:Sa.propertyName,class:"tok-propertyName"},{tag:Sa.operator,class:"tok-operator"},{tag:Sa.comment,class:"tok-comment"},{tag:Sa.meta,class:"tok-meta"},{tag:Sa.invalid,class:"tok-invalid"},{tag:Sa.punctuation,class:"tok-punctuation"}]);const ka=new ho;function Qa(t){return E.define({combine:t?e=>e.concat(t):void 0})}const $a=new ho;class Pa{constructor(t,e,i=[],n=""){this.data=t,this.name=n,xt.prototype.hasOwnProperty("tree")||Object.defineProperty(xt.prototype,"tree",{get(){return Xa(this)}}),this.parser=e,this.extension=[Wa.of(this),xt.languageData.of(((t,e,i)=>{let n=Ca(t,e,i),s=n.type.prop(ka);if(!s)return[];let r=t.facet(s),o=n.type.prop($a);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 Ca(t,e,i).type.prop(ka)==this.data}findRegions(t){let e=t.facet(Wa);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(ka)==this.data)return void i.push({from:e,to:e+t.length});let s=t.prop(ho.mounted);if(s){if(s.tree.prop(ka)==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;it.isTop?e:void 0))]}),t.name)}configure(t,e){return new _a(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Xa(t){let e=t.field(Pa.state,!1);return e?e.tree:bo.empty}class Za{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let i=this.cursorPos-this.string.length;return t=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i)}}let Aa=null;class Ta{constructor(t,e,i=[],n,s,r,o,a){this.parser=t,this.state=e,this.fragments=i,this.tree=n,this.treeLen=s,this.viewport=r,this.skipped=o,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(t,e,i){return new Ta(t,e,[],bo.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Za(this.state.doc),this.fragments)}work(t,e){return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=bo.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(Eo.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Aa;Aa=this;try{return t()}finally{Aa=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=Ra(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=Eo.applyChanges(i,e),n=bo.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=Ra(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 Vo{createParse(e,i,n){let s=n[0].from,r=n[n.length-1].to;return{parsedPos:s,advance(){let e=Aa;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 bo(fo.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 Aa}}function Ra(t,e,i){return Eo.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class Ea{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 Ea(e)}static init(t){let e=Math.min(3e3,t.doc.length),i=Ta.create(t.facet(Wa).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new Ea(i)}}Pa.state=q.define({create:Ea.init,update(t,e){for(let t of e.effects)if(t.is(Pa.setState))return t.value;return e.startState.facet(Wa)!=e.state.facet(Wa)?Ea.init(e.state):t.apply(e)}});let Va=t=>{let e=setTimeout((()=>t()),500);return()=>clearTimeout(e)};"undefined"!=typeof requestIdleCallback&&(Va=t=>{let e=-1,i=setTimeout((()=>{e=requestIdleCallback(t,{timeout:400})}),100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const Ma="undefined"!=typeof navigator&&(null===(xa=navigator.scheduling)||void 0===xa?void 0:xa.isInputPending)?()=>navigator.scheduling.isInputPending():null,Da=_i.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(Pa.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),t.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(Pa.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=Va(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEndn+1e3,a=s.context.work((()=>Ma&&Ma()||Date.now()>r),n+(o?0:1e5));this.chunkBudget-=Date.now()-e,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Pa.setState.of(new Ea(s.context))})),this.chunkBudget>0&&(!a||o)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then((()=>this.scheduleWork())).catch((t=>Qi(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()}}}),Wa=E.define({combine:t=>t.length?t[0]:null,enables:t=>[Pa.state,Da,Ts.contentAttributes.compute([t],(e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}}))]});class Ua{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}class Ya{constructor(t,e,i,n,s,r=void 0){this.name=t,this.alias=e,this.extensions=i,this.filename=n,this.loadFunc=s,this.support=r,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then((t=>this.support=t),(t=>{throw this.loading=null,t})))}static of(t){let{load:e,support:i}=t;if(!e){if(!i)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");e=()=>Promise.resolve(i)}return new Ya(t.name,(t.alias||[]).concat(t.name).map((t=>t.toLowerCase())),t.extensions||[],t.filename,e,i)}static matchFilename(t,e){for(let i of t)if(i.filename&&i.filename.test(e))return i;let i=/\.([^.]+)$/.exec(e);if(i)for(let e of t)if(e.extensions.indexOf(i[1])>-1)return e;return null}static matchLanguageName(t,e,i=!0){e=e.toLowerCase();for(let i of t)if(i.alias.some((t=>t==e)))return i;if(i)for(let i of t)for(let t of i.alias){let n=e.indexOf(t);if(n>-1&&(t.length>2||!/\w/.test(e[n-1])&&!/\w/.test(e[n+t.length])))return i}return null}}const qa=E.define(),La=E.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 za(t){let e=t.facet(La);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function Ia(t,e){let i="",n=t.tabSize,s=t.facet(La)[0];if("\t"==s){for(;e>=n;)i+="\t",e-=n;s=" "}for(let t=0;t=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 Yt(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 Na=new ho;function Ga(t){let e=t.type.prop(Na);if(e)return e;let i,n=t.firstChild;if(n&&(i=n.type.prop(ho.closedBy))){let e=t.lastChild,n=e&&i.indexOf(e.name)>-1;return t=>el(t,!0,1,void 0,n&&!function(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}(t)?e.from:void 0)}return null==t.parent?Ha:null}function Fa(t,e,i){for(;t;t=t.parent){let n=Ga(t);if(n)return n(Ja.create(i,e,t))}return null}function Ha(){return 0}class Ja extends ja{constructor(t,e,i){super(t.state,t.options),this.base=t,this.pos=e,this.node=i}static create(t,e,i){return new Ja(t,e,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){let t=this.state.doc.lineAt(this.node.from);for(;;){let e=this.node.resolve(t.from);for(;e.parent&&e.parent.from==e.from;)e=e.parent;if(Ka(e,this.node))break;t=this.state.doc.lineAt(e.from)}return this.lineIndent(t.from)}continue(){let t=this.node.parent;return t?Fa(t,this.pos,this.base):0}}function Ka(t,e){for(let i=e;i;i=i.parent)if(t==i)return!0;return!1}function tl({closing:t,align:e=!0,units:i=1}){return n=>el(n,e,i,t)}function el(t,e,i,n,s){let r=t.textAfter,o=r.match(/^\s*/)[0].length,a=n&&r.slice(o,o+n.length)==n||s==t.pos+o,l=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.from{let n=t&&t.test(i.textAfter);return i.baseIndent+(n?0:e*i.unit)}}function nl(){return xt.transactionFilter.of((t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let i=t.newDoc,{head:n}=t.newSelection.main,s=i.lineAt(n);if(n>s.from+200)return t;let r=i.sliceString(s.from,n);if(!e.some((t=>t.test(r))))return t;let{state:o}=t,a=-1,l=[];for(let{head:t}of o.selection.ranges){let e=o.doc.lineAt(t);if(e.from==a)continue;a=e.from;let i=Ba(o,e.from);if(null==i)continue;let n=/^\s*/.exec(e.text)[0],s=Ia(o,i);n!=s&&l.push({from:e.from,to:e.from+n.length,insert:s})}return l.length?[t,{changes:l,sequential:!0}]:t}))}const sl=E.define(),rl=new ho;function ol(t){let e=t.firstChild,i=t.lastChild;return e&&e.toi)continue;if(s&&r.from=e&&n.to>i&&(s=n)}}return s}(t,e,i)}function hl(t,e){let i=e.mapPos(t.from,1),n=e.mapPos(t.to,-1);return i>=n?void 0:{from:i,to:n}}const cl=ut.define({map:hl}),ul=ut.define({map:hl}),dl=q.define({create:()=>ni.none,update(t,e){t=t.map(e.changes);for(let i of e.effects)i.is(cl)&&!pl(t,i.value.from,i.value.to)?t=t.update({add:[bl.range(i.value.from,i.value.to)]}):i.is(ul)&&(t=t.update({filter:(t,e)=>i.value.from!=t||i.value.to!=e,filterFrom:i.value.from,filterTo:i.value.to}));if(e.selection){let i=!1,{head:n}=e.selection.main;t.between(n,n,((t,e)=>{tn&&(i=!0)})),i&&(t=t.update({filterFrom:n,filterTo:n,filter:(t,e)=>e<=n||t>=n}))}return t},provide:t=>Ts.decorations.from(t),toJSON(t,e){let i=[];return t.between(0,e.doc.length,((t,e)=>{i.push(t,e)})),i},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let i=0;i{(!s||s.from>t)&&(s={from:t,to:e})})),s}function pl(t,e,i){let n=!1;return t.between(e,e,((t,s)=>{t==e&&s==i&&(n=!0)})),n}const Ol={placeholderDOM:null,placeholderText:"…"},gl=E.define({combine:t=>kt(t,Ol)});function ml(t){let e=[dl,yl];return t&&e.push(gl.of(t)),e}const bl=ni.replace({widget:new class extends ei{toDOM(t){let{state:e}=t,i=e.facet(gl),n=e=>{let i=t.lineBlockAt(t.posAtDOM(e.target)),n=fl(t.state,i.from,i.to);n&&t.dispatch({effects:ul.of(n)}),e.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(t,n);let s=document.createElement("span");return s.textContent=i.placeholderText,s.setAttribute("aria-label",e.phrase("folded code")),s.title=e.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=n,s}}}),wl={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class vl extends Yr{constructor(t,e){super(),this.config=t,this.open=e}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let e=document.createElement("span");return e.textContent=this.open?this.config.openText:this.config.closedText,e.title=t.state.phrase(this.open?"Fold line":"Unfold line"),e}}const yl=Ts.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Sl{constructor(t,e){let i;function n(t){let e=It.newName();return(i||(i=Object.create(null)))["."+e]=t,e}this.specs=t;const s="string"==typeof e.all?e.all:e.all?n(e.all):void 0,r=e.scope;this.scope=r instanceof Pa?t=>t.prop(ka)==r.data:r?t=>t==r:void 0,this.style=sa(t.map((t=>({tag:t.tag,class:t.class||n(Object.assign({},t,{tag:null}))}))),{all:s}).style,this.module=i?new It(i):null,this.themeType=e.themeType}static define(t,e){return new Sl(t,e||{})}}const xl=E.define(),kl=E.define({combine:t=>t.length?[t[0]]:null});function Ql(t){let e=t.facet(xl);return e.length?e:t.facet(kl)}function $l(t,e){let i,n=[Cl];return t instanceof Sl&&(t.module&&n.push(Ts.styleModule.of(t.module)),i=t.themeType),(null==e?void 0:e.fallback)?n.push(kl.of(t)):i?n.push(xl.computeN([Ts.darkTheme],(e=>e.facet(Ts.darkTheme)==("dark"==i)?[t]:[]))):n.push(xl.of(t)),n}class Pl{constructor(t){this.markCache=Object.create(null),this.tree=Xa(t.state),this.decorations=this.buildDeco(t,Ql(t.state))}update(t){let e=Xa(t.state),i=Ql(t.state),n=i!=Ql(t.startState);e.length{i.add(t,e,this.markCache[n]||(this.markCache[n]=ni.mark({class:n})))}),n,s);return i.finish()}}const Cl=N.high(_i.fromClass(Pl,{decorations:t=>t.decorations})),_l=Sl.define([{tag:Sa.meta,color:"#404740"},{tag:Sa.link,textDecoration:"underline"},{tag:Sa.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Sa.emphasis,fontStyle:"italic"},{tag:Sa.strong,fontWeight:"bold"},{tag:Sa.strikethrough,textDecoration:"line-through"},{tag:Sa.keyword,color:"#708"},{tag:[Sa.atom,Sa.bool,Sa.url,Sa.contentSeparator,Sa.labelName],color:"#219"},{tag:[Sa.literal,Sa.inserted],color:"#164"},{tag:[Sa.string,Sa.deleted],color:"#a11"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],color:"#e40"},{tag:Sa.definition(Sa.variableName),color:"#00f"},{tag:Sa.local(Sa.variableName),color:"#30a"},{tag:[Sa.typeName,Sa.namespace],color:"#085"},{tag:Sa.className,color:"#167"},{tag:[Sa.special(Sa.variableName),Sa.macroName],color:"#256"},{tag:Sa.definition(Sa.propertyName),color:"#00c"},{tag:Sa.comment,color:"#940"},{tag:Sa.invalid,color:"#f00"}]),Xl=Ts.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Zl=1e4,Al="()[]{}",Tl=E.define({combine:t=>kt(t,{afterCursor:!0,brackets:Al,maxScanDistance:Zl,renderMatch:Vl})}),Rl=ni.mark({class:"cm-matchingBracket"}),El=ni.mark({class:"cm-nonmatchingBracket"});function Vl(t){let e=[],i=t.matched?Rl:El;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 Ml=q.define({create:()=>ni.none,update(t,e){if(!e.docChanged&&!e.selection)return t;let i=[],n=e.state.facet(Tl);for(let t of e.state.selection.ranges){if(!t.empty)continue;let s=Ll(e.state,t.head,-1,n)||t.head>0&&Ll(e.state,t.head-1,1,n)||n.afterCursor&&(Ll(e.state,t.head,1,n)||t.headTs.decorations.from(t)}),Dl=[Ml,Xl];function Wl(t={}){return[Tl.of(t),Dl]}const Ul=new ho;function Yl(t,e,i){let n=t.prop(e<0?ho.openedBy:ho.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 ql(t){let e=t.type.prop(Ul);return e?e(t.node):t}function Ll(t,e,i,n={}){let s=n.maxScanDistance||Zl,r=n.brackets||Al,o=Xa(t),a=o.resolveInner(e,i);for(let n=a;n;n=n.parent){let s=Yl(n.type,i,r);if(s&&n.from0?e>=o.from&&eo.from&&e<=o.to))return zl(t,e,i,n,o,s,r)}}return function(t,e,i,n,s,r,o){let a=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%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 a=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(a+t,1).type!=s))if(e%2==0==i>0)u++;else{if(1==u)return{start:h,end:{from:a+t,to:a+t+1},matched:e>>1==l>>1};u--}}i>0&&(t+=r.length)}return c.done?{start:h,matched:!1}:null}(t,e,i,o,a.type,s,r)}function zl(t,e,i,n,s,r,o){let a=n.parent,l={from:s.from,to:s.to},h=0,c=null==a?void 0:a.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 jl(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 Nl=new WeakMap;class Gl extends Pa{constructor(t){let e,i=Qa(t.languageData),n={name:(s=t).name||"",token:s.token,blankLine:s.blankLine||(()=>{}),startState:s.startState||(()=>!0),copyState:s.copyState||jl,indent:s.indent||(()=>null),languageData:s.languageData||{},tokenTable:s.tokenTable||th};var s;super(i,new class extends Vo{createParse(t,i,n){return new Jl(e,t,i,n)}},[qa.of(((t,e)=>this.getIndent(t,e)))],t.name),this.topNode=function(t){let e=fo.define({id:eh.length,name:"Document",props:[ka.add((()=>t))]});return eh.push(e),e}(i),e=this,this.streamParser=n,this.stateAfter=new ho({perNode:!0}),this.tokenTable=t.tokenTable?new rh(n.tokenTable):oh}static define(t){return new Gl(t)}getIndent(t,e){let i,n=Xa(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=Nl.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],a=i+e.positions[r],l=o instanceof bo&&a=e.length)return e;s||e.type!=t.topNode||(s=!0);for(let r=e.children.length-1;r>=0;r--){let o,a=e.positions[r],l=e.children[r];if(ai&&Fl(t,n.tree,0-n.offset,i,r);if(o&&(e=Hl(t,n.tree,i+n.offset,o.pos+n.offset,!1)))return{state:o.state,tree:e}}return{state:t.streamParser.startState(n?za(n):4),tree:bo.empty}}(t,i,r,null==s?void 0:s.state);this.state=o,this.parsedPos=this.chunkStart=r+a.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 Bl(e,t?t.state.tabSize:4,t?za(t.state):2);if(r.eol())s.blankLine(this.state,r.indentUnit);else for(;!r.eol();){let t=Kl(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 th=Object.create(null),eh=[fo.none],ih=new po(eh),nh=[],sh=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"]])sh[t]=lh(th,e);class rh{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),sh)}resolve(t){return t?this.table[t]||(this.table[t]=lh(this.extra,t)):0}}const oh=new rh(th);function ah(t,e){nh.indexOf(t)>-1||(nh.push(t),console.warn(e))}function lh(t,e){let i=null;for(let n of e.split(".")){let e=t[n]||Sa[n];e?"function"==typeof e?i?i=e(i):ah(n,`Modifier ${n} used at start of tag`):i?ah(n,`Tag ${n} used as modifier`):i=e:ah(n,`Unknown highlighting tag ${n}`)}if(!i)return 0;let n=e.replace(/ /g,"_"),s=fo.define({id:eh.length,name:n,props:[ea({[n]:i})]});return eh.push(s),s.id}function hh(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 ch=hh(gh,0),uh=hh(Oh,0),dh=hh(((t,e)=>Oh(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 fh(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}const ph=50;function Oh(t,e,i=e.selection.ranges){let n=i.map((t=>fh(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,a=t.sliceDoc(n-ph,n),l=t.sliceDoc(s,s+ph),h=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(l)[0].length,u=a.length-h;if(a.slice(u-e.length,u)==e&&l.slice(c,c+i.length)==i)return{open:{pos:n-h,margin:h&&1},close:{pos:s+c,margin:c&&1}};s-n<=2*ph?r=o=t.sliceDoc(n,s):(r=t.sliceDoc(n,n+ph),o=t.sliceDoc(s-ph,s));let d=/^\s*/.exec(r)[0].length,f=/\s*$/.exec(o)[0].length,p=o.length-f-i.length;return r.slice(d,d+e.length)==e&&o.slice(p,p+i.length)==i?{open:{pos:n+d+e.length,margin:/\s/.test(r.charAt(d+e.length))?1:0},close:{pos:s-f-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>l.from)){s=l.from;let t=/^\s*/.exec(l.text)[0].length,e=t==l.length,i=l.text.slice(t,t+a.length)==a?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 mh=lt.define(),bh=lt.define(),wh=E.define(),vh=E.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)})});const yh=q.define({create:()=>Dh.empty,update(t,e){let i=e.state.facet(vh),n=e.annotation(mh);if(n){let s=e.docChanged?A.single(function(t){let e=0;return t.iterChangedRanges(((t,i)=>e=i)),e}(e.changes)):void 0,r=Ch.fromTransaction(e,s),o=n.side,a=0==o?t.undone:t.done;return a=r?_h(a,a.length,i.minDepth,r):Th(a,e.startState.selection),new Dh(0==o?n.rest:a,0==o?a:n.rest)}let s=e.annotation(bh);if("full"!=s&&"before"!=s||(t=t.isolate()),!1===e.annotation(dt.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);let r=Ch.fromTransaction(e),o=e.annotation(dt.time),a=e.annotation(dt.userEvent);return r?t=t.addChanges(r,o,a,i,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,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 Dh(t.done.map(Ch.fromJSON),t.undone.map(Ch.fromJSON))});function Sh(t={}){return[yh,vh.of(t),Ts.domEventHandlers({beforeinput(t,e){let i="historyUndo"==t.inputType?kh:"historyRedo"==t.inputType?Qh:null;return!!i&&(t.preventDefault(),i(e))}})]}function xh(t,e){return function({state:i,dispatch:n}){if(!e&&i.readOnly)return!1;let s=i.field(yh,!1);if(!s)return!1;let r=s.pop(t,i,e);return!!r&&(n(r),!0)}}const kh=xh(0,!1),Qh=xh(1,!1),$h=xh(0,!0),Ph=xh(1,!0);class Ch{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 Ch(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 Ch(t.changes&&k.fromJSON(t.changes),[],t.mapped&&x.fromJSON(t.mapped),t.startSelection&&A.fromJSON(t.startSelection),t.selectionsAfter.map(A.fromJSON))}static fromTransaction(t,e){let i=Zh;for(let e of t.startState.facet(wh)){let n=e(t);n.length&&(i=i.concat(n))}return!i.length&&t.changes.empty?null:new Ch(t.changes.invert(t.startState.doc),i,void 0,e||t.startState.selection,Zh)}static selection(t){return new Ch(void 0,Zh,void 0,void 0,t)}}function _h(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 Xh(t,e){return t.length?e.length?t.concat(e):t:e}const Zh=[],Ah=200;function Th(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-Ah));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),_h(t,t.length-1,1e9,i.setSelAfter(n)))}return[Ch.selection([e])]}function Rh(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 Eh(t,e){if(!t.length)return t;let i=t.length,n=Zh;for(;i;){let s=Vh(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?[Ch.selection(n)]:Zh}function Vh(t,e,i){let n=Xh(t.selectionsAfter.length?t.selectionsAfter.map((t=>t.map(e))):Zh,i);if(!t.changes)return Ch.selection(n);let s=t.changes.map(e),r=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(r):r;return new Ch(s,ut.mapEffects(t.effects,e),o,t.startSelection.map(r),n)}const Mh=/^(input\.type|delete)($|\.)/;class Dh{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 Dh(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||Mh.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)?_h(r,r.length-1,n.minDepth,new Ch(t.changes.compose(o.changes),Xh(t.effects,o.effects),o.mapped,o.startSelection,Zh)):_h(r,r.length,n.minDepth,t),new Dh(r,Zh,e,i)}addSelection(t,e,i,n){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Zh;return s.length>0&&e-this.prevTimet.empty!=o.ranges[e].empty)).length)?this:new Dh(Th(this.done,t),this.undone,e,i);var r,o}addMapping(t){return new Dh(Eh(this.done,t),Eh(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:mh.of({side:t,rest:Rh(n)}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let i=1==n.length?Zh:n.slice(0,n.length-1);return s.mapped&&(i=Eh(i,s.mapped)),e.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:mh.of({side:t,rest:i}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}}Dh.empty=new Dh(Zh,Zh);const Wh=[{key:"Mod-z",run:kh,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Qh,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Qh,preventDefault:!0},{key:"Mod-u",run:$h,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Ph,preventDefault:!0}];function Uh(t,e){return A.create(t.ranges.map(e),t.mainIndex)}function Yh(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function qh({state:t,dispatch:e},i){let n=Uh(t.selection,i);return!n.eq(t.selection)&&(e(Yh(t,n)),!0)}function Lh(t,e){return A.cursor(e?t.to:t.from)}function zh(t,e){return qh(t,(i=>i.empty?t.moveByChar(i,e):Lh(i,e)))}function Ih(t){return t.textDirectionAt(t.state.selection.main.head)==Wi.LTR}const Bh=t=>zh(t,!Ih(t)),jh=t=>zh(t,Ih(t));function Nh(t,e){return qh(t,(i=>i.empty?t.moveByGroup(i,e):Lh(i,e)))}function Gh(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 Fh(t,e,i){let n,s,r=Xa(t).resolveInner(e.head),o=i?ho.closedBy:ho.openedBy;for(let n=e.head;;){let e=i?r.childAfter(n):r.childBefore(n);if(!e)break;Gh(t,e,o)?r=e:n=i?e.to:e.from}return s=r.type.prop(o)&&(n=i?Ll(t,r.from,1):Ll(t,r.to,-1))&&n.matched?i?n.end.to:n.end.from:i?r.to:r.from,A.cursor(s,i?-1:1)}function Hh(t,e){return qh(t,(i=>{if(!i.empty)return Lh(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)}))}const Jh=t=>Hh(t,!1),Kh=t=>Hh(t,!0);function tc(t){let e,i=t.scrollDOM.clientHeighti.empty?t.moveVertically(i,e,n.height):Lh(i,e)));if(r.eq(s.selection))return!1;if(n.selfScroll){let e=t.coordsAtPos(s.selection.main.head),o=t.scrollDOM.getBoundingClientRect(),a=o.top+n.marginTop,l=o.bottom-n.marginBottom;e&&e.top>a&&e.bottomec(t,!1),nc=t=>ec(t,!0);function sc(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=A.cursor(n.from+i))}return s}function rc(t,e){let i=Uh(t.state.selection,(t=>{let i=e(t);return A.range(t.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)}));return!i.eq(t.state.selection)&&(t.dispatch(Yh(t.state,i)),!0)}function oc(t,e){return console.log("Select!"),rc(t,(i=>t.moveByCharSelected(i,e)))}const ac=t=>oc(t,!Ih(t)),lc=t=>oc(t,Ih(t));function hc(t,e){return rc(t,(i=>t.moveByGroup(i,e)))}function cc(t,e){return rc(t,(i=>t.moveVertically(i,e)))}const uc=t=>cc(t,!1),dc=t=>cc(t,!0);function fc(t,e){return rc(t,(i=>t.moveVertically(i,e,tc(t).height)))}const pc=t=>fc(t,!1),Oc=t=>fc(t,!0),gc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:0})),!0),mc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.doc.length})),!0),bc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:0})),!0),wc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0);function vc(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=yc(t,n,!0)),s=Math.min(s,n),r=Math.max(r,n)}else s=yc(t,s,!1),r=yc(t,r,!0);return s==r?{range:n}:{changes:{from:s,to:r},range:A.cursor(s)}}));return!s.changes.empty&&(t.dispatch(n.update(s,{scrollIntoView:!0,userEvent:i,effects:"delete.selection"==i?Ts.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function yc(t,e,i){if(t instanceof Ts)for(let n of t.state.facet(Ts.atomicRanges).map((e=>e(t))))n.between(e,e,((t,n)=>{te&&(e=i?n:t)}));return e}const Sc=(t,e)=>vc(t,(i=>{let n,s,{state:r}=t,o=r.doc.lineAt(i);if(!e&&i>o.from&&iSc(t,!1),kc=t=>Sc(t,!0),Qc=(t,e)=>vc(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 a=f(r.text,n-r.from,e)+r.from,l=r.text.slice(Math.min(n,a)-r.from,Math.max(n,a)-r.from),h=o(l);if(null!=t&&h!=t)break;" "==l&&n==i||(t=h),n=a}return n})),$c=t=>Qc(t,!1),Pc=t=>vc(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 _c(t,e,i){if(t.readOnly)return!1;let n=[],s=[];for(let e of Cc(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(A.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(A.range(t.anchor-o,t.head-o))}}return!!n.length&&(e(t.update({changes:n,scrollIntoView:!0,selection:A.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0)}function Xc(t,e,i){if(t.readOnly)return!1;let n=[];for(let e of Cc(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 Zc=Ac(!1);function Ac(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),a=!e&&s==r&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i,n=Xa(t).resolveInner(e),s=n.childBefore(e),r=n.childAfter(e);return s&&r&&s.to<=e&&r.from>=e&&(i=s.type.prop(ho.closedBy))&&i.indexOf(r.name)>-1&&t.doc.lineAt(s.to).from==t.doc.lineAt(r.from).from?{from:s.to,to:r.from}:null}(i,s);e&&(s=r=(r<=o.to?o:i.doc.lineAt(r)).to);let l=new ja(i,{simulateBreak:s,simulateDoubleBreak:!!a}),h=Ba(l,s);for(null==h&&(h=/^\s*/.exec(i.doc.lineAt(s).text)[0].length);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:A.range(r.mapPos(n.anchor,1),r.mapPos(n.head,1))}}))}const Rc=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{i.push({from:e.from,insert:t.facet(La)})})),{userEvent:"input.indent"})),!0),Ec=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{let n=/^\s*/.exec(e.text)[0];if(!n)return;let s=Yt(n,t.tabSize),r=0,o=Ia(t,Math.max(0,s-za(t)));for(;rqh(t,(e=>Fh(t.state,e,!Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,!Ih(t))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:t=>qh(t,(e=>Fh(t.state,e,Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,Ih(t))))},{key:"Alt-ArrowUp",run:({state:t,dispatch:e})=>_c(t,e,!1)},{key:"Shift-Alt-ArrowUp",run:({state:t,dispatch:e})=>Xc(t,e,!1)},{key:"Alt-ArrowDown",run:({state:t,dispatch:e})=>_c(t,e,!0)},{key:"Shift-Alt-ArrowDown",run:({state:t,dispatch:e})=>Xc(t,e,!0)},{key:"Escape",run:({state:t,dispatch:e})=>{let i=t.selection,n=null;return i.ranges.length>1?n=A.create([i.main]):i.main.empty||(n=A.create([A.cursor(i.main.head)])),!!n&&(e(Yh(t,n)),!0)}},{key:"Mod-Enter",run:Ac(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:t,dispatch:e})=>{let i=Cc(t).map((({from:e,to:i})=>A.range(e,Math.min(i+1,t.doc.length))));return e(t.update({selection:A.create(i),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:t,dispatch:e})=>{let i=Uh(t.selection,(e=>{var i;let n=Xa(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 A.range(n.to,n.from)}));return e(Yh(t,i)),!0},preventDefault:!0},{key:"Mod-[",run:Ec},{key:"Mod-]",run:Rc},{key:"Mod-Alt-\\",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new ja(t,{overrideIndentation:t=>{let e=i[t];return null==e?-1:e}}),s=Tc(t,((e,s,r)=>{let o=Ba(n,e.from);if(null==o)return;/\S/.test(e.text)||(o=0);let a=/^\s*/.exec(e.text)[0],l=Ia(t,o);(a!=l||r.from{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(Cc(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=Uh(t.selection,(e=>{let s=Ll(t,e.head,-1)||Ll(t,e.head,1)||e.head>0&&Ll(t,e.head-1,1)||e.head{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=fh(t.state,i.from);return n.line?ch(t):!!n.block&&dh(t)}},{key:"Alt-A",run:uh}].concat([{key:"ArrowLeft",run:Bh,shift:ac,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:t=>Nh(t,!Ih(t)),shift:t=>hc(t,!Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:t=>qh(t,(e=>sc(t,e,!Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,!Ih(t)))),preventDefault:!0},{key:"ArrowRight",run:jh,shift:lc,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:t=>Nh(t,Ih(t)),shift:t=>hc(t,Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:t=>qh(t,(e=>sc(t,e,Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,Ih(t)))),preventDefault:!0},{key:"ArrowUp",run:Jh,shift:uc,preventDefault:!0},{mac:"Cmd-ArrowUp",run:gc,shift:bc},{mac:"Ctrl-ArrowUp",run:ic,shift:pc},{key:"ArrowDown",run:Kh,shift:dc,preventDefault:!0},{mac:"Cmd-ArrowDown",run:mc,shift:wc},{mac:"Ctrl-ArrowDown",run:nc,shift:Oc},{key:"PageUp",run:ic,shift:pc},{key:"PageDown",run:nc,shift:Oc},{key:"Home",run:t=>qh(t,(e=>sc(t,e,!1))),shift:t=>rc(t,(e=>sc(t,e,!1))),preventDefault:!0},{key:"Mod-Home",run:gc,shift:bc},{key:"End",run:t=>qh(t,(e=>sc(t,e,!0))),shift:t=>rc(t,(e=>sc(t,e,!0))),preventDefault:!0},{key:"Mod-End",run:mc,shift:wc},{key:"Enter",run:Zc},{key:"Mod-a",run:({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:xc,shift:xc},{key:"Delete",run:kc},{key:"Mod-Backspace",mac:"Alt-Backspace",run:$c},{key:"Mod-Delete",mac:"Alt-Delete",run:t=>Qc(t,!0)},{mac:"Mod-Backspace",run:t=>vc(t,(e=>{let i=t.lineBlockAt(e).from;return e>i?i:Math.max(0,e-1)}))},{mac:"Mod-Delete",run:Pc}].concat([{key:"Ctrl-b",run:Bh,shift:ac,preventDefault:!0},{key:"Ctrl-f",run:jh,shift:lc},{key:"Ctrl-p",run:Jh,shift:uc},{key:"Ctrl-n",run:Kh,shift:dc},{key:"Ctrl-a",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).from,1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).from)))},{key:"Ctrl-e",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).to,-1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).to)))},{key:"Ctrl-d",run:kc},{key:"Ctrl-h",run:xc},{key:"Ctrl-k",run:Pc},{key:"Ctrl-Alt-h",run:$c},{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:A.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:f(n.text,i-n.from,!1)+n.from,r=i==n.to?i+1:f(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:A.cursor(r)}}));return!i.changes.empty&&(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:nc}].map((t=>({mac:t.key,run:t.run,shift:t.shift})))));function Mc(){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 Uc{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(Wc(t)):Wc,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 b(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=w(t),i=this.bufferStart+this.bufferPos;this.bufferPos+=v(t);let n=this.normalize(e);for(let t=0,s=i;;t++){let r=n.charCodeAt(t),o=this.match(r,s);if(o)return this.value=o,this;if(t==n.length-1)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=jc(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 Ic(e,t.sliceString(e,i));return zc.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=jc(this.text,i+(t==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ic.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function jc(t,e){if(e>=t.length)return e;let i,n=t.lineAt(e);for(;e=56320&&i<57344;)e++;return e}function Nc(t){let e=Mc("input",{class:"cm-textfield",name:"line"});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,a,l]=i,h=a?+a.slice(1):0,c=o?+o:s.number;if(o&&l){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)));t.dispatch({effects:Gc.of(!1),selection:A.cursor(u.from+Math.max(0,Math.min(h,u.length))),scrollIntoView:!0}),t.focus()}return{dom:Mc("form",{class:"cm-gotoLine",onkeydown:e=>{27==e.keyCode?(e.preventDefault(),t.dispatch({effects:Gc.of(!1)}),t.focus()):13==e.keyCode&&(e.preventDefault(),i())},onsubmit:t=>{t.preventDefault(),i()}},Mc("label",t.state.phrase("Go to line"),": ",e)," ",Mc("button",{class:"cm-button",type:"submit"},t.state.phrase("go")))}}"undefined"!=typeof Symbol&&(Lc.prototype[Symbol.iterator]=Bc.prototype[Symbol.iterator]=function(){return this});const Gc=ut.define(),Fc=q.define({create:()=>!0,update(t,e){for(let i of e.effects)i.is(Gc)&&(t=i.value);return t},provide:t=>Ur.from(t,(t=>t?Nc:null))}),Hc=Ts.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),Jc={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Kc=E.define({combine:t=>kt(t,Jc,{highlightWordAroundCursor:(t,e)=>t||e,minSelectionLength:Math.min,maxMatches:Math.min})});function tu(t){let e=[ru,su];return t&&e.push(Kc.of(t)),e}const eu=ni.mark({class:"cm-selectionMatch"}),iu=ni.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function nu(t,e,i,n){return!(0!=i&&t(e.sliceDoc(i-1,i))==wt.Word||n!=e.doc.length&&t(e.sliceDoc(n,n+1))==wt.Word)}const su=_i.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(Kc),{state:i}=t,n=i.selection;if(n.ranges.length>1)return ni.none;let s,r=n.main,o=null;if(r.empty){if(!e.highlightWordAroundCursor)return ni.none;let t=i.wordAt(r.head);if(!t)return ni.none;o=i.charCategorizer(r.head),s=i.sliceDoc(t.from,t.to)}else{let t=r.to-r.from;if(t200)return ni.none;if(e.wholeWords){if(s=i.sliceDoc(r.from,r.to),o=i.charCategorizer(r.head),!nu(o,i,r.from,r.to)||!function(t,e,i,n){return t(e.sliceDoc(i,i+1))==wt.Word&&t(e.sliceDoc(n-1,n))==wt.Word}(o,i,r.from,r.to))return ni.none}else if(s=i.sliceDoc(r.from,r.to).trim(),!s)return ni.none}let a=[];for(let n of t.visibleRanges){let t=new Uc(i.doc,s,n.from,n.to);for(;!t.next().done;){let{from:n,to:s}=t.value;if((!o||nu(o,i,n,s))&&(r.empty&&n<=r.from&&s>=r.to?a.push(iu.range(n,s)):(n>=r.to||s<=r.from)&&a.push(eu.range(n,s)),a.length>e.maxMatches))return ni.none}}return ni.set(a)}},{decorations:t=>t.decorations}),ru=Ts.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});const ou=E.define({combine:t=>kt(t,{top:!1,caseSensitive:!1,literal:!1,wholeWord:!1,createPanel:t=>new Eu(t),scrollToMatch:t=>Ts.scrollIntoView(t)})});class au{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,qc),!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 pu(this):new cu(this)}getCursor(t,e=0,i){let n=t.doc?t:xt.create({doc:t});return null==i&&(i=n.doc.length),this.regexp?uu(this,n,e,i):hu(this,n,e,i)}}class lu{constructor(t){this.spec=t}}function hu(t,e,i,n){return new Uc(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=hu(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 uu(t,e,i,n){return new Lc(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?(s=e.charCategorizer(e.selection.main.head),(t,e,i)=>!i[0].length||(s(du(i.input,i.index))!=wt.Word||s(fu(i.input,i.index))!=wt.Word)&&(s(fu(i.input,i.index+i[0].length))!=wt.Word||s(du(i.input,i.index+i[0].length))!=wt.Word)):void 0},i,n);var s}function du(t,e){return t.slice(f(t,e,!1),e)}function fu(t,e){return t.slice(e,f(t,e))}class pu extends lu{nextMatch(t,e,i){let n=uu(this.spec,t,i,t.doc.length).next();return n.done&&(n=uu(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=uu(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=uu(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 Ou=ut.define(),gu=ut.define(),mu=q.define({create:t=>new bu(_u(t).create(),null),update(t,e){for(let i of e.effects)i.is(Ou)?t=new bu(i.value.create(),t.panel):i.is(gu)&&(t=new bu(t.query,i.value?Cu:null));return t},provide:t=>Ur.from(t,(t=>t.panel))});class bu{constructor(t,e){this.query=t,this.panel=e}}const wu=ni.mark({class:"cm-searchMatch"}),vu=ni.mark({class:"cm-searchMatch cm-searchMatch-selected"}),yu=_i.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(mu))}update(t){let e=t.state.field(mu);(e!=t.startState.field(mu)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ni.none;let{view:i}=this,n=new Xt;for(let e=0,s=i.visibleRanges,r=s.length;es[e+1].from-500;)a=s[++e].to;t.highlight(i.state,o,a,((t,e)=>{let s=i.state.selection.ranges.some((i=>i.from==t&&i.to==e));n.add(t,e,s?vu:wu)}))}return n.finish()}},{decorations:t=>t.decorations});function Su(t){return e=>{let i=e.state.field(mu,!1);return i&&i.query.spec.valid?t(e,i):Au(e)}}const xu=Su(((t,{query:e})=>{let{to:i}=t.state.selection.main,n=e.nextMatch(t.state,i,i);if(!n)return!1;let s=A.single(n.from,n.to),r=t.state.facet(ou);return t.dispatch({selection:s,effects:[Wu(t,n),r.scrollToMatch(s.main,t)],userEvent:"select.search"}),Zu(t),!0})),ku=Su(((t,{query:e})=>{let{state:i}=t,{from:n}=i.selection.main,s=e.prevMatch(i,n,n);if(!s)return!1;let r=A.single(s.from,s.to),o=t.state.facet(ou);return t.dispatch({selection:r,effects:[Wu(t,s),o.scrollToMatch(r.main,t)],userEvent:"select.search"}),Zu(t),!0})),Qu=Su(((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!(!i||!i.length)&&(t.dispatch({selection:A.create(i.map((t=>A.range(t.from,t.to)))),userEvent:"select.search.matches"}),!0)})),$u=Su(((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,a,l=[],h=[];if(r.from==n&&r.to==s&&(a=i.toText(e.getReplacement(r)),l.push({from:r.from,to:r.to,insert:a}),r=e.nextMatch(i,r.from,r.to),h.push(Ts.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(n).number)+"."))),r){let e=0==l.length||l[0].from>=r.to?0:r.to-r.from-a.length;o=A.single(r.from-e,r.to-e),h.push(Wu(t,r)),h.push(i.facet(ou).scrollToMatch(o.main,t))}return t.dispatch({changes:l,selection:o,effects:h,userEvent:"input.replace"}),!0})),Pu=Su(((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:Ts.announce.of(n),userEvent:"input.replace.all"}),!0}));function Cu(t){return t.state.facet(ou).createPanel(t)}function _u(t,e){var i,n,s,r;let o=t.selection.main,a=o.empty||o.to>o.from+100?"":t.sliceDoc(o.from,o.to);if(e&&!a)return e;let l=t.facet(ou);return new au({search:(null!==(i=null==e?void 0:e.literal)&&void 0!==i?i:l.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:null!==(n=null==e?void 0:e.caseSensitive)&&void 0!==n?n:l.caseSensitive,literal:null!==(s=null==e?void 0:e.literal)&&void 0!==s?s:l.literal,wholeWord:null!==(r=null==e?void 0:e.wholeWord)&&void 0!==r?r:l.wholeWord})}function Xu(t){let e=Vr(t,Cu);return e&&e.dom.querySelector("[main-field]")}function Zu(t){let e=Xu(t);e&&e==t.root.activeElement&&e.select()}const Au=t=>{let e=t.state.field(mu,!1);if(e&&e.panel){let i=Xu(t);if(i&&i!=t.root.activeElement){let n=_u(t.state,e.query.spec);n.valid&&t.dispatch({effects:Ou.of(n)}),i.focus(),i.select()}}else t.dispatch({effects:[gu.of(!0),e?Ou.of(_u(t.state,e.query.spec)):ut.appendConfig.of(Yu)]});return!0},Tu=t=>{let e=t.state.field(mu,!1);if(!e||!e.panel)return!1;let i=Vr(t,Cu);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:gu.of(!1)}),!0},Ru=[{key:"Mod-f",run:Au,scope:"editor search-panel"},{key:"F3",run:xu,shift:ku,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:xu,shift:ku,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Tu,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 Uc(t.doc,t.sliceDoc(n,s));!e.next().done;){if(r.length>1e3)return!1;e.value.from==n&&(o=r.length),r.push(A.range(e.value.from,e.value.to))}return e(t.update({selection:A.create(r,o),userEvent:"select.search.matches"})),!0}},{key:"Alt-g",run:t=>{let e=Vr(t,Nc);if(!e){let i=[Gc.of(!0)];null==t.state.field(Fc,!1)&&i.push(ut.appendConfig.of([Fc,Hc])),t.dispatch({effects:i}),e=Vr(t,Nc)}return e&&e.dom.querySelector("input").focus(),!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=A.create(i.ranges.map((e=>t.wordAt(e.head)||A.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 Uc(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 Uc(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(A.range(s.from,s.to),!1),effects:Ts.scrollIntoView(s.to)})),!0)},preventDefault:!0}];class Eu{constructor(t){this.view=t;let e=this.query=t.state.field(mu).query.spec;function i(t,e,i){return Mc("button",{class:"cm-button",name:t,onclick:e,type:"button"},i)}this.commit=this.commit.bind(this),this.searchField=Mc("input",{value:e.search,placeholder:Vu(t,"Find"),"aria-label":Vu(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Mc("input",{value:e.replace,placeholder:Vu(t,"Replace"),"aria-label":Vu(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Mc("input",{type:"checkbox",name:"case",form:"",checked:e.caseSensitive,onchange:this.commit}),this.reField=Mc("input",{type:"checkbox",name:"re",form:"",checked:e.regexp,onchange:this.commit}),this.wordField=Mc("input",{type:"checkbox",name:"word",form:"",checked:e.wholeWord,onchange:this.commit}),this.dom=Mc("div",{onkeydown:t=>this.keydown(t),class:"cm-search"},[this.searchField,i("next",(()=>xu(t)),[Vu(t,"next")]),i("prev",(()=>ku(t)),[Vu(t,"previous")]),i("select",(()=>Qu(t)),[Vu(t,"all")]),...t.state.readOnly?[]:[Mc("br"),this.replaceField,i("replace",(()=>$u(t)),[Vu(t,"replace")]),i("replaceAll",(()=>Pu(t)),[Vu(t,"replace all")])],Mc("button",{name:"close",onclick:()=>Tu(t),"aria-label":Vu(t,"close"),type:"button"},["×"])])}commit(){let t=new au({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:Ou.of(t)}))}keydown(t){var e,i,n;e=this.view,i=t,n="search-panel",Bs(Ls(e.state),i,e,n)?t.preventDefault():13==t.keyCode&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?ku:xu)(this.view)):13==t.keyCode&&t.target==this.replaceField&&(t.preventDefault(),$u(this.view))}update(t){for(let e of t.transactions)for(let t of e.effects)t.is(Ou)&&!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(ou).top}}function Vu(t,e){return t.state.phrase(e)}const Mu=30,Du=/[\s\.,:;?!]/;function Wu(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-Mu),o=Math.min(s,i+Mu),a=t.state.sliceDoc(r,o);if(r!=n.from)for(let t=0;ta.length-Mu;t--)if(!Du.test(a[t-1])&&Du.test(a[t])){a=a.slice(0,t);break}return Ts.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${n.number}.`)}const Uu=Ts.baseTheme({".cm-panel.cm-search":{padding:"0.25rem 0.5rem 0.25rem 0.5rem",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"0.5rem",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"}}),Yu=[mu,N.lowest(yu),Uu];class qu{constructor(t,e,i){this.state=t,this.pos=e,this.explicit=i,this.abortListeners=[]}tokenBefore(t){let e=Xa(this.state).resolveInner(this.pos,-1);for(;e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null}matchBefore(t){let e=this.state.doc.lineAt(this.pos),i=Math.max(e.from,this.pos-250),n=e.text.slice(i-e.from,this.pos-e.from),s=n.search(ju(t,!1));return s<0?null:{from:i+s,to:this.pos,text:n.slice(s)}}get aborted(){return null==this.abortListeners}addEventListener(t,e){"abort"==t&&this.abortListeners&&this.abortListeners.push(e)}}function Lu(t){let e=Object.keys(t).join(""),i=/\w/.test(e);return i&&(e=e.replace(/\w/g,"")),`[${i?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function zu(t){let e=t.map((t=>"string"==typeof t?{label:t}:t)),[i,n]=e.every((t=>/^\w+$/.test(t.label)))?[/\w*$/,/\w+$/]:function(t){let e=Object.create(null),i=Object.create(null);for(let{label:n}of t){e[n[0]]=!0;for(let t=1;t{let s=t.matchBefore(n);return s||t.explicit?{from:s?s.from:t.pos,options:e,validFor:i}:null}}class Iu{constructor(t,e,i,n){this.completion=t,this.source=e,this.match=i,this.score=n}}function Bu(t){return t.selection.main.from}function ju(t,e){var i;let{source:n}=t,s=e&&"^"!=n[0],r="$"!=n[n.length-1];return s||r?new RegExp(`${s?"^":""}(?:${n})${r?"$":""}`,null!==(i=t.flags)&&void 0!==i?i:t.ignoreCase?"i":""):t}const Nu=lt.define();const Gu=new WeakMap;function Fu(t){if(!Array.isArray(t))return t;let e=Gu.get(t);return e||Gu.set(t,e=zu(t)),e}const Hu=ut.define(),Ju=ut.define();class Ku{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[];for(let e=0;e=48&&l<=57||l>=97&&l<=122?2:l>=65&&l<=90?1:0:(y=w(l))!=y.toLowerCase()?1:y!=y.toUpperCase()?2:0;(!n||1==S&&O||0==m&&0!=S)&&(e[c]==l||i[c]==l&&(u=!0)?r[c++]=n:r.length&&(g=!1)),m=S,n+=v(l)}return c==a&&0==r[0]&&g?this.result((u?-200:0)-100,r,t):d==a&&0==f?[-200-t.length+(p==t.length?0:-100),0,p]:o>-1?[-700-t.length,o,o+this.pattern.length]:d==a?[-900-t.length,f,p]:c==a?this.result((u?-200:0)-100-700+(g?0:-1100),r,t):2==e.length?null:this.result((n[0]?-700:0)-200-1100,n,t)}result(t,e,i){let n=[t-i.length],s=1;for(let t of e){let e=t+(this.astral?v(b(i,t)):1);s>1&&n[s-1]==t?n[s-1]=e:(n[s++]=t,n[s++]=e)}return n}}const td=E.define({combine:t=>kt(t,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:id,compareCompletions:(t,e)=>t.label.localeCompare(e.label),interactionDelay:75},{defaultKeymap:(t,e)=>t&&e,closeOnBlur:(t,e)=>t&&e,icons:(t,e)=>t&&e,tooltipClass:(t,e)=>i=>ed(t(i),e(i)),optionClass:(t,e)=>i=>ed(t(i),e(i)),addToOptions:(t,e)=>t.concat(e)})});function ed(t,e){return t?e?t+" "+e:t:e}function id(t,e,i,n,s){let r,o,a=t.textDirection==Wi.RTL,l=a,h=!1,c="top",u=e.left-s.left,d=s.right-e.right,f=n.right-n.left,p=n.bottom-n.top;if(l&&u=p||t>e.top?r=i.bottom-e.top:(c="bottom",r=e.bottom-i.top)}return{style:`${c}: ${r}px; max-width: ${o}px`,class:"cm-completionInfo-"+(h?a?"left-narrow":"right-narrow":l?"left":"right")}}function nd(t,e="option"){return i=>{let n=i.state.field(yd,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp-1?n.open.selected+r*(t?1:-1):t?0:o-1;return a<0?a="page"==e?0:o-1:a>=o&&(a="page"==e?o-1:0),i.dispatch({effects:vd.of(a)}),!0}}const sd=t=>{let e=t.state.field(yd,!1);return!(t.state.readOnly||!e||!e.open||e.open.selected<0||Date.now()-e.open.timestamp(t.selection||t.docChanged)&&!gd(t)));for(let e=0;e50&&Date.now()-n.time>1e3){for(let t of n.context.abortListeners)try{t()}catch(t){Qi(this.view.state,t)}n.context.abortListeners=null,this.running.splice(e--,1)}else n.updates.push(...t.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some((t=>1==t.state&&!this.running.some((e=>e.active.source==t.source))))?setTimeout((()=>this.startUpdate()),50):-1,0!=this.composing)for(let e of t.transactions)"input"==gd(e)?this.composing=2:2==this.composing&&e.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:t}=this.view,e=t.field(yd);for(let t of e.active)1!=t.state||this.running.some((e=>e.active.source==t.source))||this.startQuery(t)}startQuery(t){let{state:e}=this.view,i=Bu(e),n=new qu(e,i,t.explicitPos==i),s=new rd(t,n);this.running.push(s),Promise.resolve(t.source(n)).then((t=>{s.context.aborted||(s.done=t||null,this.scheduleAccept())}),(t=>{this.view.dispatch({effects:Ju.of(null)}),Qi(this.view.state,t)}))}scheduleAccept(){this.running.every((t=>void 0!==t.done))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((()=>this.accept()),50))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],i=this.view.state.facet(td);for(let n=0;nt.source==s.active.source));if(r&&1==r.state)if(null==s.done){let t=new md(s.active.source,0);for(let e of s.updates)t=t.update(e,i);1!=t.state&&e.push(t)}else this.startQuery(r)}e.length&&this.view.dispatch({effects:wd.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(yd,!1);if(e&&e.tooltip&&this.view.state.facet(td).closeOnBlur){let i=e.open&&Rr(this.view,e.open.tooltip);i&&i.dom.contains(t.relatedTarget)||this.view.dispatch({effects:Ju.of(null)})}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout((()=>this.view.dispatch({effects:Hu.of(!1)})),20),this.composing=0}}});function ad(t,e){const i=e.completion.apply||e.completion.label;let n=t.state.field(yd).active.find((t=>t.source==e.source));return n instanceof bd&&("string"==typeof i?t.dispatch(Object.assign(Object.assign({},function(t,e,i,n){let{main:s}=t.selection,r=i-s.from,o=n-s.from;return Object.assign(Object.assign({},t.changeByRange((a=>a!=s&&i!=n&&t.sliceDoc(a.from+r,a.from+o)!=t.sliceDoc(i,n)?{range:a}:{changes:{from:a.from+r,to:n==s.from?a.to:a.from+o,insert:e},range:A.cursor(a.from+r+e.length)}))),{userEvent:"input.complete"})}(t.state,i,n.from,n.to)),{annotations:Nu.of(e.completion)})):i(t,e.completion,n.from,n.to),!0)}function ld(t,e,i){if(t<=i)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let t=Math.floor(e/i);return{from:t*i,to:(t+1)*i}}let n=Math.floor((t-e)/i);return{from:t-(n+1)*i,to:t-n*i}}class hd{constructor(t,e){this.view=t,this.stateField=e,this.info=null,this.placeInfoReq={read:()=>this.measureInfo(),write:t=>this.placeInfo(t),key:this},this.space=null,this.currentClass="";let i=t.state.field(e),{options:n,selected:s}=i.open,r=t.state.facet(td);this.optionContent=function(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(t){let e=document.createElement("div");return e.classList.add("cm-completionIcon"),t.type&&e.classList.add(...t.type.split(/\s+/g).map((t=>"cm-completionIcon-"+t))),e.setAttribute("aria-hidden","true"),e},position:20}),e.push({render(t,e,i){let n=document.createElement("span");n.className="cm-completionLabel";let{label:s}=t,r=0;for(let t=1;tr&&n.appendChild(document.createTextNode(s.slice(r,e)));let a=n.appendChild(document.createElement("span"));a.appendChild(document.createTextNode(s.slice(e,o))),a.className="cm-completionMatchedText",r=o}return rt.position-e.position)).map((t=>t.render))}(r),this.optionClass=r.optionClass,this.tooltipClass=r.tooltipClass,this.range=ld(n.length,s,r.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",(e=>{for(let i,s=e.target;s&&s!=this.dom;s=s.parentNode)if("LI"==s.nodeName&&(i=/-(\d+)$/.exec(s.id))&&+i[1]{let i=t.state.field(this.stateField,!1);i&&i.tooltip&&t.state.facet(td).closeOnBlur&&e.relatedTarget!=t.contentDOM&&t.dispatch({effects:Ju.of(null)})})),this.list=this.dom.appendChild(this.createListBox(n,i.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))}mount(){this.updateSel()}update(t){var e,i,n;let s=t.state.field(this.stateField),r=t.startState.field(this.stateField);this.updateTooltipClass(t.state),s!=r&&(this.updateSel(),(null===(e=s.open)||void 0===e?void 0:e.disabled)!=(null===(i=r.open)||void 0===i?void 0:i.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!(null===(n=s.open)||void 0===n?void 0:n.disabled)))}updateTooltipClass(t){let e=this.tooltipClass(t);if(e!=this.currentClass){for(let t of this.currentClass.split(" "))t&&this.dom.classList.remove(t);for(let t of e.split(" "))t&&this.dom.classList.add(t);this.currentClass=e}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),e=t.open;if((e.selected>-1&&e.selected=this.range.to)&&(this.range=ld(e.options.length,e.selected,this.view.state.facet(td).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e.options,t.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))),this.updateSelectedOption(e.selected)){this.info&&(this.info.remove(),this.info=null);let{completion:i}=e.options[e.selected],{info:n,label:s,c:r}=i;if(!n)return;let o="string"==typeof n?document.createTextNode(n+" "):n(i);if(!o)return;if(!r){const t=document.createElement("span");t.appendChild(o),o=t;const e=document.createElement("a");e.innerText="🔎",e.href="/docFind/"+s,e.target="blank",o.appendChild(e)}if(!o)return;"then"in o?o.then((e=>{e&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(e)})).catch((t=>Qi(this.view.state,t,"completion info"))):this.addInfoPane(o)}}addInfoPane(t){let e=this.info=document.createElement("div");e.className="cm-tooltip cm-completionInfo",e.appendChild(t),this.dom.appendChild(e),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let e=null;for(let i=this.list.firstChild,n=this.range.from;i;i=i.nextSibling,n++)"LI"==i.nodeName&&i.id?n==t?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),e=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected"):n--;return e&&function(t,e){let i=t.getBoundingClientRect(),n=e.getBoundingClientRect();n.topi.bottom&&(t.scrollTop+=n.bottom-i.bottom)}(this.list,e),e}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let e=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),n=t.getBoundingClientRect(),s=this.space;if(!s){let t=this.dom.ownerDocument.defaultView||window;s={left:0,top:0,right:t.innerWidth,bottom:t.innerHeight}}return n.top>Math.min(s.bottom,e.bottom)-10||n.bottomi.from||0==i.from))if(s=t,"string"!=typeof l&&l.header)n.appendChild(l.header(l));else{n.appendChild(document.createElement("completion-section")).textContent=t}}const h=n.appendChild(document.createElement("li"));h.id=e+"-"+r,h.setAttribute("role","option");let c=this.optionClass(o);c&&(h.className=c);for(let t of this.optionContent){let e=t(o,this.view.state,a);e&&h.appendChild(e)}}return i.from&&n.classList.add("cm-completionListIncompleteTop"),i.to=this.options.length?this:new ud(this.options,pd(e,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,e,i,n,s){let r=function(t,e){let i=[],n=null,s=t=>{i.push(t);let{section:e}=t.completion;if(e){n||(n=[]);let t="string"==typeof e?e:e.name;n.some((e=>e.name==t))||n.push("string"==typeof e?{name:t}:e)}};for(let n of t)if(n.hasResult())if(!1===n.result.filter){let t=n.result.getMatch;for(let e of n.result.options){let r=[1e9-i.length];if(t)for(let i of t(e))r.push(i);s(new Iu(e,n.source,r,r[0]))}}else{let t,i=new Ku(e.sliceDoc(n.from,n.to));for(let e of n.result.options)(t=i.match(e.label))&&s(new Iu(e,n.source,t,t[0]+(e.boost||0)))}if(n){let t=Object.create(null),e=0,s=(t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:1e9)-(null!==(n=e.rank)&&void 0!==n?n:1e9)||(t.namee.score-t.score||a(t.completion,e.completion))))!o||o.label!=t.completion.label||o.detail!=t.completion.detail||null!=o.type&&null!=t.completion.type&&o.type!=t.completion.type||o.apply!=t.completion.apply?r.push(t):cd(t.completion)>cd(o)&&(r[r.length-1]=t),o=t.completion;return r}(t,e);if(!r.length)return n&&t.some((t=>1==t.state))?new ud(n.options,n.attrs,n.tooltip,n.timestamp,n.selected,!0):null;let o=e.facet(td).selectOnOpen?0:-1;if(n&&n.selected!=o&&-1!=n.selected){let t=n.options[n.selected].completion;for(let e=0;ee.hasResult()?Math.min(t,e.from):t),1e8),create:(a=yd,t=>new hd(t,a)),above:s.aboveCursor},n?n.timestamp:Date.now(),o,!1);var a}map(t){return new ud(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class dd{constructor(t,e,i){this.active=t,this.id=e,this.open=i}static start(){return new dd(Od,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(t){let{state:e}=t,i=e.facet(td),n=(i.override||e.languageDataAt("autocomplete",Bu(e)).map(Fu)).map((e=>(this.active.find((t=>t.source==e))||new md(e,this.active.some((t=>0!=t.state))?1:0)).update(t,i)));n.length==this.active.length&&n.every(((t,e)=>t==this.active[e]))&&(n=this.active);let s=this.open;s&&t.docChanged&&(s=s.map(t.changes)),t.selection||n.some((e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to)))||!function(t,e){if(t==e)return!0;for(let i=0,n=0;;){for(;i1==t.state))&&(s=null),!s&&n.every((t=>1!=t.state))&&n.some((t=>t.hasResult()))&&(n=n.map((t=>t.hasResult()?new md(t.source,0):t)));for(let e of t.effects)e.is(vd)&&(s=s&&s.setSelected(e.value,this.id));return n==this.active&&s==this.open?this:new dd(n,this.id,s)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:fd}}const fd={"aria-autocomplete":"list"};function pd(t,e){let i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(i["aria-activedescendant"]=t+"-"+e),i}const Od=[];function gd(t){return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null}class md{constructor(t,e,i=-1){this.source=t,this.state=e,this.explicitPos=i}hasResult(){return!1}update(t,e){let i=gd(t),n=this;i?n=n.handleUserEvent(t,i,e):t.docChanged?n=n.handleChange(t):t.selection&&0!=n.state&&(n=new md(n.source,0));for(let e of t.effects)if(e.is(Hu))n=new md(n.source,1,e.value?Bu(t.state):-1);else if(e.is(Ju))n=new md(n.source,0);else if(e.is(wd))for(let t of e.value)t.source==n.source&&(n=t);return n}handleUserEvent(t,e,i){return"delete"!=e&&i.activateOnTyping?new md(this.source,1):this.map(t.changes)}handleChange(t){return t.changes.touchesRange(Bu(t.startState))?new md(this.source,0):this.map(t.changes)}map(t){return t.empty||this.explicitPos<0?this:new md(this.source,this.state,t.mapPos(this.explicitPos))}}class bd extends md{constructor(t,e,i,n,s){super(t,2,e),this.result=i,this.from=n,this.to=s}hasResult(){return!0}handleUserEvent(t,e,i){var n;let s=t.changes.mapPos(this.from),r=t.changes.mapPos(this.to,1),o=Bu(t.state);if((this.explicitPos<0?o<=s:or||"delete"==e&&Bu(t.startState)==this.from)return new md(this.source,"input"==e&&i.activateOnTyping?1:0);let a,l=this.explicitPos<0?-1:t.changes.mapPos(this.explicitPos);return function(t,e,i,n){if(!t)return!1;let s=e.sliceDoc(i,n);return"function"==typeof t?t(s,i,n,e):ju(t,!0).test(s)}(this.result.validFor,t.state,s,r)?new bd(this.source,l,this.result,s,r):this.result.update&&(a=this.result.update(this.result,s,r,new qu(t.state,o,l>=0)))?new bd(this.source,l,a,a.from,null!==(n=a.to)&&void 0!==n?n:Bu(t.state)):new md(this.source,1,l)}handleChange(t){return t.changes.touchesRange(this.from,this.to)?new md(this.source,0):this.map(t.changes)}map(t){return t.empty?this:new bd(this.source,this.explicitPos<0?-1:t.mapPos(this.explicitPos),this.result,t.mapPos(this.from),t.mapPos(this.to,1))}}const wd=ut.define({map:(t,e)=>t.map((t=>t.map(e)))}),vd=ut.define(),yd=q.define({create:()=>dd.start(),update:(t,e)=>t.update(e),provide:t=>[Tr.from(t,(t=>t.tooltip)),Ts.contentAttributes.from(t,(t=>t.attrs))]}),Sd=Ts.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class xd{constructor(t,e,i,n){this.field=t,this.line=e,this.from=i,this.to=n}}class kd{constructor(t,e,i){this.field=t,this.from=e,this.to=i}map(t){let e=t.mapPos(this.from,-1,S.TrackDel),i=t.mapPos(this.to,1,S.TrackDel);return null==e||null==i?null:new kd(this.field,e,i)}}class Qd{constructor(t,e){this.lines=t,this.fieldPositions=e}instantiate(t,e){let i=[],n=[e],s=t.doc.lineAt(e),r=/^\s*/.exec(s.text)[0];for(let s of this.lines){if(i.length){let i=r,o=/^\t*/.exec(s)[0].length;for(let e=0;enew kd(t.field,n[t.line]+t.from,n[t.line]+t.to)));return{text:i,ranges:o}}static parse(t){let e,i=[],n=[],s=[];for(let r of t.split(/\r\n?|\n/)){for(;e=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(r);){let t=e[1]?+e[1]:null,o=e[2]||e[3]||"",a=-1;for(let e=0;e=a&&t.field++}s.push(new xd(a,n.length,e.index,e.index+o.length)),r=r.slice(0,e.index)+o+r.slice(e.index+e[0].length)}for(let t;t=/\\([{}])/.exec(r);){r=r.slice(0,t.index)+t[1]+r.slice(t.index+t[0].length);for(let e of s)e.line==n.length&&e.from>t.index&&(e.from--,e.to--)}n.push(r)}return new Qd(n,s)}}let $d=ni.widget({widget:new class extends ei{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),Pd=ni.mark({class:"cm-snippetField"});class Cd{constructor(t,e){this.ranges=t,this.active=e,this.deco=ni.set(t.map((t=>(t.from==t.to?$d:Pd).range(t.from,t.to))))}map(t){let e=[];for(let i of this.ranges){let n=i.map(t);if(!n)return null;e.push(n)}return new Cd(e,this.active)}selectionInsideField(t){return t.ranges.every((t=>this.ranges.some((e=>e.field==this.active&&e.from<=t.from&&e.to>=t.to))))}}const _d=ut.define({map:(t,e)=>t&&t.map(e)}),Xd=ut.define(),Zd=q.define({create:()=>null,update(t,e){for(let i of e.effects){if(i.is(_d))return i.value;if(i.is(Xd)&&t)return new Cd(t.ranges,i.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>Ts.decorations.from(t,(t=>t?t.deco:ni.none))});function Ad(t,e){return A.create(t.filter((t=>t.field==e)).map((t=>A.range(t.from,t.to))))}function Td(e){let i=Qd.parse(e);return(e,n,s,r)=>{let{text:o,ranges:a}=i.instantiate(e.state,s),l={changes:{from:s,to:r,insert:t.of(o)},scrollIntoView:!0,annotations:n?Nu.of(n):void 0};if(a.length&&(l.selection=Ad(a,0)),a.length>1){let t=new Cd(a,0),i=l.effects=[_d.of(t)];void 0===e.state.field(Zd,!1)&&i.push(ut.appendConfig.of([Zd,Md,Wd,Sd]))}e.dispatch(e.state.update(l))}}function Rd(t){return({state:e,dispatch:i})=>{let n=e.field(Zd,!1);if(!n||t<0&&0==n.active)return!1;let s=n.active+t,r=t>0&&!n.ranges.some((e=>e.field==s+t));return i(e.update({selection:Ad(n.ranges,s),effects:_d.of(r?null:new Cd(n.ranges,s))})),!0}}const Ed=[{key:"Tab",run:Rd(1),shift:Rd(-1)},{key:"Escape",run:({state:t,dispatch:e})=>!!t.field(Zd,!1)&&(e(t.update({effects:_d.of(null)})),!0)}],Vd=E.define({combine:t=>t.length?t[0]:Ed}),Md=N.highest(Ys.compute([Vd],(t=>t.facet(Vd))));function Dd(t,e){return Object.assign(Object.assign({},e),{apply:Td(t)})}const Wd=Ts.domEventHandlers({mousedown(t,e){let i,n=e.state.field(Zd,!1);if(!n||null==(i=e.posAtCoords({x:t.clientX,y:t.clientY})))return!1;let s=n.ranges.find((t=>t.from<=i&&t.to>=i));return!(!s||s.field==n.active)&&(e.dispatch({selection:Ad(n.ranges,s.field),effects:_d.of(n.ranges.some((t=>t.field>s.field))?new Cd(n.ranges,s.field):null)}),!0)}}),Ud=new class extends Qt{};function Yd(t={}){return[yd,td.of(t),od,Ld,Sd]}Ud.startSide=1,Ud.endSide=-1;const qd=[{key:"Ctrl-Space",run:t=>!!t.state.field(yd,!1)&&(t.dispatch({effects:Hu.of(!0)}),!0)},{key:"Escape",run:t=>{let e=t.state.field(yd,!1);return!(!e||!e.active.some((t=>0!=t.state)))&&(t.dispatch({effects:Ju.of(null)}),!0)}},{key:"ArrowDown",run:nd(!0)},{key:"ArrowUp",run:nd(!1)},{key:"PageDown",run:nd(!0,"page")},{key:"PageUp",run:nd(!1,"page")},{key:"Enter",run:sd}],Ld=N.highest(Ys.computeN([td],(t=>t.facet(td).defaultKeymap?[qd]:[]))),zd=(()=>[vr(),Sh(),ir(),$l(_l,{fallback:!0}),Ys.of([...Vc,...Wh])])();class Id{constructor(t,e,i,n,s,r,o,a,l,h=0,c){this.p=t,this.stack=e,this.state=i,this.reducePos=n,this.pos=s,this.score=r,this.buffer=o,this.bufferBase=a,this.curContext=l,this.lookAhead=h,this.parent=c}toString(){return`[${this.stack.filter(((t,e)=>e%3==0)).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,i=0){let n=t.parser.context;return new Id(t,[],e,i,i,0,[],0,n?new Bd(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let i=t>>19,n=65535&t,{parser:s}=this.p,r=s.dynamicPrecedence(n);if(r&&(this.score+=r),0==i)return this.pushState(s.getGoto(this.state,n,!0),this.reducePos),n=2e3&&!(null===(e=this.p.parser.nodeSet.types[n])||void 0===e?void 0:e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=l):this.p.lastBigReductionSizeo;)this.stack.pop();this.reduceContext(n,a)}storeNode(t,e,i,n=4,s=!1){if(0==t&&(!this.stack.length||this.stack[this.stack.length-1]0&&0==t.buffer[n-4]&&t.buffer[n-1]>-1){if(e==i)return;if(t.buffer[n-2]>=e)return void(t.buffer[n-2]=i)}}if(s&&this.pos!=i){let s=this.buffer.length;if(s>0&&0!=this.buffer[s-4])for(;s>0&&this.buffer[s-2]>i;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,n>4&&(n-=4);this.buffer[s]=t,this.buffer[s+1]=e,this.buffer[s+2]=i,this.buffer[s+3]=n}else this.buffer.push(t,e,i,n)}shift(t,e,i){let n=this.pos;if(131072&t)this.pushState(65535&t,this.pos);else if(0==(262144&t)){let s=t,{parser:r}=this.p;(i>this.pos||e<=r.maxNode)&&(this.pos=i,r.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,n),this.shiftContext(e,n),e<=r.maxNode&&this.buffer.push(e,n,i,4)}else this.pos=i,this.shiftContext(e,n),e<=this.p.parser.maxNode&&this.buffer.push(e,n,i,4)}apply(t,e,i){65536&t?this.reduce(t):this.shift(t,e,i)}useNode(t,e){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=t)&&(this.p.reused.push(t),i++);let n=this.pos;this.reducePos=this.pos=n+t.length,this.pushState(e,n),this.buffer.push(i,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let i=t.buffer.slice(e),n=t.bufferBase+e;for(;t&&n==t.bufferBase;)t=t.parent;return new Id(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,n,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let i=t<=this.p.parser.maxNode;i&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,i?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new Nd(this);;){let i=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(0==i)return!1;if(0==(65536&i))return!0;e.reduce(i)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let n,s=0;s1&e&&t==n))||i.push(e[t],n)}e=i}let i=[];for(let t=0;t>19,n=65535&t,s=this.stack.length-3*i;if(s<0||e.getGoto(this.stack[s],n,!1)<0)return!1;this.storeNode(0,this.reducePos,this.reducePos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:t}=this.p;return 65535==t.data[t.stateSlot(this.state,1)]&&!t.stateSlot(this.state,4)}restart(){this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;ethis.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Bd{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}var jd;!function(t){t[t.Insert=200]="Insert",t[t.Delete=190]="Delete",t[t.Reduce=100]="Reduce",t[t.MaxNext=4]="MaxNext",t[t.MaxInsertStackDepth=300]="MaxInsertStackDepth",t[t.DampenInsertStackDepth=120]="DampenInsertStackDepth",t[t.MinBigReduction=2e3]="MinBigReduction"}(jd||(jd={}));class Nd{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=65535&t,i=t>>19;0==i?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(i-1);let n=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=n}}class Gd{constructor(t,e,i){this.stack=t,this.pos=e,this.index=i,this.buffer=t.buffer,0==this.index&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new Gd(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;null!=t&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new Gd(this.stack,this.pos,this.index)}}function Fd(t,e=Uint16Array){if("string"!=typeof t)return t;let i=null;for(let n=0,s=0;n=92&&e--,e>=34&&e--;let s=e-32;if(s>=46&&(s-=46,i=!0),r+=s,i)break;r*=46}i?i[s++]=r:i=new e(r)}return i}class Hd{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Jd=new Hd;class Kd{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Jd,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let i=this.range,n=this.rangeIndex,s=this.pos+t;for(;si.to:s>=i.to;){if(n==this.ranges.length-1)return null;let t=this.ranges[++n];s+=t.from-i.to,i=t}return s}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,e.from);return this.end}peek(t){let e,i,n=this.chunkOff+t;if(n>=0&&n=this.chunk2Pos&&en.to&&(this.chunk2=this.chunk2.slice(0,n.to-e)),i=this.chunk2.charCodeAt(0)}}return e>=this.token.lookAhead&&(this.token.lookAhead=e+1),i}acceptToken(t,e=0){let i=e?this.resolveOffset(e,-1):this.pos;if(null==i||i=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=Jd,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let i="";for(let n of this.ranges){if(n.from>=e)break;n.to>t&&(i+=this.input.read(Math.max(n.from,t),Math.min(n.to,e)))}return i}}class tf{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:i}=e.p;sf(this.data,t,e,this.id,i.data,i.tokenPrecTable)}}tf.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class ef{constructor(t,e,i){this.precTable=e,this.elseToken=i,this.data="string"==typeof t?Fd(t):t}token(t,e){let i=t.pos,n=0;for(;sf(this.data,t,e,0,this.data,this.precTable),!(t.token.value>-1);){if(null==this.elseToken)return;if(t.next<0)break;t.advance(),t.reset(t.pos,t.token),n++}n&&(t.reset(i,t.token),t.acceptToken(this.elseToken,n))}}ef.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class nf{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function sf(t,e,i,n,s,r){let o=0,a=1<0){let i=t[n];if(l.allows(i)&&(-1==e.token.value||e.token.value==i||of(i,e.token.value,s,r))){e.acceptToken(i);break}}let n=e.next,h=0,c=t[o+2];if(!(e.next<0&&c>h&&65535==t[i+3*c-3]&&65535==t[i+3*c-3])){for(;h>1,r=i+s+(s<<1),a=t[r],l=t[r+1]||65536;if(n=l)){o=t[r+2],e.advance();continue t}h=s+1}}break}o=t[i+3*c-1]}}function rf(t,e,i){for(let n,s=e;65535!=(n=t[s]);s++)if(n==i)return s-e;return-1}function of(t,e,i,n){let s=rf(i,n,e);return s<0||rf(i,n,t)e)&&!n.type.isError)return i<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(t.length,Math.max(n.from+1,e+25));if(i<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return i<0?0:t.length}}!function(t){t[t.Margin=25]="Margin"}(hf||(hf={}));let uf=class{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?cf(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?cf(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=r,null;if(s instanceof bo){if(r==t){if(r=Math.max(this.safeFrom,t)&&(this.trees.push(s),this.start.push(r),this.index.push(0))}else this.index[e]++,this.nextStart=r+s.length}}};class df{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map((t=>new Hd))}getActions(t){let e=0,i=null,{parser:n}=t.p,{tokenizers:s}=n,r=n.stateSlot(t.state,3),o=t.curContext?t.curContext.hash:0,a=0;for(let n=0;nh.end+25&&(a=Math.max(h.lookAhead,a)),0!=h.value)){let n=e;if(h.extended>-1&&(e=this.addActions(t,h.extended,h.end,e)),e=this.addActions(t,h.value,h.end,e),!l.extend&&(i=h,e>n))break}}for(;this.actions.length>e;)this.actions.pop();return a&&t.setLookAhead(a),i||t.pos!=this.stream.end||(i=new Hd,i.value=t.p.parser.eofTerm,i.start=i.end=t.pos,e=this.addActions(t,i.value,i.end,e)),this.mainToken=i,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new Hd,{pos:i,p:n}=t;return e.start=i,e.end=Math.min(i+1,n.stream.end),e.value=i==n.stream.end?n.parser.eofTerm:0,e}updateCachedToken(t,e,i){let n=this.stream.clipPos(i.pos);if(e.token(this.stream.reset(n,t),i),t.value>-1){let{parser:e}=i.p;for(let n=0;n=0&&i.p.parser.dialect.allows(s>>1)){0==(1&s)?t.value=s>>1:t.extended=s>>1;break}}}else t.value=0,t.end=this.stream.clipPos(n+1)}putAction(t,e,i,n){for(let e=0;e4*t.bufferLength?new uf(i,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t,e,i=this.stacks,n=this.minStackPos,s=this.stacks=[];if(this.bigReductionCount>300&&1==i.length){let[t]=i;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;rn)s.push(o);else{if(this.advanceStack(o,s,i))continue;{t||(t=[],e=[]),t.push(o);let i=this.tokens.getMainToken(o);e.push(i.value,i.end)}}break}}if(!s.length){let e=t&&function(t){let e=null;for(let i of t){let t=i.p.stoppedAt;(i.pos==i.p.stream.end||null!=t&&i.pos>t)&&i.p.parser.stateFlag(i.state,2)&&(!e||e.scorethis.stoppedAt?t[0]:this.runRecovery(t,e,s);if(i)return this.stackToTree(i.forceAll())}if(this.recovering){let t=1==this.recovering?1:3*this.recovering;if(s.length>t)for(s.sort(((t,e)=>e.score-t.score));s.length>t;)s.pop();s.some((t=>t.reducePos>n))&&this.recovering--}else if(s.length>1){t:for(let t=0;t500&&n.buffer.length>500){if(!((e.score-n.score||e.buffer.length-n.buffer.length)>0)){s.splice(t--,1);continue t}s.splice(i--,1)}}}s.length>12&&s.splice(12,s.length-12)}this.minStackPos=s[0].pos;for(let t=1;t ":"";if(null!=this.stoppedAt&&n>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let e=t.curContext&&t.curContext.tracker.strict,i=e?t.curContext.hash:0;for(let o=this.fragments.nodeAt(n);o;){let n=this.parser.nodeSet.types[o.type.id]==o.type?s.getGoto(t.state,o.type.id):-1;if(n>-1&&o.length&&(!e||(o.prop(ho.contextHash)||0)==i))return t.useNode(o,n),af&&console.log(r+this.stackID(t)+` (via reuse of ${s.getName(o.type.id)})`),!0;if(!(o instanceof bo)||0==o.children.length||o.positions[0]>0)break;let a=o.children[0];if(!(a instanceof bo&&0==o.positions[0]))break;o=a}}let o=s.stateSlot(t.state,4);if(o>0)return t.reduce(o),af&&console.log(r+this.stackID(t)+` (via always-reduce ${s.getName(65535&o)})`),!0;if(t.stack.length>=15e3)for(;t.stack.length>9e3&&t.forceReduce(););let a=this.tokens.getActions(t);for(let o=0;on?e.push(d):i.push(d)}return!1}advanceFully(t,e){let i=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>i)return Of(t,e),!0}}runRecovery(t,e,i){let n=null,s=!1;for(let r=0;r ":"";if(o.deadEnd){if(s)continue;if(s=!0,o.restart(),af&&console.log(h+this.stackID(o)+" (restarted)"),this.advanceFully(o,i))continue}let c=o.split(),u=h;for(let t=0;c.forceReduce()&&t<10;t++){if(af&&console.log(u+this.stackID(c)+" (via force-reduce)"),this.advanceFully(c,i))break;af&&(u=this.stackID(c)+" -> ")}for(let t of o.recoverByInsert(a))af&&console.log(h+this.stackID(t)+" (via recover-insert)"),this.advanceFully(t,i);this.stream.end>o.pos?(l==o.pos&&(l++,a=0),o.recoverByDelete(a,l),af&&console.log(h+this.stackID(o)+` (via recover-delete ${this.parser.getName(a)})`),Of(o,i)):(!n||n.scoret;class bf{constructor(t){this.start=t.start,this.shift=t.shift||mf,this.reduce=t.reduce||mf,this.reuse=t.reuse||mf,this.hash=t.hash||(()=>0),this.strict=!1!==t.strict}}class wf extends Vo{constructor(t){if(super(),this.wrappers=[],14!=t.version)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let i=0;it.topRules[e][1])),n=[];for(let t=0;t=0)s(n,t,e[i++]);else{let r=e[i+-n];for(let o=-n;o>0;o--)s(e[i++],t,r);i++}}}this.nodeSet=new po(e.map(((e,s)=>fo.define({name:s>=this.minRepeatTerm?void 0:e,id:s,props:n[s],top:i.indexOf(s)>-1,error:0==s,skipped:t.skippedNodes&&t.skippedNodes.indexOf(s)>-1})))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=oo;let r=Fd(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let t=0;t"number"==typeof t?new tf(r,t):t)),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,i){let n=new pf(this,t,e,i);for(let s of this.wrappers)n=s(n,t,e,i);return n}getGoto(t,e,i=!1){let n=this.goto;if(e>=n[0])return-1;for(let s=n[e+1];;){let e=n[s++],r=1&e,o=n[s++];if(r&&i)return o;for(let i=s+(e>>1);s0}validAction(t,e){if(e==this.stateSlot(t,4))return!0;for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])return!1;i=vf(this.data,i+2)}if(e==vf(this.data,i+1))return!0}}nextStates(t){let e=[];for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])break;i=vf(this.data,i+2)}if(0==(1&this.data[i+2])){let t=this.data[i+1];e.some(((e,i)=>1&i&&e==t))||e.push(this.data[i],t)}}return e}configure(t){let e=Object.assign(Object.create(wf.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let i=this.topRules[t.top];if(!i)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=i}return t.tokenizers&&(e.tokenizers=this.tokenizers.map((e=>{let i=t.tokenizers.find((t=>t.from==e));return i?i.to:e}))),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map(((i,n)=>{let s=t.specializers.find((t=>t.from==i.external));if(!s)return i;let r=Object.assign(Object.assign({},i),{external:s.to});return e.specializers[n]=yf(r),r}))),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),null!=t.strict&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),null!=t.bufferLength&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return null==e?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),i=e.map((()=>!1));if(t)for(let n of t.split(" ")){let t=e.indexOf(n);t>=0&&(i[t]=!0)}let n=null;for(let t=0;tt.external(i,n)<<1|e}return t.get}const Sf=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],xf=new bf({start:!1,shift:(t,e)=>3==e||4==e||305==e?t:306==e,strict:!1}),kf=new nf(((t,e)=>{let{next:i}=t;(125==i||-1==i||e.context)&&e.canShift(303)&&t.acceptToken(303)}),{contextual:!0,fallback:!0}),Qf=new nf(((t,e)=>{let i,{next:n}=t;Sf.indexOf(n)>-1||(47!=n||47!=(i=t.peek(1))&&42!=i)&&125!=n&&59!=n&&-1!=n&&!e.context&&e.canShift(302)&&t.acceptToken(302)}),{contextual:!0}),$f=new nf(((t,e)=>{let{next:i}=t;if((43==i||45==i)&&(t.advance(),i==t.next)){t.advance();let i=!e.context&&e.canShift(1);t.acceptToken(i?1:2)}}),{contextual:!0}),Pf=ea({"get set async static":Sa.modifier,"for while do if else switch try catch finally return throw break continue default case":Sa.controlKeyword,"in of await yield void typeof delete instanceof":Sa.operatorKeyword,"let var const function class extends":Sa.definitionKeyword,"import export from":Sa.moduleKeyword,"with debugger as new":Sa.keyword,TemplateString:Sa.special(Sa.string),super:Sa.atom,BooleanLiteral:Sa.bool,this:Sa.self,null:Sa.null,Star:Sa.modifier,VariableName:Sa.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":Sa.function(Sa.variableName),VariableDefinition:Sa.definition(Sa.variableName),Label:Sa.labelName,PropertyName:Sa.propertyName,PrivatePropertyName:Sa.special(Sa.propertyName),"CallExpression/MemberExpression/PropertyName":Sa.function(Sa.propertyName),"FunctionDeclaration/VariableDefinition":Sa.function(Sa.definition(Sa.variableName)),"ClassDeclaration/VariableDefinition":Sa.definition(Sa.className),PropertyDefinition:Sa.definition(Sa.propertyName),PrivatePropertyDefinition:Sa.definition(Sa.special(Sa.propertyName)),UpdateOp:Sa.updateOperator,LineComment:Sa.lineComment,BlockComment:Sa.blockComment,Number:Sa.number,String:Sa.string,Escape:Sa.escape,ArithOp:Sa.arithmeticOperator,LogicOp:Sa.logicOperator,BitOp:Sa.bitwiseOperator,CompareOp:Sa.compareOperator,RegExp:Sa.regexp,Equals:Sa.definitionOperator,Arrow:Sa.function(Sa.punctuation),": Spread":Sa.punctuation,"( )":Sa.paren,"[ ]":Sa.squareBracket,"{ }":Sa.brace,"InterpolationStart InterpolationEnd":Sa.special(Sa.brace),".":Sa.derefOperator,", ;":Sa.separator,"@":Sa.meta,TypeName:Sa.typeName,TypeDefinition:Sa.definition(Sa.typeName),"type enum interface implements namespace module declare":Sa.definitionKeyword,"abstract global Privacy readonly override":Sa.modifier,"is keyof unique infer":Sa.operatorKeyword,JSXAttributeValue:Sa.attributeValue,JSXText:Sa.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":Sa.angleBracket,"JSXIdentifier JSXNameSpacedName":Sa.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":Sa.attributeName,"JSXBuiltin/JSXIdentifier":Sa.standard(Sa.tagName)}),Cf={__proto__:null,export:14,as:19,from:27,default:30,async:35,function:36,extends:46,this:50,true:58,false:58,null:70,void:74,typeof:78,super:96,new:130,delete:146,yield:155,await:159,class:164,public:221,private:221,protected:221,readonly:223,instanceof:242,satisfies:245,in:246,const:248,import:280,keyof:335,unique:339,infer:345,is:381,abstract:401,implements:403,type:405,let:408,var:410,interface:417,enum:421,namespace:427,module:429,declare:433,global:437,for:456,of:465,while:468,with:472,do:476,if:480,else:482,switch:486,case:492,try:498,catch:502,finally:506,return:510,throw:514,break:518,continue:522,debugger:526},_f={__proto__:null,async:117,get:119,set:121,declare:181,public:183,private:183,protected:183,static:185,abstract:187,override:189,readonly:195,accessor:197,new:385},Xf={__proto__:null,"<":137},Zf=wf.deserialize({version:14,states:"$6[O`QUOOO%QQUOOO'TQWOOP(bOSOOO*pQ(CjO'#CfO*wOpO'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S#[W%vS'u#S'}S'z#V+eS,t&y+fT-h't-mT'O!c%wQ$hfR)j$mT)_$h)`R3Z.kT*O$u*QR*W$xQ/}*zQ2e.OQ4s0wQ5{2iQ7X4vQ7x5zQ8e7WQ8w7wQ9W8gQ9`8yQ9e9XR9h9alpOXr!X#`%]&d&f&g&i,],b1b1eQ&^!TR,Q&ZV%z|},ZR0q+qR,P&XQ%szR+c%tR+X%nT&b!U&eT&c!U&eT1d,b1e",nodeNames:"⚠ ArithOp ArithOp LineComment BlockComment Script ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXStartTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:364,context:xf,nodeProps:[["group",-26,6,14,16,62,199,203,206,207,209,212,215,225,227,233,235,237,239,242,248,254,256,258,260,262,264,265,"Statement",-32,10,11,25,28,29,35,45,48,49,51,56,64,72,76,78,80,81,103,104,113,114,131,134,136,137,138,139,141,142,162,163,165,"Expression",-23,24,26,30,34,36,38,166,168,170,171,173,174,175,177,178,179,181,182,183,193,195,197,198,"Type",-3,84,96,102,"ClassItem"],["openedBy",31,"InterpolationStart",50,"[",54,"{",69,"(",143,"JSXStartTag",155,"JSXStartTag JSXStartCloseTag"],["closedBy",33,"InterpolationEnd",44,"]",55,"}",70,")",144,"JSXSelfCloseEndTag JSXEndTag",160,"JSXEndTag"]],propSources:[Pf],skippedNodes:[0,3,4,268],repeatNodeCount:33,tokenData:"$>y(CSR!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tu>PuvBavwDxwxGgxyMvyz! Qz{!![{|!%O|}!&]}!O!%O!O!P!'g!P!Q!1w!Q!R#0t!R![#3T![!]#@T!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],tokenPrec:12712}),Af=[Dd("function ${name}(${params}) {\n\t${}\n}",{label:"function",detail:"definition",type:"keyword"}),Dd("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n\t${}\n}",{label:"for",detail:"loop",type:"keyword"}),Dd("for (let ${name} of ${collection}) {\n\t${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Dd("do {\n\t${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),Dd("while (${}) {\n\t${}\n}",{label:"while",detail:"loop",type:"keyword"}),Dd("try {\n\t${}\n} catch (${error}) {\n\t${}\n}",{label:"try",detail:"/ catch block",type:"keyword"}),Dd("if (${}) {\n\t${}\n}",{label:"if",detail:"block",type:"keyword"}),Dd("if (${}) {\n\t${}\n} else {\n\t${}\n}",{label:"if",detail:"/ else block",type:"keyword"}),Dd("class ${name} {\n\tconstructor(${params}) {\n\t\t${}\n\t}\n}",{label:"class",detail:"definition",type:"keyword"}),Dd('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Dd('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Tf=new Ro,Rf=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Ef(t){return(e,i)=>{let n=e.node.getChild("VariableDefinition");return n&&i(n,t),!0}}const Vf=["FunctionDeclaration"],Mf={FunctionDeclaration:Ef("function"),ClassDeclaration:Ef("class"),ClassExpression:()=>!0,EnumDeclaration:Ef("constant"),TypeAliasDeclaration:Ef("type"),NamespaceDeclaration:Ef("namespace"),VariableDefinition(t,e){t.matchContext(Vf)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function Df(t,e){let i=Tf.get(e);if(i)return i;let n=[],s=!0;function r(e,i){let s=t.sliceString(e.from,e.to);n.push({label:s,type:i})}return e.cursor(mo.IncludeAnonymous).iterate((e=>{if(s)s=!1;else if(e.name){let t=Mf[e.name];if(t&&t(e,r)||Rf.has(e.name))return!1}else if(e.to-e.from>8192){for(let i of Df(t,e.node))n.push(i);return!1}})),Tf.set(e,n),n}const Wf=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Uf=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName"];function Yf(t){let e=Xa(t.state).resolveInner(t.pos,-1);if(Uf.indexOf(e.name)>-1)return null;let i="VariableName"==e.name||e.to-e.from<20&&Wf.test(t.state.sliceDoc(e.from,e.to));if(!i&&!t.explicit)return null;let n=[];for(let i=e;i;i=i.parent)Rf.has(i.name)&&(n=n.concat(Df(t.state.doc,i)));return{options:n,from:i?e.from:t.pos,validFor:Wf}}const qf=_a.define({name:"javascript",parser:Zf.configure({props:[Na.add({IfStatement:il({except:/^\s*({|else\b)/}),TryStatement:il({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:t=>t.baseIndent,SwitchBody:t=>{let e=t.textAfter,i=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return t.baseIndent+(i?0:n?1:2)*t.unit},Block:tl({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":il({except:/^{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag":t=>t.column(t.node.from)+t.unit}),rl.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression":ol,BlockComment:t=>({from:t.from+2,to:t.to-2})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Lf={test:t=>/^JSX/.test(t.name),facet:Qa({commentTokens:{block:{open:"{/*",close:"*/}"}}})},zf=qf.configure({dialect:"ts"},"typescript"),If=qf.configure({dialect:"jsx",props:[$a.add((t=>t.isTop?[Lf]:void 0))]}),Bf=qf.configure({dialect:"jsx ts",props:[$a.add((t=>t.isTop?[Lf]:void 0))]},"typescript"),jf="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map((t=>({label:t,type:"keyword"})));function Nf(t={}){let e=t.jsx?t.typescript?Bf:If:t.typescript?zf:qf;return new Ua(e,[qf.data.of({autocomplete:(i=Uf,n=zu(Af.concat(jf)),t=>{for(let e=Xa(t.state).resolveInner(t.pos,-1);e;e=e.parent){if(i.indexOf(e.name)>-1)return null;if(e.type.isTop)break}return n(t)})}),qf.data.of({autocomplete:Yf}),t.jsx?Hf:[]]);var i,n}function Gf(t,e,i=t.length){for(let n=null==e?void 0:e.firstChild;n;n=n.nextSibling)if("JSXIdentifier"==n.name||"JSXBuiltin"==n.name||"JSXNamespacedName"==n.name||"JSXMemberExpression"==n.name)return t.sliceString(n.from,Math.min(n.to,i));return""}const Ff="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),Hf=Ts.inputHandler.of(((t,e,i,n)=>{if((Ff?t.composing:t.compositionStarted)||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!qf.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((t=>{var e,i;let r,{head:o}=t,a=Xa(s).resolveInner(o,-1);if("JSXStartTag"==a.name&&(a=a.parent),">"==n&&"JSXFragmentTag"==a.name)return{range:A.cursor(o+1),changes:{from:o,insert:">"}};if("/"==n&&"JSXFragmentTag"==a.name){let t=a.parent,i=null==t?void 0:t.parent;if(t.from==o-1&&"JSXEndTag"!=(null===(e=i.lastChild)||void 0===e?void 0:e.name)&&(r=Gf(s.doc,null==i?void 0:i.firstChild,o))){let t=`/${r}>`;return{range:A.cursor(o+t.length),changes:{from:o,insert:t}}}}else if(">"==n){let t=function(t){for(;;){if("JSXOpenTag"==t.name||"JSXSelfClosingTag"==t.name||"JSXFragmentTag"==t.name)return t;if(!t.parent)return null;t=t.parent}}(a);if(t&&"JSXEndTag"!=(null===(i=t.lastChild)||void 0===i?void 0:i.name)&&"`}}}return{range:t}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)}));class Jf{constructor(t,e,i,n,s,r,o){this.type=t,this.value=e,this.from=i,this.hash=n,this.end=s,this.children=r,this.positions=o,this.hashProp=[[ho.contextHash,n]]}static create(t,e,i,n,s){return new Jf(t,e,i,n+(n<<8)+t+(e<<4)|0,s,[],[])}addChild(t,e){t.prop(ho.contextHash)!=this.hash&&(t=new bo(t.type,t.children,t.positions,t.length,this.hashProp)),this.children.push(t),this.positions.push(e)}toTree(t,e=this.end){let i=this.children.length-1;return i>=0&&(e=Math.max(e,this.positions[i]+this.children[i].length+this.from)),new bo(t.types[this.type],this.children,this.positions,e-this.from).balance({makeTree:(t,e,i)=>new bo(fo.none,t,e,i,this.hashProp)})}}var Kf;!function(t){t[t.Document=1]="Document",t[t.CodeBlock=2]="CodeBlock",t[t.FencedCode=3]="FencedCode",t[t.Blockquote=4]="Blockquote",t[t.HorizontalRule=5]="HorizontalRule",t[t.BulletList=6]="BulletList",t[t.OrderedList=7]="OrderedList",t[t.ListItem=8]="ListItem",t[t.ATXHeading1=9]="ATXHeading1",t[t.ATXHeading2=10]="ATXHeading2",t[t.ATXHeading3=11]="ATXHeading3",t[t.ATXHeading4=12]="ATXHeading4",t[t.ATXHeading5=13]="ATXHeading5",t[t.ATXHeading6=14]="ATXHeading6",t[t.SetextHeading1=15]="SetextHeading1",t[t.SetextHeading2=16]="SetextHeading2",t[t.HTMLBlock=17]="HTMLBlock",t[t.LinkReference=18]="LinkReference",t[t.Paragraph=19]="Paragraph",t[t.CommentBlock=20]="CommentBlock",t[t.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",t[t.Escape=22]="Escape",t[t.Entity=23]="Entity",t[t.HardBreak=24]="HardBreak",t[t.Emphasis=25]="Emphasis",t[t.StrongEmphasis=26]="StrongEmphasis",t[t.Link=27]="Link",t[t.Image=28]="Image",t[t.InlineCode=29]="InlineCode",t[t.HTMLTag=30]="HTMLTag",t[t.Comment=31]="Comment",t[t.ProcessingInstruction=32]="ProcessingInstruction",t[t.URL=33]="URL",t[t.HeaderMark=34]="HeaderMark",t[t.QuoteMark=35]="QuoteMark",t[t.ListMark=36]="ListMark",t[t.LinkMark=37]="LinkMark",t[t.EmphasisMark=38]="EmphasisMark",t[t.CodeMark=39]="CodeMark",t[t.CodeText=40]="CodeText",t[t.CodeInfo=41]="CodeInfo",t[t.LinkTitle=42]="LinkTitle",t[t.LinkLabel=43]="LinkLabel"}(Kf||(Kf={}));class tp{constructor(t,e){this.start=t,this.content=e,this.marks=[],this.parsers=[]}}class ep{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let t=this.skipSpace(this.basePos);this.indent=this.countIndent(t,this.pos,this.indent),this.pos=t,this.next=t==this.text.length?-1:this.text.charCodeAt(t)}skipSpace(t){return rp(this.text,t)}reset(t){for(this.text=t,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(t){this.basePos=t,this.baseIndent=this.countIndent(t,this.pos,this.indent)}moveBaseColumn(t){this.baseIndent=t,this.basePos=this.findColumn(t)}addMarker(t){this.markers.push(t)}countIndent(t,e=0,i=0){for(let n=e;n=e.stack[i.depth+1].value+i.baseIndent)return!0;if(i.indent>=i.baseIndent+4)return!1;let n=(t.type==Kf.OrderedList?dp:up)(i,e,!1);return n>0&&(t.type!=Kf.BulletList||hp(i,e,!1)<0)&&i.text.charCodeAt(i.pos+n-1)==t.value}const np={[Kf.Blockquote]:(t,e,i)=>62==i.next&&(i.markers.push(Up(Kf.QuoteMark,e.lineStart+i.pos,e.lineStart+i.pos+1)),i.moveBase(i.pos+(sp(i.text.charCodeAt(i.pos+1))?2:1)),t.end=e.lineStart+i.text.length,!0),[Kf.ListItem]:(t,e,i)=>!(i.indent-1)&&(i.moveBaseColumn(i.baseIndent+t.value),!0),[Kf.OrderedList]:ip,[Kf.BulletList]:ip,[Kf.Document]:()=>!0};function sp(t){return 32==t||9==t||10==t||13==t}function rp(t,e=0){for(;ei&&sp(t.charCodeAt(e-1));)e--;return e}function ap(t){if(96!=t.next&&126!=t.next)return-1;let e=t.pos+1;for(;e-1&&t.depth==e.stack.length||n<3?-1:1}function cp(t,e){for(let i=t.stack.length-1;i>=0;i--)if(t.stack[i].type==e)return!0;return!1}function up(t,e,i){return 45!=t.next&&43!=t.next&&42!=t.next||t.pos!=t.text.length-1&&!sp(t.text.charCodeAt(t.pos+1))||!(!i||cp(e,Kf.BulletList)||t.skipSpace(t.pos+2)=48&&s<=57;){if(n++,n==t.text.length)return-1;s=t.text.charCodeAt(n)}return n==t.pos||n>t.pos+9||46!=s&&41!=s||nt.pos+1||49!=t.next)?-1:n+1-t.pos}function fp(t){if(35!=t.next)return-1;let e=t.pos+1;for(;e6?-1:i}function pp(t){if(45!=t.next&&61!=t.next||t.indent>=t.baseIndent+4)return-1;let e=t.pos+1;for(;e/,mp=/\?>/,bp=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*/i.exec(n);if(r)return t.append(Up(Kf.Comment,i,i+1+r[0].length));let o=/^\?[^]*?\?>/.exec(n);if(o)return t.append(Up(Kf.ProcessingInstruction,i,i+1+o[0].length));let a=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(n);return a?t.append(Up(Kf.HTMLTag,i,i+1+a[0].length)):-1},Emphasis(t,e,i){if(95!=e&&42!=e)return-1;let n=i+1;for(;t.char(n)==e;)n++;let s=t.slice(i-1,i),r=t.slice(n,n+1),o=jp.test(s),a=jp.test(r),l=/\s|^$/.test(s),h=/\s|^$/.test(r),c=!h&&(!a||l||o),u=!l&&(!o||h||a),d=c&&(42==e||!u||o),f=u&&(42==e||!c||a);return t.append(new Ip(95==e?Yp:qp,i,n,(d?1:0)|(f?2:0)))},HardBreak(t,e,i){if(92==e&&10==t.char(i+1))return t.append(Up(Kf.HardBreak,i,i+2));if(32==e){let e=i+1;for(;32==t.char(e);)e++;if(10==t.char(e)&&e>=i+2)return t.append(Up(Kf.HardBreak,i,e+1))}return-1},Link:(t,e,i)=>91==e?t.append(new Ip(Lp,i,i+1,1)):-1,Image:(t,e,i)=>33==e&&91==t.char(i+1)?t.append(new Ip(zp,i,i+2,1)):-1,LinkEnd(t,e,i){if(93!=e)return-1;for(let e=t.parts.length-1;e>=0;e--){let n=t.parts[e];if(n instanceof Ip&&(n.type==Lp||n.type==zp)){if(!n.side||t.skipSpace(n.to)==i&&!/[(\[]/.test(t.slice(i+1,i+2)))return t.parts[e]=null,-1;let s=t.takeContent(e),r=t.parts[e]=Gp(t,s,n.type==Lp?Kf.Link:Kf.Image,n.from,i+1);if(n.type==Lp)for(let i=0;ie?Up(Kf.URL,e+i,s+i):s==t.length&&null}}function Hp(t,e,i){let n=t.charCodeAt(e);if(39!=n&&34!=n&&40!=n)return!1;let s=40==n?41:n;for(let n=e+1,r=!1;n=this.end?-1:this.text.charCodeAt(t-this.offset)}get end(){return this.offset+this.text.length}slice(t,e){return this.text.slice(t-this.offset,e-this.offset)}append(t){return this.parts.push(t),t.to}addDelimiter(t,e,i,n,s){return this.append(new Ip(t,e,i,(n?1:0)|(s?2:0)))}addElement(t){return this.append(t)}resolveMarkers(t){for(let e=t;e=t;o--){let t=this.parts[o];if(t instanceof Ip&&1&t.side&&t.type==i.type&&!(s&&(1&i.side||2&t.side)&&(t.to-t.from+r)%3==0&&((t.to-t.from)%3||r%3))){n=t;break}}if(!n)continue;let a=i.type.resolve,l=[],h=n.from,c=i.to;if(s){let t=Math.min(2,n.to-n.from,r);h=n.to-t,c=i.from+t,a=1==t?"Emphasis":"StrongEmphasis"}n.type.mark&&l.push(this.elt(n.type.mark,h,n.to));for(let t=o+1;t=0;e--){let i=this.parts[e];if(i instanceof Ip&&i.type==t)return e}return null}takeContent(t){let e=this.resolveMarkers(t);return this.parts.length=t,e}skipSpace(t){return rp(this.text,t-this.offset)+this.offset}elt(t,e,i,n){return"string"==typeof t?Up(this.parser.getNodeType(t),e,i,n):new Wp(t,e)}}function tO(t,e){if(!e.length)return t;if(!t.length)return e;let i=t.slice(),n=0;for(let t of e){for(;n(t?t-1:0))return!1;if(this.fragmentEnd<0){let t=this.fragment.to;for(;t>0&&"\n"!=this.input.read(t-1,t);)t--;this.fragmentEnd=t?t-1:0}let i=this.cursor;i||(i=this.cursor=this.fragment.tree.cursor(),i.firstChild());let n=t+this.fragment.offset;for(;i.to<=n;)if(!i.parent())return!1;for(;;){if(i.from>=n)return this.fragment.from<=e;if(!i.childAfter(n))return!1}}matches(t){let e=this.cursor.tree;return e&&e.prop(ho.contextHash)==t}takeNodes(t){let e=this.cursor,i=this.fragment.offset,n=this.fragmentEnd-(this.fragment.openEnd?1:0),s=t.absoluteLineStart,r=s,o=t.block.children.length,a=r,l=o;for(;;){if(e.to-i>n){if(e.type.isAnonymous&&e.firstChild())continue;break}if(t.dontInject.add(e.tree),t.addNode(e.tree,e.from-i),e.type.is("Block")&&(eO.indexOf(e.type.id)<0?(r=e.to-i,o=t.block.children.length):(r=a,o=l,a=e.to-i,l=t.block.children.length)),!e.nextSibling())break}for(;t.block.children.length>o;)t.block.children.pop(),t.block.positions.pop();return r-s}}const nO=ea({"Blockquote/...":Sa.quote,HorizontalRule:Sa.contentSeparator,"ATXHeading1/... SetextHeading1/...":Sa.heading1,"ATXHeading2/... SetextHeading2/...":Sa.heading2,"ATXHeading3/...":Sa.heading3,"ATXHeading4/...":Sa.heading4,"ATXHeading5/...":Sa.heading5,"ATXHeading6/...":Sa.heading6,"Comment CommentBlock":Sa.comment,Escape:Sa.escape,Entity:Sa.character,"Emphasis/...":Sa.emphasis,"StrongEmphasis/...":Sa.strong,"Link/... Image/...":Sa.link,"OrderedList/... BulletList/...":Sa.list,"BlockQuote/...":Sa.quote,"InlineCode CodeText":Sa.monospace,URL:Sa.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":Sa.processingInstruction,"CodeInfo LinkLabel":Sa.labelName,LinkTitle:Sa.string,Paragraph:Sa.content}),sO=new Zp(new po(Ep).extend(nO),Object.keys(Sp).map((t=>Sp[t])),Object.keys(Sp).map((t=>$p[t])),Object.keys(Sp),Pp,np,Object.keys(Np).map((t=>Np[t])),Object.keys(Np),[]);function rO(t,e,i){let n=[];for(let s=t.firstChild,r=e;;s=s.nextSibling){let t=s?s.from:i;if(t>r&&n.push({from:r,to:t}),!s)break;r=s.to}return n}const oO={resolve:"Strikethrough",mark:"StrikethroughMark"},aO={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":Sa.strikethrough}},{name:"StrikethroughMark",style:Sa.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,i){if(126!=e||126!=t.char(i+1)||126==t.char(i+2))return-1;let n=t.slice(i-1,i),s=t.slice(i+2,i+3),r=/\s|^$/.test(n),o=/\s|^$/.test(s),a=jp.test(n),l=jp.test(s);return t.addDelimiter(oO,i,i+2,!o&&(!l||r||a),!r&&(!a||o||l))},after:"Emphasis"}]};function lO(t,e,i=0,n,s=0){let r=0,o=!0,a=-1,l=-1,h=!1,c=()=>{n.push(t.elt("TableCell",s+a,s+l,t.parser.parseInline(e.slice(a,l),s+a)))};for(let u=i;u-1)&&r++,o=!1,n&&(a>-1&&c(),n.push(t.elt("TableDelimiter",u+s,u+s+1))),a=l=-1),h=!h&&92==i}return a>-1&&(r++,n&&c()),r}function hO(t,e){for(let i=e;ihO(e.content,0)?new uO:null,endLeaf(t,e,i){if(i.parsers.some((t=>t instanceof uO))||!hO(e.text,e.basePos))return!1;let n=t.scanLine(t.absoluteLineEnd+1).text;return cO.test(n)&&lO(t,e.text,e.basePos)==lO(t,n,e.basePos)},before:"SetextHeading"}]};class fO{nextLine(){return!1}finish(t,e){return t.addLeafElement(e,t.elt("Task",e.start,e.start+e.content.length,[t.elt("TaskMarker",e.start,e.start+3),...t.parser.parseInline(e.content.slice(3),e.start+3)])),!0}}const pO=[dO,{defineNodes:[{name:"Task",block:!0,style:Sa.list},{name:"TaskMarker",style:Sa.atom}],parseBlock:[{name:"TaskList",leaf:(t,e)=>/^\[[ xX]\]/.test(e.content)&&"ListItem"==t.parentType().name?new fO:null,after:"SetextHeading"}]},aO];function OO(t,e,i){return(n,s,r)=>{if(s!=t||n.char(r+1)==t)return-1;let o=[n.elt(i,r,r+1)];for(let s=r+1;s=65&&r<=90||95==r||r>=97&&r<=122||r>=161;)s+=String.fromCharCode(n),n=t.peek(++e);var r;return RO=t,EO=i,TO=s?s.toLowerCase():n==MO||n==DO?void 0:null}const MO=63,DO=33;function WO(t,e){this.name=t,this.parent=e,this.hash=e?e.hash:0;for(let e=0;eUO.indexOf(e)>-1?new WO(VO(n,1)||"",t):t,reduce:(t,e)=>e==wO&&t?t.parent:t,reuse(t,e,i,n){let s=e.type.id;return 6==s||36==s?new WO(VO(n,1)||"",t):t},hash:t=>t?t.hash:0,strict:!1}),qO=new nf(((t,e)=>{if(60!=t.next)return void(t.next<0&&e.context&&t.acceptToken(57));t.advance();let i=47==t.next;i&&t.advance();let n=VO(t,0);if(void 0===n)return;if(!n)return t.acceptToken(i?14:6);let s=e.context?e.context.name:null;if(i){if(n==s)return t.acceptToken(11);if(s&&XO[s])return t.acceptToken(57,-2);if(e.dialectEnabled(0))return t.acceptToken(12);for(let t=e.context;t;t=t.parent)if(t.name==n)return;t.acceptToken(13)}else{if("script"==n)return t.acceptToken(7);if("style"==n)return t.acceptToken(8);if("textarea"==n)return t.acceptToken(9);if(_O.hasOwnProperty(n))return t.acceptToken(10);s&&ZO[s]&&ZO[s][n]?t.acceptToken(57,-1):t.acceptToken(6)}}),{contextual:!0}),LO=new nf((t=>{for(let e=0,i=0;;i++){if(t.next<0){i&&t.acceptToken(58);break}if(45==t.next)e++;else{if(62==t.next&&e>=2){i>3&&t.acceptToken(58,-2);break}e=0}t.advance()}}));const zO=new nf(((t,e)=>{if(47==t.next&&62==t.peek(1)){let i=e.dialectEnabled(1)||function(t){for(;t;t=t.parent)if("svg"==t.name||"math"==t.name)return!0;return!1}(e.context);t.acceptToken(i?5:4,2)}else 62==t.next&&t.acceptToken(4,1)}));function IO(t,e,i){let n=2+t.length;return new nf((s=>{for(let r=0,o=0,a=0;;a++){if(s.next<0){a&&s.acceptToken(e);break}if(0==r&&60==s.next||1==r&&47==s.next||r>=2&&ro?s.acceptToken(e,-o):s.acceptToken(i,-(o-2));break}if((10==s.next||13==s.next)&&a){s.acceptToken(e,1);break}r=o=0}else o++;s.advance()}}))}const BO=IO("script",54,1),jO=IO("style",55,2),NO=IO("textarea",56,3),GO=ea({"Text RawText":Sa.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":Sa.angleBracket,TagName:Sa.tagName,"MismatchedCloseTag/TagName":[Sa.tagName,Sa.invalid],AttributeName:Sa.attributeName,"AttributeValue UnquotedAttributeValue":Sa.attributeValue,Is:Sa.definitionOperator,"EntityReference CharacterReference":Sa.character,Comment:Sa.blockComment,ProcessingInst:Sa.processingInstruction,DoctypeDecl:Sa.documentMeta}),FO=wf.deserialize({version:14,states:",xOVO!rOOO!WQ#tO'#CqO!]Q#tO'#CzO!bQ#tO'#C}O!gQ#tO'#DQO!lQ#tO'#DSO!qOaO'#CpO!|ObO'#CpO#XOdO'#CpO$eO!rO'#CpOOO`'#Cp'#CpO$lO$fO'#DTO$tQ#tO'#DVO$yQ#tO'#DWOOO`'#Dk'#DkOOO`'#DY'#DYQVO!rOOO%OQ&rO,59]O%WQ&rO,59fO%`Q&rO,59iO%hQ&rO,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OS!OOhyO~OS!QOhyO~OS!SOT!TOhyO~OS!TOhyO~O!WfOPlX!ZlX~OP!WO!Z!XO~O!XiOQoX!ZoX~OQ!ZO!Z!XO~O!YlORrX!ZrX~OR!]O!Z!XO~O!Z!XO~P#dOf!_O~O![sO!e!aO~OS!bO~OS!cO~Oi!dOSgXhgXTgX~OS!fOhyO~OS!gOhyO~OS!hOhyO~OS!iOT!jOhyO~OS!jOhyO~Of!kO~Of!lO~Of!mO~OS!nO~Ok!qO!`!oO!b!pO~OS!rO~OS!sO~OS!tO~Oa!uOb!uOc!uO!`!wO!a!uO~Oa!xOb!xOc!xO!b!wO!c!xO~Oa!uOb!uOc!uO!`!{O!a!uO~Oa!xOb!xOc!xO!b!{O!c!xO~OT~bac!dx{!d~",goto:"%p!`PPPPPPPPPPPPPPPPPPPP!a!gP!mPP!yP!|#P#S#Y#]#`#f#i#l#r#x!aP!a!aP$O$U$l$r$x%O%U%[%bPPPPPPPP%hX^OX`pXUOX`pezabcde{}!P!R!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ}bQ!PcQ!RdQ!UeZ!e{}!P!R!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:67,context:YO,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,21,30,33,36,"CloseTag"],["open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%lO*V!R!N`P;=`<%l!G_T!NhbhSOq!Hpqr!Ncrs!Hpsw!Ncwx!Hpx!P!Nc!P!Q!Hp!Q!_!Nc!_!a!Hp!a!b# p!b#s!Nc#s$f!Hp$f;'S!Nc;'S;=`#!}<%l?Ah!Nc?Ah?BY!Hp?BY?Mn!Nc?MnO!HpT# ubhSOq!Hpqr!Ncrs!Hpsw!Ncwx!Hpx!P!Nc!P!Q!Hp!Q!_!Nc!_!`!Hp!`!a!If!a#s!Nc#s$f!Hp$f;'S!Nc;'S;=`#!}<%l?Ah!Nc?Ah?BY!Hp?BY?Mn!Nc?MnO!HpT##QP;=`<%l!Nc!V##^chS!a`!cpOq!G_qr!Eyrs!HUsv!Eyvw!Ncwx!Jvx!P!Ey!P!Q!G_!Q!_!Ey!_!`!G_!`!a!Mm!a#s!Ey#s$f!G_$f;'S!Ey;'S;=`#$i<%l?Ah!Ey?Ah?BY!G_?BY?Mn!Ey?MnO!G_!V#$lP;=`<%l!Ey!V#$zXiS`P!a`!cpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X",tokenizers:[BO,jO,NO,zO,qO,LO,0,1,2,3,4,5],topRules:{Document:[0,15]},dialects:{noMatch:0,selfClosing:485},tokenPrec:487});function HO(t,e){let i=Object.create(null);for(let n of t.getChildren(yO)){let t=n.getChild(SO),s=n.getChild(xO)||n.getChild(kO);t&&(i[e.read(t.from,t.to)]=s?s.type.id==xO?e.read(s.from+1,s.to-1):e.read(s.from,s.to):"")}return i}function JO(t,e){let i=t.getChild(vO);return i?e.read(i.from,i.to):" "}function KO(t,e,i){let n;for(let s of i)if(!s.attrs||s.attrs(n||(n=HO(t.node.parent.firstChild,e))))return{parser:s.parser};return null}function tg(t=[],e=[]){let i=[],n=[],s=[],r=[];for(let e of t){("script"==e.tag?i:"style"==e.tag?n:"textarea"==e.tag?s:r).push(e)}let o=e.length?Object.create(null):null;for(let t of e)(o[t.name]||(o[t.name]=[])).push(t);return Do(((t,e)=>{let a=t.type.id;if(a==QO)return KO(t,e,i);if(a==$O)return KO(t,e,n);if(a==PO)return KO(t,e,s);if(a==wO&&r.length){let i,n=t.node,s=n.firstChild,o=s&&JO(s,e);if(o)for(let t of r)if(t.tag==o&&(!t.attrs||t.attrs(i||(i=HO(n,e))))){let e=n.lastChild;return{parser:t.parser,overlay:[{from:s.to,to:e.type.id==CO?e.from:n.to}]}}}if(o&&a==yO){let i,n=t.node;if(i=n.firstChild){let t=o[e.read(i.from,i.to)];if(t)for(let i of t){if(i.tagName&&i.tagName!=JO(n.parent,e))continue;let t=n.lastChild;if(t.type.id==xO){let e=t.from+1,n=t.lastChild,s=t.to-(n&&n.isError?0:1);if(s>e)return{parser:i.parser,overlay:[{from:e,to:s}]}}else if(t.type.id==kO)return{parser:i.parser,overlay:[{from:t.from,to:t.to}]}}}}return null}))}const eg=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288];function ig(t){return t>=65&&t<=90||t>=97&&t<=122||t>=161}const ng=new nf(((t,e)=>{for(let n=!1,s=0,r=0;;r++){let{next:o}=t;if(!(ig(o)||45==o||95==o||n&&(i=o,i>=48&&i<=57))){n&&t.acceptToken(40==o?95:2==s&&e.canShift(2)?2:96);break}!n&&(45!=o||r>0)&&(n=!0),s===r&&45==o&&s++,t.advance()}var i})),sg=new nf((t=>{if(eg.includes(t.peek(-1))){let{next:e}=t;(ig(e)||95==e||35==e||46==e||91==e||58==e||45==e)&&t.acceptToken(94)}})),rg=new nf((t=>{if(!eg.includes(t.peek(-1))){let{next:e}=t;if(37==e&&(t.advance(),t.acceptToken(1)),ig(e)){do{t.advance()}while(ig(t.next));t.acceptToken(1)}}})),og=ea({"AtKeyword import charset namespace keyframes media supports":Sa.definitionKeyword,"from to selector":Sa.keyword,NamespaceName:Sa.namespace,KeyframeName:Sa.labelName,TagName:Sa.tagName,ClassName:Sa.className,PseudoClassName:Sa.constant(Sa.className),IdName:Sa.labelName,"FeatureName PropertyName":Sa.propertyName,AttributeName:Sa.attributeName,NumberLiteral:Sa.number,KeywordQuery:Sa.keyword,UnaryQueryOp:Sa.operatorKeyword,"CallTag ValueName":Sa.atom,VariableName:Sa.variableName,Callee:Sa.operatorKeyword,Unit:Sa.unit,"UniversalSelector NestingSelector":Sa.definitionOperator,MatchOp:Sa.compareOperator,"ChildOp SiblingOp, LogicOp":Sa.logicOperator,BinOp:Sa.arithmeticOperator,Important:Sa.modifier,Comment:Sa.blockComment,ParenthesizedContent:Sa.special(Sa.name),ColorLiteral:Sa.color,StringLiteral:Sa.string,":":Sa.punctuation,"PseudoOp #":Sa.derefOperator,"; ,":Sa.separator,"( )":Sa.paren,"[ ]":Sa.squareBracket,"{ }":Sa.brace}),ag={__proto__:null,lang:32,"nth-child":32,"nth-last-child":32,"nth-of-type":32,"nth-last-of-type":32,dir:32,"host-context":32,url:60,"url-prefix":60,domain:60,regexp:60,selector:134},lg={__proto__:null,"@import":114,"@media":138,"@charset":142,"@namespace":146,"@keyframes":152,"@supports":164},hg={__proto__:null,not:128,only:128,from:158,to:160},cg=wf.deserialize({version:14,states:"7WQYQ[OOO#_Q[OOOOQP'#Cd'#CdOOQP'#Cc'#CcO#fQ[O'#CfO$YQXO'#CaO$aQ[O'#ChO$lQ[O'#DPO$qQ[O'#DTOOQP'#Ed'#EdO$vQdO'#DeO%bQ[O'#DrO$vQdO'#DtO%sQ[O'#DvO&OQ[O'#DyO&TQ[O'#EPO&cQ[O'#EROOQS'#Ec'#EcOOQS'#ET'#ETQYQ[OOO&jQXO'#CdO'_QWO'#DaO'dQWO'#EjO'oQ[O'#EjQOQWOOOOQP'#Cg'#CgOOQP,59Q,59QO#fQ[O,59QO'yQ[O'#EWO(eQWO,58{O(mQ[O,59SO$lQ[O,59kO$qQ[O,59oO'yQ[O,59sO'yQ[O,59uO'yQ[O,59vO(xQ[O'#D`OOQS,58{,58{OOQP'#Ck'#CkOOQO'#C}'#C}OOQP,59S,59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WOy%^z;'S%^;'S;=`%o<%lO%^XG_WOy%^z!c%^!c!}Gw!}#T%^#T#oGw#o;'S%^;'S;=`%o<%lO%^XHO[!YPoWOy%^z}%^}!OGw!O!Q%^!Q![Gw![!c%^!c!}Gw!}#T%^#T#oGw#o;'S%^;'S;=`%o<%lO%^XHySxPOy%^z;'S%^;'S;=`%o<%lO%^^I[SvUOy%^z;'S%^;'S;=`%o<%lO%^XIkUOy%^z#b%^#b#cI}#c;'S%^;'S;=`%o<%lO%^XJSUoWOy%^z#W%^#W#XJf#X;'S%^;'S;=`%o<%lO%^XJmS!`PoWOy%^z;'S%^;'S;=`%o<%lO%^XJ|UOy%^z#f%^#f#gJf#g;'S%^;'S;=`%o<%lO%^XKeS!RPOy%^z;'S%^;'S;=`%o<%lO%^_KvS!QVOy%^z;'S%^;'S;=`%o<%lO%^ZLXU!PPOy%^z!_%^!_!`6y!`;'S%^;'S;=`%o<%lO%^WLnP;=`<%l$}",tokenizers:[sg,rg,ng,0,1,2,3],topRules:{StyleSheet:[0,4],Styles:[1,84]},specialized:[{term:95,get:t=>ag[t]||-1},{term:56,get:t=>lg[t]||-1},{term:96,get:t=>hg[t]||-1}],tokenPrec:1123});let ug=null;function dg(){if(!ug&&"object"==typeof document&&document.body){let{style:t}=document.body,e=[],i=new Set;for(let n in t)"cssText"!=n&&"cssFloat"!=n&&"string"==typeof t[n]&&(/[A-Z]/.test(n)&&(n=n.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))),i.has(n)||(e.push(n),i.add(n)));ug=e.sort().map((t=>({type:"property",label:t})))}return ug||[]}const fg=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map((t=>({type:"class",label:t}))),pg=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map((t=>({type:"keyword",label:t}))).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map((t=>({type:"constant",label:t})))),Og=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map((t=>({type:"type",label:t}))),gg=/^(\w[\w-]*|-\w[\w-]*|)$/,mg=/^-(-[\w-]*)?$/;const bg=new Ro,wg=["Declaration"];function vg(t){for(let e=t;;){if(e.type.isTop)return e;if(!(e=e.parent))return t}}function yg(t,e,i){if(e.to-e.from>4096){let n=bg.get(e);if(n)return n;let s=[],r=new Set,o=e.cursor(mo.IncludeAnonymous);if(o.firstChild())do{for(let e of yg(t,o.node,i))r.has(e.label)||(r.add(e.label),s.push(e))}while(o.nextSibling());return bg.set(e,s),s}{let n=[],s=new Set;return e.cursor().iterate((e=>{var r;if(i(e)&&e.matchContext(wg)&&":"==(null===(r=e.node.nextSibling)||void 0===r?void 0:r.name)){let i=t.sliceString(e.from,e.to);s.has(i)||(s.add(i),n.push({label:i,type:"variable"}))}})),n}}const Sg=t=>e=>{let{state:i,pos:n}=e,s=Xa(i).resolveInner(n,-1),r=s.type.isError&&s.from==s.to-1&&"-"==i.doc.sliceString(s.from,s.to);if("PropertyName"==s.name||(r||"TagName"==s.name)&&/^(Block|Styles)$/.test(s.resolve(s.to).name))return{from:s.from,options:dg(),validFor:gg};if("ValueName"==s.name)return{from:s.from,options:pg,validFor:gg};if("PseudoClassName"==s.name)return{from:s.from,options:fg,validFor:gg};if(t(s)||(e.explicit||r)&&function(t,e){var i;if(("("==t.name||t.type.isError)&&(t=t.parent||t),"ArgList"!=t.name)return!1;let n=null===(i=t.parent)||void 0===i?void 0:i.firstChild;return"Callee"==(null==n?void 0:n.name)&&"var"==e.sliceString(n.from,n.to)}(s,i.doc))return{from:t(s)||r?s.from:n,options:yg(i.doc,vg(s),t),validFor:mg};if("TagName"==s.name){for(let{parent:t}=s;t;t=t.parent)if("Block"==t.name)return{from:s.from,options:dg(),validFor:gg};return{from:s.from,options:Og,validFor:gg}}if(!e.explicit)return null;let o=s.resolve(n),a=o.childBefore(n);return a&&":"==a.name&&"PseudoClassSelector"==o.name?{from:n,options:fg,validFor:gg}:a&&":"==a.name&&"Declaration"==o.name||"ArgList"==o.name?{from:n,options:pg,validFor:gg}:"Block"==o.name||"Styles"==o.name?{from:n,options:dg(),validFor:gg}:null},xg=Sg((t=>"VariableName"==t.name)),kg=_a.define({name:"css",parser:cg.configure({props:[Na.add({Declaration:il()}),rl.add({"Block KeyframeList":ol})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function Qg(){return new Ua(kg,kg.data.of({autocomplete:xg}))}const $g=["_blank","_self","_top","_parent"],Pg=["ascii","utf-8","utf-16","latin1","latin1"],Cg=["get","post","put","delete"],_g=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Xg=["true","false"],Zg={},Ag={a:{attrs:{href:null,ping:null,type:null,media:null,target:$g,hreflang:null}},abbr:Zg,address:Zg,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Zg,aside:Zg,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Zg,base:{attrs:{href:null,target:$g}},bdi:Zg,bdo:Zg,blockquote:{attrs:{cite:null}},body:Zg,br:Zg,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Zg,center:Zg,cite:Zg,code:Zg,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:Zg,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Zg,div:Zg,dl:Zg,dt:Zg,em:Zg,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Zg,figure:Zg,footer:Zg,form:{attrs:{action:null,name:null,"accept-charset":Pg,autocomplete:["on","off"],enctype:_g,method:Cg,novalidate:["novalidate"],target:$g}},h1:Zg,h2:Zg,h3:Zg,h4:Zg,h5:Zg,h6:Zg,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Zg,hgroup:Zg,hr:Zg,html:{attrs:{manifest:null}},i:Zg,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:Zg,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Zg,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:Zg,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Pg,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:Zg,noscript:Zg,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:Zg,param:{attrs:{name:null,value:null}},pre:Zg,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Zg,rt:Zg,ruby:Zg,samp:Zg,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Pg}},section:Zg,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Zg,source:{attrs:{src:null,type:null,media:null}},span:Zg,strong:Zg,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Zg,summary:Zg,sup:Zg,table:Zg,tbody:Zg,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Zg,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:Zg,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Zg,time:{attrs:{datetime:null}},title:Zg,tr:Zg,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Zg,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:Zg},Tg={accesskey:null,class:null,contenteditable:Xg,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Xg,autocorrect:Xg,autocapitalize:Xg,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Xg,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Xg,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Xg,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Xg,"aria-hidden":Xg,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Xg,"aria-multiselectable":Xg,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Xg,"aria-relevant":null,"aria-required":Xg,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},Rg="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map((t=>"on"+t));for(let t of Rg)Tg[t]=null;class Eg{constructor(t,e){this.tags=Object.assign(Object.assign({},Ag),t),this.globalAttrs=Object.assign(Object.assign({},Tg),e),this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}function Vg(t,e,i=t.length){if(!e)return"";let n=e.firstChild,s=n&&n.getChild("TagName");return s?t.sliceString(s.from,Math.min(s.to,i)):""}function Mg(t,e=!1){for(let i=t.parent;i;i=i.parent)if("Element"==i.name){if(!e)return i;e=!1}return null}function Dg(t,e,i){let n=i.tags[Vg(t,Mg(e,!0))];return(null==n?void 0:n.children)||i.allTags}function Wg(t,e){let i=[];for(let n=e;n=Mg(n);){let s=Vg(t,n);if(s&&"CloseTag"==n.lastChild.name)break;s&&i.indexOf(s)<0&&("EndTag"==e.name||e.from>=n.firstChild.to)&&i.push(s)}return i}Eg.default=new Eg;const Ug=/^[:\-\.\w\u00b7-\uffff]*$/;function Yg(t,e,i,n,s){let r=/\s*>/.test(t.sliceDoc(s,s+5))?"":">";return{from:n,to:s,options:Dg(t.doc,i,e).map((t=>({label:t,type:"type"}))).concat(Wg(t.doc,i).map(((t,e)=>({label:"/"+t,apply:"/"+t+r,type:"type",boost:99-e})))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function qg(t,e,i,n){let s=/\s*>/.test(t.sliceDoc(n,n+5))?"":">";return{from:i,to:n,options:Wg(t.doc,e).map(((t,e)=>({label:t,apply:t+s,type:"type",boost:99-e}))),validFor:Ug}}function Lg(t,e){let{state:i,pos:n}=e,s=Xa(i).resolveInner(n),r=s.resolve(n,-1);for(let t,e=n;s==r&&(t=r.childBefore(e));){let i=t.lastChild;if(!i||!i.type.isError||i.from({label:t,type:"property"}))),validFor:Ug}}(i,t,r,"AttributeName"==r.name?r.from:n,n):"Is"==r.name||"AttributeValue"==r.name||"UnquotedAttributeValue"==r.name?function(t,e,i,n,s){var r;let o,a=null===(r=i.parent)||void 0===r?void 0:r.getChild("AttributeName"),l=[];if(a){let r=t.sliceDoc(a.from,a.to),h=e.globalAttrs[r];if(!h){let n=Mg(i),s=n?e.tags[Vg(t.doc,n)]:null;h=(null==s?void 0:s.attrs)&&s.attrs[r]}if(h){let e=t.sliceDoc(n,s).toLowerCase(),i='"',r='"';/^['"]/.test(e)?(o='"'==e[0]?/^[^"]*$/:/^[^']*$/,i="",r=t.sliceDoc(s,s+1)==e[0]?"":e[0],e=e.slice(1),n++):o=/^[^\s<>='"]*$/;for(let t of h)l.push({label:t,apply:i+t+r,type:"constant"})}}return{from:n,to:s,options:l,validFor:o}}(i,t,r,"Is"==r.name?n:r.from,n):!e.explicit||"Element"!=s.name&&"Text"!=s.name&&"Document"!=s.name?null:function(t,e,i,n){let s=[],r=0;for(let n of Dg(t.doc,i,e))s.push({label:"<"+n,type:"type"});for(let e of Wg(t.doc,i))s.push({label:"",type:"type",boost:99-r++});return{from:n,to:n,options:s,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}(i,t,r,n)}function zg(t){let{extraTags:e,extraGlobalAttributes:i}=t,n=i||e?new Eg(e,i):Eg.default;return t=>Lg(n,t)}const Ig=[{tag:"script",attrs:t=>"text/typescript"==t.type||"ts"==t.lang,parser:zf.parser},{tag:"script",attrs:t=>"text/babel"==t.type||"text/jsx"==t.type,parser:If.parser},{tag:"script",attrs:t=>"text/typescript-jsx"==t.type,parser:Bf.parser},{tag:"script",attrs:t=>!t.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(t.type),parser:qf.parser},{tag:"style",attrs:t=>(!t.lang||"css"==t.lang)&&(!t.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(t.type)),parser:kg.parser}],Bg=[{name:"style",parser:kg.parser.configure({top:"Styles"})}].concat(Rg.map((t=>({name:t,parser:qf.parser})))),jg=_a.define({name:"html",parser:FO.configure({props:[Na.add({Element(t){let e=/^(\s*)(<\/)?/.exec(t.textAfter);return t.node.to<=t.pos+e[0].length?t.continue():t.lineIndent(t.node.from)+(e[2]?0:t.unit)},"OpenTag CloseTag SelfClosingTag":t=>t.column(t.node.from)+t.unit,Document(t){if(t.pos+/\s*/.exec(t.textAfter)[0].lengtht.getChild("TagName")})],wrap:tg(Ig,Bg)}),languageData:{commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-._"}});function Ng(t={}){let e,i="";!1===t.matchClosingTags&&(i="noMatch"),!0===t.selfClosingTags&&(i=(i?i+" ":"")+"selfClosing"),(t.nestedLanguages&&t.nestedLanguages.length||t.nestedAttributes&&t.nestedAttributes.length)&&(e=tg((t.nestedLanguages||[]).concat(Ig),(t.nestedAttributes||[]).concat(Bg)));let n=e||i?jg.configure({dialect:i,wrap:e}):jg;return new Ua(n,[jg.data.of({autocomplete:zg(t)}),!1!==t.autoCloseTags?Fg:[],Nf().support,Qg().support])}const Gg=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),Fg=Ts.inputHandler.of(((t,e,i,n)=>{if(t.composing||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!jg.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((e=>{var i,r,o;let a,{head:l}=e,h=Xa(s).resolveInner(l,-1);if("TagName"!=h.name&&"StartTag"!=h.name||(h=h.parent),">"==n&&"OpenTag"==h.name){if("CloseTag"!=(null===(r=null===(i=h.parent)||void 0===i?void 0:i.lastChild)||void 0===r?void 0:r.name)&&(a=Vg(s.doc,h.parent,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`${e?"":">"}`;return{range:A.cursor(l+1),changes:{from:l+(e?1:0),insert:i}}}}else if("/"==n&&"OpenTag"==h.name){let e=h.parent,i=null==e?void 0:e.parent;if(e.from==l-1&&"CloseTag"!=(null===(o=i.lastChild)||void 0===o?void 0:o.name)&&(a=Vg(s.doc,i,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`/${a}${e?"":">"}`,n=l+i.length+(e?1:0);return{range:A.cursor(n),changes:{from:l,insert:i}}}}return{range:e}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)})),Hg=Qa({commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}}}),Jg=new ho,Kg=sO.configure({props:[rl.add((t=>!t.is("Block")||t.is("Document")||null!=tm(t)?void 0:(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to}))),Jg.add(tm),Na.add({Document:()=>null}),ka.add({Document:Hg})]});function tm(t){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(t.name);return e?+e[1]:void 0}function em(t,e){let i=t;for(;;){let t,n=i.nextSibling;if(!n||null!=(t=tm(n.type))&&t<=e)break;i=n}return i.to}const im=sl.of(((t,e,i)=>{for(let n=Xa(t).resolveInner(i,-1);n&&!(n.fromi)return{from:i,to:e}}return null}));function nm(t){return new Pa(Hg,t,[im],"markdown")}const sm=nm(Kg),rm=nm(Kg.configure([pO,mO,gO,bO]));class om{constructor(t,e,i,n,s,r,o){this.node=t,this.from=e,this.to=i,this.spaceBefore=n,this.spaceAfter=s,this.type=r,this.item=o}blank(t,e=!0){let i=this.spaceBefore+("Blockquote"==this.node.name?">":"");if(null!=t){for(;i.length0;t--)i+=" ";return i+(e?this.spaceAfter:"")}marker(t,e){let i="OrderedList"==this.node.name?String(+lm(this.item,t)[2]+e):"";return this.spaceBefore+i+this.type+this.spaceAfter}}function am(t,e){let i=[];for(let e=t;e&&"Document"!=e.name;e=e.parent)"ListItem"!=e.name&&"Blockquote"!=e.name&&"FencedCode"!=e.name||i.push(e);let n=[];for(let t=i.length-1;t>=0;t--){let s,r=i[t],o=e.lineAt(r.from),a=r.from-o.from;if("FencedCode"==r.name)n.push(new om(r,a,a,"","","",null));else if("Blockquote"==r.name&&(s=/^[ \t]*>( ?)/.exec(o.text.slice(a))))n.push(new om(r,a,a+s[0].length,"",s[1],">",null));else if("ListItem"==r.name&&"OrderedList"==r.parent.name&&(s=/^([ \t]*)\d+([.)])([ \t]*)/.exec(o.text.slice(a)))){let t=s[3],e=s[0].length;t.length>=4&&(t=t.slice(0,t.length-4),e-=4),n.push(new om(r.parent,a,a+e,s[1],t,s[2],r))}else if("ListItem"==r.name&&"BulletList"==r.parent.name&&(s=/^([ \t]*)([-+*])([ \t]{1,4}\[[ xX]\])?([ \t]+)/.exec(o.text.slice(a)))){let t=s[4],e=s[0].length;t.length>4&&(t=t.slice(0,t.length-4),e-=4);let i=s[2];s[3]&&(i+=s[3].replace(/[xX]/," ")),n.push(new om(r.parent,a,a+e,s[1],t,i,r))}}return n}function lm(t,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(t.from,t.from+10))}function hm(t,e,i,n=0){for(let s=-1,r=t;;){if("ListItem"==r.name){let t=lm(r,e),o=+t[2];if(s>=0){if(o!=s+1)return;i.push({from:r.from+t[1].length,to:r.from+t[0].length,insert:String(s+2+n)})}s=o}let t=r.nextSibling;if(!t)break;r=t}}function cm(t){return"QuoteMark"==t.name||"ListMark"==t.name}const um=[{key:"Enter",run:({state:t,dispatch:e})=>{let i=Xa(t),{doc:n}=t,s=null,r=t.changeByRange((e=>{if(!e.empty||!rm.isActiveAt(t,e.from))return s={range:e};let r=e.from,o=n.lineAt(r),a=am(i.resolveInner(r,-1),n);for(;a.length&&a[a.length-1].from>r-o.from;)a.pop();if(!a.length)return s={range:e};let l=a[a.length-1];if(l.to-l.spaceAfter.length>r-o.from)return s={range:e};let h=r>=l.to-l.spaceAfter.length&&!/\S/.test(o.text.slice(l.to));if(l.item&&h){if(l.node.firstChild.to>=r||o.from>0&&!/[^\s>]/.test(n.lineAt(o.from-1).text)){let t,e=a.length>1?a[a.length-2]:null,i="";e&&e.item?(t=o.from+e.from,i=e.marker(n,1)):t=o.from+(e?e.to:0);let s=[{from:t,to:r,insert:i}];return"OrderedList"==l.node.name&&hm(l.item,n,s,-2),e&&"OrderedList"==e.node.name&&hm(e.item,n,s),{range:A.cursor(t+i.length),changes:s}}{let e="";for(let t=0,i=a.length-2;t<=i;t++)e+=a[t].blank(t\s*$/.exec(i.text);if(s&&s.index==l.from){let n=t.changes([{from:i.from+s.index,to:i.to},{from:o.from+l.from,to:o.to}]);return{range:e.map(n),changes:n}}}let c=[];"OrderedList"==l.node.name&&hm(l.item,n,c);let u=l.item&&l.item.from]*/.exec(o.text)[0].length>=l.to)for(let t=0,e=a.length-1;t<=e;t++)d+=t!=e||u?a[t].blank(to.from&&/\s/.test(o.text.charAt(f-o.from-1));)f--;return d=t.lineBreak+d,c.push({from:f,to:r,insert:d}),{range:A.cursor(f+d.length),changes:c}}));return!s&&(e(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0)}},{key:"Backspace",run:({state:t,dispatch:e})=>{let i=Xa(t),n=null,s=t.changeByRange((e=>{let s=e.from,{doc:r}=t;if(e.empty&&rm.isActiveAt(t,e.from)){let t=r.lineAt(s),n=am(function(t,e){let i=t.resolveInner(e,-1),n=e;cm(i)&&(n=i.from,i=i.parent);for(let t;t=i.childBefore(n);)if(cm(t))n=t.from;else{if("OrderedList"!=t.name&&"BulletList"!=t.name)break;i=t.lastChild,n=i.to}return i}(i,s),r);if(n.length){let i=n[n.length-1],r=i.to-i.spaceAfter.length+(i.spaceAfter?1:0);if(s-t.from>r&&!/\S/.test(t.text.slice(r,s-t.from)))return{range:A.cursor(t.from+r),changes:{from:t.from+r,to:s}};if(s-t.from==r&&(!i.item||t.from<=i.item.from||!/\S/.test(t.text.slice(0,i.to)))){let n=t.from+i.from;if(i.item&&i.node.fromt.from-e.from||t.startSide-e.startSide)),ni.set(i)}getMatchingBracket(t){switch(t){case")":return"(";case"]":return"[";case"}":return"{";default:return null}}},{decorations:t=>t.decorations});var fm="[a-zA-Z\\$][a-zA-Z0-9\\$]*",pm="(?:\\.\\d+|\\d+\\.\\d*|\\d+)",Om="(?:`(?:`?"+pm+")?)",gm=new RegExp("(?:(?:\\d+)(?:\\^\\^(?:\\.\\w+|\\w+\\.\\w*|\\w+)"+Om+"?(?:\\*\\^[+-]?\\d+)?))"),mm=new RegExp("(?:"+pm+Om+"?(?:\\*\\^[+-]?\\d+)?)"),bm=new RegExp("(?:`?)(?:"+fm+")(?:`(?:"+fm+"))*(?:`?)");let wm=[];const vm=["True","False","All","None","Null","Full","$Failed","$Aborted"];function ym(t,e){var i;return'"'===(i=t.next())?(e.tokenize=Sm,e.tokenize(t,e)):"("===i&&t.eat("*")?(e.commentLevel++,e.tokenize=xm,e.tokenize(t,e)):(t.backUp(1),t.match(gm,!0,!1)||t.match(mm,!0,!1)?"number":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::usage)/,!0,!1)?"meta":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::[a-zA-Z\$][a-zA-Z0-9\$]*):?/,!0,!1)?"string.special":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*\s*:)(?:(?:[a-zA-Z\$][a-zA-Z0-9\$]*)|(?:[^:=>~@\^\&\*\)\[\]'\?,\|])).*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+/,!0,!1)||t.match(/_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)?"variableName.special":t.match(/\\\[[a-zA-Z\$][a-zA-Z0-9\$]*\]/,!0,!1)?"character":t.match(/(?:\[|\]|{|}|\(|\))/,!0,!1)?"bracket":t.match(/(?:#[a-zA-Z\$][a-zA-Z0-9\$]*|#+[0-9]?)/,!0,!1)?"variableName.constant":t.match(bm,!0,!1)?vm.indexOf(t.current())>-1?"number":wm.indexOf(t.current())>-1||0==wm.length?"keyword":t.current()in e.localVars?"atom":(e.localVars[t.current()]=!0,"function"):t.match(/(?:\\|\+|\-|\*|\/|,|;|\.|:|@|~|=|>|<|&|\||_|`|'|\^|\?|!|%)/,!0,!1)?"operator":(t.next(),"error"))}function Sm(t,e){for(var i,n=!1,s=!1;null!=(i=t.next());){if('"'===i&&!s){n=!0;break}s=!s&&"\\"===i}return n&&!s&&(e.tokenize=ym),"string"}function xm(t,e){for(var i,n;e.commentLevel>0&&null!=(n=t.next());)"("===i&&"*"===n&&e.commentLevel++,"*"===i&&")"===n&&e.commentLevel--,i=n;return e.commentLevel<=0&&(e.tokenize=ym),"comment"}const km={name:"mathematica",extendVariables:function(t){},startState:function(){return{tokenize:ym,commentLevel:0,localVars:{}}},token:function(t,e){return t.eatSpace()?null:e.tokenize(t,e)},languageData:{commentTokens:{block:{open:"(*",close:"*)"}}}};let Qm={of:t=>[Gl.define(km),Yd({override:[async e=>function(t,e){let i=t.matchBefore(/\w*/);return i.from!==i.to||t.explicit?{from:i.from,options:e.data}:null}(e,t)]}),Ys.of([{key:"Escape",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((t=>{let{from:e,to:i}=t;return{changes:{from:e,to:i,insert:"EC"},range:A.cursor(e+2)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])],reBuild:t=>{wm=t.map((t=>t.label))}};const $m=(t,e,i,n)=>{if(0==t.length)return;const s=(new Date).valueOf();let r=0;i.dom.loadingMark=!0;const o=i.dom.style.background;let a=0;console.log("Start animation");const l=setInterval((()=>{i.dom.style.setProperty("background","hsl("+a+"deg 100% 97%)","important"),a+=2,a>360&&(a=0)}),30);n.transaction(e,i,s,t.length);for(const a of t)Pm(a,((a,h)=>{n.file(e,i,s,a,h),r++,r>=t.length&&i.dom&&i.dom.loadingMark&&(i.dom.loadingMark=!1,setTimeout((()=>{i.dom.style.background=o,clearInterval(l),console.log("Stop animation")}),2e3))}),(()=>{console.warn("Fauilure");const t=i.dom.style.background;i.dom.style.background="rgb(255 189 189 / 97%)";let e=97;const n=setInterval((()=>{i.dom.style.background="rgb(255 189 189 / "+Math.round(e)+"%)",e*=.95}),30);clearInterval(l),setTimeout((()=>{clearInterval(n),i.dom.style.background=t}),3e3)}))};function Pm(t,e,i){const n=new FileReader;n.addEventListener("load",(n=>{const s=n.target.result;if(s.byteLength/1024/1024>15)return alert("Files > 15Mb are not supported for drag and drop"),void i();let r=base64ArrayBuffer(s);e(t.name,r)})),n.addEventListener("progress",(t=>{if(t.loaded&&t.total){const e=t.loaded/t.total*100;console.log(e)}})),n.readAsArrayBuffer(t)}const Cm=(t,e)=>Ts.domEventHandlers({drop(e,i){e.preventDefault();const n=[];e.dataTransfer.items?[...e.dataTransfer.items].forEach(((t,e)=>{if("file"===t.kind){const i=t.getAsFile();console.log(`… file[${e}].name = ${i.name}`),n.push(i)}})):[...e.dataTransfer.files].forEach(((t,e)=>{console.log(`… file[${e}].name = ${t.name}`),n.push(t)})),$m(n,e,i,t)},paste(t,i){let n=t.clipboardData||window.clipboardData;for(const s of n.items)if("string"===s.kind)switch(s.type){case"text/plain":break;case"image/png":t.preventDefault(),$m([s.getAsFile()],t,i,e)}else t.preventDefault(),$m([s.getAsFile()],t,i,e)}}),_m=new pr({regexp:/\\\[(\w+)\]/g,decoration:t=>ni.replace({widget:new Zm(t[1])})}),Xm=_i.fromClass(class{constructor(t){this.Greekholder=_m.createDeco(t)}update(t){this.Greekholder=_m.updateDeco(t,this.Greekholder)}},{decorations:t=>t.Greekholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Greekholder||ni.none))});class Zm extends ei{constructor(t){super(),this.name=t}eq(t){return this.name===t.name}toDOM(){let t=document.createElement("span");return t.innerHTML="&"+this.name.toLowerCase().replace("sqrt","radic").replace("undirectededge","harr").replace("directededge","rarr").replace(/capital(.*)/,((t,e)=>e.charAt(0).toUpperCase()+e.slice(1))).replace(/curly(.*)/,((t,e)=>e)).replace(/script(.*)/,((t,e)=>"el"+e.toLowerCase())).replace("transpose","#7488").replace("degree","deg")+";",t}ignoreEvent(){return!1}}const Am=new pr({regexp:/(->|<-)/g,decoration:t=>ni.replace({widget:new Tm(t[1])})});_i.fromClass(class{constructor(t){this.Arrowholder=Am.createDeco(t)}update(t){this.Arrowholder=Am.updateDeco(t,this.Arrowholder)}},{decorations:t=>t.Arrowholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Arrowholder||ni.none))});class Tm extends ei{constructor(t){super(),this.dir=t}eq(t){return this.dir===t.dir}toDOM(){let t=document.createElement("span");return"->"===this.dir?t.innerText="→":t.innerText="←",t}ignoreEvent(){return!1}}function Rm(t){if(!(t=t||{}).open)throw new Error('Balanced: please provide a "open" property');if(!t.close)throw new Error('Balanced: please provide a "close" property');if(this.balance=t.balance||!1,this.exceptions=t.exceptions||!1,this.caseInsensitive=t.caseInsensitive,this.head=t.head||t.open,this.head=Array.isArray(this.head)?this.head:[this.head],this.open=Array.isArray(t.open)?t.open:[t.open],this.close=Array.isArray(t.close)?t.close:[t.close],!Array.isArray(this.head)||!Array.isArray(this.open)||!Array.isArray(this.close)||this.head.length!==this.open.length||this.open.length!==this.close.length)throw new Error('Balanced: if you use arrays for a "head,open,close" you must use matching arrays for all options');var e=Dm(this.head.map(this.regExpFromArrayGroupedMap,this)),i=Dm(this.open.map(this.regExpFromArrayGroupedMap,this)),n=Dm(this.close.map(this.regExpFromArrayGroupedMap,this));this.regExp=Dm([e,i,n],"g"+(this.caseInsensitive?"i":"")),this.regExpGroupLength=this.head.length}function Em(t,e,i){for(var n=Mm(e.substr(0,i+1),/^.*\n?$/gim),s=Mm(e,/^.*\n?$/gim),r=n.length-1,o=i+1-(n.length?n[n.length-1].index:0),a="",l=2;l>=0;l--)r-l>=0&&s[r-l]&&(a+=e.substr(s[r-l].index,s[r-l].length)+"\n");for(l=0;l=0&&s[r+l]&&(a+=e.substr(s[r+l].index,s[r+l].length)+"\n");a=a.replace(/\t/g," ").replace(/\n$/,"");var h=new Error(t+" at "+(r+1)+":"+o+"\n\n"+a);return h.line=r+1,h.column=o,h.index=i,h}function Vm(t,e){return t>=e.index&&t<=e.index+e.length-1}function Mm(t,e){var i,n=new RegExp(e),s=[];if(t)for(;i=n.exec(t);)s.push({index:i.index,length:i[0].length,match:i[0]}),i[0].length||n.lastIndex++;return s}function Dm(t,e,i){var n=t.map((function(t){return t instanceof RegExp?t.source:function(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}(t)}),this).join("|");return n=i?"("+n+")":"(?:"+n+")",new RegExp(n,e||void 0)}Rm.prototype={regExpFromArrayGroupedMap:function(t){return Dm([t],null,!0)},matchContentsInBetweenBrackets:function(t,e){for(var i,n=new RegExp(this.regExp),s=[],r=[],o=null,a=!0;i=n.exec(t);){if(e){for(var l=!1,h=0;h{const i=((t,e,i)=>{var n,s=new RegExp(t),r=[];if(e)for(;n=s.exec(e);){if(i){for(var o=!1,a=0;a{new qm({open:"(*"+t+"[*)",close:"(*]"+t+"*)",balance:!1}).matchContentsInBetweenBrackets(e.value,[]).forEach((function(t){const s=e.value.slice(t.index+t.head.length,t.index+t.length-t.tail.length);n(i+t.index,{length:t.length,pos:i+t.index,argsPos:i+t.index+t.head.length,str:s})}))})(e,t,i,s)},o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)r(o,a)}var Im,Bm=function(){function t(t){var e=t.tag,i=t.decoration,n=t.decorate,s=t.boundary,r=t.maxLength,o=void 0===r?1e3:r;if(this.tag=e,n)this.addMatch=function(t,e,i,s){return n(s,i,i+t.length,t,e)};else if("function"==typeof i)this.addMatch=function(t,e,n,s){var r=i(t,e,n);r&&s(n,n+t.length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=function(t,e,n,s){return s(n,n+t.length,i)}}this.boundary=s,this.maxLength=o}return t.prototype.createDeco=function(t){for(var e=this,i=new Xt,n=i.add.bind(i),s=0,r=function(t,e){var i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;for(var n=[],s=0,r=i;s=a?n[n.length-1].to=l:n.push({from:a,to:l})}return n}(t,this.maxLength);st.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e},t.prototype.updateRange=function(t,e,i,n){for(var s=this,r=function(r){var a=Math.max(r.from,i),l=Math.min(r.to,n);if(l>a){var h=t.state.doc.lineAt(a),c=h.toh.from;a--)if(o.boundary.test(h.text[a-1-h.from])){u=a;break}for(;ld},add:f})}},o=this,a=0,l=t.visibleRanges;a{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*FB[*)((_)(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*FB[*)(("+s+")(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let Nm=class{constructor(t,e,i,n,s,r){this.view=e,this.visibleValue=t,this.placeholder=r,console.log(r),this.args=Lm(t.str,/\(\*,\*\)/gm);const o=this;let a,l;console.log("creating InstanceWidget"),a=Im({doc:o.args[0].body.slice(2,-1),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(o.visibleValue.pos),e.dispatch({selection:{anchor:o.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return l.dispatch({selection:{anchor:0}}),l.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){l.focus(),t.editorLastCursor=void 0}}])]}),l=Im({doc:o.args[2].body.slice(1,-2),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:a.state.doc.length}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:o.visibleValue.pos+o.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus(),t.editorLastCursor=void 0}}])]}),o.args[0].length=o.args[0].body.length,o.args[2].length=o.args[2].body.length,delete o.args[2].body,delete o.args[1].body,delete o.args[0].body,this.topEditor=a,this.bottomEditor=l}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="(("+t+")",s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length));const r=e.length-i[0].length;i[0].to=i[0].to+r,i[2].from=i[2].from+r,i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e="("+t+"))",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length));const r=e.length-i[2].length;i[2].to=i[2].to+r,i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t,e){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm),console.log("recreating InstanceWidget"),n=Im.state({doc:e.args[0].body.slice(2,-1),update:t=>e.applyChanges(t,0),eval:()=>{i.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(e.visibleValue.pos),i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus(),t.editorLastCursor=void 0}}])]}),s=Im.state({doc:e.args[2].body.slice(1,-2),update:t=>e.applyChanges(t,2),eval:()=>{e.view.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus(),t.editorLastCursor=void 0}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),console.log(e),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.placeholder=e,this.visibleValue.argsPos=t.argsPos}destroy(){this.topEditor.destroy(),this.bottomEditor.destroy()}},Gm=class extends ei{constructor(t,e,i,n){super(),this.view=i,this.visibleValue=t,this.reference=e,this.placeholder=n}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue,this),!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("fraction");const i=document.createElement("table");i.classList.add("container"),e.appendChild(i);const n=document.createElement("tbody");i.appendChild(n);const s=document.createElement("tr"),r=document.createElement("tr");n.appendChild(s),n.appendChild(r);const o=document.createElement("td");o.classList.add("enumenator"),s.appendChild(o);const a=document.createElement("td");r.appendChild(a);const l=this;return e.EditorWidget=new Nm(this.visibleValue,t,o,a,[],this),this.DOMElement=e,this.reference.push({destroy:()=>{l.destroy(e)}}),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const Fm=(t,e,i)=>new Bm({tag:"FB",decoration:n=>ni.replace({widget:new Gm(n,t,e,i)})}),Hm=t=>_i.fromClass(class{constructor(e){this.disposable=[],this.placeholder=Fm(this.disposable,e,this).createDeco(e),t.placeholder=this}update(t){this.placeholder=Fm(this.disposable,t,this).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var Jm;function Km(t){return Jm=t,[nb,Ys.of([{key:"Ctrl-2",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt[_](*]SqB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt["+s+"](*]SqB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let tb=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;this.sliceRanges=n,this.length=t.str.length,console.log("creating InstanceWidget"),this.editor=Jm({doc:t.str.slice(...n),parent:i,update:t=>r.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]})}applyChanges(t){const e=t,i={from:this.visibleValue.argsPos+5,to:this.visibleValue.argsPos+this.length-1,insert:e};console.log(this.visibleValue);const n=e.length+6-this.length;this.length=this.length+n,this.visibleValue.length=this.visibleValue.length+n,this.visibleValue.str="Sqrt["+e+"]",this.view.dispatch({changes:i})}update(t){if(this.visibleValue.str==t.str)this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos;else{console.warn("Out of sync"),this.visibleValue=t;const e=this.sliceRanges,i=this.editor,n=this,s=this.view;this.length=t.str.length;const r=Jm.state({doc:t.str.slice(...e),update:t=>n.applyChanges(t),eval:()=>{s.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos+n.visibleValue.length}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]});i.setState(r)}}destroy(){console.warn("destroy Instance of Widget!"),this.editor.destroy()}},eb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("sqroot");const i=this,n=document.createElement("span");return n.classList.add("radicand"),e.EditorWidget=new tb(this.visibleValue,t,n,[5,-1],[]),e.appendChild(n),this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const ib=(t,e)=>new Bm({tag:"SqB",decoration:i=>ni.replace({widget:new eb(i,t,e)})}),nb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=ib(this.disposable,t).createDeco(t)}update(t){this.placeholder=ib(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var sb;function rb(t){return sb=t,[hb,Ys.of([{key:"Ctrl--",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SbB[*)Subscript[_(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SbB[*)Subscript["+s+"(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let ob=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),console.log(r.visibleValue),o=sb({doc:r.args[0].body.slice(10),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){a.focus()}}])]}),a=sb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Subscript["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),console.log(e.visibleValue),n=sb.state({doc:e.args[0].body.slice(10),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus()}}])]}),s=sb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},ab=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sub");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new ob(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const lb=(t,e)=>new Bm({tag:"SbB",decoration:i=>ni.replace({widget:new ab(i,t,e)})}),hb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=lb(this.disposable,t).createDeco(t)}update(t){this.placeholder=lb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var cb;function ub(t){return cb=t,[Ob,Ys.of([{key:"Ctrl-6",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SpB[*)Power[_(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SpB[*)Power["+s+"(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let db=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),o=cb({doc:r.args[0].body.slice(6),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus()}}])]}),a=cb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Power["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),n=cb.state({doc:e.args[0].body.slice(6),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.bottomEditor.focus()}}])]}),s=cb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},fb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sup");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new db(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}destroy(t){t.EditorWidget.destroy()}};const pb=(t,e)=>new Bm({tag:"SpB",decoration:i=>ni.replace({widget:new fb(i,t,e)})}),Ob=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=pb(this.disposable,t).createDeco(t)}update(t){this.placeholder=pb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var gb={},mb={},bb={},wb={};function vb(t){let e=t.length;for(;--e>=0;)t[e]=0}const yb=256,Sb=286,xb=30,kb=15,Qb=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),$b=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Pb=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Cb=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_b=new Array(576);vb(_b);const Xb=new Array(60);vb(Xb);const Zb=new Array(512);vb(Zb);const Ab=new Array(256);vb(Ab);const Tb=new Array(29);vb(Tb);const Rb=new Array(xb);function Eb(t,e,i,n,s){this.static_tree=t,this.extra_bits=e,this.extra_base=i,this.elems=n,this.max_length=s,this.has_stree=t&&t.length}let Vb,Mb,Db;function Wb(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}vb(Rb);const Ub=t=>t<256?Zb[t]:Zb[256+(t>>>7)],Yb=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},qb=(t,e,i)=>{t.bi_valid>16-i?(t.bi_buf|=e<>16-t.bi_valid,t.bi_valid+=i-16):(t.bi_buf|=e<{qb(t,i[2*e],i[2*e+1])},zb=(t,e)=>{let i=0;do{i|=1&t,t>>>=1,i<<=1}while(--e>0);return i>>>1},Ib=(t,e,i)=>{const n=new Array(16);let s,r,o=0;for(s=1;s<=kb;s++)o=o+i[s-1]<<1,n[s]=o;for(r=0;r<=e;r++){let e=t[2*r+1];0!==e&&(t[2*r]=zb(n[e]++,e))}},Bb=t=>{let e;for(e=0;e{t.bi_valid>8?Yb(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},Nb=(t,e,i,n)=>{const s=2*e,r=2*i;return t[s]{const n=t.heap[i];let s=i<<1;for(;s<=t.heap_len&&(s{let n,s,r,o,a=0;if(0!==t.sym_next)do{n=255&t.pending_buf[t.sym_buf+a++],n+=(255&t.pending_buf[t.sym_buf+a++])<<8,s=t.pending_buf[t.sym_buf+a++],0===n?Lb(t,s,e):(r=Ab[s],Lb(t,r+yb+1,e),o=Qb[r],0!==o&&(s-=Tb[r],qb(t,s,o)),n--,r=Ub(n),Lb(t,r,i),o=$b[r],0!==o&&(n-=Rb[r],qb(t,n,o)))}while(a{const i=e.dyn_tree,n=e.stat_desc.static_tree,s=e.stat_desc.has_stree,r=e.stat_desc.elems;let o,a,l,h=-1;for(t.heap_len=0,t.heap_max=573,o=0;o>1;o>=1;o--)Gb(t,i,o);l=r;do{o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Gb(t,i,1),a=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=a,i[2*l]=i[2*o]+i[2*a],t.depth[l]=(t.depth[o]>=t.depth[a]?t.depth[o]:t.depth[a])+1,i[2*o+1]=i[2*a+1]=l,t.heap[1]=l++,Gb(t,i,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const i=e.dyn_tree,n=e.max_code,s=e.stat_desc.static_tree,r=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,l=e.stat_desc.max_length;let h,c,u,d,f,p,O=0;for(d=0;d<=kb;d++)t.bl_count[d]=0;for(i[2*t.heap[t.heap_max]+1]=0,h=t.heap_max+1;h<573;h++)c=t.heap[h],d=i[2*i[2*c+1]+1]+1,d>l&&(d=l,O++),i[2*c+1]=d,c>n||(t.bl_count[d]++,f=0,c>=a&&(f=o[c-a]),p=i[2*c],t.opt_len+=p*(d+f),r&&(t.static_len+=p*(s[2*c+1]+f)));if(0!==O){do{for(d=l-1;0===t.bl_count[d];)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[l]--,O-=2}while(O>0);for(d=l;0!==d;d--)for(c=t.bl_count[d];0!==c;)u=t.heap[--h],u>n||(i[2*u+1]!==d&&(t.opt_len+=(d-i[2*u+1])*i[2*u],i[2*u+1]=d),c--)}})(t,e),Ib(i,h,t.bl_count)},Jb=(t,e,i)=>{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),e[2*(i+1)+1]=65535,n=0;n<=i;n++)s=o,o=e[2*(n+1)+1],++a{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),n=0;n<=i;n++)if(s=o,o=e[2*(n+1)+1],!(++a{qb(t,0+(n?1:0),3),jb(t),Yb(t,i),Yb(t,~i),i&&t.pending_buf.set(t.window.subarray(e,e+i),t.pending),t.pending+=i};wb._tr_init=t=>{tw||((()=>{let t,e,i,n,s;const r=new Array(16);for(i=0,n=0;n<28;n++)for(Tb[n]=i,t=0;t<1<>=7;n{let s,r,o=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e{let e;for(Jb(t,t.dyn_ltree,t.l_desc.max_code),Jb(t,t.dyn_dtree,t.d_desc.max_code),Hb(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*Cb[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=i+5,i+4<=s&&-1!==e?ew(t,e,i,n):4===t.strategy||r===s?(qb(t,2+(n?1:0),3),Fb(t,_b,Xb)):(qb(t,4+(n?1:0),3),((t,e,i,n)=>{let s;for(qb(t,e-257,5),qb(t,i-1,5),qb(t,n-4,4),s=0;s(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=i,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(Ab[i]+yb+1)]++,t.dyn_dtree[2*Ub(e)]++),t.sym_next===t.sym_end),wb._tr_align=t=>{qb(t,2,3),Lb(t,256,_b),(t=>{16===t.bi_valid?(Yb(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)};var iw=(t,e,i,n)=>{let s=65535&t|0,r=t>>>16&65535|0,o=0;for(;0!==i;){o=i>2e3?2e3:i,i-=o;do{s=s+e[n++]|0,r=r+s|0}while(--o);s%=65521,r%=65521}return s|r<<16|0};const nw=new Uint32Array((()=>{let t,e=[];for(var i=0;i<256;i++){t=i;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e})());var sw=(t,e,i,n)=>{const s=nw,r=n+i;t^=-1;for(let i=n;i>>8^s[255&(t^e[i])];return-1^t},rw={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},ow={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:aw,_tr_stored_block:lw,_tr_flush_block:hw,_tr_tally:cw,_tr_align:uw}=wb,dw=iw,fw=sw,pw=rw,{Z_NO_FLUSH:Ow,Z_PARTIAL_FLUSH:gw,Z_FULL_FLUSH:mw,Z_FINISH:bw,Z_BLOCK:ww,Z_OK:vw,Z_STREAM_END:yw,Z_STREAM_ERROR:Sw,Z_DATA_ERROR:xw,Z_BUF_ERROR:kw,Z_DEFAULT_COMPRESSION:Qw,Z_FILTERED:$w,Z_HUFFMAN_ONLY:Pw,Z_RLE:Cw,Z_FIXED:_w,Z_DEFAULT_STRATEGY:Xw,Z_UNKNOWN:Zw,Z_DEFLATED:Aw}=ow,Tw=258,Rw=262,Ew=42,Vw=113,Mw=666,Dw=(t,e)=>(t.msg=pw[e],e),Ww=t=>2*t-(t>4?9:0),Uw=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Yw=t=>{let e,i,n,s=t.w_size;e=t.hash_size,n=e;do{i=t.head[--n],t.head[n]=i>=s?i-s:0}while(--e);e=s,n=e;do{i=t.prev[--n],t.prev[n]=i>=s?i-s:0}while(--e)};let qw=(t,e,i)=>(e<{const e=t.state;let i=e.pending;i>t.avail_out&&(i=t.avail_out),0!==i&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+i),t.next_out),t.next_out+=i,e.pending_out+=i,t.total_out+=i,t.avail_out-=i,e.pending-=i,0===e.pending&&(e.pending_out=0))},zw=(t,e)=>{hw(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Lw(t.strm)},Iw=(t,e)=>{t.pending_buf[t.pending++]=e},Bw=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},jw=(t,e,i,n)=>{let s=t.avail_in;return s>n&&(s=n),0===s?0:(t.avail_in-=s,e.set(t.input.subarray(t.next_in,t.next_in+s),i),1===t.state.wrap?t.adler=dw(t.adler,e,s,i):2===t.state.wrap&&(t.adler=fw(t.adler,e,s,i)),t.next_in+=s,t.total_in+=s,s)},Nw=(t,e)=>{let i,n,s=t.max_chain_length,r=t.strstart,o=t.prev_length,a=t.nice_match;const l=t.strstart>t.w_size-Rw?t.strstart-(t.w_size-Rw):0,h=t.window,c=t.w_mask,u=t.prev,d=t.strstart+Tw;let f=h[r+o-1],p=h[r+o];t.prev_length>=t.good_match&&(s>>=2),a>t.lookahead&&(a=t.lookahead);do{if(i=e,h[i+o]===p&&h[i+o-1]===f&&h[i]===h[r]&&h[++i]===h[r+1]){r+=2,i++;do{}while(h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&ro){if(t.match_start=e,o=n,n>=a)break;f=h[r+o-1],p=h[r+o]}}}while((e=u[e&c])>l&&0!=--s);return o<=t.lookahead?o:t.lookahead},Gw=t=>{const e=t.w_size;let i,n,s;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Rw)&&(t.window.set(t.window.subarray(e,e+e-n),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Yw(t),n+=e),0===t.strm.avail_in)break;if(i=jw(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=i,t.lookahead+t.insert>=3)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=qw(t,t.ins_h,t.window[s+1]);t.insert&&(t.ins_h=qw(t,t.ins_h,t.window[s+3-1]),t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead{let i,n,s,r=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,o=0,a=t.strm.avail_in;do{if(i=65535,s=t.bi_valid+42>>3,t.strm.avail_outn+t.strm.avail_in&&(i=n+t.strm.avail_in),i>s&&(i=s),i>8,t.pending_buf[t.pending-2]=~i,t.pending_buf[t.pending-1]=~i>>8,Lw(t.strm),n&&(n>i&&(n=i),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+n),t.strm.next_out),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n,t.block_start+=n,i-=n),i&&(jw(t.strm,t.strm.output,t.strm.next_out,i),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i)}while(0===o);return a-=t.strm.avail_in,a&&(a>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=a&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-a,t.strm.next_in),t.strstart),t.strstart+=a,t.insert+=a>t.w_size-t.insert?t.w_size-t.insert:a),t.block_start=t.strstart),t.high_waters&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,s+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),s>t.strm.avail_in&&(s=t.strm.avail_in),s&&(jw(t.strm,t.window,t.strstart,s),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.high_water>3,s=t.pending_buf_size-s>65535?65535:t.pending_buf_size-s,r=s>t.w_size?t.w_size:s,n=t.strstart-t.block_start,(n>=r||(n||e===bw)&&e!==Ow&&0===t.strm.avail_in&&n<=s)&&(i=n>s?s:n,o=e===bw&&0===t.strm.avail_in&&i===n?1:0,lw(t,t.block_start,i,o),t.block_start+=i,Lw(t.strm)),o?3:1)},Hw=(t,e)=>{let i,n;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==i&&t.strstart-i<=t.w_size-Rw&&(t.match_length=Nw(t,i)),t.match_length>=3)if(n=cw(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=qw(t,t.ins_h,t.window[t.strstart+1]);else n=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2},Jw=(t,e)=>{let i,n,s;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==i&&t.prev_length4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){s=t.strstart+t.lookahead-3,n=cw(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=s&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(zw(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(n=cw(t,0,t.window[t.strstart-1]),n&&zw(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=cw(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2};function Kw(t,e,i,n,s){this.good_length=t,this.max_lazy=e,this.nice_length=i,this.max_chain=n,this.func=s}const tv=[new Kw(0,0,0,0,Fw),new Kw(4,4,8,4,Hw),new Kw(4,5,16,8,Hw),new Kw(4,6,32,32,Hw),new Kw(4,4,16,16,Jw),new Kw(8,16,32,32,Jw),new Kw(8,16,128,128,Jw),new Kw(8,32,128,256,Jw),new Kw(32,128,258,1024,Jw),new Kw(32,258,258,4096,Jw)];function ev(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Aw,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Uw(this.dyn_ltree),Uw(this.dyn_dtree),Uw(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Uw(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Uw(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const iv=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==Ew&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==Vw&&e.status!==Mw?1:0},nv=t=>{if(iv(t))return Dw(t,Sw);t.total_in=t.total_out=0,t.data_type=Zw;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?Ew:Vw,t.adler=2===e.wrap?0:1,e.last_flush=-2,aw(e),vw},sv=t=>{const e=nv(t);var i;return e===vw&&((i=t.state).window_size=2*i.w_size,Uw(i.head),i.max_lazy_match=tv[i.level].max_lazy,i.good_match=tv[i.level].good_length,i.nice_match=tv[i.level].nice_length,i.max_chain_length=tv[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=2,i.match_available=0,i.ins_h=0),e},rv=(t,e,i,n,s,r)=>{if(!t)return Sw;let o=1;if(e===Qw&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),s<1||s>9||i!==Aw||n<8||n>15||e<0||e>9||r<0||r>_w||8===n&&1!==o)return Dw(t,Sw);8===n&&(n=9);const a=new ev;return t.state=a,a.strm=t,a.status=Ew,a.wrap=o,a.gzhead=null,a.w_bits=n,a.w_size=1<rv(t,e,Aw,15,8,Xw),bb.deflateInit2=rv,bb.deflateReset=sv,bb.deflateResetKeep=nv,bb.deflateSetHeader=(t,e)=>iv(t)||2!==t.state.wrap?Sw:(t.state.gzhead=e,vw),bb.deflate=(t,e)=>{if(iv(t)||e>ww||e<0)return t?Dw(t,Sw):Sw;const i=t.state;if(!t.output||0!==t.avail_in&&!t.input||i.status===Mw&&e!==bw)return Dw(t,0===t.avail_out?kw:Sw);const n=i.last_flush;if(i.last_flush=e,0!==i.pending){if(Lw(t),0===t.avail_out)return i.last_flush=-1,vw}else if(0===t.avail_in&&Ww(e)<=Ww(n)&&e!==bw)return Dw(t,kw);if(i.status===Mw&&0!==t.avail_in)return Dw(t,kw);if(i.status===Ew&&0===i.wrap&&(i.status=Vw),i.status===Ew){let e=Aw+(i.w_bits-8<<4)<<8,n=-1;if(n=i.strategy>=Pw||i.level<2?0:i.level<6?1:6===i.level?2:3,e|=n<<6,0!==i.strstart&&(e|=32),e+=31-e%31,Bw(i,e),0!==i.strstart&&(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),t.adler=1,i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(57===i.status)if(t.adler=0,Iw(i,31),Iw(i,139),Iw(i,8),i.gzhead)Iw(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),Iw(i,255&i.gzhead.time),Iw(i,i.gzhead.time>>8&255),Iw(i,i.gzhead.time>>16&255),Iw(i,i.gzhead.time>>24&255),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(Iw(i,255&i.gzhead.extra.length),Iw(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=fw(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if(Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,3),i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw;if(69===i.status){if(i.gzhead.extra){let e=i.pending,n=(65535&i.gzhead.extra.length)-i.gzindex;for(;i.pending+n>i.pending_buf_size;){let s=i.pending_buf_size-i.pending;if(i.pending_buf.set(i.gzhead.extra.subarray(i.gzindex,i.gzindex+s),i.pending),i.pending=i.pending_buf_size,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex+=s,Lw(t),0!==i.pending)return i.last_flush=-1,vw;e=0,n-=s}let s=new Uint8Array(i.gzhead.extra);i.pending_buf.set(s.subarray(i.gzindex,i.gzindex+n),i.pending),i.pending+=n,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex=0}i.status=73}if(73===i.status){if(i.gzhead.name){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),i.gzindex=0}i.status=91}if(91===i.status){if(i.gzhead.comment){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n))}i.status=103}if(103===i.status){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size&&(Lw(t),0!==i.pending))return i.last_flush=-1,vw;Iw(i,255&t.adler),Iw(i,t.adler>>8&255),t.adler=0}if(i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(0!==t.avail_in||0!==i.lookahead||e!==Ow&&i.status!==Mw){let n=0===i.level?Fw(i,e):i.strategy===Pw?((t,e)=>{let i;for(;;){if(0===t.lookahead&&(Gw(t),0===t.lookahead)){if(e===Ow)return 1;break}if(t.match_length=0,i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):i.strategy===Cw?((t,e)=>{let i,n,s,r;const o=t.window;for(;;){if(t.lookahead<=Tw){if(Gw(t),t.lookahead<=Tw&&e===Ow)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(s=t.strstart-1,n=o[s],n===o[++s]&&n===o[++s]&&n===o[++s])){r=t.strstart+Tw;do{}while(n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&st.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(i=cw(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):tv[i.level].func(i,e);if(3!==n&&4!==n||(i.status=Mw),1===n||3===n)return 0===t.avail_out&&(i.last_flush=-1),vw;if(2===n&&(e===gw?uw(i):e!==ww&&(lw(i,0,0,!1),e===mw&&(Uw(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),Lw(t),0===t.avail_out))return i.last_flush=-1,vw}return e!==bw?vw:i.wrap<=0?yw:(2===i.wrap?(Iw(i,255&t.adler),Iw(i,t.adler>>8&255),Iw(i,t.adler>>16&255),Iw(i,t.adler>>24&255),Iw(i,255&t.total_in),Iw(i,t.total_in>>8&255),Iw(i,t.total_in>>16&255),Iw(i,t.total_in>>24&255)):(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),Lw(t),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?vw:yw)},bb.deflateEnd=t=>{if(iv(t))return Sw;const e=t.state.status;return t.state=null,e===Vw?Dw(t,xw):vw},bb.deflateSetDictionary=(t,e)=>{let i=e.length;if(iv(t))return Sw;const n=t.state,s=n.wrap;if(2===s||1===s&&n.status!==Ew||n.lookahead)return Sw;if(1===s&&(t.adler=dw(t.adler,e,i,0)),n.wrap=0,i>=n.w_size){0===s&&(Uw(n.head),n.strstart=0,n.block_start=0,n.insert=0);let t=new Uint8Array(n.w_size);t.set(e.subarray(i-n.w_size,i),0),e=t,i=n.w_size}const r=t.avail_in,o=t.next_in,a=t.input;for(t.avail_in=i,t.next_in=0,t.input=e,Gw(n);n.lookahead>=3;){let t=n.strstart,e=n.lookahead-2;do{n.ins_h=qw(n,n.ins_h,n.window[t+3-1]),n.prev[t&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=t,t++}while(--e);n.strstart=t,n.lookahead=2,Gw(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,t.next_in=o,t.input=a,t.avail_in=r,n.wrap=s,vw},bb.deflateInfo="pako deflate (from Nodeca project)";var ov={};const av=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);ov.assign=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const e in i)av(i,e)&&(t[e]=i[e])}}return t},ov.flattenChunks=t=>{let e=0;for(let i=0,n=t.length;i=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;cv[254]=cv[254]=1,lv.string2buf=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,i,n,s,r,o=t.length,a=0;for(s=0;s>>6,e[r++]=128|63&i):i<65536?(e[r++]=224|i>>>12,e[r++]=128|i>>>6&63,e[r++]=128|63&i):(e[r++]=240|i>>>18,e[r++]=128|i>>>12&63,e[r++]=128|i>>>6&63,e[r++]=128|63&i);return e};lv.buf2string=(t,e)=>{const i=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let n,s;const r=new Array(2*i);for(s=0,n=0;n4)r[s++]=65533,n+=o-1;else{for(e&=2===o?31:3===o?15:7;o>1&&n1?r[s++]=65533:e<65536?r[s++]=e:(e-=65536,r[s++]=55296|e>>10&1023,r[s++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&hv)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let i="";for(let n=0;n{(e=e||t.length)>t.length&&(e=t.length);let i=e-1;for(;i>=0&&128==(192&t[i]);)i--;return i<0||0===i?e:i+cv[t[i]]>e?i:e};var uv=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const dv=bb,fv=ov,pv=lv,Ov=rw,gv=uv,mv=Object.prototype.toString,{Z_NO_FLUSH:bv,Z_SYNC_FLUSH:wv,Z_FULL_FLUSH:vv,Z_FINISH:yv,Z_OK:Sv,Z_STREAM_END:xv,Z_DEFAULT_COMPRESSION:kv,Z_DEFAULT_STRATEGY:Qv,Z_DEFLATED:$v}=ow;function Pv(t){this.options=fv.assign({level:kv,method:$v,chunkSize:16384,windowBits:15,memLevel:8,strategy:Qv},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new gv,this.strm.avail_out=0;let i=dv.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(i!==Sv)throw new Error(Ov[i]);if(e.header&&dv.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?pv.string2buf(e.dictionary):"[object ArrayBuffer]"===mv.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,i=dv.deflateSetDictionary(this.strm,t),i!==Sv)throw new Error(Ov[i]);this._dict_set=!0}}function Cv(t,e){const i=new Pv(e);if(i.push(t,!0),i.err)throw i.msg||Ov[i.err];return i.result}Pv.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize;let s,r;if(this.ended)return!1;for(r=e===~~e?e:!0===e?yv:bv,"string"==typeof t?i.input=pv.string2buf(t):"[object ArrayBuffer]"===mv.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),(r===wv||r===vv)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(s=dv.deflate(i,r),s===xv)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),s=dv.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===Sv;if(0!==i.avail_out){if(r>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},Pv.prototype.onData=function(t){this.chunks.push(t)},Pv.prototype.onEnd=function(t){t===Sv&&(this.result=fv.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},mb.Deflate=Pv,mb.deflate=Cv,mb.deflateRaw=function(t,e){return(e=e||{}).raw=!0,Cv(t,e)},mb.gzip=function(t,e){return(e=e||{}).gzip=!0,Cv(t,e)},mb.constants=ow;var _v={},Xv={};const Zv=16209;const Av=15,Tv=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Rv=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Ev=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Vv=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Mv=(t,e,i,n,s,r,o,a)=>{const l=a.bits;let h,c,u,d,f,p,O=0,g=0,m=0,b=0,w=0,v=0,y=0,S=0,x=0,k=0,Q=null;const $=new Uint16Array(16),P=new Uint16Array(16);let C,_,X,Z=null;for(O=0;O<=Av;O++)$[O]=0;for(g=0;g=1&&0===$[b];b--);if(w>b&&(w=b),0===b)return s[r++]=20971520,s[r++]=20971520,a.bits=1,0;for(m=1;m0&&(0===t||1!==b))return-1;for(P[1]=0,O=1;O852||2===t&&x>592)return 1;for(;;){C=O-y,o[g]+1=p?(_=Z[o[g]-p],X=Q[o[g]-p]):(_=96,X=0),h=1<>y)+c]=C<<24|_<<16|X|0}while(0!==c);for(h=1<>=1;if(0!==h?(k&=h-1,k+=h):k=0,g++,0==--$[O]){if(O===b)break;O=e[i+o[g]]}if(O>w&&(k&d)!==u){for(0===y&&(y=w),f+=m,v=O-y,S=1<852||2===t&&x>592)return 1;u=k&d,s[u]=w<<24|v<<16|f-r|0}}return 0!==k&&(s[f+k]=O-y<<24|64<<16|0),a.bits=w,0};const Dv=iw,Wv=sw,Uv=function(t,e){let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,y,S,x,k,Q;const $=t.state;i=t.next_in,k=t.input,n=i+(t.avail_in-5),s=t.next_out,Q=t.output,r=s-(e-t.avail_out),o=s+(t.avail_out-257),a=$.dmax,l=$.wsize,h=$.whave,c=$.wnext,u=$.window,d=$.hold,f=$.bits,p=$.lencode,O=$.distcode,g=(1<<$.lenbits)-1,m=(1<<$.distbits)-1;t:do{f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,0===w)Q[s++]=65535&b;else{if(!(16&w)){if(0==(64&w)){b=p[(65535&b)+(d&(1<>>=w,f-=w),f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,!(16&w)){if(0==(64&w)){b=O[(65535&b)+(d&(1<a){t.msg="invalid distance too far back",$.mode=Zv;break t}if(d>>>=w,f-=w,w=s-r,y>w){if(w=y-w,w>h&&$.sane){t.msg="invalid distance too far back",$.mode=Zv;break t}if(S=0,x=u,0===c){if(S+=l-w,w2;)Q[s++]=x[S++],Q[s++]=x[S++],Q[s++]=x[S++],v-=3;v&&(Q[s++]=x[S++],v>1&&(Q[s++]=x[S++]))}else{S=s-y;do{Q[s++]=Q[S++],Q[s++]=Q[S++],Q[s++]=Q[S++],v-=3}while(v>2);v&&(Q[s++]=Q[S++],v>1&&(Q[s++]=Q[S++]))}break}}break}}while(i>3,i-=v,f-=v<<3,d&=(1<(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function hy(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const cy=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode16211?1:0},uy=t=>{if(cy(t))return Nv;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Kv,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,Iv},dy=t=>{if(cy(t))return Nv;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,uy(t)},fy=(t,e)=>{let i;if(cy(t))return Nv;const n=t.state;return e<0?(i=0,e=-e):(i=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?Nv:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=i,n.wbits=e,dy(t))},py=(t,e)=>{if(!t)return Nv;const i=new hy;t.state=i,i.strm=t,i.window=null,i.mode=Kv;const n=fy(t,e);return n!==Iv&&(t.state=null),n};let Oy,gy,my=!0;const by=t=>{if(my){Oy=new Int32Array(512),gy=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Yv(1,t.lens,0,288,Oy,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Yv(2,t.lens,0,32,gy,0,t.work,{bits:5}),my=!1}t.lencode=Oy,t.lenbits=9,t.distcode=gy,t.distbits=5},wy=(t,e,i,n)=>{let s;const r=t.state;return null===r.window&&(r.wsize=1<=r.wsize?(r.window.set(e.subarray(i-r.wsize,i),0),r.wnext=0,r.whave=r.wsize):(s=r.wsize-r.wnext,s>n&&(s=n),r.window.set(e.subarray(i-n,i-n+s),r.wnext),(n-=s)?(r.window.set(e.subarray(i-n,i),0),r.wnext=n,r.whave=r.wsize):(r.wnext+=s,r.wnext===r.wsize&&(r.wnext=0),r.whavepy(t,15),Xv.inflateInit2=py,Xv.inflate=(t,e)=>{let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,y,S,x,k=0;const Q=new Uint8Array(4);let $,P;const C=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(cy(t)||!t.output||!t.input&&0!==t.avail_in)return Nv;i=t.state,i.mode===ey&&(i.mode=iy),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,u=a,d=l,x=Iv;t:for(;;)switch(i.mode){case Kv:if(0===i.wrap){i.mode=iy;break}for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0),h=0,c=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",i.mode=ay;break}if((15&h)!==Jv){t.msg="unknown compression method",i.mode=ay;break}if(h>>>=4,c-=4,S=8+(15&h),0===i.wbits&&(i.wbits=S),S>15||S>i.wbits){t.msg="invalid window size",i.mode=ay;break}i.dmax=1<>8&1),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16182;case 16182:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>8&255,Q[2]=h>>>16&255,Q[3]=h>>>24&255,i.check=Wv(i.check,Q,4,0)),h=0,c=0,i.mode=16183;case 16183:for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>8),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16184;case 16184:if(1024&i.flags){for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(f=i.length,f>a&&(f=a),f&&(i.head&&(S=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(n.subarray(r,r+f),S)),512&i.flags&&4&i.wrap&&(i.check=Wv(i.check,n,f,r)),a-=f,r+=f,i.length-=f),i.length))break t;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===a)break t;f=0;do{S=n[r+f++],i.head&&S&&i.length<65536&&(i.head.name+=String.fromCharCode(S))}while(S&&f>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=ey;break;case 16189:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>=7&c,c-=7&c,i.mode=oy;break}for(;c<3;){if(0===a)break t;a--,h+=n[r++]<>>=1,c-=1,3&h){case 0:i.mode=16193;break;case 1:if(by(i),i.mode=sy,e===zv){h>>>=2,c-=2;break t}break;case 2:i.mode=16196;break;case 3:t.msg="invalid block type",i.mode=ay}h>>>=2,c-=2;break;case 16193:for(h>>>=7&c,c-=7&c;c<32;){if(0===a)break t;a--,h+=n[r++]<>>16^65535)){t.msg="invalid stored block lengths",i.mode=ay;break}if(i.length=65535&h,h=0,c=0,i.mode=ny,e===zv)break t;case ny:i.mode=16195;case 16195:if(f=i.length,f){if(f>a&&(f=a),f>l&&(f=l),0===f)break t;s.set(n.subarray(r,r+f),o),a-=f,r+=f,l-=f,o+=f,i.length-=f;break}i.mode=ey;break;case 16196:for(;c<14;){if(0===a)break t;a--,h+=n[r++]<>>=5,c-=5,i.ndist=1+(31&h),h>>>=5,c-=5,i.ncode=4+(15&h),h>>>=4,c-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=ay;break}i.have=0,i.mode=16197;case 16197:for(;i.have>>=3,c-=3}for(;i.have<19;)i.lens[C[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,$={bits:i.lenbits},x=Yv(0,i.lens,0,19,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid code lengths set",i.mode=ay;break}i.have=0,i.mode=16198;case 16198:for(;i.have>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=g,c-=g,i.lens[i.have++]=b;else{if(16===b){for(P=g+2;c>>=g,c-=g,0===i.have){t.msg="invalid bit length repeat",i.mode=ay;break}S=i.lens[i.have-1],f=3+(3&h),h>>>=2,c-=2}else if(17===b){for(P=g+3;c>>=g,c-=g,S=0,f=3+(7&h),h>>>=3,c-=3}else{for(P=g+7;c>>=g,c-=g,S=0,f=11+(127&h),h>>>=7,c-=7}if(i.have+f>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=ay;break}for(;f--;)i.lens[i.have++]=S}}if(i.mode===ay)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=ay;break}if(i.lenbits=9,$={bits:i.lenbits},x=Yv(1,i.lens,0,i.nlen,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid literal/lengths set",i.mode=ay;break}if(i.distbits=6,i.distcode=i.distdyn,$={bits:i.distbits},x=Yv(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,$),i.distbits=$.bits,x){t.msg="invalid distances set",i.mode=ay;break}if(i.mode=sy,e===zv)break t;case sy:i.mode=ry;case ry:if(a>=6&&l>=258){t.next_out=o,t.avail_out=l,t.next_in=r,t.avail_in=a,i.hold=h,i.bits=c,Uv(t,d),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,i.mode===ey&&(i.back=-1);break}for(i.back=0;k=i.lencode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,i.length=b,0===m){i.mode=16205;break}if(32&m){i.back=-1,i.mode=ey;break}if(64&m){t.msg="invalid literal/length code",i.mode=ay;break}i.extra=15&m,i.mode=16201;case 16201:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;k=i.distcode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,64&m){t.msg="invalid distance code",i.mode=ay;break}i.offset=b,i.extra=15&m,i.mode=16203;case 16203:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=ay;break}i.mode=16204;case 16204:if(0===l)break t;if(f=d-l,i.offset>f){if(f=i.offset-f,f>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=ay;break}f>i.wnext?(f-=i.wnext,p=i.wsize-f):p=i.wnext-f,f>i.length&&(f=i.length),O=i.window}else O=s,p=o-i.offset,f=i.length;f>l&&(f=l),l-=f,i.length-=f;do{s[o++]=O[p++]}while(--f);0===i.length&&(i.mode=ry);break;case 16205:if(0===l)break t;s[o++]=i.length,l--,i.mode=ry;break;case oy:if(i.wrap){for(;c<32;){if(0===a)break t;a--,h|=n[r++]<{if(cy(t))return Nv;let e=t.state;return e.window&&(e.window=null),t.state=null,Iv},Xv.inflateGetHeader=(t,e)=>{if(cy(t))return Nv;const i=t.state;return 0==(2&i.wrap)?Nv:(i.head=e,e.done=!1,Iv)},Xv.inflateSetDictionary=(t,e)=>{const i=e.length;let n,s,r;return cy(t)?Nv:(n=t.state,0!==n.wrap&&n.mode!==ty?Nv:n.mode===ty&&(s=1,s=Dv(s,e,i,0),s!==n.check)?Gv:(r=wy(t,e,i,i),r?(n.mode=16210,Fv):(n.havedict=1,Iv)))},Xv.inflateInfo="pako inflate (from Nodeca project)";const vy=Xv,yy=ov,Sy=lv,xy=rw,ky=uv,Qy=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},$y=Object.prototype.toString,{Z_NO_FLUSH:Py,Z_FINISH:Cy,Z_OK:_y,Z_STREAM_END:Xy,Z_NEED_DICT:Zy,Z_STREAM_ERROR:Ay,Z_DATA_ERROR:Ty,Z_MEM_ERROR:Ry}=ow;function Ey(t){this.options=yy.assign({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ky,this.strm.avail_out=0;let i=vy.inflateInit2(this.strm,e.windowBits);if(i!==_y)throw new Error(xy[i]);if(this.header=new Qy,vy.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=Sy.string2buf(e.dictionary):"[object ArrayBuffer]"===$y.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(i=vy.inflateSetDictionary(this.strm,e.dictionary),i!==_y)))throw new Error(xy[i])}function Vy(t,e){const i=new Ey(e);if(i.push(t),i.err)throw i.msg||xy[i.err];return i.result}Ey.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize,s=this.options.dictionary;let r,o,a;if(this.ended)return!1;for(o=e===~~e?e:!0===e?Cy:Py,"[object ArrayBuffer]"===$y.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),r=vy.inflate(i,o),r===Zy&&s&&(r=vy.inflateSetDictionary(i,s),r===_y?r=vy.inflate(i,o):r===Ty&&(r=Zy));i.avail_in>0&&r===Xy&&i.state.wrap>0&&0!==t[i.next_in];)vy.inflateReset(i),r=vy.inflate(i,o);switch(r){case Ay:case Ty:case Zy:case Ry:return this.onEnd(r),this.ended=!0,!1}if(a=i.avail_out,i.next_out&&(0===i.avail_out||r===Xy))if("string"===this.options.to){let t=Sy.utf8border(i.output,i.next_out),e=i.next_out-t,s=Sy.buf2string(i.output,t);i.next_out=e,i.avail_out=n-e,e&&i.output.set(i.output.subarray(t,t+e),0),this.onData(s)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(r!==_y||0!==a){if(r===Xy)return r=vy.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},Ey.prototype.onData=function(t){this.chunks.push(t)},Ey.prototype.onEnd=function(t){t===_y&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=yy.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},_v.Inflate=Ey,_v.inflate=Vy,_v.inflateRaw=function(t,e){return(e=e||{}).raw=!0,Vy(t,e)},_v.ungzip=Vy,_v.constants=ow;const{Deflate:My,deflate:Dy,deflateRaw:Wy,gzip:Uy}=mb,{Inflate:Yy,inflate:qy,inflateRaw:Ly,ungzip:zy}=_v,Iy=ow;gb.Deflate=My,gb.deflate=Dy,gb.deflateRaw=Wy,gb.gzip=Uy,gb.Inflate=Yy,gb.inflate=qy,gb.inflateRaw=Ly,gb.ungzip=zy,gb.constants=Iy;const By=gb;let jy={};var Ny;function Gy(t){return Ny=t,[tS]}jy.Util={},jy.Decode={},jy.Messages=[],jy.Log=function(t){jy.Messages.push(["I",t]),console.log("Mma.js INFO: ",t)},jy.Warn=function(t){jy.Messages.push(["W",t]),console.log("Mma.js WARNING: ",t)},jy.Fail=function(t){throw jy.Messages.push(["E",t]),"Mma.js ERROR: "+t},jy.Util.Base64Decode=function(t){for(var e=atob(t),i=e.length>>>0,n=new Uint8Array(i),s=0;s1&&0===t[0]&&jy.Fail("IntegerAP: input starts with 0: "+String(t)),this.nstring=t}else void 0===t?this.nstring=void 0:jy.Fail("Integer: invalid input: "+String(t))},jy.RealMP=function(t){"number"==typeof t?this.n=t:void 0===t?this.n=void 0:jy.Fail("RealMP: invalid input")},jy.RealAP=function(t){"string"==typeof t?(t.length>1&&0===t[0]&&jy.Fail("RealAP: input starts with 0: "+String(t)),this.nstring=t):void 0===t?this.nstring=void 0:jy.Fail("RealAP: invalid input: "+String(t))},jy.Symbol=function(t){"string"==typeof t?this.name=t:void 0===t?this.name=void 0:jy.Fail("Symbol: invalid input: "+String(t))},jy.String=function(t){"string"==typeof t?this.str=t:void 0===t?this.str=void 0:jy.Fail("String: invalid input: "+String(t))},jy.Expression=function(t,e){t instanceof jy.Symbol||jy.Fail("Expression: head must be an Mma.Symbol"),e instanceof Array||jy.Fail("Expression: parts must be an Array"),this.head=t,this.parts=e},jy.Decode.Int32=function(t,e){try{return new DataView(t.buffer).getInt32(e,!0)}catch(t){return 0}},jy.Decode.Float64=function(t,e){try{return new DataView(t.buffer).getFloat64(e,!0)}catch(t){return 0}},jy.Decode.String=function(t,e,i){return void 0===e&&(e=0),void 0===i&&(i=t.length),jy.Util.U8ArrayToString(t.slice(e,e+i))},jy.Decode.StringEntry=function(t,e){void 0===e&&(e=0);var i=jy.Decode.Int32(t,e);return{length:i,string:jy.Decode.String(t,e+4,i),bytesRead:i+4}},jy.Decode.Any=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=1/0);var n=e;for(var s=0,r=[];ee%2!=0?t:{...t,body:Lm(t.body,/\(\*\|\*\)/gm)})),Array.isArray(this.args[this.args.length-1].body)||(this.decorator=this.args.pop());const r=this.args;console.log("creating InstanceWidget");for(let t=0;t{e.viewState.state.config.eval()},update:e=>this.applyChanges(e,t,i),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to&&!t.stringOnly)return i-2>=0?(o[i-2].editor.dispatch({selection:{anchor:o[i-2].editor.state.doc.length}}),o[i-2].editor.focus(),void(t.editorLastCursor=void 0)):(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0));t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to&&!t.stringOnly)return i+2=0)return r[t-2].body[i].editor.focus(),void(e.editorLastCursor=void 0)}},{key:"ArrowDown",run:function(e,n){if(t+2{},focus:()=>{},dispatch:()=>{},stringOnly:!0};const t=l.match(Fy);if(t){a.innerHTML=t[1];const e=jy.DecompressDecode(t[2]),i=jy.toArray(e.parts[0]),n=uuidv4();interpretate(i,{global:{call:n},element:a})}else a.innerHTML=l.slice(1,-1)}delete o[i].body,n.appendChild(a)}i.appendChild(n)}if(this.decorator){const t=jy.DecompressDecode(this.decorator.body.slice(2,-2)),e=jy.toArray(t.parts[0]);let n={global:{call:uuidv4(),EditorWidget:s},element:i};this.interpretated=interpretate(e,n)}}applyChanges(t,e,i){const n=this.args,s=this.args[e].body,r=this.visibleValue.argsPos,o=this.args[e].from;let a=t;0==i&&0==e&&(a="{{"+a),0==i&&0!=e&&(a="{"+a),i==s.length-1&&e==n.length-1&&(a+="}}"),i==s.length-1&&e!=n.length-1&&(a+="}");const l=s[i].length,h={from:r+o+s[i].from,to:r+o+s[i].from+l,insert:a},c=a.length-l;for(let t=i+1;t{s.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.args[0].body[0].editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.args[0].body[0].editor.focus();else{const t=this.DOMElement.EditorWidget.args,e=t[t.length-1].body[t[t.length-1].body.length-1].editor;e.dispatch({selection:{anchor:e.state.doc.length}}),e.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const Ky=(t,e)=>new Bm({tag:"GB",decoration:i=>ni.replace({widget:new Jy(i,t,e)})}),tS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=Ky(this.disposable,t).createDeco(t)}update(t){this.placeholder=Ky(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});function eS(t){return[rS]}let iS=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.span=i,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this,r=this.args[1].body.slice(3,-3),o=jy.DecompressDecode(r),a=jy.toArray(o.parts[0]);this.data=a;const l="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}));this.cuid=l;let h={call:l,EditorWidget:s},c={global:h,element:i};this.expression=a,this.env=c,this.interpretated=interpretate(a,c),this.interpretated.then((()=>{if(c.options?.Event){console.warn("Event listeners are enabled!"),s.events=c.options.Event;let t=c;if(h.stack){const e=Object.values(h.stack);e.length>0&&(console.log("Attaching first found instance..."),t=e[0].env)}interpretate(["MetaMarker","'"+l+"'"],t).then((()=>{server.kernel.emitt(s.events,'"'+l+'"',"Mounted")}))}}))}getDoc(){return this.args[0].body.slice(1,-1)}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+t+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].length=s.length,this.view.dispatch({changes:r})}applyOuterChanges(t){const e=this.visibleValue,i=t,n={from:e.pos,to:e.pos+e.length,insert:i};this.view.dispatch({changes:n})}update(t){if(!this.deactivated){if(t.str!=this.visibleValue.str){console.warn("Out of sync"),console.log("recreate..."),this.destroy();const e=this.span;return e.replaceChildren(),void this._construct(t,this.view,e)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}}destroy(t){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.events&&server.kernel.emitt(this.events,'"'+this.cuid+'"',"Destroy"),delete this.data}},nS=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=this;let i=document.createElement("span");return i.classList.add("frontend-view"),i.EditorWidget=new iS(this.visibleValue,t,i),this.reference.push({destroy:()=>{e.destroy(i)}}),i}ignoreEvent(){return!0}destroy(t){console.log("destroy in general*"),t.EditorWidget.destroy()}};const sS=(t,e)=>new Bm({tag:"VB",decoration:i=>ni.replace({widget:new nS(i,t,e)})}),rS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=sS(this.disposable,t).createDeco(t)}update(t){this.placeholder=sS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var oS;function aS(t){return oS=t,[uS]}let lS=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.span=i,this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this;this.epilog={offset:0,string:""},this.prolog={offset:0,string:""};const r=this.args[1].body.slice(3,-3),o=jy.DecompressDecode(r),a=jy.toArray(o.parts[0]);this.data=a;let l={global:{call:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)})),element:i,origin:s},element:i};this.env=l,interpretate(a,l).then((()=>{if(l.options?.Head&&(s.prolog.offset=l.options.Head.length+1,s.prolog.string=l.options.Head+"[",s.epilog.offset=1,s.epilog.string="]"),l.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=l.options.Event),l.options?.String){s.prolog.offset=1,s.prolog.string='"',s.epilog.offset=1,s.epilog.string='"',l.options?.HeadString&&(s.prolog.string=l.options.HeadString,s.prolog.offset=s.prolog.string.length),l.options?.TailString&&(s.epilog.string=l.options.TailString,s.epilog.offset=s.epilog.string.length),s.editor={destroy:()=>{console.log("Nothing to destroy, this is just a text field.")}};const t=document.createElement("span");return this.aa,t.onkeydown=function(t){13===t.keyCode&&t.preventDefault()},t.contentEditable="plaintext-only",t.innerText=s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),t.addEventListener("input",console.log),t.addEventListener("input",(()=>{console.log("Update"),console.log(t.innerText),this.applyChanges(t.innerText)})),l.global.element.appendChild(t),void(s.events&&server.kernel.emitt(s.events,"Null","Mounted"))}s.editor=oS({doc:s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),parent:l.global.element,update:t=>this.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos+s.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]}),s.events&&server.kernel.emitt(s.events,"Null","Mounted")}))}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+this.prolog.string+t+this.epilog.string+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length));const o=s.length-i[0].length;i[0].length=s.length,this.visibleValue.length=this.visibleValue.length+o,this.view.dispatch({changes:r})}update(t){if(this.visibleValue.str!=t.str)return console.warn("Out of sync"),console.log("recreating InstanceWidget"),this.destroy(),this.span.replaceChildren(),void this._construct(t,this.view,this.span);this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.editor.destroy(),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}},hS=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("subscript-tail"),e.EditorWidget=new lS(this.visibleValue,t,e,[]);const i=this;return this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const cS=(t,e)=>new Bm({tag:"BB",decoration:i=>ni.replace({widget:new hS(i,t,e)})}),uS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=cS(this.disposable,t).createDeco(t)}update(t){this.placeholder=cS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var dS;function fS(t){return dS=t,[mS]}class pS{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm);const s=this,r=Array.from({length:Math.ceil((s.args.length-3)/2)},((t,e)=>2*e+1));s.indexes=r;const o=[];this.span=i,this.spans=o;for(let t=0;t{c.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=c.options.Event),s.editors=r.map(((t,i)=>dS({doc:s.args[t].body,parent:o[i],update:e=>this.applyChanges(e,t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i>0?s.editors[i-1].focus():(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus()),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return it.destroy())),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}}class OS extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("inline-flex"),e.EditorWidget=new pS(this.visibleValue,t,e,[]);const i=this;return this.DOMElement=e,this.reference.push({destroy:()=>{i.destroy(e)}}),e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;const n=this.DOMElement.EditorWidget.editors;return t.from-e.from<0?(n[n.length-1].dispatch({selection:{anchor:n[n.length-1].state.doc.length}}),n[n.length-1].focus()):(n[0].dispatch({selection:{anchor:0}}),n[0].focus()),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}}const gS=(t,e)=>new Bm({tag:"TB",decoration:i=>ni.replace({widget:new OS(i,t,e)})}),mS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=gS(this.disposable,t).createDeco(t)}update(t){this.placeholder=gS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});const bS=_i.fromClass(class{decorations=ni.none;constructor(t){this.view=t,this.recompute()}recompute(t){let e,i,n=[];for(let{from:t,to:e}of this.view.visibleRanges)this.getDecorationsFor(t,e,n);this.decorations=ni.set(n,!0),this.decorations=this.decorations.update({filter:(n,s)=>!(n>e&&s=e&&s.selection.main.head<=i)return!0;if(!n&&s.selection.main.head>e&&s.selection.main.headt.decorations});class wS extends ei{constructor(t,e){super(),this.rawValue=t,this.visibleValue=e}eq(t){return this.rawValue===t.rawValue}toDOM(){let t=document.createElement("div");t.classList.add("cell-type-widget");const e=this.rawValue.split(" "),i=e[0].split(".");if(console.log(i),t.classList.add("cell-type-"+i[1].trim()),t.innerText=e[0].trim(),e.length>1){const n=e.slice(1),s=document.createElement("span");return s.appendChild(t),n.forEach((t=>{const e=document.createElement("span");e.innerText=t,e.classList.add("cell-type-"+i[1].trim()+"-"+t.split("=")[0]),s.appendChild(e)})),s}return t}ignoreEvent(){return!1}}const vS=new F,yS=new F,SS=[],xS=Sl.define([{tag:Sa.meta,color:"var(--editor-key-meta)"},{tag:Sa.link,textDecoration:"underline"},{tag:Sa.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Sa.emphasis,fontStyle:"italic"},{tag:Sa.strong,fontWeight:"bold"},{tag:Sa.strikethrough,textDecoration:"line-through"},{tag:Sa.keyword,color:"var(--editor-key-keyword)"},{tag:[Sa.atom,Sa.bool,Sa.url,Sa.contentSeparator,Sa.labelName],color:"var(--editor-key-atom)"},{tag:[Sa.literal,Sa.inserted],color:"var(--editor-key-literal)"},{tag:[Sa.string,Sa.deleted],color:"var(--editor-key-string)"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],color:"var(--editor-key-escape)"},{tag:Sa.definition(Sa.variableName),color:"var(--editor-key-variable)"},{tag:Sa.local(Sa.variableName),color:"var(--editor-local-variable)"},{tag:[Sa.typeName,Sa.namespace],color:"var(--editor-key-type)"},{tag:Sa.className,color:"var(--editor-key-class)"},{tag:[Sa.special(Sa.variableName),Sa.macroName],color:"var(--editor-special-variable)"},{tag:Sa.definition(Sa.propertyName),color:"var(--editor-key-property)"},{tag:Sa.comment,color:"var(--editor-key-comment)"},{tag:Sa.invalid,color:"var(--editor-key-invalid)"}]),kS={data:[],extend:t=>{kS.data.push(...t),Qm.reBuild(kS.data)},replaceAll:t=>{kS.data=t,Qm.reBuild(kS.data)}},QS=Gl.define({name:"spreadsheet",startState:function(){return{stringType:null,stack:[]}},token:function(t,e){if(t){switch(0===e.stack.length&&('"'!=t.peek()&&"'"!=t.peek()||(e.stringType=t.peek(),t.next(),e.stack.unshift("string"))),e.stack[0]){case"string":for(;"string"===e.stack[0]&&!t.eol();)t.peek()===e.stringType?(t.next(),e.stack.shift()):"\\"===t.peek()?(t.next(),t.next()):t.match(/^.[^\\\"\']*/);return"string";case"characterClass":for(;"characterClass"===e.stack[0]&&!t.eol();)t.match(/^[^\]\\]+/)||t.match(/^\\./)||e.stack.shift();return"operator"}var i=t.peek();switch(i){case"[":return t.next(),e.stack.unshift("characterClass"),"bracket";case":":return t.next(),"operator";case"\\":return t.match(/\\[a-z]+/)?"string.special":(t.next(),"atom");case".":case",":case";":case"*":case"-":case"+":case"^":case"<":case"/":case"=":return t.next(),"atom";case"$":return t.next(),"builtin"}return t.match(/\d+/)?t.match(/^\w+/)?"error":"number":t.match(/^[a-zA-Z_]\w*/)?t.match(/(?=[\(.])/,!1)?"keyword":"variable":-1!=["[","]","(",")","{","}"].indexOf(i)?(t.next(),"bracket"):(t.eatSpace()||t.next(),null)}}}),$S=new RegExp(/^[\w]*\.[\w]+/);function PS(t){const e=$S.exec(t),i=Object.values(window.SupportedLanguages);for(let t=0;t{if(!t.docChanged)return null;let e=PS(t.newDoc.line(1).text);if(e.legacy){const i=t.startState.facet(Wa);if(i){if(i.name==e.name)return null}else if(t.startState.facet(CS)==e.name)return null;return console.log("switching... to "+e.name),{effects:vS.reconfigure(e.plugins)}}return e.name===t.startState.facet(Wa).name?null:(console.log("switching... to "+e.name),{effects:vS.reconfigure(e.plugins)})}));let XS,ZS=null;const AS=t=>{const e=t||XS;return e&&e.viewState?(console.log(),PS(e.state.doc.line(1).text).name):""},TS=t=>{const e=t||XS;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return!1;const n=i[0];return[n.from,n.to]},RS=t=>{const e=t||XS;return e&&e.viewState?e.state.doc.toString():""},ES=t=>{const e=t||XS;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return"";const n=i[0];return console.log("yoko"),console.log(n),console.log(e.state.doc.toString().slice(n.from,n.to)),console.log("processing"),e.state.doc.toString().slice(n.from,n.to)},VS=(t,e)=>{const i=e||XS;if(!i)return;if(!i.viewState)return;const n=i.viewState.state.selection.ranges;if(!n.length)return;const s=n[0];console.log("result"),console.log(t),i.dispatch({changes:{...s,insert:t}})},MS=()=>XS,DS=(t,e)=>{const i=e||XS;i&&i.viewState&&(console.log("result"),console.log(t),i.dispatch({changes:{from:0,to:i.viewState.state.doc.length,insert:t}}))};ZS=t=>{let e=new Ts({doc:t.doc,extensions:[Ys.of([{key:"Tab",run:function(t,e){return sd(t)}},{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,LS,Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(XS=e.view)}))],parent:t.parent});return e.viewState.state.config.eval=t.eval,e},ZS.state=t=>{let e=xt.create({doc:t.doc,extensions:[Ys.of([{key:"Tab",run:function(t,e){return sd(t)}},{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,LS,Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(XS=e.view)}))]});return e.config.eval=t.eval,e};const WS={transaction:(t,e,i,n)=>{if(console.log(e.dom.ocellref),e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:DropEvent"]')}},file:(t,e,i,n,s)=>{console.log(e.dom.ocellref),e.dom.ocellref&&server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},US={transaction:(t,e,i,n)=>{if(console.log(e.dom.ocellref),e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:PasteEvent"]')}},file:(t,e,i,n,s)=>{console.log(e.dom.ocellref),e.dom.ocellref&&server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},YS=[Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Cm(WS,US)];let qS=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"}}),LS=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"},".cm-scroller":{"line-height":"inherit","overflow-x":"overlay","overflow-y":"overlay","align-items":"initial"},".cm-content":{padding:"0px 0"},".rainbow-bracket-red":{color:"var(--editor-bracket-1)"},".rainbow-bracket-orange":{color:"var(--editor-bracket-2)"},".rainbow-bracket-yellow":{color:"var(--editor-bracket-3)"},".rainbow-bracket-green":{color:"var(--editor-bracket-4)"},".rainbow-bracket-blue":{color:"var(--editor-bracket-5)"},".rainbow-bracket-indigo":{color:"var(--editor-bracket-6)"},".rainbow-bracket-violet":{color:"var(--editor-bracket-7)"},".rainbow-bracket-red > span":{color:"var(--editor-bracket-1-a)"},".rainbow-bracket-orange > span":{color:"var(--editor-bracket-2-a)"},".rainbow-bracket-yellow > span":{color:"var(--editor-bracket-3-a)"},".rainbow-bracket-green > span":{color:"var(--editor-bracket-4-a)"},".rainbow-bracket-blue > span":{color:"var(--editor-bracket-5-a)"},".rainbow-bracket-indigo > span":{color:"var(--editor-bracket-6-a)"},".rainbow-bracket-violet > span":{color:"var(--editor-bracket-7-a)"}}),zS=!1;const IS=[()=>vr(),()=>Sh(),()=>ir(),()=>dr(),()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xS,{fallback:!1}),()=>tu()],BS={},jS=[()=>vr(),()=>Sh(),()=>ir(),()=>dr(),t=>NS.of(t),()=>BS.gutter?function(t={}){return[eo.of(t),jr(),so]}():[],()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xS,{fallback:!1}),()=>tu(),()=>bS,()=>function(t){return _i.fromClass(class{constructor(e){this.view=e,this.placeholder=ni.set([ni.widget({widget:new kr(t),side:1}).range(0)])}get decorations(){return this.view.state.doc.length?ni.none:this.placeholder}},{decorations:t=>t.decorations})}("Type WL Expression / .md / .js"),()=>xt.allowMultipleSelections.of(!0),(t,e)=>vS.of(e),()=>yS.of(xt.readOnly.of(!1)),()=>_S,()=>{return t?[ou.of(t),Yu]:Yu;var t},(t,e)=>Ys.of([{key:"Tab",run:function(t,e){const i=sd(t);return i||Rc(t)},shift:Ec},{key:"Backspace",run:function(e,i){if(0===e.state.doc.length)return t.origin.remove(),!0}},{key:"ArrowLeft",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus prev"),t.origin.focusPrev(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus next"),t.origin.focusNext(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"Shift-Enter",preventDefault:!0,run:function(e,i){console.log(e.state.doc.toString()),t.origin.eval(e.state.doc.toString())}},...Vc,...Wh,...Ru]),(t,e)=>Ts.updateListener.of((e=>{e.docChanged&&t.origin.save(encodeURIComponent(e.state.doc.toString())),e.selectionSet&&(XS=e.view)})),()=>qS];const NS=E.define();function GS(t){return t.replace(/\\\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\\\:/g,""),16))})).replaceAll("\\:F74E","I").replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))}function FS(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(t=>(+t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+t/4).toString(16)))}core.ReadOnly=()=>"ReadOnly",core.EditorView=async(t,e)=>{let i=await interpretate(t[0],e);i=GS(i),console.log("UNICODE Disaster");const n=await core._getRules(t,e);let s=()=>{},r=()=>{},o=i;const a=[];n.ReadOnly&&a.push(xt.readOnly.of(!0)),n.ForceUpdate&&(e.local.forceUpdate=n.ForceUpdate),n.Event&&(r=t=>{o=t,console.log("editor view emitt data: "+t),server.kernel.emitt(n.Event,'"'+t.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Input")},s=()=>{server.kernel.emitt(n.Event,'"'+o.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Evaluate")}),e.local?e.local.editor=ZS({doc:i,parent:e.element,eval:s,update:r,extensions:a}):ZS({doc:i,parent:e.element,eval:s,update:r,extensions:a}),e.element.style.verticalAlign="inherit"},core.StripOnInput=async()=>{},core.EditorView.update=async(t,e)=>{if(!e.local.editor)return;const i=GS(await interpretate(t[0],e));console.log("editor view: dispatch"),e.local.forceUpdate,e.local.editor.dispatch({changes:{from:0,to:e.local.editor.state.doc.length,insert:i}})},core.EditorView.destroy=async(t,e)=>{await interpretate(t[0],e),e.local&&e.local.editor&&e.local.editor.destroy()},core.EditorView.virtual=!0,core.PreviewCell=(t,e)=>{},window.SupportedLanguages.push({check:t=>null===t,legacy:!0,plugins:YS,name:"mathematica"}),window.SupportedLanguages.push({check:t=>null!=t[0].match(/\w+\.(wl|wls)$/),plugins:YS,legacy:!0,name:"mathematica"}),window.SupportedCells.codemirror={view:class{origin={};editor={};trash=[];forceFocusNext(){zS=!0}focus(t){t>0?this.editor.dispatch({selection:{anchor:0}}):t<0&&this.editor.dispatch({selection:{anchor:this.editor.state.doc.length}}),this.editor.focus()}setContent(t){if(console.warn("content mutation!"),!this.editor.viewState)return;const e=this.editor;console.log("result"),console.log(t),this.editor.dispatch({changes:{from:0,to:e.viewState.state.doc.length,insert:t}})}addDisposable(t){this.trash.push(t)}dispose(){this.editor.destroy()}readOnly(t){this.editor.dispatch({effects:yS.reconfigure(xt.readOnly.of(t))})}constructor(t,e){this.origin=t;const i=this.origin,n=PS(e).plugins,s=this;this.origin.element.ocellref=s;const r=new Ts({doc:(o=e,o.replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))),extensions:jS.map((t=>t(s,n))),parent:this.origin.element});var o;return this.editor=r,this.editor.dom.ocellref=s,this.editor.viewState.state.config.eval=()=>{i.eval(this.editor.state.doc.toString())},zS&&r.focus(),zS=!1,this}},context:{EditorAutocomplete:kS,javascriptLanguage:qf,javascript:Nf,markdownLanguage:rm,markdown:function(t={}){let{codeLanguages:e,defaultCodeLanguage:i,addKeymap:n=!0,base:{parser:s}=sm}=t;if(!(s instanceof Zp))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let r,o=t.extensions?[t.extensions]:[],a=[dm.support];i instanceof Ua?(a.push(i.support),r=i.language):i&&(r=i);let l=e||r?(h=e,c=r,t=>{if(t&&h){let e=null;if(t=/\S*/.exec(t)[0],e="function"==typeof h?h(t):Ya.matchLanguageName(h,t,!0),e instanceof Ya)return e.support?e.support.language.parser:Ta.getSkippingParser(e.load());if(e)return e.parser}return c?c.parser:null}):void 0;var h,c;return o.push(function(t){let{codeParser:e,htmlParser:i}=t,n=Do(((t,n)=>{let s=t.type.id;if(!e||s!=Kf.CodeBlock&&s!=Kf.FencedCode){if(i&&(s==Kf.HTMLBlock||s==Kf.HTMLTag))return{parser:i,overlay:rO(t.node,t.from,t.to)}}else{let i="";if(s==Kf.FencedCode){let e=t.node.getChild(Kf.CodeInfo);e&&(i=n.read(e.from,e.to))}let r=e(i);if(r)return{parser:r,overlay:t=>t.type.id==Kf.CodeText}}return null}));return{wrap:n}}({codeParser:l,htmlParser:dm.language.parser})),n&&a.push(N.high(Ys.of(um))),new Ua(nm(s.configure(o)),a)},htmlLanguage:jg,html:Ng,cssLanguage:kg,css:Qg,EditorView:Ts,EditorState:xt,highlightSpecialChars:vr,syntaxHighlighting:$l,defaultHighlightStyle:xS,editorCustomTheme:qS,foldGutter:function(t={}){let e=Object.assign(Object.assign({},wl),t),i=new vl(e,!0),n=new vl(e,!1),s=_i.fromClass(class{constructor(t){this.from=t.viewport.from,this.markers=this.buildMarkers(t)}update(t){(t.docChanged||t.viewportChanged||t.startState.facet(Wa)!=t.state.facet(Wa)||t.startState.field(dl,!1)!=t.state.field(dl,!1)||Xa(t.startState)!=Xa(t.state)||e.foldingChanged(t))&&(this.markers=this.buildMarkers(t.view))}buildMarkers(t){let e=new Xt;for(let s of t.viewportLineBlocks){let r=fl(t.state,s.from,s.to)?n:ll(t.state,s.from,s.to)?i:null;r&&e.add(s.from,s.from,r)}return e.finish()}}),{domEventHandlers:r}=e;return[s,Ir({class:"cm-foldGutter",markers(t){var e;return(null===(e=t.plugin(s))||void 0===e?void 0:e.markers)||_t.empty},initialSpacer:()=>new vl(e,!1),domEventHandlers:Object.assign(Object.assign({},r),{click:(t,e,i)=>{if(r.click&&r.click(t,e,i))return!0;let n=fl(t.state,e.from,e.to);if(n)return t.dispatch({effects:ul.of(n)}),!0;let s=ll(t.state,e.from,e.to);return!!s&&(t.dispatch({effects:cl.of(s)}),!0)}})}),ml()]},Facet:E,Compartment:F,mathematicaPlugins:YS,legacyLangNameFacet:CS,DropPasteHandlers:Cm,EditorExtensionsMinimal:IS,EditorParameters:BS,EditorExtensions:jS,StateField:q,Decoration:ni,ViewPlugin:_i,WidgetType:ei,originFacet:NS,MatchDecorator:pr}},window.OfflineMode&&SS.push(xt.readOnly.of(!0)),core.CellView=async(t,e)=>{const i=await core._getRules(t,e);i.Display||(i.Display="codemirror");const n=await interpretate(t[0],e),s={element:e.element,uid:FS()};i.Style&&(e.element.style=i.Style),i.Class&&e.element.classList.add(...i.Class.split(" ")),i.ImageSize&&(Array.isArray(i.ImageSize)?(e.element.style.width=i.ImageSize[0]+"px",e.element.style.height=i.ImageSize[1]+"px"):e.element.style.width=i.ImageSize+"px"),new window.SupportedCells[i.Display].view(s,n)};const HS={};core.FrontEditorSelected=async(t,e)=>{console.log("check");const i=await interpretate(t[0],e),n=await core._getRules(t,e);let s;switch(n.Editor&&(s=HS[n.Editor],console.log("Editor"),console.log(n.Editor),console.log(s)),i){case"Get":return ES(s);case"Set":let i=await interpretate(t[1],e);VS(i,s);break;case"GetDoc":return RS(s);case"SetDoc":let n=await interpretate(t[1],e);DS(n,s);break;case"Cursor":return TS(s);case"Type":return AS(s);case"Editor":const r=FS();return HS[r]=MS(),r}}; diff --git a/libs/priceless-mathematica/src/boxes/gridbox.js b/libs/priceless-mathematica/src/boxes/gridbox.js index b6651b6..aa6da40 100644 --- a/libs/priceless-mathematica/src/boxes/gridbox.js +++ b/libs/priceless-mathematica/src/boxes/gridbox.js @@ -28,7 +28,7 @@ import { ]; } - const itemBox = /"(.+)"\(\*VB\[\*\)\(\*\*\)\(\*\,\*\)\(\*\"([\w:\d=]*)/; + const itemBox = /"(.+)"\(\*VB\[\*\)\(\*\*\)\(\*\,\*\)\(\*\"([\w:\d=+-]*)/; class EditorWidget { @@ -84,7 +84,7 @@ import { extensions: [ keymap.of([ { key: "ArrowLeft", run: function (editor, key) { - if (editor?.editorLastCursor === editor.state.selection.ranges[0].to) + if (editor?.editorLastCursor === editor.state.selection.ranges[0].to && !editor.stringOnly) if (j - 2 >= 0) { cols[j-2].editor.dispatch({selection:{anchor:cols[j-2].editor.state.doc.length}}); cols[j-2].editor.focus(); @@ -101,7 +101,7 @@ import { editor.editorLastCursor = editor.state.selection.ranges[0].to; } }, { key: "ArrowRight", run: function (editor, key) { - if (editor?.editorLastCursor === editor.state.selection.ranges[0].to) + if (editor?.editorLastCursor === editor.state.selection.ranges[0].to && !editor.stringOnly) if (j + 2 < cols.length) { cols[j+2].editor.dispatch({selection:{anchor:0}}); cols[j+2].editor.focus(); @@ -149,14 +149,17 @@ import { cols[j].editor = { destroy: () => {}, focus: () => {}, - dispatch: () => {} + dispatch: () => {}, + stringOnly: true }; const itemDesc = text.match(itemBox); - if (itemDesc) { + if (itemDesc) { //stylize the text td.innerHTML = itemDesc[1]; + //throw(itemDesc); + const decoded = Mma.DecompressDecode(itemDesc[2]); const json = Mma.toArray(decoded.parts[0]); const cuid = uuidv4(); From 7228e42c5ba8bc2e7ef2def3f5d0cf3665b47274 Mon Sep 17 00:00:00 2001 From: Kirill Vasin Date: Fri, 15 Nov 2024 19:51:50 +0100 Subject: [PATCH 13/26] fixed one more bug --- dist/kernel.js | 4 ++-- dist/kernel.min.js | 2 +- libs/priceless-mathematica/src/boxes/gridbox.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/kernel.js b/dist/kernel.js index 918ea9f..6e31a8f 100644 --- a/dist/kernel.js +++ b/dist/kernel.js @@ -38531,7 +38531,7 @@ var compactCMEditor$2; ]; } - const itemBox = /"(.+)"\(\*VB\[\*\)\(\*\*\)\(\*\,\*\)\(\*\"([\w:\d=+-]*)/; + const itemBox = /"(.+)"\(\*VB\[\*\)\(\*\*\)\(\*\,\*\)\(\*\"([\w:\d=+-/]*)/; let EditorWidget$3 = class EditorWidget { @@ -38654,7 +38654,7 @@ var compactCMEditor$2; const itemDesc = text.match(itemBox); - if (itemDesc) { + if (itemDesc) { //stylize the text td.innerHTML = itemDesc[1]; //throw(itemDesc); diff --git a/dist/kernel.min.js b/dist/kernel.min.js index e14b576..017eed0 100644 --- a/dist/kernel.min.js +++ b/dist/kernel.min.js @@ -1 +1 @@ -class t{constructor(){}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 a(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}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 l(n,o,i,r);n=o+1,i++}}decompose(t,i,r,o){let a=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(a.text,t.text.slice(),0,a.length);if(i.length<=32)r.push(new e(i,t.length+a.length));else{let t=i.length>>1;r.push(new e(i.slice(0,t)),new e(i.slice(t)))}}else r.push(a)}replace(t,r,o){if(!(o instanceof e))return super.replace(t,r,o);let a=n(this.text,n(o.text,s(this.text,0,t)),r),l=this.length+o.length-(r-t);return a.length<=32?new e(a,l):i.from(e.split(a,[]),l)}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=a+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,a=i+r.lines-1;if((e?a:o)>=t)return r.lineInner(t,e,i,n);n=o+1,i=a+1}}decompose(t,e,i,n){for(let s=0,r=0;r<=e&&s=r){let s=n&((r<=t?1:0)|(a>=e?2:0));r>=t&&a<=e&&!s?i.push(o):o.decompose(t-r,e-r,i,s)}r=a+1}}replace(t,e,n){if(n.lines=r&&e<=a){let l=o.replace(t-r,e-r,n),h=this.lines-o.lines+l.lines;if(l.lines>4&&l.lines>h>>6){let r=this.children.slice();return r[s]=l,new i(r,this.length-(e-t)+n.length)}return super.replace(r,a,l)}r=a+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=a+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,a]=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==a)return n;let i=this.children[s],l=t.children[r];if(i!=l)return n+i.scanIdentical(l,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,a=r>>1,l=[],h=0,c=-1,u=[];function d(t){let n;if(t.lines>o&&t instanceof i)for(let e of t.children)d(e);else t.lines>a&&(h>a||!h)?(f(),l.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&&f(),h+=t.lines,c+=t.length+1,u.push(t))}function f(){0!=h&&(l.push(1==u.length?u[0]:i.from(u,c)),c=-1,h=u.length=0)}for(let e of t)d(e);return f(),1==l.length?l[0]:new i(l,n)}}function n(t,e,i=0,n=1e9){for(let s=0,r=0,o=!0;r=i&&(l>n&&(a=a.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,a=s instanceof e?s.text.length:s.children.length;if(o==(i>0?a: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 a{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]=a.prototype[Symbol.iterator]=function(){return this});let l=class{constructor(t,e,i,n){this.from=t,this.to=e,this.number=i,this.text=n}get length(){return this.to-this.from}},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 d=8205;function f(t,e,i=!0,n=!0){return(i?p:O)(t,e,n)}function p(t,e,i){if(e==t.length)return e;e&&g(t.charCodeAt(e))&&m(t.charCodeAt(e-1))&&e--;let n=b(t,e);for(e+=v(n);e=0&&u(b(t,n));)i++,n-=2;if(i%2==0)break;e+=2}}}return e}function O(t,e,i){for(;e>0;){let n=p(t,e-2,i);if(n=56320&&t<57344}function m(t){return t>=55296&&t<56320}function b(t,e){let i=t.charCodeAt(e);if(!m(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return g(n)?n-56320+(i-55296<<10)+65536:i}function w(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function v(t){return t<65536?1:2}const y=/\r\n?|\n/;var S=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(S||(S={}));class x{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;et)return s+(t-n);s+=o}else{if(i!=S.Simple&&l>=t&&(i==S.TrackDel&&nt||i==S.TrackBefore&&nt))return null;if(l>t||l==t&&e<0&&!o)return t==n||e<0?s:s+a;s+=a}n=l}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 x(t)}static create(t){return new x(t)}}class k extends x{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 P(this,((e,i,n,s,r)=>t=t.replace(n,n+(i-e),r)),!1),t}mapDesc(t,e=!1){return C(this,t,e,!0)}invert(e){let i=this.sections.slice(),n=[];for(let s=0,r=0;s=0){i[s]=a,i[s+1]=o;let l=s>>1;for(;n.length0&&$(i,e,s.text),s.forward(t),o+=t}let l=t[r++];for(;o>1].toJSON()))}return t}static of(e,i,n){let s=[],r=[],o=0,a=null;function l(t=!1){if(!t&&!s.length)return;oa||e<0||a>i)throw new RangeError(`Invalid change range ${e} to ${a} (in doc of length ${i})`);let u=c?"string"==typeof c?t.of(c.split(n||y)):c:t.empty,d=u.length;if(e==a&&0==d)return;eo&&Q(s,e-o,-1),Q(s,a-e,d),$(r,s,u),o=a}}(e),l(!a),a}static empty(t){return new k(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 $(e,i,n){if(0==n.length)return;let s=i.length-2>>1;if(s>1])),!(n||a==e.sections.length||e.sections[a+1]<0);)l=e.sections[a++],h=e.sections[a++];i(r,c,o,u,d),r=c,o=u}}}function C(t,e,i,n=!1){let s=[],r=n?[]:null,o=new X(t),a=new X(e);for(let t=-1;;)if(-1==o.ins&&-1==a.ins){let t=Math.min(o.len,a.len);Q(s,t,-1),o.forward(t),a.forward(t)}else if(a.ins>=0&&(o.ins<0||t==o.i||0==o.off&&(a.len=0&&t=0)){if(o.done&&a.done)return r?k.createSet(s,r):x.create(s);throw new Error("Mismatched change set lengths")}{let e=0,i=o.len;for(;i;)if(-1==a.ins){let t=Math.min(i,a.len);e+=t,i-=t,a.forward(t)}else{if(!(0==a.ins&&a.lene||o.ins>=0&&o.len>e)&&(t||n.length>i),r.forward2(e),o.forward(e)}}else Q(n,0,o.ins,t),s&&$(s,n,o.text),o.next()}}class X{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 Z{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 Z(i,n,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return A.range(t,e);let i=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return A.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 A.range(t.anchor,t.head)}static create(t,e,i){return new Z(t,e,i)}}class A{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:A.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 A(t.ranges.map((t=>Z.fromJSON(t))),t.main)}static single(t,e=t){return new A([A.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?A.range(o,r):A.range(r,o))}}return new A(t,e)}}function T(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let R=0;class E{constructor(t,e,i,n,s){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=n,this.id=R++,this.default=t([]),this.extensions="function"==typeof s?s(this):s}static define(t={}){return new E(t.combine||(t=>t),t.compareInput||((t,e)=>t===e),t.compare||(t.combine?(t,e)=>t===e:V),!!t.static,t.enables)}of(t){return new M([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,2,e)}from(t,e){return e||(e=t=>t),this.compute([t],(i=>e(i.field(t))))}}function V(t,e){return t==e||t.length==e.length&&t.every(((t,i)=>t===e[i]))}class M{constructor(t,e,i,n){this.dependencies=t,this.facet=e,this.type=i,this.value=n,this.id=R++}dynamicSlot(t){var e;let i=this.value,n=this.facet.compareInput,s=this.id,r=t[s]>>1,o=2==this.type,a=!1,l=!1,h=[];for(let i of this.dependencies)"doc"==i?a=!0:"selection"==i?l=!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(a&&e.docChanged||l&&(e.docChanged||e.selection)||W(t,h)){let e=i(t);if(o?!D(e,t.values[r],n):!n(e,t.values[r]))return t.values[r]=e,1}return 0},reconfigure:(t,e)=>{let a,l=e.config.address[s];if(null!=l){let s=tt(e,l);if(this.dependencies.every((i=>i instanceof E?e.facet(i)===t.facet(i):!(i instanceof q)||e.field(i,!1)==t.field(i,!1)))||(o?D(a=i(t),s,n):n(a=i(t),s)))return t.values[r]=s,0}else a=i(t);return t.values[r]=a,1}}}}function D(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 a(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(Y).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,Y.of({field:this,create:t})]}get extension(){return this}}const L=4,z=3,I=2,B=1;function j(t){return e=>new G(e,t)}const N={highest:j(0),high:j(B),default:j(I),low:j(z),lowest:j(L)};class G{constructor(t,e){this.inner=t,this.prec=e}}class F{of(t){return new H(this,t)}reconfigure(t){return F.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class H{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;function r(t,o){let a=s.get(t);if(null!=a){if(a<=o)return;let e=n[a].indexOf(t);e>-1&&n[a].splice(e,1),t instanceof H&&i.delete(t.compartment)}if(s.set(t,o),Array.isArray(t))for(let e of t)r(e,o);else if(t instanceof H){if(i.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");let n=e.get(t.compartment)||t.inner;i.set(t.compartment,n),r(n,o)}else if(t instanceof G)r(t.inner,t.prec);else if(t instanceof q)n[o].push(t),t.provides&&r(t.provides,o);else if(t instanceof M)n[o].push(t),t.facet.extensions&&r(t.facet.extensions,I);else{let e=t.extension;if(!e)throw new Error(`Unrecognized extension value in extension set (${t}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(e,o)}}return r(t,I),n.reduce(((t,e)=>t.concat(e)))}(t,e,r))i instanceof q?n.push(i):(s[i.facet.id]||(s[i.facet.id]=[])).push(i);let o=Object.create(null),a=[],l=[];for(let t of n)o[t.id]=l.length<<1,l.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]=a.length<<1|1,V(r,e))a.push(i.facet(n));else{let t=n.combine(e.map((t=>t.value)));a.push(i&&n.compare(t,i.facet(n))?i.facet(n):t)}else{for(let t of e)0==t.type?(o[t.id]=a.length<<1|1,a.push(t.value)):(o[t.id]=l.length<<1,l.push((e=>t.dynamicSlot(e))));o[n.id]=l.length<<1,l.push((t=>U(t,n,e)))}}let c=l.map((t=>t(o)));return new J(t,r,c,o,a,s)}}function K(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 tt(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}const et=E.define(),it=E.define({combine:t=>t.some((t=>t)),static:!0}),nt=E.define({combine:t=>t.length?t[0]:void 0,static:!0}),st=E.define(),rt=E.define(),ot=E.define(),at=E.define({combine:t=>!!t.length&&t[0]});class lt{constructor(t,e){this.type=t,this.value=e}static define(){return new ht}}class ht{of(t){return new lt(this,t)}}class ct{constructor(t){this.map=t}of(t){return new ut(this,t)}}class ut{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 ut(this.type,e)}is(t){return this.type==t}static define(t={}){return new ct(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}}ut.reconfigure=ut.define(),ut.appendConfig=ut.define();class dt{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&&T(i,e.newLength),s.some((t=>t.type==dt.time))||(this.annotations=s.concat(dt.time.of(Date.now())))}static create(t,e,i,n,s,r){return new dt(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(dt.userEvent);return!(!e||!(e==t||e.length>t.length&&e.slice(0,t.length)==t&&"."==e[t.length]))}}function ft(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=pt(n,Ot(e,r,t.changes.newLength),!0))}return n==t?t:dt.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(st)){let e=n(t);if(!1===e){i=!1;break}Array.isArray(e)&&(i=!0===i?e:ft(i,e))}if(!0!==i){let n,s;if(!1===i)s=t.changes.invertedDesc,n=k.empty(e.doc.length);else{let e=t.changes.filter(i);n=e.changes,s=e.filtered.mapDesc(e.changes).invertedDesc}t=dt.create(e,n,t.selection&&t.selection.map(s),ut.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let n=e.facet(rt);for(let i=n.length-1;i>=0;i--){let s=n[i](t);t=s instanceof dt?s:Array.isArray(s)&&1==s.length&&s[0]instanceof dt?s[0]:gt(e,bt(s),!1)}return t}(s):s)}dt.time=lt.define(),dt.userEvent=lt.define(),dt.addToHistory=lt.define(),dt.remote=lt.define();const mt=[];function bt(t){return null==t?mt:Array.isArray(t)?t:[t]}var wt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(wt||(wt={}));const vt=/[\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){}function St(t){return e=>{if(!/\S/.test(e))return wt.Space;if(function(t){if(yt)return yt.test(t);for(let e=0;e"€"&&(i.toUpperCase()!=i.toLowerCase()||vt.test(i)))return!0}return!1}(e))return wt.Word;for(let i=0;i-1)return wt.Word;return wt.Other}}class xt{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(ut.reconfigure)?(i=null,n=e.value):e.is(ut.appendConfig)&&(i=null,n=bt(n).concat(e.value));if(i)e=t.startState.values.slice();else{i=J.resolve(n,s,this),e=new xt(i,this.doc,this.selection,i.dynamicSlots.map((()=>null)),((t,e)=>e.reconfigure(t,this)),null).values}new xt(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:A.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=bt(i.effects);for(let i=1;is.spec.fromJSON(r,t))))}return xt.create({doc:t.doc,selection:A.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(xt.lineSeparator)||y)),s=e.selection?e.selection instanceof A?e.selection:A.single(e.selection.anchor,e.selection.head):A.single(0);return T(s,n.length),i.staticFacet(it)||(s=s.asSingle()),new xt(i,n,s,i.dynamicSlots.map((()=>null)),((t,e)=>e.create(t)),null)}get tabSize(){return this.facet(xt.tabSize)}get lineBreak(){return this.facet(xt.lineSeparator)||"\n"}get readOnly(){return this.facet(at)}phrase(t,...e){for(let e of this.facet(xt.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(et))for(let r of s(this,e,i))Object.prototype.hasOwnProperty.call(r,t)&&n.push(r[t]);return n}charCategorizer(t){return St(this.languageDataAt("wordChars",t).join(""))}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=f(e,r,!1);if(s(e.slice(t,r))!=wt.Word)break;r=t}for(;ot.length?t[0]:4}),xt.lineSeparator=nt,xt.readOnly=at,xt.phrases=E.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]))}}),xt.languageData=et,xt.changeFilter=st,xt.transactionFilter=rt,xt.transactionExtender=ot,F.reconfigure=ut.define();class Qt{eq(t){return this==t}range(t,e=t){return $t.create(t,e,this)}}Qt.prototype.startSide=Qt.prototype.endSide=0,Qt.prototype.point=!1,Qt.prototype.mapMode=S.TrackDel;let $t=class t{constructor(t,e,i){this.from=t,this.to=e,this.value=i}static create(e,i,n){return new t(e,i,n)}};function Pt(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Ct{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,a=s[n]-t||(i?this.value[n].endSide:this.value[n].startSide)-e;if(n==r)return a>=0?r:o;a>=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||l==h&&c.startSide>0&&c.endSide<=0)continue;(h-l||c.endSide-c.startSide)<0||(r<0&&(r=l),c.point&&(o=Math.max(o,h-l)),i.push(c),n.push(l-r),s.push(h-r))}return{mapped:i.length?new Ct(n,s,i,o):null,pos:r}}}class _t{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 _t(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(Pt)),this.isEmpty)return e.length?_t.of(e):this;let o=new At(this,null,-1).goto(0),a=0,l=[],h=new Xt;for(;o.value||a=0){let t=e[a++];h.addInner(t.from,t.to,t.value)||l.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 Tt.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return Tt.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)),a=Zt(r,o,i),l=new Et(r,a,s),h=new Et(o,a,s);i.iterGaps(((t,e,i)=>Vt(l,t,h,e,i,n))),i.empty&&0==i.length&&Vt(l,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=Zt(s,r),a=new Et(s,o,0).goto(i),l=new Et(r,o,0).goto(i);for(;;){if(a.to!=l.to||!Mt(a.active,l.active)||a.point&&(!l.point||!a.point.eq(l.point)))return!1;if(a.to>n)return!0;a.next(),l.next()}}static spans(t,e,i,n,s=-1){let r=new Et(t,null,s).goto(e),o=e,a=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,a),a=r.openEnd(t));if(r.to>i)return a+(r.point&&r.to>i?1:0);o=r.to,r.next()}}static of(t,e=!1){let i=new Xt;for(let n of t instanceof $t?[t]:e?function(t){if(t.length>1)for(let e=t[0],i=1;i0)return t.slice().sort(Pt);e=n}return t}(t):t)i.add(n.from,n.to,n.value);return i.finish()}}_t.empty=new _t([],[],null,-1),_t.empty.nextLayer=_t.empty;class Xt{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}finishChunk(t){this.chunks.push(new Ct(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=[])}add(t,e,i){this.addInner(t,e,i)||(this.nextLayer||(this.nextLayer=new Xt)).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(_t.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;let e=_t.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function Zt(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 At(r,e,i,s));return 1==n.length?n[0]:new Tt(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--)Rt(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--)Rt(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(),Rt(this.heap,0)}}}function Rt(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 Et{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=Tt.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){Dt(this.active,t),Dt(this.activeTo,t),Dt(this.activeRank,t),this.minActive=Ut(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&&Dt(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 Vt(t,e,i,n,s,r){t.goto(e),i.goto(n);let o=n+s,a=n,l=n-e;for(;;){let e=t.to+l-i.to||t.endSide-i.endSide,n=e<0?t.to+l: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))&&Mt(t.activeForPoint(t.to+l),i.activeForPoint(i.to))||r.comparePoint(a,s,t.point,i.point):s>a&&!Mt(t.active,i.active)&&r.compareRange(a,s,t.active,i.active),n>o)break;a=n,e<=0&&t.next(),e>=0&&i.next()}}function Mt(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 Ut(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(!l)throw new RangeError("The value of a property ("+i+") should be a primitive value.");s(n(i),o,a,h)}else null!=o&&a.push(i.replace(/_.*/,"").replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))+": "+o+";")}(a.length||h)&&r.push((!i||l||o?t:t.map(i)).join(", ")+" {"+a.join(" ")+"}")}for(let e in t)s(n(e),t[e],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let t=zt[qt]||1;return zt[qt]=t+1,"ͼ"+t.toString(36)}static mount(t,e){(t[Lt]||new jt(t)).mount(Array.isArray(e)?e:[e])}}let Bt=new Map;class jt{constructor(t){let e=t.ownerDocument||t,i=e.defaultView;if(!t.head&&t.adoptedStyleSheets&&i.CSSStyleSheet){let n=Bt.get(e);if(n)return t.adoptedStyleSheets=[n.sheet,...t.adoptedStyleSheets],t[Lt]=n;this.sheet=new i.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets],Bt.set(e,this)}else{this.styleTag=e.createElement("style");let i=t.head||t;i.insertBefore(this.styleTag,i.firstChild)}this.modules=[],t[Lt]=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:'"'},Ft="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),Ht="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Jt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Kt=Ht||Ft&&+Ft[1]<57,te=0;te<10;te++)Nt[48+te]=Nt[96+te]=String(te);for(te=1;te<=24;te++)Nt[te+111]="F"+te;for(te=65;te<=90;te++)Nt[te]=String.fromCharCode(te+32),Gt[te]=String.fromCharCode(te);for(var ee in Nt)Gt.hasOwnProperty(ee)||(Gt[ee]=Nt[ee]);function ie(t){let e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection()}function ne(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function se(t,e){if(!e.anchorNode)return!1;try{return ne(t,e.anchorNode)}catch(t){return!1}}function re(t){return 3==t.nodeType?me(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function oe(t,e,i,n){return!!i&&(le(t,e,i,n,-1)||le(t,e,i,n,1))}function ae(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function le(t,e,i,n,s){for(;;){if(t==i&&e==n)return!0;if(e==(s<0?0:he(t))){if("DIV"==t.nodeName)return!1;let i=t.parentNode;if(!i||1!=i.nodeType)return!1;e=ae(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?he(t):0}}}function he(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}const ce={left:0,right:0,top:0,bottom:0};function ue(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function de(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}class fe{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){this.set(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset)}set(t,e,i,n){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=n}}let pe,Oe=null;function ge(t){if(t.setActive)return t.setActive();if(Oe)return t.focus(Oe);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==Oe?{get preventScroll(){return Oe={preventScroll:!0},!0}}:void 0),!Oe){Oe=!1;for(let t=0;te)return i.domBoundsAround(t,e,l);if(c>=t&&-1==n&&(n=a,s=l),l>e&&i.dom.parentNode==this.dom){r=a,o=h;break}h=c,l=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.dirty|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.dirty|=2),1&e.dirty)return;e.dirty|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,this.dirty&&this.markParentsDirty(!0))}setDOM(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=ye){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 Qe(t,e,i,n,s,r,o,a,l){let{children:h}=t,c=h.length?h[e]:null,u=r.length?r[r.length-1]:null,d=u?u.breakAfter:o;if(!(e==n&&c&&!o&&!d&&r.length<2&&c.merge(i,s,r.length?u:null,0==i,a,l))){if(n0&&(!o&&r.length&&c.merge(i,c.length,r[0],!1,a,0)?c.breakAfter=r.shift().breakAfter:(i2);var De={mac:Me||/Mac/.test(Pe.platform),windows:/Win/.test(Pe.platform),linux:/Linux|X11/.test(Pe.platform),ie:Ae,ie_version:Xe?Ce.documentMode||6:Ze?+Ze[1]:_e?+_e[1]:0,gecko:Te,gecko_version:Te?+(/Firefox\/(\d+)/.exec(Pe.userAgent)||[0,0])[1]:0,chrome:!!Re,chrome_version:Re?+Re[1]:0,ios:Me,android:/Android\b/.test(Pe.userAgent),webkit:Ee,safari:Ve,webkit_version:Ee?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Ce.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class We extends Se{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(!i||i instanceof We&&!(this.length-(e-t)+i.length>256))&&(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),!0)}split(t){let e=new We(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new ve(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 Ye(this.dom,t,e)}}class Ue extends Se{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(we(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}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.dirty|=6)}sync(t,e){this.dom?4&this.dirty&&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 Ue&&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 Ue(this.mark,e,r)}domAtPos(t){return Ge(this,t)}coordsAt(t,e){return He(this,t,e)}}function Ye(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?De.chrome||De.gecko||(e?(s--,o=1):r=0)?0:a.length-1];return De.safari&&!o&&0==l.width&&(l=Array.prototype.find.call(a,(t=>t.width))||l),o?ue(l,o<0):l||null}class qe extends Se{constructor(t,e,i){super(),this.widget=t,this.length=e,this.side=i,this.prevWidget=null}static create(t,e,i){return new(t.customView||qe)(t,e,i)}split(t){let e=qe.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 qe&&this.widget.compare(i.widget))||t>0&&s<=0||e0)?ve.before(this.dom):ve.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let i=this.dom.getClientRects(),n=null;if(!i.length)return ce;for(let e=t>0?i.length-1:0;n=i[e],!(t>0?0==e:e==i.length-1||n.top0?-1:1);return this.length?n:ue(n,this.side>0)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class Le extends qe{domAtPos(t){let{topView:e,text:i}=this.widget;return e?ze(t,0,e,i,this.length-e.length,((t,e)=>t.domAtPos(e)),((t,e)=>new ve(t,Math.min(e,t.nodeValue.length)))):new ve(i,Math.min(t,i.nodeValue.length))}sync(){this.setDOM(this.widget.toDOM())}localPosFromDOM(t,e){let{topView:i,text:n}=this.widget;return i?Be(t,e,i,n,this.length-i.length):Math.min(e,this.length)}ignoreMutation(){return!1}get overrideDOMText(){return null}coordsAt(t,e){let{topView:i,text:n}=this.widget;return i?ze(t,e,i,n,this.length-i.length,((t,e,i)=>t.coordsAt(e,i)),((t,e,i)=>Ye(t,e,i))):Ye(n,t,e)}destroy(){var t;super.destroy(),null===(t=this.widget.topView)||void 0===t||t.destroy()}get isEditable(){return!0}canReuseDOM(){return!0}}function ze(t,e,i,n,s,r,o){if(i instanceof Ue){for(let a=i.dom.firstChild;a;a=a.nextSibling){let i=Se.get(a);if(i){let l=ne(a,n),h=i.length+(l?s:0);if(t0?ve.before(this.dom):ve.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){let e=this.dom.getBoundingClientRect(),i=function(t,e){let i=t.parent,n=i?i.children.indexOf(t):-1;for(;i&&n>=0;)if(e<0?n>0:n0?-1:1);return i&&i.tope.top?{left:e.left,right:e.right,top:i.top,bottom:i.bottom}:e}get overrideDOMText(){return t.empty}get isHidden(){return!0}}function Ge(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 Ue&&s.length&&(n=s[s.length-1])instanceof Ue&&n.mark.eq(e.mark)?Fe(n,e.children[0],i-1):(s.push(e),e.setParent(t)),t.length+=e.length}function He(t,e,i){let n=null,s=-1,r=null,o=-1;!function t(e,a){for(let l=0,h=0;l=a&&(c.children.length?t(c,a-h):(!r||r instanceof Ne&&i>0)&&(u>a||h==u&&c.getSide()>0)?(r=c,o=a-h):(h0?3e8:-4e8:e>0?1e8:-1e8,new oi(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}=ai(t,n);e=(s?n?-3e8:-1:5e8)-1,i=1+(r?n?2e8:1:-6e8)}return new oi(t,e,i,n,t.widget||null,!0)}static line(t){return new ri(t)}static set(t,e=!1){return _t.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}ni.none=_t.empty;class si extends ni{constructor(t){let{start:e,end:i}=ai(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){return this==t||t instanceof si&&this.tagName==t.tagName&&this.class==t.class&&Ke(this.attrs,t.attrs)}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}si.prototype.point=!1;class ri extends ni{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof ri&&this.spec.class==t.spec.class&&Ke(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)}}ri.prototype.mapMode=S.TrackBefore,ri.prototype.point=!0;class oi extends ni{constructor(t,e,i,n,s,r){super(e,i,s,t),this.block=n,this.isReplace=r,this.mapMode=n?e<=0?S.TrackBefore:S.TrackAfter:S.TrackDel}get type(){return this.startSide=5}eq(t){return t instanceof oi&&(e=this.widget,i=t.widget,e==i||!!(e&&i&&e.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var e,i}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 ai(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 li(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)}oi.prototype.point=!0;class hi extends Se{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 hi))return!1;this.dom||i.transferDOM(this)}return n&&this.setDeco(i?i.attrs:null),$e(this,t,e,i?i.children:[],s,r),!0}split(t){let e=new hi;if(e.breakAfter=this.breakAfter,0==this.length)return e;let{i: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){Ke(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){Fe(this,t,e)}addLineDeco(t){let e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=Je(e,this.attrs||{})),i&&(this.attrs=Je({class:i},this.attrs||{}))}domAtPos(t){return Ge(this,t)}reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.dirty|=6)}sync(t,e){var i;this.dom?4&this.dirty&&(we(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&&(ti(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&&Se.get(n)instanceof Ue;)n=n.lastChild;if(!(n&&this.length&&("BR"==n.nodeName||0!=(null===(i=Se.get(n))||void 0===i?void 0:i.isEditable)||De.ios&&this.children.some((t=>t instanceof We))))){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 We)||/[^ -~]/.test(i.text))return null;let n=re(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=He(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 hi)return s;if(r>e)break}n=r+s.breakAfter}return null}}class ci extends Se{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 ci&&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(di(new We(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 oi){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let o=e-t;if(i instanceof oi)if(i.block){let{type:t}=i;t!=ii.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new ci(i.widget||new fi("div"),o,t))}else{let r=qe.create(i.widget||new fi("span"),o,o?0:i.startSide),a=this.atCursorPos&&!r.isEditable&&s<=n.length&&(t0),l=!r.isEditable&&(tn.length||i.startSide<=0),h=this.getLine();2!=this.pendingBuffer||a||r.isEditable||(this.pendingBuffer=0),this.flushBuffer(n),a&&(h.append(di(new Ne(1),n),s),s=n.length+Math.max(0,s-n.length)),h.append(di(r,n),s),this.atCursorPos=l,this.pendingBuffer=l?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 ui(t,e,i,s);return r.openEnd=_t.spans(n,e,i,r),r.openStart<0&&(r.openStart=r.openEnd),r.finish(r.openEnd),r}}function di(t,e){for(let i of e)t=new Ue(i,[t],t.length);return t}class fi extends ei{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 pi=E.define(),Oi=E.define(),gi=E.define(),mi=E.define(),bi=E.define(),wi=E.define(),vi=E.define(),yi=E.define({combine:t=>t.some((t=>t))}),Si=E.define({combine:t=>t.some((t=>t))});class xi{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 xi(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin)}}const ki=ut.define({map:(t,e)=>t.map(e)});function Qi(t,e,i){let n=t.facet(mi);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 $i=E.define({combine:t=>!t.length||t[0]});let Pi=0;const Ci=E.define();class _i{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 _i(Pi++,t,i,(t=>{let e=[Ci.of(t)];return s&&e.push(Ti.of((e=>{let i=e.plugin(t);return i?s(i):ni.none}))),n&&e.push(n(t)),e}))}static fromClass(t,e){return _i.define((e=>new t(e)),e)}}class Xi{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(Qi(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){Qi(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){Qi(t.state,e,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Zi=E.define(),Ai=E.define(),Ti=E.define(),Ri=E.define(),Ei=E.define(),Vi=E.define();class Mi{constructor(t,e,i,n){this.fromA=t,this.toA=e,this.fromB=i,this.toB=n}join(t){return new Mi(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(!a)return i;new Mi(a.fromA,a.toA,a.fromB,a.toB).addToSet(i),r=a.toA,o=a.toB}}}class Di{constructor(t,e,i){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=k.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 Mi(t,e,i,s)))),this.changedRanges=n}static create(t,e,i){return new Di(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 Wi=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Wi||(Wi={}));const Ui=Wi.LTR,Yi=Wi.RTL;function qi(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}}const Gi=[];function Fi(t){return[new Ni(0,t,0)]}let Hi="";function Ji(t,e,i,n,s){var r;let o=n.head-t.from,a=-1;if(0==o){if(!s||!t.length)return null;e[0].level!=i&&(o=e[0].side(!1,i),a=0)}else if(o==t.length){if(s)return null;let t=e[e.length-1];t.level!=i&&(o=t.side(!0,i),a=e.length-1)}a<0&&(a=Ni.find(e,o,null!==(r=n.bidiLevel)&&void 0!==r?r:-1,n.assoc));let l=e[a];o==l.side(s,i)&&(l=e[a+=s?1:-1],o=l.side(!s,i));let h=s==(l.dir==i),c=f(t.text,o,h);if(Hi=t.text.slice(Math.min(o,c),Math.max(o,c)),c!=l.side(s,i))return A.cursor(c+t.from,h?-1:1,l.level);let u=a==(s?e.length-1:0)?null:e[a+(s?1:-1)];return u||l.level==i?u&&u.level1)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=Se.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 en(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}class nn{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class sn extends Se{constructor(t){super(),this.view=t,this.compositionDeco=ni.none,this.decorations=[],this.dynamicDecorationMap=[],this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(t.contentDOM),this.children=[new hi],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Mi(0,0,0,t.state.doc.length)],0)}get length(){return this.view.state.doc.length}update(t){let e=t.changedRanges;this.minWidth>0&&e.length&&(e.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),this.view.inputState.composing<0?this.compositionDeco=ni.none:(t.transactions.length||this.dirty)&&(this.compositionDeco=function(t,e){let i=on(t);if(!i)return ni.none;let{from:n,to:s,node:r,text:o}=i,a=e.mapPos(n,1),l=Math.max(a,e.mapPos(s,-1)),{state:h}=t,c=3==r.nodeType?r.nodeValue:new tn([],h).readRange(r.firstChild,null).text;if(l-a{this.dom.style.height=this.view.viewState.contentHeight+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let t=De.chrome||De.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,t),this.dirty=0,t&&(t.written||i.selectionRange.focusNode!=t.node)&&(this.forceSelection=!0),this.dom.style.height=""}));let n=[];if(this.view.viewport.from||this.view.viewport.to=0?t[e]:null;if(!n)break;let{fromA:s,toA:r,fromB:o,toB:a}=n,{content:l,breakAtStart:h,openStart:c,openEnd:u}=ui.build(this.view.state.doc,o,a,this.decorations,this.dynamicDecorationMap),{i:d,off:f}=i.findPos(r,1),{i:p,off:O}=i.findPos(s,-1);Qe(this,p,O,d,f,l,h,c,u)}}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&&se(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,a=this.domAtPos(o.anchor),l=o.empty?a:this.domAtPos(o.head);if(De.gecko&&o.empty&&!this.compositionDeco.size&&(1==(h=a).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((()=>a.node.insertBefore(t,a.node.childNodes[a.offset]||null))),a=l=new ve(t,0),r=!0}var h;let c=this.view.observer.selectionRange;!r&&c.focusNode&&oe(a.node,a.offset,c.anchorNode,c.anchorOffset)&&oe(l.node,l.offset,c.focusNode,c.focusOffset)||(this.view.observer.ignore((()=>{De.android&&De.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=ie(this.view.root);if(t)if(o.empty){if(De.gecko){let t=(e=a.node,n=a.offset,1!=e.nodeType?0:(n&&"false"==e.childNodes[n-1].contentEditable?1:0)|(no.head&&([a,l]=[l,a]),e.setEnd(l.node,l.offset),e.setStart(a.node,a.offset),t.removeAllRanges(),t.addRange(e)}else;var e,n;s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())})),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new ve(c.anchorNode,c.anchorOffset),this.impreciseHead=l.precise?null:new ve(c.focusNode,c.focusOffset)}enforceCursorAssoc(){if(this.compositionDeco.size)return;let{view:t}=this,e=t.state.selection.main,i=ie(t.root),{anchorNode:n,anchorOffset:s}=t.observer.selectionRange;if(!(i&&e.empty&&e.assoc&&i.modify))return;let r=hi.find(this,e.head);if(!r)return;let o=r.posAtStart;if(e.head==o||e.head==o+r.length)return;let a=this.coordsAt(e.head,-1),l=this.coordsAt(e.head,1);if(!a||!l||a.bottom>l.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)}nearest(t){for(let e=t;e;){let t=Se.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!=ii.WidgetBefore&&s.type!=ii.WidgetAfter&&(!n||2==e||this.children[n-1].breakAfter||this.children[n-1].type==ii.WidgetBefore&&e>-2))return s.coordsAt(t-r,e);i=r}}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,a=this.view.textDirection==Wi.LTR;for(let t=0,l=0;ln)break;if(t>=i){let i=h.dom.getBoundingClientRect();if(e.push(i.height),r){let e=h.dom.lastChild,n=e?re(e):[];if(n.length){let e=n[n.length-1],r=a?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?Wi.RTL:Wi.LTR}measureTextSize(){for(let t of this.children)if(t instanceof hi){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.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(n);let s=re(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 ke(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;t.push(ni.replace({widget:new rn(n),block:!0,inclusive:!0,isBlockGap:!0}).range(i,r))}if(!s)break;i=s.to+1}return ni.set(t)}updateDeco(){let t=this.view.state.facet(Ti).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=0,r=0,o=0,a=0;for(let t of this.view.state.facet(Ei).map((t=>t(this.view))))if(t){let{left:e,right:i,top:n,bottom:l}=t;null!=e&&(s=Math.max(s,e)),null!=i&&(r=Math.max(r,i)),null!=n&&(o=Math.max(o,n)),null!=l&&(a=Math.max(a,l))}let l={left:n.left-s,top:n.top-o,right:n.right+r,bottom:n.bottom+a};!function(t,e,i,n,s,r,o,a){let l=t.ownerDocument,h=l.defaultView||window;for(let c=t;c;)if(1==c.nodeType){let t,u=c==l.body;if(u)t=de(h);else{if(c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let e=c.getBoundingClientRect();t={left:e.left,right:e.left+c.clientWidth,top:e.top,bottom:e.top+c.clientHeight}}let d=0,f=0;if("nearest"==s)e.top0&&e.bottom>t.bottom+f&&(f=e.bottom-t.bottom+f+o)):e.bottom>t.bottom&&(f=e.bottom-t.bottom+o,i<0&&e.top-f0&&e.right>t.right+d&&(d=e.right-t.right+d+r)):e.right>t.right&&(d=e.right-t.right+r,i<0&&e.left0))break;i=i.childNodes[n-1],n=he(i)}if(i>=0)for(let n=t,s=e;;){if(3==n.nodeType)return n;if(!(1==n.nodeType&&s=0))break;n=n.childNodes[s],s=0}return null}class hn{constructor(){this.changes=[]}compareRange(t,e){li(t,e,this.changes)}comparePoint(t,e){li(t,e,this.changes)}}function cn(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function un(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function dn(t,e){return t.tope.top+1}function fn(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,a,l,h,c,u=!1;for(let d=t.firstChild;d;d=d.nextSibling){let t=re(d);for(let f=0;fg||o==g&&r>O){n=d,s=p,r=O,o=g;let a=g?i0?f0)}0==O?i>p.bottom&&(!h||h.bottomp.top)&&(l=d,c=p):h&&dn(h,p)?h=pn(h,p.bottom):c&&dn(c,p)&&(c=fn(c,p.top))}}if(h&&h.bottom>=i?(n=a,s=h):c&&c.top<=i&&(n=l,s=c),!n)return{node:t,offset:0};let d=Math.max(s.left,Math.min(s.right,e));return 3==n.nodeType?gn(n,d,i):u&&"false"!=n.contentEditable?On(n,d,i):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,n)+(e>=(s.left+s.right)/2?1:0)}}function gn(t,e,i){let n=t.nodeValue.length,s=-1,r=1e9,o=0;for(let a=0;ai?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(De.chrome||De.gecko){me(t,a).getBoundingClientRect().left==h.right&&(n=!i)}if(c<=0)return{node:t,offset:a+(n?1:0)};s=a+(n?1:0),r=c}}}return{node:t,offset:s>-1?s:o>0?t.nodeValue.length:0}}function mn(t,e,i,n=-1){var s,r;let o,a=t.contentDOM.getBoundingClientRect(),l=a.top+t.viewState.paddingTop,{docHeight:h}=t.viewState,{x:c,y:u}=e,d=u-l;if(d<0)return 0;if(d>h)return t.state.doc.length;for(let e=t.defaultLineHeight/2,s=!1;o=t.elementAtHeight(d),o.type!=ii.Text;)for(;d=n>0?o.bottom+e:o.top-e,!(d>=0&&d<=h);){if(s)return i?null:0;s=!0,n=-n}u=l+d;let f=o.from;if(ft.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:bn(t,a,o,c,u);let p=t.dom.ownerDocument,O=t.root.elementFromPoint?t.root:p,g=O.elementFromPoint(c,u);g&&!t.contentDOM.contains(g)&&(g=null),g||(c=Math.max(a.left+1,Math.min(a.right-1,c)),g=O.elementFromPoint(c,u),g&&!t.contentDOM.contains(g)&&(g=null));let m,b=-1;if(g&&0!=(null===(s=t.docView.nearest(g))||void 0===s?void 0:s.isEditable))if(p.caretPositionFromPoint){let t=p.caretPositionFromPoint(c,u);t&&({offsetNode:m,offset:b}=t)}else if(p.caretRangeFromPoint){let e=p.caretRangeFromPoint(c,u);e&&(({startContainer:m,startOffset:b}=e),(!t.contentDOM.contains(m)||De.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 me(t,n-1,n).getBoundingClientRect().left>i}(m,b,c)||De.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}let n=1==t.nodeType?t.getBoundingClientRect():me(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return i-n.left>5}(m,b,c))&&(m=void 0))}if(!m||!t.docView.dom.contains(m)){let e=hi.find(t.docView,f);if(!e)return d>o.top+o.height/2?o.to:o.from;({node:m,offset:b}=On(e.dom,c,u))}let w=t.docView.nearest(m);if(!w)return null;if(w.isWidget&&1==(null===(r=w.dom)||void 0===r?void 0:r.nodeType)){let t=w.dom.getBoundingClientRect();return e.y1.5*t.defaultLineHeight){r+=Math.floor((s-i.top)/t.defaultLineHeight)*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=f(t,n)}return!0===n?-1:t.length}(o,r,t.state.tabSize)}function wn(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=t.bidiSpans(s),o=t.textDirectionAt(s.from);for(let a=e,l=null;;){let e=Ji(s,r,o,a,i),h=Hi;if(!e){if(s.number==(i?t.state.doc.lines:1))return a;h="\n",s=t.state.doc.line(s.number+(i?1:-1)),r=t.bidiSpans(s),e=A.cursor(i?s.from:s.to)}if(l){if(!l(h))return a}else{if(!n)return e;l=n(h)}a=e}}function vn(t,e,i,n){let s=t.state.facet(Ri).map((e=>e(t)));for(;;){let t=!1;for(let r of s)r.between(i.from-1,i.from+1,((s,r,o)=>{i.from>s&&i.fromi.from?A.cursor(s,1):A.cursor(r,-1),t=!0,o.widget.skipPosition&&(i=o.widget.skipPosition(i,e,n)))}));if(!t)return i}}class yn{constructor(t){this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null;let e=(e,i)=>{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 Cn){let n=Cn[i];t.contentDOM.addEventListener(i,(i=>{Pn(t,i)&&e(n,i)}),_n[i]),this.registeredEvents.push(i)}t.scrollDOM.addEventListener("mousedown",(i=>{if(i.target==t.scrollDOM&&i.clientY>t.contentDOM.getBoundingClientRect().bottom&&(e(Cn.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)}})),De.chrome&&102==De.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,De.safari&&t.contentDOM.addEventListener("input",(()=>null))}setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}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=>{Pn(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){Qi(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){Qi(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||xn.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,be(t.contentDOM,e.key,e.keyCode))}ignoreDuringComposition(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(De.safari&&!De.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 Sn=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],xn="dthko",kn=[16,17,18,20,91,92,224,225];function Qn(t){return.7*Math.max(0,t)+8}class $n{constructor(t,e,i,n){this.view=t,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);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(xt.allowMultipleSelections)&&function(t,e){let i=t.state.facet(pi);return i.length?i[0](e):(De.mac,e.altKey)}(t,e),this.dragMove=function(t,e){let i=t.state.facet(Oi);return i.length?i[0](e):De.mac?!e.altKey:!e.ctrlKey}(t,e),this.dragging=!(!function(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let n=ie(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!=Yn(e))&&null}start(t){!1===this.dragging&&(t.preventDefault(),this.select(t))}move(t){var e;if(0==t.buttons)return this.destroy();if(!1!==this.dragging)return;this.select(this.lastEvent=t);let i=0,n=0,s=(null===(e=this.scrollParent)||void 0===e?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight};t.clientX<=s.left+6?i=-Qn(s.left-t.clientX):t.clientX>=s.right-6&&(i=Qn(t.clientX-s.right)),t.clientY<=s.top+6?n=-Qn(s.top-t.clientY):t.clientY>=s.bottom-6&&(n=Qn(t.clientY-s.bottom)),this.setScrollSpeed(i,n)}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)}select(t){let e=this.style.get(t,this.extend,this.multiple);!this.mustSelect&&e.eq(this.view.state.selection)&&e.main.assoc==this.view.state.selection.main.assoc||this.view.dispatch({selection:e,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.docChanged&&this.dragging&&(this.dragging=this.dragging.map(t.changes)),this.style.update(t)&&setTimeout((()=>this.select(this.lastEvent)),20)}}function Pn(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=Se.get(n))&&i.ignoreEvent(e))return!1;return!0}const Cn=Object.create(null),_n=Object.create(null),Xn=De.ie&&De.ie_version<15||De.ios&&De.webkit_version<604;function Zn(t,e){let i,{state:n}=t,s=1,r=n.toText(e),o=r.lines==n.selection.ranges.length;if(null!=Ln&&n.selection.ranges.every((t=>t.empty))&&Ln==r.toString()){let t=-1;i=n.changeByRange((i=>{let a=n.doc.lineAt(i.from);if(a.from==t)return{range:i};t=a.from;let l=n.toText((o?r.line(s++).text:e)+n.lineBreak);return{changes:{from:a.from,insert:l},range:A.cursor(i.from+l.length)}}))}else i=o?n.changeByRange((t=>{let e=r.line(s++);return{changes:{from:t.from,to:t.to,insert:e.text},range:A.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 A.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 A.cursor(e);0==r?i=1:r==s.length&&(i=-1);let o=r,a=r;i<0?o=f(s.text,r,!1):a=f(s.text,r);let l=n(s.text.slice(o,a));for(;o>0;){let t=f(s.text,o,!1);if(n(s.text.slice(t,o))!=l)break;o=t}for(;a{t.inputState.setSelectionOrigin("select"),27==e.keyCode&&(t.inputState.lastEscPress=Date.now())},Cn.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},Cn.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},_n.touchstart=_n.touchmove={passive:!0},Cn.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return;let i=null;for(let n of t.state.facet(gi))if(i=n(t,e),i)break;if(i||0!=e.button||(i=function(t,e){let i=Vn(t,e),n=Yn(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 a,l=Vn(t,e),h=An(t,l.pos,l.bias,n);if(i.pos!=l.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&&(a=function(t,e){for(let i=0;i=e)return A.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,l.pos))?a:o?s.addRange(h):A.create([h])}}}(t,e)),i){let n=t.root.activeElement!=t.contentDOM;t.inputState.startMouseSelection(new $n(t,e,i,n)),n&&t.observer.ignore((()=>ge(t.contentDOM))),t.inputState.mouseSelection&&t.inputState.mouseSelection.start(e)}};let Tn=(t,e)=>t>=e.top&&t<=e.bottom,Rn=(t,e,i)=>Tn(e,i)&&t>=i.left&&t<=i.right;function En(t,e,i,n){let s=hi.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&&Rn(i,n,o))return-1;let a=s.coordsAt(r,1);return a&&Rn(i,n,a)?1:o&&Tn(n,o)?-1:1}function Vn(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:En(t,i,e.clientX,e.clientY)}}const Mn=De.ie&&De.ie_version<=11;let Dn=null,Wn=0,Un=0;function Yn(t){if(!Mn)return t.detail;let e=Dn,i=Un;return Dn=t,Un=Date.now(),Wn=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Wn+1)%3:1}function qn(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&&r.dragMove?{from:r.dragging.from,to:r.dragging.to}:null,a={from:s,insert:i},l=t.state.changes(o?[o,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(s,-1),head:l.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"})}Cn.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")},Cn.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&&qn(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 qn(t,e,e.dataTransfer.getData("Text"),!0)},Cn.paste=(t,e)=>{if(t.state.readOnly)return e.preventDefault();t.observer.flush();let i=Xn?null:e.clipboardData;i?(Zn(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(),Zn(t,i.value)}),50)}(t)};let Ln=null;Cn.copy=Cn.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;Ln=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 zn=lt.define();function In(t,e){let i=[];for(let n of t.facet(vi)){let s=n(t,e);s&&i.push(s)}return i?t.update({effects:i,annotations:zn.of(!0)}):null}function Bn(t){setTimeout((()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=In(t.state,e);i?t.dispatch(i):t.update([])}}),10)}Cn.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),Bn(t)},Cn.blur=t=>{t.observer.clearSelectionRange(),Bn(t)},Cn.compositionstart=Cn.compositionupdate=t=>{null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},Cn.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,De.chrome&&De.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then((()=>t.observer.flush())):setTimeout((()=>{t.inputState.composing<0&&t.docView.compositionDeco.size&&t.update([])}),50)},Cn.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},Cn.beforeinput=(t,e)=>{var i;let n;if(De.chrome&&De.android&&(n=Sn.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 jn=["pre-wrap","normal","pre-line","break-spaces"];class Nn{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){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return jn.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i-1,a=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,a){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)>Jn&&(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:a,toA:l,fromB:h,toB:c}=n[o],u=s.lineAt(a,Hn.ByPosNoHeight,i.setDoc(e),0,0),d=u.to>=l?u:s.lineAt(l,Hn.ByPosNoHeight,i,0,0);for(c+=d.to-l,l=d.to;o>0&&u.from<=n[o-1].toA;)a=n[o-1].fromA,h=n[o-1].fromB,o--,a2*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 es extends ts{constructor(t,e){super(t,e,ii.Text),this.collapsed=0,this.widgetHeight=0}replace(t,e,i){let n=i[0];return 1==i.length&&(n instanceof es||n instanceof is&&4&n.flags)&&Math.abs(this.length-n.length)<10?(n instanceof is?n=new es(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.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class is 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:a}=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),l=o+r.length*a,h=Math.max(i,t-l/2);return new Fn(r.from,r.length,h,l,ii.Text)}{let n=Math.max(0,Math.min(r-s,Math.floor((t-i)/o))),{from:a,length:l}=e.doc.line(s+n);return new Fn(a,l,i+o*n,o,ii.Text)}}lineAt(t,e,i,n,s){if(e==Hn.ByHeight)return this.blockAt(t,i,n,s);if(e==Hn.ByPosNoHeight){let{from:e,to:n}=i.doc.lineAt(t);return new Fn(e,n-e,0,0,ii.Text)}let{firstLine:r,perLine:o,perChar:a}=this.heightMetrics(i,s),l=i.doc.lineAt(t),h=o+l.length*a,c=l.number-r,u=n+o*c+a*(l.from-s-c);return new Fn(l.from,l.length,Math.max(n,Math.min(u,n+this.height-h)),h,ii.Text)}forEachLine(t,e,i,n,s,r){t=Math.max(t,s),e=Math.min(e,s+this.length);let{firstLine:o,perLine:a,perChar:l}=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+=a*i+l*(t-s-i)}let n=a+l*e.length;r(new Fn(e.from,e.length,c,n,ii.Text)),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 is?i[i.length-1]=new is(t.length+n):i.push(null,new is(n-1))}if(t>0){let e=i[0];e instanceof is?i[0]=new is(t+e.length):i.unshift(new is(t-1),null)}return Kn.of(i)}decomposeLeft(t,e){e.push(new is(t-1),null)}decomposeRight(t,e){e.push(null,new is(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 is(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)>=Jn&&(o=-2);let a=new es(e,s);a.outdated=!1,i.push(a),r+=e+1}r<=s&&i.push(null,new is(s-r).updateHeight(t,r));let a=Kn.of(i);return(o<0||Math.abs(a.height-this.height)>=Jn||Math.abs(o-this.heightMetrics(t,e).perLine)>=Jn)&&(t.heightChanged=!0),a}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class ns 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 l;let h=e==Hn.ByPosNoHeight?Hn.ByPosNoHeight:Hn.ByPos;return a?l.join(this.right.lineAt(o,h,i,r,o)):this.left.lineAt(o,h,i,n,s).join(l)}forEachLine(t,e,i,n,s,r){let o=n+this.left.height,a=s+this.left.length+this.break;if(this.break)t=a&&this.right.forEachLine(t,e,i,o,a,r);else{let l=this.lineAt(a,Hn.ByPos,i,n,s);t=t&&l.from<=e&&r(l),e>l.to&&this.right.forEachLine(l.to+1,e,i,o,a,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&&ss(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,a=null;return n&&n.from<=e+s.length&&n.more?a=s=s.updateHeight(t,e,i,n):s.updateHeight(t,e,i),n&&n.from<=o+r.length&&n.more?a=r=r.updateHeight(t,o,i,n):r.updateHeight(t,o,i),a?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 ss(t,e){let i,n;null==t[e]&&(i=t[e-1])instanceof is&&(n=t[e+1])instanceof is&&t.splice(e-1,3,new is(i.length+1+n.length))}class rs{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 es?i.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new es(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)}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 es(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let i=new is(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 es)return t;let e=new es(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine(),t.type!=ii.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,t.type!=ii.WidgetBefore&&(this.covering=t)}addLineDeco(t,e){let i=this.ensureLine();i.length+=e,i.collapsed+=e,i.widgetHeight=Math.max(i.widgetHeight,t),this.writtenTo=this.pos=this.pos+e}finish(t){let e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof es||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),a=Math.max(a,n.top),l=e==t.parentNode?n.bottom:Math.min(l,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:a-(i.top+e),bottom:Math.max(a,l)-(i.top+e)}}function ls(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class hs{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 Nn(i),this.stateDeco=e.facet(Ti).filter((t=>"function"!=typeof t)),this.heightMap=Kn.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle.setDoc(e.doc),[new Mi(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ni.set(this.lineGaps.map((t=>t.draw(!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 ds(e,i))}}this.viewports=t.sort(((t,e)=>t.from-e.from)),this.scaler=this.heightMap.height<=7e6?gs:new ms(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:bs(t,this.scaler))}))}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=this.state.facet(Ti).filter((t=>"function"!=typeof t));let n=t.changedRanges,s=Mi.extendWithRanges(n,function(t,e,i){let n=new os;return _t.compare(t,e,i,n,0),n.changes}(i,this.stateDeco,t?t.changes:k.empty(this.state.doc.length))),r=this.heightMap.height;this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),s),this.heightMap.height!=r&&(t.flags|=2);let o=s.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.heado.to)||!this.viewportIsAppropriate(o))&&(o=this.getViewport(0,e));let a=!t.changes.empty||2&t.flags||o.from!=this.viewport.from||o.to!=this.viewport.to;this.viewport=o,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(Si)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let i=e.contentDOM,n=window.getComputedStyle(i),s=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Wi.RTL:Wi.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),a=i.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let h=0,c=0,u=parseInt(n.paddingTop)||0,d=parseInt(n.paddingBottom)||0;this.paddingTop==u&&this.paddingBottom==d||(this.paddingTop=u,this.paddingBottom=d,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let f=(this.printing?ls:as)(i,this.paddingTop),p=f.top-this.pixelViewport.top,O=f.bottom-this.pixelViewport.bottom;this.pixelViewport=f;let g=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(g!=this.inView&&(this.inView=g,g&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let m=a.width;if(this.contentDOMWidth==m&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,h|=8),l){let i=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(i)&&(o=!0),o||s.lineWrapping&&Math.abs(m-this.contentDOMWidth)>s.charWidth){let{lineHeight:t,charWidth:n,textHeight:a}=e.docView.measureTextSize();o=t>0&&s.refresh(r,t,n,a,m/n,i),o&&(e.docView.minWidth=0,h|=8)}p>0&&O>0?c=Math.max(p,O):p<0&&O<0&&(c=Math.min(p,O)),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 Mi(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new Gn(n.from,r))}s.heightChanged&&(h|=2)}let b=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return b&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(2&h||b)&&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,a=new ds(n.lineAt(r-1e3*i,Hn.ByHeight,s,0,0).from,n.lineAt(o+1e3*(1-i),Hn.ByHeight,s,0,0).to);if(e){let{head:t}=e.range;if(ta.to){let i,r=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=n.lineAt(t,Hn.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!=Wi.LTR&&!i)return[];let o=[],a=(n,r,l,h)=>{if(r-nn&&tt.from>=l.from&&t.to<=l.to&&Math.abs(t.from-n)t.frome))));if(!d){if(rt.from<=r&&t.to>=r))){let t=e.moveToLineBoundary(A.cursor(r),!1,!0).head;t>n&&(r=t)}d=new hs(n,r,this.gapSize(l,n,r,h))}o.push(d)};for(let t of this.viewportLines){if(t.lengtht.from&&a(t.from,s,t,e),ot.draw(this.heightOracle.lineWrapping)))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];_t.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))||bs(this.heightMap.lineAt(t,Hn.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return bs(this.heightMap.lineAt(this.scaler.fromDOM(t),Hn.ByHeight,this.heightOracle,0,0),this.scaler)}elementAtHeight(t){return bs(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 ds{constructor(t,e){this.from=t,this.to=e}}function fs(t,e,i){let n=[],s=t,r=0;return _t.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 Os(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 gs={toDOM:t=>t,fromDOM:t=>t,scale:1};class ms{constructor(t,e,i){let n=0,s=0,r=0;this.viewports=i.map((({from:i,to:s})=>{let r=e.lineAt(i,Hn.ByPos,t,0,0).top,o=e.lineAt(s,Hn.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=ebs(t,e))):t.type)}const ws=E.define({combine:t=>t.join(" ")}),vs=E.define({combine:t=>t.indexOf(!0)>-1}),ys=It.newName(),Ss=It.newName(),xs=It.newName(),ks={"&light":"."+Ss,"&dark":"."+xs};function Qs(t,e,i){return new It(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 $s=Qs("."+ys,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",borderRadius:"4px",marginTop:"0.5rem",width:"30%",minWidth:"190px",marginLeft:"auto",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&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:"#333338",fontSize:"70%",padding:".2em 1em",borderRadius:"4px"},"&light .cm-button":{background:"#eee"},"&dark .cm-button":{background:"#eee"},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",borderRadius:"0.25rem",border:"1px solid silver",padding:".0em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},ks);class Ps{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;i&&(e.push(new nn(i,n)),s==i&&r==n||e.push(new nn(s,r)));return e}(t),i=new tn(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?A.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||!ne(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||!ne(t.contentDOM,e.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(e.anchorNode,e.anchorOffset);this.newSel=A.single(n,i)}}}function Cs(e,i){let n,{newSel:s}=i,r=e.state.selection.main;if(i.bounds){let{from:s,to:o}=i.bounds,a=r.from,l=null;(8===e.inputState.lastKeyCode&&e.inputState.lastKeyTime>Date.now()-100||De.android&&i.text.length0&&a>0&&t.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if("end"==n){i-=o+Math.max(0,r-Math.min(o,a))-r}if(o=o?r-i:0,a=r+(a-o),o=r}else if(a=a?r-i:0,o=r+(o-a),a=r}return{from:r,toA:o,toB:a}}(e.state.doc.sliceString(s,o,Ki),i.text,a-s,l);h&&(De.chrome&&13==e.inputState.lastKeyCode&&h.toB==h.from+2&&i.text.slice(h.from,h.toB)==Ki+Ki&&h.toB--,n={from:s+h.from,to:s+h.toA,insert:t.of(i.text.slice(h.from,h.toB).split(Ki))})}else s&&(!e.hasFocus&&e.state.facet($i)||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))}:(De.mac||De.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=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}):De.chrome&&n&&n.from==n.to&&n.from==r.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(s&&(s=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}),n){let t=e.state;if(De.ios&&e.inputState.flushIOSKey(e))return!0;if(De.android&&(n.from==r.from&&n.to==r.to&&1==n.insert.length&&2==n.insert.lines&&be(e.contentDOM,"Enter",13)||n.from==r.from-1&&n.to==r.to&&0==n.insert.length&&be(e.contentDOM,"Backspace",8)||n.from==r.from&&n.to==r.to+1&&0==n.insert.length&&be(e.contentDOM,"Delete",46)))return!0;let i,o=n.insert.toString();if(e.state.facet(wi).some((t=>t(e,n.from,n.to,o))))return!0;if(e.inputState.composing>=0&&e.inputState.composing++,n.from>=r.from&&n.to<=r.to&&n.to-n.from>=(r.to-r.from)/3&&(!s||s.main.empty&&s.main.from==n.from+n.insert.length)&&e.inputState.composing<0){let s=r.fromn.to?t.sliceDoc(n.to,r.to):"";i=t.replaceSelection(e.state.toText(s+n.insert.sliceString(0,void 0,e.state.lineBreak)+o))}else{let o=t.changes(n),a=s&&s.main.to<=o.newLength?s.main:void 0;if(t.selection.ranges.length>1&&e.inputState.composing>=0&&n.to<=r.to&&n.to>=r.to-10){let s=e.state.sliceDoc(n.from,n.to),l=on(e)||e.state.doc.lineAt(r.head),h=r.to-n.to,c=r.to-r.from;i=t.changeByRange((i=>{if(i.from==r.from&&i.to==r.to)return{changes:o,range:a||i.map(o)};let u=i.to-h,d=u-s.length;if(i.to-i.from!=c||e.state.sliceDoc(d,u)!=s||l&&i.to>=l.from&&i.from<=l.to)return{range:i};let f=t.changes({from:d,to:u,insert:n.insert}),p=i.to-r.to;return{changes:f,range:a?A.range(Math.max(0,a.anchor+p),Math.max(0,a.head+p)):i.map(f)}}))}else i={changes:o,selection:a&&t.selection.replaceRange(a)}}let a="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,a+=".compose",e.inputState.compositionFirstChange&&(a+=".start",e.inputState.compositionFirstChange=!1)),e.dispatch(i,{scrollIntoView:!0,userEvent:a}),!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 _s={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Xs=De.ie&&De.ie_version<=11;class Zs{constructor(t){this.view=t,this.active=!1,this.selectionRange=new fe,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);(De.ie&&De.ie_version<=11||De.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()})),Xs&&(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")))}),{}),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($i)?i.root.activeElement!=this.dom:!se(i.dom,n))return;let s=n.anchorNode&&i.docView.nearest(n.anchorNode);s&&s.ignoreEvent(t)?e||(this.selectionChanged=!1):(De.ie&&De.ie_version<=11||De.android&&De.chrome)&&!i.state.selection.main.empty&&n.focusNode&&oe(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=De.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,a=t.docView.domAtPos(t.state.selection.main.anchor);oe(a.node,a.offset,r,o)&&([n,s,r,o]=[r,o,n,s]);return{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:o}}(this.view)||ie(t.root);if(!e||this.selectionRange.eq(e))return!1;let i=se(this.dom,e);return i&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let t=this.delayedAndroidKey;t&&(this.clearDelayedAndroidKey(),!this.flush()&&t.force&&be(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&&se(this.dom,this.selectionRange);return t<0&&!n?null:(t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new Ps(this.view,t,e,i))}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=Cs(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.dirty|=4),"childList"==t.type){let i=As(e,t.previousSibling||t.target.previousSibling,-1),n=As(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 As(t,e,i){for(;e;){let n=Se.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 Ts{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),this._dispatch=t.dispatch||(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 us(t.state||xt.create(t)),this.plugins=this.state.facet(Ci).map((t=>new Xi(t)));for(let t of this.plugins)t.update(this);this.observer=new Zs(this),this.inputState=new yn(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new sn(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),t.parent&&t.parent.appendChild(this.dom)}get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}dispatch(...t){this._dispatch(1==t.length&&t[0]instanceof dt?t[0]:this.state.update(...t))}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,a=null;t.some((t=>t.annotation(zn)))?(this.inputState.notifiedFocused=r,o=1):r!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=r,a=In(s,r),a||(o=1));let l=this.observer.delayedAndroidKey,h=null;if(l?(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(xt.phrases)!=this.state.facet(xt.phrases))return this.setState(s);e=Di.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 xi(t.empty?t:A.cursor(t.head,t.head>t.anchor?-1:1))}for(let t of e.effects)t.is(ki)&&(c=t.value)}this.viewState.update(e,c),this.bidiCache=Vs.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),i=this.docView.update(e),this.state.facet(Vi)!=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(ws)!=e.state.facet(ws)&&(this.viewState.mustMeasureContent=!0),(i||n||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!e.empty)for(let t of this.state.facet(bi))t(e);(a||h)&&Promise.resolve().then((()=>{a&&this.state==a.startState&&this.dispatch(a),h&&!Cs(this,h)&&l.force&&be(this.contentDOM,l.key,l.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 us(t),this.plugins=t.facet(Ci).map((t=>new Xi(t))),this.pluginMap.clear();for(let t of this.plugins)t.update(this);this.docView=new sn(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(Ci),i=t.state.facet(Ci);if(e!=i){let n=[];for(let s of i){let i=e.indexOf(s);if(i<0)n.push(new Xi(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.measureScheduled=0,t&&this.observer.forceFlush();let e=null,{scrollHeight:i,scrollTop:n,clientHeight:s}=this.scrollDOM,r=n>i-s-4?i:n;try{for(let t=0;;t++){this.updateState=1;let i=this.viewport,n=this.viewState.lineBlockAtHeight(r),s=this.viewState.measure(this);if(!s&&!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 o=[];4&s||([this.measureRequests,o]=[o,this.measureRequests]);let a=o.map((t=>{try{return t.read(this)}catch(t){return Qi(this.state,t),Es}})),l=Di.create(this,this.state,[]),h=!1,c=!1;l.flags|=s,e?e.flags|=s:e=l,this.updateState=2,l.empty||(this.updatePlugins(l),this.inputState.update(l),this.updateAttrs(),h=this.docView.update(l));for(let t=0;t1||t<-1)&&(this.scrollDOM.scrollTop+=t,c=!0)}if(h&&this.docView.updateSelection(!0),this.viewport.from==i.from&&this.viewport.to==i.to&&!c&&0==this.measureRequests.length)break}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let t of this.state.facet(bi))t(e)}get themeClasses(){return ys+" "+(this.state.facet(vs)?xs:Ss)+" "+this.state.facet(ws)}updateAttrs(){let t=Ms(this,Zi,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet($i)?"true":"false",class:"cm-content",style:`${De.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Ms(this,Ai,e);let i=this.observer.ignore((()=>{let i=ti(this.contentDOM,this.contentAttrs,e),n=ti(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)if(t.is(Ts.announce)){e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(Vi),It.mount(this.root,this.styleModules.concat($s).reverse())}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}}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 vn(this,t,wn(this,t,e,i))}moveByCharSelected(t,e,i){return vn(this,t,wn(this,t,e,i),!0)}moveByGroup(t,e){return vn(this,t,wn(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==wt.Space&&(s=e),s==e}}(this,t.head,e))))}moveToLineBoundary(t,e,i=!0){return function(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=n&&t.lineWrapping?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==Wi.LTR)?e.right-1:e.left+1,y:(r.top+r.bottom)/2});if(null!=o)return A.cursor(o,i?-1:1)}let o=hi.find(t.docView,e.head),a=o?i?o.posAtEnd:o.posAtStart:i?s.to:s.from;return A.cursor(a,i?-1:1)}(this,t,e,i)}moveVertically(t,e,i){return vn(this,t,function(t,e,i,n){let s=e.head,r=i?1:-1;if(s==(i?t.state.doc.length:0))return A.cursor(s,e.assoc);let o,a=e.goalColumn,l=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s),c=t.documentTop;if(h)null==a&&(a=h.left-l.left),o=r<0?h.top:h.bottom;else{let e=t.viewState.lineBlockAt(s);null==a&&(a=Math.min(l.right-l.left,t.defaultCharacterWidth*(s-e.from))),o=(r<0?e.top:e.bottom)+c}let u=l.left+a,d=null!=n?n:t.defaultLineHeight>>1;for(let i=0;;i+=10){let n=o+(d+i)*r,h=mn(t,{x:u,y:n},!1,r);if(nl.bottom||(r<0?hs))return A.cursor(h,e.assoc,void 0,a)}}(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(),mn(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 ue(i,s[Ni.find(s,t-n.from,-1,e)].dir==Wi.LTR==e>0)}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(yi)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Rs)return Fi(t.length);let e=this.textDirectionAt(t.from);for(let i of this.bidiCache)if(i.from==t.from&&i.dir==e)return i.order;let i=function(t,e){let i=t.length,n=e==Ui?1:2,s=e==Ui?2:1;if(!t||1==n&&!ji.test(t))return Fi(i);for(let e=0,s=n,o=n;e=0;t-=3)if(Bi[t+1]==-r){let e=Bi[t+2],i=2&e?n:4&e?1&e?s:n:0;i&&(Gi[a]=Gi[Bi[t]]=i),l=t;break}}else{if(189==Bi.length)break;Bi[l++]=a,Bi[l++]=e,Bi[l++]=h}else if(2==(o=Gi[a])||1==o){let t=o==n;h=t?0:1;for(let e=l-3;e>=0;e-=3){let i=Bi[e+2];if(2&i)break;if(t)Bi[e+2]|=2;else{if(4&i)break;Bi[e+2]|=4}}}for(let t=0;te;){let t=i,n=2!=Gi[--i];for(;i>e&&n==(2!=Gi[i-1]);)i--;o.push(new Ni(i,t,n?2:1))}else o.push(new Ni(e,t,0))}else for(let t=0;tDate.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{ge(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 ki.of(new xi("number"==typeof t?A.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}static domEventHandlers(t){return _i.define((()=>({})),{eventHandlers:t})}static theme(t,e){let i=It.newName(),n=[ws.of(i),Vi.of(Qs(`.${i}`,t))];return e&&e.dark&&n.push(vs.of(!0)),n}static baseTheme(t){return N.lowest(Vi.of(Qs("."+ys,t,ks)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),n=i&&Se.get(i)||Se.get(t);return(null===(e=null==n?void 0:n.rootView)||void 0===e?void 0:e.view)||null}}Ts.styleModule=Vi,Ts.inputHandler=wi,Ts.focusChangeEffect=vi,Ts.perLineTextDirection=yi,Ts.exceptionSink=mi,Ts.updateListener=bi,Ts.editable=$i,Ts.mouseSelectionStyle=gi,Ts.dragMovesSelection=Oi,Ts.clickAddsSelectionRange=pi,Ts.decorations=Ti,Ts.atomicRanges=Ri,Ts.scrollMargins=Ei,Ts.darkTheme=vs,Ts.contentAttributes=Ai,Ts.editorAttributes=Zi,Ts.lineWrapping=Ts.contentAttributes.of({class:"cm-lineWrapping"}),Ts.announce=ut.define();const Rs=4096,Es={};class Vs{constructor(t,e,i,n){this.from=t,this.to=e,this.dir=i,this.order=n}static update(t,e){if(e.empty)return t;let i=[],n=t.length?t[t.length-1].dir:Wi.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&&Je(r,i)}return i}const Ds=De.mac?"mac":De.windows?"win":De.linux?"linux":"key";function Ws(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 Us=N.default(Ts.domEventHandlers({keydown:(t,e)=>Bs(Ls(e.state),t,e,"editor")})),Ys=E.define({enables:Us}),qs=new WeakMap;function Ls(t){let e=t.facet(Ys),i=qs.get(e);return i||qs.set(e,i=function(t,e=Ds){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)=>{var a,l;let h=i[t]||(i[t]=Object.create(null)),c=n.split(/ (?!$)/).map((t=>function(t,e){const i=t.split(/-(?!$)/);let n,s,r,o,a=i[i.length-1];"Space"==a&&(a=" ");for(let t=0;t{let n=zs={view:e,prefix:i,scope:t};return setTimeout((()=>{zs==n&&(zs=null)}),Is),!0}]})}let u=c.join(" ");s(u,!1);let d=h[u]||(h[u]={preventDefault:!1,run:(null===(l=null===(a=h._any)||void 0===a?void 0:a.run)||void 0===l?void 0:l.slice())||[]});r&&d.run.push(r),o&&(d.preventDefault=!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,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.shift&&r(e,"Shift-"+s,n.shift,n.preventDefault)}return i}(e.reduce(((t,e)=>t.concat(e)),[]))),i}let zs=null;const Is=4e3;function Bs(t,e,i,n){let s=function(t){var e=!(Kt&&(t.ctrlKey||t.altKey||t.metaKey)||Jt&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?Gt:Nt)[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=v(b(s,0))==s.length&&" "!=s,o="",a=!1;zs&&zs.view==i&&zs.scope==n&&(o=zs.prefix+" ",(a=kn.indexOf(e.keyCode)<0)&&(zs=null));let l,h,c=new Set,u=t=>{if(t){for(let n of t.run)if(!c.has(n)&&(c.add(n),n(i,e)))return!0;t.preventDefault&&(a=!0)}return!1},d=t[n];if(d){if(u(d[o+Ws(s,e,!r)]))return!0;if(r&&(e.altKey||e.metaKey||e.ctrlKey)&&!(De.windows&&e.ctrlKey&&e.altKey)&&(l=Nt[e.keyCode])&&l!=s){if(u(d[o+Ws(l,e,!0)]))return!0;if(e.shiftKey&&(h=Gt[e.keyCode])!=s&&h!=l&&u(d[o+Ws(h,e,!1)]))return!0}else if(r&&e.shiftKey&&u(d[o+Ws(s,e,!0)]))return!0;if(u(d._any))return!0}return a}class js{constructor(t,e,i,n,s){this.className=t,this.left=e,this.top=i,this.width=n,this.height=s}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className==this.className&&(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",null!=this.width&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,i){if(i.empty){let n=t.coordsAtPos(i.head,i.assoc||1);if(!n)return[];let s=Ns(t);return[new js(e,n.left-s.left,n.top-s.top,null,n.bottom-n.top)]}return function(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];let n=Math.max(i.from,t.viewport.from),s=Math.min(i.to,t.viewport.to),r=t.textDirection==Wi.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=Ns(t),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),u=a.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),d=a.right-(c?parseInt(c.paddingRight):0),f=Fs(t,n),p=Fs(t,s),O=f.type==ii.Text?f:null,g=p.type==ii.Text?p:null;t.lineWrapping&&(O&&(O=Gs(t,n,O)),g&&(g=Gs(t,s,g)));if(O&&g&&O.from==g.from)return b(w(i.from,i.to,O));{let e=O?w(i.from,null,O):v(f,!1),n=g?w(null,i.to,g):v(p,!0),s=[];return(O||f).to<(g||p).from-1?s.push(m(u,e.bottom,d,n.top)):e.bottomh&&n.from=r)break;a>s&&l(Math.max(t,s),null==e&&t<=h,Math.min(a,r),null==i&&a>=c,o.dir)}if(s=n.to+1,s>=r)break}return 0==a.length&&l(h,null==e,c,null==i,t.textDirection),{top:s,bottom:o,horizontal:a}}function v(t,e){let i=a.top+(e?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]}}}(t,e,i)}}function Ns(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Wi.LTR?e.left:e.right-t.scrollDOM.clientWidth)-t.scrollDOM.scrollLeft,top:e.top-t.scrollDOM.scrollTop}}function Gs(t,e,i){let n=A.cursor(e);return{from:Math.max(i.from,t.moveToLineBoundary(n,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(n,!0,!0).from),type:ii.Text}}function Fs(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==ii.Text))return t;return i}class Hs{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),e.above&&this.dom.classList.add("cm-layer-above"),e.class&&this.dom.classList.add(e.class),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(Js)!=t.state.facet(Js)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&t.view.requestMeasure(this.measureReq)}setOrder(t){let e=0,i=t.facet(Js);for(;e{return i=t,n=this.drawn[e],!(i.constructor==n.constructor&&i.eq(n));var i,n}))){let e=this.dom.firstChild,i=0;for(let n of t)n.update&&e&&n.constructor&&this.drawn[i].constructor&&n.update(e,this.drawn[i])?(e=e.nextSibling,i++):this.dom.insertBefore(n.draw(),e);for(;e;){let t=e.nextSibling;e.remove(),e=t}this.drawn=t}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Js=E.define();function Ks(t){return[_i.define((e=>new Hs(e,t))),Js.of(t)]}const tr=!De.ios,er=E.define({combine:t=>kt(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})});function ir(t={}){return[er.of(t),sr,or,lr,Si.of(!0)]}function nr(t){return t.startState.facet(er)!=t.state.facet(er)}const sr=Ks({above:!0,markers(t){let{state:e}=t,i=e.facet(er),n=[];for(let s of e.selection.ranges){let r=s==e.selection.main;if(s.empty?!r||tr:i.drawRangeCursor){let e=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",i=s.empty?s:A.cursor(s.head,s.head>s.anchor?-1:1);for(let s of js.forRange(t,e,i))n.push(s)}}return n},update(t,e){t.transactions.some((t=>t.selection))&&(e.style.animationName="cm-blink"==e.style.animationName?"cm-blink2":"cm-blink");let i=nr(t);return i&&rr(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){rr(e.state,t)},class:"cm-cursorLayer"});function rr(t,e){e.style.animationDuration=t.facet(er).cursorBlinkRate+"ms"}const or=Ks({above:!1,markers:t=>t.state.selection.ranges.map((e=>e.empty?[]:js.forRange(t,"cm-selectionBackground",e))).reduce(((t,e)=>t.concat(e))),update:(t,e)=>t.docChanged||t.selectionSet||t.viewportChanged||nr(t),class:"cm-selectionLayer"}),ar={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};tr&&(ar[".cm-line"].caretColor="transparent !important");const lr=N.highest(Ts.theme(ar)),hr=ut.define({map:(t,e)=>null==t?null:e.mapPos(t)}),cr=q.define({create:()=>null,update:(t,e)=>(null!=t&&(t=e.changes.mapPos(t)),e.effects.reduce(((t,e)=>e.is(hr)?e.value:t),t))}),ur=_i.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let i=t.state.field(cr);null==i?null!=this.cursor&&(null===(e=this.cursor)||void 0===e||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(cr)!=i||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let t=this.view.state.field(cr),e=null!=t&&this.view.coordsAtPos(t);if(!e)return null;let i=this.view.scrollDOM.getBoundingClientRect();return{left:e.left-i.left+this.view.scrollDOM.scrollLeft,top:e.top-i.top+this.view.scrollDOM.scrollTop,height:e.bottom-e.top}}drawCursor(t){this.cursor&&(t?(this.cursor.style.left=t.left+"px",this.cursor.style.top=t.top+"px",this.cursor.style.height=t.height+"px"):this.cursor.style.left="-100000px")}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(cr)!=t&&this.view.dispatch({effects:hr.of(t)})}},{eventHandlers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){t.target!=this.view.contentDOM&&this.view.contentDOM.contains(t.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function dr(){return[cr,ur]}function fr(t,e,i,n,s){e.lastIndex=0;for(let r,o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)if(!o.lineBreak)for(;r=e.exec(o.value);)s(a+r.index,r)}class pr{constructor(t){const{regexp:e,decoration:i,decorate:n,boundary:s,maxLength:r=1e3}=t;if(!e.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=e,n)this.addMatch=(t,e,i,s)=>n(s,i,i+t[0].length,t,e);else if("function"==typeof i)this.addMatch=(t,e,n,s)=>{let r=i(t,e,n);r&&s(n,n+t[0].length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(t,e,n,s)=>s(n,n+t[0].length,i)}this.boundary=s,this.maxLength=r}createDeco(t){let e=new Xt,i=e.add.bind(e);for(let{from:e,to:n}of function(t,e){let i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;let n=[];for(let{from:s,to:r}of i)s=Math.max(t.state.doc.lineAt(s).from,s-e),r=Math.min(t.state.doc.lineAt(r).to,r+e),n.length&&n[n.length-1].to>=s?n[n.length-1].to=r:n.push({from:s,to:r});return n}(t,this.maxLength))fr(t.state.doc,this.regexp,e,n,((e,n)=>this.addMatch(n,t,e,i)));return e.finish()}updateDeco(t,e){let i=1e9,n=-1;return t.docChanged&&t.changes.iterChanges(((e,s,r,o)=>{o>t.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e}updateRange(t,e,i,n){for(let s of t.visibleRanges){let r=Math.max(s.from,i),o=Math.min(s.to,n);if(o>r){let i=t.state.doc.lineAt(r),n=i.toi.from;r--)if(this.boundary.test(i.text[r-1-i.from])){a=r;break}for(;oc.push(i.range(t,e));if(i==n)for(this.regexp.lastIndex=a-i.from;(h=this.regexp.exec(i.text))&&h.indexthis.addMatch(i,t,e,u)));e=e.update({filterFrom:a,filterTo:l,filter:(t,e)=>tl,add:c})}}return e}}const Or=null!=/x/.unicode?"gu":"g",gr=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",Or),mr={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let br=null;const wr=E.define({combine(t){let e=kt(t,{render:null,specialChars:gr,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==br&&"undefined"!=typeof document&&document.body){let e=document.body.style;br=null!=(null!==(t=e.tabSize)&&void 0!==t?t:e.MozTabSize)}return br||!1}())&&(e.specialChars=new RegExp("\t|"+e.specialChars.source,Or)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Or)),e}});function vr(t={}){return[wr.of(t),yr||(yr=_i.fromClass(class{constructor(t){this.view=t,this.decorations=ni.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(wr)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new pr({regexp:t.specialChars,decoration:(e,i,n)=>{let{doc:s}=i.state,r=b(e[0],0);if(9==r){let t=s.lineAt(n),e=i.state.tabSize,r=Yt(t.text,e,n-t.from);return ni.replace({widget:new xr((e-r%e)*this.view.defaultCharacterWidth)})}return this.decorationCache[r]||(this.decorationCache[r]=ni.replace({widget:new Sr(t,r)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(wr);t.startState.facet(wr)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))]}let yr=null;class Sr extends ei{constructor(t,e){super(),this.options=t,this.code=e}eq(t){return t.code==this.code}toDOM(t){let e=function(t){return t>=32?"•":10==t?"␤":String.fromCharCode(9216+t)}(this.code),i=t.state.phrase("Control character")+" "+(mr[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,i,e);if(n)return n;let s=document.createElement("span");return s.textContent=e,s.title=i,s.setAttribute("aria-label",i),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class xr extends ei{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent="\t",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}class kr extends ei{constructor(t){super(),this.content=t}toDOM(){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):this.content),"string"==typeof this.content?t.setAttribute("aria-label","placeholder "+this.content):t.setAttribute("aria-hidden","true"),t}ignoreEvent(){return!1}}const Qr="-10000px";class $r{constructor(t,e,i){this.facet=e,this.createTooltipView=i,this.input=t.state.facet(e),this.tooltips=this.input.filter((t=>t)),this.tooltipViews=this.tooltips.map(i)}update(t){var e;let i=t.state.facet(this.facet),n=i.filter((t=>t));if(i===this.input){for(let e of this.tooltipViews)e.update&&e.update(t);return!1}let s=[];for(let e=0;e{var e,i,n;return{position:De.ios?"absolute":(null===(e=t.find((t=>t.position)))||void 0===e?void 0:e.position)||"fixed",parent:(null===(i=t.find((t=>t.parent)))||void 0===i?void 0:i.parent)||null,tooltipSpace:(null===(n=t.find((t=>t.tooltipSpace)))||void 0===n?void 0:n.tooltipSpace)||Pr}}}),_r=new WeakMap,Xr=_i.fromClass(class{constructor(t){this.view=t,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(Cr);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new $r(t,Tr,(t=>this.createTooltip(t))),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout((()=>{this.measureTimeout=-1,this.maybeMeasure()}),50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t);e&&this.observeIntersection();let i=e||t.geometryChanged,n=t.state.facet(Cr);if(n.position!=this.position){this.position=n.position;for(let t of this.manager.tooltipViews)t.dom.style.position=this.position;i=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let t of this.manager.tooltipViews)this.container.appendChild(t.dom);i=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure()}createTooltip(t){let e=t.create(this.view);if(e.dom.classList.add("cm-tooltip"),t.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",e.dom.appendChild(t)}return e.dom.style.position=this.position,e.dom.style.top=Qr,this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var t,e;this.view.win.removeEventListener("resize",this.measureSoon);for(let e of this.manager.tooltipViews)e.dom.remove(),null===(t=e.destroy)||void 0===t||t.call(e);null===(e=this.intersectionObserver)||void 0===e||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=this.view.dom.getBoundingClientRect();return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map(((t,e)=>{let i=this.manager.tooltipViews[e];return i.getCoords?i.getCoords(t.pos):this.view.coordsAtPos(t.pos)})),size:this.manager.tooltipViews.map((({dom:t})=>t.getBoundingClientRect())),space:this.view.state.facet(Cr).tooltipSpace(this.view)}}writeMeasure(t){var e;let{editor:i,space:n}=t,s=[];for(let r=0;r=Math.min(i.bottom,n.bottom)||h.rightMath.min(i.right,n.right)+.1){l.style.top=Qr;continue}let u=o.arrow?a.dom.querySelector(".cm-tooltip-arrow"):null,d=u?7:0,f=c.right-c.left,p=null!==(e=_r.get(a))&&void 0!==e?e:c.bottom-c.top,O=a.offset||Ar,g=this.view.textDirection==Wi.LTR,m=c.width>n.right-n.left?g?n.left:n.right-c.width:g?Math.min(h.left-(u?14:0)+O.x,n.right-f):Math.max(n.left,h.left-f+(u?14:0)-O.x),b=!!o.above;!o.strictSide&&(b?h.top-(c.bottom-c.top)-O.yn.bottom)&&b==n.bottom-h.bottom>h.top-n.top&&(b=!b);let w=(b?h.top-n.top:n.bottom-h.bottom)-d;if(wm&&t.topv&&(v=b?t.top-p-2-d:t.bottom+d+2);"absolute"==this.position?(l.style.top=v-t.parent.top+"px",l.style.left=m-t.parent.left+"px"):(l.style.top=v+"px",l.style.left=m+"px"),u&&(u.style.left=h.left+(g?O.x:-O.x)-(m+14-7)+"px"),!0!==a.overlap&&s.push({left:m,top:v,right:y,bottom:v+p}),l.classList.toggle("cm-tooltip-above",b),l.classList.toggle("cm-tooltip-below",!b),a.positioned&&a.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=Qr}},{eventHandlers:{scroll(){this.maybeMeasure()}}}),Zr=Ts.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Ar={x:0,y:0},Tr=E.define({enables:[Xr,Zr]});function Rr(t,e){let i=t.plugin(Xr);if(!i)return null;let n=i.manager.tooltips.indexOf(e);return n<0?null:i.manager.tooltipViews[n]}const Er=E.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 Vr(t,e){let i=t.plugin(Mr),n=i?i.specs.indexOf(e):-1;return n>-1?i.panels[n]:null}const Mr=_i.fromClass(class{constructor(t){this.input=t.state.facet(Ur),this.specs=this.input.filter((t=>t)),this.panels=this.specs.map((e=>e(t)));let e=t.state.facet(Er);this.top=new Dr(t,!0,e.topContainer),this.bottom=new Dr(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(Er);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Dr(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Dr(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(Ur);if(i!=this.input){let e=i.filter((t=>t)),n=[],s=[],r=[],o=[];for(let i of e){let e,a=this.specs.indexOf(i);a<0?(e=i(t.view),o.push(e)):(e=this.panels[a],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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}}))});class Dr{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=Wr(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=Wr(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 Wr(t){let e=t.nextSibling;return t.remove(),e}const Ur=E.define({enables:Mr});class Yr extends Qt{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Yr.prototype.elementClass="",Yr.prototype.toDOM=void 0,Yr.prototype.mapMode=S.TrackBefore,Yr.prototype.startSide=Yr.prototype.endSide=-1,Yr.prototype.point=!0;const qr=E.define(),Lr={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>_t.empty,lineMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},zr=E.define();function Ir(t){return[jr(),zr.of(Object.assign(Object.assign({},Lr),t))]}const Br=E.define({combine:t=>t.some((t=>t))});function jr(t){let e=[Nr];return t&&!1===t.fixed&&e.push(Br.of(!0)),e}const Nr=_i.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+"px",this.gutters=t.state.facet(zr).map((e=>new Jr(t,e)));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!t.state.facet(Br),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(Br)!=!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=_t.iter(this.view.state.facet(qr),this.view.viewport.from),n=[],s=this.gutters.map((t=>new Hr(t,this.view.viewport,-this.view.documentPadding.top)));for(let t of this.view.viewportLineBlocks){let e;if(Array.isArray(t.type)){for(let i of t.type)if(i.type==ii.Text){e=i;break}}else e=t.type==ii.Text?t:void 0;if(e){n.length&&(n=[]),Fr(i,n,t.from);for(let t of s)t.line(this.view,e,n)}}for(let t of s)t.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(zr),i=t.state.facet(zr),n=t.docChanged||t.heightChanged||t.viewportChanged||!_t.eq(t.startState.facet(qr),t.state.facet(qr),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 Jr(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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&0!=i.gutters.length&&i.fixed?e.textDirection==Wi.LTR?{left:i.dom.offsetWidth}:{right:i.dom.offsetWidth}:null}))});function Gr(t){return Array.isArray(t)?t:[t]}function Fr(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class Hr{constructor(t,e,i){this.gutter=t,this.height=i,this.i=0,this.cursor=_t.iter(t.markers,e.from)}line(t,e,i){let n=[];Fr(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;if(0==n.length&&!r.config.renderEmptyElements)return;let o=e.top-this.height;if(this.i==r.elements.length){let i=new Kr(t,e.height,o,n);r.elements.push(i),r.dom.appendChild(i.dom)}else r.elements[this.i].update(t,e.height,o,n);this.height=e.bottom,this.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 Jr{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=Gr(e.markers(t)),e.initialSpacer&&(this.spacer=new Kr(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=Gr(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!_t.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 Kr{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.dom.style.height=(this.height=e)+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),function(t,e){if(t.length!=e.length)return!1;for(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 io extends Yr{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function no(t,e){return t.state.facet(eo).formatNumber(e,t.state)}const so=zr.compute([eo],(t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:t=>t.state.facet(to),lineMarker:(t,e,i)=>i.some((t=>t.toDOM))?null:new io(no(t,t.state.doc.lineAt(e.from).number)),lineMarkerChange:t=>t.startState.facet(eo)!=t.state.facet(eo),initialSpacer:t=>new io(no(t,ro(t.state.doc.lines))),updateSpacer(t,e){let i=no(e.view,ro(e.view.state.doc.lines));return i==t.number?t:new io(i)},domEventHandlers:t.facet(eo).domEventHandlers})));function ro(t){let e=9;for(;e{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=fo.match(t)),e=>{let i=t(e);return void 0===i?null:[this,i]}}}ho.closedBy=new ho({deserialize:t=>t.split(" ")}),ho.openedBy=new ho({deserialize:t=>t.split(" ")}),ho.group=new ho({deserialize:t=>t.split(" ")}),ho.contextHash=new ho({perNode:!0}),ho.lookAhead=new ho({perNode:!0}),ho.mounted=new ho({perNode:!0});class co{constructor(t,e,i){this.tree=t,this.overlay=e,this.parser=i}}const uo=Object.create(null);class fo{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):uo,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),n=new fo(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(ho.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(ho.group),n=-1;n<(i?i.length:0);n++){let s=e[n<0?t.name:i[n]];if(s)return s}}}}fo.none=new fo("",Object.create(null),0,8);class po{constructor(t){this.types=t;for(let e=0;e=n&&(r.type.isAnonymous||!1!==e(r))){if(r.firstChild())continue;t=!0}for(;t&&i&&!r.type.isAnonymous&&i(r),!r.nextSibling();){if(!r.parent())return;t=!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:To(fo.none,this.children,this.positions,0,this.children.length,0,this.length,((t,e,i)=>new bo(this.type,t,e,i,this.propValues)),t.makeTree||((t,e,i)=>new bo(fo.none,t,e,i)))}static build(t){return function(t){var e;let{buffer:i,nodeSet:n,maxBufferLength:s=oo,reused:r=[],minRepeatType:o=n.types.length}=t,a=Array.isArray(i)?new wo(i,i.length):i,l=n.types,h=0,c=0;function u(t,e,i,m,b){let{id:w,start:v,end:y,size:S}=a,x=c;for(;S<0;){if(a.next(),-1==S){let e=r[w];return i.push(e),void m.push(v-t)}if(-3==S)return void(h=w);if(-4==S)return void(c=w);throw new RangeError(`Unrecognized record size: ${S}`)}let k,Q,$=l[w],P=v-t;if(y-v<=s&&(Q=O(a.pos-e,b))){let e=new Uint16Array(Q.size-Q.skip),i=a.pos-Q.size,s=e.length;for(;a.pos>i;)s=g(Q.start,e,s);k=new vo(e,y-Q.start,n),P=Q.start-t}else{let t=a.pos-S;a.next();let e=[],i=[],n=w>=o?w:-1,r=0,l=y;for(;a.pos>t;)n>=0&&a.id==n&&a.size>=0?(a.end<=l-s&&(f(e,i,v,r,a.end,l,n,x),r=e.length,l=a.end),a.next()):u(v,t,e,i,n);if(n>=0&&r>0&&r-1&&r>0){let t=d($);k=To($,e,i,0,e.length,0,y-v,t,t)}else k=p($,e,i,y-v,x-y)}i.push(k),m.push(P)}function d(t){return(e,i,n)=>{let s,r,o=0,a=e.length-1;if(a>=0&&(s=e[a])instanceof bo){if(!a&&s.type==t&&s.length==n)return s;(r=s.prop(ho.lookAhead))&&(o=i[a]+s.length+r)}return p(t,e,i,n,o)}}function f(t,e,i,s,r,o,a,l){let h=[],c=[];for(;t.length>s;)h.push(t.pop()),c.push(e.pop()+i-r);t.push(p(n.types[a],h,c,o-r,l-o)),e.push(r-i)}function p(t,e,i,n,s=0,r){if(h){let t=[ho.contextHash,h];r=r?[t].concat(r):[t]}if(s>25){let t=[ho.lookAhead,s];r=r?[t].concat(r):[t]}return new bo(t,e,i,n,r)}function O(t,e){let i=a.fork(),n=0,r=0,l=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=l,l+=4,n+=4,i.next();continue}let a=i.pos-t;if(t<0||a=o?4:0,d=i.start;for(i.next();i.pos>a;){if(i.size<0){if(-3!=i.size)break t;u+=4}else i.id>=o&&(u+=4);i.next()}r=d,n+=t,l+=u}return(e<0||n==t)&&(c.size=n,c.start=r,c.skip=l),c.size>4?c:void 0}function g(t,e,i){let{id:n,start:s,end:r,size:l}=a;if(a.next(),l>=0&&n4){let n=a.pos-(l-4);for(;a.pos>n;)i=g(t,e,i)}e[--i]=o,e[--i]=r-t,e[--i]=s-t,e[--i]=n}else-3==l?h=n:-4==l&&(c=n);return i}let m=[],b=[];for(;a.pos>0;)u(t.start||0,t.bufferStart||0,m,b,-1);let w=null!==(e=t.length)&&void 0!==e?e:m.length?b[0]+m[0].length:0;return new bo(l[t.topID],m.reverse(),b.reverse(),w)}(t)}}bo.empty=new bo(fo.none,[],[],0);class wo{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 wo(this.buffer,this.index)}}class vo{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return fo.none}toString(){let t=[];for(let e=0;e0));a=r[a+3]);return o}slice(t,e,i){let n=this.buffer,s=new Uint16Array(e-t),r=0;for(let o=t,a=0;o=e&&ie;case 1:return i<=e&&n>e;case 2:return n>e;case 4:return!0}}function So(t,e){let i=t.childBefore(e);for(;i;){let e=i.lastChild;if(!e||e.to!=i.to)break;e.type.isError&&e.from==e.to?(t=i,i=e.prevSibling):i=e}return t}function xo(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!=l;t+=e){let l=o[t],h=a[t]+r.from;if(yo(n,i,h,h+l.length))if(l instanceof vo){if(s&mo.ExcludeBuffers)continue;let o=l.findChild(0,l.buffer.length,e,i-h,n);if(o>-1)return new Co(new Po(r,l,t,h),null,o)}else if(s&mo.IncludeAnonymous||!l.type.isAnonymous||Xo(l)){let o;if(!(s&mo.IgnoreMounts)&&l.props&&(o=l.prop(ho.mounted))&&!o.overlay)return new ko(o.tree,h,t,r);let a=new ko(l,h,t,r);return s&mo.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(e<0?l.children.length-1:0,e,i,n)}}if(s&mo.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&mo.IgnoreOverlays)&&(n=this._tree.prop(ho.mounted))&&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 ko(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}cursor(t=0){return new _o(this,t)}get tree(){return this._tree}toTree(){return this._tree}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return So(this,t)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}toString(){return this._tree.toString()}get node(){return this}matchContext(t){return $o(this,t)}}function Qo(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 $o(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 Po{constructor(t,e,i,n){this.parent=t,this.buffer=e,this.index=i,this.start=n}}class Co{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){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 Co(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&mo.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 Co(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 Co(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 Co(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}cursor(t=0){return new _o(this,t)}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 bo(this.type,t,e,this.to-this.from)}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return So(this,t)}toString(){return this.context.buffer.childString(this.index)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}get node(){return this}matchContext(t){return $o(this,t)}}class _o{get name(){return this.type.name}constructor(t,e=0){if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof ko)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let e=t._parent;e;e=e._parent)this.stack.unshift(e.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return!!t&&(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0)}yieldBuf(t,e){this.index=t;let{start:i,buffer:n}=this.buffer;return this.type=e||n.set.types[n.buffer[t]],this.from=i+n.buffer[t+1],this.to=i+n.buffer[t+2],!0}yield(t){return!!t&&(t instanceof ko?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,i){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,i,this.mode));let{buffer:n}=this.buffer,s=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.buffer.start,i);return!(s<0)&&(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,i=this.mode){return this.buffer?!(i&mo.ExcludeBuffers)&&this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&mo.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&mo.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode));let{buffer:e}=this.buffer,i=this.stack.length-1;if(t<0){let t=i<0?0:this.stack[i]+4;if(this.index!=t)return this.yieldBuf(e.findChild(t,this.index,-1,0,4))}else{let t=e.buffer[this.index+3];if(t<(i<0?e.buffer.length:e.buffer[this.stack[i]+3]))return this.yieldBuf(t)}return i<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,i,{buffer:n}=this;if(n){if(t>0){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&mo.IncludeAnonymous||t instanceof vo||!t.type.isAnonymous||Xo(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 $o(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 Xo(t){return t.children.some((t=>t instanceof vo||!t.type.isAnonymous||Xo(t)))}const Zo=new WeakMap;function Ao(t,e){if(!t.isAnonymous||e instanceof vo||e.type!=t)return 1;let i=Zo.get(e);if(null==i){i=1;for(let n of e.children){if(n.type!=t||!(n instanceof bo)){i=1;break}i+=Ao(t,n)}Zo.set(e,i)}return i}function To(t,e,i,n,s,r,o,a,l){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]+a);continue}u.push(i[s])}else{let e=n[h-1]+i[h-1].length-f;u.push(To(t,i,n,s,h,f,e,null,l))}d.push(f+a-r)}}(e,i,n,s,0),(a||l)(u,d,o)}class Ro{constructor(){this.map=new WeakMap}setBuffer(t,e,i){let n=this.map.get(t);n||this.map.set(t,n=new Map),n.set(e,i)}getBuffer(t,e){let i=this.map.get(t);return i&&i.get(e)}set(t,e){t instanceof Co?this.setBuffer(t.context.buffer,t.index,e):t instanceof ko&&this.map.set(t.tree,e)}get(t){return t instanceof Co?this.getBuffer(t.context.buffer,t.index):t instanceof ko?this.map.get(t.tree):void 0}cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}}class Eo{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 Eo(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,a=0,l=0;;o++){let h=o=i)for(;r&&r.from=e.from||c<=e.to||l){let t=Math.max(e.from,a)-l,i=Math.min(e.to,c)-l;e=t>=i?null:new Eo(t,i,e.tree,e.offset+l,o>0,!!h)}if(e&&n.push(e),r.to>c)break;r=snew lo(t.from,t.to))):[new lo(0,0)]:[new lo(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 Mo{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)}}function Do(t){return(e,i,n,s)=>new qo(e,t,i,n,s)}class Wo{constructor(t,e,i,n,s){this.parser=t,this.parse=e,this.overlay=i,this.target=n,this.ranges=s}}class Uo{constructor(t,e,i,n,s,r,o){this.parser=t,this.predicate=e,this.mounts=i,this.index=n,this.start=s,this.target=r,this.prev=o,this.depth=0,this.ranges=[]}}const Yo=new ho({perNode:!0});class qo{constructor(t,e,i,n,s){this.nest=e,this.input=i,this.fragments=n,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=t}advance(){if(this.baseParse){let t=this.baseParse.advance();if(!t)return null;if(this.baseParse=null,this.baseTree=t,this.startInner(),null!=this.stoppedAt)for(let t of this.inner)t.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let t=this.baseTree;return null!=this.stoppedAt&&(t=new bo(t.type,t.children,t.positions,t.length,t.propValues.concat([[Yo,this.stoppedAt]]))),t}let t=this.inner[this.innerDone],e=t.parse.advance();if(e){this.innerDone++;let i=Object.assign(Object.create(null),t.target.props);i[ho.mounted.id]=new co(e,t.overlay,t.parser),t.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let t=this.input.length;for(let e=this.innerDone;et.frag.from<=n.from&&t.frag.to>=n.to&&t.mount.overlay));if(t)for(let i of t.mount.overlay){let s=i.from+t.pos,r=i.to+t.pos;s>=n.from&&r<=n.to&&!e.ranges.some((t=>t.froms))&&e.ranges.push({from:s,to:r})}}a=!1}else if(i&&(r=Lo(i.ranges,n.from,n.to)))a=2!=r;else if(!n.type.isAnonymous&&n.fromnew lo(t.from-n.from,t.to-n.from))):null,n.tree,t)),s.overlay?t.length&&(i={ranges:t,depth:0,prev:i}):a=!1}}else e&&(o=e.predicate(n))&&(!0===o&&(o=new lo(n.from,n.to)),o.fromnew lo(t.from-e.start,t.to-e.start))),e.target,t)),e=e.prev}i&&! --i.depth&&(i=i.prev)}}}}function Lo(t,e,i){for(let n of t){if(n.from>=i)break;if(n.to>e)return n.from<=e&&n.to>=i?2:1}return 0}function zo(t,e,i,n,s,r){if(e=e.to);n++);let o=s.children[n],a=o.buffer;s.children[n]=function t(i,n,s,l,h){let c=i;for(;a[c+2]+r<=e.from;)c=a[c+3];let u=[],d=[];zo(o,i,c,u,d,l);let f=a[c+1],p=a[c+2],O=f+r==e.from&&p+r==e.to&&a[c]==e.type.id;return u.push(O?e.toTree():t(c+4,a[c+3],o.set.types[a[c]],f,p-f)),d.push(f-l),zo(o,a[c+3],n,u,d,l),new bo(s,u,d,h)}(0,a.length,fo.none,0,o.length);for(let n=0;n<=i;n++)t.childAfter(e.from)}class Bo{constructor(t,e){this.offset=e,this.done=!1,this.cursor=t.cursor(mo.IncludeAnonymous|mo.IgnoreMounts)}moveTo(t){let{cursor:e}=this,i=t-this.offset;for(;!this.done&&e.from=t&&e.enter(i,1,mo.IgnoreOverlays|mo.ExcludeBuffers)||e.next(!1)||(this.done=!0)}hasNode(t){if(this.moveTo(t.from),!this.done&&this.cursor.from+this.offset==t.from&&this.cursor.tree)for(let e=this.cursor.tree;;){if(e==t.tree)return!0;if(!(e.children.length&&0==e.positions[0]&&e.children[0]instanceof bo))break;e=e.children[0]}return!1}}let jo=class{constructor(t){var e;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){let i=this.curFrag=t[0];this.curTo=null!==(e=i.tree.prop(Yo))&&void 0!==e?e:i.to,this.inner=new Bo(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t)}nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=null!==(t=e.tree.prop(Yo))&&void 0!==t?t:e.to,this.inner=new Bo(e.tree,-e.offset)}}findMounts(t,e){var i;let n=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let t=this.inner.cursor.node;t;t=t.parent){let s=null===(i=t.tree)||void 0===i?void 0:i.prop(ho.mounted);if(s&&s.parser==e)for(let e=this.fragI;e=t.to)break;i.tree==this.curFrag.tree&&n.push({frag:i,pos:t.from-i.offset,mount:s})}}}return n}};function No(t,e){let i=null,n=e;for(let s=1,r=0;s=a)break;t.to<=o||(i||(n=i=e.slice()),t.froma&&i.splice(r+1,0,new lo(a,t.to))):t.to>a?i[r--]=new lo(a,t.to):i.splice(r--,1))}}return n}function Go(t,e,i,n){let s=0,r=0,o=!1,a=!1,l=-1e9,h=[];for(;;){let c=s==t.length?1e9:o?t[s].to:t[s].from,u=r==e.length?1e9:a?e[r].to:e[r].from;if(o!=a){let t=Math.max(l,i),e=Math.min(c,u,n);tnew lo(t.from+n,t.to+n))),a,l);for(let e=0,n=a;;e++){let a=e==o.length,h=a?l:o[e].from;if(h>n&&i.push(new Eo(n,h,s.tree,-t,r.from>=n||r.openStart,r.to<=h||r.openEnd)),a)break;n=o[e].to}}else i.push(new Eo(a,l,s.tree,-t,r.from>=t||r.openStart,r.to<=o||r.openEnd))}return i}let Ho=0;class Jo{constructor(t,e,i){this.set=t,this.base=e,this.modified=i,this.id=Ho++}static define(t){if(null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let e=new Jo([],null,[]);if(e.set.push(e),t)for(let i of t.set)e.set.push(i);return e}static defineModifier(){let t=new ta;return e=>e.modified.indexOf(t)>-1?e:ta.get(e.base||e,e.modified.concat(t).sort(((t,e)=>t.id-e.id)))}}let Ko=0;class ta{constructor(){this.instances=[],this.id=Ko++}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 Jo(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(ta.get(e,t));return s}}function ea(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,a=i[o];if(!a)throw new RangeError("Invalid path: "+t);let l=new na(n,s,o>0?i.slice(0,o):null);e[a]=l.sort(e[a])}}return ia.add(e)}const ia=new ho;class na{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 ra(t,e,i,n=0,s=t.length){let r=new oa(n,Array.isArray(e)?e:[e],i);r.highlightRange(t.cursor(),n,s,"",r.highlighters),r.flush(s)}na.empty=new na([],2,null);class oa{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:a}=t;if(o>=i||a<=e)return;r.isTop&&(s=this.highlighters.filter((t=>!t.scope||t.scope(r))));let l=n,h=function(t){let e=t.type.prop(ia);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}(t)||na.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&&(l&&(l+=" "),l+=c,1==h.mode&&(n+=(n?" ":"")+c)),this.startSpan(t.from,l),h.opaque)return;let u=t.tree&&t.tree.prop(ho.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 d=0,f=o;;d++){let p=d=O)&&t.nextSibling()););if(!p||O>i)break;f=p.to+o,f>e&&(this.highlightRange(r.cursor(),Math.max(e,p.from+o),Math.min(i,f),n,h),this.startSpan(f,l))}c&&t.parent()}else if(t.firstChild()){do{if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,n,s),this.startSpan(Math.min(i,t.to),l)}}while(t.nextSibling());t.parent()}}}const aa=Jo.define,la=aa(),ha=aa(),ca=aa(ha),ua=aa(ha),da=aa(),fa=aa(da),pa=aa(da),Oa=aa(),ga=aa(Oa),ma=aa(),ba=aa(),wa=aa(),va=aa(wa),ya=aa(),Sa={comment:la,lineComment:aa(la),blockComment:aa(la),docComment:aa(la),name:ha,variableName:aa(ha),typeName:ca,tagName:aa(ca),propertyName:ua,attributeName:aa(ua),className:aa(ha),labelName:aa(ha),namespace:aa(ha),macroName:aa(ha),literal:da,string:fa,docString:aa(fa),character:aa(fa),attributeValue:aa(fa),number:pa,integer:aa(pa),float:aa(pa),bool:aa(da),regexp:aa(da),escape:aa(da),color:aa(da),url:aa(da),keyword:ma,self:aa(ma),null:aa(ma),atom:aa(ma),unit:aa(ma),modifier:aa(ma),operatorKeyword:aa(ma),controlKeyword:aa(ma),definitionKeyword:aa(ma),moduleKeyword:aa(ma),operator:ba,derefOperator:aa(ba),arithmeticOperator:aa(ba),logicOperator:aa(ba),bitwiseOperator:aa(ba),compareOperator:aa(ba),updateOperator:aa(ba),definitionOperator:aa(ba),typeOperator:aa(ba),controlOperator:aa(ba),punctuation:wa,separator:aa(wa),bracket:va,angleBracket:aa(va),squareBracket:aa(va),paren:aa(va),brace:aa(va),content:Oa,heading:ga,heading1:aa(ga),heading2:aa(ga),heading3:aa(ga),heading4:aa(ga),heading5:aa(ga),heading6:aa(ga),contentSeparator:aa(Oa),list:aa(Oa),quote:aa(Oa),emphasis:aa(Oa),strong:aa(Oa),link:aa(Oa),monospace:aa(Oa),strikethrough:aa(Oa),inserted:aa(),deleted:aa(),changed:aa(),invalid:aa(),meta:ya,documentMeta:aa(ya),annotation:aa(ya),processingInstruction:aa(ya),definition:Jo.defineModifier(),constant:Jo.defineModifier(),function:Jo.defineModifier(),standard:Jo.defineModifier(),local:Jo.defineModifier(),special:Jo.defineModifier()};var xa;sa([{tag:Sa.link,class:"tok-link"},{tag:Sa.heading,class:"tok-heading"},{tag:Sa.emphasis,class:"tok-emphasis"},{tag:Sa.strong,class:"tok-strong"},{tag:Sa.keyword,class:"tok-keyword"},{tag:Sa.atom,class:"tok-atom"},{tag:Sa.bool,class:"tok-bool"},{tag:Sa.url,class:"tok-url"},{tag:Sa.labelName,class:"tok-labelName"},{tag:Sa.inserted,class:"tok-inserted"},{tag:Sa.deleted,class:"tok-deleted"},{tag:Sa.literal,class:"tok-literal"},{tag:Sa.string,class:"tok-string"},{tag:Sa.number,class:"tok-number"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],class:"tok-string2"},{tag:Sa.variableName,class:"tok-variableName"},{tag:Sa.local(Sa.variableName),class:"tok-variableName tok-local"},{tag:Sa.definition(Sa.variableName),class:"tok-variableName tok-definition"},{tag:Sa.special(Sa.variableName),class:"tok-variableName2"},{tag:Sa.definition(Sa.propertyName),class:"tok-propertyName tok-definition"},{tag:Sa.typeName,class:"tok-typeName"},{tag:Sa.namespace,class:"tok-namespace"},{tag:Sa.className,class:"tok-className"},{tag:Sa.macroName,class:"tok-macroName"},{tag:Sa.propertyName,class:"tok-propertyName"},{tag:Sa.operator,class:"tok-operator"},{tag:Sa.comment,class:"tok-comment"},{tag:Sa.meta,class:"tok-meta"},{tag:Sa.invalid,class:"tok-invalid"},{tag:Sa.punctuation,class:"tok-punctuation"}]);const ka=new ho;function Qa(t){return E.define({combine:t?e=>e.concat(t):void 0})}const $a=new ho;class Pa{constructor(t,e,i=[],n=""){this.data=t,this.name=n,xt.prototype.hasOwnProperty("tree")||Object.defineProperty(xt.prototype,"tree",{get(){return Xa(this)}}),this.parser=e,this.extension=[Wa.of(this),xt.languageData.of(((t,e,i)=>{let n=Ca(t,e,i),s=n.type.prop(ka);if(!s)return[];let r=t.facet(s),o=n.type.prop($a);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 Ca(t,e,i).type.prop(ka)==this.data}findRegions(t){let e=t.facet(Wa);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(ka)==this.data)return void i.push({from:e,to:e+t.length});let s=t.prop(ho.mounted);if(s){if(s.tree.prop(ka)==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;it.isTop?e:void 0))]}),t.name)}configure(t,e){return new _a(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Xa(t){let e=t.field(Pa.state,!1);return e?e.tree:bo.empty}class Za{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let i=this.cursorPos-this.string.length;return t=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i)}}let Aa=null;class Ta{constructor(t,e,i=[],n,s,r,o,a){this.parser=t,this.state=e,this.fragments=i,this.tree=n,this.treeLen=s,this.viewport=r,this.skipped=o,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(t,e,i){return new Ta(t,e,[],bo.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Za(this.state.doc),this.fragments)}work(t,e){return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=bo.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(Eo.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Aa;Aa=this;try{return t()}finally{Aa=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=Ra(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=Eo.applyChanges(i,e),n=bo.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=Ra(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 Vo{createParse(e,i,n){let s=n[0].from,r=n[n.length-1].to;return{parsedPos:s,advance(){let e=Aa;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 bo(fo.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 Aa}}function Ra(t,e,i){return Eo.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class Ea{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 Ea(e)}static init(t){let e=Math.min(3e3,t.doc.length),i=Ta.create(t.facet(Wa).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new Ea(i)}}Pa.state=q.define({create:Ea.init,update(t,e){for(let t of e.effects)if(t.is(Pa.setState))return t.value;return e.startState.facet(Wa)!=e.state.facet(Wa)?Ea.init(e.state):t.apply(e)}});let Va=t=>{let e=setTimeout((()=>t()),500);return()=>clearTimeout(e)};"undefined"!=typeof requestIdleCallback&&(Va=t=>{let e=-1,i=setTimeout((()=>{e=requestIdleCallback(t,{timeout:400})}),100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const Ma="undefined"!=typeof navigator&&(null===(xa=navigator.scheduling)||void 0===xa?void 0:xa.isInputPending)?()=>navigator.scheduling.isInputPending():null,Da=_i.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(Pa.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),t.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(Pa.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=Va(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEndn+1e3,a=s.context.work((()=>Ma&&Ma()||Date.now()>r),n+(o?0:1e5));this.chunkBudget-=Date.now()-e,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Pa.setState.of(new Ea(s.context))})),this.chunkBudget>0&&(!a||o)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then((()=>this.scheduleWork())).catch((t=>Qi(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()}}}),Wa=E.define({combine:t=>t.length?t[0]:null,enables:t=>[Pa.state,Da,Ts.contentAttributes.compute([t],(e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}}))]});class Ua{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}class Ya{constructor(t,e,i,n,s,r=void 0){this.name=t,this.alias=e,this.extensions=i,this.filename=n,this.loadFunc=s,this.support=r,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then((t=>this.support=t),(t=>{throw this.loading=null,t})))}static of(t){let{load:e,support:i}=t;if(!e){if(!i)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");e=()=>Promise.resolve(i)}return new Ya(t.name,(t.alias||[]).concat(t.name).map((t=>t.toLowerCase())),t.extensions||[],t.filename,e,i)}static matchFilename(t,e){for(let i of t)if(i.filename&&i.filename.test(e))return i;let i=/\.([^.]+)$/.exec(e);if(i)for(let e of t)if(e.extensions.indexOf(i[1])>-1)return e;return null}static matchLanguageName(t,e,i=!0){e=e.toLowerCase();for(let i of t)if(i.alias.some((t=>t==e)))return i;if(i)for(let i of t)for(let t of i.alias){let n=e.indexOf(t);if(n>-1&&(t.length>2||!/\w/.test(e[n-1])&&!/\w/.test(e[n+t.length])))return i}return null}}const qa=E.define(),La=E.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 za(t){let e=t.facet(La);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function Ia(t,e){let i="",n=t.tabSize,s=t.facet(La)[0];if("\t"==s){for(;e>=n;)i+="\t",e-=n;s=" "}for(let t=0;t=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 Yt(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 Na=new ho;function Ga(t){let e=t.type.prop(Na);if(e)return e;let i,n=t.firstChild;if(n&&(i=n.type.prop(ho.closedBy))){let e=t.lastChild,n=e&&i.indexOf(e.name)>-1;return t=>el(t,!0,1,void 0,n&&!function(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}(t)?e.from:void 0)}return null==t.parent?Ha:null}function Fa(t,e,i){for(;t;t=t.parent){let n=Ga(t);if(n)return n(Ja.create(i,e,t))}return null}function Ha(){return 0}class Ja extends ja{constructor(t,e,i){super(t.state,t.options),this.base=t,this.pos=e,this.node=i}static create(t,e,i){return new Ja(t,e,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){let t=this.state.doc.lineAt(this.node.from);for(;;){let e=this.node.resolve(t.from);for(;e.parent&&e.parent.from==e.from;)e=e.parent;if(Ka(e,this.node))break;t=this.state.doc.lineAt(e.from)}return this.lineIndent(t.from)}continue(){let t=this.node.parent;return t?Fa(t,this.pos,this.base):0}}function Ka(t,e){for(let i=e;i;i=i.parent)if(t==i)return!0;return!1}function tl({closing:t,align:e=!0,units:i=1}){return n=>el(n,e,i,t)}function el(t,e,i,n,s){let r=t.textAfter,o=r.match(/^\s*/)[0].length,a=n&&r.slice(o,o+n.length)==n||s==t.pos+o,l=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.from{let n=t&&t.test(i.textAfter);return i.baseIndent+(n?0:e*i.unit)}}function nl(){return xt.transactionFilter.of((t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let i=t.newDoc,{head:n}=t.newSelection.main,s=i.lineAt(n);if(n>s.from+200)return t;let r=i.sliceString(s.from,n);if(!e.some((t=>t.test(r))))return t;let{state:o}=t,a=-1,l=[];for(let{head:t}of o.selection.ranges){let e=o.doc.lineAt(t);if(e.from==a)continue;a=e.from;let i=Ba(o,e.from);if(null==i)continue;let n=/^\s*/.exec(e.text)[0],s=Ia(o,i);n!=s&&l.push({from:e.from,to:e.from+n.length,insert:s})}return l.length?[t,{changes:l,sequential:!0}]:t}))}const sl=E.define(),rl=new ho;function ol(t){let e=t.firstChild,i=t.lastChild;return e&&e.toi)continue;if(s&&r.from=e&&n.to>i&&(s=n)}}return s}(t,e,i)}function hl(t,e){let i=e.mapPos(t.from,1),n=e.mapPos(t.to,-1);return i>=n?void 0:{from:i,to:n}}const cl=ut.define({map:hl}),ul=ut.define({map:hl}),dl=q.define({create:()=>ni.none,update(t,e){t=t.map(e.changes);for(let i of e.effects)i.is(cl)&&!pl(t,i.value.from,i.value.to)?t=t.update({add:[bl.range(i.value.from,i.value.to)]}):i.is(ul)&&(t=t.update({filter:(t,e)=>i.value.from!=t||i.value.to!=e,filterFrom:i.value.from,filterTo:i.value.to}));if(e.selection){let i=!1,{head:n}=e.selection.main;t.between(n,n,((t,e)=>{tn&&(i=!0)})),i&&(t=t.update({filterFrom:n,filterTo:n,filter:(t,e)=>e<=n||t>=n}))}return t},provide:t=>Ts.decorations.from(t),toJSON(t,e){let i=[];return t.between(0,e.doc.length,((t,e)=>{i.push(t,e)})),i},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let i=0;i{(!s||s.from>t)&&(s={from:t,to:e})})),s}function pl(t,e,i){let n=!1;return t.between(e,e,((t,s)=>{t==e&&s==i&&(n=!0)})),n}const Ol={placeholderDOM:null,placeholderText:"…"},gl=E.define({combine:t=>kt(t,Ol)});function ml(t){let e=[dl,yl];return t&&e.push(gl.of(t)),e}const bl=ni.replace({widget:new class extends ei{toDOM(t){let{state:e}=t,i=e.facet(gl),n=e=>{let i=t.lineBlockAt(t.posAtDOM(e.target)),n=fl(t.state,i.from,i.to);n&&t.dispatch({effects:ul.of(n)}),e.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(t,n);let s=document.createElement("span");return s.textContent=i.placeholderText,s.setAttribute("aria-label",e.phrase("folded code")),s.title=e.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=n,s}}}),wl={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class vl extends Yr{constructor(t,e){super(),this.config=t,this.open=e}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let e=document.createElement("span");return e.textContent=this.open?this.config.openText:this.config.closedText,e.title=t.state.phrase(this.open?"Fold line":"Unfold line"),e}}const yl=Ts.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Sl{constructor(t,e){let i;function n(t){let e=It.newName();return(i||(i=Object.create(null)))["."+e]=t,e}this.specs=t;const s="string"==typeof e.all?e.all:e.all?n(e.all):void 0,r=e.scope;this.scope=r instanceof Pa?t=>t.prop(ka)==r.data:r?t=>t==r:void 0,this.style=sa(t.map((t=>({tag:t.tag,class:t.class||n(Object.assign({},t,{tag:null}))}))),{all:s}).style,this.module=i?new It(i):null,this.themeType=e.themeType}static define(t,e){return new Sl(t,e||{})}}const xl=E.define(),kl=E.define({combine:t=>t.length?[t[0]]:null});function Ql(t){let e=t.facet(xl);return e.length?e:t.facet(kl)}function $l(t,e){let i,n=[Cl];return t instanceof Sl&&(t.module&&n.push(Ts.styleModule.of(t.module)),i=t.themeType),(null==e?void 0:e.fallback)?n.push(kl.of(t)):i?n.push(xl.computeN([Ts.darkTheme],(e=>e.facet(Ts.darkTheme)==("dark"==i)?[t]:[]))):n.push(xl.of(t)),n}class Pl{constructor(t){this.markCache=Object.create(null),this.tree=Xa(t.state),this.decorations=this.buildDeco(t,Ql(t.state))}update(t){let e=Xa(t.state),i=Ql(t.state),n=i!=Ql(t.startState);e.length{i.add(t,e,this.markCache[n]||(this.markCache[n]=ni.mark({class:n})))}),n,s);return i.finish()}}const Cl=N.high(_i.fromClass(Pl,{decorations:t=>t.decorations})),_l=Sl.define([{tag:Sa.meta,color:"#404740"},{tag:Sa.link,textDecoration:"underline"},{tag:Sa.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Sa.emphasis,fontStyle:"italic"},{tag:Sa.strong,fontWeight:"bold"},{tag:Sa.strikethrough,textDecoration:"line-through"},{tag:Sa.keyword,color:"#708"},{tag:[Sa.atom,Sa.bool,Sa.url,Sa.contentSeparator,Sa.labelName],color:"#219"},{tag:[Sa.literal,Sa.inserted],color:"#164"},{tag:[Sa.string,Sa.deleted],color:"#a11"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],color:"#e40"},{tag:Sa.definition(Sa.variableName),color:"#00f"},{tag:Sa.local(Sa.variableName),color:"#30a"},{tag:[Sa.typeName,Sa.namespace],color:"#085"},{tag:Sa.className,color:"#167"},{tag:[Sa.special(Sa.variableName),Sa.macroName],color:"#256"},{tag:Sa.definition(Sa.propertyName),color:"#00c"},{tag:Sa.comment,color:"#940"},{tag:Sa.invalid,color:"#f00"}]),Xl=Ts.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Zl=1e4,Al="()[]{}",Tl=E.define({combine:t=>kt(t,{afterCursor:!0,brackets:Al,maxScanDistance:Zl,renderMatch:Vl})}),Rl=ni.mark({class:"cm-matchingBracket"}),El=ni.mark({class:"cm-nonmatchingBracket"});function Vl(t){let e=[],i=t.matched?Rl:El;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 Ml=q.define({create:()=>ni.none,update(t,e){if(!e.docChanged&&!e.selection)return t;let i=[],n=e.state.facet(Tl);for(let t of e.state.selection.ranges){if(!t.empty)continue;let s=Ll(e.state,t.head,-1,n)||t.head>0&&Ll(e.state,t.head-1,1,n)||n.afterCursor&&(Ll(e.state,t.head,1,n)||t.headTs.decorations.from(t)}),Dl=[Ml,Xl];function Wl(t={}){return[Tl.of(t),Dl]}const Ul=new ho;function Yl(t,e,i){let n=t.prop(e<0?ho.openedBy:ho.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 ql(t){let e=t.type.prop(Ul);return e?e(t.node):t}function Ll(t,e,i,n={}){let s=n.maxScanDistance||Zl,r=n.brackets||Al,o=Xa(t),a=o.resolveInner(e,i);for(let n=a;n;n=n.parent){let s=Yl(n.type,i,r);if(s&&n.from0?e>=o.from&&eo.from&&e<=o.to))return zl(t,e,i,n,o,s,r)}}return function(t,e,i,n,s,r,o){let a=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%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 a=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(a+t,1).type!=s))if(e%2==0==i>0)u++;else{if(1==u)return{start:h,end:{from:a+t,to:a+t+1},matched:e>>1==l>>1};u--}}i>0&&(t+=r.length)}return c.done?{start:h,matched:!1}:null}(t,e,i,o,a.type,s,r)}function zl(t,e,i,n,s,r,o){let a=n.parent,l={from:s.from,to:s.to},h=0,c=null==a?void 0:a.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 jl(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 Nl=new WeakMap;class Gl extends Pa{constructor(t){let e,i=Qa(t.languageData),n={name:(s=t).name||"",token:s.token,blankLine:s.blankLine||(()=>{}),startState:s.startState||(()=>!0),copyState:s.copyState||jl,indent:s.indent||(()=>null),languageData:s.languageData||{},tokenTable:s.tokenTable||th};var s;super(i,new class extends Vo{createParse(t,i,n){return new Jl(e,t,i,n)}},[qa.of(((t,e)=>this.getIndent(t,e)))],t.name),this.topNode=function(t){let e=fo.define({id:eh.length,name:"Document",props:[ka.add((()=>t))]});return eh.push(e),e}(i),e=this,this.streamParser=n,this.stateAfter=new ho({perNode:!0}),this.tokenTable=t.tokenTable?new rh(n.tokenTable):oh}static define(t){return new Gl(t)}getIndent(t,e){let i,n=Xa(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=Nl.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],a=i+e.positions[r],l=o instanceof bo&&a=e.length)return e;s||e.type!=t.topNode||(s=!0);for(let r=e.children.length-1;r>=0;r--){let o,a=e.positions[r],l=e.children[r];if(ai&&Fl(t,n.tree,0-n.offset,i,r);if(o&&(e=Hl(t,n.tree,i+n.offset,o.pos+n.offset,!1)))return{state:o.state,tree:e}}return{state:t.streamParser.startState(n?za(n):4),tree:bo.empty}}(t,i,r,null==s?void 0:s.state);this.state=o,this.parsedPos=this.chunkStart=r+a.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 Bl(e,t?t.state.tabSize:4,t?za(t.state):2);if(r.eol())s.blankLine(this.state,r.indentUnit);else for(;!r.eol();){let t=Kl(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 th=Object.create(null),eh=[fo.none],ih=new po(eh),nh=[],sh=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"]])sh[t]=lh(th,e);class rh{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),sh)}resolve(t){return t?this.table[t]||(this.table[t]=lh(this.extra,t)):0}}const oh=new rh(th);function ah(t,e){nh.indexOf(t)>-1||(nh.push(t),console.warn(e))}function lh(t,e){let i=null;for(let n of e.split(".")){let e=t[n]||Sa[n];e?"function"==typeof e?i?i=e(i):ah(n,`Modifier ${n} used at start of tag`):i?ah(n,`Tag ${n} used as modifier`):i=e:ah(n,`Unknown highlighting tag ${n}`)}if(!i)return 0;let n=e.replace(/ /g,"_"),s=fo.define({id:eh.length,name:n,props:[ea({[n]:i})]});return eh.push(s),s.id}function hh(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 ch=hh(gh,0),uh=hh(Oh,0),dh=hh(((t,e)=>Oh(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 fh(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}const ph=50;function Oh(t,e,i=e.selection.ranges){let n=i.map((t=>fh(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,a=t.sliceDoc(n-ph,n),l=t.sliceDoc(s,s+ph),h=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(l)[0].length,u=a.length-h;if(a.slice(u-e.length,u)==e&&l.slice(c,c+i.length)==i)return{open:{pos:n-h,margin:h&&1},close:{pos:s+c,margin:c&&1}};s-n<=2*ph?r=o=t.sliceDoc(n,s):(r=t.sliceDoc(n,n+ph),o=t.sliceDoc(s-ph,s));let d=/^\s*/.exec(r)[0].length,f=/\s*$/.exec(o)[0].length,p=o.length-f-i.length;return r.slice(d,d+e.length)==e&&o.slice(p,p+i.length)==i?{open:{pos:n+d+e.length,margin:/\s/.test(r.charAt(d+e.length))?1:0},close:{pos:s-f-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>l.from)){s=l.from;let t=/^\s*/.exec(l.text)[0].length,e=t==l.length,i=l.text.slice(t,t+a.length)==a?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 mh=lt.define(),bh=lt.define(),wh=E.define(),vh=E.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)})});const yh=q.define({create:()=>Dh.empty,update(t,e){let i=e.state.facet(vh),n=e.annotation(mh);if(n){let s=e.docChanged?A.single(function(t){let e=0;return t.iterChangedRanges(((t,i)=>e=i)),e}(e.changes)):void 0,r=Ch.fromTransaction(e,s),o=n.side,a=0==o?t.undone:t.done;return a=r?_h(a,a.length,i.minDepth,r):Th(a,e.startState.selection),new Dh(0==o?n.rest:a,0==o?a:n.rest)}let s=e.annotation(bh);if("full"!=s&&"before"!=s||(t=t.isolate()),!1===e.annotation(dt.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);let r=Ch.fromTransaction(e),o=e.annotation(dt.time),a=e.annotation(dt.userEvent);return r?t=t.addChanges(r,o,a,i,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,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 Dh(t.done.map(Ch.fromJSON),t.undone.map(Ch.fromJSON))});function Sh(t={}){return[yh,vh.of(t),Ts.domEventHandlers({beforeinput(t,e){let i="historyUndo"==t.inputType?kh:"historyRedo"==t.inputType?Qh:null;return!!i&&(t.preventDefault(),i(e))}})]}function xh(t,e){return function({state:i,dispatch:n}){if(!e&&i.readOnly)return!1;let s=i.field(yh,!1);if(!s)return!1;let r=s.pop(t,i,e);return!!r&&(n(r),!0)}}const kh=xh(0,!1),Qh=xh(1,!1),$h=xh(0,!0),Ph=xh(1,!0);class Ch{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 Ch(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 Ch(t.changes&&k.fromJSON(t.changes),[],t.mapped&&x.fromJSON(t.mapped),t.startSelection&&A.fromJSON(t.startSelection),t.selectionsAfter.map(A.fromJSON))}static fromTransaction(t,e){let i=Zh;for(let e of t.startState.facet(wh)){let n=e(t);n.length&&(i=i.concat(n))}return!i.length&&t.changes.empty?null:new Ch(t.changes.invert(t.startState.doc),i,void 0,e||t.startState.selection,Zh)}static selection(t){return new Ch(void 0,Zh,void 0,void 0,t)}}function _h(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 Xh(t,e){return t.length?e.length?t.concat(e):t:e}const Zh=[],Ah=200;function Th(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-Ah));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),_h(t,t.length-1,1e9,i.setSelAfter(n)))}return[Ch.selection([e])]}function Rh(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 Eh(t,e){if(!t.length)return t;let i=t.length,n=Zh;for(;i;){let s=Vh(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?[Ch.selection(n)]:Zh}function Vh(t,e,i){let n=Xh(t.selectionsAfter.length?t.selectionsAfter.map((t=>t.map(e))):Zh,i);if(!t.changes)return Ch.selection(n);let s=t.changes.map(e),r=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(r):r;return new Ch(s,ut.mapEffects(t.effects,e),o,t.startSelection.map(r),n)}const Mh=/^(input\.type|delete)($|\.)/;class Dh{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 Dh(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||Mh.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)?_h(r,r.length-1,n.minDepth,new Ch(t.changes.compose(o.changes),Xh(t.effects,o.effects),o.mapped,o.startSelection,Zh)):_h(r,r.length,n.minDepth,t),new Dh(r,Zh,e,i)}addSelection(t,e,i,n){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Zh;return s.length>0&&e-this.prevTimet.empty!=o.ranges[e].empty)).length)?this:new Dh(Th(this.done,t),this.undone,e,i);var r,o}addMapping(t){return new Dh(Eh(this.done,t),Eh(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:mh.of({side:t,rest:Rh(n)}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let i=1==n.length?Zh:n.slice(0,n.length-1);return s.mapped&&(i=Eh(i,s.mapped)),e.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:mh.of({side:t,rest:i}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}}Dh.empty=new Dh(Zh,Zh);const Wh=[{key:"Mod-z",run:kh,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Qh,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Qh,preventDefault:!0},{key:"Mod-u",run:$h,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Ph,preventDefault:!0}];function Uh(t,e){return A.create(t.ranges.map(e),t.mainIndex)}function Yh(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function qh({state:t,dispatch:e},i){let n=Uh(t.selection,i);return!n.eq(t.selection)&&(e(Yh(t,n)),!0)}function Lh(t,e){return A.cursor(e?t.to:t.from)}function zh(t,e){return qh(t,(i=>i.empty?t.moveByChar(i,e):Lh(i,e)))}function Ih(t){return t.textDirectionAt(t.state.selection.main.head)==Wi.LTR}const Bh=t=>zh(t,!Ih(t)),jh=t=>zh(t,Ih(t));function Nh(t,e){return qh(t,(i=>i.empty?t.moveByGroup(i,e):Lh(i,e)))}function Gh(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 Fh(t,e,i){let n,s,r=Xa(t).resolveInner(e.head),o=i?ho.closedBy:ho.openedBy;for(let n=e.head;;){let e=i?r.childAfter(n):r.childBefore(n);if(!e)break;Gh(t,e,o)?r=e:n=i?e.to:e.from}return s=r.type.prop(o)&&(n=i?Ll(t,r.from,1):Ll(t,r.to,-1))&&n.matched?i?n.end.to:n.end.from:i?r.to:r.from,A.cursor(s,i?-1:1)}function Hh(t,e){return qh(t,(i=>{if(!i.empty)return Lh(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)}))}const Jh=t=>Hh(t,!1),Kh=t=>Hh(t,!0);function tc(t){let e,i=t.scrollDOM.clientHeighti.empty?t.moveVertically(i,e,n.height):Lh(i,e)));if(r.eq(s.selection))return!1;if(n.selfScroll){let e=t.coordsAtPos(s.selection.main.head),o=t.scrollDOM.getBoundingClientRect(),a=o.top+n.marginTop,l=o.bottom-n.marginBottom;e&&e.top>a&&e.bottomec(t,!1),nc=t=>ec(t,!0);function sc(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=A.cursor(n.from+i))}return s}function rc(t,e){let i=Uh(t.state.selection,(t=>{let i=e(t);return A.range(t.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)}));return!i.eq(t.state.selection)&&(t.dispatch(Yh(t.state,i)),!0)}function oc(t,e){return console.log("Select!"),rc(t,(i=>t.moveByCharSelected(i,e)))}const ac=t=>oc(t,!Ih(t)),lc=t=>oc(t,Ih(t));function hc(t,e){return rc(t,(i=>t.moveByGroup(i,e)))}function cc(t,e){return rc(t,(i=>t.moveVertically(i,e)))}const uc=t=>cc(t,!1),dc=t=>cc(t,!0);function fc(t,e){return rc(t,(i=>t.moveVertically(i,e,tc(t).height)))}const pc=t=>fc(t,!1),Oc=t=>fc(t,!0),gc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:0})),!0),mc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.doc.length})),!0),bc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:0})),!0),wc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0);function vc(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=yc(t,n,!0)),s=Math.min(s,n),r=Math.max(r,n)}else s=yc(t,s,!1),r=yc(t,r,!0);return s==r?{range:n}:{changes:{from:s,to:r},range:A.cursor(s)}}));return!s.changes.empty&&(t.dispatch(n.update(s,{scrollIntoView:!0,userEvent:i,effects:"delete.selection"==i?Ts.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function yc(t,e,i){if(t instanceof Ts)for(let n of t.state.facet(Ts.atomicRanges).map((e=>e(t))))n.between(e,e,((t,n)=>{te&&(e=i?n:t)}));return e}const Sc=(t,e)=>vc(t,(i=>{let n,s,{state:r}=t,o=r.doc.lineAt(i);if(!e&&i>o.from&&iSc(t,!1),kc=t=>Sc(t,!0),Qc=(t,e)=>vc(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 a=f(r.text,n-r.from,e)+r.from,l=r.text.slice(Math.min(n,a)-r.from,Math.max(n,a)-r.from),h=o(l);if(null!=t&&h!=t)break;" "==l&&n==i||(t=h),n=a}return n})),$c=t=>Qc(t,!1),Pc=t=>vc(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 _c(t,e,i){if(t.readOnly)return!1;let n=[],s=[];for(let e of Cc(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(A.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(A.range(t.anchor-o,t.head-o))}}return!!n.length&&(e(t.update({changes:n,scrollIntoView:!0,selection:A.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0)}function Xc(t,e,i){if(t.readOnly)return!1;let n=[];for(let e of Cc(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 Zc=Ac(!1);function Ac(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),a=!e&&s==r&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i,n=Xa(t).resolveInner(e),s=n.childBefore(e),r=n.childAfter(e);return s&&r&&s.to<=e&&r.from>=e&&(i=s.type.prop(ho.closedBy))&&i.indexOf(r.name)>-1&&t.doc.lineAt(s.to).from==t.doc.lineAt(r.from).from?{from:s.to,to:r.from}:null}(i,s);e&&(s=r=(r<=o.to?o:i.doc.lineAt(r)).to);let l=new ja(i,{simulateBreak:s,simulateDoubleBreak:!!a}),h=Ba(l,s);for(null==h&&(h=/^\s*/.exec(i.doc.lineAt(s).text)[0].length);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:A.range(r.mapPos(n.anchor,1),r.mapPos(n.head,1))}}))}const Rc=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{i.push({from:e.from,insert:t.facet(La)})})),{userEvent:"input.indent"})),!0),Ec=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{let n=/^\s*/.exec(e.text)[0];if(!n)return;let s=Yt(n,t.tabSize),r=0,o=Ia(t,Math.max(0,s-za(t)));for(;rqh(t,(e=>Fh(t.state,e,!Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,!Ih(t))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:t=>qh(t,(e=>Fh(t.state,e,Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,Ih(t))))},{key:"Alt-ArrowUp",run:({state:t,dispatch:e})=>_c(t,e,!1)},{key:"Shift-Alt-ArrowUp",run:({state:t,dispatch:e})=>Xc(t,e,!1)},{key:"Alt-ArrowDown",run:({state:t,dispatch:e})=>_c(t,e,!0)},{key:"Shift-Alt-ArrowDown",run:({state:t,dispatch:e})=>Xc(t,e,!0)},{key:"Escape",run:({state:t,dispatch:e})=>{let i=t.selection,n=null;return i.ranges.length>1?n=A.create([i.main]):i.main.empty||(n=A.create([A.cursor(i.main.head)])),!!n&&(e(Yh(t,n)),!0)}},{key:"Mod-Enter",run:Ac(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:t,dispatch:e})=>{let i=Cc(t).map((({from:e,to:i})=>A.range(e,Math.min(i+1,t.doc.length))));return e(t.update({selection:A.create(i),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:t,dispatch:e})=>{let i=Uh(t.selection,(e=>{var i;let n=Xa(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 A.range(n.to,n.from)}));return e(Yh(t,i)),!0},preventDefault:!0},{key:"Mod-[",run:Ec},{key:"Mod-]",run:Rc},{key:"Mod-Alt-\\",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new ja(t,{overrideIndentation:t=>{let e=i[t];return null==e?-1:e}}),s=Tc(t,((e,s,r)=>{let o=Ba(n,e.from);if(null==o)return;/\S/.test(e.text)||(o=0);let a=/^\s*/.exec(e.text)[0],l=Ia(t,o);(a!=l||r.from{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(Cc(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=Uh(t.selection,(e=>{let s=Ll(t,e.head,-1)||Ll(t,e.head,1)||e.head>0&&Ll(t,e.head-1,1)||e.head{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=fh(t.state,i.from);return n.line?ch(t):!!n.block&&dh(t)}},{key:"Alt-A",run:uh}].concat([{key:"ArrowLeft",run:Bh,shift:ac,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:t=>Nh(t,!Ih(t)),shift:t=>hc(t,!Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:t=>qh(t,(e=>sc(t,e,!Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,!Ih(t)))),preventDefault:!0},{key:"ArrowRight",run:jh,shift:lc,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:t=>Nh(t,Ih(t)),shift:t=>hc(t,Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:t=>qh(t,(e=>sc(t,e,Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,Ih(t)))),preventDefault:!0},{key:"ArrowUp",run:Jh,shift:uc,preventDefault:!0},{mac:"Cmd-ArrowUp",run:gc,shift:bc},{mac:"Ctrl-ArrowUp",run:ic,shift:pc},{key:"ArrowDown",run:Kh,shift:dc,preventDefault:!0},{mac:"Cmd-ArrowDown",run:mc,shift:wc},{mac:"Ctrl-ArrowDown",run:nc,shift:Oc},{key:"PageUp",run:ic,shift:pc},{key:"PageDown",run:nc,shift:Oc},{key:"Home",run:t=>qh(t,(e=>sc(t,e,!1))),shift:t=>rc(t,(e=>sc(t,e,!1))),preventDefault:!0},{key:"Mod-Home",run:gc,shift:bc},{key:"End",run:t=>qh(t,(e=>sc(t,e,!0))),shift:t=>rc(t,(e=>sc(t,e,!0))),preventDefault:!0},{key:"Mod-End",run:mc,shift:wc},{key:"Enter",run:Zc},{key:"Mod-a",run:({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:xc,shift:xc},{key:"Delete",run:kc},{key:"Mod-Backspace",mac:"Alt-Backspace",run:$c},{key:"Mod-Delete",mac:"Alt-Delete",run:t=>Qc(t,!0)},{mac:"Mod-Backspace",run:t=>vc(t,(e=>{let i=t.lineBlockAt(e).from;return e>i?i:Math.max(0,e-1)}))},{mac:"Mod-Delete",run:Pc}].concat([{key:"Ctrl-b",run:Bh,shift:ac,preventDefault:!0},{key:"Ctrl-f",run:jh,shift:lc},{key:"Ctrl-p",run:Jh,shift:uc},{key:"Ctrl-n",run:Kh,shift:dc},{key:"Ctrl-a",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).from,1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).from)))},{key:"Ctrl-e",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).to,-1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).to)))},{key:"Ctrl-d",run:kc},{key:"Ctrl-h",run:xc},{key:"Ctrl-k",run:Pc},{key:"Ctrl-Alt-h",run:$c},{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:A.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:f(n.text,i-n.from,!1)+n.from,r=i==n.to?i+1:f(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:A.cursor(r)}}));return!i.changes.empty&&(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:nc}].map((t=>({mac:t.key,run:t.run,shift:t.shift})))));function Mc(){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 Uc{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(Wc(t)):Wc,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 b(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=w(t),i=this.bufferStart+this.bufferPos;this.bufferPos+=v(t);let n=this.normalize(e);for(let t=0,s=i;;t++){let r=n.charCodeAt(t),o=this.match(r,s);if(o)return this.value=o,this;if(t==n.length-1)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=jc(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 Ic(e,t.sliceString(e,i));return zc.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=jc(this.text,i+(t==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ic.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function jc(t,e){if(e>=t.length)return e;let i,n=t.lineAt(e);for(;e=56320&&i<57344;)e++;return e}function Nc(t){let e=Mc("input",{class:"cm-textfield",name:"line"});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,a,l]=i,h=a?+a.slice(1):0,c=o?+o:s.number;if(o&&l){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)));t.dispatch({effects:Gc.of(!1),selection:A.cursor(u.from+Math.max(0,Math.min(h,u.length))),scrollIntoView:!0}),t.focus()}return{dom:Mc("form",{class:"cm-gotoLine",onkeydown:e=>{27==e.keyCode?(e.preventDefault(),t.dispatch({effects:Gc.of(!1)}),t.focus()):13==e.keyCode&&(e.preventDefault(),i())},onsubmit:t=>{t.preventDefault(),i()}},Mc("label",t.state.phrase("Go to line"),": ",e)," ",Mc("button",{class:"cm-button",type:"submit"},t.state.phrase("go")))}}"undefined"!=typeof Symbol&&(Lc.prototype[Symbol.iterator]=Bc.prototype[Symbol.iterator]=function(){return this});const Gc=ut.define(),Fc=q.define({create:()=>!0,update(t,e){for(let i of e.effects)i.is(Gc)&&(t=i.value);return t},provide:t=>Ur.from(t,(t=>t?Nc:null))}),Hc=Ts.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),Jc={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Kc=E.define({combine:t=>kt(t,Jc,{highlightWordAroundCursor:(t,e)=>t||e,minSelectionLength:Math.min,maxMatches:Math.min})});function tu(t){let e=[ru,su];return t&&e.push(Kc.of(t)),e}const eu=ni.mark({class:"cm-selectionMatch"}),iu=ni.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function nu(t,e,i,n){return!(0!=i&&t(e.sliceDoc(i-1,i))==wt.Word||n!=e.doc.length&&t(e.sliceDoc(n,n+1))==wt.Word)}const su=_i.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(Kc),{state:i}=t,n=i.selection;if(n.ranges.length>1)return ni.none;let s,r=n.main,o=null;if(r.empty){if(!e.highlightWordAroundCursor)return ni.none;let t=i.wordAt(r.head);if(!t)return ni.none;o=i.charCategorizer(r.head),s=i.sliceDoc(t.from,t.to)}else{let t=r.to-r.from;if(t200)return ni.none;if(e.wholeWords){if(s=i.sliceDoc(r.from,r.to),o=i.charCategorizer(r.head),!nu(o,i,r.from,r.to)||!function(t,e,i,n){return t(e.sliceDoc(i,i+1))==wt.Word&&t(e.sliceDoc(n-1,n))==wt.Word}(o,i,r.from,r.to))return ni.none}else if(s=i.sliceDoc(r.from,r.to).trim(),!s)return ni.none}let a=[];for(let n of t.visibleRanges){let t=new Uc(i.doc,s,n.from,n.to);for(;!t.next().done;){let{from:n,to:s}=t.value;if((!o||nu(o,i,n,s))&&(r.empty&&n<=r.from&&s>=r.to?a.push(iu.range(n,s)):(n>=r.to||s<=r.from)&&a.push(eu.range(n,s)),a.length>e.maxMatches))return ni.none}}return ni.set(a)}},{decorations:t=>t.decorations}),ru=Ts.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});const ou=E.define({combine:t=>kt(t,{top:!1,caseSensitive:!1,literal:!1,wholeWord:!1,createPanel:t=>new Eu(t),scrollToMatch:t=>Ts.scrollIntoView(t)})});class au{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,qc),!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 pu(this):new cu(this)}getCursor(t,e=0,i){let n=t.doc?t:xt.create({doc:t});return null==i&&(i=n.doc.length),this.regexp?uu(this,n,e,i):hu(this,n,e,i)}}class lu{constructor(t){this.spec=t}}function hu(t,e,i,n){return new Uc(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=hu(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 uu(t,e,i,n){return new Lc(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?(s=e.charCategorizer(e.selection.main.head),(t,e,i)=>!i[0].length||(s(du(i.input,i.index))!=wt.Word||s(fu(i.input,i.index))!=wt.Word)&&(s(fu(i.input,i.index+i[0].length))!=wt.Word||s(du(i.input,i.index+i[0].length))!=wt.Word)):void 0},i,n);var s}function du(t,e){return t.slice(f(t,e,!1),e)}function fu(t,e){return t.slice(e,f(t,e))}class pu extends lu{nextMatch(t,e,i){let n=uu(this.spec,t,i,t.doc.length).next();return n.done&&(n=uu(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=uu(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=uu(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 Ou=ut.define(),gu=ut.define(),mu=q.define({create:t=>new bu(_u(t).create(),null),update(t,e){for(let i of e.effects)i.is(Ou)?t=new bu(i.value.create(),t.panel):i.is(gu)&&(t=new bu(t.query,i.value?Cu:null));return t},provide:t=>Ur.from(t,(t=>t.panel))});class bu{constructor(t,e){this.query=t,this.panel=e}}const wu=ni.mark({class:"cm-searchMatch"}),vu=ni.mark({class:"cm-searchMatch cm-searchMatch-selected"}),yu=_i.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(mu))}update(t){let e=t.state.field(mu);(e!=t.startState.field(mu)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ni.none;let{view:i}=this,n=new Xt;for(let e=0,s=i.visibleRanges,r=s.length;es[e+1].from-500;)a=s[++e].to;t.highlight(i.state,o,a,((t,e)=>{let s=i.state.selection.ranges.some((i=>i.from==t&&i.to==e));n.add(t,e,s?vu:wu)}))}return n.finish()}},{decorations:t=>t.decorations});function Su(t){return e=>{let i=e.state.field(mu,!1);return i&&i.query.spec.valid?t(e,i):Au(e)}}const xu=Su(((t,{query:e})=>{let{to:i}=t.state.selection.main,n=e.nextMatch(t.state,i,i);if(!n)return!1;let s=A.single(n.from,n.to),r=t.state.facet(ou);return t.dispatch({selection:s,effects:[Wu(t,n),r.scrollToMatch(s.main,t)],userEvent:"select.search"}),Zu(t),!0})),ku=Su(((t,{query:e})=>{let{state:i}=t,{from:n}=i.selection.main,s=e.prevMatch(i,n,n);if(!s)return!1;let r=A.single(s.from,s.to),o=t.state.facet(ou);return t.dispatch({selection:r,effects:[Wu(t,s),o.scrollToMatch(r.main,t)],userEvent:"select.search"}),Zu(t),!0})),Qu=Su(((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!(!i||!i.length)&&(t.dispatch({selection:A.create(i.map((t=>A.range(t.from,t.to)))),userEvent:"select.search.matches"}),!0)})),$u=Su(((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,a,l=[],h=[];if(r.from==n&&r.to==s&&(a=i.toText(e.getReplacement(r)),l.push({from:r.from,to:r.to,insert:a}),r=e.nextMatch(i,r.from,r.to),h.push(Ts.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(n).number)+"."))),r){let e=0==l.length||l[0].from>=r.to?0:r.to-r.from-a.length;o=A.single(r.from-e,r.to-e),h.push(Wu(t,r)),h.push(i.facet(ou).scrollToMatch(o.main,t))}return t.dispatch({changes:l,selection:o,effects:h,userEvent:"input.replace"}),!0})),Pu=Su(((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:Ts.announce.of(n),userEvent:"input.replace.all"}),!0}));function Cu(t){return t.state.facet(ou).createPanel(t)}function _u(t,e){var i,n,s,r;let o=t.selection.main,a=o.empty||o.to>o.from+100?"":t.sliceDoc(o.from,o.to);if(e&&!a)return e;let l=t.facet(ou);return new au({search:(null!==(i=null==e?void 0:e.literal)&&void 0!==i?i:l.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:null!==(n=null==e?void 0:e.caseSensitive)&&void 0!==n?n:l.caseSensitive,literal:null!==(s=null==e?void 0:e.literal)&&void 0!==s?s:l.literal,wholeWord:null!==(r=null==e?void 0:e.wholeWord)&&void 0!==r?r:l.wholeWord})}function Xu(t){let e=Vr(t,Cu);return e&&e.dom.querySelector("[main-field]")}function Zu(t){let e=Xu(t);e&&e==t.root.activeElement&&e.select()}const Au=t=>{let e=t.state.field(mu,!1);if(e&&e.panel){let i=Xu(t);if(i&&i!=t.root.activeElement){let n=_u(t.state,e.query.spec);n.valid&&t.dispatch({effects:Ou.of(n)}),i.focus(),i.select()}}else t.dispatch({effects:[gu.of(!0),e?Ou.of(_u(t.state,e.query.spec)):ut.appendConfig.of(Yu)]});return!0},Tu=t=>{let e=t.state.field(mu,!1);if(!e||!e.panel)return!1;let i=Vr(t,Cu);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:gu.of(!1)}),!0},Ru=[{key:"Mod-f",run:Au,scope:"editor search-panel"},{key:"F3",run:xu,shift:ku,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:xu,shift:ku,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Tu,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 Uc(t.doc,t.sliceDoc(n,s));!e.next().done;){if(r.length>1e3)return!1;e.value.from==n&&(o=r.length),r.push(A.range(e.value.from,e.value.to))}return e(t.update({selection:A.create(r,o),userEvent:"select.search.matches"})),!0}},{key:"Alt-g",run:t=>{let e=Vr(t,Nc);if(!e){let i=[Gc.of(!0)];null==t.state.field(Fc,!1)&&i.push(ut.appendConfig.of([Fc,Hc])),t.dispatch({effects:i}),e=Vr(t,Nc)}return e&&e.dom.querySelector("input").focus(),!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=A.create(i.ranges.map((e=>t.wordAt(e.head)||A.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 Uc(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 Uc(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(A.range(s.from,s.to),!1),effects:Ts.scrollIntoView(s.to)})),!0)},preventDefault:!0}];class Eu{constructor(t){this.view=t;let e=this.query=t.state.field(mu).query.spec;function i(t,e,i){return Mc("button",{class:"cm-button",name:t,onclick:e,type:"button"},i)}this.commit=this.commit.bind(this),this.searchField=Mc("input",{value:e.search,placeholder:Vu(t,"Find"),"aria-label":Vu(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Mc("input",{value:e.replace,placeholder:Vu(t,"Replace"),"aria-label":Vu(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Mc("input",{type:"checkbox",name:"case",form:"",checked:e.caseSensitive,onchange:this.commit}),this.reField=Mc("input",{type:"checkbox",name:"re",form:"",checked:e.regexp,onchange:this.commit}),this.wordField=Mc("input",{type:"checkbox",name:"word",form:"",checked:e.wholeWord,onchange:this.commit}),this.dom=Mc("div",{onkeydown:t=>this.keydown(t),class:"cm-search"},[this.searchField,i("next",(()=>xu(t)),[Vu(t,"next")]),i("prev",(()=>ku(t)),[Vu(t,"previous")]),i("select",(()=>Qu(t)),[Vu(t,"all")]),...t.state.readOnly?[]:[Mc("br"),this.replaceField,i("replace",(()=>$u(t)),[Vu(t,"replace")]),i("replaceAll",(()=>Pu(t)),[Vu(t,"replace all")])],Mc("button",{name:"close",onclick:()=>Tu(t),"aria-label":Vu(t,"close"),type:"button"},["×"])])}commit(){let t=new au({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:Ou.of(t)}))}keydown(t){var e,i,n;e=this.view,i=t,n="search-panel",Bs(Ls(e.state),i,e,n)?t.preventDefault():13==t.keyCode&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?ku:xu)(this.view)):13==t.keyCode&&t.target==this.replaceField&&(t.preventDefault(),$u(this.view))}update(t){for(let e of t.transactions)for(let t of e.effects)t.is(Ou)&&!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(ou).top}}function Vu(t,e){return t.state.phrase(e)}const Mu=30,Du=/[\s\.,:;?!]/;function Wu(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-Mu),o=Math.min(s,i+Mu),a=t.state.sliceDoc(r,o);if(r!=n.from)for(let t=0;ta.length-Mu;t--)if(!Du.test(a[t-1])&&Du.test(a[t])){a=a.slice(0,t);break}return Ts.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${n.number}.`)}const Uu=Ts.baseTheme({".cm-panel.cm-search":{padding:"0.25rem 0.5rem 0.25rem 0.5rem",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"0.5rem",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"}}),Yu=[mu,N.lowest(yu),Uu];class qu{constructor(t,e,i){this.state=t,this.pos=e,this.explicit=i,this.abortListeners=[]}tokenBefore(t){let e=Xa(this.state).resolveInner(this.pos,-1);for(;e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null}matchBefore(t){let e=this.state.doc.lineAt(this.pos),i=Math.max(e.from,this.pos-250),n=e.text.slice(i-e.from,this.pos-e.from),s=n.search(ju(t,!1));return s<0?null:{from:i+s,to:this.pos,text:n.slice(s)}}get aborted(){return null==this.abortListeners}addEventListener(t,e){"abort"==t&&this.abortListeners&&this.abortListeners.push(e)}}function Lu(t){let e=Object.keys(t).join(""),i=/\w/.test(e);return i&&(e=e.replace(/\w/g,"")),`[${i?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function zu(t){let e=t.map((t=>"string"==typeof t?{label:t}:t)),[i,n]=e.every((t=>/^\w+$/.test(t.label)))?[/\w*$/,/\w+$/]:function(t){let e=Object.create(null),i=Object.create(null);for(let{label:n}of t){e[n[0]]=!0;for(let t=1;t{let s=t.matchBefore(n);return s||t.explicit?{from:s?s.from:t.pos,options:e,validFor:i}:null}}class Iu{constructor(t,e,i,n){this.completion=t,this.source=e,this.match=i,this.score=n}}function Bu(t){return t.selection.main.from}function ju(t,e){var i;let{source:n}=t,s=e&&"^"!=n[0],r="$"!=n[n.length-1];return s||r?new RegExp(`${s?"^":""}(?:${n})${r?"$":""}`,null!==(i=t.flags)&&void 0!==i?i:t.ignoreCase?"i":""):t}const Nu=lt.define();const Gu=new WeakMap;function Fu(t){if(!Array.isArray(t))return t;let e=Gu.get(t);return e||Gu.set(t,e=zu(t)),e}const Hu=ut.define(),Ju=ut.define();class Ku{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[];for(let e=0;e=48&&l<=57||l>=97&&l<=122?2:l>=65&&l<=90?1:0:(y=w(l))!=y.toLowerCase()?1:y!=y.toUpperCase()?2:0;(!n||1==S&&O||0==m&&0!=S)&&(e[c]==l||i[c]==l&&(u=!0)?r[c++]=n:r.length&&(g=!1)),m=S,n+=v(l)}return c==a&&0==r[0]&&g?this.result((u?-200:0)-100,r,t):d==a&&0==f?[-200-t.length+(p==t.length?0:-100),0,p]:o>-1?[-700-t.length,o,o+this.pattern.length]:d==a?[-900-t.length,f,p]:c==a?this.result((u?-200:0)-100-700+(g?0:-1100),r,t):2==e.length?null:this.result((n[0]?-700:0)-200-1100,n,t)}result(t,e,i){let n=[t-i.length],s=1;for(let t of e){let e=t+(this.astral?v(b(i,t)):1);s>1&&n[s-1]==t?n[s-1]=e:(n[s++]=t,n[s++]=e)}return n}}const td=E.define({combine:t=>kt(t,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:id,compareCompletions:(t,e)=>t.label.localeCompare(e.label),interactionDelay:75},{defaultKeymap:(t,e)=>t&&e,closeOnBlur:(t,e)=>t&&e,icons:(t,e)=>t&&e,tooltipClass:(t,e)=>i=>ed(t(i),e(i)),optionClass:(t,e)=>i=>ed(t(i),e(i)),addToOptions:(t,e)=>t.concat(e)})});function ed(t,e){return t?e?t+" "+e:t:e}function id(t,e,i,n,s){let r,o,a=t.textDirection==Wi.RTL,l=a,h=!1,c="top",u=e.left-s.left,d=s.right-e.right,f=n.right-n.left,p=n.bottom-n.top;if(l&&u=p||t>e.top?r=i.bottom-e.top:(c="bottom",r=e.bottom-i.top)}return{style:`${c}: ${r}px; max-width: ${o}px`,class:"cm-completionInfo-"+(h?a?"left-narrow":"right-narrow":l?"left":"right")}}function nd(t,e="option"){return i=>{let n=i.state.field(yd,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp-1?n.open.selected+r*(t?1:-1):t?0:o-1;return a<0?a="page"==e?0:o-1:a>=o&&(a="page"==e?o-1:0),i.dispatch({effects:vd.of(a)}),!0}}const sd=t=>{let e=t.state.field(yd,!1);return!(t.state.readOnly||!e||!e.open||e.open.selected<0||Date.now()-e.open.timestamp(t.selection||t.docChanged)&&!gd(t)));for(let e=0;e50&&Date.now()-n.time>1e3){for(let t of n.context.abortListeners)try{t()}catch(t){Qi(this.view.state,t)}n.context.abortListeners=null,this.running.splice(e--,1)}else n.updates.push(...t.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some((t=>1==t.state&&!this.running.some((e=>e.active.source==t.source))))?setTimeout((()=>this.startUpdate()),50):-1,0!=this.composing)for(let e of t.transactions)"input"==gd(e)?this.composing=2:2==this.composing&&e.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:t}=this.view,e=t.field(yd);for(let t of e.active)1!=t.state||this.running.some((e=>e.active.source==t.source))||this.startQuery(t)}startQuery(t){let{state:e}=this.view,i=Bu(e),n=new qu(e,i,t.explicitPos==i),s=new rd(t,n);this.running.push(s),Promise.resolve(t.source(n)).then((t=>{s.context.aborted||(s.done=t||null,this.scheduleAccept())}),(t=>{this.view.dispatch({effects:Ju.of(null)}),Qi(this.view.state,t)}))}scheduleAccept(){this.running.every((t=>void 0!==t.done))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((()=>this.accept()),50))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],i=this.view.state.facet(td);for(let n=0;nt.source==s.active.source));if(r&&1==r.state)if(null==s.done){let t=new md(s.active.source,0);for(let e of s.updates)t=t.update(e,i);1!=t.state&&e.push(t)}else this.startQuery(r)}e.length&&this.view.dispatch({effects:wd.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(yd,!1);if(e&&e.tooltip&&this.view.state.facet(td).closeOnBlur){let i=e.open&&Rr(this.view,e.open.tooltip);i&&i.dom.contains(t.relatedTarget)||this.view.dispatch({effects:Ju.of(null)})}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout((()=>this.view.dispatch({effects:Hu.of(!1)})),20),this.composing=0}}});function ad(t,e){const i=e.completion.apply||e.completion.label;let n=t.state.field(yd).active.find((t=>t.source==e.source));return n instanceof bd&&("string"==typeof i?t.dispatch(Object.assign(Object.assign({},function(t,e,i,n){let{main:s}=t.selection,r=i-s.from,o=n-s.from;return Object.assign(Object.assign({},t.changeByRange((a=>a!=s&&i!=n&&t.sliceDoc(a.from+r,a.from+o)!=t.sliceDoc(i,n)?{range:a}:{changes:{from:a.from+r,to:n==s.from?a.to:a.from+o,insert:e},range:A.cursor(a.from+r+e.length)}))),{userEvent:"input.complete"})}(t.state,i,n.from,n.to)),{annotations:Nu.of(e.completion)})):i(t,e.completion,n.from,n.to),!0)}function ld(t,e,i){if(t<=i)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let t=Math.floor(e/i);return{from:t*i,to:(t+1)*i}}let n=Math.floor((t-e)/i);return{from:t-(n+1)*i,to:t-n*i}}class hd{constructor(t,e){this.view=t,this.stateField=e,this.info=null,this.placeInfoReq={read:()=>this.measureInfo(),write:t=>this.placeInfo(t),key:this},this.space=null,this.currentClass="";let i=t.state.field(e),{options:n,selected:s}=i.open,r=t.state.facet(td);this.optionContent=function(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(t){let e=document.createElement("div");return e.classList.add("cm-completionIcon"),t.type&&e.classList.add(...t.type.split(/\s+/g).map((t=>"cm-completionIcon-"+t))),e.setAttribute("aria-hidden","true"),e},position:20}),e.push({render(t,e,i){let n=document.createElement("span");n.className="cm-completionLabel";let{label:s}=t,r=0;for(let t=1;tr&&n.appendChild(document.createTextNode(s.slice(r,e)));let a=n.appendChild(document.createElement("span"));a.appendChild(document.createTextNode(s.slice(e,o))),a.className="cm-completionMatchedText",r=o}return rt.position-e.position)).map((t=>t.render))}(r),this.optionClass=r.optionClass,this.tooltipClass=r.tooltipClass,this.range=ld(n.length,s,r.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",(e=>{for(let i,s=e.target;s&&s!=this.dom;s=s.parentNode)if("LI"==s.nodeName&&(i=/-(\d+)$/.exec(s.id))&&+i[1]{let i=t.state.field(this.stateField,!1);i&&i.tooltip&&t.state.facet(td).closeOnBlur&&e.relatedTarget!=t.contentDOM&&t.dispatch({effects:Ju.of(null)})})),this.list=this.dom.appendChild(this.createListBox(n,i.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))}mount(){this.updateSel()}update(t){var e,i,n;let s=t.state.field(this.stateField),r=t.startState.field(this.stateField);this.updateTooltipClass(t.state),s!=r&&(this.updateSel(),(null===(e=s.open)||void 0===e?void 0:e.disabled)!=(null===(i=r.open)||void 0===i?void 0:i.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!(null===(n=s.open)||void 0===n?void 0:n.disabled)))}updateTooltipClass(t){let e=this.tooltipClass(t);if(e!=this.currentClass){for(let t of this.currentClass.split(" "))t&&this.dom.classList.remove(t);for(let t of e.split(" "))t&&this.dom.classList.add(t);this.currentClass=e}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),e=t.open;if((e.selected>-1&&e.selected=this.range.to)&&(this.range=ld(e.options.length,e.selected,this.view.state.facet(td).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e.options,t.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))),this.updateSelectedOption(e.selected)){this.info&&(this.info.remove(),this.info=null);let{completion:i}=e.options[e.selected],{info:n,label:s,c:r}=i;if(!n)return;let o="string"==typeof n?document.createTextNode(n+" "):n(i);if(!o)return;if(!r){const t=document.createElement("span");t.appendChild(o),o=t;const e=document.createElement("a");e.innerText="🔎",e.href="/docFind/"+s,e.target="blank",o.appendChild(e)}if(!o)return;"then"in o?o.then((e=>{e&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(e)})).catch((t=>Qi(this.view.state,t,"completion info"))):this.addInfoPane(o)}}addInfoPane(t){let e=this.info=document.createElement("div");e.className="cm-tooltip cm-completionInfo",e.appendChild(t),this.dom.appendChild(e),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let e=null;for(let i=this.list.firstChild,n=this.range.from;i;i=i.nextSibling,n++)"LI"==i.nodeName&&i.id?n==t?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),e=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected"):n--;return e&&function(t,e){let i=t.getBoundingClientRect(),n=e.getBoundingClientRect();n.topi.bottom&&(t.scrollTop+=n.bottom-i.bottom)}(this.list,e),e}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let e=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),n=t.getBoundingClientRect(),s=this.space;if(!s){let t=this.dom.ownerDocument.defaultView||window;s={left:0,top:0,right:t.innerWidth,bottom:t.innerHeight}}return n.top>Math.min(s.bottom,e.bottom)-10||n.bottomi.from||0==i.from))if(s=t,"string"!=typeof l&&l.header)n.appendChild(l.header(l));else{n.appendChild(document.createElement("completion-section")).textContent=t}}const h=n.appendChild(document.createElement("li"));h.id=e+"-"+r,h.setAttribute("role","option");let c=this.optionClass(o);c&&(h.className=c);for(let t of this.optionContent){let e=t(o,this.view.state,a);e&&h.appendChild(e)}}return i.from&&n.classList.add("cm-completionListIncompleteTop"),i.to=this.options.length?this:new ud(this.options,pd(e,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,e,i,n,s){let r=function(t,e){let i=[],n=null,s=t=>{i.push(t);let{section:e}=t.completion;if(e){n||(n=[]);let t="string"==typeof e?e:e.name;n.some((e=>e.name==t))||n.push("string"==typeof e?{name:t}:e)}};for(let n of t)if(n.hasResult())if(!1===n.result.filter){let t=n.result.getMatch;for(let e of n.result.options){let r=[1e9-i.length];if(t)for(let i of t(e))r.push(i);s(new Iu(e,n.source,r,r[0]))}}else{let t,i=new Ku(e.sliceDoc(n.from,n.to));for(let e of n.result.options)(t=i.match(e.label))&&s(new Iu(e,n.source,t,t[0]+(e.boost||0)))}if(n){let t=Object.create(null),e=0,s=(t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:1e9)-(null!==(n=e.rank)&&void 0!==n?n:1e9)||(t.namee.score-t.score||a(t.completion,e.completion))))!o||o.label!=t.completion.label||o.detail!=t.completion.detail||null!=o.type&&null!=t.completion.type&&o.type!=t.completion.type||o.apply!=t.completion.apply?r.push(t):cd(t.completion)>cd(o)&&(r[r.length-1]=t),o=t.completion;return r}(t,e);if(!r.length)return n&&t.some((t=>1==t.state))?new ud(n.options,n.attrs,n.tooltip,n.timestamp,n.selected,!0):null;let o=e.facet(td).selectOnOpen?0:-1;if(n&&n.selected!=o&&-1!=n.selected){let t=n.options[n.selected].completion;for(let e=0;ee.hasResult()?Math.min(t,e.from):t),1e8),create:(a=yd,t=>new hd(t,a)),above:s.aboveCursor},n?n.timestamp:Date.now(),o,!1);var a}map(t){return new ud(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class dd{constructor(t,e,i){this.active=t,this.id=e,this.open=i}static start(){return new dd(Od,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(t){let{state:e}=t,i=e.facet(td),n=(i.override||e.languageDataAt("autocomplete",Bu(e)).map(Fu)).map((e=>(this.active.find((t=>t.source==e))||new md(e,this.active.some((t=>0!=t.state))?1:0)).update(t,i)));n.length==this.active.length&&n.every(((t,e)=>t==this.active[e]))&&(n=this.active);let s=this.open;s&&t.docChanged&&(s=s.map(t.changes)),t.selection||n.some((e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to)))||!function(t,e){if(t==e)return!0;for(let i=0,n=0;;){for(;i1==t.state))&&(s=null),!s&&n.every((t=>1!=t.state))&&n.some((t=>t.hasResult()))&&(n=n.map((t=>t.hasResult()?new md(t.source,0):t)));for(let e of t.effects)e.is(vd)&&(s=s&&s.setSelected(e.value,this.id));return n==this.active&&s==this.open?this:new dd(n,this.id,s)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:fd}}const fd={"aria-autocomplete":"list"};function pd(t,e){let i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(i["aria-activedescendant"]=t+"-"+e),i}const Od=[];function gd(t){return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null}class md{constructor(t,e,i=-1){this.source=t,this.state=e,this.explicitPos=i}hasResult(){return!1}update(t,e){let i=gd(t),n=this;i?n=n.handleUserEvent(t,i,e):t.docChanged?n=n.handleChange(t):t.selection&&0!=n.state&&(n=new md(n.source,0));for(let e of t.effects)if(e.is(Hu))n=new md(n.source,1,e.value?Bu(t.state):-1);else if(e.is(Ju))n=new md(n.source,0);else if(e.is(wd))for(let t of e.value)t.source==n.source&&(n=t);return n}handleUserEvent(t,e,i){return"delete"!=e&&i.activateOnTyping?new md(this.source,1):this.map(t.changes)}handleChange(t){return t.changes.touchesRange(Bu(t.startState))?new md(this.source,0):this.map(t.changes)}map(t){return t.empty||this.explicitPos<0?this:new md(this.source,this.state,t.mapPos(this.explicitPos))}}class bd extends md{constructor(t,e,i,n,s){super(t,2,e),this.result=i,this.from=n,this.to=s}hasResult(){return!0}handleUserEvent(t,e,i){var n;let s=t.changes.mapPos(this.from),r=t.changes.mapPos(this.to,1),o=Bu(t.state);if((this.explicitPos<0?o<=s:or||"delete"==e&&Bu(t.startState)==this.from)return new md(this.source,"input"==e&&i.activateOnTyping?1:0);let a,l=this.explicitPos<0?-1:t.changes.mapPos(this.explicitPos);return function(t,e,i,n){if(!t)return!1;let s=e.sliceDoc(i,n);return"function"==typeof t?t(s,i,n,e):ju(t,!0).test(s)}(this.result.validFor,t.state,s,r)?new bd(this.source,l,this.result,s,r):this.result.update&&(a=this.result.update(this.result,s,r,new qu(t.state,o,l>=0)))?new bd(this.source,l,a,a.from,null!==(n=a.to)&&void 0!==n?n:Bu(t.state)):new md(this.source,1,l)}handleChange(t){return t.changes.touchesRange(this.from,this.to)?new md(this.source,0):this.map(t.changes)}map(t){return t.empty?this:new bd(this.source,this.explicitPos<0?-1:t.mapPos(this.explicitPos),this.result,t.mapPos(this.from),t.mapPos(this.to,1))}}const wd=ut.define({map:(t,e)=>t.map((t=>t.map(e)))}),vd=ut.define(),yd=q.define({create:()=>dd.start(),update:(t,e)=>t.update(e),provide:t=>[Tr.from(t,(t=>t.tooltip)),Ts.contentAttributes.from(t,(t=>t.attrs))]}),Sd=Ts.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class xd{constructor(t,e,i,n){this.field=t,this.line=e,this.from=i,this.to=n}}class kd{constructor(t,e,i){this.field=t,this.from=e,this.to=i}map(t){let e=t.mapPos(this.from,-1,S.TrackDel),i=t.mapPos(this.to,1,S.TrackDel);return null==e||null==i?null:new kd(this.field,e,i)}}class Qd{constructor(t,e){this.lines=t,this.fieldPositions=e}instantiate(t,e){let i=[],n=[e],s=t.doc.lineAt(e),r=/^\s*/.exec(s.text)[0];for(let s of this.lines){if(i.length){let i=r,o=/^\t*/.exec(s)[0].length;for(let e=0;enew kd(t.field,n[t.line]+t.from,n[t.line]+t.to)));return{text:i,ranges:o}}static parse(t){let e,i=[],n=[],s=[];for(let r of t.split(/\r\n?|\n/)){for(;e=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(r);){let t=e[1]?+e[1]:null,o=e[2]||e[3]||"",a=-1;for(let e=0;e=a&&t.field++}s.push(new xd(a,n.length,e.index,e.index+o.length)),r=r.slice(0,e.index)+o+r.slice(e.index+e[0].length)}for(let t;t=/\\([{}])/.exec(r);){r=r.slice(0,t.index)+t[1]+r.slice(t.index+t[0].length);for(let e of s)e.line==n.length&&e.from>t.index&&(e.from--,e.to--)}n.push(r)}return new Qd(n,s)}}let $d=ni.widget({widget:new class extends ei{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),Pd=ni.mark({class:"cm-snippetField"});class Cd{constructor(t,e){this.ranges=t,this.active=e,this.deco=ni.set(t.map((t=>(t.from==t.to?$d:Pd).range(t.from,t.to))))}map(t){let e=[];for(let i of this.ranges){let n=i.map(t);if(!n)return null;e.push(n)}return new Cd(e,this.active)}selectionInsideField(t){return t.ranges.every((t=>this.ranges.some((e=>e.field==this.active&&e.from<=t.from&&e.to>=t.to))))}}const _d=ut.define({map:(t,e)=>t&&t.map(e)}),Xd=ut.define(),Zd=q.define({create:()=>null,update(t,e){for(let i of e.effects){if(i.is(_d))return i.value;if(i.is(Xd)&&t)return new Cd(t.ranges,i.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>Ts.decorations.from(t,(t=>t?t.deco:ni.none))});function Ad(t,e){return A.create(t.filter((t=>t.field==e)).map((t=>A.range(t.from,t.to))))}function Td(e){let i=Qd.parse(e);return(e,n,s,r)=>{let{text:o,ranges:a}=i.instantiate(e.state,s),l={changes:{from:s,to:r,insert:t.of(o)},scrollIntoView:!0,annotations:n?Nu.of(n):void 0};if(a.length&&(l.selection=Ad(a,0)),a.length>1){let t=new Cd(a,0),i=l.effects=[_d.of(t)];void 0===e.state.field(Zd,!1)&&i.push(ut.appendConfig.of([Zd,Md,Wd,Sd]))}e.dispatch(e.state.update(l))}}function Rd(t){return({state:e,dispatch:i})=>{let n=e.field(Zd,!1);if(!n||t<0&&0==n.active)return!1;let s=n.active+t,r=t>0&&!n.ranges.some((e=>e.field==s+t));return i(e.update({selection:Ad(n.ranges,s),effects:_d.of(r?null:new Cd(n.ranges,s))})),!0}}const Ed=[{key:"Tab",run:Rd(1),shift:Rd(-1)},{key:"Escape",run:({state:t,dispatch:e})=>!!t.field(Zd,!1)&&(e(t.update({effects:_d.of(null)})),!0)}],Vd=E.define({combine:t=>t.length?t[0]:Ed}),Md=N.highest(Ys.compute([Vd],(t=>t.facet(Vd))));function Dd(t,e){return Object.assign(Object.assign({},e),{apply:Td(t)})}const Wd=Ts.domEventHandlers({mousedown(t,e){let i,n=e.state.field(Zd,!1);if(!n||null==(i=e.posAtCoords({x:t.clientX,y:t.clientY})))return!1;let s=n.ranges.find((t=>t.from<=i&&t.to>=i));return!(!s||s.field==n.active)&&(e.dispatch({selection:Ad(n.ranges,s.field),effects:_d.of(n.ranges.some((t=>t.field>s.field))?new Cd(n.ranges,s.field):null)}),!0)}}),Ud=new class extends Qt{};function Yd(t={}){return[yd,td.of(t),od,Ld,Sd]}Ud.startSide=1,Ud.endSide=-1;const qd=[{key:"Ctrl-Space",run:t=>!!t.state.field(yd,!1)&&(t.dispatch({effects:Hu.of(!0)}),!0)},{key:"Escape",run:t=>{let e=t.state.field(yd,!1);return!(!e||!e.active.some((t=>0!=t.state)))&&(t.dispatch({effects:Ju.of(null)}),!0)}},{key:"ArrowDown",run:nd(!0)},{key:"ArrowUp",run:nd(!1)},{key:"PageDown",run:nd(!0,"page")},{key:"PageUp",run:nd(!1,"page")},{key:"Enter",run:sd}],Ld=N.highest(Ys.computeN([td],(t=>t.facet(td).defaultKeymap?[qd]:[]))),zd=(()=>[vr(),Sh(),ir(),$l(_l,{fallback:!0}),Ys.of([...Vc,...Wh])])();class Id{constructor(t,e,i,n,s,r,o,a,l,h=0,c){this.p=t,this.stack=e,this.state=i,this.reducePos=n,this.pos=s,this.score=r,this.buffer=o,this.bufferBase=a,this.curContext=l,this.lookAhead=h,this.parent=c}toString(){return`[${this.stack.filter(((t,e)=>e%3==0)).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,i=0){let n=t.parser.context;return new Id(t,[],e,i,i,0,[],0,n?new Bd(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let i=t>>19,n=65535&t,{parser:s}=this.p,r=s.dynamicPrecedence(n);if(r&&(this.score+=r),0==i)return this.pushState(s.getGoto(this.state,n,!0),this.reducePos),n=2e3&&!(null===(e=this.p.parser.nodeSet.types[n])||void 0===e?void 0:e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=l):this.p.lastBigReductionSizeo;)this.stack.pop();this.reduceContext(n,a)}storeNode(t,e,i,n=4,s=!1){if(0==t&&(!this.stack.length||this.stack[this.stack.length-1]0&&0==t.buffer[n-4]&&t.buffer[n-1]>-1){if(e==i)return;if(t.buffer[n-2]>=e)return void(t.buffer[n-2]=i)}}if(s&&this.pos!=i){let s=this.buffer.length;if(s>0&&0!=this.buffer[s-4])for(;s>0&&this.buffer[s-2]>i;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,n>4&&(n-=4);this.buffer[s]=t,this.buffer[s+1]=e,this.buffer[s+2]=i,this.buffer[s+3]=n}else this.buffer.push(t,e,i,n)}shift(t,e,i){let n=this.pos;if(131072&t)this.pushState(65535&t,this.pos);else if(0==(262144&t)){let s=t,{parser:r}=this.p;(i>this.pos||e<=r.maxNode)&&(this.pos=i,r.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,n),this.shiftContext(e,n),e<=r.maxNode&&this.buffer.push(e,n,i,4)}else this.pos=i,this.shiftContext(e,n),e<=this.p.parser.maxNode&&this.buffer.push(e,n,i,4)}apply(t,e,i){65536&t?this.reduce(t):this.shift(t,e,i)}useNode(t,e){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=t)&&(this.p.reused.push(t),i++);let n=this.pos;this.reducePos=this.pos=n+t.length,this.pushState(e,n),this.buffer.push(i,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let i=t.buffer.slice(e),n=t.bufferBase+e;for(;t&&n==t.bufferBase;)t=t.parent;return new Id(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,n,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let i=t<=this.p.parser.maxNode;i&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,i?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new Nd(this);;){let i=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(0==i)return!1;if(0==(65536&i))return!0;e.reduce(i)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let n,s=0;s1&e&&t==n))||i.push(e[t],n)}e=i}let i=[];for(let t=0;t>19,n=65535&t,s=this.stack.length-3*i;if(s<0||e.getGoto(this.stack[s],n,!1)<0)return!1;this.storeNode(0,this.reducePos,this.reducePos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:t}=this.p;return 65535==t.data[t.stateSlot(this.state,1)]&&!t.stateSlot(this.state,4)}restart(){this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;ethis.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Bd{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}var jd;!function(t){t[t.Insert=200]="Insert",t[t.Delete=190]="Delete",t[t.Reduce=100]="Reduce",t[t.MaxNext=4]="MaxNext",t[t.MaxInsertStackDepth=300]="MaxInsertStackDepth",t[t.DampenInsertStackDepth=120]="DampenInsertStackDepth",t[t.MinBigReduction=2e3]="MinBigReduction"}(jd||(jd={}));class Nd{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=65535&t,i=t>>19;0==i?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(i-1);let n=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=n}}class Gd{constructor(t,e,i){this.stack=t,this.pos=e,this.index=i,this.buffer=t.buffer,0==this.index&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new Gd(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;null!=t&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new Gd(this.stack,this.pos,this.index)}}function Fd(t,e=Uint16Array){if("string"!=typeof t)return t;let i=null;for(let n=0,s=0;n=92&&e--,e>=34&&e--;let s=e-32;if(s>=46&&(s-=46,i=!0),r+=s,i)break;r*=46}i?i[s++]=r:i=new e(r)}return i}class Hd{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Jd=new Hd;class Kd{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Jd,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let i=this.range,n=this.rangeIndex,s=this.pos+t;for(;si.to:s>=i.to;){if(n==this.ranges.length-1)return null;let t=this.ranges[++n];s+=t.from-i.to,i=t}return s}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,e.from);return this.end}peek(t){let e,i,n=this.chunkOff+t;if(n>=0&&n=this.chunk2Pos&&en.to&&(this.chunk2=this.chunk2.slice(0,n.to-e)),i=this.chunk2.charCodeAt(0)}}return e>=this.token.lookAhead&&(this.token.lookAhead=e+1),i}acceptToken(t,e=0){let i=e?this.resolveOffset(e,-1):this.pos;if(null==i||i=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=Jd,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let i="";for(let n of this.ranges){if(n.from>=e)break;n.to>t&&(i+=this.input.read(Math.max(n.from,t),Math.min(n.to,e)))}return i}}class tf{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:i}=e.p;sf(this.data,t,e,this.id,i.data,i.tokenPrecTable)}}tf.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class ef{constructor(t,e,i){this.precTable=e,this.elseToken=i,this.data="string"==typeof t?Fd(t):t}token(t,e){let i=t.pos,n=0;for(;sf(this.data,t,e,0,this.data,this.precTable),!(t.token.value>-1);){if(null==this.elseToken)return;if(t.next<0)break;t.advance(),t.reset(t.pos,t.token),n++}n&&(t.reset(i,t.token),t.acceptToken(this.elseToken,n))}}ef.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class nf{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function sf(t,e,i,n,s,r){let o=0,a=1<0){let i=t[n];if(l.allows(i)&&(-1==e.token.value||e.token.value==i||of(i,e.token.value,s,r))){e.acceptToken(i);break}}let n=e.next,h=0,c=t[o+2];if(!(e.next<0&&c>h&&65535==t[i+3*c-3]&&65535==t[i+3*c-3])){for(;h>1,r=i+s+(s<<1),a=t[r],l=t[r+1]||65536;if(n=l)){o=t[r+2],e.advance();continue t}h=s+1}}break}o=t[i+3*c-1]}}function rf(t,e,i){for(let n,s=e;65535!=(n=t[s]);s++)if(n==i)return s-e;return-1}function of(t,e,i,n){let s=rf(i,n,e);return s<0||rf(i,n,t)e)&&!n.type.isError)return i<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(t.length,Math.max(n.from+1,e+25));if(i<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return i<0?0:t.length}}!function(t){t[t.Margin=25]="Margin"}(hf||(hf={}));let uf=class{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?cf(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?cf(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=r,null;if(s instanceof bo){if(r==t){if(r=Math.max(this.safeFrom,t)&&(this.trees.push(s),this.start.push(r),this.index.push(0))}else this.index[e]++,this.nextStart=r+s.length}}};class df{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map((t=>new Hd))}getActions(t){let e=0,i=null,{parser:n}=t.p,{tokenizers:s}=n,r=n.stateSlot(t.state,3),o=t.curContext?t.curContext.hash:0,a=0;for(let n=0;nh.end+25&&(a=Math.max(h.lookAhead,a)),0!=h.value)){let n=e;if(h.extended>-1&&(e=this.addActions(t,h.extended,h.end,e)),e=this.addActions(t,h.value,h.end,e),!l.extend&&(i=h,e>n))break}}for(;this.actions.length>e;)this.actions.pop();return a&&t.setLookAhead(a),i||t.pos!=this.stream.end||(i=new Hd,i.value=t.p.parser.eofTerm,i.start=i.end=t.pos,e=this.addActions(t,i.value,i.end,e)),this.mainToken=i,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new Hd,{pos:i,p:n}=t;return e.start=i,e.end=Math.min(i+1,n.stream.end),e.value=i==n.stream.end?n.parser.eofTerm:0,e}updateCachedToken(t,e,i){let n=this.stream.clipPos(i.pos);if(e.token(this.stream.reset(n,t),i),t.value>-1){let{parser:e}=i.p;for(let n=0;n=0&&i.p.parser.dialect.allows(s>>1)){0==(1&s)?t.value=s>>1:t.extended=s>>1;break}}}else t.value=0,t.end=this.stream.clipPos(n+1)}putAction(t,e,i,n){for(let e=0;e4*t.bufferLength?new uf(i,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t,e,i=this.stacks,n=this.minStackPos,s=this.stacks=[];if(this.bigReductionCount>300&&1==i.length){let[t]=i;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;rn)s.push(o);else{if(this.advanceStack(o,s,i))continue;{t||(t=[],e=[]),t.push(o);let i=this.tokens.getMainToken(o);e.push(i.value,i.end)}}break}}if(!s.length){let e=t&&function(t){let e=null;for(let i of t){let t=i.p.stoppedAt;(i.pos==i.p.stream.end||null!=t&&i.pos>t)&&i.p.parser.stateFlag(i.state,2)&&(!e||e.scorethis.stoppedAt?t[0]:this.runRecovery(t,e,s);if(i)return this.stackToTree(i.forceAll())}if(this.recovering){let t=1==this.recovering?1:3*this.recovering;if(s.length>t)for(s.sort(((t,e)=>e.score-t.score));s.length>t;)s.pop();s.some((t=>t.reducePos>n))&&this.recovering--}else if(s.length>1){t:for(let t=0;t500&&n.buffer.length>500){if(!((e.score-n.score||e.buffer.length-n.buffer.length)>0)){s.splice(t--,1);continue t}s.splice(i--,1)}}}s.length>12&&s.splice(12,s.length-12)}this.minStackPos=s[0].pos;for(let t=1;t ":"";if(null!=this.stoppedAt&&n>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let e=t.curContext&&t.curContext.tracker.strict,i=e?t.curContext.hash:0;for(let o=this.fragments.nodeAt(n);o;){let n=this.parser.nodeSet.types[o.type.id]==o.type?s.getGoto(t.state,o.type.id):-1;if(n>-1&&o.length&&(!e||(o.prop(ho.contextHash)||0)==i))return t.useNode(o,n),af&&console.log(r+this.stackID(t)+` (via reuse of ${s.getName(o.type.id)})`),!0;if(!(o instanceof bo)||0==o.children.length||o.positions[0]>0)break;let a=o.children[0];if(!(a instanceof bo&&0==o.positions[0]))break;o=a}}let o=s.stateSlot(t.state,4);if(o>0)return t.reduce(o),af&&console.log(r+this.stackID(t)+` (via always-reduce ${s.getName(65535&o)})`),!0;if(t.stack.length>=15e3)for(;t.stack.length>9e3&&t.forceReduce(););let a=this.tokens.getActions(t);for(let o=0;on?e.push(d):i.push(d)}return!1}advanceFully(t,e){let i=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>i)return Of(t,e),!0}}runRecovery(t,e,i){let n=null,s=!1;for(let r=0;r ":"";if(o.deadEnd){if(s)continue;if(s=!0,o.restart(),af&&console.log(h+this.stackID(o)+" (restarted)"),this.advanceFully(o,i))continue}let c=o.split(),u=h;for(let t=0;c.forceReduce()&&t<10;t++){if(af&&console.log(u+this.stackID(c)+" (via force-reduce)"),this.advanceFully(c,i))break;af&&(u=this.stackID(c)+" -> ")}for(let t of o.recoverByInsert(a))af&&console.log(h+this.stackID(t)+" (via recover-insert)"),this.advanceFully(t,i);this.stream.end>o.pos?(l==o.pos&&(l++,a=0),o.recoverByDelete(a,l),af&&console.log(h+this.stackID(o)+` (via recover-delete ${this.parser.getName(a)})`),Of(o,i)):(!n||n.scoret;class bf{constructor(t){this.start=t.start,this.shift=t.shift||mf,this.reduce=t.reduce||mf,this.reuse=t.reuse||mf,this.hash=t.hash||(()=>0),this.strict=!1!==t.strict}}class wf extends Vo{constructor(t){if(super(),this.wrappers=[],14!=t.version)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let i=0;it.topRules[e][1])),n=[];for(let t=0;t=0)s(n,t,e[i++]);else{let r=e[i+-n];for(let o=-n;o>0;o--)s(e[i++],t,r);i++}}}this.nodeSet=new po(e.map(((e,s)=>fo.define({name:s>=this.minRepeatTerm?void 0:e,id:s,props:n[s],top:i.indexOf(s)>-1,error:0==s,skipped:t.skippedNodes&&t.skippedNodes.indexOf(s)>-1})))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=oo;let r=Fd(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let t=0;t"number"==typeof t?new tf(r,t):t)),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,i){let n=new pf(this,t,e,i);for(let s of this.wrappers)n=s(n,t,e,i);return n}getGoto(t,e,i=!1){let n=this.goto;if(e>=n[0])return-1;for(let s=n[e+1];;){let e=n[s++],r=1&e,o=n[s++];if(r&&i)return o;for(let i=s+(e>>1);s0}validAction(t,e){if(e==this.stateSlot(t,4))return!0;for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])return!1;i=vf(this.data,i+2)}if(e==vf(this.data,i+1))return!0}}nextStates(t){let e=[];for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])break;i=vf(this.data,i+2)}if(0==(1&this.data[i+2])){let t=this.data[i+1];e.some(((e,i)=>1&i&&e==t))||e.push(this.data[i],t)}}return e}configure(t){let e=Object.assign(Object.create(wf.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let i=this.topRules[t.top];if(!i)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=i}return t.tokenizers&&(e.tokenizers=this.tokenizers.map((e=>{let i=t.tokenizers.find((t=>t.from==e));return i?i.to:e}))),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map(((i,n)=>{let s=t.specializers.find((t=>t.from==i.external));if(!s)return i;let r=Object.assign(Object.assign({},i),{external:s.to});return e.specializers[n]=yf(r),r}))),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),null!=t.strict&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),null!=t.bufferLength&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return null==e?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),i=e.map((()=>!1));if(t)for(let n of t.split(" ")){let t=e.indexOf(n);t>=0&&(i[t]=!0)}let n=null;for(let t=0;tt.external(i,n)<<1|e}return t.get}const Sf=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],xf=new bf({start:!1,shift:(t,e)=>3==e||4==e||305==e?t:306==e,strict:!1}),kf=new nf(((t,e)=>{let{next:i}=t;(125==i||-1==i||e.context)&&e.canShift(303)&&t.acceptToken(303)}),{contextual:!0,fallback:!0}),Qf=new nf(((t,e)=>{let i,{next:n}=t;Sf.indexOf(n)>-1||(47!=n||47!=(i=t.peek(1))&&42!=i)&&125!=n&&59!=n&&-1!=n&&!e.context&&e.canShift(302)&&t.acceptToken(302)}),{contextual:!0}),$f=new nf(((t,e)=>{let{next:i}=t;if((43==i||45==i)&&(t.advance(),i==t.next)){t.advance();let i=!e.context&&e.canShift(1);t.acceptToken(i?1:2)}}),{contextual:!0}),Pf=ea({"get set async static":Sa.modifier,"for while do if else switch try catch finally return throw break continue default case":Sa.controlKeyword,"in of await yield void typeof delete instanceof":Sa.operatorKeyword,"let var const function class extends":Sa.definitionKeyword,"import export from":Sa.moduleKeyword,"with debugger as new":Sa.keyword,TemplateString:Sa.special(Sa.string),super:Sa.atom,BooleanLiteral:Sa.bool,this:Sa.self,null:Sa.null,Star:Sa.modifier,VariableName:Sa.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":Sa.function(Sa.variableName),VariableDefinition:Sa.definition(Sa.variableName),Label:Sa.labelName,PropertyName:Sa.propertyName,PrivatePropertyName:Sa.special(Sa.propertyName),"CallExpression/MemberExpression/PropertyName":Sa.function(Sa.propertyName),"FunctionDeclaration/VariableDefinition":Sa.function(Sa.definition(Sa.variableName)),"ClassDeclaration/VariableDefinition":Sa.definition(Sa.className),PropertyDefinition:Sa.definition(Sa.propertyName),PrivatePropertyDefinition:Sa.definition(Sa.special(Sa.propertyName)),UpdateOp:Sa.updateOperator,LineComment:Sa.lineComment,BlockComment:Sa.blockComment,Number:Sa.number,String:Sa.string,Escape:Sa.escape,ArithOp:Sa.arithmeticOperator,LogicOp:Sa.logicOperator,BitOp:Sa.bitwiseOperator,CompareOp:Sa.compareOperator,RegExp:Sa.regexp,Equals:Sa.definitionOperator,Arrow:Sa.function(Sa.punctuation),": Spread":Sa.punctuation,"( )":Sa.paren,"[ ]":Sa.squareBracket,"{ }":Sa.brace,"InterpolationStart InterpolationEnd":Sa.special(Sa.brace),".":Sa.derefOperator,", ;":Sa.separator,"@":Sa.meta,TypeName:Sa.typeName,TypeDefinition:Sa.definition(Sa.typeName),"type enum interface implements namespace module declare":Sa.definitionKeyword,"abstract global Privacy readonly override":Sa.modifier,"is keyof unique infer":Sa.operatorKeyword,JSXAttributeValue:Sa.attributeValue,JSXText:Sa.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":Sa.angleBracket,"JSXIdentifier JSXNameSpacedName":Sa.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":Sa.attributeName,"JSXBuiltin/JSXIdentifier":Sa.standard(Sa.tagName)}),Cf={__proto__:null,export:14,as:19,from:27,default:30,async:35,function:36,extends:46,this:50,true:58,false:58,null:70,void:74,typeof:78,super:96,new:130,delete:146,yield:155,await:159,class:164,public:221,private:221,protected:221,readonly:223,instanceof:242,satisfies:245,in:246,const:248,import:280,keyof:335,unique:339,infer:345,is:381,abstract:401,implements:403,type:405,let:408,var:410,interface:417,enum:421,namespace:427,module:429,declare:433,global:437,for:456,of:465,while:468,with:472,do:476,if:480,else:482,switch:486,case:492,try:498,catch:502,finally:506,return:510,throw:514,break:518,continue:522,debugger:526},_f={__proto__:null,async:117,get:119,set:121,declare:181,public:183,private:183,protected:183,static:185,abstract:187,override:189,readonly:195,accessor:197,new:385},Xf={__proto__:null,"<":137},Zf=wf.deserialize({version:14,states:"$6[O`QUOOO%QQUOOO'TQWOOP(bOSOOO*pQ(CjO'#CfO*wOpO'#CgO+VO!bO'#CgO+eO07`O'#DZO-vQUO'#DaO.WQUO'#DlO%QQUO'#DvO0[QUO'#EOOOQ(CY'#EW'#EWO0uQSO'#ETOOQO'#Ei'#EiOOQO'#Ib'#IbO0}QSO'#GkO1YQSO'#EhO1_QSO'#EhO3aQ(CjO'#JcO6QQ(CjO'#JdO6nQSO'#FWO6sQ#tO'#FoOOQ(CY'#F`'#F`O7OO&jO'#F`O7^Q,UO'#FvO8tQSO'#FuOOQ(CY'#Jd'#JdOOQ(CW'#Jc'#JcOOQQ'#KO'#KOO8yQSO'#IOO9OQ(C[O'#IPOOQQ'#JP'#JPOOQQ'#IT'#ITQ`QUOOO%QQUO'#DnO9WQUO'#DzO%QQUO'#D|O9_QSO'#GkO9dQ,UO'#ClO9rQSO'#EgO9}QSO'#ErO:SQ,UO'#F_O:qQSO'#GkO:vQSO'#GoO;RQSO'#GoO;aQSO'#GrO;aQSO'#GsO;aQSO'#GuO9_QSO'#GxOQQSO'#HnO>VQ(C]O'#HtO%QQUO'#HvO>bQ(C]O'#HxO>mQ(C]O'#HzO9OQ(C[O'#H|O>xQ(CjO'#CfO?zQWO'#DfQOQSOOO@bQSO'#EPO9dQ,UO'#EgO@mQSO'#EgO@xQ`O'#F_OOQQ'#Cd'#CdOOQ(CW'#Dk'#DkOOQ(CW'#Jg'#JgO%QQUO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v7tQ9U8cQ9]8tQ9n#OR;Q;^R#WWR&{!cY!qQ'Q,}0u4pS&w!c,uQ']!oS'g!r!uS'i!v4rS,r&x'PS-^'^'_Q-`'`Q1{,{R2Z-_R(k#tR(n#uQ!dQT,|'Q,}]!nQ!o'Q,}0u4pQ#l]R'Z9mT#gZ%ZS#fZ%ZU%y|},ZU(W#d#e#hS-r(X(YQ-v(ZQ0h+hQ2`-sU2a-t-u-wS5v2b2cR7u5w`#YW#S#V%v't'}+e-mt#cZ|}#d#e#h%Z(X(Y(Z+h-s-t-u-w2b2c5wQ1_,ZQ1r,oQ5e1jQ7m5fT:x&y+fT#]W%vS#[W%vS'u#S'}S'z#V+eS,t&y+fT-h't-mT'O!c%wQ$hfR)j$mT)_$h)`R3Z.kT*O$u*QR*W$xQ/}*zQ2e.OQ4s0wQ5{2iQ7X4vQ7x5zQ8e7WQ8w7wQ9W8gQ9`8yQ9e9XR9h9alpOXr!X#`%]&d&f&g&i,],b1b1eQ&^!TR,Q&ZV%z|},ZR0q+qR,P&XQ%szR+c%tR+X%nT&b!U&eT&c!U&eT1d,b1e",nodeNames:"⚠ ArithOp ArithOp LineComment BlockComment Script ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXStartTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:364,context:xf,nodeProps:[["group",-26,6,14,16,62,199,203,206,207,209,212,215,225,227,233,235,237,239,242,248,254,256,258,260,262,264,265,"Statement",-32,10,11,25,28,29,35,45,48,49,51,56,64,72,76,78,80,81,103,104,113,114,131,134,136,137,138,139,141,142,162,163,165,"Expression",-23,24,26,30,34,36,38,166,168,170,171,173,174,175,177,178,179,181,182,183,193,195,197,198,"Type",-3,84,96,102,"ClassItem"],["openedBy",31,"InterpolationStart",50,"[",54,"{",69,"(",143,"JSXStartTag",155,"JSXStartTag JSXStartCloseTag"],["closedBy",33,"InterpolationEnd",44,"]",55,"}",70,")",144,"JSXSelfCloseEndTag JSXEndTag",160,"JSXEndTag"]],propSources:[Pf],skippedNodes:[0,3,4,268],repeatNodeCount:33,tokenData:"$>y(CSR!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tu>PuvBavwDxwxGgxyMvyz! Qz{!![{|!%O|}!&]}!O!%O!O!P!'g!P!Q!1w!Q!R#0t!R![#3T![!]#@T!]!^#Aa!^!_#Bk!_!`#GS!`!a#In!a!b#N{!b!c$$z!c!}>P!}#O$&U#O#P$'`#P#Q$,w#Q#R$.R#R#S>P#S#T$/`#T#o$0j#o#p$4z#p#q$5p#q#r$7Q#r#s$8^#s$f%Z$f$g+g$g#BY>P#BY#BZ$9h#BZ$IS>P$IS$I_$9h$I_$I|>P$I|$I}$P$JT$JU$9h$JU$KV>P$KV$KW$9h$KW&FU>P&FU&FV$9h&FV;'S>P;'S;=`BZ<%l?HT>P?HT?HU$9h?HUO>P(n%d_$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$d&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$d&j'z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU'z!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!b(iP;=`<%l'}'|(oP;=`<%l&}'[(y]$d&j'wpOY(rYZ&cZr(rrs&cs!^(r!^!_)r!_#O(r#O#P&c#P#o(r#o#p)r#p;'S(r;'S;=`*a<%lO(rp)wU'wpOY)rZr)rs#O)r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!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(T~~",141,326),new ef("j~RQYZXz{^~^O'q~~aP!P!Qd~iO'r~~",25,308)],topRules:{Script:[0,5],SingleExpression:[1,266],SingleClassItem:[2,267]},dialects:{jsx:12686,ts:12688},dynamicPrecedences:{76:1,78:1,163:1,191:1},specialized:[{term:312,get:t=>Cf[t]||-1},{term:328,get:t=>_f[t]||-1},{term:67,get:t=>Xf[t]||-1}],tokenPrec:12712}),Af=[Dd("function ${name}(${params}) {\n\t${}\n}",{label:"function",detail:"definition",type:"keyword"}),Dd("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n\t${}\n}",{label:"for",detail:"loop",type:"keyword"}),Dd("for (let ${name} of ${collection}) {\n\t${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Dd("do {\n\t${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),Dd("while (${}) {\n\t${}\n}",{label:"while",detail:"loop",type:"keyword"}),Dd("try {\n\t${}\n} catch (${error}) {\n\t${}\n}",{label:"try",detail:"/ catch block",type:"keyword"}),Dd("if (${}) {\n\t${}\n}",{label:"if",detail:"block",type:"keyword"}),Dd("if (${}) {\n\t${}\n} else {\n\t${}\n}",{label:"if",detail:"/ else block",type:"keyword"}),Dd("class ${name} {\n\tconstructor(${params}) {\n\t\t${}\n\t}\n}",{label:"class",detail:"definition",type:"keyword"}),Dd('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Dd('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Tf=new Ro,Rf=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Ef(t){return(e,i)=>{let n=e.node.getChild("VariableDefinition");return n&&i(n,t),!0}}const Vf=["FunctionDeclaration"],Mf={FunctionDeclaration:Ef("function"),ClassDeclaration:Ef("class"),ClassExpression:()=>!0,EnumDeclaration:Ef("constant"),TypeAliasDeclaration:Ef("type"),NamespaceDeclaration:Ef("namespace"),VariableDefinition(t,e){t.matchContext(Vf)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function Df(t,e){let i=Tf.get(e);if(i)return i;let n=[],s=!0;function r(e,i){let s=t.sliceString(e.from,e.to);n.push({label:s,type:i})}return e.cursor(mo.IncludeAnonymous).iterate((e=>{if(s)s=!1;else if(e.name){let t=Mf[e.name];if(t&&t(e,r)||Rf.has(e.name))return!1}else if(e.to-e.from>8192){for(let i of Df(t,e.node))n.push(i);return!1}})),Tf.set(e,n),n}const Wf=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Uf=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName"];function Yf(t){let e=Xa(t.state).resolveInner(t.pos,-1);if(Uf.indexOf(e.name)>-1)return null;let i="VariableName"==e.name||e.to-e.from<20&&Wf.test(t.state.sliceDoc(e.from,e.to));if(!i&&!t.explicit)return null;let n=[];for(let i=e;i;i=i.parent)Rf.has(i.name)&&(n=n.concat(Df(t.state.doc,i)));return{options:n,from:i?e.from:t.pos,validFor:Wf}}const qf=_a.define({name:"javascript",parser:Zf.configure({props:[Na.add({IfStatement:il({except:/^\s*({|else\b)/}),TryStatement:il({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:t=>t.baseIndent,SwitchBody:t=>{let e=t.textAfter,i=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return t.baseIndent+(i?0:n?1:2)*t.unit},Block:tl({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":il({except:/^{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag":t=>t.column(t.node.from)+t.unit}),rl.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression":ol,BlockComment:t=>({from:t.from+2,to:t.to-2})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Lf={test:t=>/^JSX/.test(t.name),facet:Qa({commentTokens:{block:{open:"{/*",close:"*/}"}}})},zf=qf.configure({dialect:"ts"},"typescript"),If=qf.configure({dialect:"jsx",props:[$a.add((t=>t.isTop?[Lf]:void 0))]}),Bf=qf.configure({dialect:"jsx ts",props:[$a.add((t=>t.isTop?[Lf]:void 0))]},"typescript"),jf="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map((t=>({label:t,type:"keyword"})));function Nf(t={}){let e=t.jsx?t.typescript?Bf:If:t.typescript?zf:qf;return new Ua(e,[qf.data.of({autocomplete:(i=Uf,n=zu(Af.concat(jf)),t=>{for(let e=Xa(t.state).resolveInner(t.pos,-1);e;e=e.parent){if(i.indexOf(e.name)>-1)return null;if(e.type.isTop)break}return n(t)})}),qf.data.of({autocomplete:Yf}),t.jsx?Hf:[]]);var i,n}function Gf(t,e,i=t.length){for(let n=null==e?void 0:e.firstChild;n;n=n.nextSibling)if("JSXIdentifier"==n.name||"JSXBuiltin"==n.name||"JSXNamespacedName"==n.name||"JSXMemberExpression"==n.name)return t.sliceString(n.from,Math.min(n.to,i));return""}const Ff="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),Hf=Ts.inputHandler.of(((t,e,i,n)=>{if((Ff?t.composing:t.compositionStarted)||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!qf.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((t=>{var e,i;let r,{head:o}=t,a=Xa(s).resolveInner(o,-1);if("JSXStartTag"==a.name&&(a=a.parent),">"==n&&"JSXFragmentTag"==a.name)return{range:A.cursor(o+1),changes:{from:o,insert:">"}};if("/"==n&&"JSXFragmentTag"==a.name){let t=a.parent,i=null==t?void 0:t.parent;if(t.from==o-1&&"JSXEndTag"!=(null===(e=i.lastChild)||void 0===e?void 0:e.name)&&(r=Gf(s.doc,null==i?void 0:i.firstChild,o))){let t=`/${r}>`;return{range:A.cursor(o+t.length),changes:{from:o,insert:t}}}}else if(">"==n){let t=function(t){for(;;){if("JSXOpenTag"==t.name||"JSXSelfClosingTag"==t.name||"JSXFragmentTag"==t.name)return t;if(!t.parent)return null;t=t.parent}}(a);if(t&&"JSXEndTag"!=(null===(i=t.lastChild)||void 0===i?void 0:i.name)&&"`}}}return{range:t}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)}));class Jf{constructor(t,e,i,n,s,r,o){this.type=t,this.value=e,this.from=i,this.hash=n,this.end=s,this.children=r,this.positions=o,this.hashProp=[[ho.contextHash,n]]}static create(t,e,i,n,s){return new Jf(t,e,i,n+(n<<8)+t+(e<<4)|0,s,[],[])}addChild(t,e){t.prop(ho.contextHash)!=this.hash&&(t=new bo(t.type,t.children,t.positions,t.length,this.hashProp)),this.children.push(t),this.positions.push(e)}toTree(t,e=this.end){let i=this.children.length-1;return i>=0&&(e=Math.max(e,this.positions[i]+this.children[i].length+this.from)),new bo(t.types[this.type],this.children,this.positions,e-this.from).balance({makeTree:(t,e,i)=>new bo(fo.none,t,e,i,this.hashProp)})}}var Kf;!function(t){t[t.Document=1]="Document",t[t.CodeBlock=2]="CodeBlock",t[t.FencedCode=3]="FencedCode",t[t.Blockquote=4]="Blockquote",t[t.HorizontalRule=5]="HorizontalRule",t[t.BulletList=6]="BulletList",t[t.OrderedList=7]="OrderedList",t[t.ListItem=8]="ListItem",t[t.ATXHeading1=9]="ATXHeading1",t[t.ATXHeading2=10]="ATXHeading2",t[t.ATXHeading3=11]="ATXHeading3",t[t.ATXHeading4=12]="ATXHeading4",t[t.ATXHeading5=13]="ATXHeading5",t[t.ATXHeading6=14]="ATXHeading6",t[t.SetextHeading1=15]="SetextHeading1",t[t.SetextHeading2=16]="SetextHeading2",t[t.HTMLBlock=17]="HTMLBlock",t[t.LinkReference=18]="LinkReference",t[t.Paragraph=19]="Paragraph",t[t.CommentBlock=20]="CommentBlock",t[t.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",t[t.Escape=22]="Escape",t[t.Entity=23]="Entity",t[t.HardBreak=24]="HardBreak",t[t.Emphasis=25]="Emphasis",t[t.StrongEmphasis=26]="StrongEmphasis",t[t.Link=27]="Link",t[t.Image=28]="Image",t[t.InlineCode=29]="InlineCode",t[t.HTMLTag=30]="HTMLTag",t[t.Comment=31]="Comment",t[t.ProcessingInstruction=32]="ProcessingInstruction",t[t.URL=33]="URL",t[t.HeaderMark=34]="HeaderMark",t[t.QuoteMark=35]="QuoteMark",t[t.ListMark=36]="ListMark",t[t.LinkMark=37]="LinkMark",t[t.EmphasisMark=38]="EmphasisMark",t[t.CodeMark=39]="CodeMark",t[t.CodeText=40]="CodeText",t[t.CodeInfo=41]="CodeInfo",t[t.LinkTitle=42]="LinkTitle",t[t.LinkLabel=43]="LinkLabel"}(Kf||(Kf={}));class tp{constructor(t,e){this.start=t,this.content=e,this.marks=[],this.parsers=[]}}class ep{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let t=this.skipSpace(this.basePos);this.indent=this.countIndent(t,this.pos,this.indent),this.pos=t,this.next=t==this.text.length?-1:this.text.charCodeAt(t)}skipSpace(t){return rp(this.text,t)}reset(t){for(this.text=t,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(t){this.basePos=t,this.baseIndent=this.countIndent(t,this.pos,this.indent)}moveBaseColumn(t){this.baseIndent=t,this.basePos=this.findColumn(t)}addMarker(t){this.markers.push(t)}countIndent(t,e=0,i=0){for(let n=e;n=e.stack[i.depth+1].value+i.baseIndent)return!0;if(i.indent>=i.baseIndent+4)return!1;let n=(t.type==Kf.OrderedList?dp:up)(i,e,!1);return n>0&&(t.type!=Kf.BulletList||hp(i,e,!1)<0)&&i.text.charCodeAt(i.pos+n-1)==t.value}const np={[Kf.Blockquote]:(t,e,i)=>62==i.next&&(i.markers.push(Up(Kf.QuoteMark,e.lineStart+i.pos,e.lineStart+i.pos+1)),i.moveBase(i.pos+(sp(i.text.charCodeAt(i.pos+1))?2:1)),t.end=e.lineStart+i.text.length,!0),[Kf.ListItem]:(t,e,i)=>!(i.indent-1)&&(i.moveBaseColumn(i.baseIndent+t.value),!0),[Kf.OrderedList]:ip,[Kf.BulletList]:ip,[Kf.Document]:()=>!0};function sp(t){return 32==t||9==t||10==t||13==t}function rp(t,e=0){for(;ei&&sp(t.charCodeAt(e-1));)e--;return e}function ap(t){if(96!=t.next&&126!=t.next)return-1;let e=t.pos+1;for(;e-1&&t.depth==e.stack.length||n<3?-1:1}function cp(t,e){for(let i=t.stack.length-1;i>=0;i--)if(t.stack[i].type==e)return!0;return!1}function up(t,e,i){return 45!=t.next&&43!=t.next&&42!=t.next||t.pos!=t.text.length-1&&!sp(t.text.charCodeAt(t.pos+1))||!(!i||cp(e,Kf.BulletList)||t.skipSpace(t.pos+2)=48&&s<=57;){if(n++,n==t.text.length)return-1;s=t.text.charCodeAt(n)}return n==t.pos||n>t.pos+9||46!=s&&41!=s||nt.pos+1||49!=t.next)?-1:n+1-t.pos}function fp(t){if(35!=t.next)return-1;let e=t.pos+1;for(;e6?-1:i}function pp(t){if(45!=t.next&&61!=t.next||t.indent>=t.baseIndent+4)return-1;let e=t.pos+1;for(;e/,mp=/\?>/,bp=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*/i.exec(n);if(r)return t.append(Up(Kf.Comment,i,i+1+r[0].length));let o=/^\?[^]*?\?>/.exec(n);if(o)return t.append(Up(Kf.ProcessingInstruction,i,i+1+o[0].length));let a=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(n);return a?t.append(Up(Kf.HTMLTag,i,i+1+a[0].length)):-1},Emphasis(t,e,i){if(95!=e&&42!=e)return-1;let n=i+1;for(;t.char(n)==e;)n++;let s=t.slice(i-1,i),r=t.slice(n,n+1),o=jp.test(s),a=jp.test(r),l=/\s|^$/.test(s),h=/\s|^$/.test(r),c=!h&&(!a||l||o),u=!l&&(!o||h||a),d=c&&(42==e||!u||o),f=u&&(42==e||!c||a);return t.append(new Ip(95==e?Yp:qp,i,n,(d?1:0)|(f?2:0)))},HardBreak(t,e,i){if(92==e&&10==t.char(i+1))return t.append(Up(Kf.HardBreak,i,i+2));if(32==e){let e=i+1;for(;32==t.char(e);)e++;if(10==t.char(e)&&e>=i+2)return t.append(Up(Kf.HardBreak,i,e+1))}return-1},Link:(t,e,i)=>91==e?t.append(new Ip(Lp,i,i+1,1)):-1,Image:(t,e,i)=>33==e&&91==t.char(i+1)?t.append(new Ip(zp,i,i+2,1)):-1,LinkEnd(t,e,i){if(93!=e)return-1;for(let e=t.parts.length-1;e>=0;e--){let n=t.parts[e];if(n instanceof Ip&&(n.type==Lp||n.type==zp)){if(!n.side||t.skipSpace(n.to)==i&&!/[(\[]/.test(t.slice(i+1,i+2)))return t.parts[e]=null,-1;let s=t.takeContent(e),r=t.parts[e]=Gp(t,s,n.type==Lp?Kf.Link:Kf.Image,n.from,i+1);if(n.type==Lp)for(let i=0;ie?Up(Kf.URL,e+i,s+i):s==t.length&&null}}function Hp(t,e,i){let n=t.charCodeAt(e);if(39!=n&&34!=n&&40!=n)return!1;let s=40==n?41:n;for(let n=e+1,r=!1;n=this.end?-1:this.text.charCodeAt(t-this.offset)}get end(){return this.offset+this.text.length}slice(t,e){return this.text.slice(t-this.offset,e-this.offset)}append(t){return this.parts.push(t),t.to}addDelimiter(t,e,i,n,s){return this.append(new Ip(t,e,i,(n?1:0)|(s?2:0)))}addElement(t){return this.append(t)}resolveMarkers(t){for(let e=t;e=t;o--){let t=this.parts[o];if(t instanceof Ip&&1&t.side&&t.type==i.type&&!(s&&(1&i.side||2&t.side)&&(t.to-t.from+r)%3==0&&((t.to-t.from)%3||r%3))){n=t;break}}if(!n)continue;let a=i.type.resolve,l=[],h=n.from,c=i.to;if(s){let t=Math.min(2,n.to-n.from,r);h=n.to-t,c=i.from+t,a=1==t?"Emphasis":"StrongEmphasis"}n.type.mark&&l.push(this.elt(n.type.mark,h,n.to));for(let t=o+1;t=0;e--){let i=this.parts[e];if(i instanceof Ip&&i.type==t)return e}return null}takeContent(t){let e=this.resolveMarkers(t);return this.parts.length=t,e}skipSpace(t){return rp(this.text,t-this.offset)+this.offset}elt(t,e,i,n){return"string"==typeof t?Up(this.parser.getNodeType(t),e,i,n):new Wp(t,e)}}function tO(t,e){if(!e.length)return t;if(!t.length)return e;let i=t.slice(),n=0;for(let t of e){for(;n(t?t-1:0))return!1;if(this.fragmentEnd<0){let t=this.fragment.to;for(;t>0&&"\n"!=this.input.read(t-1,t);)t--;this.fragmentEnd=t?t-1:0}let i=this.cursor;i||(i=this.cursor=this.fragment.tree.cursor(),i.firstChild());let n=t+this.fragment.offset;for(;i.to<=n;)if(!i.parent())return!1;for(;;){if(i.from>=n)return this.fragment.from<=e;if(!i.childAfter(n))return!1}}matches(t){let e=this.cursor.tree;return e&&e.prop(ho.contextHash)==t}takeNodes(t){let e=this.cursor,i=this.fragment.offset,n=this.fragmentEnd-(this.fragment.openEnd?1:0),s=t.absoluteLineStart,r=s,o=t.block.children.length,a=r,l=o;for(;;){if(e.to-i>n){if(e.type.isAnonymous&&e.firstChild())continue;break}if(t.dontInject.add(e.tree),t.addNode(e.tree,e.from-i),e.type.is("Block")&&(eO.indexOf(e.type.id)<0?(r=e.to-i,o=t.block.children.length):(r=a,o=l,a=e.to-i,l=t.block.children.length)),!e.nextSibling())break}for(;t.block.children.length>o;)t.block.children.pop(),t.block.positions.pop();return r-s}}const nO=ea({"Blockquote/...":Sa.quote,HorizontalRule:Sa.contentSeparator,"ATXHeading1/... SetextHeading1/...":Sa.heading1,"ATXHeading2/... SetextHeading2/...":Sa.heading2,"ATXHeading3/...":Sa.heading3,"ATXHeading4/...":Sa.heading4,"ATXHeading5/...":Sa.heading5,"ATXHeading6/...":Sa.heading6,"Comment CommentBlock":Sa.comment,Escape:Sa.escape,Entity:Sa.character,"Emphasis/...":Sa.emphasis,"StrongEmphasis/...":Sa.strong,"Link/... Image/...":Sa.link,"OrderedList/... BulletList/...":Sa.list,"BlockQuote/...":Sa.quote,"InlineCode CodeText":Sa.monospace,URL:Sa.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":Sa.processingInstruction,"CodeInfo LinkLabel":Sa.labelName,LinkTitle:Sa.string,Paragraph:Sa.content}),sO=new Zp(new po(Ep).extend(nO),Object.keys(Sp).map((t=>Sp[t])),Object.keys(Sp).map((t=>$p[t])),Object.keys(Sp),Pp,np,Object.keys(Np).map((t=>Np[t])),Object.keys(Np),[]);function rO(t,e,i){let n=[];for(let s=t.firstChild,r=e;;s=s.nextSibling){let t=s?s.from:i;if(t>r&&n.push({from:r,to:t}),!s)break;r=s.to}return n}const oO={resolve:"Strikethrough",mark:"StrikethroughMark"},aO={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":Sa.strikethrough}},{name:"StrikethroughMark",style:Sa.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,i){if(126!=e||126!=t.char(i+1)||126==t.char(i+2))return-1;let n=t.slice(i-1,i),s=t.slice(i+2,i+3),r=/\s|^$/.test(n),o=/\s|^$/.test(s),a=jp.test(n),l=jp.test(s);return t.addDelimiter(oO,i,i+2,!o&&(!l||r||a),!r&&(!a||o||l))},after:"Emphasis"}]};function lO(t,e,i=0,n,s=0){let r=0,o=!0,a=-1,l=-1,h=!1,c=()=>{n.push(t.elt("TableCell",s+a,s+l,t.parser.parseInline(e.slice(a,l),s+a)))};for(let u=i;u-1)&&r++,o=!1,n&&(a>-1&&c(),n.push(t.elt("TableDelimiter",u+s,u+s+1))),a=l=-1),h=!h&&92==i}return a>-1&&(r++,n&&c()),r}function hO(t,e){for(let i=e;ihO(e.content,0)?new uO:null,endLeaf(t,e,i){if(i.parsers.some((t=>t instanceof uO))||!hO(e.text,e.basePos))return!1;let n=t.scanLine(t.absoluteLineEnd+1).text;return cO.test(n)&&lO(t,e.text,e.basePos)==lO(t,n,e.basePos)},before:"SetextHeading"}]};class fO{nextLine(){return!1}finish(t,e){return t.addLeafElement(e,t.elt("Task",e.start,e.start+e.content.length,[t.elt("TaskMarker",e.start,e.start+3),...t.parser.parseInline(e.content.slice(3),e.start+3)])),!0}}const pO=[dO,{defineNodes:[{name:"Task",block:!0,style:Sa.list},{name:"TaskMarker",style:Sa.atom}],parseBlock:[{name:"TaskList",leaf:(t,e)=>/^\[[ xX]\]/.test(e.content)&&"ListItem"==t.parentType().name?new fO:null,after:"SetextHeading"}]},aO];function OO(t,e,i){return(n,s,r)=>{if(s!=t||n.char(r+1)==t)return-1;let o=[n.elt(i,r,r+1)];for(let s=r+1;s=65&&r<=90||95==r||r>=97&&r<=122||r>=161;)s+=String.fromCharCode(n),n=t.peek(++e);var r;return RO=t,EO=i,TO=s?s.toLowerCase():n==MO||n==DO?void 0:null}const MO=63,DO=33;function WO(t,e){this.name=t,this.parent=e,this.hash=e?e.hash:0;for(let e=0;eUO.indexOf(e)>-1?new WO(VO(n,1)||"",t):t,reduce:(t,e)=>e==wO&&t?t.parent:t,reuse(t,e,i,n){let s=e.type.id;return 6==s||36==s?new WO(VO(n,1)||"",t):t},hash:t=>t?t.hash:0,strict:!1}),qO=new nf(((t,e)=>{if(60!=t.next)return void(t.next<0&&e.context&&t.acceptToken(57));t.advance();let i=47==t.next;i&&t.advance();let n=VO(t,0);if(void 0===n)return;if(!n)return t.acceptToken(i?14:6);let s=e.context?e.context.name:null;if(i){if(n==s)return t.acceptToken(11);if(s&&XO[s])return t.acceptToken(57,-2);if(e.dialectEnabled(0))return t.acceptToken(12);for(let t=e.context;t;t=t.parent)if(t.name==n)return;t.acceptToken(13)}else{if("script"==n)return t.acceptToken(7);if("style"==n)return t.acceptToken(8);if("textarea"==n)return t.acceptToken(9);if(_O.hasOwnProperty(n))return t.acceptToken(10);s&&ZO[s]&&ZO[s][n]?t.acceptToken(57,-1):t.acceptToken(6)}}),{contextual:!0}),LO=new nf((t=>{for(let e=0,i=0;;i++){if(t.next<0){i&&t.acceptToken(58);break}if(45==t.next)e++;else{if(62==t.next&&e>=2){i>3&&t.acceptToken(58,-2);break}e=0}t.advance()}}));const zO=new nf(((t,e)=>{if(47==t.next&&62==t.peek(1)){let i=e.dialectEnabled(1)||function(t){for(;t;t=t.parent)if("svg"==t.name||"math"==t.name)return!0;return!1}(e.context);t.acceptToken(i?5:4,2)}else 62==t.next&&t.acceptToken(4,1)}));function IO(t,e,i){let n=2+t.length;return new nf((s=>{for(let r=0,o=0,a=0;;a++){if(s.next<0){a&&s.acceptToken(e);break}if(0==r&&60==s.next||1==r&&47==s.next||r>=2&&ro?s.acceptToken(e,-o):s.acceptToken(i,-(o-2));break}if((10==s.next||13==s.next)&&a){s.acceptToken(e,1);break}r=o=0}else o++;s.advance()}}))}const BO=IO("script",54,1),jO=IO("style",55,2),NO=IO("textarea",56,3),GO=ea({"Text RawText":Sa.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":Sa.angleBracket,TagName:Sa.tagName,"MismatchedCloseTag/TagName":[Sa.tagName,Sa.invalid],AttributeName:Sa.attributeName,"AttributeValue UnquotedAttributeValue":Sa.attributeValue,Is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 StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:67,context:YO,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,21,30,33,36,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,29,32,35,37,"OpenTag"],["group",-9,14,17,18,19,20,39,40,41,42,"Entity",16,"Entity TextContent",-3,28,31,34,"TextContent Entity"]],propSources:[GO],skippedNodes:[0],repeatNodeCount:9,tokenData:"#%g!aR!YOX$qXY,QYZ,QZ[$q[]&X]^,Q^p$qpq,Qqr-_rs4ysv-_vw5iwxJ^x}-_}!OKP!O!P-_!P!Q$q!Q![-_![!]!!O!]!^-_!^!_!&W!_!`#$o!`!a&X!a!c-_!c!}!!O!}#R-_#R#S!!O#S#T3V#T#o!!O#o#s-_#s$f$q$f%W-_%W%o!!O%o%p-_%p&a!!O&a&b-_&b1p!!O1p4U-_4U4d!!O4d4e-_4e$IS!!O$IS$I`-_$I`$Ib!!O$Ib$Kh-_$Kh%#t!!O%#t&/x-_&/x&Et!!O&Et&FV-_&FV;'S!!O;'S;:j!&Q;:j;=`4s<%l?&r-_?&r?Ah!!O?Ah?BY$q?BY?Mn!!O?MnO$q!Z$|c`PkW!a`!cpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr$qrs&}sv$qvw+Pwx(tx!^$q!^!_*V!_!a&X!a#S$q#S#T&X#T;'S$q;'S;=`+z<%lO$q!R&bX`P!a`!cpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&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getChild(SO),s=n.getChild(xO)||n.getChild(kO);t&&(i[e.read(t.from,t.to)]=s?s.type.id==xO?e.read(s.from+1,s.to-1):e.read(s.from,s.to):"")}return i}function JO(t,e){let i=t.getChild(vO);return i?e.read(i.from,i.to):" "}function KO(t,e,i){let n;for(let s of i)if(!s.attrs||s.attrs(n||(n=HO(t.node.parent.firstChild,e))))return{parser:s.parser};return null}function tg(t=[],e=[]){let i=[],n=[],s=[],r=[];for(let e of t){("script"==e.tag?i:"style"==e.tag?n:"textarea"==e.tag?s:r).push(e)}let o=e.length?Object.create(null):null;for(let t of e)(o[t.name]||(o[t.name]=[])).push(t);return Do(((t,e)=>{let a=t.type.id;if(a==QO)return KO(t,e,i);if(a==$O)return KO(t,e,n);if(a==PO)return KO(t,e,s);if(a==wO&&r.length){let i,n=t.node,s=n.firstChild,o=s&&JO(s,e);if(o)for(let t of r)if(t.tag==o&&(!t.attrs||t.attrs(i||(i=HO(n,e))))){let e=n.lastChild;return{parser:t.parser,overlay:[{from:s.to,to:e.type.id==CO?e.from:n.to}]}}}if(o&&a==yO){let i,n=t.node;if(i=n.firstChild){let t=o[e.read(i.from,i.to)];if(t)for(let i of t){if(i.tagName&&i.tagName!=JO(n.parent,e))continue;let t=n.lastChild;if(t.type.id==xO){let e=t.from+1,n=t.lastChild,s=t.to-(n&&n.isError?0:1);if(s>e)return{parser:i.parser,overlay:[{from:e,to:s}]}}else if(t.type.id==kO)return{parser:i.parser,overlay:[{from:t.from,to:t.to}]}}}}return null}))}const eg=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288];function ig(t){return t>=65&&t<=90||t>=97&&t<=122||t>=161}const ng=new nf(((t,e)=>{for(let n=!1,s=0,r=0;;r++){let{next:o}=t;if(!(ig(o)||45==o||95==o||n&&(i=o,i>=48&&i<=57))){n&&t.acceptToken(40==o?95:2==s&&e.canShift(2)?2:96);break}!n&&(45!=o||r>0)&&(n=!0),s===r&&45==o&&s++,t.advance()}var i})),sg=new nf((t=>{if(eg.includes(t.peek(-1))){let{next:e}=t;(ig(e)||95==e||35==e||46==e||91==e||58==e||45==e)&&t.acceptToken(94)}})),rg=new nf((t=>{if(!eg.includes(t.peek(-1))){let{next:e}=t;if(37==e&&(t.advance(),t.acceptToken(1)),ig(e)){do{t.advance()}while(ig(t.next));t.acceptToken(1)}}})),og=ea({"AtKeyword import charset namespace keyframes media supports":Sa.definitionKeyword,"from to selector":Sa.keyword,NamespaceName:Sa.namespace,KeyframeName:Sa.labelName,TagName:Sa.tagName,ClassName:Sa.className,PseudoClassName:Sa.constant(Sa.className),IdName:Sa.labelName,"FeatureName PropertyName":Sa.propertyName,AttributeName:Sa.attributeName,NumberLiteral:Sa.number,KeywordQuery:Sa.keyword,UnaryQueryOp:Sa.operatorKeyword,"CallTag ValueName":Sa.atom,VariableName:Sa.variableName,Callee:Sa.operatorKeyword,Unit:Sa.unit,"UniversalSelector NestingSelector":Sa.definitionOperator,MatchOp:Sa.compareOperator,"ChildOp SiblingOp, LogicOp":Sa.logicOperator,BinOp:Sa.arithmeticOperator,Important:Sa.modifier,Comment:Sa.blockComment,ParenthesizedContent:Sa.special(Sa.name),ColorLiteral:Sa.color,StringLiteral:Sa.string,":":Sa.punctuation,"PseudoOp #":Sa.derefOperator,"; ,":Sa.separator,"( )":Sa.paren,"[ ]":Sa.squareBracket,"{ }":Sa.brace}),ag={__proto__:null,lang:32,"nth-child":32,"nth-last-child":32,"nth-of-type":32,"nth-last-of-type":32,dir:32,"host-context":32,url:60,"url-prefix":60,domain:60,regexp:60,selector:134},lg={__proto__:null,"@import":114,"@media":138,"@charset":142,"@namespace":146,"@keyframes":152,"@supports":164},hg={__proto__:null,not:128,only:128,from:158,to:160},cg=wf.deserialize({version:14,states:"7WQYQ[OOO#_Q[OOOOQP'#Cd'#CdOOQP'#Cc'#CcO#fQ[O'#CfO$YQXO'#CaO$aQ[O'#ChO$lQ[O'#DPO$qQ[O'#DTOOQ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P!QC[!Q;'S@};'S;=`Co<%lO@}~CcSoWR~Oy%^z;'S%^;'S;=`%o<%lO%^~CrP;=`<%l@}^Cz[#[UOy%^z!O%^!O!P;g!P!Q%^!Q![>T![!g%^!g!h<^!h#X%^#X#Y<^#Y;'S%^;'S;=`%o<%lO%^XDuU]POy%^z![%^![!]EX!];'S%^;'S;=`%o<%lO%^XE`S^PoWOy%^z;'S%^;'S;=`%o<%lO%^_EqS!WVOy%^z;'S%^;'S;=`%o<%lO%^YFSSzQOy%^z;'S%^;'S;=`%o<%lO%^XFeU|POy%^z!`%^!`!aFw!a;'S%^;'S;=`%o<%lO%^XGOS|PoWOy%^z;'S%^;'S;=`%o<%lO%^XG_WOy%^z!c%^!c!}Gw!}#T%^#T#oGw#o;'S%^;'S;=`%o<%lO%^XHO[!YPoWOy%^z}%^}!OGw!O!Q%^!Q![Gw![!c%^!c!}Gw!}#T%^#T#oGw#o;'S%^;'S;=`%o<%lO%^XHySxPOy%^z;'S%^;'S;=`%o<%lO%^^I[SvUOy%^z;'S%^;'S;=`%o<%lO%^XIkUOy%^z#b%^#b#cI}#c;'S%^;'S;=`%o<%lO%^XJSUoWOy%^z#W%^#W#XJf#X;'S%^;'S;=`%o<%lO%^XJmS!`PoWOy%^z;'S%^;'S;=`%o<%lO%^XJ|UOy%^z#f%^#f#gJf#g;'S%^;'S;=`%o<%lO%^XKeS!RPOy%^z;'S%^;'S;=`%o<%lO%^_KvS!QVOy%^z;'S%^;'S;=`%o<%lO%^ZLXU!PPOy%^z!_%^!_!`6y!`;'S%^;'S;=`%o<%lO%^WLnP;=`<%l$}",tokenizers:[sg,rg,ng,0,1,2,3],topRules:{StyleSheet:[0,4],Styles:[1,84]},specialized:[{term:95,get:t=>ag[t]||-1},{term:56,get:t=>lg[t]||-1},{term:96,get:t=>hg[t]||-1}],tokenPrec:1123});let ug=null;function dg(){if(!ug&&"object"==typeof document&&document.body){let{style:t}=document.body,e=[],i=new Set;for(let n in t)"cssText"!=n&&"cssFloat"!=n&&"string"==typeof t[n]&&(/[A-Z]/.test(n)&&(n=n.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))),i.has(n)||(e.push(n),i.add(n)));ug=e.sort().map((t=>({type:"property",label:t})))}return ug||[]}const fg=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map((t=>({type:"class",label:t}))),pg=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map((t=>({type:"keyword",label:t}))).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map((t=>({type:"constant",label:t})))),Og=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map((t=>({type:"type",label:t}))),gg=/^(\w[\w-]*|-\w[\w-]*|)$/,mg=/^-(-[\w-]*)?$/;const bg=new Ro,wg=["Declaration"];function vg(t){for(let e=t;;){if(e.type.isTop)return e;if(!(e=e.parent))return t}}function yg(t,e,i){if(e.to-e.from>4096){let n=bg.get(e);if(n)return n;let s=[],r=new Set,o=e.cursor(mo.IncludeAnonymous);if(o.firstChild())do{for(let e of yg(t,o.node,i))r.has(e.label)||(r.add(e.label),s.push(e))}while(o.nextSibling());return bg.set(e,s),s}{let n=[],s=new Set;return e.cursor().iterate((e=>{var r;if(i(e)&&e.matchContext(wg)&&":"==(null===(r=e.node.nextSibling)||void 0===r?void 0:r.name)){let i=t.sliceString(e.from,e.to);s.has(i)||(s.add(i),n.push({label:i,type:"variable"}))}})),n}}const Sg=t=>e=>{let{state:i,pos:n}=e,s=Xa(i).resolveInner(n,-1),r=s.type.isError&&s.from==s.to-1&&"-"==i.doc.sliceString(s.from,s.to);if("PropertyName"==s.name||(r||"TagName"==s.name)&&/^(Block|Styles)$/.test(s.resolve(s.to).name))return{from:s.from,options:dg(),validFor:gg};if("ValueName"==s.name)return{from:s.from,options:pg,validFor:gg};if("PseudoClassName"==s.name)return{from:s.from,options:fg,validFor:gg};if(t(s)||(e.explicit||r)&&function(t,e){var i;if(("("==t.name||t.type.isError)&&(t=t.parent||t),"ArgList"!=t.name)return!1;let n=null===(i=t.parent)||void 0===i?void 0:i.firstChild;return"Callee"==(null==n?void 0:n.name)&&"var"==e.sliceString(n.from,n.to)}(s,i.doc))return{from:t(s)||r?s.from:n,options:yg(i.doc,vg(s),t),validFor:mg};if("TagName"==s.name){for(let{parent:t}=s;t;t=t.parent)if("Block"==t.name)return{from:s.from,options:dg(),validFor:gg};return{from:s.from,options:Og,validFor:gg}}if(!e.explicit)return null;let o=s.resolve(n),a=o.childBefore(n);return a&&":"==a.name&&"PseudoClassSelector"==o.name?{from:n,options:fg,validFor:gg}:a&&":"==a.name&&"Declaration"==o.name||"ArgList"==o.name?{from:n,options:pg,validFor:gg}:"Block"==o.name||"Styles"==o.name?{from:n,options:dg(),validFor:gg}:null},xg=Sg((t=>"VariableName"==t.name)),kg=_a.define({name:"css",parser:cg.configure({props:[Na.add({Declaration:il()}),rl.add({"Block KeyframeList":ol})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function Qg(){return new Ua(kg,kg.data.of({autocomplete:xg}))}const $g=["_blank","_self","_top","_parent"],Pg=["ascii","utf-8","utf-16","latin1","latin1"],Cg=["get","post","put","delete"],_g=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Xg=["true","false"],Zg={},Ag={a:{attrs:{href:null,ping:null,type:null,media:null,target:$g,hreflang:null}},abbr:Zg,address:Zg,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Zg,aside:Zg,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Zg,base:{attrs:{href:null,target:$g}},bdi:Zg,bdo:Zg,blockquote:{attrs:{cite:null}},body:Zg,br:Zg,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Zg,center:Zg,cite:Zg,code:Zg,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:Zg,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Zg,div:Zg,dl:Zg,dt:Zg,em:Zg,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Zg,figure:Zg,footer:Zg,form:{attrs:{action:null,name:null,"accept-charset":Pg,autocomplete:["on","off"],enctype:_g,method:Cg,novalidate:["novalidate"],target:$g}},h1:Zg,h2:Zg,h3:Zg,h4:Zg,h5:Zg,h6:Zg,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Zg,hgroup:Zg,hr:Zg,html:{attrs:{manifest:null}},i:Zg,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:Zg,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Zg,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:Zg,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Pg,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:Zg,noscript:Zg,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:Zg,param:{attrs:{name:null,value:null}},pre:Zg,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Zg,rt:Zg,ruby:Zg,samp:Zg,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Pg}},section:Zg,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Zg,source:{attrs:{src:null,type:null,media:null}},span:Zg,strong:Zg,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Zg,summary:Zg,sup:Zg,table:Zg,tbody:Zg,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Zg,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:Zg,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Zg,time:{attrs:{datetime:null}},title:Zg,tr:Zg,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Zg,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:Zg},Tg={accesskey:null,class:null,contenteditable:Xg,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Xg,autocorrect:Xg,autocapitalize:Xg,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Xg,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Xg,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Xg,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Xg,"aria-hidden":Xg,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Xg,"aria-multiselectable":Xg,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Xg,"aria-relevant":null,"aria-required":Xg,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},Rg="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map((t=>"on"+t));for(let t of Rg)Tg[t]=null;class Eg{constructor(t,e){this.tags=Object.assign(Object.assign({},Ag),t),this.globalAttrs=Object.assign(Object.assign({},Tg),e),this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}function Vg(t,e,i=t.length){if(!e)return"";let n=e.firstChild,s=n&&n.getChild("TagName");return s?t.sliceString(s.from,Math.min(s.to,i)):""}function Mg(t,e=!1){for(let i=t.parent;i;i=i.parent)if("Element"==i.name){if(!e)return i;e=!1}return null}function Dg(t,e,i){let n=i.tags[Vg(t,Mg(e,!0))];return(null==n?void 0:n.children)||i.allTags}function Wg(t,e){let i=[];for(let n=e;n=Mg(n);){let s=Vg(t,n);if(s&&"CloseTag"==n.lastChild.name)break;s&&i.indexOf(s)<0&&("EndTag"==e.name||e.from>=n.firstChild.to)&&i.push(s)}return i}Eg.default=new Eg;const Ug=/^[:\-\.\w\u00b7-\uffff]*$/;function Yg(t,e,i,n,s){let r=/\s*>/.test(t.sliceDoc(s,s+5))?"":">";return{from:n,to:s,options:Dg(t.doc,i,e).map((t=>({label:t,type:"type"}))).concat(Wg(t.doc,i).map(((t,e)=>({label:"/"+t,apply:"/"+t+r,type:"type",boost:99-e})))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function qg(t,e,i,n){let s=/\s*>/.test(t.sliceDoc(n,n+5))?"":">";return{from:i,to:n,options:Wg(t.doc,e).map(((t,e)=>({label:t,apply:t+s,type:"type",boost:99-e}))),validFor:Ug}}function Lg(t,e){let{state:i,pos:n}=e,s=Xa(i).resolveInner(n),r=s.resolve(n,-1);for(let t,e=n;s==r&&(t=r.childBefore(e));){let i=t.lastChild;if(!i||!i.type.isError||i.from({label:t,type:"property"}))),validFor:Ug}}(i,t,r,"AttributeName"==r.name?r.from:n,n):"Is"==r.name||"AttributeValue"==r.name||"UnquotedAttributeValue"==r.name?function(t,e,i,n,s){var r;let o,a=null===(r=i.parent)||void 0===r?void 0:r.getChild("AttributeName"),l=[];if(a){let r=t.sliceDoc(a.from,a.to),h=e.globalAttrs[r];if(!h){let n=Mg(i),s=n?e.tags[Vg(t.doc,n)]:null;h=(null==s?void 0:s.attrs)&&s.attrs[r]}if(h){let e=t.sliceDoc(n,s).toLowerCase(),i='"',r='"';/^['"]/.test(e)?(o='"'==e[0]?/^[^"]*$/:/^[^']*$/,i="",r=t.sliceDoc(s,s+1)==e[0]?"":e[0],e=e.slice(1),n++):o=/^[^\s<>='"]*$/;for(let t of h)l.push({label:t,apply:i+t+r,type:"constant"})}}return{from:n,to:s,options:l,validFor:o}}(i,t,r,"Is"==r.name?n:r.from,n):!e.explicit||"Element"!=s.name&&"Text"!=s.name&&"Document"!=s.name?null:function(t,e,i,n){let s=[],r=0;for(let n of Dg(t.doc,i,e))s.push({label:"<"+n,type:"type"});for(let e of Wg(t.doc,i))s.push({label:"",type:"type",boost:99-r++});return{from:n,to:n,options:s,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}(i,t,r,n)}function zg(t){let{extraTags:e,extraGlobalAttributes:i}=t,n=i||e?new Eg(e,i):Eg.default;return t=>Lg(n,t)}const Ig=[{tag:"script",attrs:t=>"text/typescript"==t.type||"ts"==t.lang,parser:zf.parser},{tag:"script",attrs:t=>"text/babel"==t.type||"text/jsx"==t.type,parser:If.parser},{tag:"script",attrs:t=>"text/typescript-jsx"==t.type,parser:Bf.parser},{tag:"script",attrs:t=>!t.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(t.type),parser:qf.parser},{tag:"style",attrs:t=>(!t.lang||"css"==t.lang)&&(!t.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(t.type)),parser:kg.parser}],Bg=[{name:"style",parser:kg.parser.configure({top:"Styles"})}].concat(Rg.map((t=>({name:t,parser:qf.parser})))),jg=_a.define({name:"html",parser:FO.configure({props:[Na.add({Element(t){let e=/^(\s*)(<\/)?/.exec(t.textAfter);return t.node.to<=t.pos+e[0].length?t.continue():t.lineIndent(t.node.from)+(e[2]?0:t.unit)},"OpenTag CloseTag SelfClosingTag":t=>t.column(t.node.from)+t.unit,Document(t){if(t.pos+/\s*/.exec(t.textAfter)[0].lengtht.getChild("TagName")})],wrap:tg(Ig,Bg)}),languageData:{commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-._"}});function Ng(t={}){let e,i="";!1===t.matchClosingTags&&(i="noMatch"),!0===t.selfClosingTags&&(i=(i?i+" ":"")+"selfClosing"),(t.nestedLanguages&&t.nestedLanguages.length||t.nestedAttributes&&t.nestedAttributes.length)&&(e=tg((t.nestedLanguages||[]).concat(Ig),(t.nestedAttributes||[]).concat(Bg)));let n=e||i?jg.configure({dialect:i,wrap:e}):jg;return new Ua(n,[jg.data.of({autocomplete:zg(t)}),!1!==t.autoCloseTags?Fg:[],Nf().support,Qg().support])}const Gg=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),Fg=Ts.inputHandler.of(((t,e,i,n)=>{if(t.composing||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!jg.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((e=>{var i,r,o;let a,{head:l}=e,h=Xa(s).resolveInner(l,-1);if("TagName"!=h.name&&"StartTag"!=h.name||(h=h.parent),">"==n&&"OpenTag"==h.name){if("CloseTag"!=(null===(r=null===(i=h.parent)||void 0===i?void 0:i.lastChild)||void 0===r?void 0:r.name)&&(a=Vg(s.doc,h.parent,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`${e?"":">"}`;return{range:A.cursor(l+1),changes:{from:l+(e?1:0),insert:i}}}}else if("/"==n&&"OpenTag"==h.name){let e=h.parent,i=null==e?void 0:e.parent;if(e.from==l-1&&"CloseTag"!=(null===(o=i.lastChild)||void 0===o?void 0:o.name)&&(a=Vg(s.doc,i,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`/${a}${e?"":">"}`,n=l+i.length+(e?1:0);return{range:A.cursor(n),changes:{from:l,insert:i}}}}return{range:e}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)})),Hg=Qa({commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}}}),Jg=new ho,Kg=sO.configure({props:[rl.add((t=>!t.is("Block")||t.is("Document")||null!=tm(t)?void 0:(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to}))),Jg.add(tm),Na.add({Document:()=>null}),ka.add({Document:Hg})]});function tm(t){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(t.name);return e?+e[1]:void 0}function em(t,e){let i=t;for(;;){let t,n=i.nextSibling;if(!n||null!=(t=tm(n.type))&&t<=e)break;i=n}return i.to}const im=sl.of(((t,e,i)=>{for(let n=Xa(t).resolveInner(i,-1);n&&!(n.fromi)return{from:i,to:e}}return null}));function nm(t){return new Pa(Hg,t,[im],"markdown")}const sm=nm(Kg),rm=nm(Kg.configure([pO,mO,gO,bO]));class om{constructor(t,e,i,n,s,r,o){this.node=t,this.from=e,this.to=i,this.spaceBefore=n,this.spaceAfter=s,this.type=r,this.item=o}blank(t,e=!0){let i=this.spaceBefore+("Blockquote"==this.node.name?">":"");if(null!=t){for(;i.length0;t--)i+=" ";return i+(e?this.spaceAfter:"")}marker(t,e){let i="OrderedList"==this.node.name?String(+lm(this.item,t)[2]+e):"";return this.spaceBefore+i+this.type+this.spaceAfter}}function am(t,e){let i=[];for(let e=t;e&&"Document"!=e.name;e=e.parent)"ListItem"!=e.name&&"Blockquote"!=e.name&&"FencedCode"!=e.name||i.push(e);let n=[];for(let t=i.length-1;t>=0;t--){let s,r=i[t],o=e.lineAt(r.from),a=r.from-o.from;if("FencedCode"==r.name)n.push(new om(r,a,a,"","","",null));else if("Blockquote"==r.name&&(s=/^[ \t]*>( ?)/.exec(o.text.slice(a))))n.push(new om(r,a,a+s[0].length,"",s[1],">",null));else if("ListItem"==r.name&&"OrderedList"==r.parent.name&&(s=/^([ \t]*)\d+([.)])([ \t]*)/.exec(o.text.slice(a)))){let t=s[3],e=s[0].length;t.length>=4&&(t=t.slice(0,t.length-4),e-=4),n.push(new om(r.parent,a,a+e,s[1],t,s[2],r))}else if("ListItem"==r.name&&"BulletList"==r.parent.name&&(s=/^([ \t]*)([-+*])([ \t]{1,4}\[[ xX]\])?([ \t]+)/.exec(o.text.slice(a)))){let t=s[4],e=s[0].length;t.length>4&&(t=t.slice(0,t.length-4),e-=4);let i=s[2];s[3]&&(i+=s[3].replace(/[xX]/," ")),n.push(new om(r.parent,a,a+e,s[1],t,i,r))}}return n}function lm(t,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(t.from,t.from+10))}function hm(t,e,i,n=0){for(let s=-1,r=t;;){if("ListItem"==r.name){let t=lm(r,e),o=+t[2];if(s>=0){if(o!=s+1)return;i.push({from:r.from+t[1].length,to:r.from+t[0].length,insert:String(s+2+n)})}s=o}let t=r.nextSibling;if(!t)break;r=t}}function cm(t){return"QuoteMark"==t.name||"ListMark"==t.name}const um=[{key:"Enter",run:({state:t,dispatch:e})=>{let i=Xa(t),{doc:n}=t,s=null,r=t.changeByRange((e=>{if(!e.empty||!rm.isActiveAt(t,e.from))return s={range:e};let r=e.from,o=n.lineAt(r),a=am(i.resolveInner(r,-1),n);for(;a.length&&a[a.length-1].from>r-o.from;)a.pop();if(!a.length)return s={range:e};let l=a[a.length-1];if(l.to-l.spaceAfter.length>r-o.from)return s={range:e};let h=r>=l.to-l.spaceAfter.length&&!/\S/.test(o.text.slice(l.to));if(l.item&&h){if(l.node.firstChild.to>=r||o.from>0&&!/[^\s>]/.test(n.lineAt(o.from-1).text)){let t,e=a.length>1?a[a.length-2]:null,i="";e&&e.item?(t=o.from+e.from,i=e.marker(n,1)):t=o.from+(e?e.to:0);let s=[{from:t,to:r,insert:i}];return"OrderedList"==l.node.name&&hm(l.item,n,s,-2),e&&"OrderedList"==e.node.name&&hm(e.item,n,s),{range:A.cursor(t+i.length),changes:s}}{let e="";for(let t=0,i=a.length-2;t<=i;t++)e+=a[t].blank(t\s*$/.exec(i.text);if(s&&s.index==l.from){let n=t.changes([{from:i.from+s.index,to:i.to},{from:o.from+l.from,to:o.to}]);return{range:e.map(n),changes:n}}}let c=[];"OrderedList"==l.node.name&&hm(l.item,n,c);let u=l.item&&l.item.from]*/.exec(o.text)[0].length>=l.to)for(let t=0,e=a.length-1;t<=e;t++)d+=t!=e||u?a[t].blank(to.from&&/\s/.test(o.text.charAt(f-o.from-1));)f--;return d=t.lineBreak+d,c.push({from:f,to:r,insert:d}),{range:A.cursor(f+d.length),changes:c}}));return!s&&(e(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0)}},{key:"Backspace",run:({state:t,dispatch:e})=>{let i=Xa(t),n=null,s=t.changeByRange((e=>{let s=e.from,{doc:r}=t;if(e.empty&&rm.isActiveAt(t,e.from)){let t=r.lineAt(s),n=am(function(t,e){let i=t.resolveInner(e,-1),n=e;cm(i)&&(n=i.from,i=i.parent);for(let t;t=i.childBefore(n);)if(cm(t))n=t.from;else{if("OrderedList"!=t.name&&"BulletList"!=t.name)break;i=t.lastChild,n=i.to}return i}(i,s),r);if(n.length){let i=n[n.length-1],r=i.to-i.spaceAfter.length+(i.spaceAfter?1:0);if(s-t.from>r&&!/\S/.test(t.text.slice(r,s-t.from)))return{range:A.cursor(t.from+r),changes:{from:t.from+r,to:s}};if(s-t.from==r&&(!i.item||t.from<=i.item.from||!/\S/.test(t.text.slice(0,i.to)))){let n=t.from+i.from;if(i.item&&i.node.fromt.from-e.from||t.startSide-e.startSide)),ni.set(i)}getMatchingBracket(t){switch(t){case")":return"(";case"]":return"[";case"}":return"{";default:return null}}},{decorations:t=>t.decorations});var fm="[a-zA-Z\\$][a-zA-Z0-9\\$]*",pm="(?:\\.\\d+|\\d+\\.\\d*|\\d+)",Om="(?:`(?:`?"+pm+")?)",gm=new RegExp("(?:(?:\\d+)(?:\\^\\^(?:\\.\\w+|\\w+\\.\\w*|\\w+)"+Om+"?(?:\\*\\^[+-]?\\d+)?))"),mm=new RegExp("(?:"+pm+Om+"?(?:\\*\\^[+-]?\\d+)?)"),bm=new RegExp("(?:`?)(?:"+fm+")(?:`(?:"+fm+"))*(?:`?)");let wm=[];const vm=["True","False","All","None","Null","Full","$Failed","$Aborted"];function ym(t,e){var i;return'"'===(i=t.next())?(e.tokenize=Sm,e.tokenize(t,e)):"("===i&&t.eat("*")?(e.commentLevel++,e.tokenize=xm,e.tokenize(t,e)):(t.backUp(1),t.match(gm,!0,!1)||t.match(mm,!0,!1)?"number":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::usage)/,!0,!1)?"meta":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::[a-zA-Z\$][a-zA-Z0-9\$]*):?/,!0,!1)?"string.special":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*\s*:)(?:(?:[a-zA-Z\$][a-zA-Z0-9\$]*)|(?:[^:=>~@\^\&\*\)\[\]'\?,\|])).*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+/,!0,!1)||t.match(/_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)?"variableName.special":t.match(/\\\[[a-zA-Z\$][a-zA-Z0-9\$]*\]/,!0,!1)?"character":t.match(/(?:\[|\]|{|}|\(|\))/,!0,!1)?"bracket":t.match(/(?:#[a-zA-Z\$][a-zA-Z0-9\$]*|#+[0-9]?)/,!0,!1)?"variableName.constant":t.match(bm,!0,!1)?vm.indexOf(t.current())>-1?"number":wm.indexOf(t.current())>-1||0==wm.length?"keyword":t.current()in e.localVars?"atom":(e.localVars[t.current()]=!0,"function"):t.match(/(?:\\|\+|\-|\*|\/|,|;|\.|:|@|~|=|>|<|&|\||_|`|'|\^|\?|!|%)/,!0,!1)?"operator":(t.next(),"error"))}function Sm(t,e){for(var i,n=!1,s=!1;null!=(i=t.next());){if('"'===i&&!s){n=!0;break}s=!s&&"\\"===i}return n&&!s&&(e.tokenize=ym),"string"}function xm(t,e){for(var i,n;e.commentLevel>0&&null!=(n=t.next());)"("===i&&"*"===n&&e.commentLevel++,"*"===i&&")"===n&&e.commentLevel--,i=n;return e.commentLevel<=0&&(e.tokenize=ym),"comment"}const km={name:"mathematica",extendVariables:function(t){},startState:function(){return{tokenize:ym,commentLevel:0,localVars:{}}},token:function(t,e){return t.eatSpace()?null:e.tokenize(t,e)},languageData:{commentTokens:{block:{open:"(*",close:"*)"}}}};let Qm={of:t=>[Gl.define(km),Yd({override:[async e=>function(t,e){let i=t.matchBefore(/\w*/);return i.from!==i.to||t.explicit?{from:i.from,options:e.data}:null}(e,t)]}),Ys.of([{key:"Escape",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((t=>{let{from:e,to:i}=t;return{changes:{from:e,to:i,insert:"EC"},range:A.cursor(e+2)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])],reBuild:t=>{wm=t.map((t=>t.label))}};const $m=(t,e,i,n)=>{if(0==t.length)return;const s=(new Date).valueOf();let r=0;i.dom.loadingMark=!0;const o=i.dom.style.background;let a=0;console.log("Start animation");const l=setInterval((()=>{i.dom.style.setProperty("background","hsl("+a+"deg 100% 97%)","important"),a+=2,a>360&&(a=0)}),30);n.transaction(e,i,s,t.length);for(const a of t)Pm(a,((a,h)=>{n.file(e,i,s,a,h),r++,r>=t.length&&i.dom&&i.dom.loadingMark&&(i.dom.loadingMark=!1,setTimeout((()=>{i.dom.style.background=o,clearInterval(l),console.log("Stop animation")}),2e3))}),(()=>{console.warn("Fauilure");const t=i.dom.style.background;i.dom.style.background="rgb(255 189 189 / 97%)";let e=97;const n=setInterval((()=>{i.dom.style.background="rgb(255 189 189 / "+Math.round(e)+"%)",e*=.95}),30);clearInterval(l),setTimeout((()=>{clearInterval(n),i.dom.style.background=t}),3e3)}))};function Pm(t,e,i){const n=new FileReader;n.addEventListener("load",(n=>{const s=n.target.result;if(s.byteLength/1024/1024>15)return alert("Files > 15Mb are not supported for drag and drop"),void i();let r=base64ArrayBuffer(s);e(t.name,r)})),n.addEventListener("progress",(t=>{if(t.loaded&&t.total){const e=t.loaded/t.total*100;console.log(e)}})),n.readAsArrayBuffer(t)}const Cm=(t,e)=>Ts.domEventHandlers({drop(e,i){e.preventDefault();const n=[];e.dataTransfer.items?[...e.dataTransfer.items].forEach(((t,e)=>{if("file"===t.kind){const i=t.getAsFile();console.log(`… file[${e}].name = ${i.name}`),n.push(i)}})):[...e.dataTransfer.files].forEach(((t,e)=>{console.log(`… file[${e}].name = ${t.name}`),n.push(t)})),$m(n,e,i,t)},paste(t,i){let n=t.clipboardData||window.clipboardData;for(const s of n.items)if("string"===s.kind)switch(s.type){case"text/plain":break;case"image/png":t.preventDefault(),$m([s.getAsFile()],t,i,e)}else t.preventDefault(),$m([s.getAsFile()],t,i,e)}}),_m=new pr({regexp:/\\\[(\w+)\]/g,decoration:t=>ni.replace({widget:new Zm(t[1])})}),Xm=_i.fromClass(class{constructor(t){this.Greekholder=_m.createDeco(t)}update(t){this.Greekholder=_m.updateDeco(t,this.Greekholder)}},{decorations:t=>t.Greekholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Greekholder||ni.none))});class Zm extends ei{constructor(t){super(),this.name=t}eq(t){return this.name===t.name}toDOM(){let t=document.createElement("span");return t.innerHTML="&"+this.name.toLowerCase().replace("sqrt","radic").replace("undirectededge","harr").replace("directededge","rarr").replace(/capital(.*)/,((t,e)=>e.charAt(0).toUpperCase()+e.slice(1))).replace(/curly(.*)/,((t,e)=>e)).replace(/script(.*)/,((t,e)=>"el"+e.toLowerCase())).replace("transpose","#7488").replace("degree","deg")+";",t}ignoreEvent(){return!1}}const Am=new pr({regexp:/(->|<-)/g,decoration:t=>ni.replace({widget:new Tm(t[1])})});_i.fromClass(class{constructor(t){this.Arrowholder=Am.createDeco(t)}update(t){this.Arrowholder=Am.updateDeco(t,this.Arrowholder)}},{decorations:t=>t.Arrowholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Arrowholder||ni.none))});class Tm extends ei{constructor(t){super(),this.dir=t}eq(t){return this.dir===t.dir}toDOM(){let t=document.createElement("span");return"->"===this.dir?t.innerText="→":t.innerText="←",t}ignoreEvent(){return!1}}function Rm(t){if(!(t=t||{}).open)throw new Error('Balanced: please provide a "open" property');if(!t.close)throw new Error('Balanced: please provide a "close" property');if(this.balance=t.balance||!1,this.exceptions=t.exceptions||!1,this.caseInsensitive=t.caseInsensitive,this.head=t.head||t.open,this.head=Array.isArray(this.head)?this.head:[this.head],this.open=Array.isArray(t.open)?t.open:[t.open],this.close=Array.isArray(t.close)?t.close:[t.close],!Array.isArray(this.head)||!Array.isArray(this.open)||!Array.isArray(this.close)||this.head.length!==this.open.length||this.open.length!==this.close.length)throw new Error('Balanced: if you use arrays for a "head,open,close" you must use matching arrays for all options');var e=Dm(this.head.map(this.regExpFromArrayGroupedMap,this)),i=Dm(this.open.map(this.regExpFromArrayGroupedMap,this)),n=Dm(this.close.map(this.regExpFromArrayGroupedMap,this));this.regExp=Dm([e,i,n],"g"+(this.caseInsensitive?"i":"")),this.regExpGroupLength=this.head.length}function Em(t,e,i){for(var n=Mm(e.substr(0,i+1),/^.*\n?$/gim),s=Mm(e,/^.*\n?$/gim),r=n.length-1,o=i+1-(n.length?n[n.length-1].index:0),a="",l=2;l>=0;l--)r-l>=0&&s[r-l]&&(a+=e.substr(s[r-l].index,s[r-l].length)+"\n");for(l=0;l=0&&s[r+l]&&(a+=e.substr(s[r+l].index,s[r+l].length)+"\n");a=a.replace(/\t/g," ").replace(/\n$/,"");var h=new Error(t+" at "+(r+1)+":"+o+"\n\n"+a);return h.line=r+1,h.column=o,h.index=i,h}function Vm(t,e){return t>=e.index&&t<=e.index+e.length-1}function Mm(t,e){var i,n=new RegExp(e),s=[];if(t)for(;i=n.exec(t);)s.push({index:i.index,length:i[0].length,match:i[0]}),i[0].length||n.lastIndex++;return s}function Dm(t,e,i){var n=t.map((function(t){return t instanceof RegExp?t.source:function(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}(t)}),this).join("|");return n=i?"("+n+")":"(?:"+n+")",new RegExp(n,e||void 0)}Rm.prototype={regExpFromArrayGroupedMap:function(t){return Dm([t],null,!0)},matchContentsInBetweenBrackets:function(t,e){for(var i,n=new RegExp(this.regExp),s=[],r=[],o=null,a=!0;i=n.exec(t);){if(e){for(var l=!1,h=0;h{const i=((t,e,i)=>{var n,s=new RegExp(t),r=[];if(e)for(;n=s.exec(e);){if(i){for(var o=!1,a=0;a{new qm({open:"(*"+t+"[*)",close:"(*]"+t+"*)",balance:!1}).matchContentsInBetweenBrackets(e.value,[]).forEach((function(t){const s=e.value.slice(t.index+t.head.length,t.index+t.length-t.tail.length);n(i+t.index,{length:t.length,pos:i+t.index,argsPos:i+t.index+t.head.length,str:s})}))})(e,t,i,s)},o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)r(o,a)}var Im,Bm=function(){function t(t){var e=t.tag,i=t.decoration,n=t.decorate,s=t.boundary,r=t.maxLength,o=void 0===r?1e3:r;if(this.tag=e,n)this.addMatch=function(t,e,i,s){return n(s,i,i+t.length,t,e)};else if("function"==typeof i)this.addMatch=function(t,e,n,s){var r=i(t,e,n);r&&s(n,n+t.length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=function(t,e,n,s){return s(n,n+t.length,i)}}this.boundary=s,this.maxLength=o}return t.prototype.createDeco=function(t){for(var e=this,i=new Xt,n=i.add.bind(i),s=0,r=function(t,e){var i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;for(var n=[],s=0,r=i;s=a?n[n.length-1].to=l:n.push({from:a,to:l})}return n}(t,this.maxLength);st.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e},t.prototype.updateRange=function(t,e,i,n){for(var s=this,r=function(r){var a=Math.max(r.from,i),l=Math.min(r.to,n);if(l>a){var h=t.state.doc.lineAt(a),c=h.toh.from;a--)if(o.boundary.test(h.text[a-1-h.from])){u=a;break}for(;ld},add:f})}},o=this,a=0,l=t.visibleRanges;a{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*FB[*)((_)(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*FB[*)(("+s+")(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let Nm=class{constructor(t,e,i,n,s,r){this.view=e,this.visibleValue=t,this.placeholder=r,console.log(r),this.args=Lm(t.str,/\(\*,\*\)/gm);const o=this;let a,l;console.log("creating InstanceWidget"),a=Im({doc:o.args[0].body.slice(2,-1),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(o.visibleValue.pos),e.dispatch({selection:{anchor:o.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return l.dispatch({selection:{anchor:0}}),l.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){l.focus(),t.editorLastCursor=void 0}}])]}),l=Im({doc:o.args[2].body.slice(1,-2),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:a.state.doc.length}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:o.visibleValue.pos+o.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus(),t.editorLastCursor=void 0}}])]}),o.args[0].length=o.args[0].body.length,o.args[2].length=o.args[2].body.length,delete o.args[2].body,delete o.args[1].body,delete o.args[0].body,this.topEditor=a,this.bottomEditor=l}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="(("+t+")",s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length));const r=e.length-i[0].length;i[0].to=i[0].to+r,i[2].from=i[2].from+r,i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e="("+t+"))",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length));const r=e.length-i[2].length;i[2].to=i[2].to+r,i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t,e){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm),console.log("recreating InstanceWidget"),n=Im.state({doc:e.args[0].body.slice(2,-1),update:t=>e.applyChanges(t,0),eval:()=>{i.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(e.visibleValue.pos),i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus(),t.editorLastCursor=void 0}}])]}),s=Im.state({doc:e.args[2].body.slice(1,-2),update:t=>e.applyChanges(t,2),eval:()=>{e.view.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus(),t.editorLastCursor=void 0}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),console.log(e),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.placeholder=e,this.visibleValue.argsPos=t.argsPos}destroy(){this.topEditor.destroy(),this.bottomEditor.destroy()}},Gm=class extends ei{constructor(t,e,i,n){super(),this.view=i,this.visibleValue=t,this.reference=e,this.placeholder=n}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue,this),!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("fraction");const i=document.createElement("table");i.classList.add("container"),e.appendChild(i);const n=document.createElement("tbody");i.appendChild(n);const s=document.createElement("tr"),r=document.createElement("tr");n.appendChild(s),n.appendChild(r);const o=document.createElement("td");o.classList.add("enumenator"),s.appendChild(o);const a=document.createElement("td");r.appendChild(a);const l=this;return e.EditorWidget=new Nm(this.visibleValue,t,o,a,[],this),this.DOMElement=e,this.reference.push({destroy:()=>{l.destroy(e)}}),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const Fm=(t,e,i)=>new Bm({tag:"FB",decoration:n=>ni.replace({widget:new Gm(n,t,e,i)})}),Hm=t=>_i.fromClass(class{constructor(e){this.disposable=[],this.placeholder=Fm(this.disposable,e,this).createDeco(e),t.placeholder=this}update(t){this.placeholder=Fm(this.disposable,t,this).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var Jm;function Km(t){return Jm=t,[nb,Ys.of([{key:"Ctrl-2",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt[_](*]SqB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt["+s+"](*]SqB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let tb=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;this.sliceRanges=n,this.length=t.str.length,console.log("creating InstanceWidget"),this.editor=Jm({doc:t.str.slice(...n),parent:i,update:t=>r.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]})}applyChanges(t){const e=t,i={from:this.visibleValue.argsPos+5,to:this.visibleValue.argsPos+this.length-1,insert:e};console.log(this.visibleValue);const n=e.length+6-this.length;this.length=this.length+n,this.visibleValue.length=this.visibleValue.length+n,this.visibleValue.str="Sqrt["+e+"]",this.view.dispatch({changes:i})}update(t){if(this.visibleValue.str==t.str)this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos;else{console.warn("Out of sync"),this.visibleValue=t;const e=this.sliceRanges,i=this.editor,n=this,s=this.view;this.length=t.str.length;const r=Jm.state({doc:t.str.slice(...e),update:t=>n.applyChanges(t),eval:()=>{s.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos+n.visibleValue.length}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]});i.setState(r)}}destroy(){console.warn("destroy Instance of Widget!"),this.editor.destroy()}},eb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("sqroot");const i=this,n=document.createElement("span");return n.classList.add("radicand"),e.EditorWidget=new tb(this.visibleValue,t,n,[5,-1],[]),e.appendChild(n),this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const ib=(t,e)=>new Bm({tag:"SqB",decoration:i=>ni.replace({widget:new eb(i,t,e)})}),nb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=ib(this.disposable,t).createDeco(t)}update(t){this.placeholder=ib(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var sb;function rb(t){return sb=t,[hb,Ys.of([{key:"Ctrl--",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SbB[*)Subscript[_(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SbB[*)Subscript["+s+"(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let ob=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),console.log(r.visibleValue),o=sb({doc:r.args[0].body.slice(10),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){a.focus()}}])]}),a=sb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Subscript["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),console.log(e.visibleValue),n=sb.state({doc:e.args[0].body.slice(10),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus()}}])]}),s=sb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},ab=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sub");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new ob(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const lb=(t,e)=>new Bm({tag:"SbB",decoration:i=>ni.replace({widget:new ab(i,t,e)})}),hb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=lb(this.disposable,t).createDeco(t)}update(t){this.placeholder=lb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var cb;function ub(t){return cb=t,[Ob,Ys.of([{key:"Ctrl-6",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SpB[*)Power[_(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SpB[*)Power["+s+"(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let db=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),o=cb({doc:r.args[0].body.slice(6),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus()}}])]}),a=cb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Power["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),n=cb.state({doc:e.args[0].body.slice(6),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.bottomEditor.focus()}}])]}),s=cb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},fb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sup");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new db(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}destroy(t){t.EditorWidget.destroy()}};const pb=(t,e)=>new Bm({tag:"SpB",decoration:i=>ni.replace({widget:new fb(i,t,e)})}),Ob=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=pb(this.disposable,t).createDeco(t)}update(t){this.placeholder=pb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var gb={},mb={},bb={},wb={};function vb(t){let e=t.length;for(;--e>=0;)t[e]=0}const yb=256,Sb=286,xb=30,kb=15,Qb=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),$b=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Pb=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Cb=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_b=new Array(576);vb(_b);const Xb=new Array(60);vb(Xb);const Zb=new Array(512);vb(Zb);const Ab=new Array(256);vb(Ab);const Tb=new Array(29);vb(Tb);const Rb=new Array(xb);function Eb(t,e,i,n,s){this.static_tree=t,this.extra_bits=e,this.extra_base=i,this.elems=n,this.max_length=s,this.has_stree=t&&t.length}let Vb,Mb,Db;function Wb(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}vb(Rb);const Ub=t=>t<256?Zb[t]:Zb[256+(t>>>7)],Yb=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},qb=(t,e,i)=>{t.bi_valid>16-i?(t.bi_buf|=e<>16-t.bi_valid,t.bi_valid+=i-16):(t.bi_buf|=e<{qb(t,i[2*e],i[2*e+1])},zb=(t,e)=>{let i=0;do{i|=1&t,t>>>=1,i<<=1}while(--e>0);return i>>>1},Ib=(t,e,i)=>{const n=new Array(16);let s,r,o=0;for(s=1;s<=kb;s++)o=o+i[s-1]<<1,n[s]=o;for(r=0;r<=e;r++){let e=t[2*r+1];0!==e&&(t[2*r]=zb(n[e]++,e))}},Bb=t=>{let e;for(e=0;e{t.bi_valid>8?Yb(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},Nb=(t,e,i,n)=>{const s=2*e,r=2*i;return t[s]{const n=t.heap[i];let s=i<<1;for(;s<=t.heap_len&&(s{let n,s,r,o,a=0;if(0!==t.sym_next)do{n=255&t.pending_buf[t.sym_buf+a++],n+=(255&t.pending_buf[t.sym_buf+a++])<<8,s=t.pending_buf[t.sym_buf+a++],0===n?Lb(t,s,e):(r=Ab[s],Lb(t,r+yb+1,e),o=Qb[r],0!==o&&(s-=Tb[r],qb(t,s,o)),n--,r=Ub(n),Lb(t,r,i),o=$b[r],0!==o&&(n-=Rb[r],qb(t,n,o)))}while(a{const i=e.dyn_tree,n=e.stat_desc.static_tree,s=e.stat_desc.has_stree,r=e.stat_desc.elems;let o,a,l,h=-1;for(t.heap_len=0,t.heap_max=573,o=0;o>1;o>=1;o--)Gb(t,i,o);l=r;do{o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Gb(t,i,1),a=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=a,i[2*l]=i[2*o]+i[2*a],t.depth[l]=(t.depth[o]>=t.depth[a]?t.depth[o]:t.depth[a])+1,i[2*o+1]=i[2*a+1]=l,t.heap[1]=l++,Gb(t,i,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const i=e.dyn_tree,n=e.max_code,s=e.stat_desc.static_tree,r=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,l=e.stat_desc.max_length;let h,c,u,d,f,p,O=0;for(d=0;d<=kb;d++)t.bl_count[d]=0;for(i[2*t.heap[t.heap_max]+1]=0,h=t.heap_max+1;h<573;h++)c=t.heap[h],d=i[2*i[2*c+1]+1]+1,d>l&&(d=l,O++),i[2*c+1]=d,c>n||(t.bl_count[d]++,f=0,c>=a&&(f=o[c-a]),p=i[2*c],t.opt_len+=p*(d+f),r&&(t.static_len+=p*(s[2*c+1]+f)));if(0!==O){do{for(d=l-1;0===t.bl_count[d];)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[l]--,O-=2}while(O>0);for(d=l;0!==d;d--)for(c=t.bl_count[d];0!==c;)u=t.heap[--h],u>n||(i[2*u+1]!==d&&(t.opt_len+=(d-i[2*u+1])*i[2*u],i[2*u+1]=d),c--)}})(t,e),Ib(i,h,t.bl_count)},Jb=(t,e,i)=>{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),e[2*(i+1)+1]=65535,n=0;n<=i;n++)s=o,o=e[2*(n+1)+1],++a{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),n=0;n<=i;n++)if(s=o,o=e[2*(n+1)+1],!(++a{qb(t,0+(n?1:0),3),jb(t),Yb(t,i),Yb(t,~i),i&&t.pending_buf.set(t.window.subarray(e,e+i),t.pending),t.pending+=i};wb._tr_init=t=>{tw||((()=>{let t,e,i,n,s;const r=new Array(16);for(i=0,n=0;n<28;n++)for(Tb[n]=i,t=0;t<1<>=7;n{let s,r,o=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e{let e;for(Jb(t,t.dyn_ltree,t.l_desc.max_code),Jb(t,t.dyn_dtree,t.d_desc.max_code),Hb(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*Cb[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=i+5,i+4<=s&&-1!==e?ew(t,e,i,n):4===t.strategy||r===s?(qb(t,2+(n?1:0),3),Fb(t,_b,Xb)):(qb(t,4+(n?1:0),3),((t,e,i,n)=>{let s;for(qb(t,e-257,5),qb(t,i-1,5),qb(t,n-4,4),s=0;s(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=i,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(Ab[i]+yb+1)]++,t.dyn_dtree[2*Ub(e)]++),t.sym_next===t.sym_end),wb._tr_align=t=>{qb(t,2,3),Lb(t,256,_b),(t=>{16===t.bi_valid?(Yb(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)};var iw=(t,e,i,n)=>{let s=65535&t|0,r=t>>>16&65535|0,o=0;for(;0!==i;){o=i>2e3?2e3:i,i-=o;do{s=s+e[n++]|0,r=r+s|0}while(--o);s%=65521,r%=65521}return s|r<<16|0};const nw=new Uint32Array((()=>{let t,e=[];for(var i=0;i<256;i++){t=i;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e})());var sw=(t,e,i,n)=>{const s=nw,r=n+i;t^=-1;for(let i=n;i>>8^s[255&(t^e[i])];return-1^t},rw={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},ow={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:aw,_tr_stored_block:lw,_tr_flush_block:hw,_tr_tally:cw,_tr_align:uw}=wb,dw=iw,fw=sw,pw=rw,{Z_NO_FLUSH:Ow,Z_PARTIAL_FLUSH:gw,Z_FULL_FLUSH:mw,Z_FINISH:bw,Z_BLOCK:ww,Z_OK:vw,Z_STREAM_END:yw,Z_STREAM_ERROR:Sw,Z_DATA_ERROR:xw,Z_BUF_ERROR:kw,Z_DEFAULT_COMPRESSION:Qw,Z_FILTERED:$w,Z_HUFFMAN_ONLY:Pw,Z_RLE:Cw,Z_FIXED:_w,Z_DEFAULT_STRATEGY:Xw,Z_UNKNOWN:Zw,Z_DEFLATED:Aw}=ow,Tw=258,Rw=262,Ew=42,Vw=113,Mw=666,Dw=(t,e)=>(t.msg=pw[e],e),Ww=t=>2*t-(t>4?9:0),Uw=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Yw=t=>{let e,i,n,s=t.w_size;e=t.hash_size,n=e;do{i=t.head[--n],t.head[n]=i>=s?i-s:0}while(--e);e=s,n=e;do{i=t.prev[--n],t.prev[n]=i>=s?i-s:0}while(--e)};let qw=(t,e,i)=>(e<{const e=t.state;let i=e.pending;i>t.avail_out&&(i=t.avail_out),0!==i&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+i),t.next_out),t.next_out+=i,e.pending_out+=i,t.total_out+=i,t.avail_out-=i,e.pending-=i,0===e.pending&&(e.pending_out=0))},zw=(t,e)=>{hw(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Lw(t.strm)},Iw=(t,e)=>{t.pending_buf[t.pending++]=e},Bw=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},jw=(t,e,i,n)=>{let s=t.avail_in;return s>n&&(s=n),0===s?0:(t.avail_in-=s,e.set(t.input.subarray(t.next_in,t.next_in+s),i),1===t.state.wrap?t.adler=dw(t.adler,e,s,i):2===t.state.wrap&&(t.adler=fw(t.adler,e,s,i)),t.next_in+=s,t.total_in+=s,s)},Nw=(t,e)=>{let i,n,s=t.max_chain_length,r=t.strstart,o=t.prev_length,a=t.nice_match;const l=t.strstart>t.w_size-Rw?t.strstart-(t.w_size-Rw):0,h=t.window,c=t.w_mask,u=t.prev,d=t.strstart+Tw;let f=h[r+o-1],p=h[r+o];t.prev_length>=t.good_match&&(s>>=2),a>t.lookahead&&(a=t.lookahead);do{if(i=e,h[i+o]===p&&h[i+o-1]===f&&h[i]===h[r]&&h[++i]===h[r+1]){r+=2,i++;do{}while(h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&ro){if(t.match_start=e,o=n,n>=a)break;f=h[r+o-1],p=h[r+o]}}}while((e=u[e&c])>l&&0!=--s);return o<=t.lookahead?o:t.lookahead},Gw=t=>{const e=t.w_size;let i,n,s;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Rw)&&(t.window.set(t.window.subarray(e,e+e-n),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Yw(t),n+=e),0===t.strm.avail_in)break;if(i=jw(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=i,t.lookahead+t.insert>=3)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=qw(t,t.ins_h,t.window[s+1]);t.insert&&(t.ins_h=qw(t,t.ins_h,t.window[s+3-1]),t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead{let i,n,s,r=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,o=0,a=t.strm.avail_in;do{if(i=65535,s=t.bi_valid+42>>3,t.strm.avail_outn+t.strm.avail_in&&(i=n+t.strm.avail_in),i>s&&(i=s),i>8,t.pending_buf[t.pending-2]=~i,t.pending_buf[t.pending-1]=~i>>8,Lw(t.strm),n&&(n>i&&(n=i),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+n),t.strm.next_out),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n,t.block_start+=n,i-=n),i&&(jw(t.strm,t.strm.output,t.strm.next_out,i),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i)}while(0===o);return a-=t.strm.avail_in,a&&(a>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=a&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-a,t.strm.next_in),t.strstart),t.strstart+=a,t.insert+=a>t.w_size-t.insert?t.w_size-t.insert:a),t.block_start=t.strstart),t.high_waters&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,s+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),s>t.strm.avail_in&&(s=t.strm.avail_in),s&&(jw(t.strm,t.window,t.strstart,s),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.high_water>3,s=t.pending_buf_size-s>65535?65535:t.pending_buf_size-s,r=s>t.w_size?t.w_size:s,n=t.strstart-t.block_start,(n>=r||(n||e===bw)&&e!==Ow&&0===t.strm.avail_in&&n<=s)&&(i=n>s?s:n,o=e===bw&&0===t.strm.avail_in&&i===n?1:0,lw(t,t.block_start,i,o),t.block_start+=i,Lw(t.strm)),o?3:1)},Hw=(t,e)=>{let i,n;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==i&&t.strstart-i<=t.w_size-Rw&&(t.match_length=Nw(t,i)),t.match_length>=3)if(n=cw(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=qw(t,t.ins_h,t.window[t.strstart+1]);else n=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2},Jw=(t,e)=>{let i,n,s;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==i&&t.prev_length4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){s=t.strstart+t.lookahead-3,n=cw(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=s&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(zw(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(n=cw(t,0,t.window[t.strstart-1]),n&&zw(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=cw(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2};function Kw(t,e,i,n,s){this.good_length=t,this.max_lazy=e,this.nice_length=i,this.max_chain=n,this.func=s}const tv=[new Kw(0,0,0,0,Fw),new Kw(4,4,8,4,Hw),new Kw(4,5,16,8,Hw),new Kw(4,6,32,32,Hw),new Kw(4,4,16,16,Jw),new Kw(8,16,32,32,Jw),new Kw(8,16,128,128,Jw),new Kw(8,32,128,256,Jw),new Kw(32,128,258,1024,Jw),new Kw(32,258,258,4096,Jw)];function ev(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Aw,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Uw(this.dyn_ltree),Uw(this.dyn_dtree),Uw(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Uw(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Uw(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const iv=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==Ew&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==Vw&&e.status!==Mw?1:0},nv=t=>{if(iv(t))return Dw(t,Sw);t.total_in=t.total_out=0,t.data_type=Zw;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?Ew:Vw,t.adler=2===e.wrap?0:1,e.last_flush=-2,aw(e),vw},sv=t=>{const e=nv(t);var i;return e===vw&&((i=t.state).window_size=2*i.w_size,Uw(i.head),i.max_lazy_match=tv[i.level].max_lazy,i.good_match=tv[i.level].good_length,i.nice_match=tv[i.level].nice_length,i.max_chain_length=tv[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=2,i.match_available=0,i.ins_h=0),e},rv=(t,e,i,n,s,r)=>{if(!t)return Sw;let o=1;if(e===Qw&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),s<1||s>9||i!==Aw||n<8||n>15||e<0||e>9||r<0||r>_w||8===n&&1!==o)return Dw(t,Sw);8===n&&(n=9);const a=new ev;return t.state=a,a.strm=t,a.status=Ew,a.wrap=o,a.gzhead=null,a.w_bits=n,a.w_size=1<rv(t,e,Aw,15,8,Xw),bb.deflateInit2=rv,bb.deflateReset=sv,bb.deflateResetKeep=nv,bb.deflateSetHeader=(t,e)=>iv(t)||2!==t.state.wrap?Sw:(t.state.gzhead=e,vw),bb.deflate=(t,e)=>{if(iv(t)||e>ww||e<0)return t?Dw(t,Sw):Sw;const i=t.state;if(!t.output||0!==t.avail_in&&!t.input||i.status===Mw&&e!==bw)return Dw(t,0===t.avail_out?kw:Sw);const n=i.last_flush;if(i.last_flush=e,0!==i.pending){if(Lw(t),0===t.avail_out)return i.last_flush=-1,vw}else if(0===t.avail_in&&Ww(e)<=Ww(n)&&e!==bw)return Dw(t,kw);if(i.status===Mw&&0!==t.avail_in)return Dw(t,kw);if(i.status===Ew&&0===i.wrap&&(i.status=Vw),i.status===Ew){let e=Aw+(i.w_bits-8<<4)<<8,n=-1;if(n=i.strategy>=Pw||i.level<2?0:i.level<6?1:6===i.level?2:3,e|=n<<6,0!==i.strstart&&(e|=32),e+=31-e%31,Bw(i,e),0!==i.strstart&&(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),t.adler=1,i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(57===i.status)if(t.adler=0,Iw(i,31),Iw(i,139),Iw(i,8),i.gzhead)Iw(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),Iw(i,255&i.gzhead.time),Iw(i,i.gzhead.time>>8&255),Iw(i,i.gzhead.time>>16&255),Iw(i,i.gzhead.time>>24&255),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(Iw(i,255&i.gzhead.extra.length),Iw(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=fw(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if(Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,3),i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw;if(69===i.status){if(i.gzhead.extra){let e=i.pending,n=(65535&i.gzhead.extra.length)-i.gzindex;for(;i.pending+n>i.pending_buf_size;){let s=i.pending_buf_size-i.pending;if(i.pending_buf.set(i.gzhead.extra.subarray(i.gzindex,i.gzindex+s),i.pending),i.pending=i.pending_buf_size,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex+=s,Lw(t),0!==i.pending)return i.last_flush=-1,vw;e=0,n-=s}let s=new Uint8Array(i.gzhead.extra);i.pending_buf.set(s.subarray(i.gzindex,i.gzindex+n),i.pending),i.pending+=n,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex=0}i.status=73}if(73===i.status){if(i.gzhead.name){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),i.gzindex=0}i.status=91}if(91===i.status){if(i.gzhead.comment){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n))}i.status=103}if(103===i.status){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size&&(Lw(t),0!==i.pending))return i.last_flush=-1,vw;Iw(i,255&t.adler),Iw(i,t.adler>>8&255),t.adler=0}if(i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(0!==t.avail_in||0!==i.lookahead||e!==Ow&&i.status!==Mw){let n=0===i.level?Fw(i,e):i.strategy===Pw?((t,e)=>{let i;for(;;){if(0===t.lookahead&&(Gw(t),0===t.lookahead)){if(e===Ow)return 1;break}if(t.match_length=0,i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):i.strategy===Cw?((t,e)=>{let i,n,s,r;const o=t.window;for(;;){if(t.lookahead<=Tw){if(Gw(t),t.lookahead<=Tw&&e===Ow)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(s=t.strstart-1,n=o[s],n===o[++s]&&n===o[++s]&&n===o[++s])){r=t.strstart+Tw;do{}while(n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&st.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(i=cw(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):tv[i.level].func(i,e);if(3!==n&&4!==n||(i.status=Mw),1===n||3===n)return 0===t.avail_out&&(i.last_flush=-1),vw;if(2===n&&(e===gw?uw(i):e!==ww&&(lw(i,0,0,!1),e===mw&&(Uw(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),Lw(t),0===t.avail_out))return i.last_flush=-1,vw}return e!==bw?vw:i.wrap<=0?yw:(2===i.wrap?(Iw(i,255&t.adler),Iw(i,t.adler>>8&255),Iw(i,t.adler>>16&255),Iw(i,t.adler>>24&255),Iw(i,255&t.total_in),Iw(i,t.total_in>>8&255),Iw(i,t.total_in>>16&255),Iw(i,t.total_in>>24&255)):(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),Lw(t),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?vw:yw)},bb.deflateEnd=t=>{if(iv(t))return Sw;const e=t.state.status;return t.state=null,e===Vw?Dw(t,xw):vw},bb.deflateSetDictionary=(t,e)=>{let i=e.length;if(iv(t))return Sw;const n=t.state,s=n.wrap;if(2===s||1===s&&n.status!==Ew||n.lookahead)return Sw;if(1===s&&(t.adler=dw(t.adler,e,i,0)),n.wrap=0,i>=n.w_size){0===s&&(Uw(n.head),n.strstart=0,n.block_start=0,n.insert=0);let t=new Uint8Array(n.w_size);t.set(e.subarray(i-n.w_size,i),0),e=t,i=n.w_size}const r=t.avail_in,o=t.next_in,a=t.input;for(t.avail_in=i,t.next_in=0,t.input=e,Gw(n);n.lookahead>=3;){let t=n.strstart,e=n.lookahead-2;do{n.ins_h=qw(n,n.ins_h,n.window[t+3-1]),n.prev[t&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=t,t++}while(--e);n.strstart=t,n.lookahead=2,Gw(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,t.next_in=o,t.input=a,t.avail_in=r,n.wrap=s,vw},bb.deflateInfo="pako deflate (from Nodeca project)";var ov={};const av=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);ov.assign=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const e in i)av(i,e)&&(t[e]=i[e])}}return t},ov.flattenChunks=t=>{let e=0;for(let i=0,n=t.length;i=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;cv[254]=cv[254]=1,lv.string2buf=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,i,n,s,r,o=t.length,a=0;for(s=0;s>>6,e[r++]=128|63&i):i<65536?(e[r++]=224|i>>>12,e[r++]=128|i>>>6&63,e[r++]=128|63&i):(e[r++]=240|i>>>18,e[r++]=128|i>>>12&63,e[r++]=128|i>>>6&63,e[r++]=128|63&i);return e};lv.buf2string=(t,e)=>{const i=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let n,s;const r=new Array(2*i);for(s=0,n=0;n4)r[s++]=65533,n+=o-1;else{for(e&=2===o?31:3===o?15:7;o>1&&n1?r[s++]=65533:e<65536?r[s++]=e:(e-=65536,r[s++]=55296|e>>10&1023,r[s++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&hv)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let i="";for(let n=0;n{(e=e||t.length)>t.length&&(e=t.length);let i=e-1;for(;i>=0&&128==(192&t[i]);)i--;return i<0||0===i?e:i+cv[t[i]]>e?i:e};var uv=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const dv=bb,fv=ov,pv=lv,Ov=rw,gv=uv,mv=Object.prototype.toString,{Z_NO_FLUSH:bv,Z_SYNC_FLUSH:wv,Z_FULL_FLUSH:vv,Z_FINISH:yv,Z_OK:Sv,Z_STREAM_END:xv,Z_DEFAULT_COMPRESSION:kv,Z_DEFAULT_STRATEGY:Qv,Z_DEFLATED:$v}=ow;function Pv(t){this.options=fv.assign({level:kv,method:$v,chunkSize:16384,windowBits:15,memLevel:8,strategy:Qv},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new gv,this.strm.avail_out=0;let i=dv.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(i!==Sv)throw new Error(Ov[i]);if(e.header&&dv.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?pv.string2buf(e.dictionary):"[object ArrayBuffer]"===mv.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,i=dv.deflateSetDictionary(this.strm,t),i!==Sv)throw new Error(Ov[i]);this._dict_set=!0}}function Cv(t,e){const i=new Pv(e);if(i.push(t,!0),i.err)throw i.msg||Ov[i.err];return i.result}Pv.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize;let s,r;if(this.ended)return!1;for(r=e===~~e?e:!0===e?yv:bv,"string"==typeof t?i.input=pv.string2buf(t):"[object ArrayBuffer]"===mv.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),(r===wv||r===vv)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(s=dv.deflate(i,r),s===xv)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),s=dv.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===Sv;if(0!==i.avail_out){if(r>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},Pv.prototype.onData=function(t){this.chunks.push(t)},Pv.prototype.onEnd=function(t){t===Sv&&(this.result=fv.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},mb.Deflate=Pv,mb.deflate=Cv,mb.deflateRaw=function(t,e){return(e=e||{}).raw=!0,Cv(t,e)},mb.gzip=function(t,e){return(e=e||{}).gzip=!0,Cv(t,e)},mb.constants=ow;var _v={},Xv={};const Zv=16209;const Av=15,Tv=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Rv=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Ev=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Vv=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Mv=(t,e,i,n,s,r,o,a)=>{const l=a.bits;let h,c,u,d,f,p,O=0,g=0,m=0,b=0,w=0,v=0,y=0,S=0,x=0,k=0,Q=null;const $=new Uint16Array(16),P=new Uint16Array(16);let C,_,X,Z=null;for(O=0;O<=Av;O++)$[O]=0;for(g=0;g=1&&0===$[b];b--);if(w>b&&(w=b),0===b)return s[r++]=20971520,s[r++]=20971520,a.bits=1,0;for(m=1;m0&&(0===t||1!==b))return-1;for(P[1]=0,O=1;O852||2===t&&x>592)return 1;for(;;){C=O-y,o[g]+1=p?(_=Z[o[g]-p],X=Q[o[g]-p]):(_=96,X=0),h=1<>y)+c]=C<<24|_<<16|X|0}while(0!==c);for(h=1<>=1;if(0!==h?(k&=h-1,k+=h):k=0,g++,0==--$[O]){if(O===b)break;O=e[i+o[g]]}if(O>w&&(k&d)!==u){for(0===y&&(y=w),f+=m,v=O-y,S=1<852||2===t&&x>592)return 1;u=k&d,s[u]=w<<24|v<<16|f-r|0}}return 0!==k&&(s[f+k]=O-y<<24|64<<16|0),a.bits=w,0};const Dv=iw,Wv=sw,Uv=function(t,e){let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,y,S,x,k,Q;const $=t.state;i=t.next_in,k=t.input,n=i+(t.avail_in-5),s=t.next_out,Q=t.output,r=s-(e-t.avail_out),o=s+(t.avail_out-257),a=$.dmax,l=$.wsize,h=$.whave,c=$.wnext,u=$.window,d=$.hold,f=$.bits,p=$.lencode,O=$.distcode,g=(1<<$.lenbits)-1,m=(1<<$.distbits)-1;t:do{f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,0===w)Q[s++]=65535&b;else{if(!(16&w)){if(0==(64&w)){b=p[(65535&b)+(d&(1<>>=w,f-=w),f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,!(16&w)){if(0==(64&w)){b=O[(65535&b)+(d&(1<a){t.msg="invalid distance too far back",$.mode=Zv;break t}if(d>>>=w,f-=w,w=s-r,y>w){if(w=y-w,w>h&&$.sane){t.msg="invalid distance too far back",$.mode=Zv;break t}if(S=0,x=u,0===c){if(S+=l-w,w2;)Q[s++]=x[S++],Q[s++]=x[S++],Q[s++]=x[S++],v-=3;v&&(Q[s++]=x[S++],v>1&&(Q[s++]=x[S++]))}else{S=s-y;do{Q[s++]=Q[S++],Q[s++]=Q[S++],Q[s++]=Q[S++],v-=3}while(v>2);v&&(Q[s++]=Q[S++],v>1&&(Q[s++]=Q[S++]))}break}}break}}while(i>3,i-=v,f-=v<<3,d&=(1<(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function hy(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const cy=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode16211?1:0},uy=t=>{if(cy(t))return Nv;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Kv,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,Iv},dy=t=>{if(cy(t))return Nv;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,uy(t)},fy=(t,e)=>{let i;if(cy(t))return Nv;const n=t.state;return e<0?(i=0,e=-e):(i=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?Nv:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=i,n.wbits=e,dy(t))},py=(t,e)=>{if(!t)return Nv;const i=new hy;t.state=i,i.strm=t,i.window=null,i.mode=Kv;const n=fy(t,e);return n!==Iv&&(t.state=null),n};let Oy,gy,my=!0;const by=t=>{if(my){Oy=new Int32Array(512),gy=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Yv(1,t.lens,0,288,Oy,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Yv(2,t.lens,0,32,gy,0,t.work,{bits:5}),my=!1}t.lencode=Oy,t.lenbits=9,t.distcode=gy,t.distbits=5},wy=(t,e,i,n)=>{let s;const r=t.state;return null===r.window&&(r.wsize=1<=r.wsize?(r.window.set(e.subarray(i-r.wsize,i),0),r.wnext=0,r.whave=r.wsize):(s=r.wsize-r.wnext,s>n&&(s=n),r.window.set(e.subarray(i-n,i-n+s),r.wnext),(n-=s)?(r.window.set(e.subarray(i-n,i),0),r.wnext=n,r.whave=r.wsize):(r.wnext+=s,r.wnext===r.wsize&&(r.wnext=0),r.whavepy(t,15),Xv.inflateInit2=py,Xv.inflate=(t,e)=>{let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,y,S,x,k=0;const Q=new Uint8Array(4);let $,P;const C=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(cy(t)||!t.output||!t.input&&0!==t.avail_in)return Nv;i=t.state,i.mode===ey&&(i.mode=iy),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,u=a,d=l,x=Iv;t:for(;;)switch(i.mode){case Kv:if(0===i.wrap){i.mode=iy;break}for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0),h=0,c=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",i.mode=ay;break}if((15&h)!==Jv){t.msg="unknown compression method",i.mode=ay;break}if(h>>>=4,c-=4,S=8+(15&h),0===i.wbits&&(i.wbits=S),S>15||S>i.wbits){t.msg="invalid window size",i.mode=ay;break}i.dmax=1<>8&1),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16182;case 16182:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>8&255,Q[2]=h>>>16&255,Q[3]=h>>>24&255,i.check=Wv(i.check,Q,4,0)),h=0,c=0,i.mode=16183;case 16183:for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>8),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16184;case 16184:if(1024&i.flags){for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(f=i.length,f>a&&(f=a),f&&(i.head&&(S=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(n.subarray(r,r+f),S)),512&i.flags&&4&i.wrap&&(i.check=Wv(i.check,n,f,r)),a-=f,r+=f,i.length-=f),i.length))break t;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===a)break t;f=0;do{S=n[r+f++],i.head&&S&&i.length<65536&&(i.head.name+=String.fromCharCode(S))}while(S&&f>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=ey;break;case 16189:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>=7&c,c-=7&c,i.mode=oy;break}for(;c<3;){if(0===a)break t;a--,h+=n[r++]<>>=1,c-=1,3&h){case 0:i.mode=16193;break;case 1:if(by(i),i.mode=sy,e===zv){h>>>=2,c-=2;break t}break;case 2:i.mode=16196;break;case 3:t.msg="invalid block type",i.mode=ay}h>>>=2,c-=2;break;case 16193:for(h>>>=7&c,c-=7&c;c<32;){if(0===a)break t;a--,h+=n[r++]<>>16^65535)){t.msg="invalid stored block lengths",i.mode=ay;break}if(i.length=65535&h,h=0,c=0,i.mode=ny,e===zv)break t;case ny:i.mode=16195;case 16195:if(f=i.length,f){if(f>a&&(f=a),f>l&&(f=l),0===f)break t;s.set(n.subarray(r,r+f),o),a-=f,r+=f,l-=f,o+=f,i.length-=f;break}i.mode=ey;break;case 16196:for(;c<14;){if(0===a)break t;a--,h+=n[r++]<>>=5,c-=5,i.ndist=1+(31&h),h>>>=5,c-=5,i.ncode=4+(15&h),h>>>=4,c-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=ay;break}i.have=0,i.mode=16197;case 16197:for(;i.have>>=3,c-=3}for(;i.have<19;)i.lens[C[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,$={bits:i.lenbits},x=Yv(0,i.lens,0,19,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid code lengths set",i.mode=ay;break}i.have=0,i.mode=16198;case 16198:for(;i.have>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=g,c-=g,i.lens[i.have++]=b;else{if(16===b){for(P=g+2;c>>=g,c-=g,0===i.have){t.msg="invalid bit length repeat",i.mode=ay;break}S=i.lens[i.have-1],f=3+(3&h),h>>>=2,c-=2}else if(17===b){for(P=g+3;c>>=g,c-=g,S=0,f=3+(7&h),h>>>=3,c-=3}else{for(P=g+7;c>>=g,c-=g,S=0,f=11+(127&h),h>>>=7,c-=7}if(i.have+f>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=ay;break}for(;f--;)i.lens[i.have++]=S}}if(i.mode===ay)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=ay;break}if(i.lenbits=9,$={bits:i.lenbits},x=Yv(1,i.lens,0,i.nlen,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid literal/lengths set",i.mode=ay;break}if(i.distbits=6,i.distcode=i.distdyn,$={bits:i.distbits},x=Yv(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,$),i.distbits=$.bits,x){t.msg="invalid distances set",i.mode=ay;break}if(i.mode=sy,e===zv)break t;case sy:i.mode=ry;case ry:if(a>=6&&l>=258){t.next_out=o,t.avail_out=l,t.next_in=r,t.avail_in=a,i.hold=h,i.bits=c,Uv(t,d),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,i.mode===ey&&(i.back=-1);break}for(i.back=0;k=i.lencode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,i.length=b,0===m){i.mode=16205;break}if(32&m){i.back=-1,i.mode=ey;break}if(64&m){t.msg="invalid literal/length code",i.mode=ay;break}i.extra=15&m,i.mode=16201;case 16201:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;k=i.distcode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,64&m){t.msg="invalid distance code",i.mode=ay;break}i.offset=b,i.extra=15&m,i.mode=16203;case 16203:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=ay;break}i.mode=16204;case 16204:if(0===l)break t;if(f=d-l,i.offset>f){if(f=i.offset-f,f>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=ay;break}f>i.wnext?(f-=i.wnext,p=i.wsize-f):p=i.wnext-f,f>i.length&&(f=i.length),O=i.window}else O=s,p=o-i.offset,f=i.length;f>l&&(f=l),l-=f,i.length-=f;do{s[o++]=O[p++]}while(--f);0===i.length&&(i.mode=ry);break;case 16205:if(0===l)break t;s[o++]=i.length,l--,i.mode=ry;break;case oy:if(i.wrap){for(;c<32;){if(0===a)break t;a--,h|=n[r++]<{if(cy(t))return Nv;let e=t.state;return e.window&&(e.window=null),t.state=null,Iv},Xv.inflateGetHeader=(t,e)=>{if(cy(t))return Nv;const i=t.state;return 0==(2&i.wrap)?Nv:(i.head=e,e.done=!1,Iv)},Xv.inflateSetDictionary=(t,e)=>{const i=e.length;let n,s,r;return cy(t)?Nv:(n=t.state,0!==n.wrap&&n.mode!==ty?Nv:n.mode===ty&&(s=1,s=Dv(s,e,i,0),s!==n.check)?Gv:(r=wy(t,e,i,i),r?(n.mode=16210,Fv):(n.havedict=1,Iv)))},Xv.inflateInfo="pako inflate (from Nodeca project)";const vy=Xv,yy=ov,Sy=lv,xy=rw,ky=uv,Qy=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},$y=Object.prototype.toString,{Z_NO_FLUSH:Py,Z_FINISH:Cy,Z_OK:_y,Z_STREAM_END:Xy,Z_NEED_DICT:Zy,Z_STREAM_ERROR:Ay,Z_DATA_ERROR:Ty,Z_MEM_ERROR:Ry}=ow;function Ey(t){this.options=yy.assign({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ky,this.strm.avail_out=0;let i=vy.inflateInit2(this.strm,e.windowBits);if(i!==_y)throw new Error(xy[i]);if(this.header=new Qy,vy.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=Sy.string2buf(e.dictionary):"[object ArrayBuffer]"===$y.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(i=vy.inflateSetDictionary(this.strm,e.dictionary),i!==_y)))throw new Error(xy[i])}function Vy(t,e){const i=new Ey(e);if(i.push(t),i.err)throw i.msg||xy[i.err];return i.result}Ey.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize,s=this.options.dictionary;let r,o,a;if(this.ended)return!1;for(o=e===~~e?e:!0===e?Cy:Py,"[object ArrayBuffer]"===$y.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),r=vy.inflate(i,o),r===Zy&&s&&(r=vy.inflateSetDictionary(i,s),r===_y?r=vy.inflate(i,o):r===Ty&&(r=Zy));i.avail_in>0&&r===Xy&&i.state.wrap>0&&0!==t[i.next_in];)vy.inflateReset(i),r=vy.inflate(i,o);switch(r){case Ay:case Ty:case Zy:case Ry:return this.onEnd(r),this.ended=!0,!1}if(a=i.avail_out,i.next_out&&(0===i.avail_out||r===Xy))if("string"===this.options.to){let t=Sy.utf8border(i.output,i.next_out),e=i.next_out-t,s=Sy.buf2string(i.output,t);i.next_out=e,i.avail_out=n-e,e&&i.output.set(i.output.subarray(t,t+e),0),this.onData(s)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(r!==_y||0!==a){if(r===Xy)return r=vy.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},Ey.prototype.onData=function(t){this.chunks.push(t)},Ey.prototype.onEnd=function(t){t===_y&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=yy.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},_v.Inflate=Ey,_v.inflate=Vy,_v.inflateRaw=function(t,e){return(e=e||{}).raw=!0,Vy(t,e)},_v.ungzip=Vy,_v.constants=ow;const{Deflate:My,deflate:Dy,deflateRaw:Wy,gzip:Uy}=mb,{Inflate:Yy,inflate:qy,inflateRaw:Ly,ungzip:zy}=_v,Iy=ow;gb.Deflate=My,gb.deflate=Dy,gb.deflateRaw=Wy,gb.gzip=Uy,gb.Inflate=Yy,gb.inflate=qy,gb.inflateRaw=Ly,gb.ungzip=zy,gb.constants=Iy;const By=gb;let jy={};var Ny;function Gy(t){return Ny=t,[tS]}jy.Util={},jy.Decode={},jy.Messages=[],jy.Log=function(t){jy.Messages.push(["I",t]),console.log("Mma.js INFO: ",t)},jy.Warn=function(t){jy.Messages.push(["W",t]),console.log("Mma.js WARNING: ",t)},jy.Fail=function(t){throw jy.Messages.push(["E",t]),"Mma.js ERROR: "+t},jy.Util.Base64Decode=function(t){for(var e=atob(t),i=e.length>>>0,n=new Uint8Array(i),s=0;s1&&0===t[0]&&jy.Fail("IntegerAP: input starts with 0: "+String(t)),this.nstring=t}else void 0===t?this.nstring=void 0:jy.Fail("Integer: invalid input: "+String(t))},jy.RealMP=function(t){"number"==typeof t?this.n=t:void 0===t?this.n=void 0:jy.Fail("RealMP: invalid input")},jy.RealAP=function(t){"string"==typeof t?(t.length>1&&0===t[0]&&jy.Fail("RealAP: input starts with 0: "+String(t)),this.nstring=t):void 0===t?this.nstring=void 0:jy.Fail("RealAP: invalid input: "+String(t))},jy.Symbol=function(t){"string"==typeof t?this.name=t:void 0===t?this.name=void 0:jy.Fail("Symbol: invalid input: "+String(t))},jy.String=function(t){"string"==typeof t?this.str=t:void 0===t?this.str=void 0:jy.Fail("String: invalid input: "+String(t))},jy.Expression=function(t,e){t instanceof jy.Symbol||jy.Fail("Expression: head must be an Mma.Symbol"),e instanceof Array||jy.Fail("Expression: parts must be an Array"),this.head=t,this.parts=e},jy.Decode.Int32=function(t,e){try{return new DataView(t.buffer).getInt32(e,!0)}catch(t){return 0}},jy.Decode.Float64=function(t,e){try{return new DataView(t.buffer).getFloat64(e,!0)}catch(t){return 0}},jy.Decode.String=function(t,e,i){return void 0===e&&(e=0),void 0===i&&(i=t.length),jy.Util.U8ArrayToString(t.slice(e,e+i))},jy.Decode.StringEntry=function(t,e){void 0===e&&(e=0);var i=jy.Decode.Int32(t,e);return{length:i,string:jy.Decode.String(t,e+4,i),bytesRead:i+4}},jy.Decode.Any=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=1/0);var n=e;for(var s=0,r=[];ee%2!=0?t:{...t,body:Lm(t.body,/\(\*\|\*\)/gm)})),Array.isArray(this.args[this.args.length-1].body)||(this.decorator=this.args.pop());const r=this.args;console.log("creating InstanceWidget");for(let t=0;t{e.viewState.state.config.eval()},update:e=>this.applyChanges(e,t,i),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to&&!t.stringOnly)return i-2>=0?(o[i-2].editor.dispatch({selection:{anchor:o[i-2].editor.state.doc.length}}),o[i-2].editor.focus(),void(t.editorLastCursor=void 0)):(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0));t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to&&!t.stringOnly)return i+2=0)return r[t-2].body[i].editor.focus(),void(e.editorLastCursor=void 0)}},{key:"ArrowDown",run:function(e,n){if(t+2{},focus:()=>{},dispatch:()=>{},stringOnly:!0};const t=l.match(Fy);if(t){a.innerHTML=t[1];const e=jy.DecompressDecode(t[2]),i=jy.toArray(e.parts[0]),n=uuidv4();interpretate(i,{global:{call:n},element:a})}else a.innerHTML=l.slice(1,-1)}delete o[i].body,n.appendChild(a)}i.appendChild(n)}if(this.decorator){const t=jy.DecompressDecode(this.decorator.body.slice(2,-2)),e=jy.toArray(t.parts[0]);let n={global:{call:uuidv4(),EditorWidget:s},element:i};this.interpretated=interpretate(e,n)}}applyChanges(t,e,i){const n=this.args,s=this.args[e].body,r=this.visibleValue.argsPos,o=this.args[e].from;let a=t;0==i&&0==e&&(a="{{"+a),0==i&&0!=e&&(a="{"+a),i==s.length-1&&e==n.length-1&&(a+="}}"),i==s.length-1&&e!=n.length-1&&(a+="}");const l=s[i].length,h={from:r+o+s[i].from,to:r+o+s[i].from+l,insert:a},c=a.length-l;for(let t=i+1;t{s.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.args[0].body[0].editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.args[0].body[0].editor.focus();else{const t=this.DOMElement.EditorWidget.args,e=t[t.length-1].body[t[t.length-1].body.length-1].editor;e.dispatch({selection:{anchor:e.state.doc.length}}),e.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const Ky=(t,e)=>new Bm({tag:"GB",decoration:i=>ni.replace({widget:new Jy(i,t,e)})}),tS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=Ky(this.disposable,t).createDeco(t)}update(t){this.placeholder=Ky(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});function eS(t){return[rS]}let iS=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.span=i,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this,r=this.args[1].body.slice(3,-3),o=jy.DecompressDecode(r),a=jy.toArray(o.parts[0]);this.data=a;const l="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}));this.cuid=l;let h={call:l,EditorWidget:s},c={global:h,element:i};this.expression=a,this.env=c,this.interpretated=interpretate(a,c),this.interpretated.then((()=>{if(c.options?.Event){console.warn("Event listeners are enabled!"),s.events=c.options.Event;let t=c;if(h.stack){const e=Object.values(h.stack);e.length>0&&(console.log("Attaching first found instance..."),t=e[0].env)}interpretate(["MetaMarker","'"+l+"'"],t).then((()=>{server.kernel.emitt(s.events,'"'+l+'"',"Mounted")}))}}))}getDoc(){return this.args[0].body.slice(1,-1)}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+t+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].length=s.length,this.view.dispatch({changes:r})}applyOuterChanges(t){const e=this.visibleValue,i=t,n={from:e.pos,to:e.pos+e.length,insert:i};this.view.dispatch({changes:n})}update(t){if(!this.deactivated){if(t.str!=this.visibleValue.str){console.warn("Out of sync"),console.log("recreate..."),this.destroy();const e=this.span;return e.replaceChildren(),void this._construct(t,this.view,e)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}}destroy(t){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.events&&server.kernel.emitt(this.events,'"'+this.cuid+'"',"Destroy"),delete this.data}},nS=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=this;let i=document.createElement("span");return i.classList.add("frontend-view"),i.EditorWidget=new iS(this.visibleValue,t,i),this.reference.push({destroy:()=>{e.destroy(i)}}),i}ignoreEvent(){return!0}destroy(t){console.log("destroy in general*"),t.EditorWidget.destroy()}};const sS=(t,e)=>new Bm({tag:"VB",decoration:i=>ni.replace({widget:new nS(i,t,e)})}),rS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=sS(this.disposable,t).createDeco(t)}update(t){this.placeholder=sS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var oS;function aS(t){return oS=t,[uS]}let lS=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.span=i,this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this;this.epilog={offset:0,string:""},this.prolog={offset:0,string:""};const r=this.args[1].body.slice(3,-3),o=jy.DecompressDecode(r),a=jy.toArray(o.parts[0]);this.data=a;let l={global:{call:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)})),element:i,origin:s},element:i};this.env=l,interpretate(a,l).then((()=>{if(l.options?.Head&&(s.prolog.offset=l.options.Head.length+1,s.prolog.string=l.options.Head+"[",s.epilog.offset=1,s.epilog.string="]"),l.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=l.options.Event),l.options?.String){s.prolog.offset=1,s.prolog.string='"',s.epilog.offset=1,s.epilog.string='"',l.options?.HeadString&&(s.prolog.string=l.options.HeadString,s.prolog.offset=s.prolog.string.length),l.options?.TailString&&(s.epilog.string=l.options.TailString,s.epilog.offset=s.epilog.string.length),s.editor={destroy:()=>{console.log("Nothing to destroy, this is just a text field.")}};const t=document.createElement("span");return this.aa,t.onkeydown=function(t){13===t.keyCode&&t.preventDefault()},t.contentEditable="plaintext-only",t.innerText=s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),t.addEventListener("input",console.log),t.addEventListener("input",(()=>{console.log("Update"),console.log(t.innerText),this.applyChanges(t.innerText)})),l.global.element.appendChild(t),void(s.events&&server.kernel.emitt(s.events,"Null","Mounted"))}s.editor=oS({doc:s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),parent:l.global.element,update:t=>this.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos+s.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]}),s.events&&server.kernel.emitt(s.events,"Null","Mounted")}))}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+this.prolog.string+t+this.epilog.string+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length));const o=s.length-i[0].length;i[0].length=s.length,this.visibleValue.length=this.visibleValue.length+o,this.view.dispatch({changes:r})}update(t){if(this.visibleValue.str!=t.str)return console.warn("Out of sync"),console.log("recreating InstanceWidget"),this.destroy(),this.span.replaceChildren(),void this._construct(t,this.view,this.span);this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.editor.destroy(),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}},hS=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("subscript-tail"),e.EditorWidget=new lS(this.visibleValue,t,e,[]);const i=this;return this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const cS=(t,e)=>new Bm({tag:"BB",decoration:i=>ni.replace({widget:new hS(i,t,e)})}),uS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=cS(this.disposable,t).createDeco(t)}update(t){this.placeholder=cS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var dS;function fS(t){return dS=t,[mS]}class pS{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm);const s=this,r=Array.from({length:Math.ceil((s.args.length-3)/2)},((t,e)=>2*e+1));s.indexes=r;const o=[];this.span=i,this.spans=o;for(let t=0;t{c.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=c.options.Event),s.editors=r.map(((t,i)=>dS({doc:s.args[t].body,parent:o[i],update:e=>this.applyChanges(e,t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i>0?s.editors[i-1].focus():(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus()),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return it.destroy())),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}}class OS extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("inline-flex"),e.EditorWidget=new pS(this.visibleValue,t,e,[]);const i=this;return this.DOMElement=e,this.reference.push({destroy:()=>{i.destroy(e)}}),e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;const n=this.DOMElement.EditorWidget.editors;return t.from-e.from<0?(n[n.length-1].dispatch({selection:{anchor:n[n.length-1].state.doc.length}}),n[n.length-1].focus()):(n[0].dispatch({selection:{anchor:0}}),n[0].focus()),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}}const gS=(t,e)=>new Bm({tag:"TB",decoration:i=>ni.replace({widget:new OS(i,t,e)})}),mS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=gS(this.disposable,t).createDeco(t)}update(t){this.placeholder=gS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});const bS=_i.fromClass(class{decorations=ni.none;constructor(t){this.view=t,this.recompute()}recompute(t){let e,i,n=[];for(let{from:t,to:e}of this.view.visibleRanges)this.getDecorationsFor(t,e,n);this.decorations=ni.set(n,!0),this.decorations=this.decorations.update({filter:(n,s)=>!(n>e&&s=e&&s.selection.main.head<=i)return!0;if(!n&&s.selection.main.head>e&&s.selection.main.headt.decorations});class wS extends ei{constructor(t,e){super(),this.rawValue=t,this.visibleValue=e}eq(t){return this.rawValue===t.rawValue}toDOM(){let t=document.createElement("div");t.classList.add("cell-type-widget");const e=this.rawValue.split(" "),i=e[0].split(".");if(console.log(i),t.classList.add("cell-type-"+i[1].trim()),t.innerText=e[0].trim(),e.length>1){const n=e.slice(1),s=document.createElement("span");return s.appendChild(t),n.forEach((t=>{const e=document.createElement("span");e.innerText=t,e.classList.add("cell-type-"+i[1].trim()+"-"+t.split("=")[0]),s.appendChild(e)})),s}return t}ignoreEvent(){return!1}}const vS=new F,yS=new F,SS=[],xS=Sl.define([{tag:Sa.meta,color:"var(--editor-key-meta)"},{tag:Sa.link,textDecoration:"underline"},{tag:Sa.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Sa.emphasis,fontStyle:"italic"},{tag:Sa.strong,fontWeight:"bold"},{tag:Sa.strikethrough,textDecoration:"line-through"},{tag:Sa.keyword,color:"var(--editor-key-keyword)"},{tag:[Sa.atom,Sa.bool,Sa.url,Sa.contentSeparator,Sa.labelName],color:"var(--editor-key-atom)"},{tag:[Sa.literal,Sa.inserted],color:"var(--editor-key-literal)"},{tag:[Sa.string,Sa.deleted],color:"var(--editor-key-string)"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],color:"var(--editor-key-escape)"},{tag:Sa.definition(Sa.variableName),color:"var(--editor-key-variable)"},{tag:Sa.local(Sa.variableName),color:"var(--editor-local-variable)"},{tag:[Sa.typeName,Sa.namespace],color:"var(--editor-key-type)"},{tag:Sa.className,color:"var(--editor-key-class)"},{tag:[Sa.special(Sa.variableName),Sa.macroName],color:"var(--editor-special-variable)"},{tag:Sa.definition(Sa.propertyName),color:"var(--editor-key-property)"},{tag:Sa.comment,color:"var(--editor-key-comment)"},{tag:Sa.invalid,color:"var(--editor-key-invalid)"}]),kS={data:[],extend:t=>{kS.data.push(...t),Qm.reBuild(kS.data)},replaceAll:t=>{kS.data=t,Qm.reBuild(kS.data)}},QS=Gl.define({name:"spreadsheet",startState:function(){return{stringType:null,stack:[]}},token:function(t,e){if(t){switch(0===e.stack.length&&('"'!=t.peek()&&"'"!=t.peek()||(e.stringType=t.peek(),t.next(),e.stack.unshift("string"))),e.stack[0]){case"string":for(;"string"===e.stack[0]&&!t.eol();)t.peek()===e.stringType?(t.next(),e.stack.shift()):"\\"===t.peek()?(t.next(),t.next()):t.match(/^.[^\\\"\']*/);return"string";case"characterClass":for(;"characterClass"===e.stack[0]&&!t.eol();)t.match(/^[^\]\\]+/)||t.match(/^\\./)||e.stack.shift();return"operator"}var i=t.peek();switch(i){case"[":return t.next(),e.stack.unshift("characterClass"),"bracket";case":":return t.next(),"operator";case"\\":return t.match(/\\[a-z]+/)?"string.special":(t.next(),"atom");case".":case",":case";":case"*":case"-":case"+":case"^":case"<":case"/":case"=":return t.next(),"atom";case"$":return t.next(),"builtin"}return t.match(/\d+/)?t.match(/^\w+/)?"error":"number":t.match(/^[a-zA-Z_]\w*/)?t.match(/(?=[\(.])/,!1)?"keyword":"variable":-1!=["[","]","(",")","{","}"].indexOf(i)?(t.next(),"bracket"):(t.eatSpace()||t.next(),null)}}}),$S=new RegExp(/^[\w]*\.[\w]+/);function PS(t){const e=$S.exec(t),i=Object.values(window.SupportedLanguages);for(let t=0;t{if(!t.docChanged)return null;let e=PS(t.newDoc.line(1).text);if(e.legacy){const i=t.startState.facet(Wa);if(i){if(i.name==e.name)return null}else if(t.startState.facet(CS)==e.name)return null;return console.log("switching... to "+e.name),{effects:vS.reconfigure(e.plugins)}}return e.name===t.startState.facet(Wa).name?null:(console.log("switching... to "+e.name),{effects:vS.reconfigure(e.plugins)})}));let XS,ZS=null;const AS=t=>{const e=t||XS;return e&&e.viewState?(console.log(),PS(e.state.doc.line(1).text).name):""},TS=t=>{const e=t||XS;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return!1;const n=i[0];return[n.from,n.to]},RS=t=>{const e=t||XS;return e&&e.viewState?e.state.doc.toString():""},ES=t=>{const e=t||XS;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return"";const n=i[0];return console.log("yoko"),console.log(n),console.log(e.state.doc.toString().slice(n.from,n.to)),console.log("processing"),e.state.doc.toString().slice(n.from,n.to)},VS=(t,e)=>{const i=e||XS;if(!i)return;if(!i.viewState)return;const n=i.viewState.state.selection.ranges;if(!n.length)return;const s=n[0];console.log("result"),console.log(t),i.dispatch({changes:{...s,insert:t}})},MS=()=>XS,DS=(t,e)=>{const i=e||XS;i&&i.viewState&&(console.log("result"),console.log(t),i.dispatch({changes:{from:0,to:i.viewState.state.doc.length,insert:t}}))};ZS=t=>{let e=new Ts({doc:t.doc,extensions:[Ys.of([{key:"Tab",run:function(t,e){return sd(t)}},{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,LS,Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(XS=e.view)}))],parent:t.parent});return e.viewState.state.config.eval=t.eval,e},ZS.state=t=>{let e=xt.create({doc:t.doc,extensions:[Ys.of([{key:"Tab",run:function(t,e){return sd(t)}},{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,LS,Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(XS=e.view)}))]});return e.config.eval=t.eval,e};const WS={transaction:(t,e,i,n)=>{if(console.log(e.dom.ocellref),e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:DropEvent"]')}},file:(t,e,i,n,s)=>{console.log(e.dom.ocellref),e.dom.ocellref&&server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},US={transaction:(t,e,i,n)=>{if(console.log(e.dom.ocellref),e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:PasteEvent"]')}},file:(t,e,i,n,s)=>{console.log(e.dom.ocellref),e.dom.ocellref&&server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},YS=[Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Cm(WS,US)];let qS=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"}}),LS=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"},".cm-scroller":{"line-height":"inherit","overflow-x":"overlay","overflow-y":"overlay","align-items":"initial"},".cm-content":{padding:"0px 0"},".rainbow-bracket-red":{color:"var(--editor-bracket-1)"},".rainbow-bracket-orange":{color:"var(--editor-bracket-2)"},".rainbow-bracket-yellow":{color:"var(--editor-bracket-3)"},".rainbow-bracket-green":{color:"var(--editor-bracket-4)"},".rainbow-bracket-blue":{color:"var(--editor-bracket-5)"},".rainbow-bracket-indigo":{color:"var(--editor-bracket-6)"},".rainbow-bracket-violet":{color:"var(--editor-bracket-7)"},".rainbow-bracket-red > span":{color:"var(--editor-bracket-1-a)"},".rainbow-bracket-orange > span":{color:"var(--editor-bracket-2-a)"},".rainbow-bracket-yellow > span":{color:"var(--editor-bracket-3-a)"},".rainbow-bracket-green > span":{color:"var(--editor-bracket-4-a)"},".rainbow-bracket-blue > span":{color:"var(--editor-bracket-5-a)"},".rainbow-bracket-indigo > span":{color:"var(--editor-bracket-6-a)"},".rainbow-bracket-violet > span":{color:"var(--editor-bracket-7-a)"}}),zS=!1;const IS=[()=>vr(),()=>Sh(),()=>ir(),()=>dr(),()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xS,{fallback:!1}),()=>tu()],BS={},jS=[()=>vr(),()=>Sh(),()=>ir(),()=>dr(),t=>NS.of(t),()=>BS.gutter?function(t={}){return[eo.of(t),jr(),so]}():[],()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xS,{fallback:!1}),()=>tu(),()=>bS,()=>function(t){return _i.fromClass(class{constructor(e){this.view=e,this.placeholder=ni.set([ni.widget({widget:new kr(t),side:1}).range(0)])}get decorations(){return this.view.state.doc.length?ni.none:this.placeholder}},{decorations:t=>t.decorations})}("Type WL Expression / .md / .js"),()=>xt.allowMultipleSelections.of(!0),(t,e)=>vS.of(e),()=>yS.of(xt.readOnly.of(!1)),()=>_S,()=>{return t?[ou.of(t),Yu]:Yu;var t},(t,e)=>Ys.of([{key:"Tab",run:function(t,e){const i=sd(t);return i||Rc(t)},shift:Ec},{key:"Backspace",run:function(e,i){if(0===e.state.doc.length)return t.origin.remove(),!0}},{key:"ArrowLeft",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus prev"),t.origin.focusPrev(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus next"),t.origin.focusNext(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"Shift-Enter",preventDefault:!0,run:function(e,i){console.log(e.state.doc.toString()),t.origin.eval(e.state.doc.toString())}},...Vc,...Wh,...Ru]),(t,e)=>Ts.updateListener.of((e=>{e.docChanged&&t.origin.save(encodeURIComponent(e.state.doc.toString())),e.selectionSet&&(XS=e.view)})),()=>qS];const NS=E.define();function GS(t){return t.replace(/\\\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\\\:/g,""),16))})).replaceAll("\\:F74E","I").replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))}function FS(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(t=>(+t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+t/4).toString(16)))}core.ReadOnly=()=>"ReadOnly",core.EditorView=async(t,e)=>{let i=await interpretate(t[0],e);i=GS(i),console.log("UNICODE Disaster");const n=await core._getRules(t,e);let s=()=>{},r=()=>{},o=i;const a=[];n.ReadOnly&&a.push(xt.readOnly.of(!0)),n.ForceUpdate&&(e.local.forceUpdate=n.ForceUpdate),n.Event&&(r=t=>{o=t,console.log("editor view emitt data: "+t),server.kernel.emitt(n.Event,'"'+t.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Input")},s=()=>{server.kernel.emitt(n.Event,'"'+o.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Evaluate")}),e.local?e.local.editor=ZS({doc:i,parent:e.element,eval:s,update:r,extensions:a}):ZS({doc:i,parent:e.element,eval:s,update:r,extensions:a}),e.element.style.verticalAlign="inherit"},core.StripOnInput=async()=>{},core.EditorView.update=async(t,e)=>{if(!e.local.editor)return;const i=GS(await interpretate(t[0],e));console.log("editor view: dispatch"),e.local.forceUpdate,e.local.editor.dispatch({changes:{from:0,to:e.local.editor.state.doc.length,insert:i}})},core.EditorView.destroy=async(t,e)=>{await interpretate(t[0],e),e.local&&e.local.editor&&e.local.editor.destroy()},core.EditorView.virtual=!0,core.PreviewCell=(t,e)=>{},window.SupportedLanguages.push({check:t=>null===t,legacy:!0,plugins:YS,name:"mathematica"}),window.SupportedLanguages.push({check:t=>null!=t[0].match(/\w+\.(wl|wls)$/),plugins:YS,legacy:!0,name:"mathematica"}),window.SupportedCells.codemirror={view:class{origin={};editor={};trash=[];forceFocusNext(){zS=!0}focus(t){t>0?this.editor.dispatch({selection:{anchor:0}}):t<0&&this.editor.dispatch({selection:{anchor:this.editor.state.doc.length}}),this.editor.focus()}setContent(t){if(console.warn("content mutation!"),!this.editor.viewState)return;const e=this.editor;console.log("result"),console.log(t),this.editor.dispatch({changes:{from:0,to:e.viewState.state.doc.length,insert:t}})}addDisposable(t){this.trash.push(t)}dispose(){this.editor.destroy()}readOnly(t){this.editor.dispatch({effects:yS.reconfigure(xt.readOnly.of(t))})}constructor(t,e){this.origin=t;const i=this.origin,n=PS(e).plugins,s=this;this.origin.element.ocellref=s;const r=new Ts({doc:(o=e,o.replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))),extensions:jS.map((t=>t(s,n))),parent:this.origin.element});var o;return this.editor=r,this.editor.dom.ocellref=s,this.editor.viewState.state.config.eval=()=>{i.eval(this.editor.state.doc.toString())},zS&&r.focus(),zS=!1,this}},context:{EditorAutocomplete:kS,javascriptLanguage:qf,javascript:Nf,markdownLanguage:rm,markdown:function(t={}){let{codeLanguages:e,defaultCodeLanguage:i,addKeymap:n=!0,base:{parser:s}=sm}=t;if(!(s instanceof Zp))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let r,o=t.extensions?[t.extensions]:[],a=[dm.support];i instanceof Ua?(a.push(i.support),r=i.language):i&&(r=i);let l=e||r?(h=e,c=r,t=>{if(t&&h){let e=null;if(t=/\S*/.exec(t)[0],e="function"==typeof h?h(t):Ya.matchLanguageName(h,t,!0),e instanceof Ya)return e.support?e.support.language.parser:Ta.getSkippingParser(e.load());if(e)return e.parser}return c?c.parser:null}):void 0;var h,c;return o.push(function(t){let{codeParser:e,htmlParser:i}=t,n=Do(((t,n)=>{let s=t.type.id;if(!e||s!=Kf.CodeBlock&&s!=Kf.FencedCode){if(i&&(s==Kf.HTMLBlock||s==Kf.HTMLTag))return{parser:i,overlay:rO(t.node,t.from,t.to)}}else{let i="";if(s==Kf.FencedCode){let e=t.node.getChild(Kf.CodeInfo);e&&(i=n.read(e.from,e.to))}let r=e(i);if(r)return{parser:r,overlay:t=>t.type.id==Kf.CodeText}}return null}));return{wrap:n}}({codeParser:l,htmlParser:dm.language.parser})),n&&a.push(N.high(Ys.of(um))),new Ua(nm(s.configure(o)),a)},htmlLanguage:jg,html:Ng,cssLanguage:kg,css:Qg,EditorView:Ts,EditorState:xt,highlightSpecialChars:vr,syntaxHighlighting:$l,defaultHighlightStyle:xS,editorCustomTheme:qS,foldGutter:function(t={}){let e=Object.assign(Object.assign({},wl),t),i=new vl(e,!0),n=new vl(e,!1),s=_i.fromClass(class{constructor(t){this.from=t.viewport.from,this.markers=this.buildMarkers(t)}update(t){(t.docChanged||t.viewportChanged||t.startState.facet(Wa)!=t.state.facet(Wa)||t.startState.field(dl,!1)!=t.state.field(dl,!1)||Xa(t.startState)!=Xa(t.state)||e.foldingChanged(t))&&(this.markers=this.buildMarkers(t.view))}buildMarkers(t){let e=new Xt;for(let s of t.viewportLineBlocks){let r=fl(t.state,s.from,s.to)?n:ll(t.state,s.from,s.to)?i:null;r&&e.add(s.from,s.from,r)}return e.finish()}}),{domEventHandlers:r}=e;return[s,Ir({class:"cm-foldGutter",markers(t){var e;return(null===(e=t.plugin(s))||void 0===e?void 0:e.markers)||_t.empty},initialSpacer:()=>new vl(e,!1),domEventHandlers:Object.assign(Object.assign({},r),{click:(t,e,i)=>{if(r.click&&r.click(t,e,i))return!0;let n=fl(t.state,e.from,e.to);if(n)return t.dispatch({effects:ul.of(n)}),!0;let s=ll(t.state,e.from,e.to);return!!s&&(t.dispatch({effects:cl.of(s)}),!0)}})}),ml()]},Facet:E,Compartment:F,mathematicaPlugins:YS,legacyLangNameFacet:CS,DropPasteHandlers:Cm,EditorExtensionsMinimal:IS,EditorParameters:BS,EditorExtensions:jS,StateField:q,Decoration:ni,ViewPlugin:_i,WidgetType:ei,originFacet:NS,MatchDecorator:pr}},window.OfflineMode&&SS.push(xt.readOnly.of(!0)),core.CellView=async(t,e)=>{const i=await core._getRules(t,e);i.Display||(i.Display="codemirror");const n=await interpretate(t[0],e),s={element:e.element,uid:FS()};i.Style&&(e.element.style=i.Style),i.Class&&e.element.classList.add(...i.Class.split(" ")),i.ImageSize&&(Array.isArray(i.ImageSize)?(e.element.style.width=i.ImageSize[0]+"px",e.element.style.height=i.ImageSize[1]+"px"):e.element.style.width=i.ImageSize+"px"),new window.SupportedCells[i.Display].view(s,n)};const HS={};core.FrontEditorSelected=async(t,e)=>{console.log("check");const i=await interpretate(t[0],e),n=await core._getRules(t,e);let s;switch(n.Editor&&(s=HS[n.Editor],console.log("Editor"),console.log(n.Editor),console.log(s)),i){case"Get":return ES(s);case"Set":let i=await interpretate(t[1],e);VS(i,s);break;case"GetDoc":return RS(s);case"SetDoc":let n=await interpretate(t[1],e);DS(n,s);break;case"Cursor":return TS(s);case"Type":return AS(s);case"Editor":const r=FS();return HS[r]=MS(),r}}; +class t{constructor(){}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 a(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}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 l(n,o,i,r);n=o+1,i++}}decompose(t,i,r,o){let a=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(a.text,t.text.slice(),0,a.length);if(i.length<=32)r.push(new e(i,t.length+a.length));else{let t=i.length>>1;r.push(new e(i.slice(0,t)),new e(i.slice(t)))}}else r.push(a)}replace(t,r,o){if(!(o instanceof e))return super.replace(t,r,o);let a=n(this.text,n(o.text,s(this.text,0,t)),r),l=this.length+o.length-(r-t);return a.length<=32?new e(a,l):i.from(e.split(a,[]),l)}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=a+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,a=i+r.lines-1;if((e?a:o)>=t)return r.lineInner(t,e,i,n);n=o+1,i=a+1}}decompose(t,e,i,n){for(let s=0,r=0;r<=e&&s=r){let s=n&((r<=t?1:0)|(a>=e?2:0));r>=t&&a<=e&&!s?i.push(o):o.decompose(t-r,e-r,i,s)}r=a+1}}replace(t,e,n){if(n.lines=r&&e<=a){let l=o.replace(t-r,e-r,n),h=this.lines-o.lines+l.lines;if(l.lines>4&&l.lines>h>>6){let r=this.children.slice();return r[s]=l,new i(r,this.length-(e-t)+n.length)}return super.replace(r,a,l)}r=a+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=a+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,a]=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==a)return n;let i=this.children[s],l=t.children[r];if(i!=l)return n+i.scanIdentical(l,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,a=r>>1,l=[],h=0,c=-1,u=[];function d(t){let n;if(t.lines>o&&t instanceof i)for(let e of t.children)d(e);else t.lines>a&&(h>a||!h)?(f(),l.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&&f(),h+=t.lines,c+=t.length+1,u.push(t))}function f(){0!=h&&(l.push(1==u.length?u[0]:i.from(u,c)),c=-1,h=u.length=0)}for(let e of t)d(e);return f(),1==l.length?l[0]:new i(l,n)}}function n(t,e,i=0,n=1e9){for(let s=0,r=0,o=!0;r=i&&(l>n&&(a=a.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,a=s instanceof e?s.text.length:s.children.length;if(o==(i>0?a: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 a{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]=a.prototype[Symbol.iterator]=function(){return this});let l=class{constructor(t,e,i,n){this.from=t,this.to=e,this.number=i,this.text=n}get length(){return this.to-this.from}},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 d=8205;function f(t,e,i=!0,n=!0){return(i?p:O)(t,e,n)}function p(t,e,i){if(e==t.length)return e;e&&g(t.charCodeAt(e))&&m(t.charCodeAt(e-1))&&e--;let n=b(t,e);for(e+=v(n);e=0&&u(b(t,n));)i++,n-=2;if(i%2==0)break;e+=2}}}return e}function O(t,e,i){for(;e>0;){let n=p(t,e-2,i);if(n=56320&&t<57344}function m(t){return t>=55296&&t<56320}function b(t,e){let i=t.charCodeAt(e);if(!m(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return g(n)?n-56320+(i-55296<<10)+65536:i}function w(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function v(t){return t<65536?1:2}const y=/\r\n?|\n/;var S=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(S||(S={}));class x{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;et)return s+(t-n);s+=o}else{if(i!=S.Simple&&l>=t&&(i==S.TrackDel&&nt||i==S.TrackBefore&&nt))return null;if(l>t||l==t&&e<0&&!o)return t==n||e<0?s:s+a;s+=a}n=l}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 x(t)}static create(t){return new x(t)}}class k extends x{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 P(this,((e,i,n,s,r)=>t=t.replace(n,n+(i-e),r)),!1),t}mapDesc(t,e=!1){return C(this,t,e,!0)}invert(e){let i=this.sections.slice(),n=[];for(let s=0,r=0;s=0){i[s]=a,i[s+1]=o;let l=s>>1;for(;n.length0&&$(i,e,s.text),s.forward(t),o+=t}let l=t[r++];for(;o>1].toJSON()))}return t}static of(e,i,n){let s=[],r=[],o=0,a=null;function l(t=!1){if(!t&&!s.length)return;oa||e<0||a>i)throw new RangeError(`Invalid change range ${e} to ${a} (in doc of length ${i})`);let u=c?"string"==typeof c?t.of(c.split(n||y)):c:t.empty,d=u.length;if(e==a&&0==d)return;eo&&Q(s,e-o,-1),Q(s,a-e,d),$(r,s,u),o=a}}(e),l(!a),a}static empty(t){return new k(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 $(e,i,n){if(0==n.length)return;let s=i.length-2>>1;if(s>1])),!(n||a==e.sections.length||e.sections[a+1]<0);)l=e.sections[a++],h=e.sections[a++];i(r,c,o,u,d),r=c,o=u}}}function C(t,e,i,n=!1){let s=[],r=n?[]:null,o=new X(t),a=new X(e);for(let t=-1;;)if(-1==o.ins&&-1==a.ins){let t=Math.min(o.len,a.len);Q(s,t,-1),o.forward(t),a.forward(t)}else if(a.ins>=0&&(o.ins<0||t==o.i||0==o.off&&(a.len=0&&t=0)){if(o.done&&a.done)return r?k.createSet(s,r):x.create(s);throw new Error("Mismatched change set lengths")}{let e=0,i=o.len;for(;i;)if(-1==a.ins){let t=Math.min(i,a.len);e+=t,i-=t,a.forward(t)}else{if(!(0==a.ins&&a.lene||o.ins>=0&&o.len>e)&&(t||n.length>i),r.forward2(e),o.forward(e)}}else Q(n,0,o.ins,t),s&&$(s,n,o.text),o.next()}}class X{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 Z{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 Z(i,n,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return A.range(t,e);let i=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return A.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 A.range(t.anchor,t.head)}static create(t,e,i){return new Z(t,e,i)}}class A{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:A.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 A(t.ranges.map((t=>Z.fromJSON(t))),t.main)}static single(t,e=t){return new A([A.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?A.range(o,r):A.range(r,o))}}return new A(t,e)}}function T(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let R=0;class E{constructor(t,e,i,n,s){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=n,this.id=R++,this.default=t([]),this.extensions="function"==typeof s?s(this):s}static define(t={}){return new E(t.combine||(t=>t),t.compareInput||((t,e)=>t===e),t.compare||(t.combine?(t,e)=>t===e:V),!!t.static,t.enables)}of(t){return new M([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,2,e)}from(t,e){return e||(e=t=>t),this.compute([t],(i=>e(i.field(t))))}}function V(t,e){return t==e||t.length==e.length&&t.every(((t,i)=>t===e[i]))}class M{constructor(t,e,i,n){this.dependencies=t,this.facet=e,this.type=i,this.value=n,this.id=R++}dynamicSlot(t){var e;let i=this.value,n=this.facet.compareInput,s=this.id,r=t[s]>>1,o=2==this.type,a=!1,l=!1,h=[];for(let i of this.dependencies)"doc"==i?a=!0:"selection"==i?l=!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(a&&e.docChanged||l&&(e.docChanged||e.selection)||W(t,h)){let e=i(t);if(o?!D(e,t.values[r],n):!n(e,t.values[r]))return t.values[r]=e,1}return 0},reconfigure:(t,e)=>{let a,l=e.config.address[s];if(null!=l){let s=tt(e,l);if(this.dependencies.every((i=>i instanceof E?e.facet(i)===t.facet(i):!(i instanceof q)||e.field(i,!1)==t.field(i,!1)))||(o?D(a=i(t),s,n):n(a=i(t),s)))return t.values[r]=s,0}else a=i(t);return t.values[r]=a,1}}}}function D(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 a(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(Y).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,Y.of({field:this,create:t})]}get extension(){return this}}const L=4,z=3,I=2,B=1;function j(t){return e=>new G(e,t)}const N={highest:j(0),high:j(B),default:j(I),low:j(z),lowest:j(L)};class G{constructor(t,e){this.inner=t,this.prec=e}}class F{of(t){return new H(this,t)}reconfigure(t){return F.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class H{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;function r(t,o){let a=s.get(t);if(null!=a){if(a<=o)return;let e=n[a].indexOf(t);e>-1&&n[a].splice(e,1),t instanceof H&&i.delete(t.compartment)}if(s.set(t,o),Array.isArray(t))for(let e of t)r(e,o);else if(t instanceof H){if(i.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");let n=e.get(t.compartment)||t.inner;i.set(t.compartment,n),r(n,o)}else if(t instanceof G)r(t.inner,t.prec);else if(t instanceof q)n[o].push(t),t.provides&&r(t.provides,o);else if(t instanceof M)n[o].push(t),t.facet.extensions&&r(t.facet.extensions,I);else{let e=t.extension;if(!e)throw new Error(`Unrecognized extension value in extension set (${t}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(e,o)}}return r(t,I),n.reduce(((t,e)=>t.concat(e)))}(t,e,r))i instanceof q?n.push(i):(s[i.facet.id]||(s[i.facet.id]=[])).push(i);let o=Object.create(null),a=[],l=[];for(let t of n)o[t.id]=l.length<<1,l.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]=a.length<<1|1,V(r,e))a.push(i.facet(n));else{let t=n.combine(e.map((t=>t.value)));a.push(i&&n.compare(t,i.facet(n))?i.facet(n):t)}else{for(let t of e)0==t.type?(o[t.id]=a.length<<1|1,a.push(t.value)):(o[t.id]=l.length<<1,l.push((e=>t.dynamicSlot(e))));o[n.id]=l.length<<1,l.push((t=>U(t,n,e)))}}let c=l.map((t=>t(o)));return new J(t,r,c,o,a,s)}}function K(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 tt(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}const et=E.define(),it=E.define({combine:t=>t.some((t=>t)),static:!0}),nt=E.define({combine:t=>t.length?t[0]:void 0,static:!0}),st=E.define(),rt=E.define(),ot=E.define(),at=E.define({combine:t=>!!t.length&&t[0]});class lt{constructor(t,e){this.type=t,this.value=e}static define(){return new ht}}class ht{of(t){return new lt(this,t)}}class ct{constructor(t){this.map=t}of(t){return new ut(this,t)}}class ut{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 ut(this.type,e)}is(t){return this.type==t}static define(t={}){return new ct(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}}ut.reconfigure=ut.define(),ut.appendConfig=ut.define();class dt{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&&T(i,e.newLength),s.some((t=>t.type==dt.time))||(this.annotations=s.concat(dt.time.of(Date.now())))}static create(t,e,i,n,s,r){return new dt(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(dt.userEvent);return!(!e||!(e==t||e.length>t.length&&e.slice(0,t.length)==t&&"."==e[t.length]))}}function ft(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=pt(n,Ot(e,r,t.changes.newLength),!0))}return n==t?t:dt.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(st)){let e=n(t);if(!1===e){i=!1;break}Array.isArray(e)&&(i=!0===i?e:ft(i,e))}if(!0!==i){let n,s;if(!1===i)s=t.changes.invertedDesc,n=k.empty(e.doc.length);else{let e=t.changes.filter(i);n=e.changes,s=e.filtered.mapDesc(e.changes).invertedDesc}t=dt.create(e,n,t.selection&&t.selection.map(s),ut.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let n=e.facet(rt);for(let i=n.length-1;i>=0;i--){let s=n[i](t);t=s instanceof dt?s:Array.isArray(s)&&1==s.length&&s[0]instanceof dt?s[0]:gt(e,bt(s),!1)}return t}(s):s)}dt.time=lt.define(),dt.userEvent=lt.define(),dt.addToHistory=lt.define(),dt.remote=lt.define();const mt=[];function bt(t){return null==t?mt:Array.isArray(t)?t:[t]}var wt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(wt||(wt={}));const vt=/[\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){}function St(t){return e=>{if(!/\S/.test(e))return wt.Space;if(function(t){if(yt)return yt.test(t);for(let e=0;e"€"&&(i.toUpperCase()!=i.toLowerCase()||vt.test(i)))return!0}return!1}(e))return wt.Word;for(let i=0;i-1)return wt.Word;return wt.Other}}class xt{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(ut.reconfigure)?(i=null,n=e.value):e.is(ut.appendConfig)&&(i=null,n=bt(n).concat(e.value));if(i)e=t.startState.values.slice();else{i=J.resolve(n,s,this),e=new xt(i,this.doc,this.selection,i.dynamicSlots.map((()=>null)),((t,e)=>e.reconfigure(t,this)),null).values}new xt(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:A.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=bt(i.effects);for(let i=1;is.spec.fromJSON(r,t))))}return xt.create({doc:t.doc,selection:A.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(xt.lineSeparator)||y)),s=e.selection?e.selection instanceof A?e.selection:A.single(e.selection.anchor,e.selection.head):A.single(0);return T(s,n.length),i.staticFacet(it)||(s=s.asSingle()),new xt(i,n,s,i.dynamicSlots.map((()=>null)),((t,e)=>e.create(t)),null)}get tabSize(){return this.facet(xt.tabSize)}get lineBreak(){return this.facet(xt.lineSeparator)||"\n"}get readOnly(){return this.facet(at)}phrase(t,...e){for(let e of this.facet(xt.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(et))for(let r of s(this,e,i))Object.prototype.hasOwnProperty.call(r,t)&&n.push(r[t]);return n}charCategorizer(t){return St(this.languageDataAt("wordChars",t).join(""))}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=f(e,r,!1);if(s(e.slice(t,r))!=wt.Word)break;r=t}for(;ot.length?t[0]:4}),xt.lineSeparator=nt,xt.readOnly=at,xt.phrases=E.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]))}}),xt.languageData=et,xt.changeFilter=st,xt.transactionFilter=rt,xt.transactionExtender=ot,F.reconfigure=ut.define();class Qt{eq(t){return this==t}range(t,e=t){return $t.create(t,e,this)}}Qt.prototype.startSide=Qt.prototype.endSide=0,Qt.prototype.point=!1,Qt.prototype.mapMode=S.TrackDel;let $t=class t{constructor(t,e,i){this.from=t,this.to=e,this.value=i}static create(e,i,n){return new t(e,i,n)}};function Pt(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Ct{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,a=s[n]-t||(i?this.value[n].endSide:this.value[n].startSide)-e;if(n==r)return a>=0?r:o;a>=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||l==h&&c.startSide>0&&c.endSide<=0)continue;(h-l||c.endSide-c.startSide)<0||(r<0&&(r=l),c.point&&(o=Math.max(o,h-l)),i.push(c),n.push(l-r),s.push(h-r))}return{mapped:i.length?new Ct(n,s,i,o):null,pos:r}}}class _t{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 _t(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(Pt)),this.isEmpty)return e.length?_t.of(e):this;let o=new At(this,null,-1).goto(0),a=0,l=[],h=new Xt;for(;o.value||a=0){let t=e[a++];h.addInner(t.from,t.to,t.value)||l.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 Tt.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return Tt.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)),a=Zt(r,o,i),l=new Et(r,a,s),h=new Et(o,a,s);i.iterGaps(((t,e,i)=>Vt(l,t,h,e,i,n))),i.empty&&0==i.length&&Vt(l,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=Zt(s,r),a=new Et(s,o,0).goto(i),l=new Et(r,o,0).goto(i);for(;;){if(a.to!=l.to||!Mt(a.active,l.active)||a.point&&(!l.point||!a.point.eq(l.point)))return!1;if(a.to>n)return!0;a.next(),l.next()}}static spans(t,e,i,n,s=-1){let r=new Et(t,null,s).goto(e),o=e,a=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,a),a=r.openEnd(t));if(r.to>i)return a+(r.point&&r.to>i?1:0);o=r.to,r.next()}}static of(t,e=!1){let i=new Xt;for(let n of t instanceof $t?[t]:e?function(t){if(t.length>1)for(let e=t[0],i=1;i0)return t.slice().sort(Pt);e=n}return t}(t):t)i.add(n.from,n.to,n.value);return i.finish()}}_t.empty=new _t([],[],null,-1),_t.empty.nextLayer=_t.empty;class Xt{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}finishChunk(t){this.chunks.push(new Ct(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=[])}add(t,e,i){this.addInner(t,e,i)||(this.nextLayer||(this.nextLayer=new Xt)).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(_t.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;let e=_t.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function Zt(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 At(r,e,i,s));return 1==n.length?n[0]:new Tt(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--)Rt(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--)Rt(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(),Rt(this.heap,0)}}}function Rt(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 Et{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=Tt.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){Dt(this.active,t),Dt(this.activeTo,t),Dt(this.activeRank,t),this.minActive=Ut(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&&Dt(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 Vt(t,e,i,n,s,r){t.goto(e),i.goto(n);let o=n+s,a=n,l=n-e;for(;;){let e=t.to+l-i.to||t.endSide-i.endSide,n=e<0?t.to+l: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))&&Mt(t.activeForPoint(t.to+l),i.activeForPoint(i.to))||r.comparePoint(a,s,t.point,i.point):s>a&&!Mt(t.active,i.active)&&r.compareRange(a,s,t.active,i.active),n>o)break;a=n,e<=0&&t.next(),e>=0&&i.next()}}function Mt(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 Ut(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(!l)throw new RangeError("The value of a property ("+i+") should be a primitive value.");s(n(i),o,a,h)}else null!=o&&a.push(i.replace(/_.*/,"").replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))+": "+o+";")}(a.length||h)&&r.push((!i||l||o?t:t.map(i)).join(", ")+" {"+a.join(" ")+"}")}for(let e in t)s(n(e),t[e],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let t=zt[qt]||1;return zt[qt]=t+1,"ͼ"+t.toString(36)}static mount(t,e){(t[Lt]||new jt(t)).mount(Array.isArray(e)?e:[e])}}let Bt=new Map;class jt{constructor(t){let e=t.ownerDocument||t,i=e.defaultView;if(!t.head&&t.adoptedStyleSheets&&i.CSSStyleSheet){let n=Bt.get(e);if(n)return t.adoptedStyleSheets=[n.sheet,...t.adoptedStyleSheets],t[Lt]=n;this.sheet=new i.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets],Bt.set(e,this)}else{this.styleTag=e.createElement("style");let i=t.head||t;i.insertBefore(this.styleTag,i.firstChild)}this.modules=[],t[Lt]=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:'"'},Ft="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),Ht="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Jt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Kt=Ht||Ft&&+Ft[1]<57,te=0;te<10;te++)Nt[48+te]=Nt[96+te]=String(te);for(te=1;te<=24;te++)Nt[te+111]="F"+te;for(te=65;te<=90;te++)Nt[te]=String.fromCharCode(te+32),Gt[te]=String.fromCharCode(te);for(var ee in Nt)Gt.hasOwnProperty(ee)||(Gt[ee]=Nt[ee]);function ie(t){let e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection()}function ne(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function se(t,e){if(!e.anchorNode)return!1;try{return ne(t,e.anchorNode)}catch(t){return!1}}function re(t){return 3==t.nodeType?me(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function oe(t,e,i,n){return!!i&&(le(t,e,i,n,-1)||le(t,e,i,n,1))}function ae(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function le(t,e,i,n,s){for(;;){if(t==i&&e==n)return!0;if(e==(s<0?0:he(t))){if("DIV"==t.nodeName)return!1;let i=t.parentNode;if(!i||1!=i.nodeType)return!1;e=ae(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?he(t):0}}}function he(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}const ce={left:0,right:0,top:0,bottom:0};function ue(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function de(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}class fe{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){this.set(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset)}set(t,e,i,n){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=n}}let pe,Oe=null;function ge(t){if(t.setActive)return t.setActive();if(Oe)return t.focus(Oe);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==Oe?{get preventScroll(){return Oe={preventScroll:!0},!0}}:void 0),!Oe){Oe=!1;for(let t=0;te)return i.domBoundsAround(t,e,l);if(c>=t&&-1==n&&(n=a,s=l),l>e&&i.dom.parentNode==this.dom){r=a,o=h;break}h=c,l=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.dirty|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.dirty|=2),1&e.dirty)return;e.dirty|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,this.dirty&&this.markParentsDirty(!0))}setDOM(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=ye){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 Qe(t,e,i,n,s,r,o,a,l){let{children:h}=t,c=h.length?h[e]:null,u=r.length?r[r.length-1]:null,d=u?u.breakAfter:o;if(!(e==n&&c&&!o&&!d&&r.length<2&&c.merge(i,s,r.length?u:null,0==i,a,l))){if(n0&&(!o&&r.length&&c.merge(i,c.length,r[0],!1,a,0)?c.breakAfter=r.shift().breakAfter:(i2);var De={mac:Me||/Mac/.test(Pe.platform),windows:/Win/.test(Pe.platform),linux:/Linux|X11/.test(Pe.platform),ie:Ae,ie_version:Xe?Ce.documentMode||6:Ze?+Ze[1]:_e?+_e[1]:0,gecko:Te,gecko_version:Te?+(/Firefox\/(\d+)/.exec(Pe.userAgent)||[0,0])[1]:0,chrome:!!Re,chrome_version:Re?+Re[1]:0,ios:Me,android:/Android\b/.test(Pe.userAgent),webkit:Ee,safari:Ve,webkit_version:Ee?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Ce.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class We extends Se{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(!i||i instanceof We&&!(this.length-(e-t)+i.length>256))&&(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),!0)}split(t){let e=new We(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new ve(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 Ye(this.dom,t,e)}}class Ue extends Se{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(we(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}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.dirty|=6)}sync(t,e){this.dom?4&this.dirty&&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 Ue&&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 Ue(this.mark,e,r)}domAtPos(t){return Ge(this,t)}coordsAt(t,e){return He(this,t,e)}}function Ye(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?De.chrome||De.gecko||(e?(s--,o=1):r=0)?0:a.length-1];return De.safari&&!o&&0==l.width&&(l=Array.prototype.find.call(a,(t=>t.width))||l),o?ue(l,o<0):l||null}class qe extends Se{constructor(t,e,i){super(),this.widget=t,this.length=e,this.side=i,this.prevWidget=null}static create(t,e,i){return new(t.customView||qe)(t,e,i)}split(t){let e=qe.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 qe&&this.widget.compare(i.widget))||t>0&&s<=0||e0)?ve.before(this.dom):ve.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let i=this.dom.getClientRects(),n=null;if(!i.length)return ce;for(let e=t>0?i.length-1:0;n=i[e],!(t>0?0==e:e==i.length-1||n.top0?-1:1);return this.length?n:ue(n,this.side>0)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class Le extends qe{domAtPos(t){let{topView:e,text:i}=this.widget;return e?ze(t,0,e,i,this.length-e.length,((t,e)=>t.domAtPos(e)),((t,e)=>new ve(t,Math.min(e,t.nodeValue.length)))):new ve(i,Math.min(t,i.nodeValue.length))}sync(){this.setDOM(this.widget.toDOM())}localPosFromDOM(t,e){let{topView:i,text:n}=this.widget;return i?Be(t,e,i,n,this.length-i.length):Math.min(e,this.length)}ignoreMutation(){return!1}get overrideDOMText(){return null}coordsAt(t,e){let{topView:i,text:n}=this.widget;return i?ze(t,e,i,n,this.length-i.length,((t,e,i)=>t.coordsAt(e,i)),((t,e,i)=>Ye(t,e,i))):Ye(n,t,e)}destroy(){var t;super.destroy(),null===(t=this.widget.topView)||void 0===t||t.destroy()}get isEditable(){return!0}canReuseDOM(){return!0}}function ze(t,e,i,n,s,r,o){if(i instanceof Ue){for(let a=i.dom.firstChild;a;a=a.nextSibling){let i=Se.get(a);if(i){let l=ne(a,n),h=i.length+(l?s:0);if(t0?ve.before(this.dom):ve.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){let e=this.dom.getBoundingClientRect(),i=function(t,e){let i=t.parent,n=i?i.children.indexOf(t):-1;for(;i&&n>=0;)if(e<0?n>0:n0?-1:1);return i&&i.tope.top?{left:e.left,right:e.right,top:i.top,bottom:i.bottom}:e}get overrideDOMText(){return t.empty}get isHidden(){return!0}}function Ge(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 Ue&&s.length&&(n=s[s.length-1])instanceof Ue&&n.mark.eq(e.mark)?Fe(n,e.children[0],i-1):(s.push(e),e.setParent(t)),t.length+=e.length}function He(t,e,i){let n=null,s=-1,r=null,o=-1;!function t(e,a){for(let l=0,h=0;l=a&&(c.children.length?t(c,a-h):(!r||r instanceof Ne&&i>0)&&(u>a||h==u&&c.getSide()>0)?(r=c,o=a-h):(h0?3e8:-4e8:e>0?1e8:-1e8,new oi(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}=ai(t,n);e=(s?n?-3e8:-1:5e8)-1,i=1+(r?n?2e8:1:-6e8)}return new oi(t,e,i,n,t.widget||null,!0)}static line(t){return new ri(t)}static set(t,e=!1){return _t.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}ni.none=_t.empty;class si extends ni{constructor(t){let{start:e,end:i}=ai(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){return this==t||t instanceof si&&this.tagName==t.tagName&&this.class==t.class&&Ke(this.attrs,t.attrs)}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}si.prototype.point=!1;class ri extends ni{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof ri&&this.spec.class==t.spec.class&&Ke(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)}}ri.prototype.mapMode=S.TrackBefore,ri.prototype.point=!0;class oi extends ni{constructor(t,e,i,n,s,r){super(e,i,s,t),this.block=n,this.isReplace=r,this.mapMode=n?e<=0?S.TrackBefore:S.TrackAfter:S.TrackDel}get type(){return this.startSide=5}eq(t){return t instanceof oi&&(e=this.widget,i=t.widget,e==i||!!(e&&i&&e.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var e,i}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 ai(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 li(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)}oi.prototype.point=!0;class hi extends Se{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 hi))return!1;this.dom||i.transferDOM(this)}return n&&this.setDeco(i?i.attrs:null),$e(this,t,e,i?i.children:[],s,r),!0}split(t){let e=new hi;if(e.breakAfter=this.breakAfter,0==this.length)return e;let{i: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){Ke(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){Fe(this,t,e)}addLineDeco(t){let e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=Je(e,this.attrs||{})),i&&(this.attrs=Je({class:i},this.attrs||{}))}domAtPos(t){return Ge(this,t)}reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.dirty|=6)}sync(t,e){var i;this.dom?4&this.dirty&&(we(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&&(ti(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&&Se.get(n)instanceof Ue;)n=n.lastChild;if(!(n&&this.length&&("BR"==n.nodeName||0!=(null===(i=Se.get(n))||void 0===i?void 0:i.isEditable)||De.ios&&this.children.some((t=>t instanceof We))))){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 We)||/[^ -~]/.test(i.text))return null;let n=re(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=He(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 hi)return s;if(r>e)break}n=r+s.breakAfter}return null}}class ci extends Se{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 ci&&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(di(new We(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 oi){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let o=e-t;if(i instanceof oi)if(i.block){let{type:t}=i;t!=ii.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new ci(i.widget||new fi("div"),o,t))}else{let r=qe.create(i.widget||new fi("span"),o,o?0:i.startSide),a=this.atCursorPos&&!r.isEditable&&s<=n.length&&(t0),l=!r.isEditable&&(tn.length||i.startSide<=0),h=this.getLine();2!=this.pendingBuffer||a||r.isEditable||(this.pendingBuffer=0),this.flushBuffer(n),a&&(h.append(di(new Ne(1),n),s),s=n.length+Math.max(0,s-n.length)),h.append(di(r,n),s),this.atCursorPos=l,this.pendingBuffer=l?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 ui(t,e,i,s);return r.openEnd=_t.spans(n,e,i,r),r.openStart<0&&(r.openStart=r.openEnd),r.finish(r.openEnd),r}}function di(t,e){for(let i of e)t=new Ue(i,[t],t.length);return t}class fi extends ei{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 pi=E.define(),Oi=E.define(),gi=E.define(),mi=E.define(),bi=E.define(),wi=E.define(),vi=E.define(),yi=E.define({combine:t=>t.some((t=>t))}),Si=E.define({combine:t=>t.some((t=>t))});class xi{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 xi(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin)}}const ki=ut.define({map:(t,e)=>t.map(e)});function Qi(t,e,i){let n=t.facet(mi);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 $i=E.define({combine:t=>!t.length||t[0]});let Pi=0;const Ci=E.define();class _i{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 _i(Pi++,t,i,(t=>{let e=[Ci.of(t)];return s&&e.push(Ti.of((e=>{let i=e.plugin(t);return i?s(i):ni.none}))),n&&e.push(n(t)),e}))}static fromClass(t,e){return _i.define((e=>new t(e)),e)}}class Xi{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(Qi(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){Qi(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){Qi(t.state,e,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Zi=E.define(),Ai=E.define(),Ti=E.define(),Ri=E.define(),Ei=E.define(),Vi=E.define();class Mi{constructor(t,e,i,n){this.fromA=t,this.toA=e,this.fromB=i,this.toB=n}join(t){return new Mi(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(!a)return i;new Mi(a.fromA,a.toA,a.fromB,a.toB).addToSet(i),r=a.toA,o=a.toB}}}class Di{constructor(t,e,i){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=k.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 Mi(t,e,i,s)))),this.changedRanges=n}static create(t,e,i){return new Di(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 Wi=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Wi||(Wi={}));const Ui=Wi.LTR,Yi=Wi.RTL;function qi(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}}const Gi=[];function Fi(t){return[new Ni(0,t,0)]}let Hi="";function Ji(t,e,i,n,s){var r;let o=n.head-t.from,a=-1;if(0==o){if(!s||!t.length)return null;e[0].level!=i&&(o=e[0].side(!1,i),a=0)}else if(o==t.length){if(s)return null;let t=e[e.length-1];t.level!=i&&(o=t.side(!0,i),a=e.length-1)}a<0&&(a=Ni.find(e,o,null!==(r=n.bidiLevel)&&void 0!==r?r:-1,n.assoc));let l=e[a];o==l.side(s,i)&&(l=e[a+=s?1:-1],o=l.side(!s,i));let h=s==(l.dir==i),c=f(t.text,o,h);if(Hi=t.text.slice(Math.min(o,c),Math.max(o,c)),c!=l.side(s,i))return A.cursor(c+t.from,h?-1:1,l.level);let u=a==(s?e.length-1:0)?null:e[a+(s?1:-1)];return u||l.level==i?u&&u.level1)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=Se.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 en(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}class nn{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class sn extends Se{constructor(t){super(),this.view=t,this.compositionDeco=ni.none,this.decorations=[],this.dynamicDecorationMap=[],this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(t.contentDOM),this.children=[new hi],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Mi(0,0,0,t.state.doc.length)],0)}get length(){return this.view.state.doc.length}update(t){let e=t.changedRanges;this.minWidth>0&&e.length&&(e.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),this.view.inputState.composing<0?this.compositionDeco=ni.none:(t.transactions.length||this.dirty)&&(this.compositionDeco=function(t,e){let i=on(t);if(!i)return ni.none;let{from:n,to:s,node:r,text:o}=i,a=e.mapPos(n,1),l=Math.max(a,e.mapPos(s,-1)),{state:h}=t,c=3==r.nodeType?r.nodeValue:new tn([],h).readRange(r.firstChild,null).text;if(l-a{this.dom.style.height=this.view.viewState.contentHeight+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let t=De.chrome||De.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,t),this.dirty=0,t&&(t.written||i.selectionRange.focusNode!=t.node)&&(this.forceSelection=!0),this.dom.style.height=""}));let n=[];if(this.view.viewport.from||this.view.viewport.to=0?t[e]:null;if(!n)break;let{fromA:s,toA:r,fromB:o,toB:a}=n,{content:l,breakAtStart:h,openStart:c,openEnd:u}=ui.build(this.view.state.doc,o,a,this.decorations,this.dynamicDecorationMap),{i:d,off:f}=i.findPos(r,1),{i:p,off:O}=i.findPos(s,-1);Qe(this,p,O,d,f,l,h,c,u)}}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&&se(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,a=this.domAtPos(o.anchor),l=o.empty?a:this.domAtPos(o.head);if(De.gecko&&o.empty&&!this.compositionDeco.size&&(1==(h=a).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((()=>a.node.insertBefore(t,a.node.childNodes[a.offset]||null))),a=l=new ve(t,0),r=!0}var h;let c=this.view.observer.selectionRange;!r&&c.focusNode&&oe(a.node,a.offset,c.anchorNode,c.anchorOffset)&&oe(l.node,l.offset,c.focusNode,c.focusOffset)||(this.view.observer.ignore((()=>{De.android&&De.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=ie(this.view.root);if(t)if(o.empty){if(De.gecko){let t=(e=a.node,n=a.offset,1!=e.nodeType?0:(n&&"false"==e.childNodes[n-1].contentEditable?1:0)|(no.head&&([a,l]=[l,a]),e.setEnd(l.node,l.offset),e.setStart(a.node,a.offset),t.removeAllRanges(),t.addRange(e)}else;var e,n;s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())})),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new ve(c.anchorNode,c.anchorOffset),this.impreciseHead=l.precise?null:new ve(c.focusNode,c.focusOffset)}enforceCursorAssoc(){if(this.compositionDeco.size)return;let{view:t}=this,e=t.state.selection.main,i=ie(t.root),{anchorNode:n,anchorOffset:s}=t.observer.selectionRange;if(!(i&&e.empty&&e.assoc&&i.modify))return;let r=hi.find(this,e.head);if(!r)return;let o=r.posAtStart;if(e.head==o||e.head==o+r.length)return;let a=this.coordsAt(e.head,-1),l=this.coordsAt(e.head,1);if(!a||!l||a.bottom>l.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)}nearest(t){for(let e=t;e;){let t=Se.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!=ii.WidgetBefore&&s.type!=ii.WidgetAfter&&(!n||2==e||this.children[n-1].breakAfter||this.children[n-1].type==ii.WidgetBefore&&e>-2))return s.coordsAt(t-r,e);i=r}}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,a=this.view.textDirection==Wi.LTR;for(let t=0,l=0;ln)break;if(t>=i){let i=h.dom.getBoundingClientRect();if(e.push(i.height),r){let e=h.dom.lastChild,n=e?re(e):[];if(n.length){let e=n[n.length-1],r=a?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?Wi.RTL:Wi.LTR}measureTextSize(){for(let t of this.children)if(t instanceof hi){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.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(n);let s=re(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 ke(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;t.push(ni.replace({widget:new rn(n),block:!0,inclusive:!0,isBlockGap:!0}).range(i,r))}if(!s)break;i=s.to+1}return ni.set(t)}updateDeco(){let t=this.view.state.facet(Ti).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=0,r=0,o=0,a=0;for(let t of this.view.state.facet(Ei).map((t=>t(this.view))))if(t){let{left:e,right:i,top:n,bottom:l}=t;null!=e&&(s=Math.max(s,e)),null!=i&&(r=Math.max(r,i)),null!=n&&(o=Math.max(o,n)),null!=l&&(a=Math.max(a,l))}let l={left:n.left-s,top:n.top-o,right:n.right+r,bottom:n.bottom+a};!function(t,e,i,n,s,r,o,a){let l=t.ownerDocument,h=l.defaultView||window;for(let c=t;c;)if(1==c.nodeType){let t,u=c==l.body;if(u)t=de(h);else{if(c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let e=c.getBoundingClientRect();t={left:e.left,right:e.left+c.clientWidth,top:e.top,bottom:e.top+c.clientHeight}}let d=0,f=0;if("nearest"==s)e.top0&&e.bottom>t.bottom+f&&(f=e.bottom-t.bottom+f+o)):e.bottom>t.bottom&&(f=e.bottom-t.bottom+o,i<0&&e.top-f0&&e.right>t.right+d&&(d=e.right-t.right+d+r)):e.right>t.right&&(d=e.right-t.right+r,i<0&&e.left0))break;i=i.childNodes[n-1],n=he(i)}if(i>=0)for(let n=t,s=e;;){if(3==n.nodeType)return n;if(!(1==n.nodeType&&s=0))break;n=n.childNodes[s],s=0}return null}class hn{constructor(){this.changes=[]}compareRange(t,e){li(t,e,this.changes)}comparePoint(t,e){li(t,e,this.changes)}}function cn(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function un(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function dn(t,e){return t.tope.top+1}function fn(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,a,l,h,c,u=!1;for(let d=t.firstChild;d;d=d.nextSibling){let t=re(d);for(let f=0;fg||o==g&&r>O){n=d,s=p,r=O,o=g;let a=g?i0?f0)}0==O?i>p.bottom&&(!h||h.bottomp.top)&&(l=d,c=p):h&&dn(h,p)?h=pn(h,p.bottom):c&&dn(c,p)&&(c=fn(c,p.top))}}if(h&&h.bottom>=i?(n=a,s=h):c&&c.top<=i&&(n=l,s=c),!n)return{node:t,offset:0};let d=Math.max(s.left,Math.min(s.right,e));return 3==n.nodeType?gn(n,d,i):u&&"false"!=n.contentEditable?On(n,d,i):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,n)+(e>=(s.left+s.right)/2?1:0)}}function gn(t,e,i){let n=t.nodeValue.length,s=-1,r=1e9,o=0;for(let a=0;ai?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(De.chrome||De.gecko){me(t,a).getBoundingClientRect().left==h.right&&(n=!i)}if(c<=0)return{node:t,offset:a+(n?1:0)};s=a+(n?1:0),r=c}}}return{node:t,offset:s>-1?s:o>0?t.nodeValue.length:0}}function mn(t,e,i,n=-1){var s,r;let o,a=t.contentDOM.getBoundingClientRect(),l=a.top+t.viewState.paddingTop,{docHeight:h}=t.viewState,{x:c,y:u}=e,d=u-l;if(d<0)return 0;if(d>h)return t.state.doc.length;for(let e=t.defaultLineHeight/2,s=!1;o=t.elementAtHeight(d),o.type!=ii.Text;)for(;d=n>0?o.bottom+e:o.top-e,!(d>=0&&d<=h);){if(s)return i?null:0;s=!0,n=-n}u=l+d;let f=o.from;if(ft.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:bn(t,a,o,c,u);let p=t.dom.ownerDocument,O=t.root.elementFromPoint?t.root:p,g=O.elementFromPoint(c,u);g&&!t.contentDOM.contains(g)&&(g=null),g||(c=Math.max(a.left+1,Math.min(a.right-1,c)),g=O.elementFromPoint(c,u),g&&!t.contentDOM.contains(g)&&(g=null));let m,b=-1;if(g&&0!=(null===(s=t.docView.nearest(g))||void 0===s?void 0:s.isEditable))if(p.caretPositionFromPoint){let t=p.caretPositionFromPoint(c,u);t&&({offsetNode:m,offset:b}=t)}else if(p.caretRangeFromPoint){let e=p.caretRangeFromPoint(c,u);e&&(({startContainer:m,startOffset:b}=e),(!t.contentDOM.contains(m)||De.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 me(t,n-1,n).getBoundingClientRect().left>i}(m,b,c)||De.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}let n=1==t.nodeType?t.getBoundingClientRect():me(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return i-n.left>5}(m,b,c))&&(m=void 0))}if(!m||!t.docView.dom.contains(m)){let e=hi.find(t.docView,f);if(!e)return d>o.top+o.height/2?o.to:o.from;({node:m,offset:b}=On(e.dom,c,u))}let w=t.docView.nearest(m);if(!w)return null;if(w.isWidget&&1==(null===(r=w.dom)||void 0===r?void 0:r.nodeType)){let t=w.dom.getBoundingClientRect();return e.y1.5*t.defaultLineHeight){r+=Math.floor((s-i.top)/t.defaultLineHeight)*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=f(t,n)}return!0===n?-1:t.length}(o,r,t.state.tabSize)}function wn(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=t.bidiSpans(s),o=t.textDirectionAt(s.from);for(let a=e,l=null;;){let e=Ji(s,r,o,a,i),h=Hi;if(!e){if(s.number==(i?t.state.doc.lines:1))return a;h="\n",s=t.state.doc.line(s.number+(i?1:-1)),r=t.bidiSpans(s),e=A.cursor(i?s.from:s.to)}if(l){if(!l(h))return a}else{if(!n)return e;l=n(h)}a=e}}function vn(t,e,i,n){let s=t.state.facet(Ri).map((e=>e(t)));for(;;){let t=!1;for(let r of s)r.between(i.from-1,i.from+1,((s,r,o)=>{i.from>s&&i.fromi.from?A.cursor(s,1):A.cursor(r,-1),t=!0,o.widget.skipPosition&&(i=o.widget.skipPosition(i,e,n)))}));if(!t)return i}}class yn{constructor(t){this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null;let e=(e,i)=>{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 Cn){let n=Cn[i];t.contentDOM.addEventListener(i,(i=>{Pn(t,i)&&e(n,i)}),_n[i]),this.registeredEvents.push(i)}t.scrollDOM.addEventListener("mousedown",(i=>{if(i.target==t.scrollDOM&&i.clientY>t.contentDOM.getBoundingClientRect().bottom&&(e(Cn.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)}})),De.chrome&&102==De.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,De.safari&&t.contentDOM.addEventListener("input",(()=>null))}setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}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=>{Pn(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){Qi(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){Qi(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||xn.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,be(t.contentDOM,e.key,e.keyCode))}ignoreDuringComposition(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(De.safari&&!De.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 Sn=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],xn="dthko",kn=[16,17,18,20,91,92,224,225];function Qn(t){return.7*Math.max(0,t)+8}class $n{constructor(t,e,i,n){this.view=t,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);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(xt.allowMultipleSelections)&&function(t,e){let i=t.state.facet(pi);return i.length?i[0](e):(De.mac,e.altKey)}(t,e),this.dragMove=function(t,e){let i=t.state.facet(Oi);return i.length?i[0](e):De.mac?!e.altKey:!e.ctrlKey}(t,e),this.dragging=!(!function(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let n=ie(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!=Yn(e))&&null}start(t){!1===this.dragging&&(t.preventDefault(),this.select(t))}move(t){var e;if(0==t.buttons)return this.destroy();if(!1!==this.dragging)return;this.select(this.lastEvent=t);let i=0,n=0,s=(null===(e=this.scrollParent)||void 0===e?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight};t.clientX<=s.left+6?i=-Qn(s.left-t.clientX):t.clientX>=s.right-6&&(i=Qn(t.clientX-s.right)),t.clientY<=s.top+6?n=-Qn(s.top-t.clientY):t.clientY>=s.bottom-6&&(n=Qn(t.clientY-s.bottom)),this.setScrollSpeed(i,n)}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)}select(t){let e=this.style.get(t,this.extend,this.multiple);!this.mustSelect&&e.eq(this.view.state.selection)&&e.main.assoc==this.view.state.selection.main.assoc||this.view.dispatch({selection:e,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.docChanged&&this.dragging&&(this.dragging=this.dragging.map(t.changes)),this.style.update(t)&&setTimeout((()=>this.select(this.lastEvent)),20)}}function Pn(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=Se.get(n))&&i.ignoreEvent(e))return!1;return!0}const Cn=Object.create(null),_n=Object.create(null),Xn=De.ie&&De.ie_version<15||De.ios&&De.webkit_version<604;function Zn(t,e){let i,{state:n}=t,s=1,r=n.toText(e),o=r.lines==n.selection.ranges.length;if(null!=Ln&&n.selection.ranges.every((t=>t.empty))&&Ln==r.toString()){let t=-1;i=n.changeByRange((i=>{let a=n.doc.lineAt(i.from);if(a.from==t)return{range:i};t=a.from;let l=n.toText((o?r.line(s++).text:e)+n.lineBreak);return{changes:{from:a.from,insert:l},range:A.cursor(i.from+l.length)}}))}else i=o?n.changeByRange((t=>{let e=r.line(s++);return{changes:{from:t.from,to:t.to,insert:e.text},range:A.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 A.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 A.cursor(e);0==r?i=1:r==s.length&&(i=-1);let o=r,a=r;i<0?o=f(s.text,r,!1):a=f(s.text,r);let l=n(s.text.slice(o,a));for(;o>0;){let t=f(s.text,o,!1);if(n(s.text.slice(t,o))!=l)break;o=t}for(;a{t.inputState.setSelectionOrigin("select"),27==e.keyCode&&(t.inputState.lastEscPress=Date.now())},Cn.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},Cn.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},_n.touchstart=_n.touchmove={passive:!0},Cn.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return;let i=null;for(let n of t.state.facet(gi))if(i=n(t,e),i)break;if(i||0!=e.button||(i=function(t,e){let i=Vn(t,e),n=Yn(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 a,l=Vn(t,e),h=An(t,l.pos,l.bias,n);if(i.pos!=l.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&&(a=function(t,e){for(let i=0;i=e)return A.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,l.pos))?a:o?s.addRange(h):A.create([h])}}}(t,e)),i){let n=t.root.activeElement!=t.contentDOM;t.inputState.startMouseSelection(new $n(t,e,i,n)),n&&t.observer.ignore((()=>ge(t.contentDOM))),t.inputState.mouseSelection&&t.inputState.mouseSelection.start(e)}};let Tn=(t,e)=>t>=e.top&&t<=e.bottom,Rn=(t,e,i)=>Tn(e,i)&&t>=i.left&&t<=i.right;function En(t,e,i,n){let s=hi.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&&Rn(i,n,o))return-1;let a=s.coordsAt(r,1);return a&&Rn(i,n,a)?1:o&&Tn(n,o)?-1:1}function Vn(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:En(t,i,e.clientX,e.clientY)}}const Mn=De.ie&&De.ie_version<=11;let Dn=null,Wn=0,Un=0;function Yn(t){if(!Mn)return t.detail;let e=Dn,i=Un;return Dn=t,Un=Date.now(),Wn=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Wn+1)%3:1}function qn(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&&r.dragMove?{from:r.dragging.from,to:r.dragging.to}:null,a={from:s,insert:i},l=t.state.changes(o?[o,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(s,-1),head:l.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"})}Cn.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")},Cn.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&&qn(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 qn(t,e,e.dataTransfer.getData("Text"),!0)},Cn.paste=(t,e)=>{if(t.state.readOnly)return e.preventDefault();t.observer.flush();let i=Xn?null:e.clipboardData;i?(Zn(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(),Zn(t,i.value)}),50)}(t)};let Ln=null;Cn.copy=Cn.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;Ln=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 zn=lt.define();function In(t,e){let i=[];for(let n of t.facet(vi)){let s=n(t,e);s&&i.push(s)}return i?t.update({effects:i,annotations:zn.of(!0)}):null}function Bn(t){setTimeout((()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=In(t.state,e);i?t.dispatch(i):t.update([])}}),10)}Cn.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),Bn(t)},Cn.blur=t=>{t.observer.clearSelectionRange(),Bn(t)},Cn.compositionstart=Cn.compositionupdate=t=>{null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},Cn.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,De.chrome&&De.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then((()=>t.observer.flush())):setTimeout((()=>{t.inputState.composing<0&&t.docView.compositionDeco.size&&t.update([])}),50)},Cn.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},Cn.beforeinput=(t,e)=>{var i;let n;if(De.chrome&&De.android&&(n=Sn.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 jn=["pre-wrap","normal","pre-line","break-spaces"];class Nn{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){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return jn.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i-1,a=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,a){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)>Jn&&(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:a,toA:l,fromB:h,toB:c}=n[o],u=s.lineAt(a,Hn.ByPosNoHeight,i.setDoc(e),0,0),d=u.to>=l?u:s.lineAt(l,Hn.ByPosNoHeight,i,0,0);for(c+=d.to-l,l=d.to;o>0&&u.from<=n[o-1].toA;)a=n[o-1].fromA,h=n[o-1].fromB,o--,a2*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 es extends ts{constructor(t,e){super(t,e,ii.Text),this.collapsed=0,this.widgetHeight=0}replace(t,e,i){let n=i[0];return 1==i.length&&(n instanceof es||n instanceof is&&4&n.flags)&&Math.abs(this.length-n.length)<10?(n instanceof is?n=new es(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.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class is 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:a}=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),l=o+r.length*a,h=Math.max(i,t-l/2);return new Fn(r.from,r.length,h,l,ii.Text)}{let n=Math.max(0,Math.min(r-s,Math.floor((t-i)/o))),{from:a,length:l}=e.doc.line(s+n);return new Fn(a,l,i+o*n,o,ii.Text)}}lineAt(t,e,i,n,s){if(e==Hn.ByHeight)return this.blockAt(t,i,n,s);if(e==Hn.ByPosNoHeight){let{from:e,to:n}=i.doc.lineAt(t);return new Fn(e,n-e,0,0,ii.Text)}let{firstLine:r,perLine:o,perChar:a}=this.heightMetrics(i,s),l=i.doc.lineAt(t),h=o+l.length*a,c=l.number-r,u=n+o*c+a*(l.from-s-c);return new Fn(l.from,l.length,Math.max(n,Math.min(u,n+this.height-h)),h,ii.Text)}forEachLine(t,e,i,n,s,r){t=Math.max(t,s),e=Math.min(e,s+this.length);let{firstLine:o,perLine:a,perChar:l}=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+=a*i+l*(t-s-i)}let n=a+l*e.length;r(new Fn(e.from,e.length,c,n,ii.Text)),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 is?i[i.length-1]=new is(t.length+n):i.push(null,new is(n-1))}if(t>0){let e=i[0];e instanceof is?i[0]=new is(t+e.length):i.unshift(new is(t-1),null)}return Kn.of(i)}decomposeLeft(t,e){e.push(new is(t-1),null)}decomposeRight(t,e){e.push(null,new is(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 is(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)>=Jn&&(o=-2);let a=new es(e,s);a.outdated=!1,i.push(a),r+=e+1}r<=s&&i.push(null,new is(s-r).updateHeight(t,r));let a=Kn.of(i);return(o<0||Math.abs(a.height-this.height)>=Jn||Math.abs(o-this.heightMetrics(t,e).perLine)>=Jn)&&(t.heightChanged=!0),a}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class ns 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 l;let h=e==Hn.ByPosNoHeight?Hn.ByPosNoHeight:Hn.ByPos;return a?l.join(this.right.lineAt(o,h,i,r,o)):this.left.lineAt(o,h,i,n,s).join(l)}forEachLine(t,e,i,n,s,r){let o=n+this.left.height,a=s+this.left.length+this.break;if(this.break)t=a&&this.right.forEachLine(t,e,i,o,a,r);else{let l=this.lineAt(a,Hn.ByPos,i,n,s);t=t&&l.from<=e&&r(l),e>l.to&&this.right.forEachLine(l.to+1,e,i,o,a,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&&ss(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,a=null;return n&&n.from<=e+s.length&&n.more?a=s=s.updateHeight(t,e,i,n):s.updateHeight(t,e,i),n&&n.from<=o+r.length&&n.more?a=r=r.updateHeight(t,o,i,n):r.updateHeight(t,o,i),a?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 ss(t,e){let i,n;null==t[e]&&(i=t[e-1])instanceof is&&(n=t[e+1])instanceof is&&t.splice(e-1,3,new is(i.length+1+n.length))}class rs{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 es?i.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new es(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)}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 es(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let i=new is(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 es)return t;let e=new es(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine(),t.type!=ii.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,t.type!=ii.WidgetBefore&&(this.covering=t)}addLineDeco(t,e){let i=this.ensureLine();i.length+=e,i.collapsed+=e,i.widgetHeight=Math.max(i.widgetHeight,t),this.writtenTo=this.pos=this.pos+e}finish(t){let e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof es||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),a=Math.max(a,n.top),l=e==t.parentNode?n.bottom:Math.min(l,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:a-(i.top+e),bottom:Math.max(a,l)-(i.top+e)}}function ls(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class hs{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 Nn(i),this.stateDeco=e.facet(Ti).filter((t=>"function"!=typeof t)),this.heightMap=Kn.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle.setDoc(e.doc),[new Mi(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ni.set(this.lineGaps.map((t=>t.draw(!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 ds(e,i))}}this.viewports=t.sort(((t,e)=>t.from-e.from)),this.scaler=this.heightMap.height<=7e6?gs:new ms(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:bs(t,this.scaler))}))}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=this.state.facet(Ti).filter((t=>"function"!=typeof t));let n=t.changedRanges,s=Mi.extendWithRanges(n,function(t,e,i){let n=new os;return _t.compare(t,e,i,n,0),n.changes}(i,this.stateDeco,t?t.changes:k.empty(this.state.doc.length))),r=this.heightMap.height;this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),s),this.heightMap.height!=r&&(t.flags|=2);let o=s.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.heado.to)||!this.viewportIsAppropriate(o))&&(o=this.getViewport(0,e));let a=!t.changes.empty||2&t.flags||o.from!=this.viewport.from||o.to!=this.viewport.to;this.viewport=o,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(Si)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let i=e.contentDOM,n=window.getComputedStyle(i),s=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Wi.RTL:Wi.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),a=i.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let h=0,c=0,u=parseInt(n.paddingTop)||0,d=parseInt(n.paddingBottom)||0;this.paddingTop==u&&this.paddingBottom==d||(this.paddingTop=u,this.paddingBottom=d,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let f=(this.printing?ls:as)(i,this.paddingTop),p=f.top-this.pixelViewport.top,O=f.bottom-this.pixelViewport.bottom;this.pixelViewport=f;let g=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(g!=this.inView&&(this.inView=g,g&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let m=a.width;if(this.contentDOMWidth==m&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,h|=8),l){let i=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(i)&&(o=!0),o||s.lineWrapping&&Math.abs(m-this.contentDOMWidth)>s.charWidth){let{lineHeight:t,charWidth:n,textHeight:a}=e.docView.measureTextSize();o=t>0&&s.refresh(r,t,n,a,m/n,i),o&&(e.docView.minWidth=0,h|=8)}p>0&&O>0?c=Math.max(p,O):p<0&&O<0&&(c=Math.min(p,O)),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 Mi(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new Gn(n.from,r))}s.heightChanged&&(h|=2)}let b=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return b&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(2&h||b)&&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,a=new ds(n.lineAt(r-1e3*i,Hn.ByHeight,s,0,0).from,n.lineAt(o+1e3*(1-i),Hn.ByHeight,s,0,0).to);if(e){let{head:t}=e.range;if(ta.to){let i,r=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=n.lineAt(t,Hn.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!=Wi.LTR&&!i)return[];let o=[],a=(n,r,l,h)=>{if(r-nn&&tt.from>=l.from&&t.to<=l.to&&Math.abs(t.from-n)t.frome))));if(!d){if(rt.from<=r&&t.to>=r))){let t=e.moveToLineBoundary(A.cursor(r),!1,!0).head;t>n&&(r=t)}d=new hs(n,r,this.gapSize(l,n,r,h))}o.push(d)};for(let t of this.viewportLines){if(t.lengtht.from&&a(t.from,s,t,e),ot.draw(this.heightOracle.lineWrapping)))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];_t.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))||bs(this.heightMap.lineAt(t,Hn.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return bs(this.heightMap.lineAt(this.scaler.fromDOM(t),Hn.ByHeight,this.heightOracle,0,0),this.scaler)}elementAtHeight(t){return bs(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 ds{constructor(t,e){this.from=t,this.to=e}}function fs(t,e,i){let n=[],s=t,r=0;return _t.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 Os(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 gs={toDOM:t=>t,fromDOM:t=>t,scale:1};class ms{constructor(t,e,i){let n=0,s=0,r=0;this.viewports=i.map((({from:i,to:s})=>{let r=e.lineAt(i,Hn.ByPos,t,0,0).top,o=e.lineAt(s,Hn.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=ebs(t,e))):t.type)}const ws=E.define({combine:t=>t.join(" ")}),vs=E.define({combine:t=>t.indexOf(!0)>-1}),ys=It.newName(),Ss=It.newName(),xs=It.newName(),ks={"&light":"."+Ss,"&dark":"."+xs};function Qs(t,e,i){return new It(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 $s=Qs("."+ys,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",borderRadius:"4px",marginTop:"0.5rem",width:"30%",minWidth:"190px",marginLeft:"auto",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&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:"#333338",fontSize:"70%",padding:".2em 1em",borderRadius:"4px"},"&light .cm-button":{background:"#eee"},"&dark .cm-button":{background:"#eee"},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",borderRadius:"0.25rem",border:"1px solid silver",padding:".0em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},ks);class Ps{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;i&&(e.push(new nn(i,n)),s==i&&r==n||e.push(new nn(s,r)));return e}(t),i=new tn(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?A.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||!ne(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||!ne(t.contentDOM,e.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(e.anchorNode,e.anchorOffset);this.newSel=A.single(n,i)}}}function Cs(e,i){let n,{newSel:s}=i,r=e.state.selection.main;if(i.bounds){let{from:s,to:o}=i.bounds,a=r.from,l=null;(8===e.inputState.lastKeyCode&&e.inputState.lastKeyTime>Date.now()-100||De.android&&i.text.length0&&a>0&&t.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if("end"==n){i-=o+Math.max(0,r-Math.min(o,a))-r}if(o=o?r-i:0,a=r+(a-o),o=r}else if(a=a?r-i:0,o=r+(o-a),a=r}return{from:r,toA:o,toB:a}}(e.state.doc.sliceString(s,o,Ki),i.text,a-s,l);h&&(De.chrome&&13==e.inputState.lastKeyCode&&h.toB==h.from+2&&i.text.slice(h.from,h.toB)==Ki+Ki&&h.toB--,n={from:s+h.from,to:s+h.toA,insert:t.of(i.text.slice(h.from,h.toB).split(Ki))})}else s&&(!e.hasFocus&&e.state.facet($i)||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))}:(De.mac||De.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=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}):De.chrome&&n&&n.from==n.to&&n.from==r.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(s&&(s=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}),n){let t=e.state;if(De.ios&&e.inputState.flushIOSKey(e))return!0;if(De.android&&(n.from==r.from&&n.to==r.to&&1==n.insert.length&&2==n.insert.lines&&be(e.contentDOM,"Enter",13)||n.from==r.from-1&&n.to==r.to&&0==n.insert.length&&be(e.contentDOM,"Backspace",8)||n.from==r.from&&n.to==r.to+1&&0==n.insert.length&&be(e.contentDOM,"Delete",46)))return!0;let i,o=n.insert.toString();if(e.state.facet(wi).some((t=>t(e,n.from,n.to,o))))return!0;if(e.inputState.composing>=0&&e.inputState.composing++,n.from>=r.from&&n.to<=r.to&&n.to-n.from>=(r.to-r.from)/3&&(!s||s.main.empty&&s.main.from==n.from+n.insert.length)&&e.inputState.composing<0){let s=r.fromn.to?t.sliceDoc(n.to,r.to):"";i=t.replaceSelection(e.state.toText(s+n.insert.sliceString(0,void 0,e.state.lineBreak)+o))}else{let o=t.changes(n),a=s&&s.main.to<=o.newLength?s.main:void 0;if(t.selection.ranges.length>1&&e.inputState.composing>=0&&n.to<=r.to&&n.to>=r.to-10){let s=e.state.sliceDoc(n.from,n.to),l=on(e)||e.state.doc.lineAt(r.head),h=r.to-n.to,c=r.to-r.from;i=t.changeByRange((i=>{if(i.from==r.from&&i.to==r.to)return{changes:o,range:a||i.map(o)};let u=i.to-h,d=u-s.length;if(i.to-i.from!=c||e.state.sliceDoc(d,u)!=s||l&&i.to>=l.from&&i.from<=l.to)return{range:i};let f=t.changes({from:d,to:u,insert:n.insert}),p=i.to-r.to;return{changes:f,range:a?A.range(Math.max(0,a.anchor+p),Math.max(0,a.head+p)):i.map(f)}}))}else i={changes:o,selection:a&&t.selection.replaceRange(a)}}let a="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,a+=".compose",e.inputState.compositionFirstChange&&(a+=".start",e.inputState.compositionFirstChange=!1)),e.dispatch(i,{scrollIntoView:!0,userEvent:a}),!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 _s={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Xs=De.ie&&De.ie_version<=11;class Zs{constructor(t){this.view=t,this.active=!1,this.selectionRange=new fe,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);(De.ie&&De.ie_version<=11||De.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()})),Xs&&(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")))}),{}),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($i)?i.root.activeElement!=this.dom:!se(i.dom,n))return;let s=n.anchorNode&&i.docView.nearest(n.anchorNode);s&&s.ignoreEvent(t)?e||(this.selectionChanged=!1):(De.ie&&De.ie_version<=11||De.android&&De.chrome)&&!i.state.selection.main.empty&&n.focusNode&&oe(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=De.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,a=t.docView.domAtPos(t.state.selection.main.anchor);oe(a.node,a.offset,r,o)&&([n,s,r,o]=[r,o,n,s]);return{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:o}}(this.view)||ie(t.root);if(!e||this.selectionRange.eq(e))return!1;let i=se(this.dom,e);return i&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let t=this.delayedAndroidKey;t&&(this.clearDelayedAndroidKey(),!this.flush()&&t.force&&be(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&&se(this.dom,this.selectionRange);return t<0&&!n?null:(t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new Ps(this.view,t,e,i))}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=Cs(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.dirty|=4),"childList"==t.type){let i=As(e,t.previousSibling||t.target.previousSibling,-1),n=As(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 As(t,e,i){for(;e;){let n=Se.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 Ts{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),this._dispatch=t.dispatch||(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 us(t.state||xt.create(t)),this.plugins=this.state.facet(Ci).map((t=>new Xi(t)));for(let t of this.plugins)t.update(this);this.observer=new Zs(this),this.inputState=new yn(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new sn(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),t.parent&&t.parent.appendChild(this.dom)}get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}dispatch(...t){this._dispatch(1==t.length&&t[0]instanceof dt?t[0]:this.state.update(...t))}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,a=null;t.some((t=>t.annotation(zn)))?(this.inputState.notifiedFocused=r,o=1):r!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=r,a=In(s,r),a||(o=1));let l=this.observer.delayedAndroidKey,h=null;if(l?(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(xt.phrases)!=this.state.facet(xt.phrases))return this.setState(s);e=Di.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 xi(t.empty?t:A.cursor(t.head,t.head>t.anchor?-1:1))}for(let t of e.effects)t.is(ki)&&(c=t.value)}this.viewState.update(e,c),this.bidiCache=Vs.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),i=this.docView.update(e),this.state.facet(Vi)!=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(ws)!=e.state.facet(ws)&&(this.viewState.mustMeasureContent=!0),(i||n||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!e.empty)for(let t of this.state.facet(bi))t(e);(a||h)&&Promise.resolve().then((()=>{a&&this.state==a.startState&&this.dispatch(a),h&&!Cs(this,h)&&l.force&&be(this.contentDOM,l.key,l.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 us(t),this.plugins=t.facet(Ci).map((t=>new Xi(t))),this.pluginMap.clear();for(let t of this.plugins)t.update(this);this.docView=new sn(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(Ci),i=t.state.facet(Ci);if(e!=i){let n=[];for(let s of i){let i=e.indexOf(s);if(i<0)n.push(new Xi(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.measureScheduled=0,t&&this.observer.forceFlush();let e=null,{scrollHeight:i,scrollTop:n,clientHeight:s}=this.scrollDOM,r=n>i-s-4?i:n;try{for(let t=0;;t++){this.updateState=1;let i=this.viewport,n=this.viewState.lineBlockAtHeight(r),s=this.viewState.measure(this);if(!s&&!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 o=[];4&s||([this.measureRequests,o]=[o,this.measureRequests]);let a=o.map((t=>{try{return t.read(this)}catch(t){return Qi(this.state,t),Es}})),l=Di.create(this,this.state,[]),h=!1,c=!1;l.flags|=s,e?e.flags|=s:e=l,this.updateState=2,l.empty||(this.updatePlugins(l),this.inputState.update(l),this.updateAttrs(),h=this.docView.update(l));for(let t=0;t1||t<-1)&&(this.scrollDOM.scrollTop+=t,c=!0)}if(h&&this.docView.updateSelection(!0),this.viewport.from==i.from&&this.viewport.to==i.to&&!c&&0==this.measureRequests.length)break}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let t of this.state.facet(bi))t(e)}get themeClasses(){return ys+" "+(this.state.facet(vs)?xs:Ss)+" "+this.state.facet(ws)}updateAttrs(){let t=Ms(this,Zi,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet($i)?"true":"false",class:"cm-content",style:`${De.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Ms(this,Ai,e);let i=this.observer.ignore((()=>{let i=ti(this.contentDOM,this.contentAttrs,e),n=ti(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)if(t.is(Ts.announce)){e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(Vi),It.mount(this.root,this.styleModules.concat($s).reverse())}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}}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 vn(this,t,wn(this,t,e,i))}moveByCharSelected(t,e,i){return vn(this,t,wn(this,t,e,i),!0)}moveByGroup(t,e){return vn(this,t,wn(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==wt.Space&&(s=e),s==e}}(this,t.head,e))))}moveToLineBoundary(t,e,i=!0){return function(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=n&&t.lineWrapping?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==Wi.LTR)?e.right-1:e.left+1,y:(r.top+r.bottom)/2});if(null!=o)return A.cursor(o,i?-1:1)}let o=hi.find(t.docView,e.head),a=o?i?o.posAtEnd:o.posAtStart:i?s.to:s.from;return A.cursor(a,i?-1:1)}(this,t,e,i)}moveVertically(t,e,i){return vn(this,t,function(t,e,i,n){let s=e.head,r=i?1:-1;if(s==(i?t.state.doc.length:0))return A.cursor(s,e.assoc);let o,a=e.goalColumn,l=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s),c=t.documentTop;if(h)null==a&&(a=h.left-l.left),o=r<0?h.top:h.bottom;else{let e=t.viewState.lineBlockAt(s);null==a&&(a=Math.min(l.right-l.left,t.defaultCharacterWidth*(s-e.from))),o=(r<0?e.top:e.bottom)+c}let u=l.left+a,d=null!=n?n:t.defaultLineHeight>>1;for(let i=0;;i+=10){let n=o+(d+i)*r,h=mn(t,{x:u,y:n},!1,r);if(nl.bottom||(r<0?hs))return A.cursor(h,e.assoc,void 0,a)}}(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(),mn(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 ue(i,s[Ni.find(s,t-n.from,-1,e)].dir==Wi.LTR==e>0)}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(yi)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Rs)return Fi(t.length);let e=this.textDirectionAt(t.from);for(let i of this.bidiCache)if(i.from==t.from&&i.dir==e)return i.order;let i=function(t,e){let i=t.length,n=e==Ui?1:2,s=e==Ui?2:1;if(!t||1==n&&!ji.test(t))return Fi(i);for(let e=0,s=n,o=n;e=0;t-=3)if(Bi[t+1]==-r){let e=Bi[t+2],i=2&e?n:4&e?1&e?s:n:0;i&&(Gi[a]=Gi[Bi[t]]=i),l=t;break}}else{if(189==Bi.length)break;Bi[l++]=a,Bi[l++]=e,Bi[l++]=h}else if(2==(o=Gi[a])||1==o){let t=o==n;h=t?0:1;for(let e=l-3;e>=0;e-=3){let i=Bi[e+2];if(2&i)break;if(t)Bi[e+2]|=2;else{if(4&i)break;Bi[e+2]|=4}}}for(let t=0;te;){let t=i,n=2!=Gi[--i];for(;i>e&&n==(2!=Gi[i-1]);)i--;o.push(new Ni(i,t,n?2:1))}else o.push(new Ni(e,t,0))}else for(let t=0;tDate.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{ge(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 ki.of(new xi("number"==typeof t?A.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}static domEventHandlers(t){return _i.define((()=>({})),{eventHandlers:t})}static theme(t,e){let i=It.newName(),n=[ws.of(i),Vi.of(Qs(`.${i}`,t))];return e&&e.dark&&n.push(vs.of(!0)),n}static baseTheme(t){return N.lowest(Vi.of(Qs("."+ys,t,ks)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),n=i&&Se.get(i)||Se.get(t);return(null===(e=null==n?void 0:n.rootView)||void 0===e?void 0:e.view)||null}}Ts.styleModule=Vi,Ts.inputHandler=wi,Ts.focusChangeEffect=vi,Ts.perLineTextDirection=yi,Ts.exceptionSink=mi,Ts.updateListener=bi,Ts.editable=$i,Ts.mouseSelectionStyle=gi,Ts.dragMovesSelection=Oi,Ts.clickAddsSelectionRange=pi,Ts.decorations=Ti,Ts.atomicRanges=Ri,Ts.scrollMargins=Ei,Ts.darkTheme=vs,Ts.contentAttributes=Ai,Ts.editorAttributes=Zi,Ts.lineWrapping=Ts.contentAttributes.of({class:"cm-lineWrapping"}),Ts.announce=ut.define();const Rs=4096,Es={};class Vs{constructor(t,e,i,n){this.from=t,this.to=e,this.dir=i,this.order=n}static update(t,e){if(e.empty)return t;let i=[],n=t.length?t[t.length-1].dir:Wi.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&&Je(r,i)}return i}const Ds=De.mac?"mac":De.windows?"win":De.linux?"linux":"key";function Ws(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 Us=N.default(Ts.domEventHandlers({keydown:(t,e)=>Bs(Ls(e.state),t,e,"editor")})),Ys=E.define({enables:Us}),qs=new WeakMap;function Ls(t){let e=t.facet(Ys),i=qs.get(e);return i||qs.set(e,i=function(t,e=Ds){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)=>{var a,l;let h=i[t]||(i[t]=Object.create(null)),c=n.split(/ (?!$)/).map((t=>function(t,e){const i=t.split(/-(?!$)/);let n,s,r,o,a=i[i.length-1];"Space"==a&&(a=" ");for(let t=0;t{let n=zs={view:e,prefix:i,scope:t};return setTimeout((()=>{zs==n&&(zs=null)}),Is),!0}]})}let u=c.join(" ");s(u,!1);let d=h[u]||(h[u]={preventDefault:!1,run:(null===(l=null===(a=h._any)||void 0===a?void 0:a.run)||void 0===l?void 0:l.slice())||[]});r&&d.run.push(r),o&&(d.preventDefault=!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,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.shift&&r(e,"Shift-"+s,n.shift,n.preventDefault)}return i}(e.reduce(((t,e)=>t.concat(e)),[]))),i}let zs=null;const Is=4e3;function Bs(t,e,i,n){let s=function(t){var e=!(Kt&&(t.ctrlKey||t.altKey||t.metaKey)||Jt&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?Gt:Nt)[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=v(b(s,0))==s.length&&" "!=s,o="",a=!1;zs&&zs.view==i&&zs.scope==n&&(o=zs.prefix+" ",(a=kn.indexOf(e.keyCode)<0)&&(zs=null));let l,h,c=new Set,u=t=>{if(t){for(let n of t.run)if(!c.has(n)&&(c.add(n),n(i,e)))return!0;t.preventDefault&&(a=!0)}return!1},d=t[n];if(d){if(u(d[o+Ws(s,e,!r)]))return!0;if(r&&(e.altKey||e.metaKey||e.ctrlKey)&&!(De.windows&&e.ctrlKey&&e.altKey)&&(l=Nt[e.keyCode])&&l!=s){if(u(d[o+Ws(l,e,!0)]))return!0;if(e.shiftKey&&(h=Gt[e.keyCode])!=s&&h!=l&&u(d[o+Ws(h,e,!1)]))return!0}else if(r&&e.shiftKey&&u(d[o+Ws(s,e,!0)]))return!0;if(u(d._any))return!0}return a}class js{constructor(t,e,i,n,s){this.className=t,this.left=e,this.top=i,this.width=n,this.height=s}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className==this.className&&(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",null!=this.width&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,i){if(i.empty){let n=t.coordsAtPos(i.head,i.assoc||1);if(!n)return[];let s=Ns(t);return[new js(e,n.left-s.left,n.top-s.top,null,n.bottom-n.top)]}return function(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];let n=Math.max(i.from,t.viewport.from),s=Math.min(i.to,t.viewport.to),r=t.textDirection==Wi.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=Ns(t),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),u=a.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),d=a.right-(c?parseInt(c.paddingRight):0),f=Fs(t,n),p=Fs(t,s),O=f.type==ii.Text?f:null,g=p.type==ii.Text?p:null;t.lineWrapping&&(O&&(O=Gs(t,n,O)),g&&(g=Gs(t,s,g)));if(O&&g&&O.from==g.from)return b(w(i.from,i.to,O));{let e=O?w(i.from,null,O):v(f,!1),n=g?w(null,i.to,g):v(p,!0),s=[];return(O||f).to<(g||p).from-1?s.push(m(u,e.bottom,d,n.top)):e.bottomh&&n.from=r)break;a>s&&l(Math.max(t,s),null==e&&t<=h,Math.min(a,r),null==i&&a>=c,o.dir)}if(s=n.to+1,s>=r)break}return 0==a.length&&l(h,null==e,c,null==i,t.textDirection),{top:s,bottom:o,horizontal:a}}function v(t,e){let i=a.top+(e?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]}}}(t,e,i)}}function Ns(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Wi.LTR?e.left:e.right-t.scrollDOM.clientWidth)-t.scrollDOM.scrollLeft,top:e.top-t.scrollDOM.scrollTop}}function Gs(t,e,i){let n=A.cursor(e);return{from:Math.max(i.from,t.moveToLineBoundary(n,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(n,!0,!0).from),type:ii.Text}}function Fs(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==ii.Text))return t;return i}class Hs{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),e.above&&this.dom.classList.add("cm-layer-above"),e.class&&this.dom.classList.add(e.class),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(Js)!=t.state.facet(Js)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&t.view.requestMeasure(this.measureReq)}setOrder(t){let e=0,i=t.facet(Js);for(;e{return i=t,n=this.drawn[e],!(i.constructor==n.constructor&&i.eq(n));var i,n}))){let e=this.dom.firstChild,i=0;for(let n of t)n.update&&e&&n.constructor&&this.drawn[i].constructor&&n.update(e,this.drawn[i])?(e=e.nextSibling,i++):this.dom.insertBefore(n.draw(),e);for(;e;){let t=e.nextSibling;e.remove(),e=t}this.drawn=t}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Js=E.define();function Ks(t){return[_i.define((e=>new Hs(e,t))),Js.of(t)]}const tr=!De.ios,er=E.define({combine:t=>kt(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})});function ir(t={}){return[er.of(t),sr,or,lr,Si.of(!0)]}function nr(t){return t.startState.facet(er)!=t.state.facet(er)}const sr=Ks({above:!0,markers(t){let{state:e}=t,i=e.facet(er),n=[];for(let s of e.selection.ranges){let r=s==e.selection.main;if(s.empty?!r||tr:i.drawRangeCursor){let e=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",i=s.empty?s:A.cursor(s.head,s.head>s.anchor?-1:1);for(let s of js.forRange(t,e,i))n.push(s)}}return n},update(t,e){t.transactions.some((t=>t.selection))&&(e.style.animationName="cm-blink"==e.style.animationName?"cm-blink2":"cm-blink");let i=nr(t);return i&&rr(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){rr(e.state,t)},class:"cm-cursorLayer"});function rr(t,e){e.style.animationDuration=t.facet(er).cursorBlinkRate+"ms"}const or=Ks({above:!1,markers:t=>t.state.selection.ranges.map((e=>e.empty?[]:js.forRange(t,"cm-selectionBackground",e))).reduce(((t,e)=>t.concat(e))),update:(t,e)=>t.docChanged||t.selectionSet||t.viewportChanged||nr(t),class:"cm-selectionLayer"}),ar={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};tr&&(ar[".cm-line"].caretColor="transparent !important");const lr=N.highest(Ts.theme(ar)),hr=ut.define({map:(t,e)=>null==t?null:e.mapPos(t)}),cr=q.define({create:()=>null,update:(t,e)=>(null!=t&&(t=e.changes.mapPos(t)),e.effects.reduce(((t,e)=>e.is(hr)?e.value:t),t))}),ur=_i.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let i=t.state.field(cr);null==i?null!=this.cursor&&(null===(e=this.cursor)||void 0===e||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(cr)!=i||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let t=this.view.state.field(cr),e=null!=t&&this.view.coordsAtPos(t);if(!e)return null;let i=this.view.scrollDOM.getBoundingClientRect();return{left:e.left-i.left+this.view.scrollDOM.scrollLeft,top:e.top-i.top+this.view.scrollDOM.scrollTop,height:e.bottom-e.top}}drawCursor(t){this.cursor&&(t?(this.cursor.style.left=t.left+"px",this.cursor.style.top=t.top+"px",this.cursor.style.height=t.height+"px"):this.cursor.style.left="-100000px")}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(cr)!=t&&this.view.dispatch({effects:hr.of(t)})}},{eventHandlers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){t.target!=this.view.contentDOM&&this.view.contentDOM.contains(t.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function dr(){return[cr,ur]}function fr(t,e,i,n,s){e.lastIndex=0;for(let r,o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)if(!o.lineBreak)for(;r=e.exec(o.value);)s(a+r.index,r)}class pr{constructor(t){const{regexp:e,decoration:i,decorate:n,boundary:s,maxLength:r=1e3}=t;if(!e.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=e,n)this.addMatch=(t,e,i,s)=>n(s,i,i+t[0].length,t,e);else if("function"==typeof i)this.addMatch=(t,e,n,s)=>{let r=i(t,e,n);r&&s(n,n+t[0].length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(t,e,n,s)=>s(n,n+t[0].length,i)}this.boundary=s,this.maxLength=r}createDeco(t){let e=new Xt,i=e.add.bind(e);for(let{from:e,to:n}of function(t,e){let i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;let n=[];for(let{from:s,to:r}of i)s=Math.max(t.state.doc.lineAt(s).from,s-e),r=Math.min(t.state.doc.lineAt(r).to,r+e),n.length&&n[n.length-1].to>=s?n[n.length-1].to=r:n.push({from:s,to:r});return n}(t,this.maxLength))fr(t.state.doc,this.regexp,e,n,((e,n)=>this.addMatch(n,t,e,i)));return e.finish()}updateDeco(t,e){let i=1e9,n=-1;return t.docChanged&&t.changes.iterChanges(((e,s,r,o)=>{o>t.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e}updateRange(t,e,i,n){for(let s of t.visibleRanges){let r=Math.max(s.from,i),o=Math.min(s.to,n);if(o>r){let i=t.state.doc.lineAt(r),n=i.toi.from;r--)if(this.boundary.test(i.text[r-1-i.from])){a=r;break}for(;oc.push(i.range(t,e));if(i==n)for(this.regexp.lastIndex=a-i.from;(h=this.regexp.exec(i.text))&&h.indexthis.addMatch(i,t,e,u)));e=e.update({filterFrom:a,filterTo:l,filter:(t,e)=>tl,add:c})}}return e}}const Or=null!=/x/.unicode?"gu":"g",gr=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",Or),mr={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let br=null;const wr=E.define({combine(t){let e=kt(t,{render:null,specialChars:gr,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==br&&"undefined"!=typeof document&&document.body){let e=document.body.style;br=null!=(null!==(t=e.tabSize)&&void 0!==t?t:e.MozTabSize)}return br||!1}())&&(e.specialChars=new RegExp("\t|"+e.specialChars.source,Or)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Or)),e}});function vr(t={}){return[wr.of(t),yr||(yr=_i.fromClass(class{constructor(t){this.view=t,this.decorations=ni.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(wr)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new pr({regexp:t.specialChars,decoration:(e,i,n)=>{let{doc:s}=i.state,r=b(e[0],0);if(9==r){let t=s.lineAt(n),e=i.state.tabSize,r=Yt(t.text,e,n-t.from);return ni.replace({widget:new xr((e-r%e)*this.view.defaultCharacterWidth)})}return this.decorationCache[r]||(this.decorationCache[r]=ni.replace({widget:new Sr(t,r)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(wr);t.startState.facet(wr)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))]}let yr=null;class Sr extends ei{constructor(t,e){super(),this.options=t,this.code=e}eq(t){return t.code==this.code}toDOM(t){let e=function(t){return t>=32?"•":10==t?"␤":String.fromCharCode(9216+t)}(this.code),i=t.state.phrase("Control character")+" "+(mr[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,i,e);if(n)return n;let s=document.createElement("span");return s.textContent=e,s.title=i,s.setAttribute("aria-label",i),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class xr extends ei{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent="\t",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}class kr extends ei{constructor(t){super(),this.content=t}toDOM(){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):this.content),"string"==typeof this.content?t.setAttribute("aria-label","placeholder "+this.content):t.setAttribute("aria-hidden","true"),t}ignoreEvent(){return!1}}const Qr="-10000px";class $r{constructor(t,e,i){this.facet=e,this.createTooltipView=i,this.input=t.state.facet(e),this.tooltips=this.input.filter((t=>t)),this.tooltipViews=this.tooltips.map(i)}update(t){var e;let i=t.state.facet(this.facet),n=i.filter((t=>t));if(i===this.input){for(let e of this.tooltipViews)e.update&&e.update(t);return!1}let s=[];for(let e=0;e{var e,i,n;return{position:De.ios?"absolute":(null===(e=t.find((t=>t.position)))||void 0===e?void 0:e.position)||"fixed",parent:(null===(i=t.find((t=>t.parent)))||void 0===i?void 0:i.parent)||null,tooltipSpace:(null===(n=t.find((t=>t.tooltipSpace)))||void 0===n?void 0:n.tooltipSpace)||Pr}}}),_r=new WeakMap,Xr=_i.fromClass(class{constructor(t){this.view=t,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(Cr);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new $r(t,Tr,(t=>this.createTooltip(t))),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout((()=>{this.measureTimeout=-1,this.maybeMeasure()}),50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t);e&&this.observeIntersection();let i=e||t.geometryChanged,n=t.state.facet(Cr);if(n.position!=this.position){this.position=n.position;for(let t of this.manager.tooltipViews)t.dom.style.position=this.position;i=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let t of this.manager.tooltipViews)this.container.appendChild(t.dom);i=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure()}createTooltip(t){let e=t.create(this.view);if(e.dom.classList.add("cm-tooltip"),t.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",e.dom.appendChild(t)}return e.dom.style.position=this.position,e.dom.style.top=Qr,this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var t,e;this.view.win.removeEventListener("resize",this.measureSoon);for(let e of this.manager.tooltipViews)e.dom.remove(),null===(t=e.destroy)||void 0===t||t.call(e);null===(e=this.intersectionObserver)||void 0===e||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=this.view.dom.getBoundingClientRect();return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map(((t,e)=>{let i=this.manager.tooltipViews[e];return i.getCoords?i.getCoords(t.pos):this.view.coordsAtPos(t.pos)})),size:this.manager.tooltipViews.map((({dom:t})=>t.getBoundingClientRect())),space:this.view.state.facet(Cr).tooltipSpace(this.view)}}writeMeasure(t){var e;let{editor:i,space:n}=t,s=[];for(let r=0;r=Math.min(i.bottom,n.bottom)||h.rightMath.min(i.right,n.right)+.1){l.style.top=Qr;continue}let u=o.arrow?a.dom.querySelector(".cm-tooltip-arrow"):null,d=u?7:0,f=c.right-c.left,p=null!==(e=_r.get(a))&&void 0!==e?e:c.bottom-c.top,O=a.offset||Ar,g=this.view.textDirection==Wi.LTR,m=c.width>n.right-n.left?g?n.left:n.right-c.width:g?Math.min(h.left-(u?14:0)+O.x,n.right-f):Math.max(n.left,h.left-f+(u?14:0)-O.x),b=!!o.above;!o.strictSide&&(b?h.top-(c.bottom-c.top)-O.yn.bottom)&&b==n.bottom-h.bottom>h.top-n.top&&(b=!b);let w=(b?h.top-n.top:n.bottom-h.bottom)-d;if(wm&&t.topv&&(v=b?t.top-p-2-d:t.bottom+d+2);"absolute"==this.position?(l.style.top=v-t.parent.top+"px",l.style.left=m-t.parent.left+"px"):(l.style.top=v+"px",l.style.left=m+"px"),u&&(u.style.left=h.left+(g?O.x:-O.x)-(m+14-7)+"px"),!0!==a.overlap&&s.push({left:m,top:v,right:y,bottom:v+p}),l.classList.toggle("cm-tooltip-above",b),l.classList.toggle("cm-tooltip-below",!b),a.positioned&&a.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=Qr}},{eventHandlers:{scroll(){this.maybeMeasure()}}}),Zr=Ts.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Ar={x:0,y:0},Tr=E.define({enables:[Xr,Zr]});function Rr(t,e){let i=t.plugin(Xr);if(!i)return null;let n=i.manager.tooltips.indexOf(e);return n<0?null:i.manager.tooltipViews[n]}const Er=E.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 Vr(t,e){let i=t.plugin(Mr),n=i?i.specs.indexOf(e):-1;return n>-1?i.panels[n]:null}const Mr=_i.fromClass(class{constructor(t){this.input=t.state.facet(Ur),this.specs=this.input.filter((t=>t)),this.panels=this.specs.map((e=>e(t)));let e=t.state.facet(Er);this.top=new Dr(t,!0,e.topContainer),this.bottom=new Dr(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(Er);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Dr(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Dr(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(Ur);if(i!=this.input){let e=i.filter((t=>t)),n=[],s=[],r=[],o=[];for(let i of e){let e,a=this.specs.indexOf(i);a<0?(e=i(t.view),o.push(e)):(e=this.panels[a],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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}}))});class Dr{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=Wr(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=Wr(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 Wr(t){let e=t.nextSibling;return t.remove(),e}const Ur=E.define({enables:Mr});class Yr extends Qt{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Yr.prototype.elementClass="",Yr.prototype.toDOM=void 0,Yr.prototype.mapMode=S.TrackBefore,Yr.prototype.startSide=Yr.prototype.endSide=-1,Yr.prototype.point=!0;const qr=E.define(),Lr={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>_t.empty,lineMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},zr=E.define();function Ir(t){return[jr(),zr.of(Object.assign(Object.assign({},Lr),t))]}const Br=E.define({combine:t=>t.some((t=>t))});function jr(t){let e=[Nr];return t&&!1===t.fixed&&e.push(Br.of(!0)),e}const Nr=_i.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+"px",this.gutters=t.state.facet(zr).map((e=>new Jr(t,e)));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!t.state.facet(Br),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(Br)!=!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=_t.iter(this.view.state.facet(qr),this.view.viewport.from),n=[],s=this.gutters.map((t=>new Hr(t,this.view.viewport,-this.view.documentPadding.top)));for(let t of this.view.viewportLineBlocks){let e;if(Array.isArray(t.type)){for(let i of t.type)if(i.type==ii.Text){e=i;break}}else e=t.type==ii.Text?t:void 0;if(e){n.length&&(n=[]),Fr(i,n,t.from);for(let t of s)t.line(this.view,e,n)}}for(let t of s)t.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(zr),i=t.state.facet(zr),n=t.docChanged||t.heightChanged||t.viewportChanged||!_t.eq(t.startState.facet(qr),t.state.facet(qr),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 Jr(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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&0!=i.gutters.length&&i.fixed?e.textDirection==Wi.LTR?{left:i.dom.offsetWidth}:{right:i.dom.offsetWidth}:null}))});function Gr(t){return Array.isArray(t)?t:[t]}function Fr(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class Hr{constructor(t,e,i){this.gutter=t,this.height=i,this.i=0,this.cursor=_t.iter(t.markers,e.from)}line(t,e,i){let n=[];Fr(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;if(0==n.length&&!r.config.renderEmptyElements)return;let o=e.top-this.height;if(this.i==r.elements.length){let i=new Kr(t,e.height,o,n);r.elements.push(i),r.dom.appendChild(i.dom)}else r.elements[this.i].update(t,e.height,o,n);this.height=e.bottom,this.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 Jr{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=Gr(e.markers(t)),e.initialSpacer&&(this.spacer=new Kr(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=Gr(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!_t.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 Kr{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.dom.style.height=(this.height=e)+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),function(t,e){if(t.length!=e.length)return!1;for(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 io extends Yr{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function no(t,e){return t.state.facet(eo).formatNumber(e,t.state)}const so=zr.compute([eo],(t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:t=>t.state.facet(to),lineMarker:(t,e,i)=>i.some((t=>t.toDOM))?null:new io(no(t,t.state.doc.lineAt(e.from).number)),lineMarkerChange:t=>t.startState.facet(eo)!=t.state.facet(eo),initialSpacer:t=>new io(no(t,ro(t.state.doc.lines))),updateSpacer(t,e){let i=no(e.view,ro(e.view.state.doc.lines));return i==t.number?t:new io(i)},domEventHandlers:t.facet(eo).domEventHandlers})));function ro(t){let e=9;for(;e{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=fo.match(t)),e=>{let i=t(e);return void 0===i?null:[this,i]}}}ho.closedBy=new ho({deserialize:t=>t.split(" ")}),ho.openedBy=new ho({deserialize:t=>t.split(" ")}),ho.group=new ho({deserialize:t=>t.split(" ")}),ho.contextHash=new ho({perNode:!0}),ho.lookAhead=new ho({perNode:!0}),ho.mounted=new ho({perNode:!0});class co{constructor(t,e,i){this.tree=t,this.overlay=e,this.parser=i}}const uo=Object.create(null);class fo{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):uo,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),n=new fo(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(ho.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(ho.group),n=-1;n<(i?i.length:0);n++){let s=e[n<0?t.name:i[n]];if(s)return s}}}}fo.none=new fo("",Object.create(null),0,8);class po{constructor(t){this.types=t;for(let e=0;e=n&&(r.type.isAnonymous||!1!==e(r))){if(r.firstChild())continue;t=!0}for(;t&&i&&!r.type.isAnonymous&&i(r),!r.nextSibling();){if(!r.parent())return;t=!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:To(fo.none,this.children,this.positions,0,this.children.length,0,this.length,((t,e,i)=>new bo(this.type,t,e,i,this.propValues)),t.makeTree||((t,e,i)=>new bo(fo.none,t,e,i)))}static build(t){return function(t){var e;let{buffer:i,nodeSet:n,maxBufferLength:s=oo,reused:r=[],minRepeatType:o=n.types.length}=t,a=Array.isArray(i)?new wo(i,i.length):i,l=n.types,h=0,c=0;function u(t,e,i,m,b){let{id:w,start:v,end:y,size:S}=a,x=c;for(;S<0;){if(a.next(),-1==S){let e=r[w];return i.push(e),void m.push(v-t)}if(-3==S)return void(h=w);if(-4==S)return void(c=w);throw new RangeError(`Unrecognized record size: ${S}`)}let k,Q,$=l[w],P=v-t;if(y-v<=s&&(Q=O(a.pos-e,b))){let e=new Uint16Array(Q.size-Q.skip),i=a.pos-Q.size,s=e.length;for(;a.pos>i;)s=g(Q.start,e,s);k=new vo(e,y-Q.start,n),P=Q.start-t}else{let t=a.pos-S;a.next();let e=[],i=[],n=w>=o?w:-1,r=0,l=y;for(;a.pos>t;)n>=0&&a.id==n&&a.size>=0?(a.end<=l-s&&(f(e,i,v,r,a.end,l,n,x),r=e.length,l=a.end),a.next()):u(v,t,e,i,n);if(n>=0&&r>0&&r-1&&r>0){let t=d($);k=To($,e,i,0,e.length,0,y-v,t,t)}else k=p($,e,i,y-v,x-y)}i.push(k),m.push(P)}function d(t){return(e,i,n)=>{let s,r,o=0,a=e.length-1;if(a>=0&&(s=e[a])instanceof bo){if(!a&&s.type==t&&s.length==n)return s;(r=s.prop(ho.lookAhead))&&(o=i[a]+s.length+r)}return p(t,e,i,n,o)}}function f(t,e,i,s,r,o,a,l){let h=[],c=[];for(;t.length>s;)h.push(t.pop()),c.push(e.pop()+i-r);t.push(p(n.types[a],h,c,o-r,l-o)),e.push(r-i)}function p(t,e,i,n,s=0,r){if(h){let t=[ho.contextHash,h];r=r?[t].concat(r):[t]}if(s>25){let t=[ho.lookAhead,s];r=r?[t].concat(r):[t]}return new bo(t,e,i,n,r)}function O(t,e){let i=a.fork(),n=0,r=0,l=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=l,l+=4,n+=4,i.next();continue}let a=i.pos-t;if(t<0||a=o?4:0,d=i.start;for(i.next();i.pos>a;){if(i.size<0){if(-3!=i.size)break t;u+=4}else i.id>=o&&(u+=4);i.next()}r=d,n+=t,l+=u}return(e<0||n==t)&&(c.size=n,c.start=r,c.skip=l),c.size>4?c:void 0}function g(t,e,i){let{id:n,start:s,end:r,size:l}=a;if(a.next(),l>=0&&n4){let n=a.pos-(l-4);for(;a.pos>n;)i=g(t,e,i)}e[--i]=o,e[--i]=r-t,e[--i]=s-t,e[--i]=n}else-3==l?h=n:-4==l&&(c=n);return i}let m=[],b=[];for(;a.pos>0;)u(t.start||0,t.bufferStart||0,m,b,-1);let w=null!==(e=t.length)&&void 0!==e?e:m.length?b[0]+m[0].length:0;return new bo(l[t.topID],m.reverse(),b.reverse(),w)}(t)}}bo.empty=new bo(fo.none,[],[],0);class wo{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 wo(this.buffer,this.index)}}class vo{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return fo.none}toString(){let t=[];for(let e=0;e0));a=r[a+3]);return o}slice(t,e,i){let n=this.buffer,s=new Uint16Array(e-t),r=0;for(let o=t,a=0;o=e&&ie;case 1:return i<=e&&n>e;case 2:return n>e;case 4:return!0}}function So(t,e){let i=t.childBefore(e);for(;i;){let e=i.lastChild;if(!e||e.to!=i.to)break;e.type.isError&&e.from==e.to?(t=i,i=e.prevSibling):i=e}return t}function xo(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!=l;t+=e){let l=o[t],h=a[t]+r.from;if(yo(n,i,h,h+l.length))if(l instanceof vo){if(s&mo.ExcludeBuffers)continue;let o=l.findChild(0,l.buffer.length,e,i-h,n);if(o>-1)return new Co(new Po(r,l,t,h),null,o)}else if(s&mo.IncludeAnonymous||!l.type.isAnonymous||Xo(l)){let o;if(!(s&mo.IgnoreMounts)&&l.props&&(o=l.prop(ho.mounted))&&!o.overlay)return new ko(o.tree,h,t,r);let a=new ko(l,h,t,r);return s&mo.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(e<0?l.children.length-1:0,e,i,n)}}if(s&mo.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&mo.IgnoreOverlays)&&(n=this._tree.prop(ho.mounted))&&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 ko(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}cursor(t=0){return new _o(this,t)}get tree(){return this._tree}toTree(){return this._tree}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return So(this,t)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}toString(){return this._tree.toString()}get node(){return this}matchContext(t){return $o(this,t)}}function Qo(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 $o(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 Po{constructor(t,e,i,n){this.parent=t,this.buffer=e,this.index=i,this.start=n}}class Co{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){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 Co(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&mo.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 Co(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 Co(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 Co(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}cursor(t=0){return new _o(this,t)}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 bo(this.type,t,e,this.to-this.from)}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return So(this,t)}toString(){return this.context.buffer.childString(this.index)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}get node(){return this}matchContext(t){return $o(this,t)}}class _o{get name(){return this.type.name}constructor(t,e=0){if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof ko)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let e=t._parent;e;e=e._parent)this.stack.unshift(e.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return!!t&&(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0)}yieldBuf(t,e){this.index=t;let{start:i,buffer:n}=this.buffer;return this.type=e||n.set.types[n.buffer[t]],this.from=i+n.buffer[t+1],this.to=i+n.buffer[t+2],!0}yield(t){return!!t&&(t instanceof ko?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,i){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,i,this.mode));let{buffer:n}=this.buffer,s=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.buffer.start,i);return!(s<0)&&(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,i=this.mode){return this.buffer?!(i&mo.ExcludeBuffers)&&this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&mo.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&mo.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode));let{buffer:e}=this.buffer,i=this.stack.length-1;if(t<0){let t=i<0?0:this.stack[i]+4;if(this.index!=t)return this.yieldBuf(e.findChild(t,this.index,-1,0,4))}else{let t=e.buffer[this.index+3];if(t<(i<0?e.buffer.length:e.buffer[this.stack[i]+3]))return this.yieldBuf(t)}return i<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,i,{buffer:n}=this;if(n){if(t>0){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&mo.IncludeAnonymous||t instanceof vo||!t.type.isAnonymous||Xo(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 $o(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 Xo(t){return t.children.some((t=>t instanceof vo||!t.type.isAnonymous||Xo(t)))}const Zo=new WeakMap;function Ao(t,e){if(!t.isAnonymous||e instanceof vo||e.type!=t)return 1;let i=Zo.get(e);if(null==i){i=1;for(let n of e.children){if(n.type!=t||!(n instanceof bo)){i=1;break}i+=Ao(t,n)}Zo.set(e,i)}return i}function To(t,e,i,n,s,r,o,a,l){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]+a);continue}u.push(i[s])}else{let e=n[h-1]+i[h-1].length-f;u.push(To(t,i,n,s,h,f,e,null,l))}d.push(f+a-r)}}(e,i,n,s,0),(a||l)(u,d,o)}class Ro{constructor(){this.map=new WeakMap}setBuffer(t,e,i){let n=this.map.get(t);n||this.map.set(t,n=new Map),n.set(e,i)}getBuffer(t,e){let i=this.map.get(t);return i&&i.get(e)}set(t,e){t instanceof Co?this.setBuffer(t.context.buffer,t.index,e):t instanceof ko&&this.map.set(t.tree,e)}get(t){return t instanceof Co?this.getBuffer(t.context.buffer,t.index):t instanceof ko?this.map.get(t.tree):void 0}cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}}class Eo{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 Eo(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,a=0,l=0;;o++){let h=o=i)for(;r&&r.from=e.from||c<=e.to||l){let t=Math.max(e.from,a)-l,i=Math.min(e.to,c)-l;e=t>=i?null:new Eo(t,i,e.tree,e.offset+l,o>0,!!h)}if(e&&n.push(e),r.to>c)break;r=snew lo(t.from,t.to))):[new lo(0,0)]:[new lo(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 Mo{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)}}function Do(t){return(e,i,n,s)=>new qo(e,t,i,n,s)}class Wo{constructor(t,e,i,n,s){this.parser=t,this.parse=e,this.overlay=i,this.target=n,this.ranges=s}}class Uo{constructor(t,e,i,n,s,r,o){this.parser=t,this.predicate=e,this.mounts=i,this.index=n,this.start=s,this.target=r,this.prev=o,this.depth=0,this.ranges=[]}}const Yo=new ho({perNode:!0});class qo{constructor(t,e,i,n,s){this.nest=e,this.input=i,this.fragments=n,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=t}advance(){if(this.baseParse){let t=this.baseParse.advance();if(!t)return null;if(this.baseParse=null,this.baseTree=t,this.startInner(),null!=this.stoppedAt)for(let t of this.inner)t.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let t=this.baseTree;return null!=this.stoppedAt&&(t=new bo(t.type,t.children,t.positions,t.length,t.propValues.concat([[Yo,this.stoppedAt]]))),t}let t=this.inner[this.innerDone],e=t.parse.advance();if(e){this.innerDone++;let i=Object.assign(Object.create(null),t.target.props);i[ho.mounted.id]=new co(e,t.overlay,t.parser),t.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let t=this.input.length;for(let e=this.innerDone;et.frag.from<=n.from&&t.frag.to>=n.to&&t.mount.overlay));if(t)for(let i of t.mount.overlay){let s=i.from+t.pos,r=i.to+t.pos;s>=n.from&&r<=n.to&&!e.ranges.some((t=>t.froms))&&e.ranges.push({from:s,to:r})}}a=!1}else if(i&&(r=Lo(i.ranges,n.from,n.to)))a=2!=r;else if(!n.type.isAnonymous&&n.fromnew lo(t.from-n.from,t.to-n.from))):null,n.tree,t)),s.overlay?t.length&&(i={ranges:t,depth:0,prev:i}):a=!1}}else e&&(o=e.predicate(n))&&(!0===o&&(o=new lo(n.from,n.to)),o.fromnew lo(t.from-e.start,t.to-e.start))),e.target,t)),e=e.prev}i&&! --i.depth&&(i=i.prev)}}}}function Lo(t,e,i){for(let n of t){if(n.from>=i)break;if(n.to>e)return n.from<=e&&n.to>=i?2:1}return 0}function zo(t,e,i,n,s,r){if(e=e.to);n++);let o=s.children[n],a=o.buffer;s.children[n]=function t(i,n,s,l,h){let c=i;for(;a[c+2]+r<=e.from;)c=a[c+3];let u=[],d=[];zo(o,i,c,u,d,l);let f=a[c+1],p=a[c+2],O=f+r==e.from&&p+r==e.to&&a[c]==e.type.id;return u.push(O?e.toTree():t(c+4,a[c+3],o.set.types[a[c]],f,p-f)),d.push(f-l),zo(o,a[c+3],n,u,d,l),new bo(s,u,d,h)}(0,a.length,fo.none,0,o.length);for(let n=0;n<=i;n++)t.childAfter(e.from)}class Bo{constructor(t,e){this.offset=e,this.done=!1,this.cursor=t.cursor(mo.IncludeAnonymous|mo.IgnoreMounts)}moveTo(t){let{cursor:e}=this,i=t-this.offset;for(;!this.done&&e.from=t&&e.enter(i,1,mo.IgnoreOverlays|mo.ExcludeBuffers)||e.next(!1)||(this.done=!0)}hasNode(t){if(this.moveTo(t.from),!this.done&&this.cursor.from+this.offset==t.from&&this.cursor.tree)for(let e=this.cursor.tree;;){if(e==t.tree)return!0;if(!(e.children.length&&0==e.positions[0]&&e.children[0]instanceof bo))break;e=e.children[0]}return!1}}let jo=class{constructor(t){var e;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){let i=this.curFrag=t[0];this.curTo=null!==(e=i.tree.prop(Yo))&&void 0!==e?e:i.to,this.inner=new Bo(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t)}nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=null!==(t=e.tree.prop(Yo))&&void 0!==t?t:e.to,this.inner=new Bo(e.tree,-e.offset)}}findMounts(t,e){var i;let n=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let t=this.inner.cursor.node;t;t=t.parent){let s=null===(i=t.tree)||void 0===i?void 0:i.prop(ho.mounted);if(s&&s.parser==e)for(let e=this.fragI;e=t.to)break;i.tree==this.curFrag.tree&&n.push({frag:i,pos:t.from-i.offset,mount:s})}}}return n}};function No(t,e){let i=null,n=e;for(let s=1,r=0;s=a)break;t.to<=o||(i||(n=i=e.slice()),t.froma&&i.splice(r+1,0,new lo(a,t.to))):t.to>a?i[r--]=new lo(a,t.to):i.splice(r--,1))}}return n}function Go(t,e,i,n){let s=0,r=0,o=!1,a=!1,l=-1e9,h=[];for(;;){let c=s==t.length?1e9:o?t[s].to:t[s].from,u=r==e.length?1e9:a?e[r].to:e[r].from;if(o!=a){let t=Math.max(l,i),e=Math.min(c,u,n);tnew lo(t.from+n,t.to+n))),a,l);for(let e=0,n=a;;e++){let a=e==o.length,h=a?l:o[e].from;if(h>n&&i.push(new Eo(n,h,s.tree,-t,r.from>=n||r.openStart,r.to<=h||r.openEnd)),a)break;n=o[e].to}}else i.push(new Eo(a,l,s.tree,-t,r.from>=t||r.openStart,r.to<=o||r.openEnd))}return i}let Ho=0;class Jo{constructor(t,e,i){this.set=t,this.base=e,this.modified=i,this.id=Ho++}static define(t){if(null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let e=new Jo([],null,[]);if(e.set.push(e),t)for(let i of t.set)e.set.push(i);return e}static defineModifier(){let t=new ta;return e=>e.modified.indexOf(t)>-1?e:ta.get(e.base||e,e.modified.concat(t).sort(((t,e)=>t.id-e.id)))}}let Ko=0;class ta{constructor(){this.instances=[],this.id=Ko++}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 Jo(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(ta.get(e,t));return s}}function ea(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,a=i[o];if(!a)throw new RangeError("Invalid path: "+t);let l=new na(n,s,o>0?i.slice(0,o):null);e[a]=l.sort(e[a])}}return ia.add(e)}const ia=new ho;class na{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 ra(t,e,i,n=0,s=t.length){let r=new oa(n,Array.isArray(e)?e:[e],i);r.highlightRange(t.cursor(),n,s,"",r.highlighters),r.flush(s)}na.empty=new na([],2,null);class oa{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:a}=t;if(o>=i||a<=e)return;r.isTop&&(s=this.highlighters.filter((t=>!t.scope||t.scope(r))));let l=n,h=function(t){let e=t.type.prop(ia);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}(t)||na.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&&(l&&(l+=" "),l+=c,1==h.mode&&(n+=(n?" ":"")+c)),this.startSpan(t.from,l),h.opaque)return;let u=t.tree&&t.tree.prop(ho.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 d=0,f=o;;d++){let p=d=O)&&t.nextSibling()););if(!p||O>i)break;f=p.to+o,f>e&&(this.highlightRange(r.cursor(),Math.max(e,p.from+o),Math.min(i,f),n,h),this.startSpan(f,l))}c&&t.parent()}else if(t.firstChild()){do{if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,n,s),this.startSpan(Math.min(i,t.to),l)}}while(t.nextSibling());t.parent()}}}const aa=Jo.define,la=aa(),ha=aa(),ca=aa(ha),ua=aa(ha),da=aa(),fa=aa(da),pa=aa(da),Oa=aa(),ga=aa(Oa),ma=aa(),ba=aa(),wa=aa(),va=aa(wa),ya=aa(),Sa={comment:la,lineComment:aa(la),blockComment:aa(la),docComment:aa(la),name:ha,variableName:aa(ha),typeName:ca,tagName:aa(ca),propertyName:ua,attributeName:aa(ua),className:aa(ha),labelName:aa(ha),namespace:aa(ha),macroName:aa(ha),literal:da,string:fa,docString:aa(fa),character:aa(fa),attributeValue:aa(fa),number:pa,integer:aa(pa),float:aa(pa),bool:aa(da),regexp:aa(da),escape:aa(da),color:aa(da),url:aa(da),keyword:ma,self:aa(ma),null:aa(ma),atom:aa(ma),unit:aa(ma),modifier:aa(ma),operatorKeyword:aa(ma),controlKeyword:aa(ma),definitionKeyword:aa(ma),moduleKeyword:aa(ma),operator:ba,derefOperator:aa(ba),arithmeticOperator:aa(ba),logicOperator:aa(ba),bitwiseOperator:aa(ba),compareOperator:aa(ba),updateOperator:aa(ba),definitionOperator:aa(ba),typeOperator:aa(ba),controlOperator:aa(ba),punctuation:wa,separator:aa(wa),bracket:va,angleBracket:aa(va),squareBracket:aa(va),paren:aa(va),brace:aa(va),content:Oa,heading:ga,heading1:aa(ga),heading2:aa(ga),heading3:aa(ga),heading4:aa(ga),heading5:aa(ga),heading6:aa(ga),contentSeparator:aa(Oa),list:aa(Oa),quote:aa(Oa),emphasis:aa(Oa),strong:aa(Oa),link:aa(Oa),monospace:aa(Oa),strikethrough:aa(Oa),inserted:aa(),deleted:aa(),changed:aa(),invalid:aa(),meta:ya,documentMeta:aa(ya),annotation:aa(ya),processingInstruction:aa(ya),definition:Jo.defineModifier(),constant:Jo.defineModifier(),function:Jo.defineModifier(),standard:Jo.defineModifier(),local:Jo.defineModifier(),special:Jo.defineModifier()};var xa;sa([{tag:Sa.link,class:"tok-link"},{tag:Sa.heading,class:"tok-heading"},{tag:Sa.emphasis,class:"tok-emphasis"},{tag:Sa.strong,class:"tok-strong"},{tag:Sa.keyword,class:"tok-keyword"},{tag:Sa.atom,class:"tok-atom"},{tag:Sa.bool,class:"tok-bool"},{tag:Sa.url,class:"tok-url"},{tag:Sa.labelName,class:"tok-labelName"},{tag:Sa.inserted,class:"tok-inserted"},{tag:Sa.deleted,class:"tok-deleted"},{tag:Sa.literal,class:"tok-literal"},{tag:Sa.string,class:"tok-string"},{tag:Sa.number,class:"tok-number"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],class:"tok-string2"},{tag:Sa.variableName,class:"tok-variableName"},{tag:Sa.local(Sa.variableName),class:"tok-variableName tok-local"},{tag:Sa.definition(Sa.variableName),class:"tok-variableName tok-definition"},{tag:Sa.special(Sa.variableName),class:"tok-variableName2"},{tag:Sa.definition(Sa.propertyName),class:"tok-propertyName tok-definition"},{tag:Sa.typeName,class:"tok-typeName"},{tag:Sa.namespace,class:"tok-namespace"},{tag:Sa.className,class:"tok-className"},{tag:Sa.macroName,class:"tok-macroName"},{tag:Sa.propertyName,class:"tok-propertyName"},{tag:Sa.operator,class:"tok-operator"},{tag:Sa.comment,class:"tok-comment"},{tag:Sa.meta,class:"tok-meta"},{tag:Sa.invalid,class:"tok-invalid"},{tag:Sa.punctuation,class:"tok-punctuation"}]);const ka=new ho;function Qa(t){return E.define({combine:t?e=>e.concat(t):void 0})}const $a=new ho;class Pa{constructor(t,e,i=[],n=""){this.data=t,this.name=n,xt.prototype.hasOwnProperty("tree")||Object.defineProperty(xt.prototype,"tree",{get(){return Xa(this)}}),this.parser=e,this.extension=[Wa.of(this),xt.languageData.of(((t,e,i)=>{let n=Ca(t,e,i),s=n.type.prop(ka);if(!s)return[];let r=t.facet(s),o=n.type.prop($a);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 Ca(t,e,i).type.prop(ka)==this.data}findRegions(t){let e=t.facet(Wa);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(ka)==this.data)return void i.push({from:e,to:e+t.length});let s=t.prop(ho.mounted);if(s){if(s.tree.prop(ka)==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;it.isTop?e:void 0))]}),t.name)}configure(t,e){return new _a(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Xa(t){let e=t.field(Pa.state,!1);return e?e.tree:bo.empty}class Za{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let i=this.cursorPos-this.string.length;return t=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i)}}let Aa=null;class Ta{constructor(t,e,i=[],n,s,r,o,a){this.parser=t,this.state=e,this.fragments=i,this.tree=n,this.treeLen=s,this.viewport=r,this.skipped=o,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(t,e,i){return new Ta(t,e,[],bo.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Za(this.state.doc),this.fragments)}work(t,e){return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=bo.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(Eo.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Aa;Aa=this;try{return t()}finally{Aa=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=Ra(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=Eo.applyChanges(i,e),n=bo.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=Ra(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 Vo{createParse(e,i,n){let s=n[0].from,r=n[n.length-1].to;return{parsedPos:s,advance(){let e=Aa;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 bo(fo.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 Aa}}function Ra(t,e,i){return Eo.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class Ea{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 Ea(e)}static init(t){let e=Math.min(3e3,t.doc.length),i=Ta.create(t.facet(Wa).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new Ea(i)}}Pa.state=q.define({create:Ea.init,update(t,e){for(let t of e.effects)if(t.is(Pa.setState))return t.value;return e.startState.facet(Wa)!=e.state.facet(Wa)?Ea.init(e.state):t.apply(e)}});let Va=t=>{let e=setTimeout((()=>t()),500);return()=>clearTimeout(e)};"undefined"!=typeof requestIdleCallback&&(Va=t=>{let e=-1,i=setTimeout((()=>{e=requestIdleCallback(t,{timeout:400})}),100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const Ma="undefined"!=typeof navigator&&(null===(xa=navigator.scheduling)||void 0===xa?void 0:xa.isInputPending)?()=>navigator.scheduling.isInputPending():null,Da=_i.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(Pa.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),t.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(Pa.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=Va(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEndn+1e3,a=s.context.work((()=>Ma&&Ma()||Date.now()>r),n+(o?0:1e5));this.chunkBudget-=Date.now()-e,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Pa.setState.of(new Ea(s.context))})),this.chunkBudget>0&&(!a||o)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then((()=>this.scheduleWork())).catch((t=>Qi(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()}}}),Wa=E.define({combine:t=>t.length?t[0]:null,enables:t=>[Pa.state,Da,Ts.contentAttributes.compute([t],(e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}}))]});class Ua{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}class Ya{constructor(t,e,i,n,s,r=void 0){this.name=t,this.alias=e,this.extensions=i,this.filename=n,this.loadFunc=s,this.support=r,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then((t=>this.support=t),(t=>{throw this.loading=null,t})))}static of(t){let{load:e,support:i}=t;if(!e){if(!i)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");e=()=>Promise.resolve(i)}return new Ya(t.name,(t.alias||[]).concat(t.name).map((t=>t.toLowerCase())),t.extensions||[],t.filename,e,i)}static matchFilename(t,e){for(let i of t)if(i.filename&&i.filename.test(e))return i;let i=/\.([^.]+)$/.exec(e);if(i)for(let e of t)if(e.extensions.indexOf(i[1])>-1)return e;return null}static matchLanguageName(t,e,i=!0){e=e.toLowerCase();for(let i of t)if(i.alias.some((t=>t==e)))return i;if(i)for(let i of t)for(let t of i.alias){let n=e.indexOf(t);if(n>-1&&(t.length>2||!/\w/.test(e[n-1])&&!/\w/.test(e[n+t.length])))return i}return null}}const qa=E.define(),La=E.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 za(t){let e=t.facet(La);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function Ia(t,e){let i="",n=t.tabSize,s=t.facet(La)[0];if("\t"==s){for(;e>=n;)i+="\t",e-=n;s=" "}for(let t=0;t=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 Yt(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 Na=new ho;function Ga(t){let e=t.type.prop(Na);if(e)return e;let i,n=t.firstChild;if(n&&(i=n.type.prop(ho.closedBy))){let e=t.lastChild,n=e&&i.indexOf(e.name)>-1;return t=>el(t,!0,1,void 0,n&&!function(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}(t)?e.from:void 0)}return null==t.parent?Ha:null}function Fa(t,e,i){for(;t;t=t.parent){let n=Ga(t);if(n)return n(Ja.create(i,e,t))}return null}function Ha(){return 0}class Ja extends ja{constructor(t,e,i){super(t.state,t.options),this.base=t,this.pos=e,this.node=i}static create(t,e,i){return new Ja(t,e,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){let t=this.state.doc.lineAt(this.node.from);for(;;){let e=this.node.resolve(t.from);for(;e.parent&&e.parent.from==e.from;)e=e.parent;if(Ka(e,this.node))break;t=this.state.doc.lineAt(e.from)}return this.lineIndent(t.from)}continue(){let t=this.node.parent;return t?Fa(t,this.pos,this.base):0}}function Ka(t,e){for(let i=e;i;i=i.parent)if(t==i)return!0;return!1}function tl({closing:t,align:e=!0,units:i=1}){return n=>el(n,e,i,t)}function el(t,e,i,n,s){let r=t.textAfter,o=r.match(/^\s*/)[0].length,a=n&&r.slice(o,o+n.length)==n||s==t.pos+o,l=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.from{let n=t&&t.test(i.textAfter);return i.baseIndent+(n?0:e*i.unit)}}function nl(){return xt.transactionFilter.of((t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let i=t.newDoc,{head:n}=t.newSelection.main,s=i.lineAt(n);if(n>s.from+200)return t;let r=i.sliceString(s.from,n);if(!e.some((t=>t.test(r))))return t;let{state:o}=t,a=-1,l=[];for(let{head:t}of o.selection.ranges){let e=o.doc.lineAt(t);if(e.from==a)continue;a=e.from;let i=Ba(o,e.from);if(null==i)continue;let n=/^\s*/.exec(e.text)[0],s=Ia(o,i);n!=s&&l.push({from:e.from,to:e.from+n.length,insert:s})}return l.length?[t,{changes:l,sequential:!0}]:t}))}const sl=E.define(),rl=new ho;function ol(t){let e=t.firstChild,i=t.lastChild;return e&&e.toi)continue;if(s&&r.from=e&&n.to>i&&(s=n)}}return s}(t,e,i)}function hl(t,e){let i=e.mapPos(t.from,1),n=e.mapPos(t.to,-1);return i>=n?void 0:{from:i,to:n}}const cl=ut.define({map:hl}),ul=ut.define({map:hl}),dl=q.define({create:()=>ni.none,update(t,e){t=t.map(e.changes);for(let i of e.effects)i.is(cl)&&!pl(t,i.value.from,i.value.to)?t=t.update({add:[bl.range(i.value.from,i.value.to)]}):i.is(ul)&&(t=t.update({filter:(t,e)=>i.value.from!=t||i.value.to!=e,filterFrom:i.value.from,filterTo:i.value.to}));if(e.selection){let i=!1,{head:n}=e.selection.main;t.between(n,n,((t,e)=>{tn&&(i=!0)})),i&&(t=t.update({filterFrom:n,filterTo:n,filter:(t,e)=>e<=n||t>=n}))}return t},provide:t=>Ts.decorations.from(t),toJSON(t,e){let i=[];return t.between(0,e.doc.length,((t,e)=>{i.push(t,e)})),i},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let i=0;i{(!s||s.from>t)&&(s={from:t,to:e})})),s}function pl(t,e,i){let n=!1;return t.between(e,e,((t,s)=>{t==e&&s==i&&(n=!0)})),n}const Ol={placeholderDOM:null,placeholderText:"…"},gl=E.define({combine:t=>kt(t,Ol)});function ml(t){let e=[dl,yl];return t&&e.push(gl.of(t)),e}const bl=ni.replace({widget:new class extends ei{toDOM(t){let{state:e}=t,i=e.facet(gl),n=e=>{let i=t.lineBlockAt(t.posAtDOM(e.target)),n=fl(t.state,i.from,i.to);n&&t.dispatch({effects:ul.of(n)}),e.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(t,n);let s=document.createElement("span");return s.textContent=i.placeholderText,s.setAttribute("aria-label",e.phrase("folded code")),s.title=e.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=n,s}}}),wl={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class vl extends Yr{constructor(t,e){super(),this.config=t,this.open=e}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let e=document.createElement("span");return e.textContent=this.open?this.config.openText:this.config.closedText,e.title=t.state.phrase(this.open?"Fold line":"Unfold line"),e}}const yl=Ts.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Sl{constructor(t,e){let i;function n(t){let e=It.newName();return(i||(i=Object.create(null)))["."+e]=t,e}this.specs=t;const s="string"==typeof e.all?e.all:e.all?n(e.all):void 0,r=e.scope;this.scope=r instanceof Pa?t=>t.prop(ka)==r.data:r?t=>t==r:void 0,this.style=sa(t.map((t=>({tag:t.tag,class:t.class||n(Object.assign({},t,{tag:null}))}))),{all:s}).style,this.module=i?new It(i):null,this.themeType=e.themeType}static define(t,e){return new Sl(t,e||{})}}const xl=E.define(),kl=E.define({combine:t=>t.length?[t[0]]:null});function Ql(t){let e=t.facet(xl);return e.length?e:t.facet(kl)}function $l(t,e){let i,n=[Cl];return t instanceof Sl&&(t.module&&n.push(Ts.styleModule.of(t.module)),i=t.themeType),(null==e?void 0:e.fallback)?n.push(kl.of(t)):i?n.push(xl.computeN([Ts.darkTheme],(e=>e.facet(Ts.darkTheme)==("dark"==i)?[t]:[]))):n.push(xl.of(t)),n}class Pl{constructor(t){this.markCache=Object.create(null),this.tree=Xa(t.state),this.decorations=this.buildDeco(t,Ql(t.state))}update(t){let e=Xa(t.state),i=Ql(t.state),n=i!=Ql(t.startState);e.length{i.add(t,e,this.markCache[n]||(this.markCache[n]=ni.mark({class:n})))}),n,s);return i.finish()}}const Cl=N.high(_i.fromClass(Pl,{decorations:t=>t.decorations})),_l=Sl.define([{tag:Sa.meta,color:"#404740"},{tag:Sa.link,textDecoration:"underline"},{tag:Sa.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Sa.emphasis,fontStyle:"italic"},{tag:Sa.strong,fontWeight:"bold"},{tag:Sa.strikethrough,textDecoration:"line-through"},{tag:Sa.keyword,color:"#708"},{tag:[Sa.atom,Sa.bool,Sa.url,Sa.contentSeparator,Sa.labelName],color:"#219"},{tag:[Sa.literal,Sa.inserted],color:"#164"},{tag:[Sa.string,Sa.deleted],color:"#a11"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],color:"#e40"},{tag:Sa.definition(Sa.variableName),color:"#00f"},{tag:Sa.local(Sa.variableName),color:"#30a"},{tag:[Sa.typeName,Sa.namespace],color:"#085"},{tag:Sa.className,color:"#167"},{tag:[Sa.special(Sa.variableName),Sa.macroName],color:"#256"},{tag:Sa.definition(Sa.propertyName),color:"#00c"},{tag:Sa.comment,color:"#940"},{tag:Sa.invalid,color:"#f00"}]),Xl=Ts.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Zl=1e4,Al="()[]{}",Tl=E.define({combine:t=>kt(t,{afterCursor:!0,brackets:Al,maxScanDistance:Zl,renderMatch:Vl})}),Rl=ni.mark({class:"cm-matchingBracket"}),El=ni.mark({class:"cm-nonmatchingBracket"});function Vl(t){let e=[],i=t.matched?Rl:El;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 Ml=q.define({create:()=>ni.none,update(t,e){if(!e.docChanged&&!e.selection)return t;let i=[],n=e.state.facet(Tl);for(let t of e.state.selection.ranges){if(!t.empty)continue;let s=Ll(e.state,t.head,-1,n)||t.head>0&&Ll(e.state,t.head-1,1,n)||n.afterCursor&&(Ll(e.state,t.head,1,n)||t.headTs.decorations.from(t)}),Dl=[Ml,Xl];function Wl(t={}){return[Tl.of(t),Dl]}const Ul=new ho;function Yl(t,e,i){let n=t.prop(e<0?ho.openedBy:ho.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 ql(t){let e=t.type.prop(Ul);return e?e(t.node):t}function Ll(t,e,i,n={}){let s=n.maxScanDistance||Zl,r=n.brackets||Al,o=Xa(t),a=o.resolveInner(e,i);for(let n=a;n;n=n.parent){let s=Yl(n.type,i,r);if(s&&n.from0?e>=o.from&&eo.from&&e<=o.to))return zl(t,e,i,n,o,s,r)}}return function(t,e,i,n,s,r,o){let a=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%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 a=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(a+t,1).type!=s))if(e%2==0==i>0)u++;else{if(1==u)return{start:h,end:{from:a+t,to:a+t+1},matched:e>>1==l>>1};u--}}i>0&&(t+=r.length)}return c.done?{start:h,matched:!1}:null}(t,e,i,o,a.type,s,r)}function zl(t,e,i,n,s,r,o){let a=n.parent,l={from:s.from,to:s.to},h=0,c=null==a?void 0:a.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 jl(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 Nl=new WeakMap;class Gl extends Pa{constructor(t){let e,i=Qa(t.languageData),n={name:(s=t).name||"",token:s.token,blankLine:s.blankLine||(()=>{}),startState:s.startState||(()=>!0),copyState:s.copyState||jl,indent:s.indent||(()=>null),languageData:s.languageData||{},tokenTable:s.tokenTable||th};var s;super(i,new class extends Vo{createParse(t,i,n){return new Jl(e,t,i,n)}},[qa.of(((t,e)=>this.getIndent(t,e)))],t.name),this.topNode=function(t){let e=fo.define({id:eh.length,name:"Document",props:[ka.add((()=>t))]});return eh.push(e),e}(i),e=this,this.streamParser=n,this.stateAfter=new ho({perNode:!0}),this.tokenTable=t.tokenTable?new rh(n.tokenTable):oh}static define(t){return new Gl(t)}getIndent(t,e){let i,n=Xa(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=Nl.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],a=i+e.positions[r],l=o instanceof bo&&a=e.length)return e;s||e.type!=t.topNode||(s=!0);for(let r=e.children.length-1;r>=0;r--){let o,a=e.positions[r],l=e.children[r];if(ai&&Fl(t,n.tree,0-n.offset,i,r);if(o&&(e=Hl(t,n.tree,i+n.offset,o.pos+n.offset,!1)))return{state:o.state,tree:e}}return{state:t.streamParser.startState(n?za(n):4),tree:bo.empty}}(t,i,r,null==s?void 0:s.state);this.state=o,this.parsedPos=this.chunkStart=r+a.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 Bl(e,t?t.state.tabSize:4,t?za(t.state):2);if(r.eol())s.blankLine(this.state,r.indentUnit);else for(;!r.eol();){let t=Kl(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 th=Object.create(null),eh=[fo.none],ih=new po(eh),nh=[],sh=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"]])sh[t]=lh(th,e);class rh{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),sh)}resolve(t){return t?this.table[t]||(this.table[t]=lh(this.extra,t)):0}}const oh=new rh(th);function ah(t,e){nh.indexOf(t)>-1||(nh.push(t),console.warn(e))}function lh(t,e){let i=null;for(let n of e.split(".")){let e=t[n]||Sa[n];e?"function"==typeof e?i?i=e(i):ah(n,`Modifier ${n} used at start of tag`):i?ah(n,`Tag ${n} used as modifier`):i=e:ah(n,`Unknown highlighting tag ${n}`)}if(!i)return 0;let n=e.replace(/ /g,"_"),s=fo.define({id:eh.length,name:n,props:[ea({[n]:i})]});return eh.push(s),s.id}function hh(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 ch=hh(gh,0),uh=hh(Oh,0),dh=hh(((t,e)=>Oh(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 fh(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}const ph=50;function Oh(t,e,i=e.selection.ranges){let n=i.map((t=>fh(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,a=t.sliceDoc(n-ph,n),l=t.sliceDoc(s,s+ph),h=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(l)[0].length,u=a.length-h;if(a.slice(u-e.length,u)==e&&l.slice(c,c+i.length)==i)return{open:{pos:n-h,margin:h&&1},close:{pos:s+c,margin:c&&1}};s-n<=2*ph?r=o=t.sliceDoc(n,s):(r=t.sliceDoc(n,n+ph),o=t.sliceDoc(s-ph,s));let d=/^\s*/.exec(r)[0].length,f=/\s*$/.exec(o)[0].length,p=o.length-f-i.length;return r.slice(d,d+e.length)==e&&o.slice(p,p+i.length)==i?{open:{pos:n+d+e.length,margin:/\s/.test(r.charAt(d+e.length))?1:0},close:{pos:s-f-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>l.from)){s=l.from;let t=/^\s*/.exec(l.text)[0].length,e=t==l.length,i=l.text.slice(t,t+a.length)==a?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 mh=lt.define(),bh=lt.define(),wh=E.define(),vh=E.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)})});const yh=q.define({create:()=>Dh.empty,update(t,e){let i=e.state.facet(vh),n=e.annotation(mh);if(n){let s=e.docChanged?A.single(function(t){let e=0;return t.iterChangedRanges(((t,i)=>e=i)),e}(e.changes)):void 0,r=Ch.fromTransaction(e,s),o=n.side,a=0==o?t.undone:t.done;return a=r?_h(a,a.length,i.minDepth,r):Th(a,e.startState.selection),new Dh(0==o?n.rest:a,0==o?a:n.rest)}let s=e.annotation(bh);if("full"!=s&&"before"!=s||(t=t.isolate()),!1===e.annotation(dt.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);let r=Ch.fromTransaction(e),o=e.annotation(dt.time),a=e.annotation(dt.userEvent);return r?t=t.addChanges(r,o,a,i,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,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 Dh(t.done.map(Ch.fromJSON),t.undone.map(Ch.fromJSON))});function Sh(t={}){return[yh,vh.of(t),Ts.domEventHandlers({beforeinput(t,e){let i="historyUndo"==t.inputType?kh:"historyRedo"==t.inputType?Qh:null;return!!i&&(t.preventDefault(),i(e))}})]}function xh(t,e){return function({state:i,dispatch:n}){if(!e&&i.readOnly)return!1;let s=i.field(yh,!1);if(!s)return!1;let r=s.pop(t,i,e);return!!r&&(n(r),!0)}}const kh=xh(0,!1),Qh=xh(1,!1),$h=xh(0,!0),Ph=xh(1,!0);class Ch{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 Ch(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 Ch(t.changes&&k.fromJSON(t.changes),[],t.mapped&&x.fromJSON(t.mapped),t.startSelection&&A.fromJSON(t.startSelection),t.selectionsAfter.map(A.fromJSON))}static fromTransaction(t,e){let i=Zh;for(let e of t.startState.facet(wh)){let n=e(t);n.length&&(i=i.concat(n))}return!i.length&&t.changes.empty?null:new Ch(t.changes.invert(t.startState.doc),i,void 0,e||t.startState.selection,Zh)}static selection(t){return new Ch(void 0,Zh,void 0,void 0,t)}}function _h(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 Xh(t,e){return t.length?e.length?t.concat(e):t:e}const Zh=[],Ah=200;function Th(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-Ah));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),_h(t,t.length-1,1e9,i.setSelAfter(n)))}return[Ch.selection([e])]}function Rh(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 Eh(t,e){if(!t.length)return t;let i=t.length,n=Zh;for(;i;){let s=Vh(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?[Ch.selection(n)]:Zh}function Vh(t,e,i){let n=Xh(t.selectionsAfter.length?t.selectionsAfter.map((t=>t.map(e))):Zh,i);if(!t.changes)return Ch.selection(n);let s=t.changes.map(e),r=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(r):r;return new Ch(s,ut.mapEffects(t.effects,e),o,t.startSelection.map(r),n)}const Mh=/^(input\.type|delete)($|\.)/;class Dh{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 Dh(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||Mh.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)?_h(r,r.length-1,n.minDepth,new Ch(t.changes.compose(o.changes),Xh(t.effects,o.effects),o.mapped,o.startSelection,Zh)):_h(r,r.length,n.minDepth,t),new Dh(r,Zh,e,i)}addSelection(t,e,i,n){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Zh;return s.length>0&&e-this.prevTimet.empty!=o.ranges[e].empty)).length)?this:new Dh(Th(this.done,t),this.undone,e,i);var r,o}addMapping(t){return new Dh(Eh(this.done,t),Eh(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:mh.of({side:t,rest:Rh(n)}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let i=1==n.length?Zh:n.slice(0,n.length-1);return s.mapped&&(i=Eh(i,s.mapped)),e.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:mh.of({side:t,rest:i}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}}Dh.empty=new Dh(Zh,Zh);const Wh=[{key:"Mod-z",run:kh,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Qh,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Qh,preventDefault:!0},{key:"Mod-u",run:$h,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Ph,preventDefault:!0}];function Uh(t,e){return A.create(t.ranges.map(e),t.mainIndex)}function Yh(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function qh({state:t,dispatch:e},i){let n=Uh(t.selection,i);return!n.eq(t.selection)&&(e(Yh(t,n)),!0)}function Lh(t,e){return A.cursor(e?t.to:t.from)}function zh(t,e){return qh(t,(i=>i.empty?t.moveByChar(i,e):Lh(i,e)))}function Ih(t){return t.textDirectionAt(t.state.selection.main.head)==Wi.LTR}const Bh=t=>zh(t,!Ih(t)),jh=t=>zh(t,Ih(t));function Nh(t,e){return qh(t,(i=>i.empty?t.moveByGroup(i,e):Lh(i,e)))}function Gh(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 Fh(t,e,i){let n,s,r=Xa(t).resolveInner(e.head),o=i?ho.closedBy:ho.openedBy;for(let n=e.head;;){let e=i?r.childAfter(n):r.childBefore(n);if(!e)break;Gh(t,e,o)?r=e:n=i?e.to:e.from}return s=r.type.prop(o)&&(n=i?Ll(t,r.from,1):Ll(t,r.to,-1))&&n.matched?i?n.end.to:n.end.from:i?r.to:r.from,A.cursor(s,i?-1:1)}function Hh(t,e){return qh(t,(i=>{if(!i.empty)return Lh(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)}))}const Jh=t=>Hh(t,!1),Kh=t=>Hh(t,!0);function tc(t){let e,i=t.scrollDOM.clientHeighti.empty?t.moveVertically(i,e,n.height):Lh(i,e)));if(r.eq(s.selection))return!1;if(n.selfScroll){let e=t.coordsAtPos(s.selection.main.head),o=t.scrollDOM.getBoundingClientRect(),a=o.top+n.marginTop,l=o.bottom-n.marginBottom;e&&e.top>a&&e.bottomec(t,!1),nc=t=>ec(t,!0);function sc(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=A.cursor(n.from+i))}return s}function rc(t,e){let i=Uh(t.state.selection,(t=>{let i=e(t);return A.range(t.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)}));return!i.eq(t.state.selection)&&(t.dispatch(Yh(t.state,i)),!0)}function oc(t,e){return console.log("Select!"),rc(t,(i=>t.moveByCharSelected(i,e)))}const ac=t=>oc(t,!Ih(t)),lc=t=>oc(t,Ih(t));function hc(t,e){return rc(t,(i=>t.moveByGroup(i,e)))}function cc(t,e){return rc(t,(i=>t.moveVertically(i,e)))}const uc=t=>cc(t,!1),dc=t=>cc(t,!0);function fc(t,e){return rc(t,(i=>t.moveVertically(i,e,tc(t).height)))}const pc=t=>fc(t,!1),Oc=t=>fc(t,!0),gc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:0})),!0),mc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.doc.length})),!0),bc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:0})),!0),wc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0);function vc(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=yc(t,n,!0)),s=Math.min(s,n),r=Math.max(r,n)}else s=yc(t,s,!1),r=yc(t,r,!0);return s==r?{range:n}:{changes:{from:s,to:r},range:A.cursor(s)}}));return!s.changes.empty&&(t.dispatch(n.update(s,{scrollIntoView:!0,userEvent:i,effects:"delete.selection"==i?Ts.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function yc(t,e,i){if(t instanceof Ts)for(let n of t.state.facet(Ts.atomicRanges).map((e=>e(t))))n.between(e,e,((t,n)=>{te&&(e=i?n:t)}));return e}const Sc=(t,e)=>vc(t,(i=>{let n,s,{state:r}=t,o=r.doc.lineAt(i);if(!e&&i>o.from&&iSc(t,!1),kc=t=>Sc(t,!0),Qc=(t,e)=>vc(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 a=f(r.text,n-r.from,e)+r.from,l=r.text.slice(Math.min(n,a)-r.from,Math.max(n,a)-r.from),h=o(l);if(null!=t&&h!=t)break;" "==l&&n==i||(t=h),n=a}return n})),$c=t=>Qc(t,!1),Pc=t=>vc(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 _c(t,e,i){if(t.readOnly)return!1;let n=[],s=[];for(let e of Cc(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(A.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(A.range(t.anchor-o,t.head-o))}}return!!n.length&&(e(t.update({changes:n,scrollIntoView:!0,selection:A.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0)}function Xc(t,e,i){if(t.readOnly)return!1;let n=[];for(let e of Cc(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 Zc=Ac(!1);function Ac(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),a=!e&&s==r&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i,n=Xa(t).resolveInner(e),s=n.childBefore(e),r=n.childAfter(e);return s&&r&&s.to<=e&&r.from>=e&&(i=s.type.prop(ho.closedBy))&&i.indexOf(r.name)>-1&&t.doc.lineAt(s.to).from==t.doc.lineAt(r.from).from?{from:s.to,to:r.from}:null}(i,s);e&&(s=r=(r<=o.to?o:i.doc.lineAt(r)).to);let l=new ja(i,{simulateBreak:s,simulateDoubleBreak:!!a}),h=Ba(l,s);for(null==h&&(h=/^\s*/.exec(i.doc.lineAt(s).text)[0].length);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:A.range(r.mapPos(n.anchor,1),r.mapPos(n.head,1))}}))}const Rc=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{i.push({from:e.from,insert:t.facet(La)})})),{userEvent:"input.indent"})),!0),Ec=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{let n=/^\s*/.exec(e.text)[0];if(!n)return;let s=Yt(n,t.tabSize),r=0,o=Ia(t,Math.max(0,s-za(t)));for(;rqh(t,(e=>Fh(t.state,e,!Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,!Ih(t))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:t=>qh(t,(e=>Fh(t.state,e,Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,Ih(t))))},{key:"Alt-ArrowUp",run:({state:t,dispatch:e})=>_c(t,e,!1)},{key:"Shift-Alt-ArrowUp",run:({state:t,dispatch:e})=>Xc(t,e,!1)},{key:"Alt-ArrowDown",run:({state:t,dispatch:e})=>_c(t,e,!0)},{key:"Shift-Alt-ArrowDown",run:({state:t,dispatch:e})=>Xc(t,e,!0)},{key:"Escape",run:({state:t,dispatch:e})=>{let i=t.selection,n=null;return i.ranges.length>1?n=A.create([i.main]):i.main.empty||(n=A.create([A.cursor(i.main.head)])),!!n&&(e(Yh(t,n)),!0)}},{key:"Mod-Enter",run:Ac(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:t,dispatch:e})=>{let i=Cc(t).map((({from:e,to:i})=>A.range(e,Math.min(i+1,t.doc.length))));return e(t.update({selection:A.create(i),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:t,dispatch:e})=>{let i=Uh(t.selection,(e=>{var i;let n=Xa(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 A.range(n.to,n.from)}));return e(Yh(t,i)),!0},preventDefault:!0},{key:"Mod-[",run:Ec},{key:"Mod-]",run:Rc},{key:"Mod-Alt-\\",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new ja(t,{overrideIndentation:t=>{let e=i[t];return null==e?-1:e}}),s=Tc(t,((e,s,r)=>{let o=Ba(n,e.from);if(null==o)return;/\S/.test(e.text)||(o=0);let a=/^\s*/.exec(e.text)[0],l=Ia(t,o);(a!=l||r.from{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(Cc(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=Uh(t.selection,(e=>{let s=Ll(t,e.head,-1)||Ll(t,e.head,1)||e.head>0&&Ll(t,e.head-1,1)||e.head{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=fh(t.state,i.from);return n.line?ch(t):!!n.block&&dh(t)}},{key:"Alt-A",run:uh}].concat([{key:"ArrowLeft",run:Bh,shift:ac,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:t=>Nh(t,!Ih(t)),shift:t=>hc(t,!Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:t=>qh(t,(e=>sc(t,e,!Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,!Ih(t)))),preventDefault:!0},{key:"ArrowRight",run:jh,shift:lc,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:t=>Nh(t,Ih(t)),shift:t=>hc(t,Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:t=>qh(t,(e=>sc(t,e,Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,Ih(t)))),preventDefault:!0},{key:"ArrowUp",run:Jh,shift:uc,preventDefault:!0},{mac:"Cmd-ArrowUp",run:gc,shift:bc},{mac:"Ctrl-ArrowUp",run:ic,shift:pc},{key:"ArrowDown",run:Kh,shift:dc,preventDefault:!0},{mac:"Cmd-ArrowDown",run:mc,shift:wc},{mac:"Ctrl-ArrowDown",run:nc,shift:Oc},{key:"PageUp",run:ic,shift:pc},{key:"PageDown",run:nc,shift:Oc},{key:"Home",run:t=>qh(t,(e=>sc(t,e,!1))),shift:t=>rc(t,(e=>sc(t,e,!1))),preventDefault:!0},{key:"Mod-Home",run:gc,shift:bc},{key:"End",run:t=>qh(t,(e=>sc(t,e,!0))),shift:t=>rc(t,(e=>sc(t,e,!0))),preventDefault:!0},{key:"Mod-End",run:mc,shift:wc},{key:"Enter",run:Zc},{key:"Mod-a",run:({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:xc,shift:xc},{key:"Delete",run:kc},{key:"Mod-Backspace",mac:"Alt-Backspace",run:$c},{key:"Mod-Delete",mac:"Alt-Delete",run:t=>Qc(t,!0)},{mac:"Mod-Backspace",run:t=>vc(t,(e=>{let i=t.lineBlockAt(e).from;return e>i?i:Math.max(0,e-1)}))},{mac:"Mod-Delete",run:Pc}].concat([{key:"Ctrl-b",run:Bh,shift:ac,preventDefault:!0},{key:"Ctrl-f",run:jh,shift:lc},{key:"Ctrl-p",run:Jh,shift:uc},{key:"Ctrl-n",run:Kh,shift:dc},{key:"Ctrl-a",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).from,1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).from)))},{key:"Ctrl-e",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).to,-1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).to)))},{key:"Ctrl-d",run:kc},{key:"Ctrl-h",run:xc},{key:"Ctrl-k",run:Pc},{key:"Ctrl-Alt-h",run:$c},{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:A.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:f(n.text,i-n.from,!1)+n.from,r=i==n.to?i+1:f(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:A.cursor(r)}}));return!i.changes.empty&&(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:nc}].map((t=>({mac:t.key,run:t.run,shift:t.shift})))));function Mc(){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 Uc{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(Wc(t)):Wc,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 b(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=w(t),i=this.bufferStart+this.bufferPos;this.bufferPos+=v(t);let n=this.normalize(e);for(let t=0,s=i;;t++){let r=n.charCodeAt(t),o=this.match(r,s);if(o)return this.value=o,this;if(t==n.length-1)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=jc(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 Ic(e,t.sliceString(e,i));return zc.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=jc(this.text,i+(t==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ic.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function jc(t,e){if(e>=t.length)return e;let i,n=t.lineAt(e);for(;e=56320&&i<57344;)e++;return e}function Nc(t){let e=Mc("input",{class:"cm-textfield",name:"line"});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,a,l]=i,h=a?+a.slice(1):0,c=o?+o:s.number;if(o&&l){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)));t.dispatch({effects:Gc.of(!1),selection:A.cursor(u.from+Math.max(0,Math.min(h,u.length))),scrollIntoView:!0}),t.focus()}return{dom:Mc("form",{class:"cm-gotoLine",onkeydown:e=>{27==e.keyCode?(e.preventDefault(),t.dispatch({effects:Gc.of(!1)}),t.focus()):13==e.keyCode&&(e.preventDefault(),i())},onsubmit:t=>{t.preventDefault(),i()}},Mc("label",t.state.phrase("Go to line"),": ",e)," ",Mc("button",{class:"cm-button",type:"submit"},t.state.phrase("go")))}}"undefined"!=typeof Symbol&&(Lc.prototype[Symbol.iterator]=Bc.prototype[Symbol.iterator]=function(){return this});const Gc=ut.define(),Fc=q.define({create:()=>!0,update(t,e){for(let i of e.effects)i.is(Gc)&&(t=i.value);return t},provide:t=>Ur.from(t,(t=>t?Nc:null))}),Hc=Ts.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),Jc={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Kc=E.define({combine:t=>kt(t,Jc,{highlightWordAroundCursor:(t,e)=>t||e,minSelectionLength:Math.min,maxMatches:Math.min})});function tu(t){let e=[ru,su];return t&&e.push(Kc.of(t)),e}const eu=ni.mark({class:"cm-selectionMatch"}),iu=ni.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function nu(t,e,i,n){return!(0!=i&&t(e.sliceDoc(i-1,i))==wt.Word||n!=e.doc.length&&t(e.sliceDoc(n,n+1))==wt.Word)}const su=_i.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(Kc),{state:i}=t,n=i.selection;if(n.ranges.length>1)return ni.none;let s,r=n.main,o=null;if(r.empty){if(!e.highlightWordAroundCursor)return ni.none;let t=i.wordAt(r.head);if(!t)return ni.none;o=i.charCategorizer(r.head),s=i.sliceDoc(t.from,t.to)}else{let t=r.to-r.from;if(t200)return ni.none;if(e.wholeWords){if(s=i.sliceDoc(r.from,r.to),o=i.charCategorizer(r.head),!nu(o,i,r.from,r.to)||!function(t,e,i,n){return t(e.sliceDoc(i,i+1))==wt.Word&&t(e.sliceDoc(n-1,n))==wt.Word}(o,i,r.from,r.to))return ni.none}else if(s=i.sliceDoc(r.from,r.to).trim(),!s)return ni.none}let a=[];for(let n of t.visibleRanges){let t=new Uc(i.doc,s,n.from,n.to);for(;!t.next().done;){let{from:n,to:s}=t.value;if((!o||nu(o,i,n,s))&&(r.empty&&n<=r.from&&s>=r.to?a.push(iu.range(n,s)):(n>=r.to||s<=r.from)&&a.push(eu.range(n,s)),a.length>e.maxMatches))return ni.none}}return ni.set(a)}},{decorations:t=>t.decorations}),ru=Ts.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});const ou=E.define({combine:t=>kt(t,{top:!1,caseSensitive:!1,literal:!1,wholeWord:!1,createPanel:t=>new Eu(t),scrollToMatch:t=>Ts.scrollIntoView(t)})});class au{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,qc),!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 pu(this):new cu(this)}getCursor(t,e=0,i){let n=t.doc?t:xt.create({doc:t});return null==i&&(i=n.doc.length),this.regexp?uu(this,n,e,i):hu(this,n,e,i)}}class lu{constructor(t){this.spec=t}}function hu(t,e,i,n){return new Uc(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=hu(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 uu(t,e,i,n){return new Lc(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?(s=e.charCategorizer(e.selection.main.head),(t,e,i)=>!i[0].length||(s(du(i.input,i.index))!=wt.Word||s(fu(i.input,i.index))!=wt.Word)&&(s(fu(i.input,i.index+i[0].length))!=wt.Word||s(du(i.input,i.index+i[0].length))!=wt.Word)):void 0},i,n);var s}function du(t,e){return t.slice(f(t,e,!1),e)}function fu(t,e){return t.slice(e,f(t,e))}class pu extends lu{nextMatch(t,e,i){let n=uu(this.spec,t,i,t.doc.length).next();return n.done&&(n=uu(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=uu(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=uu(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 Ou=ut.define(),gu=ut.define(),mu=q.define({create:t=>new bu(_u(t).create(),null),update(t,e){for(let i of e.effects)i.is(Ou)?t=new bu(i.value.create(),t.panel):i.is(gu)&&(t=new bu(t.query,i.value?Cu:null));return t},provide:t=>Ur.from(t,(t=>t.panel))});class bu{constructor(t,e){this.query=t,this.panel=e}}const wu=ni.mark({class:"cm-searchMatch"}),vu=ni.mark({class:"cm-searchMatch cm-searchMatch-selected"}),yu=_i.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(mu))}update(t){let e=t.state.field(mu);(e!=t.startState.field(mu)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ni.none;let{view:i}=this,n=new Xt;for(let e=0,s=i.visibleRanges,r=s.length;es[e+1].from-500;)a=s[++e].to;t.highlight(i.state,o,a,((t,e)=>{let s=i.state.selection.ranges.some((i=>i.from==t&&i.to==e));n.add(t,e,s?vu:wu)}))}return n.finish()}},{decorations:t=>t.decorations});function Su(t){return e=>{let i=e.state.field(mu,!1);return i&&i.query.spec.valid?t(e,i):Au(e)}}const xu=Su(((t,{query:e})=>{let{to:i}=t.state.selection.main,n=e.nextMatch(t.state,i,i);if(!n)return!1;let s=A.single(n.from,n.to),r=t.state.facet(ou);return t.dispatch({selection:s,effects:[Wu(t,n),r.scrollToMatch(s.main,t)],userEvent:"select.search"}),Zu(t),!0})),ku=Su(((t,{query:e})=>{let{state:i}=t,{from:n}=i.selection.main,s=e.prevMatch(i,n,n);if(!s)return!1;let r=A.single(s.from,s.to),o=t.state.facet(ou);return t.dispatch({selection:r,effects:[Wu(t,s),o.scrollToMatch(r.main,t)],userEvent:"select.search"}),Zu(t),!0})),Qu=Su(((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!(!i||!i.length)&&(t.dispatch({selection:A.create(i.map((t=>A.range(t.from,t.to)))),userEvent:"select.search.matches"}),!0)})),$u=Su(((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,a,l=[],h=[];if(r.from==n&&r.to==s&&(a=i.toText(e.getReplacement(r)),l.push({from:r.from,to:r.to,insert:a}),r=e.nextMatch(i,r.from,r.to),h.push(Ts.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(n).number)+"."))),r){let e=0==l.length||l[0].from>=r.to?0:r.to-r.from-a.length;o=A.single(r.from-e,r.to-e),h.push(Wu(t,r)),h.push(i.facet(ou).scrollToMatch(o.main,t))}return t.dispatch({changes:l,selection:o,effects:h,userEvent:"input.replace"}),!0})),Pu=Su(((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:Ts.announce.of(n),userEvent:"input.replace.all"}),!0}));function Cu(t){return t.state.facet(ou).createPanel(t)}function _u(t,e){var i,n,s,r;let o=t.selection.main,a=o.empty||o.to>o.from+100?"":t.sliceDoc(o.from,o.to);if(e&&!a)return e;let l=t.facet(ou);return new au({search:(null!==(i=null==e?void 0:e.literal)&&void 0!==i?i:l.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:null!==(n=null==e?void 0:e.caseSensitive)&&void 0!==n?n:l.caseSensitive,literal:null!==(s=null==e?void 0:e.literal)&&void 0!==s?s:l.literal,wholeWord:null!==(r=null==e?void 0:e.wholeWord)&&void 0!==r?r:l.wholeWord})}function Xu(t){let e=Vr(t,Cu);return e&&e.dom.querySelector("[main-field]")}function Zu(t){let e=Xu(t);e&&e==t.root.activeElement&&e.select()}const Au=t=>{let e=t.state.field(mu,!1);if(e&&e.panel){let i=Xu(t);if(i&&i!=t.root.activeElement){let n=_u(t.state,e.query.spec);n.valid&&t.dispatch({effects:Ou.of(n)}),i.focus(),i.select()}}else t.dispatch({effects:[gu.of(!0),e?Ou.of(_u(t.state,e.query.spec)):ut.appendConfig.of(Yu)]});return!0},Tu=t=>{let e=t.state.field(mu,!1);if(!e||!e.panel)return!1;let i=Vr(t,Cu);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:gu.of(!1)}),!0},Ru=[{key:"Mod-f",run:Au,scope:"editor search-panel"},{key:"F3",run:xu,shift:ku,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:xu,shift:ku,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Tu,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 Uc(t.doc,t.sliceDoc(n,s));!e.next().done;){if(r.length>1e3)return!1;e.value.from==n&&(o=r.length),r.push(A.range(e.value.from,e.value.to))}return e(t.update({selection:A.create(r,o),userEvent:"select.search.matches"})),!0}},{key:"Alt-g",run:t=>{let e=Vr(t,Nc);if(!e){let i=[Gc.of(!0)];null==t.state.field(Fc,!1)&&i.push(ut.appendConfig.of([Fc,Hc])),t.dispatch({effects:i}),e=Vr(t,Nc)}return e&&e.dom.querySelector("input").focus(),!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=A.create(i.ranges.map((e=>t.wordAt(e.head)||A.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 Uc(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 Uc(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(A.range(s.from,s.to),!1),effects:Ts.scrollIntoView(s.to)})),!0)},preventDefault:!0}];class Eu{constructor(t){this.view=t;let e=this.query=t.state.field(mu).query.spec;function i(t,e,i){return Mc("button",{class:"cm-button",name:t,onclick:e,type:"button"},i)}this.commit=this.commit.bind(this),this.searchField=Mc("input",{value:e.search,placeholder:Vu(t,"Find"),"aria-label":Vu(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Mc("input",{value:e.replace,placeholder:Vu(t,"Replace"),"aria-label":Vu(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Mc("input",{type:"checkbox",name:"case",form:"",checked:e.caseSensitive,onchange:this.commit}),this.reField=Mc("input",{type:"checkbox",name:"re",form:"",checked:e.regexp,onchange:this.commit}),this.wordField=Mc("input",{type:"checkbox",name:"word",form:"",checked:e.wholeWord,onchange:this.commit}),this.dom=Mc("div",{onkeydown:t=>this.keydown(t),class:"cm-search"},[this.searchField,i("next",(()=>xu(t)),[Vu(t,"next")]),i("prev",(()=>ku(t)),[Vu(t,"previous")]),i("select",(()=>Qu(t)),[Vu(t,"all")]),...t.state.readOnly?[]:[Mc("br"),this.replaceField,i("replace",(()=>$u(t)),[Vu(t,"replace")]),i("replaceAll",(()=>Pu(t)),[Vu(t,"replace all")])],Mc("button",{name:"close",onclick:()=>Tu(t),"aria-label":Vu(t,"close"),type:"button"},["×"])])}commit(){let t=new au({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:Ou.of(t)}))}keydown(t){var e,i,n;e=this.view,i=t,n="search-panel",Bs(Ls(e.state),i,e,n)?t.preventDefault():13==t.keyCode&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?ku:xu)(this.view)):13==t.keyCode&&t.target==this.replaceField&&(t.preventDefault(),$u(this.view))}update(t){for(let e of t.transactions)for(let t of e.effects)t.is(Ou)&&!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(ou).top}}function Vu(t,e){return t.state.phrase(e)}const Mu=30,Du=/[\s\.,:;?!]/;function Wu(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-Mu),o=Math.min(s,i+Mu),a=t.state.sliceDoc(r,o);if(r!=n.from)for(let t=0;ta.length-Mu;t--)if(!Du.test(a[t-1])&&Du.test(a[t])){a=a.slice(0,t);break}return Ts.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${n.number}.`)}const Uu=Ts.baseTheme({".cm-panel.cm-search":{padding:"0.25rem 0.5rem 0.25rem 0.5rem",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"0.5rem",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"}}),Yu=[mu,N.lowest(yu),Uu];class qu{constructor(t,e,i){this.state=t,this.pos=e,this.explicit=i,this.abortListeners=[]}tokenBefore(t){let e=Xa(this.state).resolveInner(this.pos,-1);for(;e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null}matchBefore(t){let e=this.state.doc.lineAt(this.pos),i=Math.max(e.from,this.pos-250),n=e.text.slice(i-e.from,this.pos-e.from),s=n.search(ju(t,!1));return s<0?null:{from:i+s,to:this.pos,text:n.slice(s)}}get aborted(){return null==this.abortListeners}addEventListener(t,e){"abort"==t&&this.abortListeners&&this.abortListeners.push(e)}}function Lu(t){let e=Object.keys(t).join(""),i=/\w/.test(e);return i&&(e=e.replace(/\w/g,"")),`[${i?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function zu(t){let e=t.map((t=>"string"==typeof t?{label:t}:t)),[i,n]=e.every((t=>/^\w+$/.test(t.label)))?[/\w*$/,/\w+$/]:function(t){let e=Object.create(null),i=Object.create(null);for(let{label:n}of t){e[n[0]]=!0;for(let t=1;t{let s=t.matchBefore(n);return s||t.explicit?{from:s?s.from:t.pos,options:e,validFor:i}:null}}class Iu{constructor(t,e,i,n){this.completion=t,this.source=e,this.match=i,this.score=n}}function Bu(t){return t.selection.main.from}function ju(t,e){var i;let{source:n}=t,s=e&&"^"!=n[0],r="$"!=n[n.length-1];return s||r?new RegExp(`${s?"^":""}(?:${n})${r?"$":""}`,null!==(i=t.flags)&&void 0!==i?i:t.ignoreCase?"i":""):t}const Nu=lt.define();const Gu=new WeakMap;function Fu(t){if(!Array.isArray(t))return t;let e=Gu.get(t);return e||Gu.set(t,e=zu(t)),e}const Hu=ut.define(),Ju=ut.define();class Ku{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[];for(let e=0;e=48&&l<=57||l>=97&&l<=122?2:l>=65&&l<=90?1:0:(y=w(l))!=y.toLowerCase()?1:y!=y.toUpperCase()?2:0;(!n||1==S&&O||0==m&&0!=S)&&(e[c]==l||i[c]==l&&(u=!0)?r[c++]=n:r.length&&(g=!1)),m=S,n+=v(l)}return c==a&&0==r[0]&&g?this.result((u?-200:0)-100,r,t):d==a&&0==f?[-200-t.length+(p==t.length?0:-100),0,p]:o>-1?[-700-t.length,o,o+this.pattern.length]:d==a?[-900-t.length,f,p]:c==a?this.result((u?-200:0)-100-700+(g?0:-1100),r,t):2==e.length?null:this.result((n[0]?-700:0)-200-1100,n,t)}result(t,e,i){let n=[t-i.length],s=1;for(let t of e){let e=t+(this.astral?v(b(i,t)):1);s>1&&n[s-1]==t?n[s-1]=e:(n[s++]=t,n[s++]=e)}return n}}const td=E.define({combine:t=>kt(t,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:id,compareCompletions:(t,e)=>t.label.localeCompare(e.label),interactionDelay:75},{defaultKeymap:(t,e)=>t&&e,closeOnBlur:(t,e)=>t&&e,icons:(t,e)=>t&&e,tooltipClass:(t,e)=>i=>ed(t(i),e(i)),optionClass:(t,e)=>i=>ed(t(i),e(i)),addToOptions:(t,e)=>t.concat(e)})});function ed(t,e){return t?e?t+" "+e:t:e}function id(t,e,i,n,s){let r,o,a=t.textDirection==Wi.RTL,l=a,h=!1,c="top",u=e.left-s.left,d=s.right-e.right,f=n.right-n.left,p=n.bottom-n.top;if(l&&u=p||t>e.top?r=i.bottom-e.top:(c="bottom",r=e.bottom-i.top)}return{style:`${c}: ${r}px; max-width: ${o}px`,class:"cm-completionInfo-"+(h?a?"left-narrow":"right-narrow":l?"left":"right")}}function nd(t,e="option"){return i=>{let n=i.state.field(yd,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp-1?n.open.selected+r*(t?1:-1):t?0:o-1;return a<0?a="page"==e?0:o-1:a>=o&&(a="page"==e?o-1:0),i.dispatch({effects:vd.of(a)}),!0}}const sd=t=>{let e=t.state.field(yd,!1);return!(t.state.readOnly||!e||!e.open||e.open.selected<0||Date.now()-e.open.timestamp(t.selection||t.docChanged)&&!gd(t)));for(let e=0;e50&&Date.now()-n.time>1e3){for(let t of n.context.abortListeners)try{t()}catch(t){Qi(this.view.state,t)}n.context.abortListeners=null,this.running.splice(e--,1)}else n.updates.push(...t.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some((t=>1==t.state&&!this.running.some((e=>e.active.source==t.source))))?setTimeout((()=>this.startUpdate()),50):-1,0!=this.composing)for(let e of t.transactions)"input"==gd(e)?this.composing=2:2==this.composing&&e.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:t}=this.view,e=t.field(yd);for(let t of e.active)1!=t.state||this.running.some((e=>e.active.source==t.source))||this.startQuery(t)}startQuery(t){let{state:e}=this.view,i=Bu(e),n=new qu(e,i,t.explicitPos==i),s=new rd(t,n);this.running.push(s),Promise.resolve(t.source(n)).then((t=>{s.context.aborted||(s.done=t||null,this.scheduleAccept())}),(t=>{this.view.dispatch({effects:Ju.of(null)}),Qi(this.view.state,t)}))}scheduleAccept(){this.running.every((t=>void 0!==t.done))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((()=>this.accept()),50))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],i=this.view.state.facet(td);for(let n=0;nt.source==s.active.source));if(r&&1==r.state)if(null==s.done){let t=new md(s.active.source,0);for(let e of s.updates)t=t.update(e,i);1!=t.state&&e.push(t)}else this.startQuery(r)}e.length&&this.view.dispatch({effects:wd.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(yd,!1);if(e&&e.tooltip&&this.view.state.facet(td).closeOnBlur){let i=e.open&&Rr(this.view,e.open.tooltip);i&&i.dom.contains(t.relatedTarget)||this.view.dispatch({effects:Ju.of(null)})}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout((()=>this.view.dispatch({effects:Hu.of(!1)})),20),this.composing=0}}});function ad(t,e){const i=e.completion.apply||e.completion.label;let n=t.state.field(yd).active.find((t=>t.source==e.source));return n instanceof bd&&("string"==typeof i?t.dispatch(Object.assign(Object.assign({},function(t,e,i,n){let{main:s}=t.selection,r=i-s.from,o=n-s.from;return Object.assign(Object.assign({},t.changeByRange((a=>a!=s&&i!=n&&t.sliceDoc(a.from+r,a.from+o)!=t.sliceDoc(i,n)?{range:a}:{changes:{from:a.from+r,to:n==s.from?a.to:a.from+o,insert:e},range:A.cursor(a.from+r+e.length)}))),{userEvent:"input.complete"})}(t.state,i,n.from,n.to)),{annotations:Nu.of(e.completion)})):i(t,e.completion,n.from,n.to),!0)}function ld(t,e,i){if(t<=i)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let t=Math.floor(e/i);return{from:t*i,to:(t+1)*i}}let n=Math.floor((t-e)/i);return{from:t-(n+1)*i,to:t-n*i}}class hd{constructor(t,e){this.view=t,this.stateField=e,this.info=null,this.placeInfoReq={read:()=>this.measureInfo(),write:t=>this.placeInfo(t),key:this},this.space=null,this.currentClass="";let i=t.state.field(e),{options:n,selected:s}=i.open,r=t.state.facet(td);this.optionContent=function(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(t){let e=document.createElement("div");return e.classList.add("cm-completionIcon"),t.type&&e.classList.add(...t.type.split(/\s+/g).map((t=>"cm-completionIcon-"+t))),e.setAttribute("aria-hidden","true"),e},position:20}),e.push({render(t,e,i){let n=document.createElement("span");n.className="cm-completionLabel";let{label:s}=t,r=0;for(let t=1;tr&&n.appendChild(document.createTextNode(s.slice(r,e)));let a=n.appendChild(document.createElement("span"));a.appendChild(document.createTextNode(s.slice(e,o))),a.className="cm-completionMatchedText",r=o}return rt.position-e.position)).map((t=>t.render))}(r),this.optionClass=r.optionClass,this.tooltipClass=r.tooltipClass,this.range=ld(n.length,s,r.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",(e=>{for(let i,s=e.target;s&&s!=this.dom;s=s.parentNode)if("LI"==s.nodeName&&(i=/-(\d+)$/.exec(s.id))&&+i[1]{let i=t.state.field(this.stateField,!1);i&&i.tooltip&&t.state.facet(td).closeOnBlur&&e.relatedTarget!=t.contentDOM&&t.dispatch({effects:Ju.of(null)})})),this.list=this.dom.appendChild(this.createListBox(n,i.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))}mount(){this.updateSel()}update(t){var e,i,n;let s=t.state.field(this.stateField),r=t.startState.field(this.stateField);this.updateTooltipClass(t.state),s!=r&&(this.updateSel(),(null===(e=s.open)||void 0===e?void 0:e.disabled)!=(null===(i=r.open)||void 0===i?void 0:i.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!(null===(n=s.open)||void 0===n?void 0:n.disabled)))}updateTooltipClass(t){let e=this.tooltipClass(t);if(e!=this.currentClass){for(let t of this.currentClass.split(" "))t&&this.dom.classList.remove(t);for(let t of e.split(" "))t&&this.dom.classList.add(t);this.currentClass=e}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),e=t.open;if((e.selected>-1&&e.selected=this.range.to)&&(this.range=ld(e.options.length,e.selected,this.view.state.facet(td).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e.options,t.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))),this.updateSelectedOption(e.selected)){this.info&&(this.info.remove(),this.info=null);let{completion:i}=e.options[e.selected],{info:n,label:s,c:r}=i;if(!n)return;let o="string"==typeof n?document.createTextNode(n+" "):n(i);if(!o)return;if(!r){const t=document.createElement("span");t.appendChild(o),o=t;const e=document.createElement("a");e.innerText="🔎",e.href="/docFind/"+s,e.target="blank",o.appendChild(e)}if(!o)return;"then"in o?o.then((e=>{e&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(e)})).catch((t=>Qi(this.view.state,t,"completion info"))):this.addInfoPane(o)}}addInfoPane(t){let e=this.info=document.createElement("div");e.className="cm-tooltip cm-completionInfo",e.appendChild(t),this.dom.appendChild(e),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let e=null;for(let i=this.list.firstChild,n=this.range.from;i;i=i.nextSibling,n++)"LI"==i.nodeName&&i.id?n==t?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),e=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected"):n--;return e&&function(t,e){let i=t.getBoundingClientRect(),n=e.getBoundingClientRect();n.topi.bottom&&(t.scrollTop+=n.bottom-i.bottom)}(this.list,e),e}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let e=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),n=t.getBoundingClientRect(),s=this.space;if(!s){let t=this.dom.ownerDocument.defaultView||window;s={left:0,top:0,right:t.innerWidth,bottom:t.innerHeight}}return n.top>Math.min(s.bottom,e.bottom)-10||n.bottomi.from||0==i.from))if(s=t,"string"!=typeof l&&l.header)n.appendChild(l.header(l));else{n.appendChild(document.createElement("completion-section")).textContent=t}}const h=n.appendChild(document.createElement("li"));h.id=e+"-"+r,h.setAttribute("role","option");let c=this.optionClass(o);c&&(h.className=c);for(let t of this.optionContent){let e=t(o,this.view.state,a);e&&h.appendChild(e)}}return i.from&&n.classList.add("cm-completionListIncompleteTop"),i.to=this.options.length?this:new ud(this.options,pd(e,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,e,i,n,s){let r=function(t,e){let i=[],n=null,s=t=>{i.push(t);let{section:e}=t.completion;if(e){n||(n=[]);let t="string"==typeof e?e:e.name;n.some((e=>e.name==t))||n.push("string"==typeof e?{name:t}:e)}};for(let n of t)if(n.hasResult())if(!1===n.result.filter){let t=n.result.getMatch;for(let e of n.result.options){let r=[1e9-i.length];if(t)for(let i of t(e))r.push(i);s(new Iu(e,n.source,r,r[0]))}}else{let t,i=new Ku(e.sliceDoc(n.from,n.to));for(let e of n.result.options)(t=i.match(e.label))&&s(new Iu(e,n.source,t,t[0]+(e.boost||0)))}if(n){let t=Object.create(null),e=0,s=(t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:1e9)-(null!==(n=e.rank)&&void 0!==n?n:1e9)||(t.namee.score-t.score||a(t.completion,e.completion))))!o||o.label!=t.completion.label||o.detail!=t.completion.detail||null!=o.type&&null!=t.completion.type&&o.type!=t.completion.type||o.apply!=t.completion.apply?r.push(t):cd(t.completion)>cd(o)&&(r[r.length-1]=t),o=t.completion;return r}(t,e);if(!r.length)return n&&t.some((t=>1==t.state))?new ud(n.options,n.attrs,n.tooltip,n.timestamp,n.selected,!0):null;let o=e.facet(td).selectOnOpen?0:-1;if(n&&n.selected!=o&&-1!=n.selected){let t=n.options[n.selected].completion;for(let e=0;ee.hasResult()?Math.min(t,e.from):t),1e8),create:(a=yd,t=>new hd(t,a)),above:s.aboveCursor},n?n.timestamp:Date.now(),o,!1);var a}map(t){return new ud(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class dd{constructor(t,e,i){this.active=t,this.id=e,this.open=i}static start(){return new dd(Od,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(t){let{state:e}=t,i=e.facet(td),n=(i.override||e.languageDataAt("autocomplete",Bu(e)).map(Fu)).map((e=>(this.active.find((t=>t.source==e))||new md(e,this.active.some((t=>0!=t.state))?1:0)).update(t,i)));n.length==this.active.length&&n.every(((t,e)=>t==this.active[e]))&&(n=this.active);let s=this.open;s&&t.docChanged&&(s=s.map(t.changes)),t.selection||n.some((e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to)))||!function(t,e){if(t==e)return!0;for(let i=0,n=0;;){for(;i1==t.state))&&(s=null),!s&&n.every((t=>1!=t.state))&&n.some((t=>t.hasResult()))&&(n=n.map((t=>t.hasResult()?new md(t.source,0):t)));for(let e of t.effects)e.is(vd)&&(s=s&&s.setSelected(e.value,this.id));return n==this.active&&s==this.open?this:new dd(n,this.id,s)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:fd}}const fd={"aria-autocomplete":"list"};function pd(t,e){let i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(i["aria-activedescendant"]=t+"-"+e),i}const Od=[];function gd(t){return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null}class md{constructor(t,e,i=-1){this.source=t,this.state=e,this.explicitPos=i}hasResult(){return!1}update(t,e){let i=gd(t),n=this;i?n=n.handleUserEvent(t,i,e):t.docChanged?n=n.handleChange(t):t.selection&&0!=n.state&&(n=new md(n.source,0));for(let e of t.effects)if(e.is(Hu))n=new md(n.source,1,e.value?Bu(t.state):-1);else if(e.is(Ju))n=new md(n.source,0);else if(e.is(wd))for(let t of e.value)t.source==n.source&&(n=t);return n}handleUserEvent(t,e,i){return"delete"!=e&&i.activateOnTyping?new md(this.source,1):this.map(t.changes)}handleChange(t){return t.changes.touchesRange(Bu(t.startState))?new md(this.source,0):this.map(t.changes)}map(t){return t.empty||this.explicitPos<0?this:new md(this.source,this.state,t.mapPos(this.explicitPos))}}class bd extends md{constructor(t,e,i,n,s){super(t,2,e),this.result=i,this.from=n,this.to=s}hasResult(){return!0}handleUserEvent(t,e,i){var n;let s=t.changes.mapPos(this.from),r=t.changes.mapPos(this.to,1),o=Bu(t.state);if((this.explicitPos<0?o<=s:or||"delete"==e&&Bu(t.startState)==this.from)return new md(this.source,"input"==e&&i.activateOnTyping?1:0);let a,l=this.explicitPos<0?-1:t.changes.mapPos(this.explicitPos);return function(t,e,i,n){if(!t)return!1;let s=e.sliceDoc(i,n);return"function"==typeof t?t(s,i,n,e):ju(t,!0).test(s)}(this.result.validFor,t.state,s,r)?new bd(this.source,l,this.result,s,r):this.result.update&&(a=this.result.update(this.result,s,r,new qu(t.state,o,l>=0)))?new bd(this.source,l,a,a.from,null!==(n=a.to)&&void 0!==n?n:Bu(t.state)):new md(this.source,1,l)}handleChange(t){return t.changes.touchesRange(this.from,this.to)?new md(this.source,0):this.map(t.changes)}map(t){return t.empty?this:new bd(this.source,this.explicitPos<0?-1:t.mapPos(this.explicitPos),this.result,t.mapPos(this.from),t.mapPos(this.to,1))}}const wd=ut.define({map:(t,e)=>t.map((t=>t.map(e)))}),vd=ut.define(),yd=q.define({create:()=>dd.start(),update:(t,e)=>t.update(e),provide:t=>[Tr.from(t,(t=>t.tooltip)),Ts.contentAttributes.from(t,(t=>t.attrs))]}),Sd=Ts.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class xd{constructor(t,e,i,n){this.field=t,this.line=e,this.from=i,this.to=n}}class kd{constructor(t,e,i){this.field=t,this.from=e,this.to=i}map(t){let e=t.mapPos(this.from,-1,S.TrackDel),i=t.mapPos(this.to,1,S.TrackDel);return null==e||null==i?null:new kd(this.field,e,i)}}class Qd{constructor(t,e){this.lines=t,this.fieldPositions=e}instantiate(t,e){let i=[],n=[e],s=t.doc.lineAt(e),r=/^\s*/.exec(s.text)[0];for(let s of this.lines){if(i.length){let i=r,o=/^\t*/.exec(s)[0].length;for(let e=0;enew kd(t.field,n[t.line]+t.from,n[t.line]+t.to)));return{text:i,ranges:o}}static parse(t){let e,i=[],n=[],s=[];for(let r of t.split(/\r\n?|\n/)){for(;e=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(r);){let t=e[1]?+e[1]:null,o=e[2]||e[3]||"",a=-1;for(let e=0;e=a&&t.field++}s.push(new xd(a,n.length,e.index,e.index+o.length)),r=r.slice(0,e.index)+o+r.slice(e.index+e[0].length)}for(let t;t=/\\([{}])/.exec(r);){r=r.slice(0,t.index)+t[1]+r.slice(t.index+t[0].length);for(let e of s)e.line==n.length&&e.from>t.index&&(e.from--,e.to--)}n.push(r)}return new Qd(n,s)}}let $d=ni.widget({widget:new class extends ei{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),Pd=ni.mark({class:"cm-snippetField"});class Cd{constructor(t,e){this.ranges=t,this.active=e,this.deco=ni.set(t.map((t=>(t.from==t.to?$d:Pd).range(t.from,t.to))))}map(t){let e=[];for(let i of this.ranges){let n=i.map(t);if(!n)return null;e.push(n)}return new Cd(e,this.active)}selectionInsideField(t){return t.ranges.every((t=>this.ranges.some((e=>e.field==this.active&&e.from<=t.from&&e.to>=t.to))))}}const _d=ut.define({map:(t,e)=>t&&t.map(e)}),Xd=ut.define(),Zd=q.define({create:()=>null,update(t,e){for(let i of e.effects){if(i.is(_d))return i.value;if(i.is(Xd)&&t)return new Cd(t.ranges,i.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>Ts.decorations.from(t,(t=>t?t.deco:ni.none))});function Ad(t,e){return A.create(t.filter((t=>t.field==e)).map((t=>A.range(t.from,t.to))))}function Td(e){let i=Qd.parse(e);return(e,n,s,r)=>{let{text:o,ranges:a}=i.instantiate(e.state,s),l={changes:{from:s,to:r,insert:t.of(o)},scrollIntoView:!0,annotations:n?Nu.of(n):void 0};if(a.length&&(l.selection=Ad(a,0)),a.length>1){let t=new Cd(a,0),i=l.effects=[_d.of(t)];void 0===e.state.field(Zd,!1)&&i.push(ut.appendConfig.of([Zd,Md,Wd,Sd]))}e.dispatch(e.state.update(l))}}function Rd(t){return({state:e,dispatch:i})=>{let n=e.field(Zd,!1);if(!n||t<0&&0==n.active)return!1;let s=n.active+t,r=t>0&&!n.ranges.some((e=>e.field==s+t));return i(e.update({selection:Ad(n.ranges,s),effects:_d.of(r?null:new Cd(n.ranges,s))})),!0}}const Ed=[{key:"Tab",run:Rd(1),shift:Rd(-1)},{key:"Escape",run:({state:t,dispatch:e})=>!!t.field(Zd,!1)&&(e(t.update({effects:_d.of(null)})),!0)}],Vd=E.define({combine:t=>t.length?t[0]:Ed}),Md=N.highest(Ys.compute([Vd],(t=>t.facet(Vd))));function Dd(t,e){return Object.assign(Object.assign({},e),{apply:Td(t)})}const Wd=Ts.domEventHandlers({mousedown(t,e){let i,n=e.state.field(Zd,!1);if(!n||null==(i=e.posAtCoords({x:t.clientX,y:t.clientY})))return!1;let s=n.ranges.find((t=>t.from<=i&&t.to>=i));return!(!s||s.field==n.active)&&(e.dispatch({selection:Ad(n.ranges,s.field),effects:_d.of(n.ranges.some((t=>t.field>s.field))?new Cd(n.ranges,s.field):null)}),!0)}}),Ud=new class extends Qt{};function Yd(t={}){return[yd,td.of(t),od,Ld,Sd]}Ud.startSide=1,Ud.endSide=-1;const qd=[{key:"Ctrl-Space",run:t=>!!t.state.field(yd,!1)&&(t.dispatch({effects:Hu.of(!0)}),!0)},{key:"Escape",run:t=>{let e=t.state.field(yd,!1);return!(!e||!e.active.some((t=>0!=t.state)))&&(t.dispatch({effects:Ju.of(null)}),!0)}},{key:"ArrowDown",run:nd(!0)},{key:"ArrowUp",run:nd(!1)},{key:"PageDown",run:nd(!0,"page")},{key:"PageUp",run:nd(!1,"page")},{key:"Enter",run:sd}],Ld=N.highest(Ys.computeN([td],(t=>t.facet(td).defaultKeymap?[qd]:[]))),zd=(()=>[vr(),Sh(),ir(),$l(_l,{fallback:!0}),Ys.of([...Vc,...Wh])])();class Id{constructor(t,e,i,n,s,r,o,a,l,h=0,c){this.p=t,this.stack=e,this.state=i,this.reducePos=n,this.pos=s,this.score=r,this.buffer=o,this.bufferBase=a,this.curContext=l,this.lookAhead=h,this.parent=c}toString(){return`[${this.stack.filter(((t,e)=>e%3==0)).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,i=0){let n=t.parser.context;return new Id(t,[],e,i,i,0,[],0,n?new Bd(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let i=t>>19,n=65535&t,{parser:s}=this.p,r=s.dynamicPrecedence(n);if(r&&(this.score+=r),0==i)return this.pushState(s.getGoto(this.state,n,!0),this.reducePos),n=2e3&&!(null===(e=this.p.parser.nodeSet.types[n])||void 0===e?void 0:e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=l):this.p.lastBigReductionSizeo;)this.stack.pop();this.reduceContext(n,a)}storeNode(t,e,i,n=4,s=!1){if(0==t&&(!this.stack.length||this.stack[this.stack.length-1]0&&0==t.buffer[n-4]&&t.buffer[n-1]>-1){if(e==i)return;if(t.buffer[n-2]>=e)return void(t.buffer[n-2]=i)}}if(s&&this.pos!=i){let s=this.buffer.length;if(s>0&&0!=this.buffer[s-4])for(;s>0&&this.buffer[s-2]>i;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,n>4&&(n-=4);this.buffer[s]=t,this.buffer[s+1]=e,this.buffer[s+2]=i,this.buffer[s+3]=n}else this.buffer.push(t,e,i,n)}shift(t,e,i){let n=this.pos;if(131072&t)this.pushState(65535&t,this.pos);else if(0==(262144&t)){let s=t,{parser:r}=this.p;(i>this.pos||e<=r.maxNode)&&(this.pos=i,r.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,n),this.shiftContext(e,n),e<=r.maxNode&&this.buffer.push(e,n,i,4)}else this.pos=i,this.shiftContext(e,n),e<=this.p.parser.maxNode&&this.buffer.push(e,n,i,4)}apply(t,e,i){65536&t?this.reduce(t):this.shift(t,e,i)}useNode(t,e){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=t)&&(this.p.reused.push(t),i++);let n=this.pos;this.reducePos=this.pos=n+t.length,this.pushState(e,n),this.buffer.push(i,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let i=t.buffer.slice(e),n=t.bufferBase+e;for(;t&&n==t.bufferBase;)t=t.parent;return new Id(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,n,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let i=t<=this.p.parser.maxNode;i&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,i?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new Nd(this);;){let i=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(0==i)return!1;if(0==(65536&i))return!0;e.reduce(i)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let n,s=0;s1&e&&t==n))||i.push(e[t],n)}e=i}let i=[];for(let t=0;t>19,n=65535&t,s=this.stack.length-3*i;if(s<0||e.getGoto(this.stack[s],n,!1)<0)return!1;this.storeNode(0,this.reducePos,this.reducePos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:t}=this.p;return 65535==t.data[t.stateSlot(this.state,1)]&&!t.stateSlot(this.state,4)}restart(){this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;ethis.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Bd{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}var jd;!function(t){t[t.Insert=200]="Insert",t[t.Delete=190]="Delete",t[t.Reduce=100]="Reduce",t[t.MaxNext=4]="MaxNext",t[t.MaxInsertStackDepth=300]="MaxInsertStackDepth",t[t.DampenInsertStackDepth=120]="DampenInsertStackDepth",t[t.MinBigReduction=2e3]="MinBigReduction"}(jd||(jd={}));class Nd{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=65535&t,i=t>>19;0==i?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(i-1);let n=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=n}}class Gd{constructor(t,e,i){this.stack=t,this.pos=e,this.index=i,this.buffer=t.buffer,0==this.index&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new Gd(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;null!=t&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new Gd(this.stack,this.pos,this.index)}}function Fd(t,e=Uint16Array){if("string"!=typeof t)return t;let i=null;for(let n=0,s=0;n=92&&e--,e>=34&&e--;let s=e-32;if(s>=46&&(s-=46,i=!0),r+=s,i)break;r*=46}i?i[s++]=r:i=new e(r)}return i}class Hd{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Jd=new Hd;class Kd{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Jd,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let i=this.range,n=this.rangeIndex,s=this.pos+t;for(;si.to:s>=i.to;){if(n==this.ranges.length-1)return null;let t=this.ranges[++n];s+=t.from-i.to,i=t}return s}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,e.from);return this.end}peek(t){let e,i,n=this.chunkOff+t;if(n>=0&&n=this.chunk2Pos&&en.to&&(this.chunk2=this.chunk2.slice(0,n.to-e)),i=this.chunk2.charCodeAt(0)}}return e>=this.token.lookAhead&&(this.token.lookAhead=e+1),i}acceptToken(t,e=0){let i=e?this.resolveOffset(e,-1):this.pos;if(null==i||i=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=Jd,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let i="";for(let n of this.ranges){if(n.from>=e)break;n.to>t&&(i+=this.input.read(Math.max(n.from,t),Math.min(n.to,e)))}return i}}class tf{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:i}=e.p;sf(this.data,t,e,this.id,i.data,i.tokenPrecTable)}}tf.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class ef{constructor(t,e,i){this.precTable=e,this.elseToken=i,this.data="string"==typeof t?Fd(t):t}token(t,e){let i=t.pos,n=0;for(;sf(this.data,t,e,0,this.data,this.precTable),!(t.token.value>-1);){if(null==this.elseToken)return;if(t.next<0)break;t.advance(),t.reset(t.pos,t.token),n++}n&&(t.reset(i,t.token),t.acceptToken(this.elseToken,n))}}ef.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class nf{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function sf(t,e,i,n,s,r){let o=0,a=1<0){let i=t[n];if(l.allows(i)&&(-1==e.token.value||e.token.value==i||of(i,e.token.value,s,r))){e.acceptToken(i);break}}let n=e.next,h=0,c=t[o+2];if(!(e.next<0&&c>h&&65535==t[i+3*c-3]&&65535==t[i+3*c-3])){for(;h>1,r=i+s+(s<<1),a=t[r],l=t[r+1]||65536;if(n=l)){o=t[r+2],e.advance();continue t}h=s+1}}break}o=t[i+3*c-1]}}function rf(t,e,i){for(let n,s=e;65535!=(n=t[s]);s++)if(n==i)return s-e;return-1}function of(t,e,i,n){let s=rf(i,n,e);return s<0||rf(i,n,t)e)&&!n.type.isError)return i<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(t.length,Math.max(n.from+1,e+25));if(i<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return i<0?0:t.length}}!function(t){t[t.Margin=25]="Margin"}(hf||(hf={}));let uf=class{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?cf(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?cf(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=r,null;if(s instanceof bo){if(r==t){if(r=Math.max(this.safeFrom,t)&&(this.trees.push(s),this.start.push(r),this.index.push(0))}else this.index[e]++,this.nextStart=r+s.length}}};class df{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map((t=>new Hd))}getActions(t){let e=0,i=null,{parser:n}=t.p,{tokenizers:s}=n,r=n.stateSlot(t.state,3),o=t.curContext?t.curContext.hash:0,a=0;for(let n=0;nh.end+25&&(a=Math.max(h.lookAhead,a)),0!=h.value)){let n=e;if(h.extended>-1&&(e=this.addActions(t,h.extended,h.end,e)),e=this.addActions(t,h.value,h.end,e),!l.extend&&(i=h,e>n))break}}for(;this.actions.length>e;)this.actions.pop();return a&&t.setLookAhead(a),i||t.pos!=this.stream.end||(i=new Hd,i.value=t.p.parser.eofTerm,i.start=i.end=t.pos,e=this.addActions(t,i.value,i.end,e)),this.mainToken=i,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new Hd,{pos:i,p:n}=t;return e.start=i,e.end=Math.min(i+1,n.stream.end),e.value=i==n.stream.end?n.parser.eofTerm:0,e}updateCachedToken(t,e,i){let n=this.stream.clipPos(i.pos);if(e.token(this.stream.reset(n,t),i),t.value>-1){let{parser:e}=i.p;for(let n=0;n=0&&i.p.parser.dialect.allows(s>>1)){0==(1&s)?t.value=s>>1:t.extended=s>>1;break}}}else t.value=0,t.end=this.stream.clipPos(n+1)}putAction(t,e,i,n){for(let e=0;e4*t.bufferLength?new uf(i,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t,e,i=this.stacks,n=this.minStackPos,s=this.stacks=[];if(this.bigReductionCount>300&&1==i.length){let[t]=i;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;rn)s.push(o);else{if(this.advanceStack(o,s,i))continue;{t||(t=[],e=[]),t.push(o);let i=this.tokens.getMainToken(o);e.push(i.value,i.end)}}break}}if(!s.length){let e=t&&function(t){let e=null;for(let i of t){let t=i.p.stoppedAt;(i.pos==i.p.stream.end||null!=t&&i.pos>t)&&i.p.parser.stateFlag(i.state,2)&&(!e||e.scorethis.stoppedAt?t[0]:this.runRecovery(t,e,s);if(i)return this.stackToTree(i.forceAll())}if(this.recovering){let t=1==this.recovering?1:3*this.recovering;if(s.length>t)for(s.sort(((t,e)=>e.score-t.score));s.length>t;)s.pop();s.some((t=>t.reducePos>n))&&this.recovering--}else if(s.length>1){t:for(let t=0;t500&&n.buffer.length>500){if(!((e.score-n.score||e.buffer.length-n.buffer.length)>0)){s.splice(t--,1);continue t}s.splice(i--,1)}}}s.length>12&&s.splice(12,s.length-12)}this.minStackPos=s[0].pos;for(let t=1;t ":"";if(null!=this.stoppedAt&&n>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let e=t.curContext&&t.curContext.tracker.strict,i=e?t.curContext.hash:0;for(let o=this.fragments.nodeAt(n);o;){let n=this.parser.nodeSet.types[o.type.id]==o.type?s.getGoto(t.state,o.type.id):-1;if(n>-1&&o.length&&(!e||(o.prop(ho.contextHash)||0)==i))return t.useNode(o,n),af&&console.log(r+this.stackID(t)+` (via reuse of ${s.getName(o.type.id)})`),!0;if(!(o instanceof bo)||0==o.children.length||o.positions[0]>0)break;let a=o.children[0];if(!(a instanceof bo&&0==o.positions[0]))break;o=a}}let o=s.stateSlot(t.state,4);if(o>0)return t.reduce(o),af&&console.log(r+this.stackID(t)+` (via always-reduce ${s.getName(65535&o)})`),!0;if(t.stack.length>=15e3)for(;t.stack.length>9e3&&t.forceReduce(););let a=this.tokens.getActions(t);for(let o=0;on?e.push(d):i.push(d)}return!1}advanceFully(t,e){let i=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>i)return Of(t,e),!0}}runRecovery(t,e,i){let n=null,s=!1;for(let r=0;r ":"";if(o.deadEnd){if(s)continue;if(s=!0,o.restart(),af&&console.log(h+this.stackID(o)+" (restarted)"),this.advanceFully(o,i))continue}let c=o.split(),u=h;for(let t=0;c.forceReduce()&&t<10;t++){if(af&&console.log(u+this.stackID(c)+" (via force-reduce)"),this.advanceFully(c,i))break;af&&(u=this.stackID(c)+" -> ")}for(let t of o.recoverByInsert(a))af&&console.log(h+this.stackID(t)+" (via recover-insert)"),this.advanceFully(t,i);this.stream.end>o.pos?(l==o.pos&&(l++,a=0),o.recoverByDelete(a,l),af&&console.log(h+this.stackID(o)+` (via recover-delete ${this.parser.getName(a)})`),Of(o,i)):(!n||n.scoret;class bf{constructor(t){this.start=t.start,this.shift=t.shift||mf,this.reduce=t.reduce||mf,this.reuse=t.reuse||mf,this.hash=t.hash||(()=>0),this.strict=!1!==t.strict}}class wf extends Vo{constructor(t){if(super(),this.wrappers=[],14!=t.version)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let i=0;it.topRules[e][1])),n=[];for(let t=0;t=0)s(n,t,e[i++]);else{let r=e[i+-n];for(let o=-n;o>0;o--)s(e[i++],t,r);i++}}}this.nodeSet=new po(e.map(((e,s)=>fo.define({name:s>=this.minRepeatTerm?void 0:e,id:s,props:n[s],top:i.indexOf(s)>-1,error:0==s,skipped:t.skippedNodes&&t.skippedNodes.indexOf(s)>-1})))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=oo;let r=Fd(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let t=0;t"number"==typeof t?new tf(r,t):t)),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,i){let n=new pf(this,t,e,i);for(let s of this.wrappers)n=s(n,t,e,i);return n}getGoto(t,e,i=!1){let n=this.goto;if(e>=n[0])return-1;for(let s=n[e+1];;){let e=n[s++],r=1&e,o=n[s++];if(r&&i)return o;for(let i=s+(e>>1);s0}validAction(t,e){if(e==this.stateSlot(t,4))return!0;for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])return!1;i=vf(this.data,i+2)}if(e==vf(this.data,i+1))return!0}}nextStates(t){let e=[];for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])break;i=vf(this.data,i+2)}if(0==(1&this.data[i+2])){let t=this.data[i+1];e.some(((e,i)=>1&i&&e==t))||e.push(this.data[i],t)}}return e}configure(t){let e=Object.assign(Object.create(wf.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let i=this.topRules[t.top];if(!i)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=i}return t.tokenizers&&(e.tokenizers=this.tokenizers.map((e=>{let i=t.tokenizers.find((t=>t.from==e));return i?i.to:e}))),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map(((i,n)=>{let s=t.specializers.find((t=>t.from==i.external));if(!s)return i;let r=Object.assign(Object.assign({},i),{external:s.to});return e.specializers[n]=yf(r),r}))),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),null!=t.strict&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),null!=t.bufferLength&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return null==e?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),i=e.map((()=>!1));if(t)for(let n of t.split(" ")){let t=e.indexOf(n);t>=0&&(i[t]=!0)}let n=null;for(let t=0;tt.external(i,n)<<1|e}return t.get}const Sf=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],xf=new bf({start:!1,shift:(t,e)=>3==e||4==e||305==e?t:306==e,strict:!1}),kf=new nf(((t,e)=>{let{next:i}=t;(125==i||-1==i||e.context)&&e.canShift(303)&&t.acceptToken(303)}),{contextual:!0,fallback:!0}),Qf=new nf(((t,e)=>{let i,{next:n}=t;Sf.indexOf(n)>-1||(47!=n||47!=(i=t.peek(1))&&42!=i)&&125!=n&&59!=n&&-1!=n&&!e.context&&e.canShift(302)&&t.acceptToken(302)}),{contextual:!0}),$f=new nf(((t,e)=>{let{next:i}=t;if((43==i||45==i)&&(t.advance(),i==t.next)){t.advance();let i=!e.context&&e.canShift(1);t.acceptToken(i?1:2)}}),{contextual:!0}),Pf=ea({"get set async static":Sa.modifier,"for while do if else switch try catch finally return throw break continue default case":Sa.controlKeyword,"in of await yield void typeof delete instanceof":Sa.operatorKeyword,"let var const function class extends":Sa.definitionKeyword,"import export from":Sa.moduleKeyword,"with debugger as new":Sa.keyword,TemplateString:Sa.special(Sa.string),super:Sa.atom,BooleanLiteral:Sa.bool,this:Sa.self,null:Sa.null,Star:Sa.modifier,VariableName:Sa.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":Sa.function(Sa.variableName),VariableDefinition:Sa.definition(Sa.variableName),Label:Sa.labelName,PropertyName:Sa.propertyName,PrivatePropertyName:Sa.special(Sa.propertyName),"CallExpression/MemberExpression/PropertyName":Sa.function(Sa.propertyName),"FunctionDeclaration/VariableDefinition":Sa.function(Sa.definition(Sa.variableName)),"ClassDeclaration/VariableDefinition":Sa.definition(Sa.className),PropertyDefinition:Sa.definition(Sa.propertyName),PrivatePropertyDefinition:Sa.definition(Sa.special(Sa.propertyName)),UpdateOp:Sa.updateOperator,LineComment:Sa.lineComment,BlockComment:Sa.blockComment,Number:Sa.number,String:Sa.string,Escape:Sa.escape,ArithOp:Sa.arithmeticOperator,LogicOp:Sa.logicOperator,BitOp:Sa.bitwiseOperator,CompareOp:Sa.compareOperator,RegExp:Sa.regexp,Equals:Sa.definitionOperator,Arrow:Sa.function(Sa.punctuation),": Spread":Sa.punctuation,"( )":Sa.paren,"[ ]":Sa.squareBracket,"{ }":Sa.brace,"InterpolationStart InterpolationEnd":Sa.special(Sa.brace),".":Sa.derefOperator,", ;":Sa.separator,"@":Sa.meta,TypeName:Sa.typeName,TypeDefinition:Sa.definition(Sa.typeName),"type enum interface implements namespace module declare":Sa.definitionKeyword,"abstract global Privacy readonly override":Sa.modifier,"is keyof unique infer":Sa.operatorKeyword,JSXAttributeValue:Sa.attributeValue,JSXText:Sa.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":Sa.angleBracket,"JSXIdentifier JSXNameSpacedName":Sa.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":Sa.attributeName,"JSXBuiltin/JSXIdentifier":Sa.standard(Sa.tagName)}),Cf={__proto__:null,export:14,as:19,from:27,default:30,async:35,function:36,extends:46,this:50,true:58,false:58,null:70,void:74,typeof:78,super:96,new:130,delete:146,yield:155,await:159,class:164,public:221,private:221,protected:221,readonly:223,instanceof:242,satisfies:245,in:246,const:248,import:280,keyof:335,unique:339,infer:345,is:381,abstract:401,implements:403,type:405,let:408,var:410,interface:417,enum:421,namespace:427,module:429,declare:433,global:437,for:456,of:465,while:468,with:472,do:476,if:480,else:482,switch:486,case:492,try:498,catch:502,finally:506,return:510,throw:514,break:518,continue:522,debugger:526},_f={__proto__:null,async:117,get:119,set:121,declare:181,public:183,private:183,protected:183,static:185,abstract:187,override:189,readonly:195,accessor:197,new:385},Xf={__proto__:null,"<":137},Zf=wf.deserialize({version:14,states:"$6[O`QUOOO%QQUOOO'TQWOOP(bOSOOO*pQ(CjO'#CfO*wOpO'#CgO+VO!bO'#CgO+eO07`O'#DZO-vQUO'#DaO.WQUO'#DlO%QQUO'#DvO0[QUO'#EOOOQ(CY'#EW'#EWO0uQSO'#ETOOQO'#Ei'#EiOOQO'#Ib'#IbO0}QSO'#GkO1YQSO'#EhO1_QSO'#EhO3aQ(CjO'#JcO6QQ(CjO'#JdO6nQSO'#FWO6sQ#tO'#FoOOQ(CY'#F`'#F`O7OO&jO'#F`O7^Q,UO'#FvO8tQSO'#FuOOQ(CY'#Jd'#JdOOQ(CW'#Jc'#JcOOQQ'#KO'#KOO8yQSO'#IOO9OQ(C[O'#IPOOQQ'#JP'#JPOOQQ'#IT'#ITQ`QUOOO%QQUO'#DnO9WQUO'#DzO%QQUO'#D|O9_QSO'#GkO9dQ,UO'#ClO9rQSO'#EgO9}QSO'#ErO:SQ,UO'#F_O:qQSO'#GkO:vQSO'#GoO;RQSO'#GoO;aQSO'#GrO;aQSO'#GsO;aQSO'#GuO9_QSO'#GxOQQSO'#HnO>VQ(C]O'#HtO%QQUO'#HvO>bQ(C]O'#HxO>mQ(C]O'#HzO9OQ(C[O'#H|O>xQ(CjO'#CfO?zQWO'#DfQOQSOOO@bQSO'#EPO9dQ,UO'#EgO@mQSO'#EgO@xQ`O'#F_OOQQ'#Cd'#CdOOQ(CW'#Dk'#DkOOQ(CW'#Jg'#JgO%QQUO'#JgOOQO'#Jk'#JkOOQO'#I_'#I_OAxQWO'#E`OOQ(CW'#E_'#E_OBtQ(C`O'#E`OCOQWO'#ESOOQO'#Jj'#JjOCdQWO'#JkODqQWO'#ESOCOQWO'#E`PEOO?MpO'#C`POOO)CDn)CDnOOOO'#IU'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1}O~P'TO^%^O#X2WO'k%^O~O^%^O!a#rO#X2WO'k%^O~O^%^O!a#rO!l2[O#X2WO'k%^O(b'bO~O^%^O'k%^O~P!6UO!V$^Oo$ka~O!S&|i!V&|i~P!6UO!V'vO!S(Xi~O!V'}O!S(fi~O!S(gi!V(gi~P!6UO!V(di!g(di^(di'k(di~P!6UO#X2^O!V(di!g(di^(di'k(di~O!V(ZO!g(ci~O|%vO!X%wO!x]O#b2cO#c2bO't%eO~O|%vO!X%wO#c2bO't%eO~Og2jO!X'QO%a2iO~Og2jO!X'QO%a2iO'}%OO~O#dvaPvaXva^vakva!eva!fva!hva!lva#gva#hva#iva#jva#kva#lva#mva#nva#ova#qva#sva#uva#vva'kva(Rva(bva!gva!Sva'ivaova!Xva%ava!ava~P#L|O#d$laP$laX$la^$lak$laz$la!e$la!f$la!h$la!l$la#g$la#h$la#i$la#j$la#k$la#l$la#m$la#n$la#o$la#q$la#s$la#u$la#v$la'k$la(R$la(b$la!g$la!S$la'i$lao$la!X$la%a$la!a$la~P#MrO#d$naP$naX$na^$nak$naz$na!e$na!f$na!h$na!l$na#g$na#h$na#i$na#j$na#k$na#l$na#m$na#n$na#o$na#q$na#s$na#u$na#v$na'k$na(R$na(b$na!g$na!S$na'i$nao$na!X$na%a$na!a$na~P#NeO#d$|aP$|aX$|a^$|ak$|az$|a!V$|a!e$|a!f$|a!h$|a!l$|a#g$|a#h$|a#i$|a#j$|a#k$|a#l$|a#m$|a#n$|a#o$|a#q$|a#s$|a#u$|a#v$|a'k$|a(R$|a(b$|a!g$|a!S$|a'i$|a#X$|ao$|a!X$|a%a$|a!a$|a~P#)tO^#[q!V#[q'k#[q'i#[q!S#[q!g#[qo#[q!X#[q%a#[q!a#[q~P!6UOd'OX!V'OX~P!'^O!V.YOd([a~O!U2rO!V'PX!g'PX~P%QO!V.]O!g(]a~O!V.]O!g(]a~P!6UO!S2uO~O#y!ja!W!ja~PJ`O#y!ba!V!ba!W!ba~P#@_O#y!na!W!na~P!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]R'Z9mT#gZ%ZS#fZ%ZU%y|},ZU(W#d#e#hS-r(X(YQ-v(ZQ0h+hQ2`-sU2a-t-u-wS5v2b2cR7u5w`#YW#S#V%v't'}+e-mt#cZ|}#d#e#h%Z(X(Y(Z+h-s-t-u-w2b2c5wQ1_,ZQ1r,oQ5e1jQ7m5fT:x&y+fT#]W%vS#[W%vS'u#S'}S'z#V+eS,t&y+fT-h't-mT'O!c%wQ$hfR)j$mT)_$h)`R3Z.kT*O$u*QR*W$xQ/}*zQ2e.OQ4s0wQ5{2iQ7X4vQ7x5zQ8e7WQ8w7wQ9W8gQ9`8yQ9e9XR9h9alpOXr!X#`%]&d&f&g&i,],b1b1eQ&^!TR,Q&ZV%z|},ZR0q+qR,P&XQ%szR+c%tR+X%nT&b!U&eT&c!U&eT1d,b1e",nodeNames:"⚠ ArithOp ArithOp LineComment BlockComment Script ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXStartTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:364,context:xf,nodeProps:[["group",-26,6,14,16,62,199,203,206,207,209,212,215,225,227,233,235,237,239,242,248,254,256,258,260,262,264,265,"Statement",-32,10,11,25,28,29,35,45,48,49,51,56,64,72,76,78,80,81,103,104,113,114,131,134,136,137,138,139,141,142,162,163,165,"Expression",-23,24,26,30,34,36,38,166,168,170,171,173,174,175,177,178,179,181,182,183,193,195,197,198,"Type",-3,84,96,102,"ClassItem"],["openedBy",31,"InterpolationStart",50,"[",54,"{",69,"(",143,"JSXStartTag",155,"JSXStartTag JSXStartCloseTag"],["closedBy",33,"InterpolationEnd",44,"]",55,"}",70,")",144,"JSXSelfCloseEndTag JSXEndTag",160,"JSXEndTag"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ZXz{^~^O'q~~aP!P!Qd~iO'r~~",25,308)],topRules:{Script:[0,5],SingleExpression:[1,266],SingleClassItem:[2,267]},dialects:{jsx:12686,ts:12688},dynamicPrecedences:{76:1,78:1,163:1,191:1},specialized:[{term:312,get:t=>Cf[t]||-1},{term:328,get:t=>_f[t]||-1},{term:67,get:t=>Xf[t]||-1}],tokenPrec:12712}),Af=[Dd("function ${name}(${params}) {\n\t${}\n}",{label:"function",detail:"definition",type:"keyword"}),Dd("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n\t${}\n}",{label:"for",detail:"loop",type:"keyword"}),Dd("for (let ${name} of ${collection}) {\n\t${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Dd("do {\n\t${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),Dd("while (${}) {\n\t${}\n}",{label:"while",detail:"loop",type:"keyword"}),Dd("try {\n\t${}\n} catch (${error}) {\n\t${}\n}",{label:"try",detail:"/ catch block",type:"keyword"}),Dd("if (${}) {\n\t${}\n}",{label:"if",detail:"block",type:"keyword"}),Dd("if (${}) {\n\t${}\n} else {\n\t${}\n}",{label:"if",detail:"/ else block",type:"keyword"}),Dd("class ${name} {\n\tconstructor(${params}) {\n\t\t${}\n\t}\n}",{label:"class",detail:"definition",type:"keyword"}),Dd('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Dd('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Tf=new Ro,Rf=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Ef(t){return(e,i)=>{let n=e.node.getChild("VariableDefinition");return n&&i(n,t),!0}}const Vf=["FunctionDeclaration"],Mf={FunctionDeclaration:Ef("function"),ClassDeclaration:Ef("class"),ClassExpression:()=>!0,EnumDeclaration:Ef("constant"),TypeAliasDeclaration:Ef("type"),NamespaceDeclaration:Ef("namespace"),VariableDefinition(t,e){t.matchContext(Vf)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function Df(t,e){let i=Tf.get(e);if(i)return i;let n=[],s=!0;function r(e,i){let s=t.sliceString(e.from,e.to);n.push({label:s,type:i})}return e.cursor(mo.IncludeAnonymous).iterate((e=>{if(s)s=!1;else if(e.name){let t=Mf[e.name];if(t&&t(e,r)||Rf.has(e.name))return!1}else if(e.to-e.from>8192){for(let i of Df(t,e.node))n.push(i);return!1}})),Tf.set(e,n),n}const Wf=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Uf=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName"];function Yf(t){let e=Xa(t.state).resolveInner(t.pos,-1);if(Uf.indexOf(e.name)>-1)return null;let i="VariableName"==e.name||e.to-e.from<20&&Wf.test(t.state.sliceDoc(e.from,e.to));if(!i&&!t.explicit)return null;let n=[];for(let i=e;i;i=i.parent)Rf.has(i.name)&&(n=n.concat(Df(t.state.doc,i)));return{options:n,from:i?e.from:t.pos,validFor:Wf}}const qf=_a.define({name:"javascript",parser:Zf.configure({props:[Na.add({IfStatement:il({except:/^\s*({|else\b)/}),TryStatement:il({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:t=>t.baseIndent,SwitchBody:t=>{let e=t.textAfter,i=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return t.baseIndent+(i?0:n?1:2)*t.unit},Block:tl({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":il({except:/^{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag":t=>t.column(t.node.from)+t.unit}),rl.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression":ol,BlockComment:t=>({from:t.from+2,to:t.to-2})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Lf={test:t=>/^JSX/.test(t.name),facet:Qa({commentTokens:{block:{open:"{/*",close:"*/}"}}})},zf=qf.configure({dialect:"ts"},"typescript"),If=qf.configure({dialect:"jsx",props:[$a.add((t=>t.isTop?[Lf]:void 0))]}),Bf=qf.configure({dialect:"jsx ts",props:[$a.add((t=>t.isTop?[Lf]:void 0))]},"typescript"),jf="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map((t=>({label:t,type:"keyword"})));function Nf(t={}){let e=t.jsx?t.typescript?Bf:If:t.typescript?zf:qf;return new Ua(e,[qf.data.of({autocomplete:(i=Uf,n=zu(Af.concat(jf)),t=>{for(let e=Xa(t.state).resolveInner(t.pos,-1);e;e=e.parent){if(i.indexOf(e.name)>-1)return null;if(e.type.isTop)break}return n(t)})}),qf.data.of({autocomplete:Yf}),t.jsx?Hf:[]]);var i,n}function Gf(t,e,i=t.length){for(let n=null==e?void 0:e.firstChild;n;n=n.nextSibling)if("JSXIdentifier"==n.name||"JSXBuiltin"==n.name||"JSXNamespacedName"==n.name||"JSXMemberExpression"==n.name)return t.sliceString(n.from,Math.min(n.to,i));return""}const Ff="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),Hf=Ts.inputHandler.of(((t,e,i,n)=>{if((Ff?t.composing:t.compositionStarted)||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!qf.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((t=>{var e,i;let r,{head:o}=t,a=Xa(s).resolveInner(o,-1);if("JSXStartTag"==a.name&&(a=a.parent),">"==n&&"JSXFragmentTag"==a.name)return{range:A.cursor(o+1),changes:{from:o,insert:">"}};if("/"==n&&"JSXFragmentTag"==a.name){let t=a.parent,i=null==t?void 0:t.parent;if(t.from==o-1&&"JSXEndTag"!=(null===(e=i.lastChild)||void 0===e?void 0:e.name)&&(r=Gf(s.doc,null==i?void 0:i.firstChild,o))){let t=`/${r}>`;return{range:A.cursor(o+t.length),changes:{from:o,insert:t}}}}else if(">"==n){let t=function(t){for(;;){if("JSXOpenTag"==t.name||"JSXSelfClosingTag"==t.name||"JSXFragmentTag"==t.name)return t;if(!t.parent)return null;t=t.parent}}(a);if(t&&"JSXEndTag"!=(null===(i=t.lastChild)||void 0===i?void 0:i.name)&&"`}}}return{range:t}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)}));class Jf{constructor(t,e,i,n,s,r,o){this.type=t,this.value=e,this.from=i,this.hash=n,this.end=s,this.children=r,this.positions=o,this.hashProp=[[ho.contextHash,n]]}static create(t,e,i,n,s){return new Jf(t,e,i,n+(n<<8)+t+(e<<4)|0,s,[],[])}addChild(t,e){t.prop(ho.contextHash)!=this.hash&&(t=new bo(t.type,t.children,t.positions,t.length,this.hashProp)),this.children.push(t),this.positions.push(e)}toTree(t,e=this.end){let i=this.children.length-1;return i>=0&&(e=Math.max(e,this.positions[i]+this.children[i].length+this.from)),new bo(t.types[this.type],this.children,this.positions,e-this.from).balance({makeTree:(t,e,i)=>new bo(fo.none,t,e,i,this.hashProp)})}}var Kf;!function(t){t[t.Document=1]="Document",t[t.CodeBlock=2]="CodeBlock",t[t.FencedCode=3]="FencedCode",t[t.Blockquote=4]="Blockquote",t[t.HorizontalRule=5]="HorizontalRule",t[t.BulletList=6]="BulletList",t[t.OrderedList=7]="OrderedList",t[t.ListItem=8]="ListItem",t[t.ATXHeading1=9]="ATXHeading1",t[t.ATXHeading2=10]="ATXHeading2",t[t.ATXHeading3=11]="ATXHeading3",t[t.ATXHeading4=12]="ATXHeading4",t[t.ATXHeading5=13]="ATXHeading5",t[t.ATXHeading6=14]="ATXHeading6",t[t.SetextHeading1=15]="SetextHeading1",t[t.SetextHeading2=16]="SetextHeading2",t[t.HTMLBlock=17]="HTMLBlock",t[t.LinkReference=18]="LinkReference",t[t.Paragraph=19]="Paragraph",t[t.CommentBlock=20]="CommentBlock",t[t.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",t[t.Escape=22]="Escape",t[t.Entity=23]="Entity",t[t.HardBreak=24]="HardBreak",t[t.Emphasis=25]="Emphasis",t[t.StrongEmphasis=26]="StrongEmphasis",t[t.Link=27]="Link",t[t.Image=28]="Image",t[t.InlineCode=29]="InlineCode",t[t.HTMLTag=30]="HTMLTag",t[t.Comment=31]="Comment",t[t.ProcessingInstruction=32]="ProcessingInstruction",t[t.URL=33]="URL",t[t.HeaderMark=34]="HeaderMark",t[t.QuoteMark=35]="QuoteMark",t[t.ListMark=36]="ListMark",t[t.LinkMark=37]="LinkMark",t[t.EmphasisMark=38]="EmphasisMark",t[t.CodeMark=39]="CodeMark",t[t.CodeText=40]="CodeText",t[t.CodeInfo=41]="CodeInfo",t[t.LinkTitle=42]="LinkTitle",t[t.LinkLabel=43]="LinkLabel"}(Kf||(Kf={}));class tp{constructor(t,e){this.start=t,this.content=e,this.marks=[],this.parsers=[]}}class ep{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let t=this.skipSpace(this.basePos);this.indent=this.countIndent(t,this.pos,this.indent),this.pos=t,this.next=t==this.text.length?-1:this.text.charCodeAt(t)}skipSpace(t){return rp(this.text,t)}reset(t){for(this.text=t,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(t){this.basePos=t,this.baseIndent=this.countIndent(t,this.pos,this.indent)}moveBaseColumn(t){this.baseIndent=t,this.basePos=this.findColumn(t)}addMarker(t){this.markers.push(t)}countIndent(t,e=0,i=0){for(let n=e;n=e.stack[i.depth+1].value+i.baseIndent)return!0;if(i.indent>=i.baseIndent+4)return!1;let n=(t.type==Kf.OrderedList?dp:up)(i,e,!1);return n>0&&(t.type!=Kf.BulletList||hp(i,e,!1)<0)&&i.text.charCodeAt(i.pos+n-1)==t.value}const np={[Kf.Blockquote]:(t,e,i)=>62==i.next&&(i.markers.push(Up(Kf.QuoteMark,e.lineStart+i.pos,e.lineStart+i.pos+1)),i.moveBase(i.pos+(sp(i.text.charCodeAt(i.pos+1))?2:1)),t.end=e.lineStart+i.text.length,!0),[Kf.ListItem]:(t,e,i)=>!(i.indent-1)&&(i.moveBaseColumn(i.baseIndent+t.value),!0),[Kf.OrderedList]:ip,[Kf.BulletList]:ip,[Kf.Document]:()=>!0};function sp(t){return 32==t||9==t||10==t||13==t}function rp(t,e=0){for(;ei&&sp(t.charCodeAt(e-1));)e--;return e}function ap(t){if(96!=t.next&&126!=t.next)return-1;let e=t.pos+1;for(;e-1&&t.depth==e.stack.length||n<3?-1:1}function cp(t,e){for(let i=t.stack.length-1;i>=0;i--)if(t.stack[i].type==e)return!0;return!1}function up(t,e,i){return 45!=t.next&&43!=t.next&&42!=t.next||t.pos!=t.text.length-1&&!sp(t.text.charCodeAt(t.pos+1))||!(!i||cp(e,Kf.BulletList)||t.skipSpace(t.pos+2)=48&&s<=57;){if(n++,n==t.text.length)return-1;s=t.text.charCodeAt(n)}return n==t.pos||n>t.pos+9||46!=s&&41!=s||nt.pos+1||49!=t.next)?-1:n+1-t.pos}function fp(t){if(35!=t.next)return-1;let e=t.pos+1;for(;e6?-1:i}function pp(t){if(45!=t.next&&61!=t.next||t.indent>=t.baseIndent+4)return-1;let e=t.pos+1;for(;e/,mp=/\?>/,bp=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*/i.exec(n);if(r)return t.append(Up(Kf.Comment,i,i+1+r[0].length));let o=/^\?[^]*?\?>/.exec(n);if(o)return t.append(Up(Kf.ProcessingInstruction,i,i+1+o[0].length));let a=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(n);return a?t.append(Up(Kf.HTMLTag,i,i+1+a[0].length)):-1},Emphasis(t,e,i){if(95!=e&&42!=e)return-1;let n=i+1;for(;t.char(n)==e;)n++;let s=t.slice(i-1,i),r=t.slice(n,n+1),o=jp.test(s),a=jp.test(r),l=/\s|^$/.test(s),h=/\s|^$/.test(r),c=!h&&(!a||l||o),u=!l&&(!o||h||a),d=c&&(42==e||!u||o),f=u&&(42==e||!c||a);return t.append(new Ip(95==e?Yp:qp,i,n,(d?1:0)|(f?2:0)))},HardBreak(t,e,i){if(92==e&&10==t.char(i+1))return t.append(Up(Kf.HardBreak,i,i+2));if(32==e){let e=i+1;for(;32==t.char(e);)e++;if(10==t.char(e)&&e>=i+2)return t.append(Up(Kf.HardBreak,i,e+1))}return-1},Link:(t,e,i)=>91==e?t.append(new Ip(Lp,i,i+1,1)):-1,Image:(t,e,i)=>33==e&&91==t.char(i+1)?t.append(new Ip(zp,i,i+2,1)):-1,LinkEnd(t,e,i){if(93!=e)return-1;for(let e=t.parts.length-1;e>=0;e--){let n=t.parts[e];if(n instanceof Ip&&(n.type==Lp||n.type==zp)){if(!n.side||t.skipSpace(n.to)==i&&!/[(\[]/.test(t.slice(i+1,i+2)))return t.parts[e]=null,-1;let s=t.takeContent(e),r=t.parts[e]=Gp(t,s,n.type==Lp?Kf.Link:Kf.Image,n.from,i+1);if(n.type==Lp)for(let i=0;ie?Up(Kf.URL,e+i,s+i):s==t.length&&null}}function Hp(t,e,i){let n=t.charCodeAt(e);if(39!=n&&34!=n&&40!=n)return!1;let s=40==n?41:n;for(let n=e+1,r=!1;n=this.end?-1:this.text.charCodeAt(t-this.offset)}get end(){return this.offset+this.text.length}slice(t,e){return this.text.slice(t-this.offset,e-this.offset)}append(t){return this.parts.push(t),t.to}addDelimiter(t,e,i,n,s){return this.append(new Ip(t,e,i,(n?1:0)|(s?2:0)))}addElement(t){return this.append(t)}resolveMarkers(t){for(let e=t;e=t;o--){let t=this.parts[o];if(t instanceof Ip&&1&t.side&&t.type==i.type&&!(s&&(1&i.side||2&t.side)&&(t.to-t.from+r)%3==0&&((t.to-t.from)%3||r%3))){n=t;break}}if(!n)continue;let a=i.type.resolve,l=[],h=n.from,c=i.to;if(s){let t=Math.min(2,n.to-n.from,r);h=n.to-t,c=i.from+t,a=1==t?"Emphasis":"StrongEmphasis"}n.type.mark&&l.push(this.elt(n.type.mark,h,n.to));for(let t=o+1;t=0;e--){let i=this.parts[e];if(i instanceof Ip&&i.type==t)return e}return null}takeContent(t){let e=this.resolveMarkers(t);return this.parts.length=t,e}skipSpace(t){return rp(this.text,t-this.offset)+this.offset}elt(t,e,i,n){return"string"==typeof t?Up(this.parser.getNodeType(t),e,i,n):new Wp(t,e)}}function tO(t,e){if(!e.length)return t;if(!t.length)return e;let i=t.slice(),n=0;for(let t of e){for(;n(t?t-1:0))return!1;if(this.fragmentEnd<0){let t=this.fragment.to;for(;t>0&&"\n"!=this.input.read(t-1,t);)t--;this.fragmentEnd=t?t-1:0}let i=this.cursor;i||(i=this.cursor=this.fragment.tree.cursor(),i.firstChild());let n=t+this.fragment.offset;for(;i.to<=n;)if(!i.parent())return!1;for(;;){if(i.from>=n)return this.fragment.from<=e;if(!i.childAfter(n))return!1}}matches(t){let e=this.cursor.tree;return e&&e.prop(ho.contextHash)==t}takeNodes(t){let e=this.cursor,i=this.fragment.offset,n=this.fragmentEnd-(this.fragment.openEnd?1:0),s=t.absoluteLineStart,r=s,o=t.block.children.length,a=r,l=o;for(;;){if(e.to-i>n){if(e.type.isAnonymous&&e.firstChild())continue;break}if(t.dontInject.add(e.tree),t.addNode(e.tree,e.from-i),e.type.is("Block")&&(eO.indexOf(e.type.id)<0?(r=e.to-i,o=t.block.children.length):(r=a,o=l,a=e.to-i,l=t.block.children.length)),!e.nextSibling())break}for(;t.block.children.length>o;)t.block.children.pop(),t.block.positions.pop();return r-s}}const nO=ea({"Blockquote/...":Sa.quote,HorizontalRule:Sa.contentSeparator,"ATXHeading1/... SetextHeading1/...":Sa.heading1,"ATXHeading2/... SetextHeading2/...":Sa.heading2,"ATXHeading3/...":Sa.heading3,"ATXHeading4/...":Sa.heading4,"ATXHeading5/...":Sa.heading5,"ATXHeading6/...":Sa.heading6,"Comment CommentBlock":Sa.comment,Escape:Sa.escape,Entity:Sa.character,"Emphasis/...":Sa.emphasis,"StrongEmphasis/...":Sa.strong,"Link/... Image/...":Sa.link,"OrderedList/... BulletList/...":Sa.list,"BlockQuote/...":Sa.quote,"InlineCode CodeText":Sa.monospace,URL:Sa.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":Sa.processingInstruction,"CodeInfo LinkLabel":Sa.labelName,LinkTitle:Sa.string,Paragraph:Sa.content}),sO=new Zp(new po(Ep).extend(nO),Object.keys(Sp).map((t=>Sp[t])),Object.keys(Sp).map((t=>$p[t])),Object.keys(Sp),Pp,np,Object.keys(Np).map((t=>Np[t])),Object.keys(Np),[]);function rO(t,e,i){let n=[];for(let s=t.firstChild,r=e;;s=s.nextSibling){let t=s?s.from:i;if(t>r&&n.push({from:r,to:t}),!s)break;r=s.to}return n}const oO={resolve:"Strikethrough",mark:"StrikethroughMark"},aO={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":Sa.strikethrough}},{name:"StrikethroughMark",style:Sa.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,i){if(126!=e||126!=t.char(i+1)||126==t.char(i+2))return-1;let n=t.slice(i-1,i),s=t.slice(i+2,i+3),r=/\s|^$/.test(n),o=/\s|^$/.test(s),a=jp.test(n),l=jp.test(s);return t.addDelimiter(oO,i,i+2,!o&&(!l||r||a),!r&&(!a||o||l))},after:"Emphasis"}]};function lO(t,e,i=0,n,s=0){let r=0,o=!0,a=-1,l=-1,h=!1,c=()=>{n.push(t.elt("TableCell",s+a,s+l,t.parser.parseInline(e.slice(a,l),s+a)))};for(let u=i;u-1)&&r++,o=!1,n&&(a>-1&&c(),n.push(t.elt("TableDelimiter",u+s,u+s+1))),a=l=-1),h=!h&&92==i}return a>-1&&(r++,n&&c()),r}function hO(t,e){for(let i=e;ihO(e.content,0)?new uO:null,endLeaf(t,e,i){if(i.parsers.some((t=>t instanceof uO))||!hO(e.text,e.basePos))return!1;let n=t.scanLine(t.absoluteLineEnd+1).text;return cO.test(n)&&lO(t,e.text,e.basePos)==lO(t,n,e.basePos)},before:"SetextHeading"}]};class fO{nextLine(){return!1}finish(t,e){return t.addLeafElement(e,t.elt("Task",e.start,e.start+e.content.length,[t.elt("TaskMarker",e.start,e.start+3),...t.parser.parseInline(e.content.slice(3),e.start+3)])),!0}}const pO=[dO,{defineNodes:[{name:"Task",block:!0,style:Sa.list},{name:"TaskMarker",style:Sa.atom}],parseBlock:[{name:"TaskList",leaf:(t,e)=>/^\[[ xX]\]/.test(e.content)&&"ListItem"==t.parentType().name?new fO:null,after:"SetextHeading"}]},aO];function OO(t,e,i){return(n,s,r)=>{if(s!=t||n.char(r+1)==t)return-1;let o=[n.elt(i,r,r+1)];for(let s=r+1;s=65&&r<=90||95==r||r>=97&&r<=122||r>=161;)s+=String.fromCharCode(n),n=t.peek(++e);var r;return RO=t,EO=i,TO=s?s.toLowerCase():n==MO||n==DO?void 0:null}const MO=63,DO=33;function WO(t,e){this.name=t,this.parent=e,this.hash=e?e.hash:0;for(let e=0;eUO.indexOf(e)>-1?new WO(VO(n,1)||"",t):t,reduce:(t,e)=>e==wO&&t?t.parent:t,reuse(t,e,i,n){let s=e.type.id;return 6==s||36==s?new WO(VO(n,1)||"",t):t},hash:t=>t?t.hash:0,strict:!1}),qO=new nf(((t,e)=>{if(60!=t.next)return void(t.next<0&&e.context&&t.acceptToken(57));t.advance();let i=47==t.next;i&&t.advance();let n=VO(t,0);if(void 0===n)return;if(!n)return t.acceptToken(i?14:6);let s=e.context?e.context.name:null;if(i){if(n==s)return t.acceptToken(11);if(s&&XO[s])return t.acceptToken(57,-2);if(e.dialectEnabled(0))return t.acceptToken(12);for(let t=e.context;t;t=t.parent)if(t.name==n)return;t.acceptToken(13)}else{if("script"==n)return t.acceptToken(7);if("style"==n)return t.acceptToken(8);if("textarea"==n)return t.acceptToken(9);if(_O.hasOwnProperty(n))return t.acceptToken(10);s&&ZO[s]&&ZO[s][n]?t.acceptToken(57,-1):t.acceptToken(6)}}),{contextual:!0}),LO=new nf((t=>{for(let e=0,i=0;;i++){if(t.next<0){i&&t.acceptToken(58);break}if(45==t.next)e++;else{if(62==t.next&&e>=2){i>3&&t.acceptToken(58,-2);break}e=0}t.advance()}}));const zO=new nf(((t,e)=>{if(47==t.next&&62==t.peek(1)){let i=e.dialectEnabled(1)||function(t){for(;t;t=t.parent)if("svg"==t.name||"math"==t.name)return!0;return!1}(e.context);t.acceptToken(i?5:4,2)}else 62==t.next&&t.acceptToken(4,1)}));function IO(t,e,i){let n=2+t.length;return new nf((s=>{for(let r=0,o=0,a=0;;a++){if(s.next<0){a&&s.acceptToken(e);break}if(0==r&&60==s.next||1==r&&47==s.next||r>=2&&ro?s.acceptToken(e,-o):s.acceptToken(i,-(o-2));break}if((10==s.next||13==s.next)&&a){s.acceptToken(e,1);break}r=o=0}else o++;s.advance()}}))}const BO=IO("script",54,1),jO=IO("style",55,2),NO=IO("textarea",56,3),GO=ea({"Text RawText":Sa.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":Sa.angleBracket,TagName:Sa.tagName,"MismatchedCloseTag/TagName":[Sa.tagName,Sa.invalid],AttributeName:Sa.attributeName,"AttributeValue UnquotedAttributeValue":Sa.attributeValue,Is:Sa.definitionOperator,"EntityReference CharacterReference":Sa.character,Comment:Sa.blockComment,ProcessingInst:Sa.processingInstruction,DoctypeDecl:Sa.documentMeta}),FO=wf.deserialize({version:14,states:",xOVO!rOOO!WQ#tO'#CqO!]Q#tO'#CzO!bQ#tO'#C}O!gQ#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^O`^Oa^Ob^Oc^Ox^O{_O!dZO~OfaO~OfbO~OfcO~OfdO~OfeO~O!WfOPlP!ZlP~O!XiOQoP!ZoP~O!YlORrP!ZrP~OUSOVPOWQOXROYTOZqO[]O][O^^O`^Oa^Ob^Oc^Ox^O!dZO~O!ZrO~P#dO![sO!euO~OfvO~OfwO~OS|OhyO~OS!OOhyO~OS!QOhyO~OS!SOT!TOhyO~OS!TOhyO~O!WfOPlX!ZlX~OP!WO!Z!XO~O!XiOQoX!ZoX~OQ!ZO!Z!XO~O!YlORrX!ZrX~OR!]O!Z!XO~O!Z!XO~P#dOf!_O~O![sO!e!aO~OS!bO~OS!cO~Oi!dOSgXhgXTgX~OS!fOhyO~OS!gOhyO~OS!hOhyO~OS!iOT!jOhyO~OS!jOhyO~Of!kO~Of!lO~Of!mO~OS!nO~Ok!qO!`!oO!b!pO~OS!rO~OS!sO~OS!tO~Oa!uOb!uOc!uO!`!wO!a!uO~Oa!xOb!xOc!xO!b!wO!c!xO~Oa!uOb!uOc!uO!`!{O!a!uO~Oa!xOb!xOc!xO!b!{O!c!xO~OT~bac!dx{!d~",goto:"%p!`PPPPPPPPPPPPPPPPPPPP!a!gP!mPP!yP!|#P#S#Y#]#`#f#i#l#r#x!aP!a!aP$O$U$l$r$x%O%U%[%bPPPPPPPP%hX^OX`pXUOX`pezabcde{}!P!R!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ}bQ!PcQ!RdQ!UeZ!e{}!P!R!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:67,context:YO,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,21,30,33,36,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,29,32,35,37,"OpenTag"],["group",-9,14,17,18,19,20,39,40,41,42,"Entity",16,"Entity TextContent",-3,28,31,34,"TextContent Entity"]],propSources:[GO],skippedNodes:[0],repeatNodeCount:9,tokenData:"#%g!aR!YOX$qXY,QYZ,QZ[$q[]&X]^,Q^p$qpq,Qqr-_rs4ysv-_vw5iwxJ^x}-_}!OKP!O!P-_!P!Q$q!Q![-_![!]!!O!]!^-_!^!_!&W!_!`#$o!`!a&X!a!c-_!c!}!!O!}#R-_#R#S!!O#S#T3V#T#o!!O#o#s-_#s$f$q$f%W-_%W%o!!O%o%p-_%p&a!!O&a&b-_&b1p!!O1p4U-_4U4d!!O4d4e-_4e$IS!!O$IS$I`-_$I`$Ib!!O$Ib$Kh-_$Kh%#t!!O%#t&/x-_&/x&Et!!O&Et&FV-_&FV;'S!!O;'S;:j!&Q;:j;=`4s<%l?&r-_?&r?Ah!!O?Ah?BY$q?BY?Mn!!O?MnO$q!Z$|c`PkW!a`!cpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr$qrs&}sv$qvw+Pwx(tx!^$q!^!_*V!_!a&X!a#S$q#S#T&X#T;'S$q;'S;=`+z<%lO$q!R&bX`P!a`!cpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&Xq'UV`P!cpOv&}wx'kx!^&}!^!_(V!_;'S&};'S;=`(n<%lO&}P'pT`POv'kw!^'k!_;'S'k;'S;=`(P<%lO'kP(SP;=`<%l'kp([S!cpOv(Vx;'S(V;'S;=`(h<%lO(Vp(kP;=`<%l(Vq(qP;=`<%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!Jva!LaT!a`xPOr)esv)ew;'S)e;'S;=`)y<%lO)ea!LsP;=`<%l!Jv!R!L}Y!a`!cpOr!G_rs!HUsv!G_vw!Hpwx!Jvx!`!G_!`!a!Mm!a;'S!G_;'S;=`!N]<%lO!G_!R!MvV!a`!cpxPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!N`P;=`<%l!G_T!NhbhSOq!Hpqr!Ncrs!Hpsw!Ncwx!Hpx!P!Nc!P!Q!Hp!Q!_!Nc!_!a!Hp!a!b# p!b#s!Nc#s$f!Hp$f;'S!Nc;'S;=`#!}<%l?Ah!Nc?Ah?BY!Hp?BY?Mn!Nc?MnO!HpT# ubhSOq!Hpqr!Ncrs!Hpsw!Ncwx!Hpx!P!Nc!P!Q!Hp!Q!_!Nc!_!`!Hp!`!a!If!a#s!Nc#s$f!Hp$f;'S!Nc;'S;=`#!}<%l?Ah!Nc?Ah?BY!Hp?BY?Mn!Nc?MnO!HpT##QP;=`<%l!Nc!V##^chS!a`!cpOq!G_qr!Eyrs!HUsv!Eyvw!Ncwx!Jvx!P!Ey!P!Q!G_!Q!_!Ey!_!`!G_!`!a!Mm!a#s!Ey#s$f!G_$f;'S!Ey;'S;=`#$i<%l?Ah!Ey?Ah?BY!G_?BY?Mn!Ey?MnO!G_!V#$lP;=`<%l!Ey!V#$zXiS`P!a`!cpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X",tokenizers:[BO,jO,NO,zO,qO,LO,0,1,2,3,4,5],topRules:{Document:[0,15]},dialects:{noMatch:0,selfClosing:485},tokenPrec:487});function HO(t,e){let i=Object.create(null);for(let n of t.getChildren(yO)){let t=n.getChild(SO),s=n.getChild(xO)||n.getChild(kO);t&&(i[e.read(t.from,t.to)]=s?s.type.id==xO?e.read(s.from+1,s.to-1):e.read(s.from,s.to):"")}return i}function JO(t,e){let i=t.getChild(vO);return i?e.read(i.from,i.to):" "}function KO(t,e,i){let n;for(let s of i)if(!s.attrs||s.attrs(n||(n=HO(t.node.parent.firstChild,e))))return{parser:s.parser};return null}function tg(t=[],e=[]){let i=[],n=[],s=[],r=[];for(let e of t){("script"==e.tag?i:"style"==e.tag?n:"textarea"==e.tag?s:r).push(e)}let o=e.length?Object.create(null):null;for(let t of e)(o[t.name]||(o[t.name]=[])).push(t);return Do(((t,e)=>{let a=t.type.id;if(a==QO)return KO(t,e,i);if(a==$O)return KO(t,e,n);if(a==PO)return KO(t,e,s);if(a==wO&&r.length){let i,n=t.node,s=n.firstChild,o=s&&JO(s,e);if(o)for(let t of r)if(t.tag==o&&(!t.attrs||t.attrs(i||(i=HO(n,e))))){let e=n.lastChild;return{parser:t.parser,overlay:[{from:s.to,to:e.type.id==CO?e.from:n.to}]}}}if(o&&a==yO){let i,n=t.node;if(i=n.firstChild){let t=o[e.read(i.from,i.to)];if(t)for(let i of t){if(i.tagName&&i.tagName!=JO(n.parent,e))continue;let t=n.lastChild;if(t.type.id==xO){let e=t.from+1,n=t.lastChild,s=t.to-(n&&n.isError?0:1);if(s>e)return{parser:i.parser,overlay:[{from:e,to:s}]}}else if(t.type.id==kO)return{parser:i.parser,overlay:[{from:t.from,to:t.to}]}}}}return null}))}const eg=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288];function ig(t){return t>=65&&t<=90||t>=97&&t<=122||t>=161}const ng=new nf(((t,e)=>{for(let n=!1,s=0,r=0;;r++){let{next:o}=t;if(!(ig(o)||45==o||95==o||n&&(i=o,i>=48&&i<=57))){n&&t.acceptToken(40==o?95:2==s&&e.canShift(2)?2:96);break}!n&&(45!=o||r>0)&&(n=!0),s===r&&45==o&&s++,t.advance()}var i})),sg=new nf((t=>{if(eg.includes(t.peek(-1))){let{next:e}=t;(ig(e)||95==e||35==e||46==e||91==e||58==e||45==e)&&t.acceptToken(94)}})),rg=new nf((t=>{if(!eg.includes(t.peek(-1))){let{next:e}=t;if(37==e&&(t.advance(),t.acceptToken(1)),ig(e)){do{t.advance()}while(ig(t.next));t.acceptToken(1)}}})),og=ea({"AtKeyword import charset namespace keyframes media supports":Sa.definitionKeyword,"from to selector":Sa.keyword,NamespaceName:Sa.namespace,KeyframeName:Sa.labelName,TagName:Sa.tagName,ClassName:Sa.className,PseudoClassName:Sa.constant(Sa.className),IdName:Sa.labelName,"FeatureName PropertyName":Sa.propertyName,AttributeName:Sa.attributeName,NumberLiteral:Sa.number,KeywordQuery:Sa.keyword,UnaryQueryOp:Sa.operatorKeyword,"CallTag ValueName":Sa.atom,VariableName:Sa.variableName,Callee:Sa.operatorKeyword,Unit:Sa.unit,"UniversalSelector NestingSelector":Sa.definitionOperator,MatchOp:Sa.compareOperator,"ChildOp SiblingOp, LogicOp":Sa.logicOperator,BinOp:Sa.arithmeticOperator,Important:Sa.modifier,Comment:Sa.blockComment,ParenthesizedContent:Sa.special(Sa.name),ColorLiteral:Sa.color,StringLiteral:Sa.string,":":Sa.punctuation,"PseudoOp #":Sa.derefOperator,"; ,":Sa.separator,"( )":Sa.paren,"[ ]":Sa.squareBracket,"{ }":Sa.brace}),ag={__proto__:null,lang:32,"nth-child":32,"nth-last-child":32,"nth-of-type":32,"nth-last-of-type":32,dir:32,"host-context":32,url:60,"url-prefix":60,domain:60,regexp:60,selector:134},lg={__proto__:null,"@import":114,"@media":138,"@charset":142,"@namespace":146,"@keyframes":152,"@supports":164},hg={__proto__:null,not:128,only:128,from:158,to:160},cg=wf.deserialize({version:14,states:"7WQYQ[OOO#_Q[OOOOQP'#Cd'#CdOOQP'#Cc'#CcO#fQ[O'#CfO$YQXO'#CaO$aQ[O'#ChO$lQ[O'#DPO$qQ[O'#DTOOQP'#Ed'#EdO$vQdO'#DeO%bQ[O'#DrO$vQdO'#DtO%sQ[O'#DvO&OQ[O'#DyO&TQ[O'#EPO&cQ[O'#EROOQS'#Ec'#EcOOQS'#ET'#ETQYQ[OOO&jQXO'#CdO'_QWO'#DaO'dQWO'#EjO'oQ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%^XDuU]POy%^z![%^![!]EX!];'S%^;'S;=`%o<%lO%^XE`S^PoWOy%^z;'S%^;'S;=`%o<%lO%^_EqS!WVOy%^z;'S%^;'S;=`%o<%lO%^YFSSzQOy%^z;'S%^;'S;=`%o<%lO%^XFeU|POy%^z!`%^!`!aFw!a;'S%^;'S;=`%o<%lO%^XGOS|PoWOy%^z;'S%^;'S;=`%o<%lO%^XG_WOy%^z!c%^!c!}Gw!}#T%^#T#oGw#o;'S%^;'S;=`%o<%lO%^XHO[!YPoWOy%^z}%^}!OGw!O!Q%^!Q![Gw![!c%^!c!}Gw!}#T%^#T#oGw#o;'S%^;'S;=`%o<%lO%^XHySxPOy%^z;'S%^;'S;=`%o<%lO%^^I[SvUOy%^z;'S%^;'S;=`%o<%lO%^XIkUOy%^z#b%^#b#cI}#c;'S%^;'S;=`%o<%lO%^XJSUoWOy%^z#W%^#W#XJf#X;'S%^;'S;=`%o<%lO%^XJmS!`PoWOy%^z;'S%^;'S;=`%o<%lO%^XJ|UOy%^z#f%^#f#gJf#g;'S%^;'S;=`%o<%lO%^XKeS!RPOy%^z;'S%^;'S;=`%o<%lO%^_KvS!QVOy%^z;'S%^;'S;=`%o<%lO%^ZLXU!PPOy%^z!_%^!_!`6y!`;'S%^;'S;=`%o<%lO%^WLnP;=`<%l$}",tokenizers:[sg,rg,ng,0,1,2,3],topRules:{StyleSheet:[0,4],Styles:[1,84]},specialized:[{term:95,get:t=>ag[t]||-1},{term:56,get:t=>lg[t]||-1},{term:96,get:t=>hg[t]||-1}],tokenPrec:1123});let ug=null;function dg(){if(!ug&&"object"==typeof document&&document.body){let{style:t}=document.body,e=[],i=new Set;for(let n in t)"cssText"!=n&&"cssFloat"!=n&&"string"==typeof t[n]&&(/[A-Z]/.test(n)&&(n=n.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))),i.has(n)||(e.push(n),i.add(n)));ug=e.sort().map((t=>({type:"property",label:t})))}return ug||[]}const fg=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map((t=>({type:"class",label:t}))),pg=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map((t=>({type:"keyword",label:t}))).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map((t=>({type:"constant",label:t})))),Og=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map((t=>({type:"type",label:t}))),gg=/^(\w[\w-]*|-\w[\w-]*|)$/,mg=/^-(-[\w-]*)?$/;const bg=new Ro,wg=["Declaration"];function vg(t){for(let e=t;;){if(e.type.isTop)return e;if(!(e=e.parent))return t}}function yg(t,e,i){if(e.to-e.from>4096){let n=bg.get(e);if(n)return n;let s=[],r=new Set,o=e.cursor(mo.IncludeAnonymous);if(o.firstChild())do{for(let e of yg(t,o.node,i))r.has(e.label)||(r.add(e.label),s.push(e))}while(o.nextSibling());return bg.set(e,s),s}{let n=[],s=new Set;return e.cursor().iterate((e=>{var r;if(i(e)&&e.matchContext(wg)&&":"==(null===(r=e.node.nextSibling)||void 0===r?void 0:r.name)){let i=t.sliceString(e.from,e.to);s.has(i)||(s.add(i),n.push({label:i,type:"variable"}))}})),n}}const Sg=t=>e=>{let{state:i,pos:n}=e,s=Xa(i).resolveInner(n,-1),r=s.type.isError&&s.from==s.to-1&&"-"==i.doc.sliceString(s.from,s.to);if("PropertyName"==s.name||(r||"TagName"==s.name)&&/^(Block|Styles)$/.test(s.resolve(s.to).name))return{from:s.from,options:dg(),validFor:gg};if("ValueName"==s.name)return{from:s.from,options:pg,validFor:gg};if("PseudoClassName"==s.name)return{from:s.from,options:fg,validFor:gg};if(t(s)||(e.explicit||r)&&function(t,e){var i;if(("("==t.name||t.type.isError)&&(t=t.parent||t),"ArgList"!=t.name)return!1;let n=null===(i=t.parent)||void 0===i?void 0:i.firstChild;return"Callee"==(null==n?void 0:n.name)&&"var"==e.sliceString(n.from,n.to)}(s,i.doc))return{from:t(s)||r?s.from:n,options:yg(i.doc,vg(s),t),validFor:mg};if("TagName"==s.name){for(let{parent:t}=s;t;t=t.parent)if("Block"==t.name)return{from:s.from,options:dg(),validFor:gg};return{from:s.from,options:Og,validFor:gg}}if(!e.explicit)return null;let o=s.resolve(n),a=o.childBefore(n);return a&&":"==a.name&&"PseudoClassSelector"==o.name?{from:n,options:fg,validFor:gg}:a&&":"==a.name&&"Declaration"==o.name||"ArgList"==o.name?{from:n,options:pg,validFor:gg}:"Block"==o.name||"Styles"==o.name?{from:n,options:dg(),validFor:gg}:null},xg=Sg((t=>"VariableName"==t.name)),kg=_a.define({name:"css",parser:cg.configure({props:[Na.add({Declaration:il()}),rl.add({"Block KeyframeList":ol})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function Qg(){return new Ua(kg,kg.data.of({autocomplete:xg}))}const $g=["_blank","_self","_top","_parent"],Pg=["ascii","utf-8","utf-16","latin1","latin1"],Cg=["get","post","put","delete"],_g=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Xg=["true","false"],Zg={},Ag={a:{attrs:{href:null,ping:null,type:null,media:null,target:$g,hreflang:null}},abbr:Zg,address:Zg,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Zg,aside:Zg,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Zg,base:{attrs:{href:null,target:$g}},bdi:Zg,bdo:Zg,blockquote:{attrs:{cite:null}},body:Zg,br:Zg,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Zg,center:Zg,cite:Zg,code:Zg,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:Zg,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Zg,div:Zg,dl:Zg,dt:Zg,em:Zg,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Zg,figure:Zg,footer:Zg,form:{attrs:{action:null,name:null,"accept-charset":Pg,autocomplete:["on","off"],enctype:_g,method:Cg,novalidate:["novalidate"],target:$g}},h1:Zg,h2:Zg,h3:Zg,h4:Zg,h5:Zg,h6:Zg,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Zg,hgroup:Zg,hr:Zg,html:{attrs:{manifest:null}},i:Zg,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:Zg,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Zg,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:Zg,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Pg,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:Zg,noscript:Zg,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:Zg,param:{attrs:{name:null,value:null}},pre:Zg,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Zg,rt:Zg,ruby:Zg,samp:Zg,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Pg}},section:Zg,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Zg,source:{attrs:{src:null,type:null,media:null}},span:Zg,strong:Zg,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Zg,summary:Zg,sup:Zg,table:Zg,tbody:Zg,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Zg,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:Zg,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Zg,time:{attrs:{datetime:null}},title:Zg,tr:Zg,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Zg,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:Zg},Tg={accesskey:null,class:null,contenteditable:Xg,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Xg,autocorrect:Xg,autocapitalize:Xg,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Xg,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Xg,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Xg,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Xg,"aria-hidden":Xg,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Xg,"aria-multiselectable":Xg,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Xg,"aria-relevant":null,"aria-required":Xg,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},Rg="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map((t=>"on"+t));for(let t of Rg)Tg[t]=null;class Eg{constructor(t,e){this.tags=Object.assign(Object.assign({},Ag),t),this.globalAttrs=Object.assign(Object.assign({},Tg),e),this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}function Vg(t,e,i=t.length){if(!e)return"";let n=e.firstChild,s=n&&n.getChild("TagName");return s?t.sliceString(s.from,Math.min(s.to,i)):""}function Mg(t,e=!1){for(let i=t.parent;i;i=i.parent)if("Element"==i.name){if(!e)return i;e=!1}return null}function Dg(t,e,i){let n=i.tags[Vg(t,Mg(e,!0))];return(null==n?void 0:n.children)||i.allTags}function Wg(t,e){let i=[];for(let n=e;n=Mg(n);){let s=Vg(t,n);if(s&&"CloseTag"==n.lastChild.name)break;s&&i.indexOf(s)<0&&("EndTag"==e.name||e.from>=n.firstChild.to)&&i.push(s)}return i}Eg.default=new Eg;const Ug=/^[:\-\.\w\u00b7-\uffff]*$/;function Yg(t,e,i,n,s){let r=/\s*>/.test(t.sliceDoc(s,s+5))?"":">";return{from:n,to:s,options:Dg(t.doc,i,e).map((t=>({label:t,type:"type"}))).concat(Wg(t.doc,i).map(((t,e)=>({label:"/"+t,apply:"/"+t+r,type:"type",boost:99-e})))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function qg(t,e,i,n){let s=/\s*>/.test(t.sliceDoc(n,n+5))?"":">";return{from:i,to:n,options:Wg(t.doc,e).map(((t,e)=>({label:t,apply:t+s,type:"type",boost:99-e}))),validFor:Ug}}function Lg(t,e){let{state:i,pos:n}=e,s=Xa(i).resolveInner(n),r=s.resolve(n,-1);for(let t,e=n;s==r&&(t=r.childBefore(e));){let i=t.lastChild;if(!i||!i.type.isError||i.from({label:t,type:"property"}))),validFor:Ug}}(i,t,r,"AttributeName"==r.name?r.from:n,n):"Is"==r.name||"AttributeValue"==r.name||"UnquotedAttributeValue"==r.name?function(t,e,i,n,s){var r;let o,a=null===(r=i.parent)||void 0===r?void 0:r.getChild("AttributeName"),l=[];if(a){let r=t.sliceDoc(a.from,a.to),h=e.globalAttrs[r];if(!h){let n=Mg(i),s=n?e.tags[Vg(t.doc,n)]:null;h=(null==s?void 0:s.attrs)&&s.attrs[r]}if(h){let e=t.sliceDoc(n,s).toLowerCase(),i='"',r='"';/^['"]/.test(e)?(o='"'==e[0]?/^[^"]*$/:/^[^']*$/,i="",r=t.sliceDoc(s,s+1)==e[0]?"":e[0],e=e.slice(1),n++):o=/^[^\s<>='"]*$/;for(let t of h)l.push({label:t,apply:i+t+r,type:"constant"})}}return{from:n,to:s,options:l,validFor:o}}(i,t,r,"Is"==r.name?n:r.from,n):!e.explicit||"Element"!=s.name&&"Text"!=s.name&&"Document"!=s.name?null:function(t,e,i,n){let s=[],r=0;for(let n of Dg(t.doc,i,e))s.push({label:"<"+n,type:"type"});for(let e of Wg(t.doc,i))s.push({label:"",type:"type",boost:99-r++});return{from:n,to:n,options:s,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}(i,t,r,n)}function zg(t){let{extraTags:e,extraGlobalAttributes:i}=t,n=i||e?new Eg(e,i):Eg.default;return t=>Lg(n,t)}const Ig=[{tag:"script",attrs:t=>"text/typescript"==t.type||"ts"==t.lang,parser:zf.parser},{tag:"script",attrs:t=>"text/babel"==t.type||"text/jsx"==t.type,parser:If.parser},{tag:"script",attrs:t=>"text/typescript-jsx"==t.type,parser:Bf.parser},{tag:"script",attrs:t=>!t.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(t.type),parser:qf.parser},{tag:"style",attrs:t=>(!t.lang||"css"==t.lang)&&(!t.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(t.type)),parser:kg.parser}],Bg=[{name:"style",parser:kg.parser.configure({top:"Styles"})}].concat(Rg.map((t=>({name:t,parser:qf.parser})))),jg=_a.define({name:"html",parser:FO.configure({props:[Na.add({Element(t){let e=/^(\s*)(<\/)?/.exec(t.textAfter);return t.node.to<=t.pos+e[0].length?t.continue():t.lineIndent(t.node.from)+(e[2]?0:t.unit)},"OpenTag CloseTag SelfClosingTag":t=>t.column(t.node.from)+t.unit,Document(t){if(t.pos+/\s*/.exec(t.textAfter)[0].lengtht.getChild("TagName")})],wrap:tg(Ig,Bg)}),languageData:{commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-._"}});function Ng(t={}){let e,i="";!1===t.matchClosingTags&&(i="noMatch"),!0===t.selfClosingTags&&(i=(i?i+" ":"")+"selfClosing"),(t.nestedLanguages&&t.nestedLanguages.length||t.nestedAttributes&&t.nestedAttributes.length)&&(e=tg((t.nestedLanguages||[]).concat(Ig),(t.nestedAttributes||[]).concat(Bg)));let n=e||i?jg.configure({dialect:i,wrap:e}):jg;return new Ua(n,[jg.data.of({autocomplete:zg(t)}),!1!==t.autoCloseTags?Fg:[],Nf().support,Qg().support])}const Gg=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),Fg=Ts.inputHandler.of(((t,e,i,n)=>{if(t.composing||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!jg.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((e=>{var i,r,o;let a,{head:l}=e,h=Xa(s).resolveInner(l,-1);if("TagName"!=h.name&&"StartTag"!=h.name||(h=h.parent),">"==n&&"OpenTag"==h.name){if("CloseTag"!=(null===(r=null===(i=h.parent)||void 0===i?void 0:i.lastChild)||void 0===r?void 0:r.name)&&(a=Vg(s.doc,h.parent,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`${e?"":">"}`;return{range:A.cursor(l+1),changes:{from:l+(e?1:0),insert:i}}}}else if("/"==n&&"OpenTag"==h.name){let e=h.parent,i=null==e?void 0:e.parent;if(e.from==l-1&&"CloseTag"!=(null===(o=i.lastChild)||void 0===o?void 0:o.name)&&(a=Vg(s.doc,i,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`/${a}${e?"":">"}`,n=l+i.length+(e?1:0);return{range:A.cursor(n),changes:{from:l,insert:i}}}}return{range:e}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)})),Hg=Qa({commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}}}),Jg=new ho,Kg=sO.configure({props:[rl.add((t=>!t.is("Block")||t.is("Document")||null!=tm(t)?void 0:(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to}))),Jg.add(tm),Na.add({Document:()=>null}),ka.add({Document:Hg})]});function tm(t){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(t.name);return e?+e[1]:void 0}function em(t,e){let i=t;for(;;){let t,n=i.nextSibling;if(!n||null!=(t=tm(n.type))&&t<=e)break;i=n}return i.to}const im=sl.of(((t,e,i)=>{for(let n=Xa(t).resolveInner(i,-1);n&&!(n.fromi)return{from:i,to:e}}return null}));function nm(t){return new Pa(Hg,t,[im],"markdown")}const sm=nm(Kg),rm=nm(Kg.configure([pO,mO,gO,bO]));class om{constructor(t,e,i,n,s,r,o){this.node=t,this.from=e,this.to=i,this.spaceBefore=n,this.spaceAfter=s,this.type=r,this.item=o}blank(t,e=!0){let i=this.spaceBefore+("Blockquote"==this.node.name?">":"");if(null!=t){for(;i.length0;t--)i+=" ";return i+(e?this.spaceAfter:"")}marker(t,e){let i="OrderedList"==this.node.name?String(+lm(this.item,t)[2]+e):"";return this.spaceBefore+i+this.type+this.spaceAfter}}function am(t,e){let i=[];for(let e=t;e&&"Document"!=e.name;e=e.parent)"ListItem"!=e.name&&"Blockquote"!=e.name&&"FencedCode"!=e.name||i.push(e);let n=[];for(let t=i.length-1;t>=0;t--){let s,r=i[t],o=e.lineAt(r.from),a=r.from-o.from;if("FencedCode"==r.name)n.push(new om(r,a,a,"","","",null));else if("Blockquote"==r.name&&(s=/^[ \t]*>( ?)/.exec(o.text.slice(a))))n.push(new om(r,a,a+s[0].length,"",s[1],">",null));else if("ListItem"==r.name&&"OrderedList"==r.parent.name&&(s=/^([ \t]*)\d+([.)])([ \t]*)/.exec(o.text.slice(a)))){let t=s[3],e=s[0].length;t.length>=4&&(t=t.slice(0,t.length-4),e-=4),n.push(new om(r.parent,a,a+e,s[1],t,s[2],r))}else if("ListItem"==r.name&&"BulletList"==r.parent.name&&(s=/^([ \t]*)([-+*])([ \t]{1,4}\[[ xX]\])?([ \t]+)/.exec(o.text.slice(a)))){let t=s[4],e=s[0].length;t.length>4&&(t=t.slice(0,t.length-4),e-=4);let i=s[2];s[3]&&(i+=s[3].replace(/[xX]/," ")),n.push(new om(r.parent,a,a+e,s[1],t,i,r))}}return n}function lm(t,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(t.from,t.from+10))}function hm(t,e,i,n=0){for(let s=-1,r=t;;){if("ListItem"==r.name){let t=lm(r,e),o=+t[2];if(s>=0){if(o!=s+1)return;i.push({from:r.from+t[1].length,to:r.from+t[0].length,insert:String(s+2+n)})}s=o}let t=r.nextSibling;if(!t)break;r=t}}function cm(t){return"QuoteMark"==t.name||"ListMark"==t.name}const um=[{key:"Enter",run:({state:t,dispatch:e})=>{let i=Xa(t),{doc:n}=t,s=null,r=t.changeByRange((e=>{if(!e.empty||!rm.isActiveAt(t,e.from))return s={range:e};let r=e.from,o=n.lineAt(r),a=am(i.resolveInner(r,-1),n);for(;a.length&&a[a.length-1].from>r-o.from;)a.pop();if(!a.length)return s={range:e};let l=a[a.length-1];if(l.to-l.spaceAfter.length>r-o.from)return s={range:e};let h=r>=l.to-l.spaceAfter.length&&!/\S/.test(o.text.slice(l.to));if(l.item&&h){if(l.node.firstChild.to>=r||o.from>0&&!/[^\s>]/.test(n.lineAt(o.from-1).text)){let t,e=a.length>1?a[a.length-2]:null,i="";e&&e.item?(t=o.from+e.from,i=e.marker(n,1)):t=o.from+(e?e.to:0);let s=[{from:t,to:r,insert:i}];return"OrderedList"==l.node.name&&hm(l.item,n,s,-2),e&&"OrderedList"==e.node.name&&hm(e.item,n,s),{range:A.cursor(t+i.length),changes:s}}{let e="";for(let t=0,i=a.length-2;t<=i;t++)e+=a[t].blank(t\s*$/.exec(i.text);if(s&&s.index==l.from){let n=t.changes([{from:i.from+s.index,to:i.to},{from:o.from+l.from,to:o.to}]);return{range:e.map(n),changes:n}}}let c=[];"OrderedList"==l.node.name&&hm(l.item,n,c);let u=l.item&&l.item.from]*/.exec(o.text)[0].length>=l.to)for(let t=0,e=a.length-1;t<=e;t++)d+=t!=e||u?a[t].blank(to.from&&/\s/.test(o.text.charAt(f-o.from-1));)f--;return d=t.lineBreak+d,c.push({from:f,to:r,insert:d}),{range:A.cursor(f+d.length),changes:c}}));return!s&&(e(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0)}},{key:"Backspace",run:({state:t,dispatch:e})=>{let i=Xa(t),n=null,s=t.changeByRange((e=>{let s=e.from,{doc:r}=t;if(e.empty&&rm.isActiveAt(t,e.from)){let t=r.lineAt(s),n=am(function(t,e){let i=t.resolveInner(e,-1),n=e;cm(i)&&(n=i.from,i=i.parent);for(let t;t=i.childBefore(n);)if(cm(t))n=t.from;else{if("OrderedList"!=t.name&&"BulletList"!=t.name)break;i=t.lastChild,n=i.to}return i}(i,s),r);if(n.length){let i=n[n.length-1],r=i.to-i.spaceAfter.length+(i.spaceAfter?1:0);if(s-t.from>r&&!/\S/.test(t.text.slice(r,s-t.from)))return{range:A.cursor(t.from+r),changes:{from:t.from+r,to:s}};if(s-t.from==r&&(!i.item||t.from<=i.item.from||!/\S/.test(t.text.slice(0,i.to)))){let n=t.from+i.from;if(i.item&&i.node.fromt.from-e.from||t.startSide-e.startSide)),ni.set(i)}getMatchingBracket(t){switch(t){case")":return"(";case"]":return"[";case"}":return"{";default:return null}}},{decorations:t=>t.decorations});var fm="[a-zA-Z\\$][a-zA-Z0-9\\$]*",pm="(?:\\.\\d+|\\d+\\.\\d*|\\d+)",Om="(?:`(?:`?"+pm+")?)",gm=new RegExp("(?:(?:\\d+)(?:\\^\\^(?:\\.\\w+|\\w+\\.\\w*|\\w+)"+Om+"?(?:\\*\\^[+-]?\\d+)?))"),mm=new RegExp("(?:"+pm+Om+"?(?:\\*\\^[+-]?\\d+)?)"),bm=new RegExp("(?:`?)(?:"+fm+")(?:`(?:"+fm+"))*(?:`?)");let wm=[];const vm=["True","False","All","None","Null","Full","$Failed","$Aborted"];function ym(t,e){var i;return'"'===(i=t.next())?(e.tokenize=Sm,e.tokenize(t,e)):"("===i&&t.eat("*")?(e.commentLevel++,e.tokenize=xm,e.tokenize(t,e)):(t.backUp(1),t.match(gm,!0,!1)||t.match(mm,!0,!1)?"number":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::usage)/,!0,!1)?"meta":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::[a-zA-Z\$][a-zA-Z0-9\$]*):?/,!0,!1)?"string.special":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*\s*:)(?:(?:[a-zA-Z\$][a-zA-Z0-9\$]*)|(?:[^:=>~@\^\&\*\)\[\]'\?,\|])).*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+/,!0,!1)||t.match(/_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)?"variableName.special":t.match(/\\\[[a-zA-Z\$][a-zA-Z0-9\$]*\]/,!0,!1)?"character":t.match(/(?:\[|\]|{|}|\(|\))/,!0,!1)?"bracket":t.match(/(?:#[a-zA-Z\$][a-zA-Z0-9\$]*|#+[0-9]?)/,!0,!1)?"variableName.constant":t.match(bm,!0,!1)?vm.indexOf(t.current())>-1?"number":wm.indexOf(t.current())>-1||0==wm.length?"keyword":t.current()in e.localVars?"atom":(e.localVars[t.current()]=!0,"function"):t.match(/(?:\\|\+|\-|\*|\/|,|;|\.|:|@|~|=|>|<|&|\||_|`|'|\^|\?|!|%)/,!0,!1)?"operator":(t.next(),"error"))}function Sm(t,e){for(var i,n=!1,s=!1;null!=(i=t.next());){if('"'===i&&!s){n=!0;break}s=!s&&"\\"===i}return n&&!s&&(e.tokenize=ym),"string"}function xm(t,e){for(var i,n;e.commentLevel>0&&null!=(n=t.next());)"("===i&&"*"===n&&e.commentLevel++,"*"===i&&")"===n&&e.commentLevel--,i=n;return e.commentLevel<=0&&(e.tokenize=ym),"comment"}const km={name:"mathematica",extendVariables:function(t){},startState:function(){return{tokenize:ym,commentLevel:0,localVars:{}}},token:function(t,e){return t.eatSpace()?null:e.tokenize(t,e)},languageData:{commentTokens:{block:{open:"(*",close:"*)"}}}};let Qm={of:t=>[Gl.define(km),Yd({override:[async e=>function(t,e){let i=t.matchBefore(/\w*/);return i.from!==i.to||t.explicit?{from:i.from,options:e.data}:null}(e,t)]}),Ys.of([{key:"Escape",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((t=>{let{from:e,to:i}=t;return{changes:{from:e,to:i,insert:"EC"},range:A.cursor(e+2)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])],reBuild:t=>{wm=t.map((t=>t.label))}};const $m=(t,e,i,n)=>{if(0==t.length)return;const s=(new Date).valueOf();let r=0;i.dom.loadingMark=!0;const o=i.dom.style.background;let a=0;console.log("Start animation");const l=setInterval((()=>{i.dom.style.setProperty("background","hsl("+a+"deg 100% 97%)","important"),a+=2,a>360&&(a=0)}),30);n.transaction(e,i,s,t.length);for(const a of t)Pm(a,((a,h)=>{n.file(e,i,s,a,h),r++,r>=t.length&&i.dom&&i.dom.loadingMark&&(i.dom.loadingMark=!1,setTimeout((()=>{i.dom.style.background=o,clearInterval(l),console.log("Stop animation")}),2e3))}),(()=>{console.warn("Fauilure");const t=i.dom.style.background;i.dom.style.background="rgb(255 189 189 / 97%)";let e=97;const n=setInterval((()=>{i.dom.style.background="rgb(255 189 189 / "+Math.round(e)+"%)",e*=.95}),30);clearInterval(l),setTimeout((()=>{clearInterval(n),i.dom.style.background=t}),3e3)}))};function Pm(t,e,i){const n=new FileReader;n.addEventListener("load",(n=>{const s=n.target.result;if(s.byteLength/1024/1024>15)return alert("Files > 15Mb are not supported for drag and drop"),void i();let r=base64ArrayBuffer(s);e(t.name,r)})),n.addEventListener("progress",(t=>{if(t.loaded&&t.total){const e=t.loaded/t.total*100;console.log(e)}})),n.readAsArrayBuffer(t)}const Cm=(t,e)=>Ts.domEventHandlers({drop(e,i){e.preventDefault();const n=[];e.dataTransfer.items?[...e.dataTransfer.items].forEach(((t,e)=>{if("file"===t.kind){const i=t.getAsFile();console.log(`… file[${e}].name = ${i.name}`),n.push(i)}})):[...e.dataTransfer.files].forEach(((t,e)=>{console.log(`… file[${e}].name = ${t.name}`),n.push(t)})),$m(n,e,i,t)},paste(t,i){let n=t.clipboardData||window.clipboardData;for(const s of n.items)if("string"===s.kind)switch(s.type){case"text/plain":break;case"image/png":t.preventDefault(),$m([s.getAsFile()],t,i,e)}else t.preventDefault(),$m([s.getAsFile()],t,i,e)}}),_m=new pr({regexp:/\\\[(\w+)\]/g,decoration:t=>ni.replace({widget:new Zm(t[1])})}),Xm=_i.fromClass(class{constructor(t){this.Greekholder=_m.createDeco(t)}update(t){this.Greekholder=_m.updateDeco(t,this.Greekholder)}},{decorations:t=>t.Greekholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Greekholder||ni.none))});class Zm extends ei{constructor(t){super(),this.name=t}eq(t){return this.name===t.name}toDOM(){let t=document.createElement("span");return t.innerHTML="&"+this.name.toLowerCase().replace("sqrt","radic").replace("undirectededge","harr").replace("directededge","rarr").replace(/capital(.*)/,((t,e)=>e.charAt(0).toUpperCase()+e.slice(1))).replace(/curly(.*)/,((t,e)=>e)).replace(/script(.*)/,((t,e)=>"el"+e.toLowerCase())).replace("transpose","#7488").replace("degree","deg")+";",t}ignoreEvent(){return!1}}const Am=new pr({regexp:/(->|<-)/g,decoration:t=>ni.replace({widget:new Tm(t[1])})});_i.fromClass(class{constructor(t){this.Arrowholder=Am.createDeco(t)}update(t){this.Arrowholder=Am.updateDeco(t,this.Arrowholder)}},{decorations:t=>t.Arrowholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Arrowholder||ni.none))});class Tm extends ei{constructor(t){super(),this.dir=t}eq(t){return this.dir===t.dir}toDOM(){let t=document.createElement("span");return"->"===this.dir?t.innerText="→":t.innerText="←",t}ignoreEvent(){return!1}}function Rm(t){if(!(t=t||{}).open)throw new Error('Balanced: please provide a "open" property');if(!t.close)throw new Error('Balanced: please provide a "close" property');if(this.balance=t.balance||!1,this.exceptions=t.exceptions||!1,this.caseInsensitive=t.caseInsensitive,this.head=t.head||t.open,this.head=Array.isArray(this.head)?this.head:[this.head],this.open=Array.isArray(t.open)?t.open:[t.open],this.close=Array.isArray(t.close)?t.close:[t.close],!Array.isArray(this.head)||!Array.isArray(this.open)||!Array.isArray(this.close)||this.head.length!==this.open.length||this.open.length!==this.close.length)throw new Error('Balanced: if you use arrays for a "head,open,close" you must use matching arrays for all options');var e=Dm(this.head.map(this.regExpFromArrayGroupedMap,this)),i=Dm(this.open.map(this.regExpFromArrayGroupedMap,this)),n=Dm(this.close.map(this.regExpFromArrayGroupedMap,this));this.regExp=Dm([e,i,n],"g"+(this.caseInsensitive?"i":"")),this.regExpGroupLength=this.head.length}function Em(t,e,i){for(var n=Mm(e.substr(0,i+1),/^.*\n?$/gim),s=Mm(e,/^.*\n?$/gim),r=n.length-1,o=i+1-(n.length?n[n.length-1].index:0),a="",l=2;l>=0;l--)r-l>=0&&s[r-l]&&(a+=e.substr(s[r-l].index,s[r-l].length)+"\n");for(l=0;l=0&&s[r+l]&&(a+=e.substr(s[r+l].index,s[r+l].length)+"\n");a=a.replace(/\t/g," ").replace(/\n$/,"");var h=new Error(t+" at "+(r+1)+":"+o+"\n\n"+a);return h.line=r+1,h.column=o,h.index=i,h}function Vm(t,e){return t>=e.index&&t<=e.index+e.length-1}function Mm(t,e){var i,n=new RegExp(e),s=[];if(t)for(;i=n.exec(t);)s.push({index:i.index,length:i[0].length,match:i[0]}),i[0].length||n.lastIndex++;return s}function Dm(t,e,i){var n=t.map((function(t){return t instanceof RegExp?t.source:function(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}(t)}),this).join("|");return n=i?"("+n+")":"(?:"+n+")",new RegExp(n,e||void 0)}Rm.prototype={regExpFromArrayGroupedMap:function(t){return Dm([t],null,!0)},matchContentsInBetweenBrackets:function(t,e){for(var i,n=new RegExp(this.regExp),s=[],r=[],o=null,a=!0;i=n.exec(t);){if(e){for(var l=!1,h=0;h{const i=((t,e,i)=>{var n,s=new RegExp(t),r=[];if(e)for(;n=s.exec(e);){if(i){for(var o=!1,a=0;a{new qm({open:"(*"+t+"[*)",close:"(*]"+t+"*)",balance:!1}).matchContentsInBetweenBrackets(e.value,[]).forEach((function(t){const s=e.value.slice(t.index+t.head.length,t.index+t.length-t.tail.length);n(i+t.index,{length:t.length,pos:i+t.index,argsPos:i+t.index+t.head.length,str:s})}))})(e,t,i,s)},o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)r(o,a)}var Im,Bm=function(){function t(t){var e=t.tag,i=t.decoration,n=t.decorate,s=t.boundary,r=t.maxLength,o=void 0===r?1e3:r;if(this.tag=e,n)this.addMatch=function(t,e,i,s){return n(s,i,i+t.length,t,e)};else if("function"==typeof i)this.addMatch=function(t,e,n,s){var r=i(t,e,n);r&&s(n,n+t.length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=function(t,e,n,s){return s(n,n+t.length,i)}}this.boundary=s,this.maxLength=o}return t.prototype.createDeco=function(t){for(var e=this,i=new Xt,n=i.add.bind(i),s=0,r=function(t,e){var i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;for(var n=[],s=0,r=i;s=a?n[n.length-1].to=l:n.push({from:a,to:l})}return n}(t,this.maxLength);st.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e},t.prototype.updateRange=function(t,e,i,n){for(var s=this,r=function(r){var a=Math.max(r.from,i),l=Math.min(r.to,n);if(l>a){var h=t.state.doc.lineAt(a),c=h.toh.from;a--)if(o.boundary.test(h.text[a-1-h.from])){u=a;break}for(;ld},add:f})}},o=this,a=0,l=t.visibleRanges;a{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*FB[*)((_)(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*FB[*)(("+s+")(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let Nm=class{constructor(t,e,i,n,s,r){this.view=e,this.visibleValue=t,this.placeholder=r,console.log(r),this.args=Lm(t.str,/\(\*,\*\)/gm);const o=this;let a,l;console.log("creating InstanceWidget"),a=Im({doc:o.args[0].body.slice(2,-1),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(o.visibleValue.pos),e.dispatch({selection:{anchor:o.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return l.dispatch({selection:{anchor:0}}),l.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){l.focus(),t.editorLastCursor=void 0}}])]}),l=Im({doc:o.args[2].body.slice(1,-2),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:a.state.doc.length}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:o.visibleValue.pos+o.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus(),t.editorLastCursor=void 0}}])]}),o.args[0].length=o.args[0].body.length,o.args[2].length=o.args[2].body.length,delete o.args[2].body,delete o.args[1].body,delete o.args[0].body,this.topEditor=a,this.bottomEditor=l}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="(("+t+")",s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length));const r=e.length-i[0].length;i[0].to=i[0].to+r,i[2].from=i[2].from+r,i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e="("+t+"))",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length));const r=e.length-i[2].length;i[2].to=i[2].to+r,i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t,e){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm),console.log("recreating InstanceWidget"),n=Im.state({doc:e.args[0].body.slice(2,-1),update:t=>e.applyChanges(t,0),eval:()=>{i.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(e.visibleValue.pos),i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus(),t.editorLastCursor=void 0}}])]}),s=Im.state({doc:e.args[2].body.slice(1,-2),update:t=>e.applyChanges(t,2),eval:()=>{e.view.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus(),t.editorLastCursor=void 0}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),console.log(e),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.placeholder=e,this.visibleValue.argsPos=t.argsPos}destroy(){this.topEditor.destroy(),this.bottomEditor.destroy()}},Gm=class extends ei{constructor(t,e,i,n){super(),this.view=i,this.visibleValue=t,this.reference=e,this.placeholder=n}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue,this),!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("fraction");const i=document.createElement("table");i.classList.add("container"),e.appendChild(i);const n=document.createElement("tbody");i.appendChild(n);const s=document.createElement("tr"),r=document.createElement("tr");n.appendChild(s),n.appendChild(r);const o=document.createElement("td");o.classList.add("enumenator"),s.appendChild(o);const a=document.createElement("td");r.appendChild(a);const l=this;return e.EditorWidget=new Nm(this.visibleValue,t,o,a,[],this),this.DOMElement=e,this.reference.push({destroy:()=>{l.destroy(e)}}),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const Fm=(t,e,i)=>new Bm({tag:"FB",decoration:n=>ni.replace({widget:new Gm(n,t,e,i)})}),Hm=t=>_i.fromClass(class{constructor(e){this.disposable=[],this.placeholder=Fm(this.disposable,e,this).createDeco(e),t.placeholder=this}update(t){this.placeholder=Fm(this.disposable,t,this).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var Jm;function Km(t){return Jm=t,[nb,Ys.of([{key:"Ctrl-2",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt[_](*]SqB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt["+s+"](*]SqB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let tb=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;this.sliceRanges=n,this.length=t.str.length,console.log("creating InstanceWidget"),this.editor=Jm({doc:t.str.slice(...n),parent:i,update:t=>r.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]})}applyChanges(t){const e=t,i={from:this.visibleValue.argsPos+5,to:this.visibleValue.argsPos+this.length-1,insert:e};console.log(this.visibleValue);const n=e.length+6-this.length;this.length=this.length+n,this.visibleValue.length=this.visibleValue.length+n,this.visibleValue.str="Sqrt["+e+"]",this.view.dispatch({changes:i})}update(t){if(this.visibleValue.str==t.str)this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos;else{console.warn("Out of sync"),this.visibleValue=t;const e=this.sliceRanges,i=this.editor,n=this,s=this.view;this.length=t.str.length;const r=Jm.state({doc:t.str.slice(...e),update:t=>n.applyChanges(t),eval:()=>{s.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos+n.visibleValue.length}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]});i.setState(r)}}destroy(){console.warn("destroy Instance of Widget!"),this.editor.destroy()}},eb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("sqroot");const i=this,n=document.createElement("span");return n.classList.add("radicand"),e.EditorWidget=new tb(this.visibleValue,t,n,[5,-1],[]),e.appendChild(n),this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const ib=(t,e)=>new Bm({tag:"SqB",decoration:i=>ni.replace({widget:new eb(i,t,e)})}),nb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=ib(this.disposable,t).createDeco(t)}update(t){this.placeholder=ib(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var sb;function rb(t){return sb=t,[hb,Ys.of([{key:"Ctrl--",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SbB[*)Subscript[_(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SbB[*)Subscript["+s+"(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let ob=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),console.log(r.visibleValue),o=sb({doc:r.args[0].body.slice(10),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){a.focus()}}])]}),a=sb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Subscript["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),console.log(e.visibleValue),n=sb.state({doc:e.args[0].body.slice(10),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus()}}])]}),s=sb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},ab=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sub");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new ob(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const lb=(t,e)=>new Bm({tag:"SbB",decoration:i=>ni.replace({widget:new ab(i,t,e)})}),hb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=lb(this.disposable,t).createDeco(t)}update(t){this.placeholder=lb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var cb;function ub(t){return cb=t,[Ob,Ys.of([{key:"Ctrl-6",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SpB[*)Power[_(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SpB[*)Power["+s+"(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let db=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),o=cb({doc:r.args[0].body.slice(6),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus()}}])]}),a=cb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Power["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),n=cb.state({doc:e.args[0].body.slice(6),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.bottomEditor.focus()}}])]}),s=cb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},fb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sup");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new db(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}destroy(t){t.EditorWidget.destroy()}};const pb=(t,e)=>new Bm({tag:"SpB",decoration:i=>ni.replace({widget:new fb(i,t,e)})}),Ob=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=pb(this.disposable,t).createDeco(t)}update(t){this.placeholder=pb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var gb={},mb={},bb={},wb={};function vb(t){let e=t.length;for(;--e>=0;)t[e]=0}const yb=256,Sb=286,xb=30,kb=15,Qb=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),$b=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Pb=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Cb=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_b=new Array(576);vb(_b);const Xb=new Array(60);vb(Xb);const Zb=new Array(512);vb(Zb);const Ab=new Array(256);vb(Ab);const Tb=new Array(29);vb(Tb);const Rb=new Array(xb);function Eb(t,e,i,n,s){this.static_tree=t,this.extra_bits=e,this.extra_base=i,this.elems=n,this.max_length=s,this.has_stree=t&&t.length}let Vb,Mb,Db;function Wb(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}vb(Rb);const Ub=t=>t<256?Zb[t]:Zb[256+(t>>>7)],Yb=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},qb=(t,e,i)=>{t.bi_valid>16-i?(t.bi_buf|=e<>16-t.bi_valid,t.bi_valid+=i-16):(t.bi_buf|=e<{qb(t,i[2*e],i[2*e+1])},zb=(t,e)=>{let i=0;do{i|=1&t,t>>>=1,i<<=1}while(--e>0);return i>>>1},Ib=(t,e,i)=>{const n=new Array(16);let s,r,o=0;for(s=1;s<=kb;s++)o=o+i[s-1]<<1,n[s]=o;for(r=0;r<=e;r++){let e=t[2*r+1];0!==e&&(t[2*r]=zb(n[e]++,e))}},Bb=t=>{let e;for(e=0;e{t.bi_valid>8?Yb(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},Nb=(t,e,i,n)=>{const s=2*e,r=2*i;return t[s]{const n=t.heap[i];let s=i<<1;for(;s<=t.heap_len&&(s{let n,s,r,o,a=0;if(0!==t.sym_next)do{n=255&t.pending_buf[t.sym_buf+a++],n+=(255&t.pending_buf[t.sym_buf+a++])<<8,s=t.pending_buf[t.sym_buf+a++],0===n?Lb(t,s,e):(r=Ab[s],Lb(t,r+yb+1,e),o=Qb[r],0!==o&&(s-=Tb[r],qb(t,s,o)),n--,r=Ub(n),Lb(t,r,i),o=$b[r],0!==o&&(n-=Rb[r],qb(t,n,o)))}while(a{const i=e.dyn_tree,n=e.stat_desc.static_tree,s=e.stat_desc.has_stree,r=e.stat_desc.elems;let o,a,l,h=-1;for(t.heap_len=0,t.heap_max=573,o=0;o>1;o>=1;o--)Gb(t,i,o);l=r;do{o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Gb(t,i,1),a=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=a,i[2*l]=i[2*o]+i[2*a],t.depth[l]=(t.depth[o]>=t.depth[a]?t.depth[o]:t.depth[a])+1,i[2*o+1]=i[2*a+1]=l,t.heap[1]=l++,Gb(t,i,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const i=e.dyn_tree,n=e.max_code,s=e.stat_desc.static_tree,r=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,l=e.stat_desc.max_length;let h,c,u,d,f,p,O=0;for(d=0;d<=kb;d++)t.bl_count[d]=0;for(i[2*t.heap[t.heap_max]+1]=0,h=t.heap_max+1;h<573;h++)c=t.heap[h],d=i[2*i[2*c+1]+1]+1,d>l&&(d=l,O++),i[2*c+1]=d,c>n||(t.bl_count[d]++,f=0,c>=a&&(f=o[c-a]),p=i[2*c],t.opt_len+=p*(d+f),r&&(t.static_len+=p*(s[2*c+1]+f)));if(0!==O){do{for(d=l-1;0===t.bl_count[d];)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[l]--,O-=2}while(O>0);for(d=l;0!==d;d--)for(c=t.bl_count[d];0!==c;)u=t.heap[--h],u>n||(i[2*u+1]!==d&&(t.opt_len+=(d-i[2*u+1])*i[2*u],i[2*u+1]=d),c--)}})(t,e),Ib(i,h,t.bl_count)},Jb=(t,e,i)=>{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),e[2*(i+1)+1]=65535,n=0;n<=i;n++)s=o,o=e[2*(n+1)+1],++a{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),n=0;n<=i;n++)if(s=o,o=e[2*(n+1)+1],!(++a{qb(t,0+(n?1:0),3),jb(t),Yb(t,i),Yb(t,~i),i&&t.pending_buf.set(t.window.subarray(e,e+i),t.pending),t.pending+=i};wb._tr_init=t=>{tw||((()=>{let t,e,i,n,s;const r=new Array(16);for(i=0,n=0;n<28;n++)for(Tb[n]=i,t=0;t<1<>=7;n{let s,r,o=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e{let e;for(Jb(t,t.dyn_ltree,t.l_desc.max_code),Jb(t,t.dyn_dtree,t.d_desc.max_code),Hb(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*Cb[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=i+5,i+4<=s&&-1!==e?ew(t,e,i,n):4===t.strategy||r===s?(qb(t,2+(n?1:0),3),Fb(t,_b,Xb)):(qb(t,4+(n?1:0),3),((t,e,i,n)=>{let s;for(qb(t,e-257,5),qb(t,i-1,5),qb(t,n-4,4),s=0;s(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=i,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(Ab[i]+yb+1)]++,t.dyn_dtree[2*Ub(e)]++),t.sym_next===t.sym_end),wb._tr_align=t=>{qb(t,2,3),Lb(t,256,_b),(t=>{16===t.bi_valid?(Yb(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)};var iw=(t,e,i,n)=>{let s=65535&t|0,r=t>>>16&65535|0,o=0;for(;0!==i;){o=i>2e3?2e3:i,i-=o;do{s=s+e[n++]|0,r=r+s|0}while(--o);s%=65521,r%=65521}return s|r<<16|0};const nw=new Uint32Array((()=>{let t,e=[];for(var i=0;i<256;i++){t=i;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e})());var sw=(t,e,i,n)=>{const s=nw,r=n+i;t^=-1;for(let i=n;i>>8^s[255&(t^e[i])];return-1^t},rw={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},ow={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:aw,_tr_stored_block:lw,_tr_flush_block:hw,_tr_tally:cw,_tr_align:uw}=wb,dw=iw,fw=sw,pw=rw,{Z_NO_FLUSH:Ow,Z_PARTIAL_FLUSH:gw,Z_FULL_FLUSH:mw,Z_FINISH:bw,Z_BLOCK:ww,Z_OK:vw,Z_STREAM_END:yw,Z_STREAM_ERROR:Sw,Z_DATA_ERROR:xw,Z_BUF_ERROR:kw,Z_DEFAULT_COMPRESSION:Qw,Z_FILTERED:$w,Z_HUFFMAN_ONLY:Pw,Z_RLE:Cw,Z_FIXED:_w,Z_DEFAULT_STRATEGY:Xw,Z_UNKNOWN:Zw,Z_DEFLATED:Aw}=ow,Tw=258,Rw=262,Ew=42,Vw=113,Mw=666,Dw=(t,e)=>(t.msg=pw[e],e),Ww=t=>2*t-(t>4?9:0),Uw=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Yw=t=>{let e,i,n,s=t.w_size;e=t.hash_size,n=e;do{i=t.head[--n],t.head[n]=i>=s?i-s:0}while(--e);e=s,n=e;do{i=t.prev[--n],t.prev[n]=i>=s?i-s:0}while(--e)};let qw=(t,e,i)=>(e<{const e=t.state;let i=e.pending;i>t.avail_out&&(i=t.avail_out),0!==i&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+i),t.next_out),t.next_out+=i,e.pending_out+=i,t.total_out+=i,t.avail_out-=i,e.pending-=i,0===e.pending&&(e.pending_out=0))},zw=(t,e)=>{hw(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Lw(t.strm)},Iw=(t,e)=>{t.pending_buf[t.pending++]=e},Bw=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},jw=(t,e,i,n)=>{let s=t.avail_in;return s>n&&(s=n),0===s?0:(t.avail_in-=s,e.set(t.input.subarray(t.next_in,t.next_in+s),i),1===t.state.wrap?t.adler=dw(t.adler,e,s,i):2===t.state.wrap&&(t.adler=fw(t.adler,e,s,i)),t.next_in+=s,t.total_in+=s,s)},Nw=(t,e)=>{let i,n,s=t.max_chain_length,r=t.strstart,o=t.prev_length,a=t.nice_match;const l=t.strstart>t.w_size-Rw?t.strstart-(t.w_size-Rw):0,h=t.window,c=t.w_mask,u=t.prev,d=t.strstart+Tw;let f=h[r+o-1],p=h[r+o];t.prev_length>=t.good_match&&(s>>=2),a>t.lookahead&&(a=t.lookahead);do{if(i=e,h[i+o]===p&&h[i+o-1]===f&&h[i]===h[r]&&h[++i]===h[r+1]){r+=2,i++;do{}while(h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&ro){if(t.match_start=e,o=n,n>=a)break;f=h[r+o-1],p=h[r+o]}}}while((e=u[e&c])>l&&0!=--s);return o<=t.lookahead?o:t.lookahead},Gw=t=>{const e=t.w_size;let i,n,s;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Rw)&&(t.window.set(t.window.subarray(e,e+e-n),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Yw(t),n+=e),0===t.strm.avail_in)break;if(i=jw(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=i,t.lookahead+t.insert>=3)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=qw(t,t.ins_h,t.window[s+1]);t.insert&&(t.ins_h=qw(t,t.ins_h,t.window[s+3-1]),t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead{let i,n,s,r=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,o=0,a=t.strm.avail_in;do{if(i=65535,s=t.bi_valid+42>>3,t.strm.avail_outn+t.strm.avail_in&&(i=n+t.strm.avail_in),i>s&&(i=s),i>8,t.pending_buf[t.pending-2]=~i,t.pending_buf[t.pending-1]=~i>>8,Lw(t.strm),n&&(n>i&&(n=i),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+n),t.strm.next_out),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n,t.block_start+=n,i-=n),i&&(jw(t.strm,t.strm.output,t.strm.next_out,i),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i)}while(0===o);return a-=t.strm.avail_in,a&&(a>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=a&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-a,t.strm.next_in),t.strstart),t.strstart+=a,t.insert+=a>t.w_size-t.insert?t.w_size-t.insert:a),t.block_start=t.strstart),t.high_waters&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,s+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),s>t.strm.avail_in&&(s=t.strm.avail_in),s&&(jw(t.strm,t.window,t.strstart,s),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.high_water>3,s=t.pending_buf_size-s>65535?65535:t.pending_buf_size-s,r=s>t.w_size?t.w_size:s,n=t.strstart-t.block_start,(n>=r||(n||e===bw)&&e!==Ow&&0===t.strm.avail_in&&n<=s)&&(i=n>s?s:n,o=e===bw&&0===t.strm.avail_in&&i===n?1:0,lw(t,t.block_start,i,o),t.block_start+=i,Lw(t.strm)),o?3:1)},Hw=(t,e)=>{let i,n;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==i&&t.strstart-i<=t.w_size-Rw&&(t.match_length=Nw(t,i)),t.match_length>=3)if(n=cw(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=qw(t,t.ins_h,t.window[t.strstart+1]);else n=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2},Jw=(t,e)=>{let i,n,s;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==i&&t.prev_length4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){s=t.strstart+t.lookahead-3,n=cw(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=s&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(zw(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(n=cw(t,0,t.window[t.strstart-1]),n&&zw(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=cw(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2};function Kw(t,e,i,n,s){this.good_length=t,this.max_lazy=e,this.nice_length=i,this.max_chain=n,this.func=s}const tv=[new Kw(0,0,0,0,Fw),new Kw(4,4,8,4,Hw),new Kw(4,5,16,8,Hw),new Kw(4,6,32,32,Hw),new Kw(4,4,16,16,Jw),new Kw(8,16,32,32,Jw),new Kw(8,16,128,128,Jw),new Kw(8,32,128,256,Jw),new Kw(32,128,258,1024,Jw),new Kw(32,258,258,4096,Jw)];function ev(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Aw,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Uw(this.dyn_ltree),Uw(this.dyn_dtree),Uw(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Uw(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Uw(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const iv=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==Ew&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==Vw&&e.status!==Mw?1:0},nv=t=>{if(iv(t))return Dw(t,Sw);t.total_in=t.total_out=0,t.data_type=Zw;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?Ew:Vw,t.adler=2===e.wrap?0:1,e.last_flush=-2,aw(e),vw},sv=t=>{const e=nv(t);var i;return e===vw&&((i=t.state).window_size=2*i.w_size,Uw(i.head),i.max_lazy_match=tv[i.level].max_lazy,i.good_match=tv[i.level].good_length,i.nice_match=tv[i.level].nice_length,i.max_chain_length=tv[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=2,i.match_available=0,i.ins_h=0),e},rv=(t,e,i,n,s,r)=>{if(!t)return Sw;let o=1;if(e===Qw&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),s<1||s>9||i!==Aw||n<8||n>15||e<0||e>9||r<0||r>_w||8===n&&1!==o)return Dw(t,Sw);8===n&&(n=9);const a=new ev;return t.state=a,a.strm=t,a.status=Ew,a.wrap=o,a.gzhead=null,a.w_bits=n,a.w_size=1<rv(t,e,Aw,15,8,Xw),bb.deflateInit2=rv,bb.deflateReset=sv,bb.deflateResetKeep=nv,bb.deflateSetHeader=(t,e)=>iv(t)||2!==t.state.wrap?Sw:(t.state.gzhead=e,vw),bb.deflate=(t,e)=>{if(iv(t)||e>ww||e<0)return t?Dw(t,Sw):Sw;const i=t.state;if(!t.output||0!==t.avail_in&&!t.input||i.status===Mw&&e!==bw)return Dw(t,0===t.avail_out?kw:Sw);const n=i.last_flush;if(i.last_flush=e,0!==i.pending){if(Lw(t),0===t.avail_out)return i.last_flush=-1,vw}else if(0===t.avail_in&&Ww(e)<=Ww(n)&&e!==bw)return Dw(t,kw);if(i.status===Mw&&0!==t.avail_in)return Dw(t,kw);if(i.status===Ew&&0===i.wrap&&(i.status=Vw),i.status===Ew){let e=Aw+(i.w_bits-8<<4)<<8,n=-1;if(n=i.strategy>=Pw||i.level<2?0:i.level<6?1:6===i.level?2:3,e|=n<<6,0!==i.strstart&&(e|=32),e+=31-e%31,Bw(i,e),0!==i.strstart&&(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),t.adler=1,i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(57===i.status)if(t.adler=0,Iw(i,31),Iw(i,139),Iw(i,8),i.gzhead)Iw(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),Iw(i,255&i.gzhead.time),Iw(i,i.gzhead.time>>8&255),Iw(i,i.gzhead.time>>16&255),Iw(i,i.gzhead.time>>24&255),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(Iw(i,255&i.gzhead.extra.length),Iw(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=fw(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if(Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,3),i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw;if(69===i.status){if(i.gzhead.extra){let e=i.pending,n=(65535&i.gzhead.extra.length)-i.gzindex;for(;i.pending+n>i.pending_buf_size;){let s=i.pending_buf_size-i.pending;if(i.pending_buf.set(i.gzhead.extra.subarray(i.gzindex,i.gzindex+s),i.pending),i.pending=i.pending_buf_size,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex+=s,Lw(t),0!==i.pending)return i.last_flush=-1,vw;e=0,n-=s}let s=new Uint8Array(i.gzhead.extra);i.pending_buf.set(s.subarray(i.gzindex,i.gzindex+n),i.pending),i.pending+=n,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex=0}i.status=73}if(73===i.status){if(i.gzhead.name){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),i.gzindex=0}i.status=91}if(91===i.status){if(i.gzhead.comment){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n))}i.status=103}if(103===i.status){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size&&(Lw(t),0!==i.pending))return i.last_flush=-1,vw;Iw(i,255&t.adler),Iw(i,t.adler>>8&255),t.adler=0}if(i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(0!==t.avail_in||0!==i.lookahead||e!==Ow&&i.status!==Mw){let n=0===i.level?Fw(i,e):i.strategy===Pw?((t,e)=>{let i;for(;;){if(0===t.lookahead&&(Gw(t),0===t.lookahead)){if(e===Ow)return 1;break}if(t.match_length=0,i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):i.strategy===Cw?((t,e)=>{let i,n,s,r;const o=t.window;for(;;){if(t.lookahead<=Tw){if(Gw(t),t.lookahead<=Tw&&e===Ow)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(s=t.strstart-1,n=o[s],n===o[++s]&&n===o[++s]&&n===o[++s])){r=t.strstart+Tw;do{}while(n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&st.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(i=cw(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):tv[i.level].func(i,e);if(3!==n&&4!==n||(i.status=Mw),1===n||3===n)return 0===t.avail_out&&(i.last_flush=-1),vw;if(2===n&&(e===gw?uw(i):e!==ww&&(lw(i,0,0,!1),e===mw&&(Uw(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),Lw(t),0===t.avail_out))return i.last_flush=-1,vw}return e!==bw?vw:i.wrap<=0?yw:(2===i.wrap?(Iw(i,255&t.adler),Iw(i,t.adler>>8&255),Iw(i,t.adler>>16&255),Iw(i,t.adler>>24&255),Iw(i,255&t.total_in),Iw(i,t.total_in>>8&255),Iw(i,t.total_in>>16&255),Iw(i,t.total_in>>24&255)):(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),Lw(t),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?vw:yw)},bb.deflateEnd=t=>{if(iv(t))return Sw;const e=t.state.status;return t.state=null,e===Vw?Dw(t,xw):vw},bb.deflateSetDictionary=(t,e)=>{let i=e.length;if(iv(t))return Sw;const n=t.state,s=n.wrap;if(2===s||1===s&&n.status!==Ew||n.lookahead)return Sw;if(1===s&&(t.adler=dw(t.adler,e,i,0)),n.wrap=0,i>=n.w_size){0===s&&(Uw(n.head),n.strstart=0,n.block_start=0,n.insert=0);let t=new Uint8Array(n.w_size);t.set(e.subarray(i-n.w_size,i),0),e=t,i=n.w_size}const r=t.avail_in,o=t.next_in,a=t.input;for(t.avail_in=i,t.next_in=0,t.input=e,Gw(n);n.lookahead>=3;){let t=n.strstart,e=n.lookahead-2;do{n.ins_h=qw(n,n.ins_h,n.window[t+3-1]),n.prev[t&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=t,t++}while(--e);n.strstart=t,n.lookahead=2,Gw(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,t.next_in=o,t.input=a,t.avail_in=r,n.wrap=s,vw},bb.deflateInfo="pako deflate (from Nodeca project)";var ov={};const av=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);ov.assign=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const e in i)av(i,e)&&(t[e]=i[e])}}return t},ov.flattenChunks=t=>{let e=0;for(let i=0,n=t.length;i=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;cv[254]=cv[254]=1,lv.string2buf=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,i,n,s,r,o=t.length,a=0;for(s=0;s>>6,e[r++]=128|63&i):i<65536?(e[r++]=224|i>>>12,e[r++]=128|i>>>6&63,e[r++]=128|63&i):(e[r++]=240|i>>>18,e[r++]=128|i>>>12&63,e[r++]=128|i>>>6&63,e[r++]=128|63&i);return e};lv.buf2string=(t,e)=>{const i=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let n,s;const r=new Array(2*i);for(s=0,n=0;n4)r[s++]=65533,n+=o-1;else{for(e&=2===o?31:3===o?15:7;o>1&&n1?r[s++]=65533:e<65536?r[s++]=e:(e-=65536,r[s++]=55296|e>>10&1023,r[s++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&hv)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let i="";for(let n=0;n{(e=e||t.length)>t.length&&(e=t.length);let i=e-1;for(;i>=0&&128==(192&t[i]);)i--;return i<0||0===i?e:i+cv[t[i]]>e?i:e};var uv=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const dv=bb,fv=ov,pv=lv,Ov=rw,gv=uv,mv=Object.prototype.toString,{Z_NO_FLUSH:bv,Z_SYNC_FLUSH:wv,Z_FULL_FLUSH:vv,Z_FINISH:yv,Z_OK:Sv,Z_STREAM_END:xv,Z_DEFAULT_COMPRESSION:kv,Z_DEFAULT_STRATEGY:Qv,Z_DEFLATED:$v}=ow;function Pv(t){this.options=fv.assign({level:kv,method:$v,chunkSize:16384,windowBits:15,memLevel:8,strategy:Qv},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new gv,this.strm.avail_out=0;let i=dv.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(i!==Sv)throw new Error(Ov[i]);if(e.header&&dv.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?pv.string2buf(e.dictionary):"[object ArrayBuffer]"===mv.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,i=dv.deflateSetDictionary(this.strm,t),i!==Sv)throw new Error(Ov[i]);this._dict_set=!0}}function Cv(t,e){const i=new Pv(e);if(i.push(t,!0),i.err)throw i.msg||Ov[i.err];return i.result}Pv.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize;let s,r;if(this.ended)return!1;for(r=e===~~e?e:!0===e?yv:bv,"string"==typeof t?i.input=pv.string2buf(t):"[object ArrayBuffer]"===mv.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),(r===wv||r===vv)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(s=dv.deflate(i,r),s===xv)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),s=dv.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===Sv;if(0!==i.avail_out){if(r>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},Pv.prototype.onData=function(t){this.chunks.push(t)},Pv.prototype.onEnd=function(t){t===Sv&&(this.result=fv.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},mb.Deflate=Pv,mb.deflate=Cv,mb.deflateRaw=function(t,e){return(e=e||{}).raw=!0,Cv(t,e)},mb.gzip=function(t,e){return(e=e||{}).gzip=!0,Cv(t,e)},mb.constants=ow;var _v={},Xv={};const Zv=16209;const Av=15,Tv=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Rv=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Ev=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Vv=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Mv=(t,e,i,n,s,r,o,a)=>{const l=a.bits;let h,c,u,d,f,p,O=0,g=0,m=0,b=0,w=0,v=0,y=0,S=0,x=0,k=0,Q=null;const $=new Uint16Array(16),P=new Uint16Array(16);let C,_,X,Z=null;for(O=0;O<=Av;O++)$[O]=0;for(g=0;g=1&&0===$[b];b--);if(w>b&&(w=b),0===b)return s[r++]=20971520,s[r++]=20971520,a.bits=1,0;for(m=1;m0&&(0===t||1!==b))return-1;for(P[1]=0,O=1;O852||2===t&&x>592)return 1;for(;;){C=O-y,o[g]+1=p?(_=Z[o[g]-p],X=Q[o[g]-p]):(_=96,X=0),h=1<>y)+c]=C<<24|_<<16|X|0}while(0!==c);for(h=1<>=1;if(0!==h?(k&=h-1,k+=h):k=0,g++,0==--$[O]){if(O===b)break;O=e[i+o[g]]}if(O>w&&(k&d)!==u){for(0===y&&(y=w),f+=m,v=O-y,S=1<852||2===t&&x>592)return 1;u=k&d,s[u]=w<<24|v<<16|f-r|0}}return 0!==k&&(s[f+k]=O-y<<24|64<<16|0),a.bits=w,0};const Dv=iw,Wv=sw,Uv=function(t,e){let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,y,S,x,k,Q;const $=t.state;i=t.next_in,k=t.input,n=i+(t.avail_in-5),s=t.next_out,Q=t.output,r=s-(e-t.avail_out),o=s+(t.avail_out-257),a=$.dmax,l=$.wsize,h=$.whave,c=$.wnext,u=$.window,d=$.hold,f=$.bits,p=$.lencode,O=$.distcode,g=(1<<$.lenbits)-1,m=(1<<$.distbits)-1;t:do{f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,0===w)Q[s++]=65535&b;else{if(!(16&w)){if(0==(64&w)){b=p[(65535&b)+(d&(1<>>=w,f-=w),f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,!(16&w)){if(0==(64&w)){b=O[(65535&b)+(d&(1<a){t.msg="invalid distance too far back",$.mode=Zv;break t}if(d>>>=w,f-=w,w=s-r,y>w){if(w=y-w,w>h&&$.sane){t.msg="invalid distance too far back",$.mode=Zv;break t}if(S=0,x=u,0===c){if(S+=l-w,w2;)Q[s++]=x[S++],Q[s++]=x[S++],Q[s++]=x[S++],v-=3;v&&(Q[s++]=x[S++],v>1&&(Q[s++]=x[S++]))}else{S=s-y;do{Q[s++]=Q[S++],Q[s++]=Q[S++],Q[s++]=Q[S++],v-=3}while(v>2);v&&(Q[s++]=Q[S++],v>1&&(Q[s++]=Q[S++]))}break}}break}}while(i>3,i-=v,f-=v<<3,d&=(1<(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function hy(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const cy=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode16211?1:0},uy=t=>{if(cy(t))return Nv;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Kv,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,Iv},dy=t=>{if(cy(t))return Nv;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,uy(t)},fy=(t,e)=>{let i;if(cy(t))return Nv;const n=t.state;return e<0?(i=0,e=-e):(i=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?Nv:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=i,n.wbits=e,dy(t))},py=(t,e)=>{if(!t)return Nv;const i=new hy;t.state=i,i.strm=t,i.window=null,i.mode=Kv;const n=fy(t,e);return n!==Iv&&(t.state=null),n};let Oy,gy,my=!0;const by=t=>{if(my){Oy=new Int32Array(512),gy=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Yv(1,t.lens,0,288,Oy,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Yv(2,t.lens,0,32,gy,0,t.work,{bits:5}),my=!1}t.lencode=Oy,t.lenbits=9,t.distcode=gy,t.distbits=5},wy=(t,e,i,n)=>{let s;const r=t.state;return null===r.window&&(r.wsize=1<=r.wsize?(r.window.set(e.subarray(i-r.wsize,i),0),r.wnext=0,r.whave=r.wsize):(s=r.wsize-r.wnext,s>n&&(s=n),r.window.set(e.subarray(i-n,i-n+s),r.wnext),(n-=s)?(r.window.set(e.subarray(i-n,i),0),r.wnext=n,r.whave=r.wsize):(r.wnext+=s,r.wnext===r.wsize&&(r.wnext=0),r.whavepy(t,15),Xv.inflateInit2=py,Xv.inflate=(t,e)=>{let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,y,S,x,k=0;const Q=new Uint8Array(4);let $,P;const C=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(cy(t)||!t.output||!t.input&&0!==t.avail_in)return Nv;i=t.state,i.mode===ey&&(i.mode=iy),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,u=a,d=l,x=Iv;t:for(;;)switch(i.mode){case Kv:if(0===i.wrap){i.mode=iy;break}for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0),h=0,c=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",i.mode=ay;break}if((15&h)!==Jv){t.msg="unknown compression method",i.mode=ay;break}if(h>>>=4,c-=4,S=8+(15&h),0===i.wbits&&(i.wbits=S),S>15||S>i.wbits){t.msg="invalid window size",i.mode=ay;break}i.dmax=1<>8&1),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16182;case 16182:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>8&255,Q[2]=h>>>16&255,Q[3]=h>>>24&255,i.check=Wv(i.check,Q,4,0)),h=0,c=0,i.mode=16183;case 16183:for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>8),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16184;case 16184:if(1024&i.flags){for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(f=i.length,f>a&&(f=a),f&&(i.head&&(S=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(n.subarray(r,r+f),S)),512&i.flags&&4&i.wrap&&(i.check=Wv(i.check,n,f,r)),a-=f,r+=f,i.length-=f),i.length))break t;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===a)break t;f=0;do{S=n[r+f++],i.head&&S&&i.length<65536&&(i.head.name+=String.fromCharCode(S))}while(S&&f>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=ey;break;case 16189:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>=7&c,c-=7&c,i.mode=oy;break}for(;c<3;){if(0===a)break t;a--,h+=n[r++]<>>=1,c-=1,3&h){case 0:i.mode=16193;break;case 1:if(by(i),i.mode=sy,e===zv){h>>>=2,c-=2;break t}break;case 2:i.mode=16196;break;case 3:t.msg="invalid block type",i.mode=ay}h>>>=2,c-=2;break;case 16193:for(h>>>=7&c,c-=7&c;c<32;){if(0===a)break t;a--,h+=n[r++]<>>16^65535)){t.msg="invalid stored block lengths",i.mode=ay;break}if(i.length=65535&h,h=0,c=0,i.mode=ny,e===zv)break t;case ny:i.mode=16195;case 16195:if(f=i.length,f){if(f>a&&(f=a),f>l&&(f=l),0===f)break t;s.set(n.subarray(r,r+f),o),a-=f,r+=f,l-=f,o+=f,i.length-=f;break}i.mode=ey;break;case 16196:for(;c<14;){if(0===a)break t;a--,h+=n[r++]<>>=5,c-=5,i.ndist=1+(31&h),h>>>=5,c-=5,i.ncode=4+(15&h),h>>>=4,c-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=ay;break}i.have=0,i.mode=16197;case 16197:for(;i.have>>=3,c-=3}for(;i.have<19;)i.lens[C[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,$={bits:i.lenbits},x=Yv(0,i.lens,0,19,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid code lengths set",i.mode=ay;break}i.have=0,i.mode=16198;case 16198:for(;i.have>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=g,c-=g,i.lens[i.have++]=b;else{if(16===b){for(P=g+2;c>>=g,c-=g,0===i.have){t.msg="invalid bit length repeat",i.mode=ay;break}S=i.lens[i.have-1],f=3+(3&h),h>>>=2,c-=2}else if(17===b){for(P=g+3;c>>=g,c-=g,S=0,f=3+(7&h),h>>>=3,c-=3}else{for(P=g+7;c>>=g,c-=g,S=0,f=11+(127&h),h>>>=7,c-=7}if(i.have+f>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=ay;break}for(;f--;)i.lens[i.have++]=S}}if(i.mode===ay)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=ay;break}if(i.lenbits=9,$={bits:i.lenbits},x=Yv(1,i.lens,0,i.nlen,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid literal/lengths set",i.mode=ay;break}if(i.distbits=6,i.distcode=i.distdyn,$={bits:i.distbits},x=Yv(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,$),i.distbits=$.bits,x){t.msg="invalid distances set",i.mode=ay;break}if(i.mode=sy,e===zv)break t;case sy:i.mode=ry;case ry:if(a>=6&&l>=258){t.next_out=o,t.avail_out=l,t.next_in=r,t.avail_in=a,i.hold=h,i.bits=c,Uv(t,d),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,i.mode===ey&&(i.back=-1);break}for(i.back=0;k=i.lencode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,i.length=b,0===m){i.mode=16205;break}if(32&m){i.back=-1,i.mode=ey;break}if(64&m){t.msg="invalid literal/length code",i.mode=ay;break}i.extra=15&m,i.mode=16201;case 16201:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;k=i.distcode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,64&m){t.msg="invalid distance code",i.mode=ay;break}i.offset=b,i.extra=15&m,i.mode=16203;case 16203:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=ay;break}i.mode=16204;case 16204:if(0===l)break t;if(f=d-l,i.offset>f){if(f=i.offset-f,f>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=ay;break}f>i.wnext?(f-=i.wnext,p=i.wsize-f):p=i.wnext-f,f>i.length&&(f=i.length),O=i.window}else O=s,p=o-i.offset,f=i.length;f>l&&(f=l),l-=f,i.length-=f;do{s[o++]=O[p++]}while(--f);0===i.length&&(i.mode=ry);break;case 16205:if(0===l)break t;s[o++]=i.length,l--,i.mode=ry;break;case oy:if(i.wrap){for(;c<32;){if(0===a)break t;a--,h|=n[r++]<{if(cy(t))return Nv;let e=t.state;return e.window&&(e.window=null),t.state=null,Iv},Xv.inflateGetHeader=(t,e)=>{if(cy(t))return Nv;const i=t.state;return 0==(2&i.wrap)?Nv:(i.head=e,e.done=!1,Iv)},Xv.inflateSetDictionary=(t,e)=>{const i=e.length;let n,s,r;return cy(t)?Nv:(n=t.state,0!==n.wrap&&n.mode!==ty?Nv:n.mode===ty&&(s=1,s=Dv(s,e,i,0),s!==n.check)?Gv:(r=wy(t,e,i,i),r?(n.mode=16210,Fv):(n.havedict=1,Iv)))},Xv.inflateInfo="pako inflate (from Nodeca project)";const vy=Xv,yy=ov,Sy=lv,xy=rw,ky=uv,Qy=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},$y=Object.prototype.toString,{Z_NO_FLUSH:Py,Z_FINISH:Cy,Z_OK:_y,Z_STREAM_END:Xy,Z_NEED_DICT:Zy,Z_STREAM_ERROR:Ay,Z_DATA_ERROR:Ty,Z_MEM_ERROR:Ry}=ow;function Ey(t){this.options=yy.assign({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ky,this.strm.avail_out=0;let i=vy.inflateInit2(this.strm,e.windowBits);if(i!==_y)throw new Error(xy[i]);if(this.header=new Qy,vy.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=Sy.string2buf(e.dictionary):"[object ArrayBuffer]"===$y.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(i=vy.inflateSetDictionary(this.strm,e.dictionary),i!==_y)))throw new Error(xy[i])}function Vy(t,e){const i=new Ey(e);if(i.push(t),i.err)throw i.msg||xy[i.err];return i.result}Ey.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize,s=this.options.dictionary;let r,o,a;if(this.ended)return!1;for(o=e===~~e?e:!0===e?Cy:Py,"[object ArrayBuffer]"===$y.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),r=vy.inflate(i,o),r===Zy&&s&&(r=vy.inflateSetDictionary(i,s),r===_y?r=vy.inflate(i,o):r===Ty&&(r=Zy));i.avail_in>0&&r===Xy&&i.state.wrap>0&&0!==t[i.next_in];)vy.inflateReset(i),r=vy.inflate(i,o);switch(r){case Ay:case Ty:case Zy:case Ry:return this.onEnd(r),this.ended=!0,!1}if(a=i.avail_out,i.next_out&&(0===i.avail_out||r===Xy))if("string"===this.options.to){let t=Sy.utf8border(i.output,i.next_out),e=i.next_out-t,s=Sy.buf2string(i.output,t);i.next_out=e,i.avail_out=n-e,e&&i.output.set(i.output.subarray(t,t+e),0),this.onData(s)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(r!==_y||0!==a){if(r===Xy)return r=vy.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},Ey.prototype.onData=function(t){this.chunks.push(t)},Ey.prototype.onEnd=function(t){t===_y&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=yy.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},_v.Inflate=Ey,_v.inflate=Vy,_v.inflateRaw=function(t,e){return(e=e||{}).raw=!0,Vy(t,e)},_v.ungzip=Vy,_v.constants=ow;const{Deflate:My,deflate:Dy,deflateRaw:Wy,gzip:Uy}=mb,{Inflate:Yy,inflate:qy,inflateRaw:Ly,ungzip:zy}=_v,Iy=ow;gb.Deflate=My,gb.deflate=Dy,gb.deflateRaw=Wy,gb.gzip=Uy,gb.Inflate=Yy,gb.inflate=qy,gb.inflateRaw=Ly,gb.ungzip=zy,gb.constants=Iy;const By=gb;let jy={};var Ny;function Gy(t){return Ny=t,[tS]}jy.Util={},jy.Decode={},jy.Messages=[],jy.Log=function(t){jy.Messages.push(["I",t]),console.log("Mma.js INFO: ",t)},jy.Warn=function(t){jy.Messages.push(["W",t]),console.log("Mma.js WARNING: ",t)},jy.Fail=function(t){throw jy.Messages.push(["E",t]),"Mma.js ERROR: "+t},jy.Util.Base64Decode=function(t){for(var e=atob(t),i=e.length>>>0,n=new Uint8Array(i),s=0;s1&&0===t[0]&&jy.Fail("IntegerAP: input starts with 0: "+String(t)),this.nstring=t}else void 0===t?this.nstring=void 0:jy.Fail("Integer: invalid input: "+String(t))},jy.RealMP=function(t){"number"==typeof t?this.n=t:void 0===t?this.n=void 0:jy.Fail("RealMP: invalid input")},jy.RealAP=function(t){"string"==typeof t?(t.length>1&&0===t[0]&&jy.Fail("RealAP: input starts with 0: "+String(t)),this.nstring=t):void 0===t?this.nstring=void 0:jy.Fail("RealAP: invalid input: "+String(t))},jy.Symbol=function(t){"string"==typeof t?this.name=t:void 0===t?this.name=void 0:jy.Fail("Symbol: invalid input: "+String(t))},jy.String=function(t){"string"==typeof t?this.str=t:void 0===t?this.str=void 0:jy.Fail("String: invalid input: "+String(t))},jy.Expression=function(t,e){t instanceof jy.Symbol||jy.Fail("Expression: head must be an Mma.Symbol"),e instanceof Array||jy.Fail("Expression: parts must be an Array"),this.head=t,this.parts=e},jy.Decode.Int32=function(t,e){try{return new DataView(t.buffer).getInt32(e,!0)}catch(t){return 0}},jy.Decode.Float64=function(t,e){try{return new DataView(t.buffer).getFloat64(e,!0)}catch(t){return 0}},jy.Decode.String=function(t,e,i){return void 0===e&&(e=0),void 0===i&&(i=t.length),jy.Util.U8ArrayToString(t.slice(e,e+i))},jy.Decode.StringEntry=function(t,e){void 0===e&&(e=0);var i=jy.Decode.Int32(t,e);return{length:i,string:jy.Decode.String(t,e+4,i),bytesRead:i+4}},jy.Decode.Any=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=1/0);var n=e;for(var s=0,r=[];ee%2!=0?t:{...t,body:Lm(t.body,/\(\*\|\*\)/gm)})),Array.isArray(this.args[this.args.length-1].body)||(this.decorator=this.args.pop());const r=this.args;console.log("creating InstanceWidget");for(let t=0;t{e.viewState.state.config.eval()},update:e=>this.applyChanges(e,t,i),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to&&!t.stringOnly)return i-2>=0?(o[i-2].editor.dispatch({selection:{anchor:o[i-2].editor.state.doc.length}}),o[i-2].editor.focus(),void(t.editorLastCursor=void 0)):(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0));t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to&&!t.stringOnly)return i+2=0)return r[t-2].body[i].editor.focus(),void(e.editorLastCursor=void 0)}},{key:"ArrowDown",run:function(e,n){if(t+2{},focus:()=>{},dispatch:()=>{},stringOnly:!0};const t=l.match(Fy);if(t){a.innerHTML=t[1];const e=jy.DecompressDecode(t[2]),i=jy.toArray(e.parts[0]),n=uuidv4();interpretate(i,{global:{call:n},element:a})}else a.innerHTML=l.slice(1,-1)}delete o[i].body,n.appendChild(a)}i.appendChild(n)}if(this.decorator){const t=jy.DecompressDecode(this.decorator.body.slice(2,-2)),e=jy.toArray(t.parts[0]);let n={global:{call:uuidv4(),EditorWidget:s},element:i};this.interpretated=interpretate(e,n)}}applyChanges(t,e,i){const n=this.args,s=this.args[e].body,r=this.visibleValue.argsPos,o=this.args[e].from;let a=t;0==i&&0==e&&(a="{{"+a),0==i&&0!=e&&(a="{"+a),i==s.length-1&&e==n.length-1&&(a+="}}"),i==s.length-1&&e!=n.length-1&&(a+="}");const l=s[i].length,h={from:r+o+s[i].from,to:r+o+s[i].from+l,insert:a},c=a.length-l;for(let t=i+1;t{s.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.args[0].body[0].editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.args[0].body[0].editor.focus();else{const t=this.DOMElement.EditorWidget.args,e=t[t.length-1].body[t[t.length-1].body.length-1].editor;e.dispatch({selection:{anchor:e.state.doc.length}}),e.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const Ky=(t,e)=>new Bm({tag:"GB",decoration:i=>ni.replace({widget:new Jy(i,t,e)})}),tS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=Ky(this.disposable,t).createDeco(t)}update(t){this.placeholder=Ky(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});function eS(t){return[rS]}let iS=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.span=i,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this,r=this.args[1].body.slice(3,-3),o=jy.DecompressDecode(r),a=jy.toArray(o.parts[0]);this.data=a;const l="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}));this.cuid=l;let h={call:l,EditorWidget:s},c={global:h,element:i};this.expression=a,this.env=c,this.interpretated=interpretate(a,c),this.interpretated.then((()=>{if(c.options?.Event){console.warn("Event listeners are enabled!"),s.events=c.options.Event;let t=c;if(h.stack){const e=Object.values(h.stack);e.length>0&&(console.log("Attaching first found instance..."),t=e[0].env)}interpretate(["MetaMarker","'"+l+"'"],t).then((()=>{server.kernel.emitt(s.events,'"'+l+'"',"Mounted")}))}}))}getDoc(){return this.args[0].body.slice(1,-1)}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+t+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].length=s.length,this.view.dispatch({changes:r})}applyOuterChanges(t){const e=this.visibleValue,i=t,n={from:e.pos,to:e.pos+e.length,insert:i};this.view.dispatch({changes:n})}update(t){if(!this.deactivated){if(t.str!=this.visibleValue.str){console.warn("Out of sync"),console.log("recreate..."),this.destroy();const e=this.span;return e.replaceChildren(),void this._construct(t,this.view,e)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}}destroy(t){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.events&&server.kernel.emitt(this.events,'"'+this.cuid+'"',"Destroy"),delete this.data}},nS=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=this;let i=document.createElement("span");return i.classList.add("frontend-view"),i.EditorWidget=new iS(this.visibleValue,t,i),this.reference.push({destroy:()=>{e.destroy(i)}}),i}ignoreEvent(){return!0}destroy(t){console.log("destroy in general*"),t.EditorWidget.destroy()}};const sS=(t,e)=>new Bm({tag:"VB",decoration:i=>ni.replace({widget:new nS(i,t,e)})}),rS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=sS(this.disposable,t).createDeco(t)}update(t){this.placeholder=sS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var oS;function aS(t){return oS=t,[uS]}let lS=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.span=i,this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this;this.epilog={offset:0,string:""},this.prolog={offset:0,string:""};const r=this.args[1].body.slice(3,-3),o=jy.DecompressDecode(r),a=jy.toArray(o.parts[0]);this.data=a;let l={global:{call:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)})),element:i,origin:s},element:i};this.env=l,interpretate(a,l).then((()=>{if(l.options?.Head&&(s.prolog.offset=l.options.Head.length+1,s.prolog.string=l.options.Head+"[",s.epilog.offset=1,s.epilog.string="]"),l.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=l.options.Event),l.options?.String){s.prolog.offset=1,s.prolog.string='"',s.epilog.offset=1,s.epilog.string='"',l.options?.HeadString&&(s.prolog.string=l.options.HeadString,s.prolog.offset=s.prolog.string.length),l.options?.TailString&&(s.epilog.string=l.options.TailString,s.epilog.offset=s.epilog.string.length),s.editor={destroy:()=>{console.log("Nothing to destroy, this is just a text field.")}};const t=document.createElement("span");return this.aa,t.onkeydown=function(t){13===t.keyCode&&t.preventDefault()},t.contentEditable="plaintext-only",t.innerText=s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),t.addEventListener("input",console.log),t.addEventListener("input",(()=>{console.log("Update"),console.log(t.innerText),this.applyChanges(t.innerText)})),l.global.element.appendChild(t),void(s.events&&server.kernel.emitt(s.events,"Null","Mounted"))}s.editor=oS({doc:s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),parent:l.global.element,update:t=>this.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos+s.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]}),s.events&&server.kernel.emitt(s.events,"Null","Mounted")}))}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+this.prolog.string+t+this.epilog.string+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length));const o=s.length-i[0].length;i[0].length=s.length,this.visibleValue.length=this.visibleValue.length+o,this.view.dispatch({changes:r})}update(t){if(this.visibleValue.str!=t.str)return console.warn("Out of sync"),console.log("recreating InstanceWidget"),this.destroy(),this.span.replaceChildren(),void this._construct(t,this.view,this.span);this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.editor.destroy(),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}},hS=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("subscript-tail"),e.EditorWidget=new lS(this.visibleValue,t,e,[]);const i=this;return this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const cS=(t,e)=>new Bm({tag:"BB",decoration:i=>ni.replace({widget:new hS(i,t,e)})}),uS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=cS(this.disposable,t).createDeco(t)}update(t){this.placeholder=cS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var dS;function fS(t){return dS=t,[mS]}class pS{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm);const s=this,r=Array.from({length:Math.ceil((s.args.length-3)/2)},((t,e)=>2*e+1));s.indexes=r;const o=[];this.span=i,this.spans=o;for(let t=0;t{c.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=c.options.Event),s.editors=r.map(((t,i)=>dS({doc:s.args[t].body,parent:o[i],update:e=>this.applyChanges(e,t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i>0?s.editors[i-1].focus():(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus()),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return it.destroy())),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}}class OS extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("inline-flex"),e.EditorWidget=new pS(this.visibleValue,t,e,[]);const i=this;return this.DOMElement=e,this.reference.push({destroy:()=>{i.destroy(e)}}),e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;const n=this.DOMElement.EditorWidget.editors;return t.from-e.from<0?(n[n.length-1].dispatch({selection:{anchor:n[n.length-1].state.doc.length}}),n[n.length-1].focus()):(n[0].dispatch({selection:{anchor:0}}),n[0].focus()),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}}const gS=(t,e)=>new Bm({tag:"TB",decoration:i=>ni.replace({widget:new OS(i,t,e)})}),mS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=gS(this.disposable,t).createDeco(t)}update(t){this.placeholder=gS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});const bS=_i.fromClass(class{decorations=ni.none;constructor(t){this.view=t,this.recompute()}recompute(t){let e,i,n=[];for(let{from:t,to:e}of this.view.visibleRanges)this.getDecorationsFor(t,e,n);this.decorations=ni.set(n,!0),this.decorations=this.decorations.update({filter:(n,s)=>!(n>e&&s=e&&s.selection.main.head<=i)return!0;if(!n&&s.selection.main.head>e&&s.selection.main.headt.decorations});class wS extends ei{constructor(t,e){super(),this.rawValue=t,this.visibleValue=e}eq(t){return this.rawValue===t.rawValue}toDOM(){let t=document.createElement("div");t.classList.add("cell-type-widget");const e=this.rawValue.split(" "),i=e[0].split(".");if(console.log(i),t.classList.add("cell-type-"+i[1].trim()),t.innerText=e[0].trim(),e.length>1){const n=e.slice(1),s=document.createElement("span");return s.appendChild(t),n.forEach((t=>{const e=document.createElement("span");e.innerText=t,e.classList.add("cell-type-"+i[1].trim()+"-"+t.split("=")[0]),s.appendChild(e)})),s}return t}ignoreEvent(){return!1}}const vS=new F,yS=new F,SS=[],xS=Sl.define([{tag:Sa.meta,color:"var(--editor-key-meta)"},{tag:Sa.link,textDecoration:"underline"},{tag:Sa.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Sa.emphasis,fontStyle:"italic"},{tag:Sa.strong,fontWeight:"bold"},{tag:Sa.strikethrough,textDecoration:"line-through"},{tag:Sa.keyword,color:"var(--editor-key-keyword)"},{tag:[Sa.atom,Sa.bool,Sa.url,Sa.contentSeparator,Sa.labelName],color:"var(--editor-key-atom)"},{tag:[Sa.literal,Sa.inserted],color:"var(--editor-key-literal)"},{tag:[Sa.string,Sa.deleted],color:"var(--editor-key-string)"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],color:"var(--editor-key-escape)"},{tag:Sa.definition(Sa.variableName),color:"var(--editor-key-variable)"},{tag:Sa.local(Sa.variableName),color:"var(--editor-local-variable)"},{tag:[Sa.typeName,Sa.namespace],color:"var(--editor-key-type)"},{tag:Sa.className,color:"var(--editor-key-class)"},{tag:[Sa.special(Sa.variableName),Sa.macroName],color:"var(--editor-special-variable)"},{tag:Sa.definition(Sa.propertyName),color:"var(--editor-key-property)"},{tag:Sa.comment,color:"var(--editor-key-comment)"},{tag:Sa.invalid,color:"var(--editor-key-invalid)"}]),kS={data:[],extend:t=>{kS.data.push(...t),Qm.reBuild(kS.data)},replaceAll:t=>{kS.data=t,Qm.reBuild(kS.data)}},QS=Gl.define({name:"spreadsheet",startState:function(){return{stringType:null,stack:[]}},token:function(t,e){if(t){switch(0===e.stack.length&&('"'!=t.peek()&&"'"!=t.peek()||(e.stringType=t.peek(),t.next(),e.stack.unshift("string"))),e.stack[0]){case"string":for(;"string"===e.stack[0]&&!t.eol();)t.peek()===e.stringType?(t.next(),e.stack.shift()):"\\"===t.peek()?(t.next(),t.next()):t.match(/^.[^\\\"\']*/);return"string";case"characterClass":for(;"characterClass"===e.stack[0]&&!t.eol();)t.match(/^[^\]\\]+/)||t.match(/^\\./)||e.stack.shift();return"operator"}var i=t.peek();switch(i){case"[":return t.next(),e.stack.unshift("characterClass"),"bracket";case":":return t.next(),"operator";case"\\":return t.match(/\\[a-z]+/)?"string.special":(t.next(),"atom");case".":case",":case";":case"*":case"-":case"+":case"^":case"<":case"/":case"=":return t.next(),"atom";case"$":return t.next(),"builtin"}return t.match(/\d+/)?t.match(/^\w+/)?"error":"number":t.match(/^[a-zA-Z_]\w*/)?t.match(/(?=[\(.])/,!1)?"keyword":"variable":-1!=["[","]","(",")","{","}"].indexOf(i)?(t.next(),"bracket"):(t.eatSpace()||t.next(),null)}}}),$S=new RegExp(/^[\w]*\.[\w]+/);function PS(t){const e=$S.exec(t),i=Object.values(window.SupportedLanguages);for(let t=0;t{if(!t.docChanged)return null;let e=PS(t.newDoc.line(1).text);if(e.legacy){const i=t.startState.facet(Wa);if(i){if(i.name==e.name)return null}else if(t.startState.facet(CS)==e.name)return null;return console.log("switching... to "+e.name),{effects:vS.reconfigure(e.plugins)}}return e.name===t.startState.facet(Wa).name?null:(console.log("switching... to "+e.name),{effects:vS.reconfigure(e.plugins)})}));let XS,ZS=null;const AS=t=>{const e=t||XS;return e&&e.viewState?(console.log(),PS(e.state.doc.line(1).text).name):""},TS=t=>{const e=t||XS;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return!1;const n=i[0];return[n.from,n.to]},RS=t=>{const e=t||XS;return e&&e.viewState?e.state.doc.toString():""},ES=t=>{const e=t||XS;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return"";const n=i[0];return console.log("yoko"),console.log(n),console.log(e.state.doc.toString().slice(n.from,n.to)),console.log("processing"),e.state.doc.toString().slice(n.from,n.to)},VS=(t,e)=>{const i=e||XS;if(!i)return;if(!i.viewState)return;const n=i.viewState.state.selection.ranges;if(!n.length)return;const s=n[0];console.log("result"),console.log(t),i.dispatch({changes:{...s,insert:t}})},MS=()=>XS,DS=(t,e)=>{const i=e||XS;i&&i.viewState&&(console.log("result"),console.log(t),i.dispatch({changes:{from:0,to:i.viewState.state.doc.length,insert:t}}))};ZS=t=>{let e=new Ts({doc:t.doc,extensions:[Ys.of([{key:"Tab",run:function(t,e){return sd(t)}},{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,LS,Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(XS=e.view)}))],parent:t.parent});return e.viewState.state.config.eval=t.eval,e},ZS.state=t=>{let e=xt.create({doc:t.doc,extensions:[Ys.of([{key:"Tab",run:function(t,e){return sd(t)}},{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,LS,Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(XS=e.view)}))]});return e.config.eval=t.eval,e};const WS={transaction:(t,e,i,n)=>{if(console.log(e.dom.ocellref),e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:DropEvent"]')}},file:(t,e,i,n,s)=>{console.log(e.dom.ocellref),e.dom.ocellref&&server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},US={transaction:(t,e,i,n)=>{if(console.log(e.dom.ocellref),e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:PasteEvent"]')}},file:(t,e,i,n,s)=>{console.log(e.dom.ocellref),e.dom.ocellref&&server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},YS=[Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Cm(WS,US)];let qS=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"}}),LS=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"},".cm-scroller":{"line-height":"inherit","overflow-x":"overlay","overflow-y":"overlay","align-items":"initial"},".cm-content":{padding:"0px 0"},".rainbow-bracket-red":{color:"var(--editor-bracket-1)"},".rainbow-bracket-orange":{color:"var(--editor-bracket-2)"},".rainbow-bracket-yellow":{color:"var(--editor-bracket-3)"},".rainbow-bracket-green":{color:"var(--editor-bracket-4)"},".rainbow-bracket-blue":{color:"var(--editor-bracket-5)"},".rainbow-bracket-indigo":{color:"var(--editor-bracket-6)"},".rainbow-bracket-violet":{color:"var(--editor-bracket-7)"},".rainbow-bracket-red > span":{color:"var(--editor-bracket-1-a)"},".rainbow-bracket-orange > span":{color:"var(--editor-bracket-2-a)"},".rainbow-bracket-yellow > span":{color:"var(--editor-bracket-3-a)"},".rainbow-bracket-green > span":{color:"var(--editor-bracket-4-a)"},".rainbow-bracket-blue > span":{color:"var(--editor-bracket-5-a)"},".rainbow-bracket-indigo > span":{color:"var(--editor-bracket-6-a)"},".rainbow-bracket-violet > span":{color:"var(--editor-bracket-7-a)"}}),zS=!1;const IS=[()=>vr(),()=>Sh(),()=>ir(),()=>dr(),()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xS,{fallback:!1}),()=>tu()],BS={},jS=[()=>vr(),()=>Sh(),()=>ir(),()=>dr(),t=>NS.of(t),()=>BS.gutter?function(t={}){return[eo.of(t),jr(),so]}():[],()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xS,{fallback:!1}),()=>tu(),()=>bS,()=>function(t){return _i.fromClass(class{constructor(e){this.view=e,this.placeholder=ni.set([ni.widget({widget:new kr(t),side:1}).range(0)])}get decorations(){return this.view.state.doc.length?ni.none:this.placeholder}},{decorations:t=>t.decorations})}("Type WL Expression / .md / .js"),()=>xt.allowMultipleSelections.of(!0),(t,e)=>vS.of(e),()=>yS.of(xt.readOnly.of(!1)),()=>_S,()=>{return t?[ou.of(t),Yu]:Yu;var t},(t,e)=>Ys.of([{key:"Tab",run:function(t,e){const i=sd(t);return i||Rc(t)},shift:Ec},{key:"Backspace",run:function(e,i){if(0===e.state.doc.length)return t.origin.remove(),!0}},{key:"ArrowLeft",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus prev"),t.origin.focusPrev(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus next"),t.origin.focusNext(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"Shift-Enter",preventDefault:!0,run:function(e,i){console.log(e.state.doc.toString()),t.origin.eval(e.state.doc.toString())}},...Vc,...Wh,...Ru]),(t,e)=>Ts.updateListener.of((e=>{e.docChanged&&t.origin.save(encodeURIComponent(e.state.doc.toString())),e.selectionSet&&(XS=e.view)})),()=>qS];const NS=E.define();function GS(t){return t.replace(/\\\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\\\:/g,""),16))})).replaceAll("\\:F74E","I").replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))}function FS(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(t=>(+t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+t/4).toString(16)))}core.ReadOnly=()=>"ReadOnly",core.EditorView=async(t,e)=>{let i=await interpretate(t[0],e);i=GS(i),console.log("UNICODE Disaster");const n=await core._getRules(t,e);let s=()=>{},r=()=>{},o=i;const a=[];n.ReadOnly&&a.push(xt.readOnly.of(!0)),n.ForceUpdate&&(e.local.forceUpdate=n.ForceUpdate),n.Event&&(r=t=>{o=t,console.log("editor view emitt data: "+t),server.kernel.emitt(n.Event,'"'+t.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Input")},s=()=>{server.kernel.emitt(n.Event,'"'+o.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Evaluate")}),e.local?e.local.editor=ZS({doc:i,parent:e.element,eval:s,update:r,extensions:a}):ZS({doc:i,parent:e.element,eval:s,update:r,extensions:a}),e.element.style.verticalAlign="inherit"},core.StripOnInput=async()=>{},core.EditorView.update=async(t,e)=>{if(!e.local.editor)return;const i=GS(await interpretate(t[0],e));console.log("editor view: dispatch"),e.local.forceUpdate,e.local.editor.dispatch({changes:{from:0,to:e.local.editor.state.doc.length,insert:i}})},core.EditorView.destroy=async(t,e)=>{await interpretate(t[0],e),e.local&&e.local.editor&&e.local.editor.destroy()},core.EditorView.virtual=!0,core.PreviewCell=(t,e)=>{},window.SupportedLanguages.push({check:t=>null===t,legacy:!0,plugins:YS,name:"mathematica"}),window.SupportedLanguages.push({check:t=>null!=t[0].match(/\w+\.(wl|wls)$/),plugins:YS,legacy:!0,name:"mathematica"}),window.SupportedCells.codemirror={view:class{origin={};editor={};trash=[];forceFocusNext(){zS=!0}focus(t){t>0?this.editor.dispatch({selection:{anchor:0}}):t<0&&this.editor.dispatch({selection:{anchor:this.editor.state.doc.length}}),this.editor.focus()}setContent(t){if(console.warn("content mutation!"),!this.editor.viewState)return;const e=this.editor;console.log("result"),console.log(t),this.editor.dispatch({changes:{from:0,to:e.viewState.state.doc.length,insert:t}})}addDisposable(t){this.trash.push(t)}dispose(){this.editor.destroy()}readOnly(t){this.editor.dispatch({effects:yS.reconfigure(xt.readOnly.of(t))})}constructor(t,e){this.origin=t;const i=this.origin,n=PS(e).plugins,s=this;this.origin.element.ocellref=s;const r=new Ts({doc:(o=e,o.replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))),extensions:jS.map((t=>t(s,n))),parent:this.origin.element});var o;return this.editor=r,this.editor.dom.ocellref=s,this.editor.viewState.state.config.eval=()=>{i.eval(this.editor.state.doc.toString())},zS&&r.focus(),zS=!1,this}},context:{EditorAutocomplete:kS,javascriptLanguage:qf,javascript:Nf,markdownLanguage:rm,markdown:function(t={}){let{codeLanguages:e,defaultCodeLanguage:i,addKeymap:n=!0,base:{parser:s}=sm}=t;if(!(s instanceof Zp))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let r,o=t.extensions?[t.extensions]:[],a=[dm.support];i instanceof Ua?(a.push(i.support),r=i.language):i&&(r=i);let l=e||r?(h=e,c=r,t=>{if(t&&h){let e=null;if(t=/\S*/.exec(t)[0],e="function"==typeof h?h(t):Ya.matchLanguageName(h,t,!0),e instanceof Ya)return e.support?e.support.language.parser:Ta.getSkippingParser(e.load());if(e)return e.parser}return c?c.parser:null}):void 0;var h,c;return o.push(function(t){let{codeParser:e,htmlParser:i}=t,n=Do(((t,n)=>{let s=t.type.id;if(!e||s!=Kf.CodeBlock&&s!=Kf.FencedCode){if(i&&(s==Kf.HTMLBlock||s==Kf.HTMLTag))return{parser:i,overlay:rO(t.node,t.from,t.to)}}else{let i="";if(s==Kf.FencedCode){let e=t.node.getChild(Kf.CodeInfo);e&&(i=n.read(e.from,e.to))}let r=e(i);if(r)return{parser:r,overlay:t=>t.type.id==Kf.CodeText}}return null}));return{wrap:n}}({codeParser:l,htmlParser:dm.language.parser})),n&&a.push(N.high(Ys.of(um))),new Ua(nm(s.configure(o)),a)},htmlLanguage:jg,html:Ng,cssLanguage:kg,css:Qg,EditorView:Ts,EditorState:xt,highlightSpecialChars:vr,syntaxHighlighting:$l,defaultHighlightStyle:xS,editorCustomTheme:qS,foldGutter:function(t={}){let e=Object.assign(Object.assign({},wl),t),i=new vl(e,!0),n=new vl(e,!1),s=_i.fromClass(class{constructor(t){this.from=t.viewport.from,this.markers=this.buildMarkers(t)}update(t){(t.docChanged||t.viewportChanged||t.startState.facet(Wa)!=t.state.facet(Wa)||t.startState.field(dl,!1)!=t.state.field(dl,!1)||Xa(t.startState)!=Xa(t.state)||e.foldingChanged(t))&&(this.markers=this.buildMarkers(t.view))}buildMarkers(t){let e=new Xt;for(let s of t.viewportLineBlocks){let r=fl(t.state,s.from,s.to)?n:ll(t.state,s.from,s.to)?i:null;r&&e.add(s.from,s.from,r)}return e.finish()}}),{domEventHandlers:r}=e;return[s,Ir({class:"cm-foldGutter",markers(t){var e;return(null===(e=t.plugin(s))||void 0===e?void 0:e.markers)||_t.empty},initialSpacer:()=>new vl(e,!1),domEventHandlers:Object.assign(Object.assign({},r),{click:(t,e,i)=>{if(r.click&&r.click(t,e,i))return!0;let n=fl(t.state,e.from,e.to);if(n)return t.dispatch({effects:ul.of(n)}),!0;let s=ll(t.state,e.from,e.to);return!!s&&(t.dispatch({effects:cl.of(s)}),!0)}})}),ml()]},Facet:E,Compartment:F,mathematicaPlugins:YS,legacyLangNameFacet:CS,DropPasteHandlers:Cm,EditorExtensionsMinimal:IS,EditorParameters:BS,EditorExtensions:jS,StateField:q,Decoration:ni,ViewPlugin:_i,WidgetType:ei,originFacet:NS,MatchDecorator:pr}},window.OfflineMode&&SS.push(xt.readOnly.of(!0)),core.CellView=async(t,e)=>{const i=await core._getRules(t,e);i.Display||(i.Display="codemirror");const n=await interpretate(t[0],e),s={element:e.element,uid:FS()};i.Style&&(e.element.style=i.Style),i.Class&&e.element.classList.add(...i.Class.split(" ")),i.ImageSize&&(Array.isArray(i.ImageSize)?(e.element.style.width=i.ImageSize[0]+"px",e.element.style.height=i.ImageSize[1]+"px"):e.element.style.width=i.ImageSize+"px"),new window.SupportedCells[i.Display].view(s,n)};const HS={};core.FrontEditorSelected=async(t,e)=>{console.log("check");const i=await interpretate(t[0],e),n=await core._getRules(t,e);let s;switch(n.Editor&&(s=HS[n.Editor],console.log("Editor"),console.log(n.Editor),console.log(s)),i){case"Get":return ES(s);case"Set":let i=await interpretate(t[1],e);VS(i,s);break;case"GetDoc":return RS(s);case"SetDoc":let n=await interpretate(t[1],e);DS(n,s);break;case"Cursor":return TS(s);case"Type":return AS(s);case"Editor":const r=FS();return HS[r]=MS(),r}}; diff --git a/libs/priceless-mathematica/src/boxes/gridbox.js b/libs/priceless-mathematica/src/boxes/gridbox.js index aa6da40..fd34924 100644 --- a/libs/priceless-mathematica/src/boxes/gridbox.js +++ b/libs/priceless-mathematica/src/boxes/gridbox.js @@ -28,7 +28,7 @@ import { ]; } - const itemBox = /"(.+)"\(\*VB\[\*\)\(\*\*\)\(\*\,\*\)\(\*\"([\w:\d=+-]*)/; + const itemBox = /"(.+)"\(\*VB\[\*\)\(\*\*\)\(\*\,\*\)\(\*\"([\w:\d=+-/]*)/; class EditorWidget { From 4a5e6a622d962cf9ff260ff00cbcec4120ba50d8 Mon Sep 17 00:00:00 2001 From: Kirill Vasin Date: Sun, 17 Nov 2024 21:27:54 +0100 Subject: [PATCH 14/26] added shell cells --- dist/kernel.js | 24 ++++++++++++++++++++++++ dist/kernel.min.js | 2 +- src/Frontend.wl | 40 ++++++++++++++++++++++++++++++++++++++++ src/kernel.js | 24 ++++++++++++++++++++++++ 4 files changed, 89 insertions(+), 1 deletion(-) diff --git a/dist/kernel.js b/dist/kernel.js index 6e31a8f..2feb14f 100644 --- a/dist/kernel.js +++ b/dist/kernel.js @@ -40818,3 +40818,27 @@ core.FrontEditorSelected = async (args, env) => { return key; } }; + + +class ShellCell { + + dispose() { + + } + + constructor(parent, data) { + this.origin = parent; + const result = document.createElement('div'); + result.classList.add(...('flex sc-b max-h-60 text-sm overflow-y-scroll'.split(' '))); + result.style.overflowAnchor = 'auto'; + result.style.flexDirection = 'column-reverse'; + result.innerText = data; + this.origin.element.appendChild(result); + + return this; + } +} + +window.SupportedCells['shell'] = { + view: ShellCell +}; diff --git a/dist/kernel.min.js b/dist/kernel.min.js index 017eed0..8c5f9a2 100644 --- a/dist/kernel.min.js +++ b/dist/kernel.min.js @@ -1 +1 @@ -class t{constructor(){}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 a(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}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 l(n,o,i,r);n=o+1,i++}}decompose(t,i,r,o){let a=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(a.text,t.text.slice(),0,a.length);if(i.length<=32)r.push(new e(i,t.length+a.length));else{let t=i.length>>1;r.push(new e(i.slice(0,t)),new e(i.slice(t)))}}else r.push(a)}replace(t,r,o){if(!(o instanceof e))return super.replace(t,r,o);let a=n(this.text,n(o.text,s(this.text,0,t)),r),l=this.length+o.length-(r-t);return a.length<=32?new e(a,l):i.from(e.split(a,[]),l)}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=a+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,a=i+r.lines-1;if((e?a:o)>=t)return r.lineInner(t,e,i,n);n=o+1,i=a+1}}decompose(t,e,i,n){for(let s=0,r=0;r<=e&&s=r){let s=n&((r<=t?1:0)|(a>=e?2:0));r>=t&&a<=e&&!s?i.push(o):o.decompose(t-r,e-r,i,s)}r=a+1}}replace(t,e,n){if(n.lines=r&&e<=a){let l=o.replace(t-r,e-r,n),h=this.lines-o.lines+l.lines;if(l.lines>4&&l.lines>h>>6){let r=this.children.slice();return r[s]=l,new i(r,this.length-(e-t)+n.length)}return super.replace(r,a,l)}r=a+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=a+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,a]=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==a)return n;let i=this.children[s],l=t.children[r];if(i!=l)return n+i.scanIdentical(l,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,a=r>>1,l=[],h=0,c=-1,u=[];function d(t){let n;if(t.lines>o&&t instanceof i)for(let e of t.children)d(e);else t.lines>a&&(h>a||!h)?(f(),l.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&&f(),h+=t.lines,c+=t.length+1,u.push(t))}function f(){0!=h&&(l.push(1==u.length?u[0]:i.from(u,c)),c=-1,h=u.length=0)}for(let e of t)d(e);return f(),1==l.length?l[0]:new i(l,n)}}function n(t,e,i=0,n=1e9){for(let s=0,r=0,o=!0;r=i&&(l>n&&(a=a.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,a=s instanceof e?s.text.length:s.children.length;if(o==(i>0?a: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 a{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]=a.prototype[Symbol.iterator]=function(){return this});let l=class{constructor(t,e,i,n){this.from=t,this.to=e,this.number=i,this.text=n}get length(){return this.to-this.from}},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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,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 d=8205;function f(t,e,i=!0,n=!0){return(i?p:O)(t,e,n)}function p(t,e,i){if(e==t.length)return e;e&&g(t.charCodeAt(e))&&m(t.charCodeAt(e-1))&&e--;let n=b(t,e);for(e+=v(n);e=0&&u(b(t,n));)i++,n-=2;if(i%2==0)break;e+=2}}}return e}function O(t,e,i){for(;e>0;){let n=p(t,e-2,i);if(n=56320&&t<57344}function m(t){return t>=55296&&t<56320}function b(t,e){let i=t.charCodeAt(e);if(!m(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return g(n)?n-56320+(i-55296<<10)+65536:i}function w(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function v(t){return t<65536?1:2}const y=/\r\n?|\n/;var S=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(S||(S={}));class x{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;et)return s+(t-n);s+=o}else{if(i!=S.Simple&&l>=t&&(i==S.TrackDel&&nt||i==S.TrackBefore&&nt))return null;if(l>t||l==t&&e<0&&!o)return t==n||e<0?s:s+a;s+=a}n=l}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 x(t)}static create(t){return new x(t)}}class k extends x{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 P(this,((e,i,n,s,r)=>t=t.replace(n,n+(i-e),r)),!1),t}mapDesc(t,e=!1){return C(this,t,e,!0)}invert(e){let i=this.sections.slice(),n=[];for(let s=0,r=0;s=0){i[s]=a,i[s+1]=o;let l=s>>1;for(;n.length0&&$(i,e,s.text),s.forward(t),o+=t}let l=t[r++];for(;o>1].toJSON()))}return t}static of(e,i,n){let s=[],r=[],o=0,a=null;function l(t=!1){if(!t&&!s.length)return;oa||e<0||a>i)throw new RangeError(`Invalid change range ${e} to ${a} (in doc of length ${i})`);let u=c?"string"==typeof c?t.of(c.split(n||y)):c:t.empty,d=u.length;if(e==a&&0==d)return;eo&&Q(s,e-o,-1),Q(s,a-e,d),$(r,s,u),o=a}}(e),l(!a),a}static empty(t){return new k(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 $(e,i,n){if(0==n.length)return;let s=i.length-2>>1;if(s>1])),!(n||a==e.sections.length||e.sections[a+1]<0);)l=e.sections[a++],h=e.sections[a++];i(r,c,o,u,d),r=c,o=u}}}function C(t,e,i,n=!1){let s=[],r=n?[]:null,o=new X(t),a=new X(e);for(let t=-1;;)if(-1==o.ins&&-1==a.ins){let t=Math.min(o.len,a.len);Q(s,t,-1),o.forward(t),a.forward(t)}else if(a.ins>=0&&(o.ins<0||t==o.i||0==o.off&&(a.len=0&&t=0)){if(o.done&&a.done)return r?k.createSet(s,r):x.create(s);throw new Error("Mismatched change set lengths")}{let e=0,i=o.len;for(;i;)if(-1==a.ins){let t=Math.min(i,a.len);e+=t,i-=t,a.forward(t)}else{if(!(0==a.ins&&a.lene||o.ins>=0&&o.len>e)&&(t||n.length>i),r.forward2(e),o.forward(e)}}else Q(n,0,o.ins,t),s&&$(s,n,o.text),o.next()}}class X{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 Z{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 Z(i,n,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return A.range(t,e);let i=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return A.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 A.range(t.anchor,t.head)}static create(t,e,i){return new Z(t,e,i)}}class A{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:A.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 A(t.ranges.map((t=>Z.fromJSON(t))),t.main)}static single(t,e=t){return new A([A.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?A.range(o,r):A.range(r,o))}}return new A(t,e)}}function T(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let R=0;class E{constructor(t,e,i,n,s){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=n,this.id=R++,this.default=t([]),this.extensions="function"==typeof s?s(this):s}static define(t={}){return new E(t.combine||(t=>t),t.compareInput||((t,e)=>t===e),t.compare||(t.combine?(t,e)=>t===e:V),!!t.static,t.enables)}of(t){return new M([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,2,e)}from(t,e){return e||(e=t=>t),this.compute([t],(i=>e(i.field(t))))}}function V(t,e){return t==e||t.length==e.length&&t.every(((t,i)=>t===e[i]))}class M{constructor(t,e,i,n){this.dependencies=t,this.facet=e,this.type=i,this.value=n,this.id=R++}dynamicSlot(t){var e;let i=this.value,n=this.facet.compareInput,s=this.id,r=t[s]>>1,o=2==this.type,a=!1,l=!1,h=[];for(let i of this.dependencies)"doc"==i?a=!0:"selection"==i?l=!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(a&&e.docChanged||l&&(e.docChanged||e.selection)||W(t,h)){let e=i(t);if(o?!D(e,t.values[r],n):!n(e,t.values[r]))return t.values[r]=e,1}return 0},reconfigure:(t,e)=>{let a,l=e.config.address[s];if(null!=l){let s=tt(e,l);if(this.dependencies.every((i=>i instanceof E?e.facet(i)===t.facet(i):!(i instanceof q)||e.field(i,!1)==t.field(i,!1)))||(o?D(a=i(t),s,n):n(a=i(t),s)))return t.values[r]=s,0}else a=i(t);return t.values[r]=a,1}}}}function D(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 a(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(Y).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,Y.of({field:this,create:t})]}get extension(){return this}}const L=4,z=3,I=2,B=1;function j(t){return e=>new G(e,t)}const N={highest:j(0),high:j(B),default:j(I),low:j(z),lowest:j(L)};class G{constructor(t,e){this.inner=t,this.prec=e}}class F{of(t){return new H(this,t)}reconfigure(t){return F.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class H{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;function r(t,o){let a=s.get(t);if(null!=a){if(a<=o)return;let e=n[a].indexOf(t);e>-1&&n[a].splice(e,1),t instanceof H&&i.delete(t.compartment)}if(s.set(t,o),Array.isArray(t))for(let e of t)r(e,o);else if(t instanceof H){if(i.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");let n=e.get(t.compartment)||t.inner;i.set(t.compartment,n),r(n,o)}else if(t instanceof G)r(t.inner,t.prec);else if(t instanceof q)n[o].push(t),t.provides&&r(t.provides,o);else if(t instanceof M)n[o].push(t),t.facet.extensions&&r(t.facet.extensions,I);else{let e=t.extension;if(!e)throw new Error(`Unrecognized extension value in extension set (${t}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(e,o)}}return r(t,I),n.reduce(((t,e)=>t.concat(e)))}(t,e,r))i instanceof q?n.push(i):(s[i.facet.id]||(s[i.facet.id]=[])).push(i);let o=Object.create(null),a=[],l=[];for(let t of n)o[t.id]=l.length<<1,l.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]=a.length<<1|1,V(r,e))a.push(i.facet(n));else{let t=n.combine(e.map((t=>t.value)));a.push(i&&n.compare(t,i.facet(n))?i.facet(n):t)}else{for(let t of e)0==t.type?(o[t.id]=a.length<<1|1,a.push(t.value)):(o[t.id]=l.length<<1,l.push((e=>t.dynamicSlot(e))));o[n.id]=l.length<<1,l.push((t=>U(t,n,e)))}}let c=l.map((t=>t(o)));return new J(t,r,c,o,a,s)}}function K(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 tt(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}const et=E.define(),it=E.define({combine:t=>t.some((t=>t)),static:!0}),nt=E.define({combine:t=>t.length?t[0]:void 0,static:!0}),st=E.define(),rt=E.define(),ot=E.define(),at=E.define({combine:t=>!!t.length&&t[0]});class lt{constructor(t,e){this.type=t,this.value=e}static define(){return new ht}}class ht{of(t){return new lt(this,t)}}class ct{constructor(t){this.map=t}of(t){return new ut(this,t)}}class ut{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 ut(this.type,e)}is(t){return this.type==t}static define(t={}){return new ct(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}}ut.reconfigure=ut.define(),ut.appendConfig=ut.define();class dt{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&&T(i,e.newLength),s.some((t=>t.type==dt.time))||(this.annotations=s.concat(dt.time.of(Date.now())))}static create(t,e,i,n,s,r){return new dt(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(dt.userEvent);return!(!e||!(e==t||e.length>t.length&&e.slice(0,t.length)==t&&"."==e[t.length]))}}function ft(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=pt(n,Ot(e,r,t.changes.newLength),!0))}return n==t?t:dt.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(st)){let e=n(t);if(!1===e){i=!1;break}Array.isArray(e)&&(i=!0===i?e:ft(i,e))}if(!0!==i){let n,s;if(!1===i)s=t.changes.invertedDesc,n=k.empty(e.doc.length);else{let e=t.changes.filter(i);n=e.changes,s=e.filtered.mapDesc(e.changes).invertedDesc}t=dt.create(e,n,t.selection&&t.selection.map(s),ut.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let n=e.facet(rt);for(let i=n.length-1;i>=0;i--){let s=n[i](t);t=s instanceof dt?s:Array.isArray(s)&&1==s.length&&s[0]instanceof dt?s[0]:gt(e,bt(s),!1)}return t}(s):s)}dt.time=lt.define(),dt.userEvent=lt.define(),dt.addToHistory=lt.define(),dt.remote=lt.define();const mt=[];function bt(t){return null==t?mt:Array.isArray(t)?t:[t]}var wt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(wt||(wt={}));const vt=/[\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){}function St(t){return e=>{if(!/\S/.test(e))return wt.Space;if(function(t){if(yt)return yt.test(t);for(let e=0;e"€"&&(i.toUpperCase()!=i.toLowerCase()||vt.test(i)))return!0}return!1}(e))return wt.Word;for(let i=0;i-1)return wt.Word;return wt.Other}}class xt{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(ut.reconfigure)?(i=null,n=e.value):e.is(ut.appendConfig)&&(i=null,n=bt(n).concat(e.value));if(i)e=t.startState.values.slice();else{i=J.resolve(n,s,this),e=new xt(i,this.doc,this.selection,i.dynamicSlots.map((()=>null)),((t,e)=>e.reconfigure(t,this)),null).values}new xt(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:A.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=bt(i.effects);for(let i=1;is.spec.fromJSON(r,t))))}return xt.create({doc:t.doc,selection:A.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(xt.lineSeparator)||y)),s=e.selection?e.selection instanceof A?e.selection:A.single(e.selection.anchor,e.selection.head):A.single(0);return T(s,n.length),i.staticFacet(it)||(s=s.asSingle()),new xt(i,n,s,i.dynamicSlots.map((()=>null)),((t,e)=>e.create(t)),null)}get tabSize(){return this.facet(xt.tabSize)}get lineBreak(){return this.facet(xt.lineSeparator)||"\n"}get readOnly(){return this.facet(at)}phrase(t,...e){for(let e of this.facet(xt.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(et))for(let r of s(this,e,i))Object.prototype.hasOwnProperty.call(r,t)&&n.push(r[t]);return n}charCategorizer(t){return St(this.languageDataAt("wordChars",t).join(""))}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=f(e,r,!1);if(s(e.slice(t,r))!=wt.Word)break;r=t}for(;ot.length?t[0]:4}),xt.lineSeparator=nt,xt.readOnly=at,xt.phrases=E.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]))}}),xt.languageData=et,xt.changeFilter=st,xt.transactionFilter=rt,xt.transactionExtender=ot,F.reconfigure=ut.define();class Qt{eq(t){return this==t}range(t,e=t){return $t.create(t,e,this)}}Qt.prototype.startSide=Qt.prototype.endSide=0,Qt.prototype.point=!1,Qt.prototype.mapMode=S.TrackDel;let $t=class t{constructor(t,e,i){this.from=t,this.to=e,this.value=i}static create(e,i,n){return new t(e,i,n)}};function Pt(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Ct{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,a=s[n]-t||(i?this.value[n].endSide:this.value[n].startSide)-e;if(n==r)return a>=0?r:o;a>=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||l==h&&c.startSide>0&&c.endSide<=0)continue;(h-l||c.endSide-c.startSide)<0||(r<0&&(r=l),c.point&&(o=Math.max(o,h-l)),i.push(c),n.push(l-r),s.push(h-r))}return{mapped:i.length?new Ct(n,s,i,o):null,pos:r}}}class _t{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 _t(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(Pt)),this.isEmpty)return e.length?_t.of(e):this;let o=new At(this,null,-1).goto(0),a=0,l=[],h=new Xt;for(;o.value||a=0){let t=e[a++];h.addInner(t.from,t.to,t.value)||l.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 Tt.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return Tt.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)),a=Zt(r,o,i),l=new Et(r,a,s),h=new Et(o,a,s);i.iterGaps(((t,e,i)=>Vt(l,t,h,e,i,n))),i.empty&&0==i.length&&Vt(l,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=Zt(s,r),a=new Et(s,o,0).goto(i),l=new Et(r,o,0).goto(i);for(;;){if(a.to!=l.to||!Mt(a.active,l.active)||a.point&&(!l.point||!a.point.eq(l.point)))return!1;if(a.to>n)return!0;a.next(),l.next()}}static spans(t,e,i,n,s=-1){let r=new Et(t,null,s).goto(e),o=e,a=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,a),a=r.openEnd(t));if(r.to>i)return a+(r.point&&r.to>i?1:0);o=r.to,r.next()}}static of(t,e=!1){let i=new Xt;for(let n of t instanceof $t?[t]:e?function(t){if(t.length>1)for(let e=t[0],i=1;i0)return t.slice().sort(Pt);e=n}return t}(t):t)i.add(n.from,n.to,n.value);return i.finish()}}_t.empty=new _t([],[],null,-1),_t.empty.nextLayer=_t.empty;class Xt{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}finishChunk(t){this.chunks.push(new Ct(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=[])}add(t,e,i){this.addInner(t,e,i)||(this.nextLayer||(this.nextLayer=new Xt)).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(_t.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;let e=_t.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function Zt(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 At(r,e,i,s));return 1==n.length?n[0]:new Tt(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--)Rt(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--)Rt(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(),Rt(this.heap,0)}}}function Rt(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 Et{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=Tt.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){Dt(this.active,t),Dt(this.activeTo,t),Dt(this.activeRank,t),this.minActive=Ut(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&&Dt(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 Vt(t,e,i,n,s,r){t.goto(e),i.goto(n);let o=n+s,a=n,l=n-e;for(;;){let e=t.to+l-i.to||t.endSide-i.endSide,n=e<0?t.to+l: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))&&Mt(t.activeForPoint(t.to+l),i.activeForPoint(i.to))||r.comparePoint(a,s,t.point,i.point):s>a&&!Mt(t.active,i.active)&&r.compareRange(a,s,t.active,i.active),n>o)break;a=n,e<=0&&t.next(),e>=0&&i.next()}}function Mt(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 Ut(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(!l)throw new RangeError("The value of a property ("+i+") should be a primitive value.");s(n(i),o,a,h)}else null!=o&&a.push(i.replace(/_.*/,"").replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))+": "+o+";")}(a.length||h)&&r.push((!i||l||o?t:t.map(i)).join(", ")+" {"+a.join(" ")+"}")}for(let e in t)s(n(e),t[e],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let t=zt[qt]||1;return zt[qt]=t+1,"ͼ"+t.toString(36)}static mount(t,e){(t[Lt]||new jt(t)).mount(Array.isArray(e)?e:[e])}}let Bt=new Map;class jt{constructor(t){let e=t.ownerDocument||t,i=e.defaultView;if(!t.head&&t.adoptedStyleSheets&&i.CSSStyleSheet){let n=Bt.get(e);if(n)return t.adoptedStyleSheets=[n.sheet,...t.adoptedStyleSheets],t[Lt]=n;this.sheet=new i.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets],Bt.set(e,this)}else{this.styleTag=e.createElement("style");let i=t.head||t;i.insertBefore(this.styleTag,i.firstChild)}this.modules=[],t[Lt]=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:'"'},Ft="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),Ht="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Jt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Kt=Ht||Ft&&+Ft[1]<57,te=0;te<10;te++)Nt[48+te]=Nt[96+te]=String(te);for(te=1;te<=24;te++)Nt[te+111]="F"+te;for(te=65;te<=90;te++)Nt[te]=String.fromCharCode(te+32),Gt[te]=String.fromCharCode(te);for(var ee in Nt)Gt.hasOwnProperty(ee)||(Gt[ee]=Nt[ee]);function ie(t){let e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection()}function ne(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function se(t,e){if(!e.anchorNode)return!1;try{return ne(t,e.anchorNode)}catch(t){return!1}}function re(t){return 3==t.nodeType?me(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function oe(t,e,i,n){return!!i&&(le(t,e,i,n,-1)||le(t,e,i,n,1))}function ae(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function le(t,e,i,n,s){for(;;){if(t==i&&e==n)return!0;if(e==(s<0?0:he(t))){if("DIV"==t.nodeName)return!1;let i=t.parentNode;if(!i||1!=i.nodeType)return!1;e=ae(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?he(t):0}}}function he(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}const ce={left:0,right:0,top:0,bottom:0};function ue(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function de(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}class fe{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){this.set(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset)}set(t,e,i,n){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=n}}let pe,Oe=null;function ge(t){if(t.setActive)return t.setActive();if(Oe)return t.focus(Oe);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==Oe?{get preventScroll(){return Oe={preventScroll:!0},!0}}:void 0),!Oe){Oe=!1;for(let t=0;te)return i.domBoundsAround(t,e,l);if(c>=t&&-1==n&&(n=a,s=l),l>e&&i.dom.parentNode==this.dom){r=a,o=h;break}h=c,l=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.dirty|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.dirty|=2),1&e.dirty)return;e.dirty|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,this.dirty&&this.markParentsDirty(!0))}setDOM(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=ye){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 Qe(t,e,i,n,s,r,o,a,l){let{children:h}=t,c=h.length?h[e]:null,u=r.length?r[r.length-1]:null,d=u?u.breakAfter:o;if(!(e==n&&c&&!o&&!d&&r.length<2&&c.merge(i,s,r.length?u:null,0==i,a,l))){if(n0&&(!o&&r.length&&c.merge(i,c.length,r[0],!1,a,0)?c.breakAfter=r.shift().breakAfter:(i2);var De={mac:Me||/Mac/.test(Pe.platform),windows:/Win/.test(Pe.platform),linux:/Linux|X11/.test(Pe.platform),ie:Ae,ie_version:Xe?Ce.documentMode||6:Ze?+Ze[1]:_e?+_e[1]:0,gecko:Te,gecko_version:Te?+(/Firefox\/(\d+)/.exec(Pe.userAgent)||[0,0])[1]:0,chrome:!!Re,chrome_version:Re?+Re[1]:0,ios:Me,android:/Android\b/.test(Pe.userAgent),webkit:Ee,safari:Ve,webkit_version:Ee?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Ce.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class We extends Se{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(!i||i instanceof We&&!(this.length-(e-t)+i.length>256))&&(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),!0)}split(t){let e=new We(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new ve(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 Ye(this.dom,t,e)}}class Ue extends Se{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(we(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}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.dirty|=6)}sync(t,e){this.dom?4&this.dirty&&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 Ue&&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 Ue(this.mark,e,r)}domAtPos(t){return Ge(this,t)}coordsAt(t,e){return He(this,t,e)}}function Ye(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?De.chrome||De.gecko||(e?(s--,o=1):r=0)?0:a.length-1];return De.safari&&!o&&0==l.width&&(l=Array.prototype.find.call(a,(t=>t.width))||l),o?ue(l,o<0):l||null}class qe extends Se{constructor(t,e,i){super(),this.widget=t,this.length=e,this.side=i,this.prevWidget=null}static create(t,e,i){return new(t.customView||qe)(t,e,i)}split(t){let e=qe.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 qe&&this.widget.compare(i.widget))||t>0&&s<=0||e0)?ve.before(this.dom):ve.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let i=this.dom.getClientRects(),n=null;if(!i.length)return ce;for(let e=t>0?i.length-1:0;n=i[e],!(t>0?0==e:e==i.length-1||n.top0?-1:1);return this.length?n:ue(n,this.side>0)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class Le extends qe{domAtPos(t){let{topView:e,text:i}=this.widget;return e?ze(t,0,e,i,this.length-e.length,((t,e)=>t.domAtPos(e)),((t,e)=>new ve(t,Math.min(e,t.nodeValue.length)))):new ve(i,Math.min(t,i.nodeValue.length))}sync(){this.setDOM(this.widget.toDOM())}localPosFromDOM(t,e){let{topView:i,text:n}=this.widget;return i?Be(t,e,i,n,this.length-i.length):Math.min(e,this.length)}ignoreMutation(){return!1}get overrideDOMText(){return null}coordsAt(t,e){let{topView:i,text:n}=this.widget;return i?ze(t,e,i,n,this.length-i.length,((t,e,i)=>t.coordsAt(e,i)),((t,e,i)=>Ye(t,e,i))):Ye(n,t,e)}destroy(){var t;super.destroy(),null===(t=this.widget.topView)||void 0===t||t.destroy()}get isEditable(){return!0}canReuseDOM(){return!0}}function ze(t,e,i,n,s,r,o){if(i instanceof Ue){for(let a=i.dom.firstChild;a;a=a.nextSibling){let i=Se.get(a);if(i){let l=ne(a,n),h=i.length+(l?s:0);if(t0?ve.before(this.dom):ve.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){let e=this.dom.getBoundingClientRect(),i=function(t,e){let i=t.parent,n=i?i.children.indexOf(t):-1;for(;i&&n>=0;)if(e<0?n>0:n0?-1:1);return i&&i.tope.top?{left:e.left,right:e.right,top:i.top,bottom:i.bottom}:e}get overrideDOMText(){return t.empty}get isHidden(){return!0}}function Ge(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 Ue&&s.length&&(n=s[s.length-1])instanceof Ue&&n.mark.eq(e.mark)?Fe(n,e.children[0],i-1):(s.push(e),e.setParent(t)),t.length+=e.length}function He(t,e,i){let n=null,s=-1,r=null,o=-1;!function t(e,a){for(let l=0,h=0;l=a&&(c.children.length?t(c,a-h):(!r||r instanceof Ne&&i>0)&&(u>a||h==u&&c.getSide()>0)?(r=c,o=a-h):(h0?3e8:-4e8:e>0?1e8:-1e8,new oi(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}=ai(t,n);e=(s?n?-3e8:-1:5e8)-1,i=1+(r?n?2e8:1:-6e8)}return new oi(t,e,i,n,t.widget||null,!0)}static line(t){return new ri(t)}static set(t,e=!1){return _t.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}ni.none=_t.empty;class si extends ni{constructor(t){let{start:e,end:i}=ai(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){return this==t||t instanceof si&&this.tagName==t.tagName&&this.class==t.class&&Ke(this.attrs,t.attrs)}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}si.prototype.point=!1;class ri extends ni{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof ri&&this.spec.class==t.spec.class&&Ke(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)}}ri.prototype.mapMode=S.TrackBefore,ri.prototype.point=!0;class oi extends ni{constructor(t,e,i,n,s,r){super(e,i,s,t),this.block=n,this.isReplace=r,this.mapMode=n?e<=0?S.TrackBefore:S.TrackAfter:S.TrackDel}get type(){return this.startSide=5}eq(t){return t instanceof oi&&(e=this.widget,i=t.widget,e==i||!!(e&&i&&e.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var e,i}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 ai(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 li(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)}oi.prototype.point=!0;class hi extends Se{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 hi))return!1;this.dom||i.transferDOM(this)}return n&&this.setDeco(i?i.attrs:null),$e(this,t,e,i?i.children:[],s,r),!0}split(t){let e=new hi;if(e.breakAfter=this.breakAfter,0==this.length)return e;let{i: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){Ke(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){Fe(this,t,e)}addLineDeco(t){let e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=Je(e,this.attrs||{})),i&&(this.attrs=Je({class:i},this.attrs||{}))}domAtPos(t){return Ge(this,t)}reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.dirty|=6)}sync(t,e){var i;this.dom?4&this.dirty&&(we(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&&(ti(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&&Se.get(n)instanceof Ue;)n=n.lastChild;if(!(n&&this.length&&("BR"==n.nodeName||0!=(null===(i=Se.get(n))||void 0===i?void 0:i.isEditable)||De.ios&&this.children.some((t=>t instanceof We))))){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 We)||/[^ -~]/.test(i.text))return null;let n=re(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=He(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 hi)return s;if(r>e)break}n=r+s.breakAfter}return null}}class ci extends Se{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 ci&&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(di(new We(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 oi){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let o=e-t;if(i instanceof oi)if(i.block){let{type:t}=i;t!=ii.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new ci(i.widget||new fi("div"),o,t))}else{let r=qe.create(i.widget||new fi("span"),o,o?0:i.startSide),a=this.atCursorPos&&!r.isEditable&&s<=n.length&&(t0),l=!r.isEditable&&(tn.length||i.startSide<=0),h=this.getLine();2!=this.pendingBuffer||a||r.isEditable||(this.pendingBuffer=0),this.flushBuffer(n),a&&(h.append(di(new Ne(1),n),s),s=n.length+Math.max(0,s-n.length)),h.append(di(r,n),s),this.atCursorPos=l,this.pendingBuffer=l?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 ui(t,e,i,s);return r.openEnd=_t.spans(n,e,i,r),r.openStart<0&&(r.openStart=r.openEnd),r.finish(r.openEnd),r}}function di(t,e){for(let i of e)t=new Ue(i,[t],t.length);return t}class fi extends ei{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 pi=E.define(),Oi=E.define(),gi=E.define(),mi=E.define(),bi=E.define(),wi=E.define(),vi=E.define(),yi=E.define({combine:t=>t.some((t=>t))}),Si=E.define({combine:t=>t.some((t=>t))});class xi{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 xi(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin)}}const ki=ut.define({map:(t,e)=>t.map(e)});function Qi(t,e,i){let n=t.facet(mi);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 $i=E.define({combine:t=>!t.length||t[0]});let Pi=0;const Ci=E.define();class _i{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 _i(Pi++,t,i,(t=>{let e=[Ci.of(t)];return s&&e.push(Ti.of((e=>{let i=e.plugin(t);return i?s(i):ni.none}))),n&&e.push(n(t)),e}))}static fromClass(t,e){return _i.define((e=>new t(e)),e)}}class Xi{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(Qi(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){Qi(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){Qi(t.state,e,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Zi=E.define(),Ai=E.define(),Ti=E.define(),Ri=E.define(),Ei=E.define(),Vi=E.define();class Mi{constructor(t,e,i,n){this.fromA=t,this.toA=e,this.fromB=i,this.toB=n}join(t){return new Mi(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(!a)return i;new Mi(a.fromA,a.toA,a.fromB,a.toB).addToSet(i),r=a.toA,o=a.toB}}}class Di{constructor(t,e,i){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=k.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 Mi(t,e,i,s)))),this.changedRanges=n}static create(t,e,i){return new Di(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 Wi=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Wi||(Wi={}));const Ui=Wi.LTR,Yi=Wi.RTL;function qi(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}}const Gi=[];function Fi(t){return[new Ni(0,t,0)]}let Hi="";function Ji(t,e,i,n,s){var r;let o=n.head-t.from,a=-1;if(0==o){if(!s||!t.length)return null;e[0].level!=i&&(o=e[0].side(!1,i),a=0)}else if(o==t.length){if(s)return null;let t=e[e.length-1];t.level!=i&&(o=t.side(!0,i),a=e.length-1)}a<0&&(a=Ni.find(e,o,null!==(r=n.bidiLevel)&&void 0!==r?r:-1,n.assoc));let l=e[a];o==l.side(s,i)&&(l=e[a+=s?1:-1],o=l.side(!s,i));let h=s==(l.dir==i),c=f(t.text,o,h);if(Hi=t.text.slice(Math.min(o,c),Math.max(o,c)),c!=l.side(s,i))return A.cursor(c+t.from,h?-1:1,l.level);let u=a==(s?e.length-1:0)?null:e[a+(s?1:-1)];return u||l.level==i?u&&u.level1)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=Se.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 en(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}class nn{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class sn extends Se{constructor(t){super(),this.view=t,this.compositionDeco=ni.none,this.decorations=[],this.dynamicDecorationMap=[],this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(t.contentDOM),this.children=[new hi],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Mi(0,0,0,t.state.doc.length)],0)}get length(){return this.view.state.doc.length}update(t){let e=t.changedRanges;this.minWidth>0&&e.length&&(e.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),this.view.inputState.composing<0?this.compositionDeco=ni.none:(t.transactions.length||this.dirty)&&(this.compositionDeco=function(t,e){let i=on(t);if(!i)return ni.none;let{from:n,to:s,node:r,text:o}=i,a=e.mapPos(n,1),l=Math.max(a,e.mapPos(s,-1)),{state:h}=t,c=3==r.nodeType?r.nodeValue:new tn([],h).readRange(r.firstChild,null).text;if(l-a{this.dom.style.height=this.view.viewState.contentHeight+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let t=De.chrome||De.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,t),this.dirty=0,t&&(t.written||i.selectionRange.focusNode!=t.node)&&(this.forceSelection=!0),this.dom.style.height=""}));let n=[];if(this.view.viewport.from||this.view.viewport.to=0?t[e]:null;if(!n)break;let{fromA:s,toA:r,fromB:o,toB:a}=n,{content:l,breakAtStart:h,openStart:c,openEnd:u}=ui.build(this.view.state.doc,o,a,this.decorations,this.dynamicDecorationMap),{i:d,off:f}=i.findPos(r,1),{i:p,off:O}=i.findPos(s,-1);Qe(this,p,O,d,f,l,h,c,u)}}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&&se(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,a=this.domAtPos(o.anchor),l=o.empty?a:this.domAtPos(o.head);if(De.gecko&&o.empty&&!this.compositionDeco.size&&(1==(h=a).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((()=>a.node.insertBefore(t,a.node.childNodes[a.offset]||null))),a=l=new ve(t,0),r=!0}var h;let c=this.view.observer.selectionRange;!r&&c.focusNode&&oe(a.node,a.offset,c.anchorNode,c.anchorOffset)&&oe(l.node,l.offset,c.focusNode,c.focusOffset)||(this.view.observer.ignore((()=>{De.android&&De.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=ie(this.view.root);if(t)if(o.empty){if(De.gecko){let t=(e=a.node,n=a.offset,1!=e.nodeType?0:(n&&"false"==e.childNodes[n-1].contentEditable?1:0)|(no.head&&([a,l]=[l,a]),e.setEnd(l.node,l.offset),e.setStart(a.node,a.offset),t.removeAllRanges(),t.addRange(e)}else;var e,n;s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())})),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new ve(c.anchorNode,c.anchorOffset),this.impreciseHead=l.precise?null:new ve(c.focusNode,c.focusOffset)}enforceCursorAssoc(){if(this.compositionDeco.size)return;let{view:t}=this,e=t.state.selection.main,i=ie(t.root),{anchorNode:n,anchorOffset:s}=t.observer.selectionRange;if(!(i&&e.empty&&e.assoc&&i.modify))return;let r=hi.find(this,e.head);if(!r)return;let o=r.posAtStart;if(e.head==o||e.head==o+r.length)return;let a=this.coordsAt(e.head,-1),l=this.coordsAt(e.head,1);if(!a||!l||a.bottom>l.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)}nearest(t){for(let e=t;e;){let t=Se.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!=ii.WidgetBefore&&s.type!=ii.WidgetAfter&&(!n||2==e||this.children[n-1].breakAfter||this.children[n-1].type==ii.WidgetBefore&&e>-2))return s.coordsAt(t-r,e);i=r}}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,a=this.view.textDirection==Wi.LTR;for(let t=0,l=0;ln)break;if(t>=i){let i=h.dom.getBoundingClientRect();if(e.push(i.height),r){let e=h.dom.lastChild,n=e?re(e):[];if(n.length){let e=n[n.length-1],r=a?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?Wi.RTL:Wi.LTR}measureTextSize(){for(let t of this.children)if(t instanceof hi){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.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(n);let s=re(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 ke(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;t.push(ni.replace({widget:new rn(n),block:!0,inclusive:!0,isBlockGap:!0}).range(i,r))}if(!s)break;i=s.to+1}return ni.set(t)}updateDeco(){let t=this.view.state.facet(Ti).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=0,r=0,o=0,a=0;for(let t of this.view.state.facet(Ei).map((t=>t(this.view))))if(t){let{left:e,right:i,top:n,bottom:l}=t;null!=e&&(s=Math.max(s,e)),null!=i&&(r=Math.max(r,i)),null!=n&&(o=Math.max(o,n)),null!=l&&(a=Math.max(a,l))}let l={left:n.left-s,top:n.top-o,right:n.right+r,bottom:n.bottom+a};!function(t,e,i,n,s,r,o,a){let l=t.ownerDocument,h=l.defaultView||window;for(let c=t;c;)if(1==c.nodeType){let t,u=c==l.body;if(u)t=de(h);else{if(c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let e=c.getBoundingClientRect();t={left:e.left,right:e.left+c.clientWidth,top:e.top,bottom:e.top+c.clientHeight}}let d=0,f=0;if("nearest"==s)e.top0&&e.bottom>t.bottom+f&&(f=e.bottom-t.bottom+f+o)):e.bottom>t.bottom&&(f=e.bottom-t.bottom+o,i<0&&e.top-f0&&e.right>t.right+d&&(d=e.right-t.right+d+r)):e.right>t.right&&(d=e.right-t.right+r,i<0&&e.left0))break;i=i.childNodes[n-1],n=he(i)}if(i>=0)for(let n=t,s=e;;){if(3==n.nodeType)return n;if(!(1==n.nodeType&&s=0))break;n=n.childNodes[s],s=0}return null}class hn{constructor(){this.changes=[]}compareRange(t,e){li(t,e,this.changes)}comparePoint(t,e){li(t,e,this.changes)}}function cn(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function un(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function dn(t,e){return t.tope.top+1}function fn(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,a,l,h,c,u=!1;for(let d=t.firstChild;d;d=d.nextSibling){let t=re(d);for(let f=0;fg||o==g&&r>O){n=d,s=p,r=O,o=g;let a=g?i0?f0)}0==O?i>p.bottom&&(!h||h.bottomp.top)&&(l=d,c=p):h&&dn(h,p)?h=pn(h,p.bottom):c&&dn(c,p)&&(c=fn(c,p.top))}}if(h&&h.bottom>=i?(n=a,s=h):c&&c.top<=i&&(n=l,s=c),!n)return{node:t,offset:0};let d=Math.max(s.left,Math.min(s.right,e));return 3==n.nodeType?gn(n,d,i):u&&"false"!=n.contentEditable?On(n,d,i):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,n)+(e>=(s.left+s.right)/2?1:0)}}function gn(t,e,i){let n=t.nodeValue.length,s=-1,r=1e9,o=0;for(let a=0;ai?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(De.chrome||De.gecko){me(t,a).getBoundingClientRect().left==h.right&&(n=!i)}if(c<=0)return{node:t,offset:a+(n?1:0)};s=a+(n?1:0),r=c}}}return{node:t,offset:s>-1?s:o>0?t.nodeValue.length:0}}function mn(t,e,i,n=-1){var s,r;let o,a=t.contentDOM.getBoundingClientRect(),l=a.top+t.viewState.paddingTop,{docHeight:h}=t.viewState,{x:c,y:u}=e,d=u-l;if(d<0)return 0;if(d>h)return t.state.doc.length;for(let e=t.defaultLineHeight/2,s=!1;o=t.elementAtHeight(d),o.type!=ii.Text;)for(;d=n>0?o.bottom+e:o.top-e,!(d>=0&&d<=h);){if(s)return i?null:0;s=!0,n=-n}u=l+d;let f=o.from;if(ft.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:bn(t,a,o,c,u);let p=t.dom.ownerDocument,O=t.root.elementFromPoint?t.root:p,g=O.elementFromPoint(c,u);g&&!t.contentDOM.contains(g)&&(g=null),g||(c=Math.max(a.left+1,Math.min(a.right-1,c)),g=O.elementFromPoint(c,u),g&&!t.contentDOM.contains(g)&&(g=null));let m,b=-1;if(g&&0!=(null===(s=t.docView.nearest(g))||void 0===s?void 0:s.isEditable))if(p.caretPositionFromPoint){let t=p.caretPositionFromPoint(c,u);t&&({offsetNode:m,offset:b}=t)}else if(p.caretRangeFromPoint){let e=p.caretRangeFromPoint(c,u);e&&(({startContainer:m,startOffset:b}=e),(!t.contentDOM.contains(m)||De.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 me(t,n-1,n).getBoundingClientRect().left>i}(m,b,c)||De.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}let n=1==t.nodeType?t.getBoundingClientRect():me(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return i-n.left>5}(m,b,c))&&(m=void 0))}if(!m||!t.docView.dom.contains(m)){let e=hi.find(t.docView,f);if(!e)return d>o.top+o.height/2?o.to:o.from;({node:m,offset:b}=On(e.dom,c,u))}let w=t.docView.nearest(m);if(!w)return null;if(w.isWidget&&1==(null===(r=w.dom)||void 0===r?void 0:r.nodeType)){let t=w.dom.getBoundingClientRect();return e.y1.5*t.defaultLineHeight){r+=Math.floor((s-i.top)/t.defaultLineHeight)*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=f(t,n)}return!0===n?-1:t.length}(o,r,t.state.tabSize)}function wn(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=t.bidiSpans(s),o=t.textDirectionAt(s.from);for(let a=e,l=null;;){let e=Ji(s,r,o,a,i),h=Hi;if(!e){if(s.number==(i?t.state.doc.lines:1))return a;h="\n",s=t.state.doc.line(s.number+(i?1:-1)),r=t.bidiSpans(s),e=A.cursor(i?s.from:s.to)}if(l){if(!l(h))return a}else{if(!n)return e;l=n(h)}a=e}}function vn(t,e,i,n){let s=t.state.facet(Ri).map((e=>e(t)));for(;;){let t=!1;for(let r of s)r.between(i.from-1,i.from+1,((s,r,o)=>{i.from>s&&i.fromi.from?A.cursor(s,1):A.cursor(r,-1),t=!0,o.widget.skipPosition&&(i=o.widget.skipPosition(i,e,n)))}));if(!t)return i}}class yn{constructor(t){this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null;let e=(e,i)=>{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 Cn){let n=Cn[i];t.contentDOM.addEventListener(i,(i=>{Pn(t,i)&&e(n,i)}),_n[i]),this.registeredEvents.push(i)}t.scrollDOM.addEventListener("mousedown",(i=>{if(i.target==t.scrollDOM&&i.clientY>t.contentDOM.getBoundingClientRect().bottom&&(e(Cn.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)}})),De.chrome&&102==De.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,De.safari&&t.contentDOM.addEventListener("input",(()=>null))}setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}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=>{Pn(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){Qi(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){Qi(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||xn.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,be(t.contentDOM,e.key,e.keyCode))}ignoreDuringComposition(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(De.safari&&!De.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 Sn=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],xn="dthko",kn=[16,17,18,20,91,92,224,225];function Qn(t){return.7*Math.max(0,t)+8}class $n{constructor(t,e,i,n){this.view=t,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);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(xt.allowMultipleSelections)&&function(t,e){let i=t.state.facet(pi);return i.length?i[0](e):(De.mac,e.altKey)}(t,e),this.dragMove=function(t,e){let i=t.state.facet(Oi);return i.length?i[0](e):De.mac?!e.altKey:!e.ctrlKey}(t,e),this.dragging=!(!function(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let n=ie(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!=Yn(e))&&null}start(t){!1===this.dragging&&(t.preventDefault(),this.select(t))}move(t){var e;if(0==t.buttons)return this.destroy();if(!1!==this.dragging)return;this.select(this.lastEvent=t);let i=0,n=0,s=(null===(e=this.scrollParent)||void 0===e?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight};t.clientX<=s.left+6?i=-Qn(s.left-t.clientX):t.clientX>=s.right-6&&(i=Qn(t.clientX-s.right)),t.clientY<=s.top+6?n=-Qn(s.top-t.clientY):t.clientY>=s.bottom-6&&(n=Qn(t.clientY-s.bottom)),this.setScrollSpeed(i,n)}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)}select(t){let e=this.style.get(t,this.extend,this.multiple);!this.mustSelect&&e.eq(this.view.state.selection)&&e.main.assoc==this.view.state.selection.main.assoc||this.view.dispatch({selection:e,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.docChanged&&this.dragging&&(this.dragging=this.dragging.map(t.changes)),this.style.update(t)&&setTimeout((()=>this.select(this.lastEvent)),20)}}function Pn(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=Se.get(n))&&i.ignoreEvent(e))return!1;return!0}const Cn=Object.create(null),_n=Object.create(null),Xn=De.ie&&De.ie_version<15||De.ios&&De.webkit_version<604;function Zn(t,e){let i,{state:n}=t,s=1,r=n.toText(e),o=r.lines==n.selection.ranges.length;if(null!=Ln&&n.selection.ranges.every((t=>t.empty))&&Ln==r.toString()){let t=-1;i=n.changeByRange((i=>{let a=n.doc.lineAt(i.from);if(a.from==t)return{range:i};t=a.from;let l=n.toText((o?r.line(s++).text:e)+n.lineBreak);return{changes:{from:a.from,insert:l},range:A.cursor(i.from+l.length)}}))}else i=o?n.changeByRange((t=>{let e=r.line(s++);return{changes:{from:t.from,to:t.to,insert:e.text},range:A.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 A.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 A.cursor(e);0==r?i=1:r==s.length&&(i=-1);let o=r,a=r;i<0?o=f(s.text,r,!1):a=f(s.text,r);let l=n(s.text.slice(o,a));for(;o>0;){let t=f(s.text,o,!1);if(n(s.text.slice(t,o))!=l)break;o=t}for(;a{t.inputState.setSelectionOrigin("select"),27==e.keyCode&&(t.inputState.lastEscPress=Date.now())},Cn.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},Cn.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},_n.touchstart=_n.touchmove={passive:!0},Cn.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return;let i=null;for(let n of t.state.facet(gi))if(i=n(t,e),i)break;if(i||0!=e.button||(i=function(t,e){let i=Vn(t,e),n=Yn(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 a,l=Vn(t,e),h=An(t,l.pos,l.bias,n);if(i.pos!=l.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&&(a=function(t,e){for(let i=0;i=e)return A.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,l.pos))?a:o?s.addRange(h):A.create([h])}}}(t,e)),i){let n=t.root.activeElement!=t.contentDOM;t.inputState.startMouseSelection(new $n(t,e,i,n)),n&&t.observer.ignore((()=>ge(t.contentDOM))),t.inputState.mouseSelection&&t.inputState.mouseSelection.start(e)}};let Tn=(t,e)=>t>=e.top&&t<=e.bottom,Rn=(t,e,i)=>Tn(e,i)&&t>=i.left&&t<=i.right;function En(t,e,i,n){let s=hi.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&&Rn(i,n,o))return-1;let a=s.coordsAt(r,1);return a&&Rn(i,n,a)?1:o&&Tn(n,o)?-1:1}function Vn(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:En(t,i,e.clientX,e.clientY)}}const Mn=De.ie&&De.ie_version<=11;let Dn=null,Wn=0,Un=0;function Yn(t){if(!Mn)return t.detail;let e=Dn,i=Un;return Dn=t,Un=Date.now(),Wn=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Wn+1)%3:1}function qn(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&&r.dragMove?{from:r.dragging.from,to:r.dragging.to}:null,a={from:s,insert:i},l=t.state.changes(o?[o,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(s,-1),head:l.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"})}Cn.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")},Cn.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&&qn(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 qn(t,e,e.dataTransfer.getData("Text"),!0)},Cn.paste=(t,e)=>{if(t.state.readOnly)return e.preventDefault();t.observer.flush();let i=Xn?null:e.clipboardData;i?(Zn(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(),Zn(t,i.value)}),50)}(t)};let Ln=null;Cn.copy=Cn.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;Ln=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 zn=lt.define();function In(t,e){let i=[];for(let n of t.facet(vi)){let s=n(t,e);s&&i.push(s)}return i?t.update({effects:i,annotations:zn.of(!0)}):null}function Bn(t){setTimeout((()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=In(t.state,e);i?t.dispatch(i):t.update([])}}),10)}Cn.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),Bn(t)},Cn.blur=t=>{t.observer.clearSelectionRange(),Bn(t)},Cn.compositionstart=Cn.compositionupdate=t=>{null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},Cn.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,De.chrome&&De.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then((()=>t.observer.flush())):setTimeout((()=>{t.inputState.composing<0&&t.docView.compositionDeco.size&&t.update([])}),50)},Cn.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},Cn.beforeinput=(t,e)=>{var i;let n;if(De.chrome&&De.android&&(n=Sn.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 jn=["pre-wrap","normal","pre-line","break-spaces"];class Nn{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){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return jn.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i-1,a=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,a){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)>Jn&&(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:a,toA:l,fromB:h,toB:c}=n[o],u=s.lineAt(a,Hn.ByPosNoHeight,i.setDoc(e),0,0),d=u.to>=l?u:s.lineAt(l,Hn.ByPosNoHeight,i,0,0);for(c+=d.to-l,l=d.to;o>0&&u.from<=n[o-1].toA;)a=n[o-1].fromA,h=n[o-1].fromB,o--,a2*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 es extends ts{constructor(t,e){super(t,e,ii.Text),this.collapsed=0,this.widgetHeight=0}replace(t,e,i){let n=i[0];return 1==i.length&&(n instanceof es||n instanceof is&&4&n.flags)&&Math.abs(this.length-n.length)<10?(n instanceof is?n=new es(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.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class is 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:a}=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),l=o+r.length*a,h=Math.max(i,t-l/2);return new Fn(r.from,r.length,h,l,ii.Text)}{let n=Math.max(0,Math.min(r-s,Math.floor((t-i)/o))),{from:a,length:l}=e.doc.line(s+n);return new Fn(a,l,i+o*n,o,ii.Text)}}lineAt(t,e,i,n,s){if(e==Hn.ByHeight)return this.blockAt(t,i,n,s);if(e==Hn.ByPosNoHeight){let{from:e,to:n}=i.doc.lineAt(t);return new Fn(e,n-e,0,0,ii.Text)}let{firstLine:r,perLine:o,perChar:a}=this.heightMetrics(i,s),l=i.doc.lineAt(t),h=o+l.length*a,c=l.number-r,u=n+o*c+a*(l.from-s-c);return new Fn(l.from,l.length,Math.max(n,Math.min(u,n+this.height-h)),h,ii.Text)}forEachLine(t,e,i,n,s,r){t=Math.max(t,s),e=Math.min(e,s+this.length);let{firstLine:o,perLine:a,perChar:l}=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+=a*i+l*(t-s-i)}let n=a+l*e.length;r(new Fn(e.from,e.length,c,n,ii.Text)),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 is?i[i.length-1]=new is(t.length+n):i.push(null,new is(n-1))}if(t>0){let e=i[0];e instanceof is?i[0]=new is(t+e.length):i.unshift(new is(t-1),null)}return Kn.of(i)}decomposeLeft(t,e){e.push(new is(t-1),null)}decomposeRight(t,e){e.push(null,new is(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 is(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)>=Jn&&(o=-2);let a=new es(e,s);a.outdated=!1,i.push(a),r+=e+1}r<=s&&i.push(null,new is(s-r).updateHeight(t,r));let a=Kn.of(i);return(o<0||Math.abs(a.height-this.height)>=Jn||Math.abs(o-this.heightMetrics(t,e).perLine)>=Jn)&&(t.heightChanged=!0),a}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class ns 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 l;let h=e==Hn.ByPosNoHeight?Hn.ByPosNoHeight:Hn.ByPos;return a?l.join(this.right.lineAt(o,h,i,r,o)):this.left.lineAt(o,h,i,n,s).join(l)}forEachLine(t,e,i,n,s,r){let o=n+this.left.height,a=s+this.left.length+this.break;if(this.break)t=a&&this.right.forEachLine(t,e,i,o,a,r);else{let l=this.lineAt(a,Hn.ByPos,i,n,s);t=t&&l.from<=e&&r(l),e>l.to&&this.right.forEachLine(l.to+1,e,i,o,a,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&&ss(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,a=null;return n&&n.from<=e+s.length&&n.more?a=s=s.updateHeight(t,e,i,n):s.updateHeight(t,e,i),n&&n.from<=o+r.length&&n.more?a=r=r.updateHeight(t,o,i,n):r.updateHeight(t,o,i),a?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 ss(t,e){let i,n;null==t[e]&&(i=t[e-1])instanceof is&&(n=t[e+1])instanceof is&&t.splice(e-1,3,new is(i.length+1+n.length))}class rs{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 es?i.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new es(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)}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 es(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let i=new is(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 es)return t;let e=new es(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine(),t.type!=ii.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,t.type!=ii.WidgetBefore&&(this.covering=t)}addLineDeco(t,e){let i=this.ensureLine();i.length+=e,i.collapsed+=e,i.widgetHeight=Math.max(i.widgetHeight,t),this.writtenTo=this.pos=this.pos+e}finish(t){let e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof es||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),a=Math.max(a,n.top),l=e==t.parentNode?n.bottom:Math.min(l,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:a-(i.top+e),bottom:Math.max(a,l)-(i.top+e)}}function ls(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class hs{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 Nn(i),this.stateDeco=e.facet(Ti).filter((t=>"function"!=typeof t)),this.heightMap=Kn.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle.setDoc(e.doc),[new Mi(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ni.set(this.lineGaps.map((t=>t.draw(!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 ds(e,i))}}this.viewports=t.sort(((t,e)=>t.from-e.from)),this.scaler=this.heightMap.height<=7e6?gs:new ms(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:bs(t,this.scaler))}))}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=this.state.facet(Ti).filter((t=>"function"!=typeof t));let n=t.changedRanges,s=Mi.extendWithRanges(n,function(t,e,i){let n=new os;return _t.compare(t,e,i,n,0),n.changes}(i,this.stateDeco,t?t.changes:k.empty(this.state.doc.length))),r=this.heightMap.height;this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),s),this.heightMap.height!=r&&(t.flags|=2);let o=s.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.heado.to)||!this.viewportIsAppropriate(o))&&(o=this.getViewport(0,e));let a=!t.changes.empty||2&t.flags||o.from!=this.viewport.from||o.to!=this.viewport.to;this.viewport=o,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(Si)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let i=e.contentDOM,n=window.getComputedStyle(i),s=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Wi.RTL:Wi.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),a=i.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let h=0,c=0,u=parseInt(n.paddingTop)||0,d=parseInt(n.paddingBottom)||0;this.paddingTop==u&&this.paddingBottom==d||(this.paddingTop=u,this.paddingBottom=d,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let f=(this.printing?ls:as)(i,this.paddingTop),p=f.top-this.pixelViewport.top,O=f.bottom-this.pixelViewport.bottom;this.pixelViewport=f;let g=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(g!=this.inView&&(this.inView=g,g&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let m=a.width;if(this.contentDOMWidth==m&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,h|=8),l){let i=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(i)&&(o=!0),o||s.lineWrapping&&Math.abs(m-this.contentDOMWidth)>s.charWidth){let{lineHeight:t,charWidth:n,textHeight:a}=e.docView.measureTextSize();o=t>0&&s.refresh(r,t,n,a,m/n,i),o&&(e.docView.minWidth=0,h|=8)}p>0&&O>0?c=Math.max(p,O):p<0&&O<0&&(c=Math.min(p,O)),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 Mi(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new Gn(n.from,r))}s.heightChanged&&(h|=2)}let b=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return b&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(2&h||b)&&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,a=new ds(n.lineAt(r-1e3*i,Hn.ByHeight,s,0,0).from,n.lineAt(o+1e3*(1-i),Hn.ByHeight,s,0,0).to);if(e){let{head:t}=e.range;if(ta.to){let i,r=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=n.lineAt(t,Hn.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!=Wi.LTR&&!i)return[];let o=[],a=(n,r,l,h)=>{if(r-nn&&tt.from>=l.from&&t.to<=l.to&&Math.abs(t.from-n)t.frome))));if(!d){if(rt.from<=r&&t.to>=r))){let t=e.moveToLineBoundary(A.cursor(r),!1,!0).head;t>n&&(r=t)}d=new hs(n,r,this.gapSize(l,n,r,h))}o.push(d)};for(let t of this.viewportLines){if(t.lengtht.from&&a(t.from,s,t,e),ot.draw(this.heightOracle.lineWrapping)))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];_t.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))||bs(this.heightMap.lineAt(t,Hn.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return bs(this.heightMap.lineAt(this.scaler.fromDOM(t),Hn.ByHeight,this.heightOracle,0,0),this.scaler)}elementAtHeight(t){return bs(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 ds{constructor(t,e){this.from=t,this.to=e}}function fs(t,e,i){let n=[],s=t,r=0;return _t.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 Os(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 gs={toDOM:t=>t,fromDOM:t=>t,scale:1};class ms{constructor(t,e,i){let n=0,s=0,r=0;this.viewports=i.map((({from:i,to:s})=>{let r=e.lineAt(i,Hn.ByPos,t,0,0).top,o=e.lineAt(s,Hn.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=ebs(t,e))):t.type)}const ws=E.define({combine:t=>t.join(" ")}),vs=E.define({combine:t=>t.indexOf(!0)>-1}),ys=It.newName(),Ss=It.newName(),xs=It.newName(),ks={"&light":"."+Ss,"&dark":"."+xs};function Qs(t,e,i){return new It(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 $s=Qs("."+ys,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",borderRadius:"4px",marginTop:"0.5rem",width:"30%",minWidth:"190px",marginLeft:"auto",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&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:"#333338",fontSize:"70%",padding:".2em 1em",borderRadius:"4px"},"&light .cm-button":{background:"#eee"},"&dark .cm-button":{background:"#eee"},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",borderRadius:"0.25rem",border:"1px solid silver",padding:".0em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},ks);class Ps{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;i&&(e.push(new nn(i,n)),s==i&&r==n||e.push(new nn(s,r)));return e}(t),i=new tn(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?A.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||!ne(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||!ne(t.contentDOM,e.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(e.anchorNode,e.anchorOffset);this.newSel=A.single(n,i)}}}function Cs(e,i){let n,{newSel:s}=i,r=e.state.selection.main;if(i.bounds){let{from:s,to:o}=i.bounds,a=r.from,l=null;(8===e.inputState.lastKeyCode&&e.inputState.lastKeyTime>Date.now()-100||De.android&&i.text.length0&&a>0&&t.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if("end"==n){i-=o+Math.max(0,r-Math.min(o,a))-r}if(o=o?r-i:0,a=r+(a-o),o=r}else if(a=a?r-i:0,o=r+(o-a),a=r}return{from:r,toA:o,toB:a}}(e.state.doc.sliceString(s,o,Ki),i.text,a-s,l);h&&(De.chrome&&13==e.inputState.lastKeyCode&&h.toB==h.from+2&&i.text.slice(h.from,h.toB)==Ki+Ki&&h.toB--,n={from:s+h.from,to:s+h.toA,insert:t.of(i.text.slice(h.from,h.toB).split(Ki))})}else s&&(!e.hasFocus&&e.state.facet($i)||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))}:(De.mac||De.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=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}):De.chrome&&n&&n.from==n.to&&n.from==r.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(s&&(s=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}),n){let t=e.state;if(De.ios&&e.inputState.flushIOSKey(e))return!0;if(De.android&&(n.from==r.from&&n.to==r.to&&1==n.insert.length&&2==n.insert.lines&&be(e.contentDOM,"Enter",13)||n.from==r.from-1&&n.to==r.to&&0==n.insert.length&&be(e.contentDOM,"Backspace",8)||n.from==r.from&&n.to==r.to+1&&0==n.insert.length&&be(e.contentDOM,"Delete",46)))return!0;let i,o=n.insert.toString();if(e.state.facet(wi).some((t=>t(e,n.from,n.to,o))))return!0;if(e.inputState.composing>=0&&e.inputState.composing++,n.from>=r.from&&n.to<=r.to&&n.to-n.from>=(r.to-r.from)/3&&(!s||s.main.empty&&s.main.from==n.from+n.insert.length)&&e.inputState.composing<0){let s=r.fromn.to?t.sliceDoc(n.to,r.to):"";i=t.replaceSelection(e.state.toText(s+n.insert.sliceString(0,void 0,e.state.lineBreak)+o))}else{let o=t.changes(n),a=s&&s.main.to<=o.newLength?s.main:void 0;if(t.selection.ranges.length>1&&e.inputState.composing>=0&&n.to<=r.to&&n.to>=r.to-10){let s=e.state.sliceDoc(n.from,n.to),l=on(e)||e.state.doc.lineAt(r.head),h=r.to-n.to,c=r.to-r.from;i=t.changeByRange((i=>{if(i.from==r.from&&i.to==r.to)return{changes:o,range:a||i.map(o)};let u=i.to-h,d=u-s.length;if(i.to-i.from!=c||e.state.sliceDoc(d,u)!=s||l&&i.to>=l.from&&i.from<=l.to)return{range:i};let f=t.changes({from:d,to:u,insert:n.insert}),p=i.to-r.to;return{changes:f,range:a?A.range(Math.max(0,a.anchor+p),Math.max(0,a.head+p)):i.map(f)}}))}else i={changes:o,selection:a&&t.selection.replaceRange(a)}}let a="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,a+=".compose",e.inputState.compositionFirstChange&&(a+=".start",e.inputState.compositionFirstChange=!1)),e.dispatch(i,{scrollIntoView:!0,userEvent:a}),!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 _s={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Xs=De.ie&&De.ie_version<=11;class Zs{constructor(t){this.view=t,this.active=!1,this.selectionRange=new fe,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);(De.ie&&De.ie_version<=11||De.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()})),Xs&&(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")))}),{}),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($i)?i.root.activeElement!=this.dom:!se(i.dom,n))return;let s=n.anchorNode&&i.docView.nearest(n.anchorNode);s&&s.ignoreEvent(t)?e||(this.selectionChanged=!1):(De.ie&&De.ie_version<=11||De.android&&De.chrome)&&!i.state.selection.main.empty&&n.focusNode&&oe(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=De.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,a=t.docView.domAtPos(t.state.selection.main.anchor);oe(a.node,a.offset,r,o)&&([n,s,r,o]=[r,o,n,s]);return{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:o}}(this.view)||ie(t.root);if(!e||this.selectionRange.eq(e))return!1;let i=se(this.dom,e);return i&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let t=this.delayedAndroidKey;t&&(this.clearDelayedAndroidKey(),!this.flush()&&t.force&&be(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&&se(this.dom,this.selectionRange);return t<0&&!n?null:(t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new Ps(this.view,t,e,i))}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=Cs(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.dirty|=4),"childList"==t.type){let i=As(e,t.previousSibling||t.target.previousSibling,-1),n=As(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 As(t,e,i){for(;e;){let n=Se.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 Ts{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),this._dispatch=t.dispatch||(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 us(t.state||xt.create(t)),this.plugins=this.state.facet(Ci).map((t=>new Xi(t)));for(let t of this.plugins)t.update(this);this.observer=new Zs(this),this.inputState=new yn(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new sn(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),t.parent&&t.parent.appendChild(this.dom)}get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}dispatch(...t){this._dispatch(1==t.length&&t[0]instanceof dt?t[0]:this.state.update(...t))}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,a=null;t.some((t=>t.annotation(zn)))?(this.inputState.notifiedFocused=r,o=1):r!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=r,a=In(s,r),a||(o=1));let l=this.observer.delayedAndroidKey,h=null;if(l?(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(xt.phrases)!=this.state.facet(xt.phrases))return this.setState(s);e=Di.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 xi(t.empty?t:A.cursor(t.head,t.head>t.anchor?-1:1))}for(let t of e.effects)t.is(ki)&&(c=t.value)}this.viewState.update(e,c),this.bidiCache=Vs.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),i=this.docView.update(e),this.state.facet(Vi)!=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(ws)!=e.state.facet(ws)&&(this.viewState.mustMeasureContent=!0),(i||n||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!e.empty)for(let t of this.state.facet(bi))t(e);(a||h)&&Promise.resolve().then((()=>{a&&this.state==a.startState&&this.dispatch(a),h&&!Cs(this,h)&&l.force&&be(this.contentDOM,l.key,l.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 us(t),this.plugins=t.facet(Ci).map((t=>new Xi(t))),this.pluginMap.clear();for(let t of this.plugins)t.update(this);this.docView=new sn(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(Ci),i=t.state.facet(Ci);if(e!=i){let n=[];for(let s of i){let i=e.indexOf(s);if(i<0)n.push(new Xi(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.measureScheduled=0,t&&this.observer.forceFlush();let e=null,{scrollHeight:i,scrollTop:n,clientHeight:s}=this.scrollDOM,r=n>i-s-4?i:n;try{for(let t=0;;t++){this.updateState=1;let i=this.viewport,n=this.viewState.lineBlockAtHeight(r),s=this.viewState.measure(this);if(!s&&!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 o=[];4&s||([this.measureRequests,o]=[o,this.measureRequests]);let a=o.map((t=>{try{return t.read(this)}catch(t){return Qi(this.state,t),Es}})),l=Di.create(this,this.state,[]),h=!1,c=!1;l.flags|=s,e?e.flags|=s:e=l,this.updateState=2,l.empty||(this.updatePlugins(l),this.inputState.update(l),this.updateAttrs(),h=this.docView.update(l));for(let t=0;t1||t<-1)&&(this.scrollDOM.scrollTop+=t,c=!0)}if(h&&this.docView.updateSelection(!0),this.viewport.from==i.from&&this.viewport.to==i.to&&!c&&0==this.measureRequests.length)break}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let t of this.state.facet(bi))t(e)}get themeClasses(){return ys+" "+(this.state.facet(vs)?xs:Ss)+" "+this.state.facet(ws)}updateAttrs(){let t=Ms(this,Zi,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet($i)?"true":"false",class:"cm-content",style:`${De.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Ms(this,Ai,e);let i=this.observer.ignore((()=>{let i=ti(this.contentDOM,this.contentAttrs,e),n=ti(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)if(t.is(Ts.announce)){e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(Vi),It.mount(this.root,this.styleModules.concat($s).reverse())}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}}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 vn(this,t,wn(this,t,e,i))}moveByCharSelected(t,e,i){return vn(this,t,wn(this,t,e,i),!0)}moveByGroup(t,e){return vn(this,t,wn(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==wt.Space&&(s=e),s==e}}(this,t.head,e))))}moveToLineBoundary(t,e,i=!0){return function(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=n&&t.lineWrapping?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==Wi.LTR)?e.right-1:e.left+1,y:(r.top+r.bottom)/2});if(null!=o)return A.cursor(o,i?-1:1)}let o=hi.find(t.docView,e.head),a=o?i?o.posAtEnd:o.posAtStart:i?s.to:s.from;return A.cursor(a,i?-1:1)}(this,t,e,i)}moveVertically(t,e,i){return vn(this,t,function(t,e,i,n){let s=e.head,r=i?1:-1;if(s==(i?t.state.doc.length:0))return A.cursor(s,e.assoc);let o,a=e.goalColumn,l=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s),c=t.documentTop;if(h)null==a&&(a=h.left-l.left),o=r<0?h.top:h.bottom;else{let e=t.viewState.lineBlockAt(s);null==a&&(a=Math.min(l.right-l.left,t.defaultCharacterWidth*(s-e.from))),o=(r<0?e.top:e.bottom)+c}let u=l.left+a,d=null!=n?n:t.defaultLineHeight>>1;for(let i=0;;i+=10){let n=o+(d+i)*r,h=mn(t,{x:u,y:n},!1,r);if(nl.bottom||(r<0?hs))return A.cursor(h,e.assoc,void 0,a)}}(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(),mn(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 ue(i,s[Ni.find(s,t-n.from,-1,e)].dir==Wi.LTR==e>0)}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(yi)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Rs)return Fi(t.length);let e=this.textDirectionAt(t.from);for(let i of this.bidiCache)if(i.from==t.from&&i.dir==e)return i.order;let i=function(t,e){let i=t.length,n=e==Ui?1:2,s=e==Ui?2:1;if(!t||1==n&&!ji.test(t))return Fi(i);for(let e=0,s=n,o=n;e=0;t-=3)if(Bi[t+1]==-r){let e=Bi[t+2],i=2&e?n:4&e?1&e?s:n:0;i&&(Gi[a]=Gi[Bi[t]]=i),l=t;break}}else{if(189==Bi.length)break;Bi[l++]=a,Bi[l++]=e,Bi[l++]=h}else if(2==(o=Gi[a])||1==o){let t=o==n;h=t?0:1;for(let e=l-3;e>=0;e-=3){let i=Bi[e+2];if(2&i)break;if(t)Bi[e+2]|=2;else{if(4&i)break;Bi[e+2]|=4}}}for(let t=0;te;){let t=i,n=2!=Gi[--i];for(;i>e&&n==(2!=Gi[i-1]);)i--;o.push(new Ni(i,t,n?2:1))}else o.push(new Ni(e,t,0))}else for(let t=0;tDate.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{ge(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 ki.of(new xi("number"==typeof t?A.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}static domEventHandlers(t){return _i.define((()=>({})),{eventHandlers:t})}static theme(t,e){let i=It.newName(),n=[ws.of(i),Vi.of(Qs(`.${i}`,t))];return e&&e.dark&&n.push(vs.of(!0)),n}static baseTheme(t){return N.lowest(Vi.of(Qs("."+ys,t,ks)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),n=i&&Se.get(i)||Se.get(t);return(null===(e=null==n?void 0:n.rootView)||void 0===e?void 0:e.view)||null}}Ts.styleModule=Vi,Ts.inputHandler=wi,Ts.focusChangeEffect=vi,Ts.perLineTextDirection=yi,Ts.exceptionSink=mi,Ts.updateListener=bi,Ts.editable=$i,Ts.mouseSelectionStyle=gi,Ts.dragMovesSelection=Oi,Ts.clickAddsSelectionRange=pi,Ts.decorations=Ti,Ts.atomicRanges=Ri,Ts.scrollMargins=Ei,Ts.darkTheme=vs,Ts.contentAttributes=Ai,Ts.editorAttributes=Zi,Ts.lineWrapping=Ts.contentAttributes.of({class:"cm-lineWrapping"}),Ts.announce=ut.define();const Rs=4096,Es={};class Vs{constructor(t,e,i,n){this.from=t,this.to=e,this.dir=i,this.order=n}static update(t,e){if(e.empty)return t;let i=[],n=t.length?t[t.length-1].dir:Wi.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&&Je(r,i)}return i}const Ds=De.mac?"mac":De.windows?"win":De.linux?"linux":"key";function Ws(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 Us=N.default(Ts.domEventHandlers({keydown:(t,e)=>Bs(Ls(e.state),t,e,"editor")})),Ys=E.define({enables:Us}),qs=new WeakMap;function Ls(t){let e=t.facet(Ys),i=qs.get(e);return i||qs.set(e,i=function(t,e=Ds){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)=>{var a,l;let h=i[t]||(i[t]=Object.create(null)),c=n.split(/ (?!$)/).map((t=>function(t,e){const i=t.split(/-(?!$)/);let n,s,r,o,a=i[i.length-1];"Space"==a&&(a=" ");for(let t=0;t{let n=zs={view:e,prefix:i,scope:t};return setTimeout((()=>{zs==n&&(zs=null)}),Is),!0}]})}let u=c.join(" ");s(u,!1);let d=h[u]||(h[u]={preventDefault:!1,run:(null===(l=null===(a=h._any)||void 0===a?void 0:a.run)||void 0===l?void 0:l.slice())||[]});r&&d.run.push(r),o&&(d.preventDefault=!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,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.shift&&r(e,"Shift-"+s,n.shift,n.preventDefault)}return i}(e.reduce(((t,e)=>t.concat(e)),[]))),i}let zs=null;const Is=4e3;function Bs(t,e,i,n){let s=function(t){var e=!(Kt&&(t.ctrlKey||t.altKey||t.metaKey)||Jt&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?Gt:Nt)[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=v(b(s,0))==s.length&&" "!=s,o="",a=!1;zs&&zs.view==i&&zs.scope==n&&(o=zs.prefix+" ",(a=kn.indexOf(e.keyCode)<0)&&(zs=null));let l,h,c=new Set,u=t=>{if(t){for(let n of t.run)if(!c.has(n)&&(c.add(n),n(i,e)))return!0;t.preventDefault&&(a=!0)}return!1},d=t[n];if(d){if(u(d[o+Ws(s,e,!r)]))return!0;if(r&&(e.altKey||e.metaKey||e.ctrlKey)&&!(De.windows&&e.ctrlKey&&e.altKey)&&(l=Nt[e.keyCode])&&l!=s){if(u(d[o+Ws(l,e,!0)]))return!0;if(e.shiftKey&&(h=Gt[e.keyCode])!=s&&h!=l&&u(d[o+Ws(h,e,!1)]))return!0}else if(r&&e.shiftKey&&u(d[o+Ws(s,e,!0)]))return!0;if(u(d._any))return!0}return a}class js{constructor(t,e,i,n,s){this.className=t,this.left=e,this.top=i,this.width=n,this.height=s}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className==this.className&&(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",null!=this.width&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,i){if(i.empty){let n=t.coordsAtPos(i.head,i.assoc||1);if(!n)return[];let s=Ns(t);return[new js(e,n.left-s.left,n.top-s.top,null,n.bottom-n.top)]}return function(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];let n=Math.max(i.from,t.viewport.from),s=Math.min(i.to,t.viewport.to),r=t.textDirection==Wi.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=Ns(t),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),u=a.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),d=a.right-(c?parseInt(c.paddingRight):0),f=Fs(t,n),p=Fs(t,s),O=f.type==ii.Text?f:null,g=p.type==ii.Text?p:null;t.lineWrapping&&(O&&(O=Gs(t,n,O)),g&&(g=Gs(t,s,g)));if(O&&g&&O.from==g.from)return b(w(i.from,i.to,O));{let e=O?w(i.from,null,O):v(f,!1),n=g?w(null,i.to,g):v(p,!0),s=[];return(O||f).to<(g||p).from-1?s.push(m(u,e.bottom,d,n.top)):e.bottomh&&n.from=r)break;a>s&&l(Math.max(t,s),null==e&&t<=h,Math.min(a,r),null==i&&a>=c,o.dir)}if(s=n.to+1,s>=r)break}return 0==a.length&&l(h,null==e,c,null==i,t.textDirection),{top:s,bottom:o,horizontal:a}}function v(t,e){let i=a.top+(e?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]}}}(t,e,i)}}function Ns(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Wi.LTR?e.left:e.right-t.scrollDOM.clientWidth)-t.scrollDOM.scrollLeft,top:e.top-t.scrollDOM.scrollTop}}function Gs(t,e,i){let n=A.cursor(e);return{from:Math.max(i.from,t.moveToLineBoundary(n,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(n,!0,!0).from),type:ii.Text}}function Fs(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==ii.Text))return t;return i}class Hs{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),e.above&&this.dom.classList.add("cm-layer-above"),e.class&&this.dom.classList.add(e.class),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(Js)!=t.state.facet(Js)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&t.view.requestMeasure(this.measureReq)}setOrder(t){let e=0,i=t.facet(Js);for(;e{return i=t,n=this.drawn[e],!(i.constructor==n.constructor&&i.eq(n));var i,n}))){let e=this.dom.firstChild,i=0;for(let n of t)n.update&&e&&n.constructor&&this.drawn[i].constructor&&n.update(e,this.drawn[i])?(e=e.nextSibling,i++):this.dom.insertBefore(n.draw(),e);for(;e;){let t=e.nextSibling;e.remove(),e=t}this.drawn=t}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Js=E.define();function Ks(t){return[_i.define((e=>new Hs(e,t))),Js.of(t)]}const tr=!De.ios,er=E.define({combine:t=>kt(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})});function ir(t={}){return[er.of(t),sr,or,lr,Si.of(!0)]}function nr(t){return t.startState.facet(er)!=t.state.facet(er)}const sr=Ks({above:!0,markers(t){let{state:e}=t,i=e.facet(er),n=[];for(let s of e.selection.ranges){let r=s==e.selection.main;if(s.empty?!r||tr:i.drawRangeCursor){let e=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",i=s.empty?s:A.cursor(s.head,s.head>s.anchor?-1:1);for(let s of js.forRange(t,e,i))n.push(s)}}return n},update(t,e){t.transactions.some((t=>t.selection))&&(e.style.animationName="cm-blink"==e.style.animationName?"cm-blink2":"cm-blink");let i=nr(t);return i&&rr(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){rr(e.state,t)},class:"cm-cursorLayer"});function rr(t,e){e.style.animationDuration=t.facet(er).cursorBlinkRate+"ms"}const or=Ks({above:!1,markers:t=>t.state.selection.ranges.map((e=>e.empty?[]:js.forRange(t,"cm-selectionBackground",e))).reduce(((t,e)=>t.concat(e))),update:(t,e)=>t.docChanged||t.selectionSet||t.viewportChanged||nr(t),class:"cm-selectionLayer"}),ar={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};tr&&(ar[".cm-line"].caretColor="transparent !important");const lr=N.highest(Ts.theme(ar)),hr=ut.define({map:(t,e)=>null==t?null:e.mapPos(t)}),cr=q.define({create:()=>null,update:(t,e)=>(null!=t&&(t=e.changes.mapPos(t)),e.effects.reduce(((t,e)=>e.is(hr)?e.value:t),t))}),ur=_i.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let i=t.state.field(cr);null==i?null!=this.cursor&&(null===(e=this.cursor)||void 0===e||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(cr)!=i||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let t=this.view.state.field(cr),e=null!=t&&this.view.coordsAtPos(t);if(!e)return null;let i=this.view.scrollDOM.getBoundingClientRect();return{left:e.left-i.left+this.view.scrollDOM.scrollLeft,top:e.top-i.top+this.view.scrollDOM.scrollTop,height:e.bottom-e.top}}drawCursor(t){this.cursor&&(t?(this.cursor.style.left=t.left+"px",this.cursor.style.top=t.top+"px",this.cursor.style.height=t.height+"px"):this.cursor.style.left="-100000px")}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(cr)!=t&&this.view.dispatch({effects:hr.of(t)})}},{eventHandlers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){t.target!=this.view.contentDOM&&this.view.contentDOM.contains(t.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function dr(){return[cr,ur]}function fr(t,e,i,n,s){e.lastIndex=0;for(let r,o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)if(!o.lineBreak)for(;r=e.exec(o.value);)s(a+r.index,r)}class pr{constructor(t){const{regexp:e,decoration:i,decorate:n,boundary:s,maxLength:r=1e3}=t;if(!e.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=e,n)this.addMatch=(t,e,i,s)=>n(s,i,i+t[0].length,t,e);else if("function"==typeof i)this.addMatch=(t,e,n,s)=>{let r=i(t,e,n);r&&s(n,n+t[0].length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(t,e,n,s)=>s(n,n+t[0].length,i)}this.boundary=s,this.maxLength=r}createDeco(t){let e=new Xt,i=e.add.bind(e);for(let{from:e,to:n}of function(t,e){let i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;let n=[];for(let{from:s,to:r}of i)s=Math.max(t.state.doc.lineAt(s).from,s-e),r=Math.min(t.state.doc.lineAt(r).to,r+e),n.length&&n[n.length-1].to>=s?n[n.length-1].to=r:n.push({from:s,to:r});return n}(t,this.maxLength))fr(t.state.doc,this.regexp,e,n,((e,n)=>this.addMatch(n,t,e,i)));return e.finish()}updateDeco(t,e){let i=1e9,n=-1;return t.docChanged&&t.changes.iterChanges(((e,s,r,o)=>{o>t.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e}updateRange(t,e,i,n){for(let s of t.visibleRanges){let r=Math.max(s.from,i),o=Math.min(s.to,n);if(o>r){let i=t.state.doc.lineAt(r),n=i.toi.from;r--)if(this.boundary.test(i.text[r-1-i.from])){a=r;break}for(;oc.push(i.range(t,e));if(i==n)for(this.regexp.lastIndex=a-i.from;(h=this.regexp.exec(i.text))&&h.indexthis.addMatch(i,t,e,u)));e=e.update({filterFrom:a,filterTo:l,filter:(t,e)=>tl,add:c})}}return e}}const Or=null!=/x/.unicode?"gu":"g",gr=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",Or),mr={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let br=null;const wr=E.define({combine(t){let e=kt(t,{render:null,specialChars:gr,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==br&&"undefined"!=typeof document&&document.body){let e=document.body.style;br=null!=(null!==(t=e.tabSize)&&void 0!==t?t:e.MozTabSize)}return br||!1}())&&(e.specialChars=new RegExp("\t|"+e.specialChars.source,Or)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Or)),e}});function vr(t={}){return[wr.of(t),yr||(yr=_i.fromClass(class{constructor(t){this.view=t,this.decorations=ni.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(wr)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new pr({regexp:t.specialChars,decoration:(e,i,n)=>{let{doc:s}=i.state,r=b(e[0],0);if(9==r){let t=s.lineAt(n),e=i.state.tabSize,r=Yt(t.text,e,n-t.from);return ni.replace({widget:new xr((e-r%e)*this.view.defaultCharacterWidth)})}return this.decorationCache[r]||(this.decorationCache[r]=ni.replace({widget:new Sr(t,r)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(wr);t.startState.facet(wr)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))]}let yr=null;class Sr extends ei{constructor(t,e){super(),this.options=t,this.code=e}eq(t){return t.code==this.code}toDOM(t){let e=function(t){return t>=32?"•":10==t?"␤":String.fromCharCode(9216+t)}(this.code),i=t.state.phrase("Control character")+" "+(mr[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,i,e);if(n)return n;let s=document.createElement("span");return s.textContent=e,s.title=i,s.setAttribute("aria-label",i),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class xr extends ei{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent="\t",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}class kr extends ei{constructor(t){super(),this.content=t}toDOM(){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):this.content),"string"==typeof this.content?t.setAttribute("aria-label","placeholder "+this.content):t.setAttribute("aria-hidden","true"),t}ignoreEvent(){return!1}}const Qr="-10000px";class $r{constructor(t,e,i){this.facet=e,this.createTooltipView=i,this.input=t.state.facet(e),this.tooltips=this.input.filter((t=>t)),this.tooltipViews=this.tooltips.map(i)}update(t){var e;let i=t.state.facet(this.facet),n=i.filter((t=>t));if(i===this.input){for(let e of this.tooltipViews)e.update&&e.update(t);return!1}let s=[];for(let e=0;e{var e,i,n;return{position:De.ios?"absolute":(null===(e=t.find((t=>t.position)))||void 0===e?void 0:e.position)||"fixed",parent:(null===(i=t.find((t=>t.parent)))||void 0===i?void 0:i.parent)||null,tooltipSpace:(null===(n=t.find((t=>t.tooltipSpace)))||void 0===n?void 0:n.tooltipSpace)||Pr}}}),_r=new WeakMap,Xr=_i.fromClass(class{constructor(t){this.view=t,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(Cr);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new $r(t,Tr,(t=>this.createTooltip(t))),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout((()=>{this.measureTimeout=-1,this.maybeMeasure()}),50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t);e&&this.observeIntersection();let i=e||t.geometryChanged,n=t.state.facet(Cr);if(n.position!=this.position){this.position=n.position;for(let t of this.manager.tooltipViews)t.dom.style.position=this.position;i=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let t of this.manager.tooltipViews)this.container.appendChild(t.dom);i=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure()}createTooltip(t){let e=t.create(this.view);if(e.dom.classList.add("cm-tooltip"),t.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",e.dom.appendChild(t)}return e.dom.style.position=this.position,e.dom.style.top=Qr,this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var t,e;this.view.win.removeEventListener("resize",this.measureSoon);for(let e of this.manager.tooltipViews)e.dom.remove(),null===(t=e.destroy)||void 0===t||t.call(e);null===(e=this.intersectionObserver)||void 0===e||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=this.view.dom.getBoundingClientRect();return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map(((t,e)=>{let i=this.manager.tooltipViews[e];return i.getCoords?i.getCoords(t.pos):this.view.coordsAtPos(t.pos)})),size:this.manager.tooltipViews.map((({dom:t})=>t.getBoundingClientRect())),space:this.view.state.facet(Cr).tooltipSpace(this.view)}}writeMeasure(t){var e;let{editor:i,space:n}=t,s=[];for(let r=0;r=Math.min(i.bottom,n.bottom)||h.rightMath.min(i.right,n.right)+.1){l.style.top=Qr;continue}let u=o.arrow?a.dom.querySelector(".cm-tooltip-arrow"):null,d=u?7:0,f=c.right-c.left,p=null!==(e=_r.get(a))&&void 0!==e?e:c.bottom-c.top,O=a.offset||Ar,g=this.view.textDirection==Wi.LTR,m=c.width>n.right-n.left?g?n.left:n.right-c.width:g?Math.min(h.left-(u?14:0)+O.x,n.right-f):Math.max(n.left,h.left-f+(u?14:0)-O.x),b=!!o.above;!o.strictSide&&(b?h.top-(c.bottom-c.top)-O.yn.bottom)&&b==n.bottom-h.bottom>h.top-n.top&&(b=!b);let w=(b?h.top-n.top:n.bottom-h.bottom)-d;if(wm&&t.topv&&(v=b?t.top-p-2-d:t.bottom+d+2);"absolute"==this.position?(l.style.top=v-t.parent.top+"px",l.style.left=m-t.parent.left+"px"):(l.style.top=v+"px",l.style.left=m+"px"),u&&(u.style.left=h.left+(g?O.x:-O.x)-(m+14-7)+"px"),!0!==a.overlap&&s.push({left:m,top:v,right:y,bottom:v+p}),l.classList.toggle("cm-tooltip-above",b),l.classList.toggle("cm-tooltip-below",!b),a.positioned&&a.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=Qr}},{eventHandlers:{scroll(){this.maybeMeasure()}}}),Zr=Ts.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Ar={x:0,y:0},Tr=E.define({enables:[Xr,Zr]});function Rr(t,e){let i=t.plugin(Xr);if(!i)return null;let n=i.manager.tooltips.indexOf(e);return n<0?null:i.manager.tooltipViews[n]}const Er=E.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 Vr(t,e){let i=t.plugin(Mr),n=i?i.specs.indexOf(e):-1;return n>-1?i.panels[n]:null}const Mr=_i.fromClass(class{constructor(t){this.input=t.state.facet(Ur),this.specs=this.input.filter((t=>t)),this.panels=this.specs.map((e=>e(t)));let e=t.state.facet(Er);this.top=new Dr(t,!0,e.topContainer),this.bottom=new Dr(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(Er);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Dr(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Dr(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(Ur);if(i!=this.input){let e=i.filter((t=>t)),n=[],s=[],r=[],o=[];for(let i of e){let e,a=this.specs.indexOf(i);a<0?(e=i(t.view),o.push(e)):(e=this.panels[a],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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}}))});class Dr{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=Wr(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=Wr(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 Wr(t){let e=t.nextSibling;return t.remove(),e}const Ur=E.define({enables:Mr});class Yr extends Qt{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Yr.prototype.elementClass="",Yr.prototype.toDOM=void 0,Yr.prototype.mapMode=S.TrackBefore,Yr.prototype.startSide=Yr.prototype.endSide=-1,Yr.prototype.point=!0;const qr=E.define(),Lr={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>_t.empty,lineMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},zr=E.define();function Ir(t){return[jr(),zr.of(Object.assign(Object.assign({},Lr),t))]}const Br=E.define({combine:t=>t.some((t=>t))});function jr(t){let e=[Nr];return t&&!1===t.fixed&&e.push(Br.of(!0)),e}const Nr=_i.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+"px",this.gutters=t.state.facet(zr).map((e=>new Jr(t,e)));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!t.state.facet(Br),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(Br)!=!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=_t.iter(this.view.state.facet(qr),this.view.viewport.from),n=[],s=this.gutters.map((t=>new Hr(t,this.view.viewport,-this.view.documentPadding.top)));for(let t of this.view.viewportLineBlocks){let e;if(Array.isArray(t.type)){for(let i of t.type)if(i.type==ii.Text){e=i;break}}else e=t.type==ii.Text?t:void 0;if(e){n.length&&(n=[]),Fr(i,n,t.from);for(let t of s)t.line(this.view,e,n)}}for(let t of s)t.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(zr),i=t.state.facet(zr),n=t.docChanged||t.heightChanged||t.viewportChanged||!_t.eq(t.startState.facet(qr),t.state.facet(qr),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 Jr(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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&0!=i.gutters.length&&i.fixed?e.textDirection==Wi.LTR?{left:i.dom.offsetWidth}:{right:i.dom.offsetWidth}:null}))});function Gr(t){return Array.isArray(t)?t:[t]}function Fr(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class Hr{constructor(t,e,i){this.gutter=t,this.height=i,this.i=0,this.cursor=_t.iter(t.markers,e.from)}line(t,e,i){let n=[];Fr(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;if(0==n.length&&!r.config.renderEmptyElements)return;let o=e.top-this.height;if(this.i==r.elements.length){let i=new Kr(t,e.height,o,n);r.elements.push(i),r.dom.appendChild(i.dom)}else r.elements[this.i].update(t,e.height,o,n);this.height=e.bottom,this.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 Jr{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=Gr(e.markers(t)),e.initialSpacer&&(this.spacer=new Kr(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=Gr(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!_t.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 Kr{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.dom.style.height=(this.height=e)+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),function(t,e){if(t.length!=e.length)return!1;for(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 io extends Yr{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function no(t,e){return t.state.facet(eo).formatNumber(e,t.state)}const so=zr.compute([eo],(t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:t=>t.state.facet(to),lineMarker:(t,e,i)=>i.some((t=>t.toDOM))?null:new io(no(t,t.state.doc.lineAt(e.from).number)),lineMarkerChange:t=>t.startState.facet(eo)!=t.state.facet(eo),initialSpacer:t=>new io(no(t,ro(t.state.doc.lines))),updateSpacer(t,e){let i=no(e.view,ro(e.view.state.doc.lines));return i==t.number?t:new io(i)},domEventHandlers:t.facet(eo).domEventHandlers})));function ro(t){let e=9;for(;e{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=fo.match(t)),e=>{let i=t(e);return void 0===i?null:[this,i]}}}ho.closedBy=new ho({deserialize:t=>t.split(" ")}),ho.openedBy=new ho({deserialize:t=>t.split(" ")}),ho.group=new ho({deserialize:t=>t.split(" ")}),ho.contextHash=new ho({perNode:!0}),ho.lookAhead=new ho({perNode:!0}),ho.mounted=new ho({perNode:!0});class co{constructor(t,e,i){this.tree=t,this.overlay=e,this.parser=i}}const uo=Object.create(null);class fo{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):uo,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),n=new fo(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(ho.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(ho.group),n=-1;n<(i?i.length:0);n++){let s=e[n<0?t.name:i[n]];if(s)return s}}}}fo.none=new fo("",Object.create(null),0,8);class po{constructor(t){this.types=t;for(let e=0;e=n&&(r.type.isAnonymous||!1!==e(r))){if(r.firstChild())continue;t=!0}for(;t&&i&&!r.type.isAnonymous&&i(r),!r.nextSibling();){if(!r.parent())return;t=!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:To(fo.none,this.children,this.positions,0,this.children.length,0,this.length,((t,e,i)=>new bo(this.type,t,e,i,this.propValues)),t.makeTree||((t,e,i)=>new bo(fo.none,t,e,i)))}static build(t){return function(t){var e;let{buffer:i,nodeSet:n,maxBufferLength:s=oo,reused:r=[],minRepeatType:o=n.types.length}=t,a=Array.isArray(i)?new wo(i,i.length):i,l=n.types,h=0,c=0;function u(t,e,i,m,b){let{id:w,start:v,end:y,size:S}=a,x=c;for(;S<0;){if(a.next(),-1==S){let e=r[w];return i.push(e),void m.push(v-t)}if(-3==S)return void(h=w);if(-4==S)return void(c=w);throw new RangeError(`Unrecognized record size: ${S}`)}let k,Q,$=l[w],P=v-t;if(y-v<=s&&(Q=O(a.pos-e,b))){let e=new Uint16Array(Q.size-Q.skip),i=a.pos-Q.size,s=e.length;for(;a.pos>i;)s=g(Q.start,e,s);k=new vo(e,y-Q.start,n),P=Q.start-t}else{let t=a.pos-S;a.next();let e=[],i=[],n=w>=o?w:-1,r=0,l=y;for(;a.pos>t;)n>=0&&a.id==n&&a.size>=0?(a.end<=l-s&&(f(e,i,v,r,a.end,l,n,x),r=e.length,l=a.end),a.next()):u(v,t,e,i,n);if(n>=0&&r>0&&r-1&&r>0){let t=d($);k=To($,e,i,0,e.length,0,y-v,t,t)}else k=p($,e,i,y-v,x-y)}i.push(k),m.push(P)}function d(t){return(e,i,n)=>{let s,r,o=0,a=e.length-1;if(a>=0&&(s=e[a])instanceof bo){if(!a&&s.type==t&&s.length==n)return s;(r=s.prop(ho.lookAhead))&&(o=i[a]+s.length+r)}return p(t,e,i,n,o)}}function f(t,e,i,s,r,o,a,l){let h=[],c=[];for(;t.length>s;)h.push(t.pop()),c.push(e.pop()+i-r);t.push(p(n.types[a],h,c,o-r,l-o)),e.push(r-i)}function p(t,e,i,n,s=0,r){if(h){let t=[ho.contextHash,h];r=r?[t].concat(r):[t]}if(s>25){let t=[ho.lookAhead,s];r=r?[t].concat(r):[t]}return new bo(t,e,i,n,r)}function O(t,e){let i=a.fork(),n=0,r=0,l=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=l,l+=4,n+=4,i.next();continue}let a=i.pos-t;if(t<0||a=o?4:0,d=i.start;for(i.next();i.pos>a;){if(i.size<0){if(-3!=i.size)break t;u+=4}else i.id>=o&&(u+=4);i.next()}r=d,n+=t,l+=u}return(e<0||n==t)&&(c.size=n,c.start=r,c.skip=l),c.size>4?c:void 0}function g(t,e,i){let{id:n,start:s,end:r,size:l}=a;if(a.next(),l>=0&&n4){let n=a.pos-(l-4);for(;a.pos>n;)i=g(t,e,i)}e[--i]=o,e[--i]=r-t,e[--i]=s-t,e[--i]=n}else-3==l?h=n:-4==l&&(c=n);return i}let m=[],b=[];for(;a.pos>0;)u(t.start||0,t.bufferStart||0,m,b,-1);let w=null!==(e=t.length)&&void 0!==e?e:m.length?b[0]+m[0].length:0;return new bo(l[t.topID],m.reverse(),b.reverse(),w)}(t)}}bo.empty=new bo(fo.none,[],[],0);class wo{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 wo(this.buffer,this.index)}}class vo{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return fo.none}toString(){let t=[];for(let e=0;e0));a=r[a+3]);return o}slice(t,e,i){let n=this.buffer,s=new Uint16Array(e-t),r=0;for(let o=t,a=0;o=e&&ie;case 1:return i<=e&&n>e;case 2:return n>e;case 4:return!0}}function So(t,e){let i=t.childBefore(e);for(;i;){let e=i.lastChild;if(!e||e.to!=i.to)break;e.type.isError&&e.from==e.to?(t=i,i=e.prevSibling):i=e}return t}function xo(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!=l;t+=e){let l=o[t],h=a[t]+r.from;if(yo(n,i,h,h+l.length))if(l instanceof vo){if(s&mo.ExcludeBuffers)continue;let o=l.findChild(0,l.buffer.length,e,i-h,n);if(o>-1)return new Co(new Po(r,l,t,h),null,o)}else if(s&mo.IncludeAnonymous||!l.type.isAnonymous||Xo(l)){let o;if(!(s&mo.IgnoreMounts)&&l.props&&(o=l.prop(ho.mounted))&&!o.overlay)return new ko(o.tree,h,t,r);let a=new ko(l,h,t,r);return s&mo.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(e<0?l.children.length-1:0,e,i,n)}}if(s&mo.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&mo.IgnoreOverlays)&&(n=this._tree.prop(ho.mounted))&&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 ko(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}cursor(t=0){return new _o(this,t)}get tree(){return this._tree}toTree(){return this._tree}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return So(this,t)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}toString(){return this._tree.toString()}get node(){return this}matchContext(t){return $o(this,t)}}function Qo(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 $o(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 Po{constructor(t,e,i,n){this.parent=t,this.buffer=e,this.index=i,this.start=n}}class Co{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){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 Co(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&mo.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 Co(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 Co(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 Co(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}cursor(t=0){return new _o(this,t)}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 bo(this.type,t,e,this.to-this.from)}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return So(this,t)}toString(){return this.context.buffer.childString(this.index)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}get node(){return this}matchContext(t){return $o(this,t)}}class _o{get name(){return this.type.name}constructor(t,e=0){if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof ko)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let e=t._parent;e;e=e._parent)this.stack.unshift(e.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return!!t&&(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0)}yieldBuf(t,e){this.index=t;let{start:i,buffer:n}=this.buffer;return this.type=e||n.set.types[n.buffer[t]],this.from=i+n.buffer[t+1],this.to=i+n.buffer[t+2],!0}yield(t){return!!t&&(t instanceof ko?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,i){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,i,this.mode));let{buffer:n}=this.buffer,s=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.buffer.start,i);return!(s<0)&&(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,i=this.mode){return this.buffer?!(i&mo.ExcludeBuffers)&&this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&mo.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&mo.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode));let{buffer:e}=this.buffer,i=this.stack.length-1;if(t<0){let t=i<0?0:this.stack[i]+4;if(this.index!=t)return this.yieldBuf(e.findChild(t,this.index,-1,0,4))}else{let t=e.buffer[this.index+3];if(t<(i<0?e.buffer.length:e.buffer[this.stack[i]+3]))return this.yieldBuf(t)}return i<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,i,{buffer:n}=this;if(n){if(t>0){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&mo.IncludeAnonymous||t instanceof vo||!t.type.isAnonymous||Xo(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 $o(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 Xo(t){return t.children.some((t=>t instanceof vo||!t.type.isAnonymous||Xo(t)))}const Zo=new WeakMap;function Ao(t,e){if(!t.isAnonymous||e instanceof vo||e.type!=t)return 1;let i=Zo.get(e);if(null==i){i=1;for(let n of e.children){if(n.type!=t||!(n instanceof bo)){i=1;break}i+=Ao(t,n)}Zo.set(e,i)}return i}function To(t,e,i,n,s,r,o,a,l){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]+a);continue}u.push(i[s])}else{let e=n[h-1]+i[h-1].length-f;u.push(To(t,i,n,s,h,f,e,null,l))}d.push(f+a-r)}}(e,i,n,s,0),(a||l)(u,d,o)}class Ro{constructor(){this.map=new WeakMap}setBuffer(t,e,i){let n=this.map.get(t);n||this.map.set(t,n=new Map),n.set(e,i)}getBuffer(t,e){let i=this.map.get(t);return i&&i.get(e)}set(t,e){t instanceof Co?this.setBuffer(t.context.buffer,t.index,e):t instanceof ko&&this.map.set(t.tree,e)}get(t){return t instanceof Co?this.getBuffer(t.context.buffer,t.index):t instanceof ko?this.map.get(t.tree):void 0}cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}}class Eo{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 Eo(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,a=0,l=0;;o++){let h=o=i)for(;r&&r.from=e.from||c<=e.to||l){let t=Math.max(e.from,a)-l,i=Math.min(e.to,c)-l;e=t>=i?null:new Eo(t,i,e.tree,e.offset+l,o>0,!!h)}if(e&&n.push(e),r.to>c)break;r=snew lo(t.from,t.to))):[new lo(0,0)]:[new lo(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 Mo{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)}}function Do(t){return(e,i,n,s)=>new qo(e,t,i,n,s)}class Wo{constructor(t,e,i,n,s){this.parser=t,this.parse=e,this.overlay=i,this.target=n,this.ranges=s}}class Uo{constructor(t,e,i,n,s,r,o){this.parser=t,this.predicate=e,this.mounts=i,this.index=n,this.start=s,this.target=r,this.prev=o,this.depth=0,this.ranges=[]}}const Yo=new ho({perNode:!0});class qo{constructor(t,e,i,n,s){this.nest=e,this.input=i,this.fragments=n,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=t}advance(){if(this.baseParse){let t=this.baseParse.advance();if(!t)return null;if(this.baseParse=null,this.baseTree=t,this.startInner(),null!=this.stoppedAt)for(let t of this.inner)t.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let t=this.baseTree;return null!=this.stoppedAt&&(t=new bo(t.type,t.children,t.positions,t.length,t.propValues.concat([[Yo,this.stoppedAt]]))),t}let t=this.inner[this.innerDone],e=t.parse.advance();if(e){this.innerDone++;let i=Object.assign(Object.create(null),t.target.props);i[ho.mounted.id]=new co(e,t.overlay,t.parser),t.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let t=this.input.length;for(let e=this.innerDone;et.frag.from<=n.from&&t.frag.to>=n.to&&t.mount.overlay));if(t)for(let i of t.mount.overlay){let s=i.from+t.pos,r=i.to+t.pos;s>=n.from&&r<=n.to&&!e.ranges.some((t=>t.froms))&&e.ranges.push({from:s,to:r})}}a=!1}else if(i&&(r=Lo(i.ranges,n.from,n.to)))a=2!=r;else if(!n.type.isAnonymous&&n.fromnew lo(t.from-n.from,t.to-n.from))):null,n.tree,t)),s.overlay?t.length&&(i={ranges:t,depth:0,prev:i}):a=!1}}else e&&(o=e.predicate(n))&&(!0===o&&(o=new lo(n.from,n.to)),o.fromnew lo(t.from-e.start,t.to-e.start))),e.target,t)),e=e.prev}i&&! --i.depth&&(i=i.prev)}}}}function Lo(t,e,i){for(let n of t){if(n.from>=i)break;if(n.to>e)return n.from<=e&&n.to>=i?2:1}return 0}function zo(t,e,i,n,s,r){if(e=e.to);n++);let o=s.children[n],a=o.buffer;s.children[n]=function t(i,n,s,l,h){let c=i;for(;a[c+2]+r<=e.from;)c=a[c+3];let u=[],d=[];zo(o,i,c,u,d,l);let f=a[c+1],p=a[c+2],O=f+r==e.from&&p+r==e.to&&a[c]==e.type.id;return u.push(O?e.toTree():t(c+4,a[c+3],o.set.types[a[c]],f,p-f)),d.push(f-l),zo(o,a[c+3],n,u,d,l),new bo(s,u,d,h)}(0,a.length,fo.none,0,o.length);for(let n=0;n<=i;n++)t.childAfter(e.from)}class Bo{constructor(t,e){this.offset=e,this.done=!1,this.cursor=t.cursor(mo.IncludeAnonymous|mo.IgnoreMounts)}moveTo(t){let{cursor:e}=this,i=t-this.offset;for(;!this.done&&e.from=t&&e.enter(i,1,mo.IgnoreOverlays|mo.ExcludeBuffers)||e.next(!1)||(this.done=!0)}hasNode(t){if(this.moveTo(t.from),!this.done&&this.cursor.from+this.offset==t.from&&this.cursor.tree)for(let e=this.cursor.tree;;){if(e==t.tree)return!0;if(!(e.children.length&&0==e.positions[0]&&e.children[0]instanceof bo))break;e=e.children[0]}return!1}}let jo=class{constructor(t){var e;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){let i=this.curFrag=t[0];this.curTo=null!==(e=i.tree.prop(Yo))&&void 0!==e?e:i.to,this.inner=new Bo(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t)}nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=null!==(t=e.tree.prop(Yo))&&void 0!==t?t:e.to,this.inner=new Bo(e.tree,-e.offset)}}findMounts(t,e){var i;let n=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let t=this.inner.cursor.node;t;t=t.parent){let s=null===(i=t.tree)||void 0===i?void 0:i.prop(ho.mounted);if(s&&s.parser==e)for(let e=this.fragI;e=t.to)break;i.tree==this.curFrag.tree&&n.push({frag:i,pos:t.from-i.offset,mount:s})}}}return n}};function No(t,e){let i=null,n=e;for(let s=1,r=0;s=a)break;t.to<=o||(i||(n=i=e.slice()),t.froma&&i.splice(r+1,0,new lo(a,t.to))):t.to>a?i[r--]=new lo(a,t.to):i.splice(r--,1))}}return n}function Go(t,e,i,n){let s=0,r=0,o=!1,a=!1,l=-1e9,h=[];for(;;){let c=s==t.length?1e9:o?t[s].to:t[s].from,u=r==e.length?1e9:a?e[r].to:e[r].from;if(o!=a){let t=Math.max(l,i),e=Math.min(c,u,n);tnew lo(t.from+n,t.to+n))),a,l);for(let e=0,n=a;;e++){let a=e==o.length,h=a?l:o[e].from;if(h>n&&i.push(new Eo(n,h,s.tree,-t,r.from>=n||r.openStart,r.to<=h||r.openEnd)),a)break;n=o[e].to}}else i.push(new Eo(a,l,s.tree,-t,r.from>=t||r.openStart,r.to<=o||r.openEnd))}return i}let Ho=0;class Jo{constructor(t,e,i){this.set=t,this.base=e,this.modified=i,this.id=Ho++}static define(t){if(null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let e=new Jo([],null,[]);if(e.set.push(e),t)for(let i of t.set)e.set.push(i);return e}static defineModifier(){let t=new ta;return e=>e.modified.indexOf(t)>-1?e:ta.get(e.base||e,e.modified.concat(t).sort(((t,e)=>t.id-e.id)))}}let Ko=0;class ta{constructor(){this.instances=[],this.id=Ko++}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 Jo(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(ta.get(e,t));return s}}function ea(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,a=i[o];if(!a)throw new RangeError("Invalid path: "+t);let l=new na(n,s,o>0?i.slice(0,o):null);e[a]=l.sort(e[a])}}return ia.add(e)}const ia=new ho;class na{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 ra(t,e,i,n=0,s=t.length){let r=new oa(n,Array.isArray(e)?e:[e],i);r.highlightRange(t.cursor(),n,s,"",r.highlighters),r.flush(s)}na.empty=new na([],2,null);class oa{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:a}=t;if(o>=i||a<=e)return;r.isTop&&(s=this.highlighters.filter((t=>!t.scope||t.scope(r))));let l=n,h=function(t){let e=t.type.prop(ia);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}(t)||na.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&&(l&&(l+=" "),l+=c,1==h.mode&&(n+=(n?" ":"")+c)),this.startSpan(t.from,l),h.opaque)return;let u=t.tree&&t.tree.prop(ho.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 d=0,f=o;;d++){let p=d=O)&&t.nextSibling()););if(!p||O>i)break;f=p.to+o,f>e&&(this.highlightRange(r.cursor(),Math.max(e,p.from+o),Math.min(i,f),n,h),this.startSpan(f,l))}c&&t.parent()}else if(t.firstChild()){do{if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,n,s),this.startSpan(Math.min(i,t.to),l)}}while(t.nextSibling());t.parent()}}}const aa=Jo.define,la=aa(),ha=aa(),ca=aa(ha),ua=aa(ha),da=aa(),fa=aa(da),pa=aa(da),Oa=aa(),ga=aa(Oa),ma=aa(),ba=aa(),wa=aa(),va=aa(wa),ya=aa(),Sa={comment:la,lineComment:aa(la),blockComment:aa(la),docComment:aa(la),name:ha,variableName:aa(ha),typeName:ca,tagName:aa(ca),propertyName:ua,attributeName:aa(ua),className:aa(ha),labelName:aa(ha),namespace:aa(ha),macroName:aa(ha),literal:da,string:fa,docString:aa(fa),character:aa(fa),attributeValue:aa(fa),number:pa,integer:aa(pa),float:aa(pa),bool:aa(da),regexp:aa(da),escape:aa(da),color:aa(da),url:aa(da),keyword:ma,self:aa(ma),null:aa(ma),atom:aa(ma),unit:aa(ma),modifier:aa(ma),operatorKeyword:aa(ma),controlKeyword:aa(ma),definitionKeyword:aa(ma),moduleKeyword:aa(ma),operator:ba,derefOperator:aa(ba),arithmeticOperator:aa(ba),logicOperator:aa(ba),bitwiseOperator:aa(ba),compareOperator:aa(ba),updateOperator:aa(ba),definitionOperator:aa(ba),typeOperator:aa(ba),controlOperator:aa(ba),punctuation:wa,separator:aa(wa),bracket:va,angleBracket:aa(va),squareBracket:aa(va),paren:aa(va),brace:aa(va),content:Oa,heading:ga,heading1:aa(ga),heading2:aa(ga),heading3:aa(ga),heading4:aa(ga),heading5:aa(ga),heading6:aa(ga),contentSeparator:aa(Oa),list:aa(Oa),quote:aa(Oa),emphasis:aa(Oa),strong:aa(Oa),link:aa(Oa),monospace:aa(Oa),strikethrough:aa(Oa),inserted:aa(),deleted:aa(),changed:aa(),invalid:aa(),meta:ya,documentMeta:aa(ya),annotation:aa(ya),processingInstruction:aa(ya),definition:Jo.defineModifier(),constant:Jo.defineModifier(),function:Jo.defineModifier(),standard:Jo.defineModifier(),local:Jo.defineModifier(),special:Jo.defineModifier()};var xa;sa([{tag:Sa.link,class:"tok-link"},{tag:Sa.heading,class:"tok-heading"},{tag:Sa.emphasis,class:"tok-emphasis"},{tag:Sa.strong,class:"tok-strong"},{tag:Sa.keyword,class:"tok-keyword"},{tag:Sa.atom,class:"tok-atom"},{tag:Sa.bool,class:"tok-bool"},{tag:Sa.url,class:"tok-url"},{tag:Sa.labelName,class:"tok-labelName"},{tag:Sa.inserted,class:"tok-inserted"},{tag:Sa.deleted,class:"tok-deleted"},{tag:Sa.literal,class:"tok-literal"},{tag:Sa.string,class:"tok-string"},{tag:Sa.number,class:"tok-number"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],class:"tok-string2"},{tag:Sa.variableName,class:"tok-variableName"},{tag:Sa.local(Sa.variableName),class:"tok-variableName tok-local"},{tag:Sa.definition(Sa.variableName),class:"tok-variableName tok-definition"},{tag:Sa.special(Sa.variableName),class:"tok-variableName2"},{tag:Sa.definition(Sa.propertyName),class:"tok-propertyName tok-definition"},{tag:Sa.typeName,class:"tok-typeName"},{tag:Sa.namespace,class:"tok-namespace"},{tag:Sa.className,class:"tok-className"},{tag:Sa.macroName,class:"tok-macroName"},{tag:Sa.propertyName,class:"tok-propertyName"},{tag:Sa.operator,class:"tok-operator"},{tag:Sa.comment,class:"tok-comment"},{tag:Sa.meta,class:"tok-meta"},{tag:Sa.invalid,class:"tok-invalid"},{tag:Sa.punctuation,class:"tok-punctuation"}]);const ka=new ho;function Qa(t){return E.define({combine:t?e=>e.concat(t):void 0})}const $a=new ho;class Pa{constructor(t,e,i=[],n=""){this.data=t,this.name=n,xt.prototype.hasOwnProperty("tree")||Object.defineProperty(xt.prototype,"tree",{get(){return Xa(this)}}),this.parser=e,this.extension=[Wa.of(this),xt.languageData.of(((t,e,i)=>{let n=Ca(t,e,i),s=n.type.prop(ka);if(!s)return[];let r=t.facet(s),o=n.type.prop($a);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 Ca(t,e,i).type.prop(ka)==this.data}findRegions(t){let e=t.facet(Wa);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(ka)==this.data)return void i.push({from:e,to:e+t.length});let s=t.prop(ho.mounted);if(s){if(s.tree.prop(ka)==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;it.isTop?e:void 0))]}),t.name)}configure(t,e){return new _a(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Xa(t){let e=t.field(Pa.state,!1);return e?e.tree:bo.empty}class Za{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let i=this.cursorPos-this.string.length;return t=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i)}}let Aa=null;class Ta{constructor(t,e,i=[],n,s,r,o,a){this.parser=t,this.state=e,this.fragments=i,this.tree=n,this.treeLen=s,this.viewport=r,this.skipped=o,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(t,e,i){return new Ta(t,e,[],bo.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Za(this.state.doc),this.fragments)}work(t,e){return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=bo.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(Eo.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Aa;Aa=this;try{return t()}finally{Aa=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=Ra(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=Eo.applyChanges(i,e),n=bo.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=Ra(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 Vo{createParse(e,i,n){let s=n[0].from,r=n[n.length-1].to;return{parsedPos:s,advance(){let e=Aa;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 bo(fo.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 Aa}}function Ra(t,e,i){return Eo.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class Ea{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 Ea(e)}static init(t){let e=Math.min(3e3,t.doc.length),i=Ta.create(t.facet(Wa).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new Ea(i)}}Pa.state=q.define({create:Ea.init,update(t,e){for(let t of e.effects)if(t.is(Pa.setState))return t.value;return e.startState.facet(Wa)!=e.state.facet(Wa)?Ea.init(e.state):t.apply(e)}});let Va=t=>{let e=setTimeout((()=>t()),500);return()=>clearTimeout(e)};"undefined"!=typeof requestIdleCallback&&(Va=t=>{let e=-1,i=setTimeout((()=>{e=requestIdleCallback(t,{timeout:400})}),100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const Ma="undefined"!=typeof navigator&&(null===(xa=navigator.scheduling)||void 0===xa?void 0:xa.isInputPending)?()=>navigator.scheduling.isInputPending():null,Da=_i.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(Pa.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),t.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(Pa.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=Va(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEndn+1e3,a=s.context.work((()=>Ma&&Ma()||Date.now()>r),n+(o?0:1e5));this.chunkBudget-=Date.now()-e,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Pa.setState.of(new Ea(s.context))})),this.chunkBudget>0&&(!a||o)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then((()=>this.scheduleWork())).catch((t=>Qi(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()}}}),Wa=E.define({combine:t=>t.length?t[0]:null,enables:t=>[Pa.state,Da,Ts.contentAttributes.compute([t],(e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}}))]});class Ua{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}class Ya{constructor(t,e,i,n,s,r=void 0){this.name=t,this.alias=e,this.extensions=i,this.filename=n,this.loadFunc=s,this.support=r,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then((t=>this.support=t),(t=>{throw this.loading=null,t})))}static of(t){let{load:e,support:i}=t;if(!e){if(!i)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");e=()=>Promise.resolve(i)}return new Ya(t.name,(t.alias||[]).concat(t.name).map((t=>t.toLowerCase())),t.extensions||[],t.filename,e,i)}static matchFilename(t,e){for(let i of t)if(i.filename&&i.filename.test(e))return i;let i=/\.([^.]+)$/.exec(e);if(i)for(let e of t)if(e.extensions.indexOf(i[1])>-1)return e;return null}static matchLanguageName(t,e,i=!0){e=e.toLowerCase();for(let i of t)if(i.alias.some((t=>t==e)))return i;if(i)for(let i of t)for(let t of i.alias){let n=e.indexOf(t);if(n>-1&&(t.length>2||!/\w/.test(e[n-1])&&!/\w/.test(e[n+t.length])))return i}return null}}const qa=E.define(),La=E.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 za(t){let e=t.facet(La);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function Ia(t,e){let i="",n=t.tabSize,s=t.facet(La)[0];if("\t"==s){for(;e>=n;)i+="\t",e-=n;s=" "}for(let t=0;t=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 Yt(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 Na=new ho;function Ga(t){let e=t.type.prop(Na);if(e)return e;let i,n=t.firstChild;if(n&&(i=n.type.prop(ho.closedBy))){let e=t.lastChild,n=e&&i.indexOf(e.name)>-1;return t=>el(t,!0,1,void 0,n&&!function(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}(t)?e.from:void 0)}return null==t.parent?Ha:null}function Fa(t,e,i){for(;t;t=t.parent){let n=Ga(t);if(n)return n(Ja.create(i,e,t))}return null}function Ha(){return 0}class Ja extends ja{constructor(t,e,i){super(t.state,t.options),this.base=t,this.pos=e,this.node=i}static create(t,e,i){return new Ja(t,e,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){let t=this.state.doc.lineAt(this.node.from);for(;;){let e=this.node.resolve(t.from);for(;e.parent&&e.parent.from==e.from;)e=e.parent;if(Ka(e,this.node))break;t=this.state.doc.lineAt(e.from)}return this.lineIndent(t.from)}continue(){let t=this.node.parent;return t?Fa(t,this.pos,this.base):0}}function Ka(t,e){for(let i=e;i;i=i.parent)if(t==i)return!0;return!1}function tl({closing:t,align:e=!0,units:i=1}){return n=>el(n,e,i,t)}function el(t,e,i,n,s){let r=t.textAfter,o=r.match(/^\s*/)[0].length,a=n&&r.slice(o,o+n.length)==n||s==t.pos+o,l=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.from{let n=t&&t.test(i.textAfter);return i.baseIndent+(n?0:e*i.unit)}}function nl(){return xt.transactionFilter.of((t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let i=t.newDoc,{head:n}=t.newSelection.main,s=i.lineAt(n);if(n>s.from+200)return t;let r=i.sliceString(s.from,n);if(!e.some((t=>t.test(r))))return t;let{state:o}=t,a=-1,l=[];for(let{head:t}of o.selection.ranges){let e=o.doc.lineAt(t);if(e.from==a)continue;a=e.from;let i=Ba(o,e.from);if(null==i)continue;let n=/^\s*/.exec(e.text)[0],s=Ia(o,i);n!=s&&l.push({from:e.from,to:e.from+n.length,insert:s})}return l.length?[t,{changes:l,sequential:!0}]:t}))}const sl=E.define(),rl=new ho;function ol(t){let e=t.firstChild,i=t.lastChild;return e&&e.toi)continue;if(s&&r.from=e&&n.to>i&&(s=n)}}return s}(t,e,i)}function hl(t,e){let i=e.mapPos(t.from,1),n=e.mapPos(t.to,-1);return i>=n?void 0:{from:i,to:n}}const cl=ut.define({map:hl}),ul=ut.define({map:hl}),dl=q.define({create:()=>ni.none,update(t,e){t=t.map(e.changes);for(let i of e.effects)i.is(cl)&&!pl(t,i.value.from,i.value.to)?t=t.update({add:[bl.range(i.value.from,i.value.to)]}):i.is(ul)&&(t=t.update({filter:(t,e)=>i.value.from!=t||i.value.to!=e,filterFrom:i.value.from,filterTo:i.value.to}));if(e.selection){let i=!1,{head:n}=e.selection.main;t.between(n,n,((t,e)=>{tn&&(i=!0)})),i&&(t=t.update({filterFrom:n,filterTo:n,filter:(t,e)=>e<=n||t>=n}))}return t},provide:t=>Ts.decorations.from(t),toJSON(t,e){let i=[];return t.between(0,e.doc.length,((t,e)=>{i.push(t,e)})),i},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let i=0;i{(!s||s.from>t)&&(s={from:t,to:e})})),s}function pl(t,e,i){let n=!1;return t.between(e,e,((t,s)=>{t==e&&s==i&&(n=!0)})),n}const Ol={placeholderDOM:null,placeholderText:"…"},gl=E.define({combine:t=>kt(t,Ol)});function ml(t){let e=[dl,yl];return t&&e.push(gl.of(t)),e}const bl=ni.replace({widget:new class extends ei{toDOM(t){let{state:e}=t,i=e.facet(gl),n=e=>{let i=t.lineBlockAt(t.posAtDOM(e.target)),n=fl(t.state,i.from,i.to);n&&t.dispatch({effects:ul.of(n)}),e.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(t,n);let s=document.createElement("span");return s.textContent=i.placeholderText,s.setAttribute("aria-label",e.phrase("folded code")),s.title=e.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=n,s}}}),wl={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class vl extends Yr{constructor(t,e){super(),this.config=t,this.open=e}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let e=document.createElement("span");return e.textContent=this.open?this.config.openText:this.config.closedText,e.title=t.state.phrase(this.open?"Fold line":"Unfold line"),e}}const yl=Ts.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Sl{constructor(t,e){let i;function n(t){let e=It.newName();return(i||(i=Object.create(null)))["."+e]=t,e}this.specs=t;const s="string"==typeof e.all?e.all:e.all?n(e.all):void 0,r=e.scope;this.scope=r instanceof Pa?t=>t.prop(ka)==r.data:r?t=>t==r:void 0,this.style=sa(t.map((t=>({tag:t.tag,class:t.class||n(Object.assign({},t,{tag:null}))}))),{all:s}).style,this.module=i?new It(i):null,this.themeType=e.themeType}static define(t,e){return new Sl(t,e||{})}}const xl=E.define(),kl=E.define({combine:t=>t.length?[t[0]]:null});function Ql(t){let e=t.facet(xl);return e.length?e:t.facet(kl)}function $l(t,e){let i,n=[Cl];return t instanceof Sl&&(t.module&&n.push(Ts.styleModule.of(t.module)),i=t.themeType),(null==e?void 0:e.fallback)?n.push(kl.of(t)):i?n.push(xl.computeN([Ts.darkTheme],(e=>e.facet(Ts.darkTheme)==("dark"==i)?[t]:[]))):n.push(xl.of(t)),n}class Pl{constructor(t){this.markCache=Object.create(null),this.tree=Xa(t.state),this.decorations=this.buildDeco(t,Ql(t.state))}update(t){let e=Xa(t.state),i=Ql(t.state),n=i!=Ql(t.startState);e.length{i.add(t,e,this.markCache[n]||(this.markCache[n]=ni.mark({class:n})))}),n,s);return i.finish()}}const Cl=N.high(_i.fromClass(Pl,{decorations:t=>t.decorations})),_l=Sl.define([{tag:Sa.meta,color:"#404740"},{tag:Sa.link,textDecoration:"underline"},{tag:Sa.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Sa.emphasis,fontStyle:"italic"},{tag:Sa.strong,fontWeight:"bold"},{tag:Sa.strikethrough,textDecoration:"line-through"},{tag:Sa.keyword,color:"#708"},{tag:[Sa.atom,Sa.bool,Sa.url,Sa.contentSeparator,Sa.labelName],color:"#219"},{tag:[Sa.literal,Sa.inserted],color:"#164"},{tag:[Sa.string,Sa.deleted],color:"#a11"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],color:"#e40"},{tag:Sa.definition(Sa.variableName),color:"#00f"},{tag:Sa.local(Sa.variableName),color:"#30a"},{tag:[Sa.typeName,Sa.namespace],color:"#085"},{tag:Sa.className,color:"#167"},{tag:[Sa.special(Sa.variableName),Sa.macroName],color:"#256"},{tag:Sa.definition(Sa.propertyName),color:"#00c"},{tag:Sa.comment,color:"#940"},{tag:Sa.invalid,color:"#f00"}]),Xl=Ts.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Zl=1e4,Al="()[]{}",Tl=E.define({combine:t=>kt(t,{afterCursor:!0,brackets:Al,maxScanDistance:Zl,renderMatch:Vl})}),Rl=ni.mark({class:"cm-matchingBracket"}),El=ni.mark({class:"cm-nonmatchingBracket"});function Vl(t){let e=[],i=t.matched?Rl:El;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 Ml=q.define({create:()=>ni.none,update(t,e){if(!e.docChanged&&!e.selection)return t;let i=[],n=e.state.facet(Tl);for(let t of e.state.selection.ranges){if(!t.empty)continue;let s=Ll(e.state,t.head,-1,n)||t.head>0&&Ll(e.state,t.head-1,1,n)||n.afterCursor&&(Ll(e.state,t.head,1,n)||t.headTs.decorations.from(t)}),Dl=[Ml,Xl];function Wl(t={}){return[Tl.of(t),Dl]}const Ul=new ho;function Yl(t,e,i){let n=t.prop(e<0?ho.openedBy:ho.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 ql(t){let e=t.type.prop(Ul);return e?e(t.node):t}function Ll(t,e,i,n={}){let s=n.maxScanDistance||Zl,r=n.brackets||Al,o=Xa(t),a=o.resolveInner(e,i);for(let n=a;n;n=n.parent){let s=Yl(n.type,i,r);if(s&&n.from0?e>=o.from&&eo.from&&e<=o.to))return zl(t,e,i,n,o,s,r)}}return function(t,e,i,n,s,r,o){let a=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%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 a=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(a+t,1).type!=s))if(e%2==0==i>0)u++;else{if(1==u)return{start:h,end:{from:a+t,to:a+t+1},matched:e>>1==l>>1};u--}}i>0&&(t+=r.length)}return c.done?{start:h,matched:!1}:null}(t,e,i,o,a.type,s,r)}function zl(t,e,i,n,s,r,o){let a=n.parent,l={from:s.from,to:s.to},h=0,c=null==a?void 0:a.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 jl(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 Nl=new WeakMap;class Gl extends Pa{constructor(t){let e,i=Qa(t.languageData),n={name:(s=t).name||"",token:s.token,blankLine:s.blankLine||(()=>{}),startState:s.startState||(()=>!0),copyState:s.copyState||jl,indent:s.indent||(()=>null),languageData:s.languageData||{},tokenTable:s.tokenTable||th};var s;super(i,new class extends Vo{createParse(t,i,n){return new Jl(e,t,i,n)}},[qa.of(((t,e)=>this.getIndent(t,e)))],t.name),this.topNode=function(t){let e=fo.define({id:eh.length,name:"Document",props:[ka.add((()=>t))]});return eh.push(e),e}(i),e=this,this.streamParser=n,this.stateAfter=new ho({perNode:!0}),this.tokenTable=t.tokenTable?new rh(n.tokenTable):oh}static define(t){return new Gl(t)}getIndent(t,e){let i,n=Xa(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=Nl.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],a=i+e.positions[r],l=o instanceof bo&&a=e.length)return e;s||e.type!=t.topNode||(s=!0);for(let r=e.children.length-1;r>=0;r--){let o,a=e.positions[r],l=e.children[r];if(ai&&Fl(t,n.tree,0-n.offset,i,r);if(o&&(e=Hl(t,n.tree,i+n.offset,o.pos+n.offset,!1)))return{state:o.state,tree:e}}return{state:t.streamParser.startState(n?za(n):4),tree:bo.empty}}(t,i,r,null==s?void 0:s.state);this.state=o,this.parsedPos=this.chunkStart=r+a.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 Bl(e,t?t.state.tabSize:4,t?za(t.state):2);if(r.eol())s.blankLine(this.state,r.indentUnit);else for(;!r.eol();){let t=Kl(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 th=Object.create(null),eh=[fo.none],ih=new po(eh),nh=[],sh=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"]])sh[t]=lh(th,e);class rh{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),sh)}resolve(t){return t?this.table[t]||(this.table[t]=lh(this.extra,t)):0}}const oh=new rh(th);function ah(t,e){nh.indexOf(t)>-1||(nh.push(t),console.warn(e))}function lh(t,e){let i=null;for(let n of e.split(".")){let e=t[n]||Sa[n];e?"function"==typeof e?i?i=e(i):ah(n,`Modifier ${n} used at start of tag`):i?ah(n,`Tag ${n} used as modifier`):i=e:ah(n,`Unknown highlighting tag ${n}`)}if(!i)return 0;let n=e.replace(/ /g,"_"),s=fo.define({id:eh.length,name:n,props:[ea({[n]:i})]});return eh.push(s),s.id}function hh(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 ch=hh(gh,0),uh=hh(Oh,0),dh=hh(((t,e)=>Oh(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 fh(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}const ph=50;function Oh(t,e,i=e.selection.ranges){let n=i.map((t=>fh(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,a=t.sliceDoc(n-ph,n),l=t.sliceDoc(s,s+ph),h=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(l)[0].length,u=a.length-h;if(a.slice(u-e.length,u)==e&&l.slice(c,c+i.length)==i)return{open:{pos:n-h,margin:h&&1},close:{pos:s+c,margin:c&&1}};s-n<=2*ph?r=o=t.sliceDoc(n,s):(r=t.sliceDoc(n,n+ph),o=t.sliceDoc(s-ph,s));let d=/^\s*/.exec(r)[0].length,f=/\s*$/.exec(o)[0].length,p=o.length-f-i.length;return r.slice(d,d+e.length)==e&&o.slice(p,p+i.length)==i?{open:{pos:n+d+e.length,margin:/\s/.test(r.charAt(d+e.length))?1:0},close:{pos:s-f-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>l.from)){s=l.from;let t=/^\s*/.exec(l.text)[0].length,e=t==l.length,i=l.text.slice(t,t+a.length)==a?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 mh=lt.define(),bh=lt.define(),wh=E.define(),vh=E.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)})});const yh=q.define({create:()=>Dh.empty,update(t,e){let i=e.state.facet(vh),n=e.annotation(mh);if(n){let s=e.docChanged?A.single(function(t){let e=0;return t.iterChangedRanges(((t,i)=>e=i)),e}(e.changes)):void 0,r=Ch.fromTransaction(e,s),o=n.side,a=0==o?t.undone:t.done;return a=r?_h(a,a.length,i.minDepth,r):Th(a,e.startState.selection),new Dh(0==o?n.rest:a,0==o?a:n.rest)}let s=e.annotation(bh);if("full"!=s&&"before"!=s||(t=t.isolate()),!1===e.annotation(dt.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);let r=Ch.fromTransaction(e),o=e.annotation(dt.time),a=e.annotation(dt.userEvent);return r?t=t.addChanges(r,o,a,i,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,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 Dh(t.done.map(Ch.fromJSON),t.undone.map(Ch.fromJSON))});function Sh(t={}){return[yh,vh.of(t),Ts.domEventHandlers({beforeinput(t,e){let i="historyUndo"==t.inputType?kh:"historyRedo"==t.inputType?Qh:null;return!!i&&(t.preventDefault(),i(e))}})]}function xh(t,e){return function({state:i,dispatch:n}){if(!e&&i.readOnly)return!1;let s=i.field(yh,!1);if(!s)return!1;let r=s.pop(t,i,e);return!!r&&(n(r),!0)}}const kh=xh(0,!1),Qh=xh(1,!1),$h=xh(0,!0),Ph=xh(1,!0);class Ch{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 Ch(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 Ch(t.changes&&k.fromJSON(t.changes),[],t.mapped&&x.fromJSON(t.mapped),t.startSelection&&A.fromJSON(t.startSelection),t.selectionsAfter.map(A.fromJSON))}static fromTransaction(t,e){let i=Zh;for(let e of t.startState.facet(wh)){let n=e(t);n.length&&(i=i.concat(n))}return!i.length&&t.changes.empty?null:new Ch(t.changes.invert(t.startState.doc),i,void 0,e||t.startState.selection,Zh)}static selection(t){return new Ch(void 0,Zh,void 0,void 0,t)}}function _h(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 Xh(t,e){return t.length?e.length?t.concat(e):t:e}const Zh=[],Ah=200;function Th(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-Ah));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),_h(t,t.length-1,1e9,i.setSelAfter(n)))}return[Ch.selection([e])]}function Rh(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 Eh(t,e){if(!t.length)return t;let i=t.length,n=Zh;for(;i;){let s=Vh(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?[Ch.selection(n)]:Zh}function Vh(t,e,i){let n=Xh(t.selectionsAfter.length?t.selectionsAfter.map((t=>t.map(e))):Zh,i);if(!t.changes)return Ch.selection(n);let s=t.changes.map(e),r=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(r):r;return new Ch(s,ut.mapEffects(t.effects,e),o,t.startSelection.map(r),n)}const Mh=/^(input\.type|delete)($|\.)/;class Dh{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 Dh(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||Mh.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)?_h(r,r.length-1,n.minDepth,new Ch(t.changes.compose(o.changes),Xh(t.effects,o.effects),o.mapped,o.startSelection,Zh)):_h(r,r.length,n.minDepth,t),new Dh(r,Zh,e,i)}addSelection(t,e,i,n){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Zh;return s.length>0&&e-this.prevTimet.empty!=o.ranges[e].empty)).length)?this:new Dh(Th(this.done,t),this.undone,e,i);var r,o}addMapping(t){return new Dh(Eh(this.done,t),Eh(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:mh.of({side:t,rest:Rh(n)}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let i=1==n.length?Zh:n.slice(0,n.length-1);return s.mapped&&(i=Eh(i,s.mapped)),e.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:mh.of({side:t,rest:i}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}}Dh.empty=new Dh(Zh,Zh);const Wh=[{key:"Mod-z",run:kh,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Qh,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Qh,preventDefault:!0},{key:"Mod-u",run:$h,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Ph,preventDefault:!0}];function Uh(t,e){return A.create(t.ranges.map(e),t.mainIndex)}function Yh(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function qh({state:t,dispatch:e},i){let n=Uh(t.selection,i);return!n.eq(t.selection)&&(e(Yh(t,n)),!0)}function Lh(t,e){return A.cursor(e?t.to:t.from)}function zh(t,e){return qh(t,(i=>i.empty?t.moveByChar(i,e):Lh(i,e)))}function Ih(t){return t.textDirectionAt(t.state.selection.main.head)==Wi.LTR}const Bh=t=>zh(t,!Ih(t)),jh=t=>zh(t,Ih(t));function Nh(t,e){return qh(t,(i=>i.empty?t.moveByGroup(i,e):Lh(i,e)))}function Gh(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 Fh(t,e,i){let n,s,r=Xa(t).resolveInner(e.head),o=i?ho.closedBy:ho.openedBy;for(let n=e.head;;){let e=i?r.childAfter(n):r.childBefore(n);if(!e)break;Gh(t,e,o)?r=e:n=i?e.to:e.from}return s=r.type.prop(o)&&(n=i?Ll(t,r.from,1):Ll(t,r.to,-1))&&n.matched?i?n.end.to:n.end.from:i?r.to:r.from,A.cursor(s,i?-1:1)}function Hh(t,e){return qh(t,(i=>{if(!i.empty)return Lh(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)}))}const Jh=t=>Hh(t,!1),Kh=t=>Hh(t,!0);function tc(t){let e,i=t.scrollDOM.clientHeighti.empty?t.moveVertically(i,e,n.height):Lh(i,e)));if(r.eq(s.selection))return!1;if(n.selfScroll){let e=t.coordsAtPos(s.selection.main.head),o=t.scrollDOM.getBoundingClientRect(),a=o.top+n.marginTop,l=o.bottom-n.marginBottom;e&&e.top>a&&e.bottomec(t,!1),nc=t=>ec(t,!0);function sc(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=A.cursor(n.from+i))}return s}function rc(t,e){let i=Uh(t.state.selection,(t=>{let i=e(t);return A.range(t.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)}));return!i.eq(t.state.selection)&&(t.dispatch(Yh(t.state,i)),!0)}function oc(t,e){return console.log("Select!"),rc(t,(i=>t.moveByCharSelected(i,e)))}const ac=t=>oc(t,!Ih(t)),lc=t=>oc(t,Ih(t));function hc(t,e){return rc(t,(i=>t.moveByGroup(i,e)))}function cc(t,e){return rc(t,(i=>t.moveVertically(i,e)))}const uc=t=>cc(t,!1),dc=t=>cc(t,!0);function fc(t,e){return rc(t,(i=>t.moveVertically(i,e,tc(t).height)))}const pc=t=>fc(t,!1),Oc=t=>fc(t,!0),gc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:0})),!0),mc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.doc.length})),!0),bc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:0})),!0),wc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0);function vc(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=yc(t,n,!0)),s=Math.min(s,n),r=Math.max(r,n)}else s=yc(t,s,!1),r=yc(t,r,!0);return s==r?{range:n}:{changes:{from:s,to:r},range:A.cursor(s)}}));return!s.changes.empty&&(t.dispatch(n.update(s,{scrollIntoView:!0,userEvent:i,effects:"delete.selection"==i?Ts.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function yc(t,e,i){if(t instanceof Ts)for(let n of t.state.facet(Ts.atomicRanges).map((e=>e(t))))n.between(e,e,((t,n)=>{te&&(e=i?n:t)}));return e}const Sc=(t,e)=>vc(t,(i=>{let n,s,{state:r}=t,o=r.doc.lineAt(i);if(!e&&i>o.from&&iSc(t,!1),kc=t=>Sc(t,!0),Qc=(t,e)=>vc(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 a=f(r.text,n-r.from,e)+r.from,l=r.text.slice(Math.min(n,a)-r.from,Math.max(n,a)-r.from),h=o(l);if(null!=t&&h!=t)break;" "==l&&n==i||(t=h),n=a}return n})),$c=t=>Qc(t,!1),Pc=t=>vc(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 _c(t,e,i){if(t.readOnly)return!1;let n=[],s=[];for(let e of Cc(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(A.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(A.range(t.anchor-o,t.head-o))}}return!!n.length&&(e(t.update({changes:n,scrollIntoView:!0,selection:A.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0)}function Xc(t,e,i){if(t.readOnly)return!1;let n=[];for(let e of Cc(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 Zc=Ac(!1);function Ac(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),a=!e&&s==r&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i,n=Xa(t).resolveInner(e),s=n.childBefore(e),r=n.childAfter(e);return s&&r&&s.to<=e&&r.from>=e&&(i=s.type.prop(ho.closedBy))&&i.indexOf(r.name)>-1&&t.doc.lineAt(s.to).from==t.doc.lineAt(r.from).from?{from:s.to,to:r.from}:null}(i,s);e&&(s=r=(r<=o.to?o:i.doc.lineAt(r)).to);let l=new ja(i,{simulateBreak:s,simulateDoubleBreak:!!a}),h=Ba(l,s);for(null==h&&(h=/^\s*/.exec(i.doc.lineAt(s).text)[0].length);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:A.range(r.mapPos(n.anchor,1),r.mapPos(n.head,1))}}))}const Rc=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{i.push({from:e.from,insert:t.facet(La)})})),{userEvent:"input.indent"})),!0),Ec=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{let n=/^\s*/.exec(e.text)[0];if(!n)return;let s=Yt(n,t.tabSize),r=0,o=Ia(t,Math.max(0,s-za(t)));for(;rqh(t,(e=>Fh(t.state,e,!Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,!Ih(t))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:t=>qh(t,(e=>Fh(t.state,e,Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,Ih(t))))},{key:"Alt-ArrowUp",run:({state:t,dispatch:e})=>_c(t,e,!1)},{key:"Shift-Alt-ArrowUp",run:({state:t,dispatch:e})=>Xc(t,e,!1)},{key:"Alt-ArrowDown",run:({state:t,dispatch:e})=>_c(t,e,!0)},{key:"Shift-Alt-ArrowDown",run:({state:t,dispatch:e})=>Xc(t,e,!0)},{key:"Escape",run:({state:t,dispatch:e})=>{let i=t.selection,n=null;return i.ranges.length>1?n=A.create([i.main]):i.main.empty||(n=A.create([A.cursor(i.main.head)])),!!n&&(e(Yh(t,n)),!0)}},{key:"Mod-Enter",run:Ac(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:t,dispatch:e})=>{let i=Cc(t).map((({from:e,to:i})=>A.range(e,Math.min(i+1,t.doc.length))));return e(t.update({selection:A.create(i),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:t,dispatch:e})=>{let i=Uh(t.selection,(e=>{var i;let n=Xa(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 A.range(n.to,n.from)}));return e(Yh(t,i)),!0},preventDefault:!0},{key:"Mod-[",run:Ec},{key:"Mod-]",run:Rc},{key:"Mod-Alt-\\",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new ja(t,{overrideIndentation:t=>{let e=i[t];return null==e?-1:e}}),s=Tc(t,((e,s,r)=>{let o=Ba(n,e.from);if(null==o)return;/\S/.test(e.text)||(o=0);let a=/^\s*/.exec(e.text)[0],l=Ia(t,o);(a!=l||r.from{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(Cc(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=Uh(t.selection,(e=>{let s=Ll(t,e.head,-1)||Ll(t,e.head,1)||e.head>0&&Ll(t,e.head-1,1)||e.head{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=fh(t.state,i.from);return n.line?ch(t):!!n.block&&dh(t)}},{key:"Alt-A",run:uh}].concat([{key:"ArrowLeft",run:Bh,shift:ac,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:t=>Nh(t,!Ih(t)),shift:t=>hc(t,!Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:t=>qh(t,(e=>sc(t,e,!Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,!Ih(t)))),preventDefault:!0},{key:"ArrowRight",run:jh,shift:lc,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:t=>Nh(t,Ih(t)),shift:t=>hc(t,Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:t=>qh(t,(e=>sc(t,e,Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,Ih(t)))),preventDefault:!0},{key:"ArrowUp",run:Jh,shift:uc,preventDefault:!0},{mac:"Cmd-ArrowUp",run:gc,shift:bc},{mac:"Ctrl-ArrowUp",run:ic,shift:pc},{key:"ArrowDown",run:Kh,shift:dc,preventDefault:!0},{mac:"Cmd-ArrowDown",run:mc,shift:wc},{mac:"Ctrl-ArrowDown",run:nc,shift:Oc},{key:"PageUp",run:ic,shift:pc},{key:"PageDown",run:nc,shift:Oc},{key:"Home",run:t=>qh(t,(e=>sc(t,e,!1))),shift:t=>rc(t,(e=>sc(t,e,!1))),preventDefault:!0},{key:"Mod-Home",run:gc,shift:bc},{key:"End",run:t=>qh(t,(e=>sc(t,e,!0))),shift:t=>rc(t,(e=>sc(t,e,!0))),preventDefault:!0},{key:"Mod-End",run:mc,shift:wc},{key:"Enter",run:Zc},{key:"Mod-a",run:({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:xc,shift:xc},{key:"Delete",run:kc},{key:"Mod-Backspace",mac:"Alt-Backspace",run:$c},{key:"Mod-Delete",mac:"Alt-Delete",run:t=>Qc(t,!0)},{mac:"Mod-Backspace",run:t=>vc(t,(e=>{let i=t.lineBlockAt(e).from;return e>i?i:Math.max(0,e-1)}))},{mac:"Mod-Delete",run:Pc}].concat([{key:"Ctrl-b",run:Bh,shift:ac,preventDefault:!0},{key:"Ctrl-f",run:jh,shift:lc},{key:"Ctrl-p",run:Jh,shift:uc},{key:"Ctrl-n",run:Kh,shift:dc},{key:"Ctrl-a",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).from,1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).from)))},{key:"Ctrl-e",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).to,-1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).to)))},{key:"Ctrl-d",run:kc},{key:"Ctrl-h",run:xc},{key:"Ctrl-k",run:Pc},{key:"Ctrl-Alt-h",run:$c},{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:A.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:f(n.text,i-n.from,!1)+n.from,r=i==n.to?i+1:f(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:A.cursor(r)}}));return!i.changes.empty&&(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:nc}].map((t=>({mac:t.key,run:t.run,shift:t.shift})))));function Mc(){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 Uc{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(Wc(t)):Wc,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 b(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=w(t),i=this.bufferStart+this.bufferPos;this.bufferPos+=v(t);let n=this.normalize(e);for(let t=0,s=i;;t++){let r=n.charCodeAt(t),o=this.match(r,s);if(o)return this.value=o,this;if(t==n.length-1)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=jc(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 Ic(e,t.sliceString(e,i));return zc.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=jc(this.text,i+(t==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ic.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function jc(t,e){if(e>=t.length)return e;let i,n=t.lineAt(e);for(;e=56320&&i<57344;)e++;return e}function Nc(t){let e=Mc("input",{class:"cm-textfield",name:"line"});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,a,l]=i,h=a?+a.slice(1):0,c=o?+o:s.number;if(o&&l){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)));t.dispatch({effects:Gc.of(!1),selection:A.cursor(u.from+Math.max(0,Math.min(h,u.length))),scrollIntoView:!0}),t.focus()}return{dom:Mc("form",{class:"cm-gotoLine",onkeydown:e=>{27==e.keyCode?(e.preventDefault(),t.dispatch({effects:Gc.of(!1)}),t.focus()):13==e.keyCode&&(e.preventDefault(),i())},onsubmit:t=>{t.preventDefault(),i()}},Mc("label",t.state.phrase("Go to line"),": ",e)," ",Mc("button",{class:"cm-button",type:"submit"},t.state.phrase("go")))}}"undefined"!=typeof Symbol&&(Lc.prototype[Symbol.iterator]=Bc.prototype[Symbol.iterator]=function(){return this});const Gc=ut.define(),Fc=q.define({create:()=>!0,update(t,e){for(let i of e.effects)i.is(Gc)&&(t=i.value);return t},provide:t=>Ur.from(t,(t=>t?Nc:null))}),Hc=Ts.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),Jc={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Kc=E.define({combine:t=>kt(t,Jc,{highlightWordAroundCursor:(t,e)=>t||e,minSelectionLength:Math.min,maxMatches:Math.min})});function tu(t){let e=[ru,su];return t&&e.push(Kc.of(t)),e}const eu=ni.mark({class:"cm-selectionMatch"}),iu=ni.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function nu(t,e,i,n){return!(0!=i&&t(e.sliceDoc(i-1,i))==wt.Word||n!=e.doc.length&&t(e.sliceDoc(n,n+1))==wt.Word)}const su=_i.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(Kc),{state:i}=t,n=i.selection;if(n.ranges.length>1)return ni.none;let s,r=n.main,o=null;if(r.empty){if(!e.highlightWordAroundCursor)return ni.none;let t=i.wordAt(r.head);if(!t)return ni.none;o=i.charCategorizer(r.head),s=i.sliceDoc(t.from,t.to)}else{let t=r.to-r.from;if(t200)return ni.none;if(e.wholeWords){if(s=i.sliceDoc(r.from,r.to),o=i.charCategorizer(r.head),!nu(o,i,r.from,r.to)||!function(t,e,i,n){return t(e.sliceDoc(i,i+1))==wt.Word&&t(e.sliceDoc(n-1,n))==wt.Word}(o,i,r.from,r.to))return ni.none}else if(s=i.sliceDoc(r.from,r.to).trim(),!s)return ni.none}let a=[];for(let n of t.visibleRanges){let t=new Uc(i.doc,s,n.from,n.to);for(;!t.next().done;){let{from:n,to:s}=t.value;if((!o||nu(o,i,n,s))&&(r.empty&&n<=r.from&&s>=r.to?a.push(iu.range(n,s)):(n>=r.to||s<=r.from)&&a.push(eu.range(n,s)),a.length>e.maxMatches))return ni.none}}return ni.set(a)}},{decorations:t=>t.decorations}),ru=Ts.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});const ou=E.define({combine:t=>kt(t,{top:!1,caseSensitive:!1,literal:!1,wholeWord:!1,createPanel:t=>new Eu(t),scrollToMatch:t=>Ts.scrollIntoView(t)})});class au{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,qc),!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 pu(this):new cu(this)}getCursor(t,e=0,i){let n=t.doc?t:xt.create({doc:t});return null==i&&(i=n.doc.length),this.regexp?uu(this,n,e,i):hu(this,n,e,i)}}class lu{constructor(t){this.spec=t}}function hu(t,e,i,n){return new Uc(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=hu(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 uu(t,e,i,n){return new Lc(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?(s=e.charCategorizer(e.selection.main.head),(t,e,i)=>!i[0].length||(s(du(i.input,i.index))!=wt.Word||s(fu(i.input,i.index))!=wt.Word)&&(s(fu(i.input,i.index+i[0].length))!=wt.Word||s(du(i.input,i.index+i[0].length))!=wt.Word)):void 0},i,n);var s}function du(t,e){return t.slice(f(t,e,!1),e)}function fu(t,e){return t.slice(e,f(t,e))}class pu extends lu{nextMatch(t,e,i){let n=uu(this.spec,t,i,t.doc.length).next();return n.done&&(n=uu(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=uu(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=uu(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 Ou=ut.define(),gu=ut.define(),mu=q.define({create:t=>new bu(_u(t).create(),null),update(t,e){for(let i of e.effects)i.is(Ou)?t=new bu(i.value.create(),t.panel):i.is(gu)&&(t=new bu(t.query,i.value?Cu:null));return t},provide:t=>Ur.from(t,(t=>t.panel))});class bu{constructor(t,e){this.query=t,this.panel=e}}const wu=ni.mark({class:"cm-searchMatch"}),vu=ni.mark({class:"cm-searchMatch cm-searchMatch-selected"}),yu=_i.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(mu))}update(t){let e=t.state.field(mu);(e!=t.startState.field(mu)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ni.none;let{view:i}=this,n=new Xt;for(let e=0,s=i.visibleRanges,r=s.length;es[e+1].from-500;)a=s[++e].to;t.highlight(i.state,o,a,((t,e)=>{let s=i.state.selection.ranges.some((i=>i.from==t&&i.to==e));n.add(t,e,s?vu:wu)}))}return n.finish()}},{decorations:t=>t.decorations});function Su(t){return e=>{let i=e.state.field(mu,!1);return i&&i.query.spec.valid?t(e,i):Au(e)}}const xu=Su(((t,{query:e})=>{let{to:i}=t.state.selection.main,n=e.nextMatch(t.state,i,i);if(!n)return!1;let s=A.single(n.from,n.to),r=t.state.facet(ou);return t.dispatch({selection:s,effects:[Wu(t,n),r.scrollToMatch(s.main,t)],userEvent:"select.search"}),Zu(t),!0})),ku=Su(((t,{query:e})=>{let{state:i}=t,{from:n}=i.selection.main,s=e.prevMatch(i,n,n);if(!s)return!1;let r=A.single(s.from,s.to),o=t.state.facet(ou);return t.dispatch({selection:r,effects:[Wu(t,s),o.scrollToMatch(r.main,t)],userEvent:"select.search"}),Zu(t),!0})),Qu=Su(((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!(!i||!i.length)&&(t.dispatch({selection:A.create(i.map((t=>A.range(t.from,t.to)))),userEvent:"select.search.matches"}),!0)})),$u=Su(((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,a,l=[],h=[];if(r.from==n&&r.to==s&&(a=i.toText(e.getReplacement(r)),l.push({from:r.from,to:r.to,insert:a}),r=e.nextMatch(i,r.from,r.to),h.push(Ts.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(n).number)+"."))),r){let e=0==l.length||l[0].from>=r.to?0:r.to-r.from-a.length;o=A.single(r.from-e,r.to-e),h.push(Wu(t,r)),h.push(i.facet(ou).scrollToMatch(o.main,t))}return t.dispatch({changes:l,selection:o,effects:h,userEvent:"input.replace"}),!0})),Pu=Su(((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:Ts.announce.of(n),userEvent:"input.replace.all"}),!0}));function Cu(t){return t.state.facet(ou).createPanel(t)}function _u(t,e){var i,n,s,r;let o=t.selection.main,a=o.empty||o.to>o.from+100?"":t.sliceDoc(o.from,o.to);if(e&&!a)return e;let l=t.facet(ou);return new au({search:(null!==(i=null==e?void 0:e.literal)&&void 0!==i?i:l.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:null!==(n=null==e?void 0:e.caseSensitive)&&void 0!==n?n:l.caseSensitive,literal:null!==(s=null==e?void 0:e.literal)&&void 0!==s?s:l.literal,wholeWord:null!==(r=null==e?void 0:e.wholeWord)&&void 0!==r?r:l.wholeWord})}function Xu(t){let e=Vr(t,Cu);return e&&e.dom.querySelector("[main-field]")}function Zu(t){let e=Xu(t);e&&e==t.root.activeElement&&e.select()}const Au=t=>{let e=t.state.field(mu,!1);if(e&&e.panel){let i=Xu(t);if(i&&i!=t.root.activeElement){let n=_u(t.state,e.query.spec);n.valid&&t.dispatch({effects:Ou.of(n)}),i.focus(),i.select()}}else t.dispatch({effects:[gu.of(!0),e?Ou.of(_u(t.state,e.query.spec)):ut.appendConfig.of(Yu)]});return!0},Tu=t=>{let e=t.state.field(mu,!1);if(!e||!e.panel)return!1;let i=Vr(t,Cu);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:gu.of(!1)}),!0},Ru=[{key:"Mod-f",run:Au,scope:"editor search-panel"},{key:"F3",run:xu,shift:ku,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:xu,shift:ku,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Tu,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 Uc(t.doc,t.sliceDoc(n,s));!e.next().done;){if(r.length>1e3)return!1;e.value.from==n&&(o=r.length),r.push(A.range(e.value.from,e.value.to))}return e(t.update({selection:A.create(r,o),userEvent:"select.search.matches"})),!0}},{key:"Alt-g",run:t=>{let e=Vr(t,Nc);if(!e){let i=[Gc.of(!0)];null==t.state.field(Fc,!1)&&i.push(ut.appendConfig.of([Fc,Hc])),t.dispatch({effects:i}),e=Vr(t,Nc)}return e&&e.dom.querySelector("input").focus(),!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=A.create(i.ranges.map((e=>t.wordAt(e.head)||A.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 Uc(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 Uc(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(A.range(s.from,s.to),!1),effects:Ts.scrollIntoView(s.to)})),!0)},preventDefault:!0}];class Eu{constructor(t){this.view=t;let e=this.query=t.state.field(mu).query.spec;function i(t,e,i){return Mc("button",{class:"cm-button",name:t,onclick:e,type:"button"},i)}this.commit=this.commit.bind(this),this.searchField=Mc("input",{value:e.search,placeholder:Vu(t,"Find"),"aria-label":Vu(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Mc("input",{value:e.replace,placeholder:Vu(t,"Replace"),"aria-label":Vu(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Mc("input",{type:"checkbox",name:"case",form:"",checked:e.caseSensitive,onchange:this.commit}),this.reField=Mc("input",{type:"checkbox",name:"re",form:"",checked:e.regexp,onchange:this.commit}),this.wordField=Mc("input",{type:"checkbox",name:"word",form:"",checked:e.wholeWord,onchange:this.commit}),this.dom=Mc("div",{onkeydown:t=>this.keydown(t),class:"cm-search"},[this.searchField,i("next",(()=>xu(t)),[Vu(t,"next")]),i("prev",(()=>ku(t)),[Vu(t,"previous")]),i("select",(()=>Qu(t)),[Vu(t,"all")]),...t.state.readOnly?[]:[Mc("br"),this.replaceField,i("replace",(()=>$u(t)),[Vu(t,"replace")]),i("replaceAll",(()=>Pu(t)),[Vu(t,"replace all")])],Mc("button",{name:"close",onclick:()=>Tu(t),"aria-label":Vu(t,"close"),type:"button"},["×"])])}commit(){let t=new au({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:Ou.of(t)}))}keydown(t){var e,i,n;e=this.view,i=t,n="search-panel",Bs(Ls(e.state),i,e,n)?t.preventDefault():13==t.keyCode&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?ku:xu)(this.view)):13==t.keyCode&&t.target==this.replaceField&&(t.preventDefault(),$u(this.view))}update(t){for(let e of t.transactions)for(let t of e.effects)t.is(Ou)&&!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(ou).top}}function Vu(t,e){return t.state.phrase(e)}const Mu=30,Du=/[\s\.,:;?!]/;function Wu(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-Mu),o=Math.min(s,i+Mu),a=t.state.sliceDoc(r,o);if(r!=n.from)for(let t=0;ta.length-Mu;t--)if(!Du.test(a[t-1])&&Du.test(a[t])){a=a.slice(0,t);break}return Ts.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${n.number}.`)}const Uu=Ts.baseTheme({".cm-panel.cm-search":{padding:"0.25rem 0.5rem 0.25rem 0.5rem",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"0.5rem",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"}}),Yu=[mu,N.lowest(yu),Uu];class qu{constructor(t,e,i){this.state=t,this.pos=e,this.explicit=i,this.abortListeners=[]}tokenBefore(t){let e=Xa(this.state).resolveInner(this.pos,-1);for(;e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null}matchBefore(t){let e=this.state.doc.lineAt(this.pos),i=Math.max(e.from,this.pos-250),n=e.text.slice(i-e.from,this.pos-e.from),s=n.search(ju(t,!1));return s<0?null:{from:i+s,to:this.pos,text:n.slice(s)}}get aborted(){return null==this.abortListeners}addEventListener(t,e){"abort"==t&&this.abortListeners&&this.abortListeners.push(e)}}function Lu(t){let e=Object.keys(t).join(""),i=/\w/.test(e);return i&&(e=e.replace(/\w/g,"")),`[${i?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function zu(t){let e=t.map((t=>"string"==typeof t?{label:t}:t)),[i,n]=e.every((t=>/^\w+$/.test(t.label)))?[/\w*$/,/\w+$/]:function(t){let e=Object.create(null),i=Object.create(null);for(let{label:n}of t){e[n[0]]=!0;for(let t=1;t{let s=t.matchBefore(n);return s||t.explicit?{from:s?s.from:t.pos,options:e,validFor:i}:null}}class Iu{constructor(t,e,i,n){this.completion=t,this.source=e,this.match=i,this.score=n}}function Bu(t){return t.selection.main.from}function ju(t,e){var i;let{source:n}=t,s=e&&"^"!=n[0],r="$"!=n[n.length-1];return s||r?new RegExp(`${s?"^":""}(?:${n})${r?"$":""}`,null!==(i=t.flags)&&void 0!==i?i:t.ignoreCase?"i":""):t}const Nu=lt.define();const Gu=new WeakMap;function Fu(t){if(!Array.isArray(t))return t;let e=Gu.get(t);return e||Gu.set(t,e=zu(t)),e}const Hu=ut.define(),Ju=ut.define();class Ku{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[];for(let e=0;e=48&&l<=57||l>=97&&l<=122?2:l>=65&&l<=90?1:0:(y=w(l))!=y.toLowerCase()?1:y!=y.toUpperCase()?2:0;(!n||1==S&&O||0==m&&0!=S)&&(e[c]==l||i[c]==l&&(u=!0)?r[c++]=n:r.length&&(g=!1)),m=S,n+=v(l)}return c==a&&0==r[0]&&g?this.result((u?-200:0)-100,r,t):d==a&&0==f?[-200-t.length+(p==t.length?0:-100),0,p]:o>-1?[-700-t.length,o,o+this.pattern.length]:d==a?[-900-t.length,f,p]:c==a?this.result((u?-200:0)-100-700+(g?0:-1100),r,t):2==e.length?null:this.result((n[0]?-700:0)-200-1100,n,t)}result(t,e,i){let n=[t-i.length],s=1;for(let t of e){let e=t+(this.astral?v(b(i,t)):1);s>1&&n[s-1]==t?n[s-1]=e:(n[s++]=t,n[s++]=e)}return n}}const td=E.define({combine:t=>kt(t,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:id,compareCompletions:(t,e)=>t.label.localeCompare(e.label),interactionDelay:75},{defaultKeymap:(t,e)=>t&&e,closeOnBlur:(t,e)=>t&&e,icons:(t,e)=>t&&e,tooltipClass:(t,e)=>i=>ed(t(i),e(i)),optionClass:(t,e)=>i=>ed(t(i),e(i)),addToOptions:(t,e)=>t.concat(e)})});function ed(t,e){return t?e?t+" "+e:t:e}function id(t,e,i,n,s){let r,o,a=t.textDirection==Wi.RTL,l=a,h=!1,c="top",u=e.left-s.left,d=s.right-e.right,f=n.right-n.left,p=n.bottom-n.top;if(l&&u=p||t>e.top?r=i.bottom-e.top:(c="bottom",r=e.bottom-i.top)}return{style:`${c}: ${r}px; max-width: ${o}px`,class:"cm-completionInfo-"+(h?a?"left-narrow":"right-narrow":l?"left":"right")}}function nd(t,e="option"){return i=>{let n=i.state.field(yd,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp-1?n.open.selected+r*(t?1:-1):t?0:o-1;return a<0?a="page"==e?0:o-1:a>=o&&(a="page"==e?o-1:0),i.dispatch({effects:vd.of(a)}),!0}}const sd=t=>{let e=t.state.field(yd,!1);return!(t.state.readOnly||!e||!e.open||e.open.selected<0||Date.now()-e.open.timestamp(t.selection||t.docChanged)&&!gd(t)));for(let e=0;e50&&Date.now()-n.time>1e3){for(let t of n.context.abortListeners)try{t()}catch(t){Qi(this.view.state,t)}n.context.abortListeners=null,this.running.splice(e--,1)}else n.updates.push(...t.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some((t=>1==t.state&&!this.running.some((e=>e.active.source==t.source))))?setTimeout((()=>this.startUpdate()),50):-1,0!=this.composing)for(let e of t.transactions)"input"==gd(e)?this.composing=2:2==this.composing&&e.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:t}=this.view,e=t.field(yd);for(let t of e.active)1!=t.state||this.running.some((e=>e.active.source==t.source))||this.startQuery(t)}startQuery(t){let{state:e}=this.view,i=Bu(e),n=new qu(e,i,t.explicitPos==i),s=new rd(t,n);this.running.push(s),Promise.resolve(t.source(n)).then((t=>{s.context.aborted||(s.done=t||null,this.scheduleAccept())}),(t=>{this.view.dispatch({effects:Ju.of(null)}),Qi(this.view.state,t)}))}scheduleAccept(){this.running.every((t=>void 0!==t.done))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((()=>this.accept()),50))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],i=this.view.state.facet(td);for(let n=0;nt.source==s.active.source));if(r&&1==r.state)if(null==s.done){let t=new md(s.active.source,0);for(let e of s.updates)t=t.update(e,i);1!=t.state&&e.push(t)}else this.startQuery(r)}e.length&&this.view.dispatch({effects:wd.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(yd,!1);if(e&&e.tooltip&&this.view.state.facet(td).closeOnBlur){let i=e.open&&Rr(this.view,e.open.tooltip);i&&i.dom.contains(t.relatedTarget)||this.view.dispatch({effects:Ju.of(null)})}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout((()=>this.view.dispatch({effects:Hu.of(!1)})),20),this.composing=0}}});function ad(t,e){const i=e.completion.apply||e.completion.label;let n=t.state.field(yd).active.find((t=>t.source==e.source));return n instanceof bd&&("string"==typeof i?t.dispatch(Object.assign(Object.assign({},function(t,e,i,n){let{main:s}=t.selection,r=i-s.from,o=n-s.from;return Object.assign(Object.assign({},t.changeByRange((a=>a!=s&&i!=n&&t.sliceDoc(a.from+r,a.from+o)!=t.sliceDoc(i,n)?{range:a}:{changes:{from:a.from+r,to:n==s.from?a.to:a.from+o,insert:e},range:A.cursor(a.from+r+e.length)}))),{userEvent:"input.complete"})}(t.state,i,n.from,n.to)),{annotations:Nu.of(e.completion)})):i(t,e.completion,n.from,n.to),!0)}function ld(t,e,i){if(t<=i)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let t=Math.floor(e/i);return{from:t*i,to:(t+1)*i}}let n=Math.floor((t-e)/i);return{from:t-(n+1)*i,to:t-n*i}}class hd{constructor(t,e){this.view=t,this.stateField=e,this.info=null,this.placeInfoReq={read:()=>this.measureInfo(),write:t=>this.placeInfo(t),key:this},this.space=null,this.currentClass="";let i=t.state.field(e),{options:n,selected:s}=i.open,r=t.state.facet(td);this.optionContent=function(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(t){let e=document.createElement("div");return e.classList.add("cm-completionIcon"),t.type&&e.classList.add(...t.type.split(/\s+/g).map((t=>"cm-completionIcon-"+t))),e.setAttribute("aria-hidden","true"),e},position:20}),e.push({render(t,e,i){let n=document.createElement("span");n.className="cm-completionLabel";let{label:s}=t,r=0;for(let t=1;tr&&n.appendChild(document.createTextNode(s.slice(r,e)));let a=n.appendChild(document.createElement("span"));a.appendChild(document.createTextNode(s.slice(e,o))),a.className="cm-completionMatchedText",r=o}return rt.position-e.position)).map((t=>t.render))}(r),this.optionClass=r.optionClass,this.tooltipClass=r.tooltipClass,this.range=ld(n.length,s,r.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",(e=>{for(let i,s=e.target;s&&s!=this.dom;s=s.parentNode)if("LI"==s.nodeName&&(i=/-(\d+)$/.exec(s.id))&&+i[1]{let i=t.state.field(this.stateField,!1);i&&i.tooltip&&t.state.facet(td).closeOnBlur&&e.relatedTarget!=t.contentDOM&&t.dispatch({effects:Ju.of(null)})})),this.list=this.dom.appendChild(this.createListBox(n,i.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))}mount(){this.updateSel()}update(t){var e,i,n;let s=t.state.field(this.stateField),r=t.startState.field(this.stateField);this.updateTooltipClass(t.state),s!=r&&(this.updateSel(),(null===(e=s.open)||void 0===e?void 0:e.disabled)!=(null===(i=r.open)||void 0===i?void 0:i.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!(null===(n=s.open)||void 0===n?void 0:n.disabled)))}updateTooltipClass(t){let e=this.tooltipClass(t);if(e!=this.currentClass){for(let t of this.currentClass.split(" "))t&&this.dom.classList.remove(t);for(let t of e.split(" "))t&&this.dom.classList.add(t);this.currentClass=e}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),e=t.open;if((e.selected>-1&&e.selected=this.range.to)&&(this.range=ld(e.options.length,e.selected,this.view.state.facet(td).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e.options,t.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))),this.updateSelectedOption(e.selected)){this.info&&(this.info.remove(),this.info=null);let{completion:i}=e.options[e.selected],{info:n,label:s,c:r}=i;if(!n)return;let o="string"==typeof n?document.createTextNode(n+" "):n(i);if(!o)return;if(!r){const t=document.createElement("span");t.appendChild(o),o=t;const e=document.createElement("a");e.innerText="🔎",e.href="/docFind/"+s,e.target="blank",o.appendChild(e)}if(!o)return;"then"in o?o.then((e=>{e&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(e)})).catch((t=>Qi(this.view.state,t,"completion info"))):this.addInfoPane(o)}}addInfoPane(t){let e=this.info=document.createElement("div");e.className="cm-tooltip cm-completionInfo",e.appendChild(t),this.dom.appendChild(e),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let e=null;for(let i=this.list.firstChild,n=this.range.from;i;i=i.nextSibling,n++)"LI"==i.nodeName&&i.id?n==t?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),e=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected"):n--;return e&&function(t,e){let i=t.getBoundingClientRect(),n=e.getBoundingClientRect();n.topi.bottom&&(t.scrollTop+=n.bottom-i.bottom)}(this.list,e),e}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let e=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),n=t.getBoundingClientRect(),s=this.space;if(!s){let t=this.dom.ownerDocument.defaultView||window;s={left:0,top:0,right:t.innerWidth,bottom:t.innerHeight}}return n.top>Math.min(s.bottom,e.bottom)-10||n.bottomi.from||0==i.from))if(s=t,"string"!=typeof l&&l.header)n.appendChild(l.header(l));else{n.appendChild(document.createElement("completion-section")).textContent=t}}const h=n.appendChild(document.createElement("li"));h.id=e+"-"+r,h.setAttribute("role","option");let c=this.optionClass(o);c&&(h.className=c);for(let t of this.optionContent){let e=t(o,this.view.state,a);e&&h.appendChild(e)}}return i.from&&n.classList.add("cm-completionListIncompleteTop"),i.to=this.options.length?this:new ud(this.options,pd(e,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,e,i,n,s){let r=function(t,e){let i=[],n=null,s=t=>{i.push(t);let{section:e}=t.completion;if(e){n||(n=[]);let t="string"==typeof e?e:e.name;n.some((e=>e.name==t))||n.push("string"==typeof e?{name:t}:e)}};for(let n of t)if(n.hasResult())if(!1===n.result.filter){let t=n.result.getMatch;for(let e of n.result.options){let r=[1e9-i.length];if(t)for(let i of t(e))r.push(i);s(new Iu(e,n.source,r,r[0]))}}else{let t,i=new Ku(e.sliceDoc(n.from,n.to));for(let e of n.result.options)(t=i.match(e.label))&&s(new Iu(e,n.source,t,t[0]+(e.boost||0)))}if(n){let t=Object.create(null),e=0,s=(t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:1e9)-(null!==(n=e.rank)&&void 0!==n?n:1e9)||(t.namee.score-t.score||a(t.completion,e.completion))))!o||o.label!=t.completion.label||o.detail!=t.completion.detail||null!=o.type&&null!=t.completion.type&&o.type!=t.completion.type||o.apply!=t.completion.apply?r.push(t):cd(t.completion)>cd(o)&&(r[r.length-1]=t),o=t.completion;return r}(t,e);if(!r.length)return n&&t.some((t=>1==t.state))?new ud(n.options,n.attrs,n.tooltip,n.timestamp,n.selected,!0):null;let o=e.facet(td).selectOnOpen?0:-1;if(n&&n.selected!=o&&-1!=n.selected){let t=n.options[n.selected].completion;for(let e=0;ee.hasResult()?Math.min(t,e.from):t),1e8),create:(a=yd,t=>new hd(t,a)),above:s.aboveCursor},n?n.timestamp:Date.now(),o,!1);var a}map(t){return new ud(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class dd{constructor(t,e,i){this.active=t,this.id=e,this.open=i}static start(){return new dd(Od,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(t){let{state:e}=t,i=e.facet(td),n=(i.override||e.languageDataAt("autocomplete",Bu(e)).map(Fu)).map((e=>(this.active.find((t=>t.source==e))||new md(e,this.active.some((t=>0!=t.state))?1:0)).update(t,i)));n.length==this.active.length&&n.every(((t,e)=>t==this.active[e]))&&(n=this.active);let s=this.open;s&&t.docChanged&&(s=s.map(t.changes)),t.selection||n.some((e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to)))||!function(t,e){if(t==e)return!0;for(let i=0,n=0;;){for(;i1==t.state))&&(s=null),!s&&n.every((t=>1!=t.state))&&n.some((t=>t.hasResult()))&&(n=n.map((t=>t.hasResult()?new md(t.source,0):t)));for(let e of t.effects)e.is(vd)&&(s=s&&s.setSelected(e.value,this.id));return n==this.active&&s==this.open?this:new dd(n,this.id,s)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:fd}}const fd={"aria-autocomplete":"list"};function pd(t,e){let i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(i["aria-activedescendant"]=t+"-"+e),i}const Od=[];function gd(t){return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null}class md{constructor(t,e,i=-1){this.source=t,this.state=e,this.explicitPos=i}hasResult(){return!1}update(t,e){let i=gd(t),n=this;i?n=n.handleUserEvent(t,i,e):t.docChanged?n=n.handleChange(t):t.selection&&0!=n.state&&(n=new md(n.source,0));for(let e of t.effects)if(e.is(Hu))n=new md(n.source,1,e.value?Bu(t.state):-1);else if(e.is(Ju))n=new md(n.source,0);else if(e.is(wd))for(let t of e.value)t.source==n.source&&(n=t);return n}handleUserEvent(t,e,i){return"delete"!=e&&i.activateOnTyping?new md(this.source,1):this.map(t.changes)}handleChange(t){return t.changes.touchesRange(Bu(t.startState))?new md(this.source,0):this.map(t.changes)}map(t){return t.empty||this.explicitPos<0?this:new md(this.source,this.state,t.mapPos(this.explicitPos))}}class bd extends md{constructor(t,e,i,n,s){super(t,2,e),this.result=i,this.from=n,this.to=s}hasResult(){return!0}handleUserEvent(t,e,i){var n;let s=t.changes.mapPos(this.from),r=t.changes.mapPos(this.to,1),o=Bu(t.state);if((this.explicitPos<0?o<=s:or||"delete"==e&&Bu(t.startState)==this.from)return new md(this.source,"input"==e&&i.activateOnTyping?1:0);let a,l=this.explicitPos<0?-1:t.changes.mapPos(this.explicitPos);return function(t,e,i,n){if(!t)return!1;let s=e.sliceDoc(i,n);return"function"==typeof t?t(s,i,n,e):ju(t,!0).test(s)}(this.result.validFor,t.state,s,r)?new bd(this.source,l,this.result,s,r):this.result.update&&(a=this.result.update(this.result,s,r,new qu(t.state,o,l>=0)))?new bd(this.source,l,a,a.from,null!==(n=a.to)&&void 0!==n?n:Bu(t.state)):new md(this.source,1,l)}handleChange(t){return t.changes.touchesRange(this.from,this.to)?new md(this.source,0):this.map(t.changes)}map(t){return t.empty?this:new bd(this.source,this.explicitPos<0?-1:t.mapPos(this.explicitPos),this.result,t.mapPos(this.from),t.mapPos(this.to,1))}}const wd=ut.define({map:(t,e)=>t.map((t=>t.map(e)))}),vd=ut.define(),yd=q.define({create:()=>dd.start(),update:(t,e)=>t.update(e),provide:t=>[Tr.from(t,(t=>t.tooltip)),Ts.contentAttributes.from(t,(t=>t.attrs))]}),Sd=Ts.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class xd{constructor(t,e,i,n){this.field=t,this.line=e,this.from=i,this.to=n}}class kd{constructor(t,e,i){this.field=t,this.from=e,this.to=i}map(t){let e=t.mapPos(this.from,-1,S.TrackDel),i=t.mapPos(this.to,1,S.TrackDel);return null==e||null==i?null:new kd(this.field,e,i)}}class Qd{constructor(t,e){this.lines=t,this.fieldPositions=e}instantiate(t,e){let i=[],n=[e],s=t.doc.lineAt(e),r=/^\s*/.exec(s.text)[0];for(let s of this.lines){if(i.length){let i=r,o=/^\t*/.exec(s)[0].length;for(let e=0;enew kd(t.field,n[t.line]+t.from,n[t.line]+t.to)));return{text:i,ranges:o}}static parse(t){let e,i=[],n=[],s=[];for(let r of t.split(/\r\n?|\n/)){for(;e=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(r);){let t=e[1]?+e[1]:null,o=e[2]||e[3]||"",a=-1;for(let e=0;e=a&&t.field++}s.push(new xd(a,n.length,e.index,e.index+o.length)),r=r.slice(0,e.index)+o+r.slice(e.index+e[0].length)}for(let t;t=/\\([{}])/.exec(r);){r=r.slice(0,t.index)+t[1]+r.slice(t.index+t[0].length);for(let e of s)e.line==n.length&&e.from>t.index&&(e.from--,e.to--)}n.push(r)}return new Qd(n,s)}}let $d=ni.widget({widget:new class extends ei{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),Pd=ni.mark({class:"cm-snippetField"});class Cd{constructor(t,e){this.ranges=t,this.active=e,this.deco=ni.set(t.map((t=>(t.from==t.to?$d:Pd).range(t.from,t.to))))}map(t){let e=[];for(let i of this.ranges){let n=i.map(t);if(!n)return null;e.push(n)}return new Cd(e,this.active)}selectionInsideField(t){return t.ranges.every((t=>this.ranges.some((e=>e.field==this.active&&e.from<=t.from&&e.to>=t.to))))}}const _d=ut.define({map:(t,e)=>t&&t.map(e)}),Xd=ut.define(),Zd=q.define({create:()=>null,update(t,e){for(let i of e.effects){if(i.is(_d))return i.value;if(i.is(Xd)&&t)return new Cd(t.ranges,i.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>Ts.decorations.from(t,(t=>t?t.deco:ni.none))});function Ad(t,e){return A.create(t.filter((t=>t.field==e)).map((t=>A.range(t.from,t.to))))}function Td(e){let i=Qd.parse(e);return(e,n,s,r)=>{let{text:o,ranges:a}=i.instantiate(e.state,s),l={changes:{from:s,to:r,insert:t.of(o)},scrollIntoView:!0,annotations:n?Nu.of(n):void 0};if(a.length&&(l.selection=Ad(a,0)),a.length>1){let t=new Cd(a,0),i=l.effects=[_d.of(t)];void 0===e.state.field(Zd,!1)&&i.push(ut.appendConfig.of([Zd,Md,Wd,Sd]))}e.dispatch(e.state.update(l))}}function Rd(t){return({state:e,dispatch:i})=>{let n=e.field(Zd,!1);if(!n||t<0&&0==n.active)return!1;let s=n.active+t,r=t>0&&!n.ranges.some((e=>e.field==s+t));return i(e.update({selection:Ad(n.ranges,s),effects:_d.of(r?null:new Cd(n.ranges,s))})),!0}}const Ed=[{key:"Tab",run:Rd(1),shift:Rd(-1)},{key:"Escape",run:({state:t,dispatch:e})=>!!t.field(Zd,!1)&&(e(t.update({effects:_d.of(null)})),!0)}],Vd=E.define({combine:t=>t.length?t[0]:Ed}),Md=N.highest(Ys.compute([Vd],(t=>t.facet(Vd))));function Dd(t,e){return Object.assign(Object.assign({},e),{apply:Td(t)})}const Wd=Ts.domEventHandlers({mousedown(t,e){let i,n=e.state.field(Zd,!1);if(!n||null==(i=e.posAtCoords({x:t.clientX,y:t.clientY})))return!1;let s=n.ranges.find((t=>t.from<=i&&t.to>=i));return!(!s||s.field==n.active)&&(e.dispatch({selection:Ad(n.ranges,s.field),effects:_d.of(n.ranges.some((t=>t.field>s.field))?new Cd(n.ranges,s.field):null)}),!0)}}),Ud=new class extends Qt{};function Yd(t={}){return[yd,td.of(t),od,Ld,Sd]}Ud.startSide=1,Ud.endSide=-1;const qd=[{key:"Ctrl-Space",run:t=>!!t.state.field(yd,!1)&&(t.dispatch({effects:Hu.of(!0)}),!0)},{key:"Escape",run:t=>{let e=t.state.field(yd,!1);return!(!e||!e.active.some((t=>0!=t.state)))&&(t.dispatch({effects:Ju.of(null)}),!0)}},{key:"ArrowDown",run:nd(!0)},{key:"ArrowUp",run:nd(!1)},{key:"PageDown",run:nd(!0,"page")},{key:"PageUp",run:nd(!1,"page")},{key:"Enter",run:sd}],Ld=N.highest(Ys.computeN([td],(t=>t.facet(td).defaultKeymap?[qd]:[]))),zd=(()=>[vr(),Sh(),ir(),$l(_l,{fallback:!0}),Ys.of([...Vc,...Wh])])();class Id{constructor(t,e,i,n,s,r,o,a,l,h=0,c){this.p=t,this.stack=e,this.state=i,this.reducePos=n,this.pos=s,this.score=r,this.buffer=o,this.bufferBase=a,this.curContext=l,this.lookAhead=h,this.parent=c}toString(){return`[${this.stack.filter(((t,e)=>e%3==0)).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,i=0){let n=t.parser.context;return new Id(t,[],e,i,i,0,[],0,n?new Bd(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let i=t>>19,n=65535&t,{parser:s}=this.p,r=s.dynamicPrecedence(n);if(r&&(this.score+=r),0==i)return this.pushState(s.getGoto(this.state,n,!0),this.reducePos),n=2e3&&!(null===(e=this.p.parser.nodeSet.types[n])||void 0===e?void 0:e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=l):this.p.lastBigReductionSizeo;)this.stack.pop();this.reduceContext(n,a)}storeNode(t,e,i,n=4,s=!1){if(0==t&&(!this.stack.length||this.stack[this.stack.length-1]0&&0==t.buffer[n-4]&&t.buffer[n-1]>-1){if(e==i)return;if(t.buffer[n-2]>=e)return void(t.buffer[n-2]=i)}}if(s&&this.pos!=i){let s=this.buffer.length;if(s>0&&0!=this.buffer[s-4])for(;s>0&&this.buffer[s-2]>i;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,n>4&&(n-=4);this.buffer[s]=t,this.buffer[s+1]=e,this.buffer[s+2]=i,this.buffer[s+3]=n}else this.buffer.push(t,e,i,n)}shift(t,e,i){let n=this.pos;if(131072&t)this.pushState(65535&t,this.pos);else if(0==(262144&t)){let s=t,{parser:r}=this.p;(i>this.pos||e<=r.maxNode)&&(this.pos=i,r.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,n),this.shiftContext(e,n),e<=r.maxNode&&this.buffer.push(e,n,i,4)}else this.pos=i,this.shiftContext(e,n),e<=this.p.parser.maxNode&&this.buffer.push(e,n,i,4)}apply(t,e,i){65536&t?this.reduce(t):this.shift(t,e,i)}useNode(t,e){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=t)&&(this.p.reused.push(t),i++);let n=this.pos;this.reducePos=this.pos=n+t.length,this.pushState(e,n),this.buffer.push(i,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let i=t.buffer.slice(e),n=t.bufferBase+e;for(;t&&n==t.bufferBase;)t=t.parent;return new Id(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,n,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let i=t<=this.p.parser.maxNode;i&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,i?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new Nd(this);;){let i=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(0==i)return!1;if(0==(65536&i))return!0;e.reduce(i)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let n,s=0;s1&e&&t==n))||i.push(e[t],n)}e=i}let i=[];for(let t=0;t>19,n=65535&t,s=this.stack.length-3*i;if(s<0||e.getGoto(this.stack[s],n,!1)<0)return!1;this.storeNode(0,this.reducePos,this.reducePos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:t}=this.p;return 65535==t.data[t.stateSlot(this.state,1)]&&!t.stateSlot(this.state,4)}restart(){this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;ethis.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Bd{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}var jd;!function(t){t[t.Insert=200]="Insert",t[t.Delete=190]="Delete",t[t.Reduce=100]="Reduce",t[t.MaxNext=4]="MaxNext",t[t.MaxInsertStackDepth=300]="MaxInsertStackDepth",t[t.DampenInsertStackDepth=120]="DampenInsertStackDepth",t[t.MinBigReduction=2e3]="MinBigReduction"}(jd||(jd={}));class Nd{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=65535&t,i=t>>19;0==i?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(i-1);let n=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=n}}class Gd{constructor(t,e,i){this.stack=t,this.pos=e,this.index=i,this.buffer=t.buffer,0==this.index&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new Gd(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;null!=t&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new Gd(this.stack,this.pos,this.index)}}function Fd(t,e=Uint16Array){if("string"!=typeof t)return t;let i=null;for(let n=0,s=0;n=92&&e--,e>=34&&e--;let s=e-32;if(s>=46&&(s-=46,i=!0),r+=s,i)break;r*=46}i?i[s++]=r:i=new e(r)}return i}class Hd{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Jd=new Hd;class Kd{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Jd,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let i=this.range,n=this.rangeIndex,s=this.pos+t;for(;si.to:s>=i.to;){if(n==this.ranges.length-1)return null;let t=this.ranges[++n];s+=t.from-i.to,i=t}return s}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,e.from);return this.end}peek(t){let e,i,n=this.chunkOff+t;if(n>=0&&n=this.chunk2Pos&&en.to&&(this.chunk2=this.chunk2.slice(0,n.to-e)),i=this.chunk2.charCodeAt(0)}}return e>=this.token.lookAhead&&(this.token.lookAhead=e+1),i}acceptToken(t,e=0){let i=e?this.resolveOffset(e,-1):this.pos;if(null==i||i=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=Jd,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let i="";for(let n of this.ranges){if(n.from>=e)break;n.to>t&&(i+=this.input.read(Math.max(n.from,t),Math.min(n.to,e)))}return i}}class tf{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:i}=e.p;sf(this.data,t,e,this.id,i.data,i.tokenPrecTable)}}tf.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class ef{constructor(t,e,i){this.precTable=e,this.elseToken=i,this.data="string"==typeof t?Fd(t):t}token(t,e){let i=t.pos,n=0;for(;sf(this.data,t,e,0,this.data,this.precTable),!(t.token.value>-1);){if(null==this.elseToken)return;if(t.next<0)break;t.advance(),t.reset(t.pos,t.token),n++}n&&(t.reset(i,t.token),t.acceptToken(this.elseToken,n))}}ef.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class nf{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function sf(t,e,i,n,s,r){let o=0,a=1<0){let i=t[n];if(l.allows(i)&&(-1==e.token.value||e.token.value==i||of(i,e.token.value,s,r))){e.acceptToken(i);break}}let n=e.next,h=0,c=t[o+2];if(!(e.next<0&&c>h&&65535==t[i+3*c-3]&&65535==t[i+3*c-3])){for(;h>1,r=i+s+(s<<1),a=t[r],l=t[r+1]||65536;if(n=l)){o=t[r+2],e.advance();continue t}h=s+1}}break}o=t[i+3*c-1]}}function rf(t,e,i){for(let n,s=e;65535!=(n=t[s]);s++)if(n==i)return s-e;return-1}function of(t,e,i,n){let s=rf(i,n,e);return s<0||rf(i,n,t)e)&&!n.type.isError)return i<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(t.length,Math.max(n.from+1,e+25));if(i<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return i<0?0:t.length}}!function(t){t[t.Margin=25]="Margin"}(hf||(hf={}));let uf=class{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?cf(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?cf(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=r,null;if(s instanceof bo){if(r==t){if(r=Math.max(this.safeFrom,t)&&(this.trees.push(s),this.start.push(r),this.index.push(0))}else this.index[e]++,this.nextStart=r+s.length}}};class df{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map((t=>new Hd))}getActions(t){let e=0,i=null,{parser:n}=t.p,{tokenizers:s}=n,r=n.stateSlot(t.state,3),o=t.curContext?t.curContext.hash:0,a=0;for(let n=0;nh.end+25&&(a=Math.max(h.lookAhead,a)),0!=h.value)){let n=e;if(h.extended>-1&&(e=this.addActions(t,h.extended,h.end,e)),e=this.addActions(t,h.value,h.end,e),!l.extend&&(i=h,e>n))break}}for(;this.actions.length>e;)this.actions.pop();return a&&t.setLookAhead(a),i||t.pos!=this.stream.end||(i=new Hd,i.value=t.p.parser.eofTerm,i.start=i.end=t.pos,e=this.addActions(t,i.value,i.end,e)),this.mainToken=i,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new Hd,{pos:i,p:n}=t;return e.start=i,e.end=Math.min(i+1,n.stream.end),e.value=i==n.stream.end?n.parser.eofTerm:0,e}updateCachedToken(t,e,i){let n=this.stream.clipPos(i.pos);if(e.token(this.stream.reset(n,t),i),t.value>-1){let{parser:e}=i.p;for(let n=0;n=0&&i.p.parser.dialect.allows(s>>1)){0==(1&s)?t.value=s>>1:t.extended=s>>1;break}}}else t.value=0,t.end=this.stream.clipPos(n+1)}putAction(t,e,i,n){for(let e=0;e4*t.bufferLength?new uf(i,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t,e,i=this.stacks,n=this.minStackPos,s=this.stacks=[];if(this.bigReductionCount>300&&1==i.length){let[t]=i;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;rn)s.push(o);else{if(this.advanceStack(o,s,i))continue;{t||(t=[],e=[]),t.push(o);let i=this.tokens.getMainToken(o);e.push(i.value,i.end)}}break}}if(!s.length){let e=t&&function(t){let e=null;for(let i of t){let t=i.p.stoppedAt;(i.pos==i.p.stream.end||null!=t&&i.pos>t)&&i.p.parser.stateFlag(i.state,2)&&(!e||e.scorethis.stoppedAt?t[0]:this.runRecovery(t,e,s);if(i)return this.stackToTree(i.forceAll())}if(this.recovering){let t=1==this.recovering?1:3*this.recovering;if(s.length>t)for(s.sort(((t,e)=>e.score-t.score));s.length>t;)s.pop();s.some((t=>t.reducePos>n))&&this.recovering--}else if(s.length>1){t:for(let t=0;t500&&n.buffer.length>500){if(!((e.score-n.score||e.buffer.length-n.buffer.length)>0)){s.splice(t--,1);continue t}s.splice(i--,1)}}}s.length>12&&s.splice(12,s.length-12)}this.minStackPos=s[0].pos;for(let t=1;t ":"";if(null!=this.stoppedAt&&n>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let e=t.curContext&&t.curContext.tracker.strict,i=e?t.curContext.hash:0;for(let o=this.fragments.nodeAt(n);o;){let n=this.parser.nodeSet.types[o.type.id]==o.type?s.getGoto(t.state,o.type.id):-1;if(n>-1&&o.length&&(!e||(o.prop(ho.contextHash)||0)==i))return t.useNode(o,n),af&&console.log(r+this.stackID(t)+` (via reuse of ${s.getName(o.type.id)})`),!0;if(!(o instanceof bo)||0==o.children.length||o.positions[0]>0)break;let a=o.children[0];if(!(a instanceof bo&&0==o.positions[0]))break;o=a}}let o=s.stateSlot(t.state,4);if(o>0)return t.reduce(o),af&&console.log(r+this.stackID(t)+` (via always-reduce ${s.getName(65535&o)})`),!0;if(t.stack.length>=15e3)for(;t.stack.length>9e3&&t.forceReduce(););let a=this.tokens.getActions(t);for(let o=0;on?e.push(d):i.push(d)}return!1}advanceFully(t,e){let i=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>i)return Of(t,e),!0}}runRecovery(t,e,i){let n=null,s=!1;for(let r=0;r ":"";if(o.deadEnd){if(s)continue;if(s=!0,o.restart(),af&&console.log(h+this.stackID(o)+" (restarted)"),this.advanceFully(o,i))continue}let c=o.split(),u=h;for(let t=0;c.forceReduce()&&t<10;t++){if(af&&console.log(u+this.stackID(c)+" (via force-reduce)"),this.advanceFully(c,i))break;af&&(u=this.stackID(c)+" -> ")}for(let t of o.recoverByInsert(a))af&&console.log(h+this.stackID(t)+" (via recover-insert)"),this.advanceFully(t,i);this.stream.end>o.pos?(l==o.pos&&(l++,a=0),o.recoverByDelete(a,l),af&&console.log(h+this.stackID(o)+` (via recover-delete ${this.parser.getName(a)})`),Of(o,i)):(!n||n.scoret;class bf{constructor(t){this.start=t.start,this.shift=t.shift||mf,this.reduce=t.reduce||mf,this.reuse=t.reuse||mf,this.hash=t.hash||(()=>0),this.strict=!1!==t.strict}}class wf extends Vo{constructor(t){if(super(),this.wrappers=[],14!=t.version)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let i=0;it.topRules[e][1])),n=[];for(let t=0;t=0)s(n,t,e[i++]);else{let r=e[i+-n];for(let o=-n;o>0;o--)s(e[i++],t,r);i++}}}this.nodeSet=new po(e.map(((e,s)=>fo.define({name:s>=this.minRepeatTerm?void 0:e,id:s,props:n[s],top:i.indexOf(s)>-1,error:0==s,skipped:t.skippedNodes&&t.skippedNodes.indexOf(s)>-1})))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=oo;let r=Fd(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let t=0;t"number"==typeof t?new tf(r,t):t)),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,i){let n=new pf(this,t,e,i);for(let s of this.wrappers)n=s(n,t,e,i);return n}getGoto(t,e,i=!1){let n=this.goto;if(e>=n[0])return-1;for(let s=n[e+1];;){let e=n[s++],r=1&e,o=n[s++];if(r&&i)return o;for(let i=s+(e>>1);s0}validAction(t,e){if(e==this.stateSlot(t,4))return!0;for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])return!1;i=vf(this.data,i+2)}if(e==vf(this.data,i+1))return!0}}nextStates(t){let e=[];for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])break;i=vf(this.data,i+2)}if(0==(1&this.data[i+2])){let t=this.data[i+1];e.some(((e,i)=>1&i&&e==t))||e.push(this.data[i],t)}}return e}configure(t){let e=Object.assign(Object.create(wf.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let i=this.topRules[t.top];if(!i)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=i}return t.tokenizers&&(e.tokenizers=this.tokenizers.map((e=>{let i=t.tokenizers.find((t=>t.from==e));return i?i.to:e}))),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map(((i,n)=>{let s=t.specializers.find((t=>t.from==i.external));if(!s)return i;let r=Object.assign(Object.assign({},i),{external:s.to});return e.specializers[n]=yf(r),r}))),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),null!=t.strict&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),null!=t.bufferLength&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return null==e?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),i=e.map((()=>!1));if(t)for(let n of t.split(" ")){let t=e.indexOf(n);t>=0&&(i[t]=!0)}let n=null;for(let t=0;tt.external(i,n)<<1|e}return t.get}const Sf=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],xf=new bf({start:!1,shift:(t,e)=>3==e||4==e||305==e?t:306==e,strict:!1}),kf=new nf(((t,e)=>{let{next:i}=t;(125==i||-1==i||e.context)&&e.canShift(303)&&t.acceptToken(303)}),{contextual:!0,fallback:!0}),Qf=new nf(((t,e)=>{let i,{next:n}=t;Sf.indexOf(n)>-1||(47!=n||47!=(i=t.peek(1))&&42!=i)&&125!=n&&59!=n&&-1!=n&&!e.context&&e.canShift(302)&&t.acceptToken(302)}),{contextual:!0}),$f=new nf(((t,e)=>{let{next:i}=t;if((43==i||45==i)&&(t.advance(),i==t.next)){t.advance();let i=!e.context&&e.canShift(1);t.acceptToken(i?1:2)}}),{contextual:!0}),Pf=ea({"get set async static":Sa.modifier,"for while do if else switch try catch finally return throw break continue default case":Sa.controlKeyword,"in of await yield void typeof delete instanceof":Sa.operatorKeyword,"let var const function class extends":Sa.definitionKeyword,"import export from":Sa.moduleKeyword,"with debugger as new":Sa.keyword,TemplateString:Sa.special(Sa.string),super:Sa.atom,BooleanLiteral:Sa.bool,this:Sa.self,null:Sa.null,Star:Sa.modifier,VariableName:Sa.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":Sa.function(Sa.variableName),VariableDefinition:Sa.definition(Sa.variableName),Label:Sa.labelName,PropertyName:Sa.propertyName,PrivatePropertyName:Sa.special(Sa.propertyName),"CallExpression/MemberExpression/PropertyName":Sa.function(Sa.propertyName),"FunctionDeclaration/VariableDefinition":Sa.function(Sa.definition(Sa.variableName)),"ClassDeclaration/VariableDefinition":Sa.definition(Sa.className),PropertyDefinition:Sa.definition(Sa.propertyName),PrivatePropertyDefinition:Sa.definition(Sa.special(Sa.propertyName)),UpdateOp:Sa.updateOperator,LineComment:Sa.lineComment,BlockComment:Sa.blockComment,Number:Sa.number,String:Sa.string,Escape:Sa.escape,ArithOp:Sa.arithmeticOperator,LogicOp:Sa.logicOperator,BitOp:Sa.bitwiseOperator,CompareOp:Sa.compareOperator,RegExp:Sa.regexp,Equals:Sa.definitionOperator,Arrow:Sa.function(Sa.punctuation),": Spread":Sa.punctuation,"( )":Sa.paren,"[ ]":Sa.squareBracket,"{ }":Sa.brace,"InterpolationStart InterpolationEnd":Sa.special(Sa.brace),".":Sa.derefOperator,", ;":Sa.separator,"@":Sa.meta,TypeName:Sa.typeName,TypeDefinition:Sa.definition(Sa.typeName),"type enum interface implements namespace module declare":Sa.definitionKeyword,"abstract global Privacy readonly override":Sa.modifier,"is keyof unique infer":Sa.operatorKeyword,JSXAttributeValue:Sa.attributeValue,JSXText:Sa.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":Sa.angleBracket,"JSXIdentifier JSXNameSpacedName":Sa.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":Sa.attributeName,"JSXBuiltin/JSXIdentifier":Sa.standard(Sa.tagName)}),Cf={__proto__:null,export:14,as:19,from:27,default:30,async:35,function:36,extends:46,this:50,true:58,false:58,null:70,void:74,typeof:78,super:96,new:130,delete:146,yield:155,await:159,class:164,public:221,private:221,protected:221,readonly:223,instanceof:242,satisfies:245,in:246,const:248,import:280,keyof:335,unique:339,infer:345,is:381,abstract:401,implements:403,type:405,let:408,var:410,interface:417,enum:421,namespace:427,module:429,declare:433,global:437,for:456,of:465,while:468,with:472,do:476,if:480,else:482,switch:486,case:492,try:498,catch:502,finally:506,return:510,throw:514,break:518,continue:522,debugger:526},_f={__proto__:null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2WO'k%^O~O^%^O!a#rO!l2[O#X2WO'k%^O(b'bO~O^%^O'k%^O~P!6UO!V$^Oo$ka~O!S&|i!V&|i~P!6UO!V'vO!S(Xi~O!V'}O!S(fi~O!S(gi!V(gi~P!6UO!V(di!g(di^(di'k(di~P!6UO#X2^O!V(di!g(di^(di'k(di~O!V(ZO!g(ci~O|%vO!X%wO!x]O#b2cO#c2bO't%eO~O|%vO!X%wO#c2bO't%eO~Og2jO!X'QO%a2iO~Og2jO!X'QO%a2iO'}%OO~O#dvaPvaXva^vakva!eva!fva!hva!lva#gva#hva#iva#jva#kva#lva#mva#nva#ova#qva#sva#uva#vva'kva(Rva(bva!gva!Sva'ivaova!Xva%ava!ava~P#L|O#d$laP$laX$la^$lak$laz$la!e$la!f$la!h$la!l$la#g$la#h$la#i$la#j$la#k$la#l$la#m$la#n$la#o$la#q$la#s$la#u$la#v$la'k$la(R$la(b$la!g$la!S$la'i$lao$la!X$la%a$la!a$la~P#MrO#d$naP$naX$na^$nak$naz$na!e$na!f$na!h$na!l$na#g$na#h$na#i$na#j$na#k$na#l$na#m$na#n$na#o$na#q$na#s$na#u$na#v$na'k$na(R$na(b$na!g$na!S$na'i$nao$na!X$na%a$na!a$na~P#NeO#d$|aP$|aX$|a^$|ak$|az$|a!V$|a!e$|a!f$|a!h$|a!l$|a#g$|a#h$|a#i$|a#j$|a#k$|a#l$|a#m$|a#n$|a#o$|a#q$|a#s$|a#u$|a#v$|a'k$|a(R$|a(b$|a!g$|a!S$|a'i$|a#X$|ao$|a!X$|a%a$|a!a$|a~P#)tO^#[q!V#[q'k#[q'i#[q!S#[q!g#[qo#[q!X#[q%a#[q!a#[q~P!6UOd'OX!V'OX~P!'^O!V.YOd([a~O!U2rO!V'PX!g'PX~P%QO!V.]O!g(]a~O!V.]O!g(]a~P!6UO!S2uO~O#y!ja!W!ja~PJ`O#y!ba!V!ba!W!ba~P#@_O#y!na!W!na~P!8oO#y!pa!W!pa~P!;YO!X3XO$UfO$_3YO~O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#e#hS-r(X(YQ-v(ZQ0h+hQ2`-sU2a-t-u-wS5v2b2cR7u5w`#YW#S#V%v't'}+e-mt#cZ|}#d#e#h%Z(X(Y(Z+h-s-t-u-w2b2c5wQ1_,ZQ1r,oQ5e1jQ7m5fT:x&y+fT#]W%vS#[W%vS'u#S'}S'z#V+eS,t&y+fT-h't-mT'O!c%wQ$hfR)j$mT)_$h)`R3Z.kT*O$u*QR*W$xQ/}*zQ2e.OQ4s0wQ5{2iQ7X4vQ7x5zQ8e7WQ8w7wQ9W8gQ9`8yQ9e9XR9h9alpOXr!X#`%]&d&f&g&i,],b1b1eQ&^!TR,Q&ZV%z|},ZR0q+qR,P&XQ%szR+c%tR+X%nT&b!U&eT&c!U&eT1d,b1e",nodeNames:"⚠ ArithOp ArithOp LineComment BlockComment Script ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXStartTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:364,context:xf,nodeProps:[["group",-26,6,14,16,62,199,203,206,207,209,212,215,225,227,233,235,237,239,242,248,254,256,258,260,262,264,265,"Statement",-32,10,11,25,28,29,35,45,48,49,51,56,64,72,76,78,80,81,103,104,113,114,131,134,136,137,138,139,141,142,162,163,165,"Expression",-23,24,26,30,34,36,38,166,168,170,171,173,174,175,177,178,179,181,182,183,193,195,197,198,"Type",-3,84,96,102,"ClassItem"],["openedBy",31,"InterpolationStart",50,"[",54,"{",69,"(",143,"JSXStartTag",155,"JSXStartTag JSXStartCloseTag"],["closedBy",33,"InterpolationEnd",44,"]",55,"}",70,")",144,"JSXSelfCloseEndTag JSXEndTag",160,"JSXEndTag"]],propSources:[Pf],skippedNodes:[0,3,4,268],repeatNodeCount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ules:{Script:[0,5],SingleExpression:[1,266],SingleClassItem:[2,267]},dialects:{jsx:12686,ts:12688},dynamicPrecedences:{76:1,78:1,163:1,191:1},specialized:[{term:312,get:t=>Cf[t]||-1},{term:328,get:t=>_f[t]||-1},{term:67,get:t=>Xf[t]||-1}],tokenPrec:12712}),Af=[Dd("function ${name}(${params}) {\n\t${}\n}",{label:"function",detail:"definition",type:"keyword"}),Dd("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n\t${}\n}",{label:"for",detail:"loop",type:"keyword"}),Dd("for (let ${name} of ${collection}) {\n\t${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Dd("do {\n\t${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),Dd("while (${}) {\n\t${}\n}",{label:"while",detail:"loop",type:"keyword"}),Dd("try {\n\t${}\n} catch (${error}) {\n\t${}\n}",{label:"try",detail:"/ catch block",type:"keyword"}),Dd("if (${}) {\n\t${}\n}",{label:"if",detail:"block",type:"keyword"}),Dd("if (${}) {\n\t${}\n} else {\n\t${}\n}",{label:"if",detail:"/ else block",type:"keyword"}),Dd("class ${name} {\n\tconstructor(${params}) {\n\t\t${}\n\t}\n}",{label:"class",detail:"definition",type:"keyword"}),Dd('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Dd('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Tf=new Ro,Rf=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Ef(t){return(e,i)=>{let n=e.node.getChild("VariableDefinition");return n&&i(n,t),!0}}const Vf=["FunctionDeclaration"],Mf={FunctionDeclaration:Ef("function"),ClassDeclaration:Ef("class"),ClassExpression:()=>!0,EnumDeclaration:Ef("constant"),TypeAliasDeclaration:Ef("type"),NamespaceDeclaration:Ef("namespace"),VariableDefinition(t,e){t.matchContext(Vf)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function Df(t,e){let i=Tf.get(e);if(i)return i;let n=[],s=!0;function r(e,i){let s=t.sliceString(e.from,e.to);n.push({label:s,type:i})}return e.cursor(mo.IncludeAnonymous).iterate((e=>{if(s)s=!1;else if(e.name){let t=Mf[e.name];if(t&&t(e,r)||Rf.has(e.name))return!1}else if(e.to-e.from>8192){for(let i of Df(t,e.node))n.push(i);return!1}})),Tf.set(e,n),n}const Wf=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Uf=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName"];function Yf(t){let e=Xa(t.state).resolveInner(t.pos,-1);if(Uf.indexOf(e.name)>-1)return null;let i="VariableName"==e.name||e.to-e.from<20&&Wf.test(t.state.sliceDoc(e.from,e.to));if(!i&&!t.explicit)return null;let n=[];for(let i=e;i;i=i.parent)Rf.has(i.name)&&(n=n.concat(Df(t.state.doc,i)));return{options:n,from:i?e.from:t.pos,validFor:Wf}}const qf=_a.define({name:"javascript",parser:Zf.configure({props:[Na.add({IfStatement:il({except:/^\s*({|else\b)/}),TryStatement:il({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:t=>t.baseIndent,SwitchBody:t=>{let e=t.textAfter,i=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return t.baseIndent+(i?0:n?1:2)*t.unit},Block:tl({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":il({except:/^{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag":t=>t.column(t.node.from)+t.unit}),rl.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression":ol,BlockComment:t=>({from:t.from+2,to:t.to-2})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Lf={test:t=>/^JSX/.test(t.name),facet:Qa({commentTokens:{block:{open:"{/*",close:"*/}"}}})},zf=qf.configure({dialect:"ts"},"typescript"),If=qf.configure({dialect:"jsx",props:[$a.add((t=>t.isTop?[Lf]:void 0))]}),Bf=qf.configure({dialect:"jsx ts",props:[$a.add((t=>t.isTop?[Lf]:void 0))]},"typescript"),jf="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map((t=>({label:t,type:"keyword"})));function Nf(t={}){let e=t.jsx?t.typescript?Bf:If:t.typescript?zf:qf;return new Ua(e,[qf.data.of({autocomplete:(i=Uf,n=zu(Af.concat(jf)),t=>{for(let e=Xa(t.state).resolveInner(t.pos,-1);e;e=e.parent){if(i.indexOf(e.name)>-1)return null;if(e.type.isTop)break}return n(t)})}),qf.data.of({autocomplete:Yf}),t.jsx?Hf:[]]);var i,n}function Gf(t,e,i=t.length){for(let n=null==e?void 0:e.firstChild;n;n=n.nextSibling)if("JSXIdentifier"==n.name||"JSXBuiltin"==n.name||"JSXNamespacedName"==n.name||"JSXMemberExpression"==n.name)return t.sliceString(n.from,Math.min(n.to,i));return""}const Ff="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),Hf=Ts.inputHandler.of(((t,e,i,n)=>{if((Ff?t.composing:t.compositionStarted)||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!qf.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((t=>{var e,i;let r,{head:o}=t,a=Xa(s).resolveInner(o,-1);if("JSXStartTag"==a.name&&(a=a.parent),">"==n&&"JSXFragmentTag"==a.name)return{range:A.cursor(o+1),changes:{from:o,insert:">"}};if("/"==n&&"JSXFragmentTag"==a.name){let t=a.parent,i=null==t?void 0:t.parent;if(t.from==o-1&&"JSXEndTag"!=(null===(e=i.lastChild)||void 0===e?void 0:e.name)&&(r=Gf(s.doc,null==i?void 0:i.firstChild,o))){let t=`/${r}>`;return{range:A.cursor(o+t.length),changes:{from:o,insert:t}}}}else if(">"==n){let t=function(t){for(;;){if("JSXOpenTag"==t.name||"JSXSelfClosingTag"==t.name||"JSXFragmentTag"==t.name)return t;if(!t.parent)return null;t=t.parent}}(a);if(t&&"JSXEndTag"!=(null===(i=t.lastChild)||void 0===i?void 0:i.name)&&"`}}}return{range:t}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)}));class Jf{constructor(t,e,i,n,s,r,o){this.type=t,this.value=e,this.from=i,this.hash=n,this.end=s,this.children=r,this.positions=o,this.hashProp=[[ho.contextHash,n]]}static create(t,e,i,n,s){return new Jf(t,e,i,n+(n<<8)+t+(e<<4)|0,s,[],[])}addChild(t,e){t.prop(ho.contextHash)!=this.hash&&(t=new bo(t.type,t.children,t.positions,t.length,this.hashProp)),this.children.push(t),this.positions.push(e)}toTree(t,e=this.end){let i=this.children.length-1;return i>=0&&(e=Math.max(e,this.positions[i]+this.children[i].length+this.from)),new bo(t.types[this.type],this.children,this.positions,e-this.from).balance({makeTree:(t,e,i)=>new bo(fo.none,t,e,i,this.hashProp)})}}var Kf;!function(t){t[t.Document=1]="Document",t[t.CodeBlock=2]="CodeBlock",t[t.FencedCode=3]="FencedCode",t[t.Blockquote=4]="Blockquote",t[t.HorizontalRule=5]="HorizontalRule",t[t.BulletList=6]="BulletList",t[t.OrderedList=7]="OrderedList",t[t.ListItem=8]="ListItem",t[t.ATXHeading1=9]="ATXHeading1",t[t.ATXHeading2=10]="ATXHeading2",t[t.ATXHeading3=11]="ATXHeading3",t[t.ATXHeading4=12]="ATXHeading4",t[t.ATXHeading5=13]="ATXHeading5",t[t.ATXHeading6=14]="ATXHeading6",t[t.SetextHeading1=15]="SetextHeading1",t[t.SetextHeading2=16]="SetextHeading2",t[t.HTMLBlock=17]="HTMLBlock",t[t.LinkReference=18]="LinkReference",t[t.Paragraph=19]="Paragraph",t[t.CommentBlock=20]="CommentBlock",t[t.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",t[t.Escape=22]="Escape",t[t.Entity=23]="Entity",t[t.HardBreak=24]="HardBreak",t[t.Emphasis=25]="Emphasis",t[t.StrongEmphasis=26]="StrongEmphasis",t[t.Link=27]="Link",t[t.Image=28]="Image",t[t.InlineCode=29]="InlineCode",t[t.HTMLTag=30]="HTMLTag",t[t.Comment=31]="Comment",t[t.ProcessingInstruction=32]="ProcessingInstruction",t[t.URL=33]="URL",t[t.HeaderMark=34]="HeaderMark",t[t.QuoteMark=35]="QuoteMark",t[t.ListMark=36]="ListMark",t[t.LinkMark=37]="LinkMark",t[t.EmphasisMark=38]="EmphasisMark",t[t.CodeMark=39]="CodeMark",t[t.CodeText=40]="CodeText",t[t.CodeInfo=41]="CodeInfo",t[t.LinkTitle=42]="LinkTitle",t[t.LinkLabel=43]="LinkLabel"}(Kf||(Kf={}));class tp{constructor(t,e){this.start=t,this.content=e,this.marks=[],this.parsers=[]}}class ep{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let t=this.skipSpace(this.basePos);this.indent=this.countIndent(t,this.pos,this.indent),this.pos=t,this.next=t==this.text.length?-1:this.text.charCodeAt(t)}skipSpace(t){return rp(this.text,t)}reset(t){for(this.text=t,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(t){this.basePos=t,this.baseIndent=this.countIndent(t,this.pos,this.indent)}moveBaseColumn(t){this.baseIndent=t,this.basePos=this.findColumn(t)}addMarker(t){this.markers.push(t)}countIndent(t,e=0,i=0){for(let n=e;n=e.stack[i.depth+1].value+i.baseIndent)return!0;if(i.indent>=i.baseIndent+4)return!1;let n=(t.type==Kf.OrderedList?dp:up)(i,e,!1);return n>0&&(t.type!=Kf.BulletList||hp(i,e,!1)<0)&&i.text.charCodeAt(i.pos+n-1)==t.value}const np={[Kf.Blockquote]:(t,e,i)=>62==i.next&&(i.markers.push(Up(Kf.QuoteMark,e.lineStart+i.pos,e.lineStart+i.pos+1)),i.moveBase(i.pos+(sp(i.text.charCodeAt(i.pos+1))?2:1)),t.end=e.lineStart+i.text.length,!0),[Kf.ListItem]:(t,e,i)=>!(i.indent-1)&&(i.moveBaseColumn(i.baseIndent+t.value),!0),[Kf.OrderedList]:ip,[Kf.BulletList]:ip,[Kf.Document]:()=>!0};function sp(t){return 32==t||9==t||10==t||13==t}function rp(t,e=0){for(;ei&&sp(t.charCodeAt(e-1));)e--;return e}function ap(t){if(96!=t.next&&126!=t.next)return-1;let e=t.pos+1;for(;e-1&&t.depth==e.stack.length||n<3?-1:1}function cp(t,e){for(let i=t.stack.length-1;i>=0;i--)if(t.stack[i].type==e)return!0;return!1}function up(t,e,i){return 45!=t.next&&43!=t.next&&42!=t.next||t.pos!=t.text.length-1&&!sp(t.text.charCodeAt(t.pos+1))||!(!i||cp(e,Kf.BulletList)||t.skipSpace(t.pos+2)=48&&s<=57;){if(n++,n==t.text.length)return-1;s=t.text.charCodeAt(n)}return n==t.pos||n>t.pos+9||46!=s&&41!=s||nt.pos+1||49!=t.next)?-1:n+1-t.pos}function fp(t){if(35!=t.next)return-1;let e=t.pos+1;for(;e6?-1:i}function pp(t){if(45!=t.next&&61!=t.next||t.indent>=t.baseIndent+4)return-1;let e=t.pos+1;for(;e/,mp=/\?>/,bp=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*/i.exec(n);if(r)return t.append(Up(Kf.Comment,i,i+1+r[0].length));let o=/^\?[^]*?\?>/.exec(n);if(o)return t.append(Up(Kf.ProcessingInstruction,i,i+1+o[0].length));let a=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(n);return a?t.append(Up(Kf.HTMLTag,i,i+1+a[0].length)):-1},Emphasis(t,e,i){if(95!=e&&42!=e)return-1;let n=i+1;for(;t.char(n)==e;)n++;let s=t.slice(i-1,i),r=t.slice(n,n+1),o=jp.test(s),a=jp.test(r),l=/\s|^$/.test(s),h=/\s|^$/.test(r),c=!h&&(!a||l||o),u=!l&&(!o||h||a),d=c&&(42==e||!u||o),f=u&&(42==e||!c||a);return t.append(new Ip(95==e?Yp:qp,i,n,(d?1:0)|(f?2:0)))},HardBreak(t,e,i){if(92==e&&10==t.char(i+1))return t.append(Up(Kf.HardBreak,i,i+2));if(32==e){let e=i+1;for(;32==t.char(e);)e++;if(10==t.char(e)&&e>=i+2)return t.append(Up(Kf.HardBreak,i,e+1))}return-1},Link:(t,e,i)=>91==e?t.append(new Ip(Lp,i,i+1,1)):-1,Image:(t,e,i)=>33==e&&91==t.char(i+1)?t.append(new Ip(zp,i,i+2,1)):-1,LinkEnd(t,e,i){if(93!=e)return-1;for(let e=t.parts.length-1;e>=0;e--){let n=t.parts[e];if(n instanceof Ip&&(n.type==Lp||n.type==zp)){if(!n.side||t.skipSpace(n.to)==i&&!/[(\[]/.test(t.slice(i+1,i+2)))return t.parts[e]=null,-1;let s=t.takeContent(e),r=t.parts[e]=Gp(t,s,n.type==Lp?Kf.Link:Kf.Image,n.from,i+1);if(n.type==Lp)for(let i=0;ie?Up(Kf.URL,e+i,s+i):s==t.length&&null}}function Hp(t,e,i){let n=t.charCodeAt(e);if(39!=n&&34!=n&&40!=n)return!1;let s=40==n?41:n;for(let n=e+1,r=!1;n=this.end?-1:this.text.charCodeAt(t-this.offset)}get end(){return this.offset+this.text.length}slice(t,e){return this.text.slice(t-this.offset,e-this.offset)}append(t){return this.parts.push(t),t.to}addDelimiter(t,e,i,n,s){return this.append(new Ip(t,e,i,(n?1:0)|(s?2:0)))}addElement(t){return this.append(t)}resolveMarkers(t){for(let e=t;e=t;o--){let t=this.parts[o];if(t instanceof Ip&&1&t.side&&t.type==i.type&&!(s&&(1&i.side||2&t.side)&&(t.to-t.from+r)%3==0&&((t.to-t.from)%3||r%3))){n=t;break}}if(!n)continue;let a=i.type.resolve,l=[],h=n.from,c=i.to;if(s){let t=Math.min(2,n.to-n.from,r);h=n.to-t,c=i.from+t,a=1==t?"Emphasis":"StrongEmphasis"}n.type.mark&&l.push(this.elt(n.type.mark,h,n.to));for(let t=o+1;t=0;e--){let i=this.parts[e];if(i instanceof Ip&&i.type==t)return e}return null}takeContent(t){let e=this.resolveMarkers(t);return this.parts.length=t,e}skipSpace(t){return rp(this.text,t-this.offset)+this.offset}elt(t,e,i,n){return"string"==typeof t?Up(this.parser.getNodeType(t),e,i,n):new Wp(t,e)}}function tO(t,e){if(!e.length)return t;if(!t.length)return e;let i=t.slice(),n=0;for(let t of e){for(;n(t?t-1:0))return!1;if(this.fragmentEnd<0){let t=this.fragment.to;for(;t>0&&"\n"!=this.input.read(t-1,t);)t--;this.fragmentEnd=t?t-1:0}let i=this.cursor;i||(i=this.cursor=this.fragment.tree.cursor(),i.firstChild());let n=t+this.fragment.offset;for(;i.to<=n;)if(!i.parent())return!1;for(;;){if(i.from>=n)return this.fragment.from<=e;if(!i.childAfter(n))return!1}}matches(t){let e=this.cursor.tree;return e&&e.prop(ho.contextHash)==t}takeNodes(t){let e=this.cursor,i=this.fragment.offset,n=this.fragmentEnd-(this.fragment.openEnd?1:0),s=t.absoluteLineStart,r=s,o=t.block.children.length,a=r,l=o;for(;;){if(e.to-i>n){if(e.type.isAnonymous&&e.firstChild())continue;break}if(t.dontInject.add(e.tree),t.addNode(e.tree,e.from-i),e.type.is("Block")&&(eO.indexOf(e.type.id)<0?(r=e.to-i,o=t.block.children.length):(r=a,o=l,a=e.to-i,l=t.block.children.length)),!e.nextSibling())break}for(;t.block.children.length>o;)t.block.children.pop(),t.block.positions.pop();return r-s}}const nO=ea({"Blockquote/...":Sa.quote,HorizontalRule:Sa.contentSeparator,"ATXHeading1/... SetextHeading1/...":Sa.heading1,"ATXHeading2/... SetextHeading2/...":Sa.heading2,"ATXHeading3/...":Sa.heading3,"ATXHeading4/...":Sa.heading4,"ATXHeading5/...":Sa.heading5,"ATXHeading6/...":Sa.heading6,"Comment CommentBlock":Sa.comment,Escape:Sa.escape,Entity:Sa.character,"Emphasis/...":Sa.emphasis,"StrongEmphasis/...":Sa.strong,"Link/... Image/...":Sa.link,"OrderedList/... BulletList/...":Sa.list,"BlockQuote/...":Sa.quote,"InlineCode CodeText":Sa.monospace,URL:Sa.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":Sa.processingInstruction,"CodeInfo LinkLabel":Sa.labelName,LinkTitle:Sa.string,Paragraph:Sa.content}),sO=new Zp(new po(Ep).extend(nO),Object.keys(Sp).map((t=>Sp[t])),Object.keys(Sp).map((t=>$p[t])),Object.keys(Sp),Pp,np,Object.keys(Np).map((t=>Np[t])),Object.keys(Np),[]);function rO(t,e,i){let n=[];for(let s=t.firstChild,r=e;;s=s.nextSibling){let t=s?s.from:i;if(t>r&&n.push({from:r,to:t}),!s)break;r=s.to}return n}const oO={resolve:"Strikethrough",mark:"StrikethroughMark"},aO={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":Sa.strikethrough}},{name:"StrikethroughMark",style:Sa.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,i){if(126!=e||126!=t.char(i+1)||126==t.char(i+2))return-1;let n=t.slice(i-1,i),s=t.slice(i+2,i+3),r=/\s|^$/.test(n),o=/\s|^$/.test(s),a=jp.test(n),l=jp.test(s);return t.addDelimiter(oO,i,i+2,!o&&(!l||r||a),!r&&(!a||o||l))},after:"Emphasis"}]};function lO(t,e,i=0,n,s=0){let r=0,o=!0,a=-1,l=-1,h=!1,c=()=>{n.push(t.elt("TableCell",s+a,s+l,t.parser.parseInline(e.slice(a,l),s+a)))};for(let u=i;u-1)&&r++,o=!1,n&&(a>-1&&c(),n.push(t.elt("TableDelimiter",u+s,u+s+1))),a=l=-1),h=!h&&92==i}return a>-1&&(r++,n&&c()),r}function hO(t,e){for(let i=e;ihO(e.content,0)?new uO:null,endLeaf(t,e,i){if(i.parsers.some((t=>t instanceof uO))||!hO(e.text,e.basePos))return!1;let n=t.scanLine(t.absoluteLineEnd+1).text;return cO.test(n)&&lO(t,e.text,e.basePos)==lO(t,n,e.basePos)},before:"SetextHeading"}]};class fO{nextLine(){return!1}finish(t,e){return t.addLeafElement(e,t.elt("Task",e.start,e.start+e.content.length,[t.elt("TaskMarker",e.start,e.start+3),...t.parser.parseInline(e.content.slice(3),e.start+3)])),!0}}const pO=[dO,{defineNodes:[{name:"Task",block:!0,style:Sa.list},{name:"TaskMarker",style:Sa.atom}],parseBlock:[{name:"TaskList",leaf:(t,e)=>/^\[[ xX]\]/.test(e.content)&&"ListItem"==t.parentType().name?new fO:null,after:"SetextHeading"}]},aO];function OO(t,e,i){return(n,s,r)=>{if(s!=t||n.char(r+1)==t)return-1;let o=[n.elt(i,r,r+1)];for(let s=r+1;s=65&&r<=90||95==r||r>=97&&r<=122||r>=161;)s+=String.fromCharCode(n),n=t.peek(++e);var r;return RO=t,EO=i,TO=s?s.toLowerCase():n==MO||n==DO?void 0:null}const MO=63,DO=33;function WO(t,e){this.name=t,this.parent=e,this.hash=e?e.hash:0;for(let e=0;eUO.indexOf(e)>-1?new WO(VO(n,1)||"",t):t,reduce:(t,e)=>e==wO&&t?t.parent:t,reuse(t,e,i,n){let s=e.type.id;return 6==s||36==s?new WO(VO(n,1)||"",t):t},hash:t=>t?t.hash:0,strict:!1}),qO=new nf(((t,e)=>{if(60!=t.next)return void(t.next<0&&e.context&&t.acceptToken(57));t.advance();let i=47==t.next;i&&t.advance();let n=VO(t,0);if(void 0===n)return;if(!n)return t.acceptToken(i?14:6);let s=e.context?e.context.name:null;if(i){if(n==s)return t.acceptToken(11);if(s&&XO[s])return t.acceptToken(57,-2);if(e.dialectEnabled(0))return t.acceptToken(12);for(let t=e.context;t;t=t.parent)if(t.name==n)return;t.acceptToken(13)}else{if("script"==n)return t.acceptToken(7);if("style"==n)return t.acceptToken(8);if("textarea"==n)return t.acceptToken(9);if(_O.hasOwnProperty(n))return t.acceptToken(10);s&&ZO[s]&&ZO[s][n]?t.acceptToken(57,-1):t.acceptToken(6)}}),{contextual:!0}),LO=new nf((t=>{for(let e=0,i=0;;i++){if(t.next<0){i&&t.acceptToken(58);break}if(45==t.next)e++;else{if(62==t.next&&e>=2){i>3&&t.acceptToken(58,-2);break}e=0}t.advance()}}));const zO=new nf(((t,e)=>{if(47==t.next&&62==t.peek(1)){let i=e.dialectEnabled(1)||function(t){for(;t;t=t.parent)if("svg"==t.name||"math"==t.name)return!0;return!1}(e.context);t.acceptToken(i?5:4,2)}else 62==t.next&&t.acceptToken(4,1)}));function IO(t,e,i){let n=2+t.length;return new nf((s=>{for(let r=0,o=0,a=0;;a++){if(s.next<0){a&&s.acceptToken(e);break}if(0==r&&60==s.next||1==r&&47==s.next||r>=2&&ro?s.acceptToken(e,-o):s.acceptToken(i,-(o-2));break}if((10==s.next||13==s.next)&&a){s.acceptToken(e,1);break}r=o=0}else o++;s.advance()}}))}const BO=IO("script",54,1),jO=IO("style",55,2),NO=IO("textarea",56,3),GO=ea({"Text RawText":Sa.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":Sa.angleBracket,TagName:Sa.tagName,"MismatchedCloseTag/TagName":[Sa.tagName,Sa.invalid],AttributeName:Sa.attributeName,"AttributeValue UnquotedAttributeValue":Sa.attributeValue,Is:Sa.definitionOperator,"EntityReference CharacterReference":Sa.character,Comment:Sa.blockComment,ProcessingInst:Sa.processingInstruction,DoctypeDecl:Sa.documentMeta}),FO=wf.deserialize({version:14,states:",xOVO!rOOO!WQ#tO'#CqO!]Q#tO'#CzO!bQ#tO'#C}O!gQ#tO'#DQO!lQ#tO'#DSO!qOaO'#CpO!|ObO'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fbO~OfcO~OfdO~OfeO~O!WfOPlP!ZlP~O!XiOQoP!ZoP~O!YlORrP!ZrP~OUSOVPOWQOXROYTOZqO[]O][O^^O`^Oa^Ob^Oc^Ox^O!dZO~O!ZrO~P#dO![sO!euO~OfvO~OfwO~OS|OhyO~OS!OOhyO~OS!QOhyO~OS!SOT!TOhyO~OS!TOhyO~O!WfOPlX!ZlX~OP!WO!Z!XO~O!XiOQoX!ZoX~OQ!ZO!Z!XO~O!YlORrX!ZrX~OR!]O!Z!XO~O!Z!XO~P#dOf!_O~O![sO!e!aO~OS!bO~OS!cO~Oi!dOSgXhgXTgX~OS!fOhyO~OS!gOhyO~OS!hOhyO~OS!iOT!jOhyO~OS!jOhyO~Of!kO~Of!lO~Of!mO~OS!nO~Ok!qO!`!oO!b!pO~OS!rO~OS!sO~OS!tO~Oa!uOb!uOc!uO!`!wO!a!uO~Oa!xOb!xOc!xO!b!wO!c!xO~Oa!uOb!uOc!uO!`!{O!a!uO~Oa!xOb!xOc!xO!b!{O!c!xO~OT~bac!dx{!d~",goto:"%p!`PPPPPPPPPPPPPPPPPPPP!a!gP!mPP!yP!|#P#S#Y#]#`#f#i#l#r#x!aP!a!aP$O$U$l$r$x%O%U%[%bPPPPPPPP%hX^OX`pXUOX`pezabcde{}!P!R!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ}bQ!PcQ!RdQ!UeZ!e{}!P!R!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:67,context:YO,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,21,30,33,36,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,29,32,35,37,"OpenTag"],["group",-9,14,17,18,19,20,39,40,41,42,"Entity",16,"Entity TextContent",-3,28,31,34,"TextContent Entity"]],propSources:[GO],skippedNodes:[0],repeatNodeCount:9,tokenData:"#%g!aR!YOX$qXY,QYZ,QZ[$q[]&X]^,Q^p$qpq,Qqr-_rs4ysv-_vw5iwxJ^x}-_}!OKP!O!P-_!P!Q$q!Q![-_![!]!!O!]!^-_!^!_!&W!_!`#$o!`!a&X!a!c-_!c!}!!O!}#R-_#R#S!!O#S#T3V#T#o!!O#o#s-_#s$f$q$f%W-_%W%o!!O%o%p-_%p&a!!O&a&b-_&b1p!!O1p4U-_4U4d!!O4d4e-_4e$IS!!O$IS$I`-_$I`$Ib!!O$Ib$Kh-_$Kh%#t!!O%#t&/x-_&/x&Et!!O&Et&FV-_&FV;'S!!O;'S;:j!&Q;:j;=`4s<%l?&r-_?&r?Ah!!O?Ah?BY$q?BY?Mn!!O?MnO$q!Z$|c`PkW!a`!cpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr$qrs&}sv$qvw+Pwx(tx!^$q!^!_*V!_!a&X!a#S$q#S#T&X#T;'S$q;'S;=`+z<%lO$q!R&bX`P!a`!cpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&Xq'UV`P!cpOv&}wx'kx!^&}!^!_(V!_;'S&};'S;=`(n<%lO&}P'pT`POv'kw!^'k!_;'S'k;'S;=`(P<%lO'kP(SP;=`<%l'kp([S!cpOv(Vx;'S(V;'S;=`(h<%lO(Vp(kP;=`<%l(Vq(qP;=`<%l&}a({W`P!a`Or(trs'ksv(tw!^(t!^!_)e!_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%lO)ea!LsP;=`<%l!Jv!R!L}Y!a`!cpOr!G_rs!HUsv!G_vw!Hpwx!Jvx!`!G_!`!a!Mm!a;'S!G_;'S;=`!N]<%lO!G_!R!MvV!a`!cpxPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!N`P;=`<%l!G_T!NhbhSOq!Hpqr!Ncrs!Hpsw!Ncwx!Hpx!P!Nc!P!Q!Hp!Q!_!Nc!_!a!Hp!a!b# p!b#s!Nc#s$f!Hp$f;'S!Nc;'S;=`#!}<%l?Ah!Nc?Ah?BY!Hp?BY?Mn!Nc?MnO!HpT# ubhSOq!Hpqr!Ncrs!Hpsw!Ncwx!Hpx!P!Nc!P!Q!Hp!Q!_!Nc!_!`!Hp!`!a!If!a#s!Nc#s$f!Hp$f;'S!Nc;'S;=`#!}<%l?Ah!Nc?Ah?BY!Hp?BY?Mn!Nc?MnO!HpT##QP;=`<%l!Nc!V##^chS!a`!cpOq!G_qr!Eyrs!HUsv!Eyvw!Ncwx!Jvx!P!Ey!P!Q!G_!Q!_!Ey!_!`!G_!`!a!Mm!a#s!Ey#s$f!G_$f;'S!Ey;'S;=`#$i<%l?Ah!Ey?Ah?BY!G_?BY?Mn!Ey?MnO!G_!V#$lP;=`<%l!Ey!V#$zXiS`P!a`!cpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X",tokenizers:[BO,jO,NO,zO,qO,LO,0,1,2,3,4,5],topRules:{Document:[0,15]},dialects:{noMatch:0,selfClosing:485},tokenPrec:487});function HO(t,e){let i=Object.create(null);for(let n of t.getChildren(yO)){let t=n.getChild(SO),s=n.getChild(xO)||n.getChild(kO);t&&(i[e.read(t.from,t.to)]=s?s.type.id==xO?e.read(s.from+1,s.to-1):e.read(s.from,s.to):"")}return i}function JO(t,e){let i=t.getChild(vO);return i?e.read(i.from,i.to):" "}function KO(t,e,i){let n;for(let s of i)if(!s.attrs||s.attrs(n||(n=HO(t.node.parent.firstChild,e))))return{parser:s.parser};return null}function tg(t=[],e=[]){let i=[],n=[],s=[],r=[];for(let e of t){("script"==e.tag?i:"style"==e.tag?n:"textarea"==e.tag?s:r).push(e)}let o=e.length?Object.create(null):null;for(let t of e)(o[t.name]||(o[t.name]=[])).push(t);return Do(((t,e)=>{let a=t.type.id;if(a==QO)return KO(t,e,i);if(a==$O)return KO(t,e,n);if(a==PO)return KO(t,e,s);if(a==wO&&r.length){let i,n=t.node,s=n.firstChild,o=s&&JO(s,e);if(o)for(let t of r)if(t.tag==o&&(!t.attrs||t.attrs(i||(i=HO(n,e))))){let e=n.lastChild;return{parser:t.parser,overlay:[{from:s.to,to:e.type.id==CO?e.from:n.to}]}}}if(o&&a==yO){let i,n=t.node;if(i=n.firstChild){let t=o[e.read(i.from,i.to)];if(t)for(let i of t){if(i.tagName&&i.tagName!=JO(n.parent,e))continue;let t=n.lastChild;if(t.type.id==xO){let e=t.from+1,n=t.lastChild,s=t.to-(n&&n.isError?0:1);if(s>e)return{parser:i.parser,overlay:[{from:e,to:s}]}}else if(t.type.id==kO)return{parser:i.parser,overlay:[{from:t.from,to:t.to}]}}}}return null}))}const eg=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288];function ig(t){return t>=65&&t<=90||t>=97&&t<=122||t>=161}const ng=new nf(((t,e)=>{for(let n=!1,s=0,r=0;;r++){let{next:o}=t;if(!(ig(o)||45==o||95==o||n&&(i=o,i>=48&&i<=57))){n&&t.acceptToken(40==o?95:2==s&&e.canShift(2)?2:96);break}!n&&(45!=o||r>0)&&(n=!0),s===r&&45==o&&s++,t.advance()}var i})),sg=new nf((t=>{if(eg.includes(t.peek(-1))){let{next:e}=t;(ig(e)||95==e||35==e||46==e||91==e||58==e||45==e)&&t.acceptToken(94)}})),rg=new nf((t=>{if(!eg.includes(t.peek(-1))){let{next:e}=t;if(37==e&&(t.advance(),t.acceptToken(1)),ig(e)){do{t.advance()}while(ig(t.next));t.acceptToken(1)}}})),og=ea({"AtKeyword import charset namespace keyframes media supports":Sa.definitionKeyword,"from to selector":Sa.keyword,NamespaceName:Sa.namespace,KeyframeName:Sa.labelName,TagName:Sa.tagName,ClassName:Sa.className,PseudoClassName:Sa.constant(Sa.className),IdName:Sa.labelName,"FeatureName PropertyName":Sa.propertyName,AttributeName:Sa.attributeName,NumberLiteral:Sa.number,KeywordQuery:Sa.keyword,UnaryQueryOp:Sa.operatorKeyword,"CallTag ValueName":Sa.atom,VariableName:Sa.variableName,Callee:Sa.operatorKeyword,Unit:Sa.unit,"UniversalSelector NestingSelector":Sa.definitionOperator,MatchOp:Sa.compareOperator,"ChildOp SiblingOp, LogicOp":Sa.logicOperator,BinOp:Sa.arithmeticOperator,Important:Sa.modifier,Comment:Sa.blockComment,ParenthesizedContent:Sa.special(Sa.name),ColorLiteral:Sa.color,StringLiteral:Sa.string,":":Sa.punctuation,"PseudoOp #":Sa.derefOperator,"; ,":Sa.separator,"( )":Sa.paren,"[ ]":Sa.squareBracket,"{ }":Sa.brace}),ag={__proto__:null,lang:32,"nth-child":32,"nth-last-child":32,"nth-of-type":32,"nth-last-of-type":32,dir:32,"host-context":32,url:60,"url-prefix":60,domain:60,regexp:60,selector:134},lg={__proto__:null,"@import":114,"@media":138,"@charset":142,"@namespace":146,"@keyframes":152,"@supports":164},hg={__proto__:null,not:128,only:128,from:158,to:160},cg=wf.deserialize({version:14,states:"7WQYQ[OOO#_Q[OOOOQP'#Cd'#CdOOQP'#Cc'#CcO#fQ[O'#CfO$YQXO'#CaO$aQ[O'#ChO$lQ[O'#DPO$qQ[O'#DTOOQP'#Ed'#EdO$vQdO'#DeO%bQ[O'#DrO$vQdO'#DtO%sQ[O'#DvO&OQ[O'#DyO&TQ[O'#EPO&cQ[O'#EROOQS'#Ec'#EcOOQS'#ET'#ETQYQ[OOO&jQXO'#CdO'_QWO'#DaO'dQWO'#EjO'oQ[O'#EjQOQWOOOOQP'#Cg'#CgOOQP,59Q,59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%lO%^XE`S^PoWOy%^z;'S%^;'S;=`%o<%lO%^_EqS!WVOy%^z;'S%^;'S;=`%o<%lO%^YFSSzQOy%^z;'S%^;'S;=`%o<%lO%^XFeU|POy%^z!`%^!`!aFw!a;'S%^;'S;=`%o<%lO%^XGOS|PoWOy%^z;'S%^;'S;=`%o<%lO%^XG_WOy%^z!c%^!c!}Gw!}#T%^#T#oGw#o;'S%^;'S;=`%o<%lO%^XHO[!YPoWOy%^z}%^}!OGw!O!Q%^!Q![Gw![!c%^!c!}Gw!}#T%^#T#oGw#o;'S%^;'S;=`%o<%lO%^XHySxPOy%^z;'S%^;'S;=`%o<%lO%^^I[SvUOy%^z;'S%^;'S;=`%o<%lO%^XIkUOy%^z#b%^#b#cI}#c;'S%^;'S;=`%o<%lO%^XJSUoWOy%^z#W%^#W#XJf#X;'S%^;'S;=`%o<%lO%^XJmS!`PoWOy%^z;'S%^;'S;=`%o<%lO%^XJ|UOy%^z#f%^#f#gJf#g;'S%^;'S;=`%o<%lO%^XKeS!RPOy%^z;'S%^;'S;=`%o<%lO%^_KvS!QVOy%^z;'S%^;'S;=`%o<%lO%^ZLXU!PPOy%^z!_%^!_!`6y!`;'S%^;'S;=`%o<%lO%^WLnP;=`<%l$}",tokenizers:[sg,rg,ng,0,1,2,3],topRules:{StyleSheet:[0,4],Styles:[1,84]},specialized:[{term:95,get:t=>ag[t]||-1},{term:56,get:t=>lg[t]||-1},{term:96,get:t=>hg[t]||-1}],tokenPrec:1123});let ug=null;function dg(){if(!ug&&"object"==typeof document&&document.body){let{style:t}=document.body,e=[],i=new Set;for(let n in t)"cssText"!=n&&"cssFloat"!=n&&"string"==typeof t[n]&&(/[A-Z]/.test(n)&&(n=n.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))),i.has(n)||(e.push(n),i.add(n)));ug=e.sort().map((t=>({type:"property",label:t})))}return ug||[]}const fg=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map((t=>({type:"class",label:t}))),pg=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map((t=>({type:"keyword",label:t}))).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map((t=>({type:"constant",label:t})))),Og=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map((t=>({type:"type",label:t}))),gg=/^(\w[\w-]*|-\w[\w-]*|)$/,mg=/^-(-[\w-]*)?$/;const bg=new Ro,wg=["Declaration"];function vg(t){for(let e=t;;){if(e.type.isTop)return e;if(!(e=e.parent))return t}}function yg(t,e,i){if(e.to-e.from>4096){let n=bg.get(e);if(n)return n;let s=[],r=new Set,o=e.cursor(mo.IncludeAnonymous);if(o.firstChild())do{for(let e of yg(t,o.node,i))r.has(e.label)||(r.add(e.label),s.push(e))}while(o.nextSibling());return bg.set(e,s),s}{let n=[],s=new Set;return e.cursor().iterate((e=>{var r;if(i(e)&&e.matchContext(wg)&&":"==(null===(r=e.node.nextSibling)||void 0===r?void 0:r.name)){let i=t.sliceString(e.from,e.to);s.has(i)||(s.add(i),n.push({label:i,type:"variable"}))}})),n}}const Sg=t=>e=>{let{state:i,pos:n}=e,s=Xa(i).resolveInner(n,-1),r=s.type.isError&&s.from==s.to-1&&"-"==i.doc.sliceString(s.from,s.to);if("PropertyName"==s.name||(r||"TagName"==s.name)&&/^(Block|Styles)$/.test(s.resolve(s.to).name))return{from:s.from,options:dg(),validFor:gg};if("ValueName"==s.name)return{from:s.from,options:pg,validFor:gg};if("PseudoClassName"==s.name)return{from:s.from,options:fg,validFor:gg};if(t(s)||(e.explicit||r)&&function(t,e){var i;if(("("==t.name||t.type.isError)&&(t=t.parent||t),"ArgList"!=t.name)return!1;let n=null===(i=t.parent)||void 0===i?void 0:i.firstChild;return"Callee"==(null==n?void 0:n.name)&&"var"==e.sliceString(n.from,n.to)}(s,i.doc))return{from:t(s)||r?s.from:n,options:yg(i.doc,vg(s),t),validFor:mg};if("TagName"==s.name){for(let{parent:t}=s;t;t=t.parent)if("Block"==t.name)return{from:s.from,options:dg(),validFor:gg};return{from:s.from,options:Og,validFor:gg}}if(!e.explicit)return null;let o=s.resolve(n),a=o.childBefore(n);return a&&":"==a.name&&"PseudoClassSelector"==o.name?{from:n,options:fg,validFor:gg}:a&&":"==a.name&&"Declaration"==o.name||"ArgList"==o.name?{from:n,options:pg,validFor:gg}:"Block"==o.name||"Styles"==o.name?{from:n,options:dg(),validFor:gg}:null},xg=Sg((t=>"VariableName"==t.name)),kg=_a.define({name:"css",parser:cg.configure({props:[Na.add({Declaration:il()}),rl.add({"Block KeyframeList":ol})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function Qg(){return new Ua(kg,kg.data.of({autocomplete:xg}))}const $g=["_blank","_self","_top","_parent"],Pg=["ascii","utf-8","utf-16","latin1","latin1"],Cg=["get","post","put","delete"],_g=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Xg=["true","false"],Zg={},Ag={a:{attrs:{href:null,ping:null,type:null,media:null,target:$g,hreflang:null}},abbr:Zg,address:Zg,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Zg,aside:Zg,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Zg,base:{attrs:{href:null,target:$g}},bdi:Zg,bdo:Zg,blockquote:{attrs:{cite:null}},body:Zg,br:Zg,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Zg,center:Zg,cite:Zg,code:Zg,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:Zg,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Zg,div:Zg,dl:Zg,dt:Zg,em:Zg,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Zg,figure:Zg,footer:Zg,form:{attrs:{action:null,name:null,"accept-charset":Pg,autocomplete:["on","off"],enctype:_g,method:Cg,novalidate:["novalidate"],target:$g}},h1:Zg,h2:Zg,h3:Zg,h4:Zg,h5:Zg,h6:Zg,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Zg,hgroup:Zg,hr:Zg,html:{attrs:{manifest:null}},i:Zg,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:Zg,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Zg,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:Zg,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Pg,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:Zg,noscript:Zg,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:Zg,param:{attrs:{name:null,value:null}},pre:Zg,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Zg,rt:Zg,ruby:Zg,samp:Zg,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Pg}},section:Zg,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Zg,source:{attrs:{src:null,type:null,media:null}},span:Zg,strong:Zg,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Zg,summary:Zg,sup:Zg,table:Zg,tbody:Zg,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Zg,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:Zg,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Zg,time:{attrs:{datetime:null}},title:Zg,tr:Zg,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Zg,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:Zg},Tg={accesskey:null,class:null,contenteditable:Xg,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Xg,autocorrect:Xg,autocapitalize:Xg,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Xg,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Xg,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Xg,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Xg,"aria-hidden":Xg,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Xg,"aria-multiselectable":Xg,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Xg,"aria-relevant":null,"aria-required":Xg,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},Rg="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map((t=>"on"+t));for(let t of Rg)Tg[t]=null;class Eg{constructor(t,e){this.tags=Object.assign(Object.assign({},Ag),t),this.globalAttrs=Object.assign(Object.assign({},Tg),e),this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}function Vg(t,e,i=t.length){if(!e)return"";let n=e.firstChild,s=n&&n.getChild("TagName");return s?t.sliceString(s.from,Math.min(s.to,i)):""}function Mg(t,e=!1){for(let i=t.parent;i;i=i.parent)if("Element"==i.name){if(!e)return i;e=!1}return null}function Dg(t,e,i){let n=i.tags[Vg(t,Mg(e,!0))];return(null==n?void 0:n.children)||i.allTags}function Wg(t,e){let i=[];for(let n=e;n=Mg(n);){let s=Vg(t,n);if(s&&"CloseTag"==n.lastChild.name)break;s&&i.indexOf(s)<0&&("EndTag"==e.name||e.from>=n.firstChild.to)&&i.push(s)}return i}Eg.default=new Eg;const Ug=/^[:\-\.\w\u00b7-\uffff]*$/;function Yg(t,e,i,n,s){let r=/\s*>/.test(t.sliceDoc(s,s+5))?"":">";return{from:n,to:s,options:Dg(t.doc,i,e).map((t=>({label:t,type:"type"}))).concat(Wg(t.doc,i).map(((t,e)=>({label:"/"+t,apply:"/"+t+r,type:"type",boost:99-e})))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function qg(t,e,i,n){let s=/\s*>/.test(t.sliceDoc(n,n+5))?"":">";return{from:i,to:n,options:Wg(t.doc,e).map(((t,e)=>({label:t,apply:t+s,type:"type",boost:99-e}))),validFor:Ug}}function Lg(t,e){let{state:i,pos:n}=e,s=Xa(i).resolveInner(n),r=s.resolve(n,-1);for(let t,e=n;s==r&&(t=r.childBefore(e));){let i=t.lastChild;if(!i||!i.type.isError||i.from({label:t,type:"property"}))),validFor:Ug}}(i,t,r,"AttributeName"==r.name?r.from:n,n):"Is"==r.name||"AttributeValue"==r.name||"UnquotedAttributeValue"==r.name?function(t,e,i,n,s){var r;let o,a=null===(r=i.parent)||void 0===r?void 0:r.getChild("AttributeName"),l=[];if(a){let r=t.sliceDoc(a.from,a.to),h=e.globalAttrs[r];if(!h){let n=Mg(i),s=n?e.tags[Vg(t.doc,n)]:null;h=(null==s?void 0:s.attrs)&&s.attrs[r]}if(h){let e=t.sliceDoc(n,s).toLowerCase(),i='"',r='"';/^['"]/.test(e)?(o='"'==e[0]?/^[^"]*$/:/^[^']*$/,i="",r=t.sliceDoc(s,s+1)==e[0]?"":e[0],e=e.slice(1),n++):o=/^[^\s<>='"]*$/;for(let t of h)l.push({label:t,apply:i+t+r,type:"constant"})}}return{from:n,to:s,options:l,validFor:o}}(i,t,r,"Is"==r.name?n:r.from,n):!e.explicit||"Element"!=s.name&&"Text"!=s.name&&"Document"!=s.name?null:function(t,e,i,n){let s=[],r=0;for(let n of Dg(t.doc,i,e))s.push({label:"<"+n,type:"type"});for(let e of Wg(t.doc,i))s.push({label:"",type:"type",boost:99-r++});return{from:n,to:n,options:s,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}(i,t,r,n)}function zg(t){let{extraTags:e,extraGlobalAttributes:i}=t,n=i||e?new Eg(e,i):Eg.default;return t=>Lg(n,t)}const Ig=[{tag:"script",attrs:t=>"text/typescript"==t.type||"ts"==t.lang,parser:zf.parser},{tag:"script",attrs:t=>"text/babel"==t.type||"text/jsx"==t.type,parser:If.parser},{tag:"script",attrs:t=>"text/typescript-jsx"==t.type,parser:Bf.parser},{tag:"script",attrs:t=>!t.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(t.type),parser:qf.parser},{tag:"style",attrs:t=>(!t.lang||"css"==t.lang)&&(!t.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(t.type)),parser:kg.parser}],Bg=[{name:"style",parser:kg.parser.configure({top:"Styles"})}].concat(Rg.map((t=>({name:t,parser:qf.parser})))),jg=_a.define({name:"html",parser:FO.configure({props:[Na.add({Element(t){let e=/^(\s*)(<\/)?/.exec(t.textAfter);return t.node.to<=t.pos+e[0].length?t.continue():t.lineIndent(t.node.from)+(e[2]?0:t.unit)},"OpenTag CloseTag SelfClosingTag":t=>t.column(t.node.from)+t.unit,Document(t){if(t.pos+/\s*/.exec(t.textAfter)[0].lengtht.getChild("TagName")})],wrap:tg(Ig,Bg)}),languageData:{commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-._"}});function Ng(t={}){let e,i="";!1===t.matchClosingTags&&(i="noMatch"),!0===t.selfClosingTags&&(i=(i?i+" ":"")+"selfClosing"),(t.nestedLanguages&&t.nestedLanguages.length||t.nestedAttributes&&t.nestedAttributes.length)&&(e=tg((t.nestedLanguages||[]).concat(Ig),(t.nestedAttributes||[]).concat(Bg)));let n=e||i?jg.configure({dialect:i,wrap:e}):jg;return new Ua(n,[jg.data.of({autocomplete:zg(t)}),!1!==t.autoCloseTags?Fg:[],Nf().support,Qg().support])}const Gg=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),Fg=Ts.inputHandler.of(((t,e,i,n)=>{if(t.composing||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!jg.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((e=>{var i,r,o;let a,{head:l}=e,h=Xa(s).resolveInner(l,-1);if("TagName"!=h.name&&"StartTag"!=h.name||(h=h.parent),">"==n&&"OpenTag"==h.name){if("CloseTag"!=(null===(r=null===(i=h.parent)||void 0===i?void 0:i.lastChild)||void 0===r?void 0:r.name)&&(a=Vg(s.doc,h.parent,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`${e?"":">"}`;return{range:A.cursor(l+1),changes:{from:l+(e?1:0),insert:i}}}}else if("/"==n&&"OpenTag"==h.name){let e=h.parent,i=null==e?void 0:e.parent;if(e.from==l-1&&"CloseTag"!=(null===(o=i.lastChild)||void 0===o?void 0:o.name)&&(a=Vg(s.doc,i,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`/${a}${e?"":">"}`,n=l+i.length+(e?1:0);return{range:A.cursor(n),changes:{from:l,insert:i}}}}return{range:e}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)})),Hg=Qa({commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}}}),Jg=new ho,Kg=sO.configure({props:[rl.add((t=>!t.is("Block")||t.is("Document")||null!=tm(t)?void 0:(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to}))),Jg.add(tm),Na.add({Document:()=>null}),ka.add({Document:Hg})]});function tm(t){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(t.name);return e?+e[1]:void 0}function em(t,e){let i=t;for(;;){let t,n=i.nextSibling;if(!n||null!=(t=tm(n.type))&&t<=e)break;i=n}return i.to}const im=sl.of(((t,e,i)=>{for(let n=Xa(t).resolveInner(i,-1);n&&!(n.fromi)return{from:i,to:e}}return null}));function nm(t){return new Pa(Hg,t,[im],"markdown")}const sm=nm(Kg),rm=nm(Kg.configure([pO,mO,gO,bO]));class om{constructor(t,e,i,n,s,r,o){this.node=t,this.from=e,this.to=i,this.spaceBefore=n,this.spaceAfter=s,this.type=r,this.item=o}blank(t,e=!0){let i=this.spaceBefore+("Blockquote"==this.node.name?">":"");if(null!=t){for(;i.length0;t--)i+=" ";return i+(e?this.spaceAfter:"")}marker(t,e){let i="OrderedList"==this.node.name?String(+lm(this.item,t)[2]+e):"";return this.spaceBefore+i+this.type+this.spaceAfter}}function am(t,e){let i=[];for(let e=t;e&&"Document"!=e.name;e=e.parent)"ListItem"!=e.name&&"Blockquote"!=e.name&&"FencedCode"!=e.name||i.push(e);let n=[];for(let t=i.length-1;t>=0;t--){let s,r=i[t],o=e.lineAt(r.from),a=r.from-o.from;if("FencedCode"==r.name)n.push(new om(r,a,a,"","","",null));else if("Blockquote"==r.name&&(s=/^[ \t]*>( ?)/.exec(o.text.slice(a))))n.push(new om(r,a,a+s[0].length,"",s[1],">",null));else if("ListItem"==r.name&&"OrderedList"==r.parent.name&&(s=/^([ \t]*)\d+([.)])([ \t]*)/.exec(o.text.slice(a)))){let t=s[3],e=s[0].length;t.length>=4&&(t=t.slice(0,t.length-4),e-=4),n.push(new om(r.parent,a,a+e,s[1],t,s[2],r))}else if("ListItem"==r.name&&"BulletList"==r.parent.name&&(s=/^([ \t]*)([-+*])([ \t]{1,4}\[[ xX]\])?([ \t]+)/.exec(o.text.slice(a)))){let t=s[4],e=s[0].length;t.length>4&&(t=t.slice(0,t.length-4),e-=4);let i=s[2];s[3]&&(i+=s[3].replace(/[xX]/," ")),n.push(new om(r.parent,a,a+e,s[1],t,i,r))}}return n}function lm(t,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(t.from,t.from+10))}function hm(t,e,i,n=0){for(let s=-1,r=t;;){if("ListItem"==r.name){let t=lm(r,e),o=+t[2];if(s>=0){if(o!=s+1)return;i.push({from:r.from+t[1].length,to:r.from+t[0].length,insert:String(s+2+n)})}s=o}let t=r.nextSibling;if(!t)break;r=t}}function cm(t){return"QuoteMark"==t.name||"ListMark"==t.name}const um=[{key:"Enter",run:({state:t,dispatch:e})=>{let i=Xa(t),{doc:n}=t,s=null,r=t.changeByRange((e=>{if(!e.empty||!rm.isActiveAt(t,e.from))return s={range:e};let r=e.from,o=n.lineAt(r),a=am(i.resolveInner(r,-1),n);for(;a.length&&a[a.length-1].from>r-o.from;)a.pop();if(!a.length)return s={range:e};let l=a[a.length-1];if(l.to-l.spaceAfter.length>r-o.from)return s={range:e};let h=r>=l.to-l.spaceAfter.length&&!/\S/.test(o.text.slice(l.to));if(l.item&&h){if(l.node.firstChild.to>=r||o.from>0&&!/[^\s>]/.test(n.lineAt(o.from-1).text)){let t,e=a.length>1?a[a.length-2]:null,i="";e&&e.item?(t=o.from+e.from,i=e.marker(n,1)):t=o.from+(e?e.to:0);let s=[{from:t,to:r,insert:i}];return"OrderedList"==l.node.name&&hm(l.item,n,s,-2),e&&"OrderedList"==e.node.name&&hm(e.item,n,s),{range:A.cursor(t+i.length),changes:s}}{let e="";for(let t=0,i=a.length-2;t<=i;t++)e+=a[t].blank(t\s*$/.exec(i.text);if(s&&s.index==l.from){let n=t.changes([{from:i.from+s.index,to:i.to},{from:o.from+l.from,to:o.to}]);return{range:e.map(n),changes:n}}}let c=[];"OrderedList"==l.node.name&&hm(l.item,n,c);let u=l.item&&l.item.from]*/.exec(o.text)[0].length>=l.to)for(let t=0,e=a.length-1;t<=e;t++)d+=t!=e||u?a[t].blank(to.from&&/\s/.test(o.text.charAt(f-o.from-1));)f--;return d=t.lineBreak+d,c.push({from:f,to:r,insert:d}),{range:A.cursor(f+d.length),changes:c}}));return!s&&(e(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0)}},{key:"Backspace",run:({state:t,dispatch:e})=>{let i=Xa(t),n=null,s=t.changeByRange((e=>{let s=e.from,{doc:r}=t;if(e.empty&&rm.isActiveAt(t,e.from)){let t=r.lineAt(s),n=am(function(t,e){let i=t.resolveInner(e,-1),n=e;cm(i)&&(n=i.from,i=i.parent);for(let t;t=i.childBefore(n);)if(cm(t))n=t.from;else{if("OrderedList"!=t.name&&"BulletList"!=t.name)break;i=t.lastChild,n=i.to}return i}(i,s),r);if(n.length){let i=n[n.length-1],r=i.to-i.spaceAfter.length+(i.spaceAfter?1:0);if(s-t.from>r&&!/\S/.test(t.text.slice(r,s-t.from)))return{range:A.cursor(t.from+r),changes:{from:t.from+r,to:s}};if(s-t.from==r&&(!i.item||t.from<=i.item.from||!/\S/.test(t.text.slice(0,i.to)))){let n=t.from+i.from;if(i.item&&i.node.fromt.from-e.from||t.startSide-e.startSide)),ni.set(i)}getMatchingBracket(t){switch(t){case")":return"(";case"]":return"[";case"}":return"{";default:return null}}},{decorations:t=>t.decorations});var fm="[a-zA-Z\\$][a-zA-Z0-9\\$]*",pm="(?:\\.\\d+|\\d+\\.\\d*|\\d+)",Om="(?:`(?:`?"+pm+")?)",gm=new RegExp("(?:(?:\\d+)(?:\\^\\^(?:\\.\\w+|\\w+\\.\\w*|\\w+)"+Om+"?(?:\\*\\^[+-]?\\d+)?))"),mm=new RegExp("(?:"+pm+Om+"?(?:\\*\\^[+-]?\\d+)?)"),bm=new RegExp("(?:`?)(?:"+fm+")(?:`(?:"+fm+"))*(?:`?)");let wm=[];const vm=["True","False","All","None","Null","Full","$Failed","$Aborted"];function ym(t,e){var i;return'"'===(i=t.next())?(e.tokenize=Sm,e.tokenize(t,e)):"("===i&&t.eat("*")?(e.commentLevel++,e.tokenize=xm,e.tokenize(t,e)):(t.backUp(1),t.match(gm,!0,!1)||t.match(mm,!0,!1)?"number":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::usage)/,!0,!1)?"meta":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::[a-zA-Z\$][a-zA-Z0-9\$]*):?/,!0,!1)?"string.special":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*\s*:)(?:(?:[a-zA-Z\$][a-zA-Z0-9\$]*)|(?:[^:=>~@\^\&\*\)\[\]'\?,\|])).*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+/,!0,!1)||t.match(/_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)?"variableName.special":t.match(/\\\[[a-zA-Z\$][a-zA-Z0-9\$]*\]/,!0,!1)?"character":t.match(/(?:\[|\]|{|}|\(|\))/,!0,!1)?"bracket":t.match(/(?:#[a-zA-Z\$][a-zA-Z0-9\$]*|#+[0-9]?)/,!0,!1)?"variableName.constant":t.match(bm,!0,!1)?vm.indexOf(t.current())>-1?"number":wm.indexOf(t.current())>-1||0==wm.length?"keyword":t.current()in e.localVars?"atom":(e.localVars[t.current()]=!0,"function"):t.match(/(?:\\|\+|\-|\*|\/|,|;|\.|:|@|~|=|>|<|&|\||_|`|'|\^|\?|!|%)/,!0,!1)?"operator":(t.next(),"error"))}function Sm(t,e){for(var i,n=!1,s=!1;null!=(i=t.next());){if('"'===i&&!s){n=!0;break}s=!s&&"\\"===i}return n&&!s&&(e.tokenize=ym),"string"}function xm(t,e){for(var i,n;e.commentLevel>0&&null!=(n=t.next());)"("===i&&"*"===n&&e.commentLevel++,"*"===i&&")"===n&&e.commentLevel--,i=n;return e.commentLevel<=0&&(e.tokenize=ym),"comment"}const km={name:"mathematica",extendVariables:function(t){},startState:function(){return{tokenize:ym,commentLevel:0,localVars:{}}},token:function(t,e){return t.eatSpace()?null:e.tokenize(t,e)},languageData:{commentTokens:{block:{open:"(*",close:"*)"}}}};let Qm={of:t=>[Gl.define(km),Yd({override:[async e=>function(t,e){let i=t.matchBefore(/\w*/);return i.from!==i.to||t.explicit?{from:i.from,options:e.data}:null}(e,t)]}),Ys.of([{key:"Escape",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((t=>{let{from:e,to:i}=t;return{changes:{from:e,to:i,insert:"EC"},range:A.cursor(e+2)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])],reBuild:t=>{wm=t.map((t=>t.label))}};const $m=(t,e,i,n)=>{if(0==t.length)return;const s=(new Date).valueOf();let r=0;i.dom.loadingMark=!0;const o=i.dom.style.background;let a=0;console.log("Start animation");const l=setInterval((()=>{i.dom.style.setProperty("background","hsl("+a+"deg 100% 97%)","important"),a+=2,a>360&&(a=0)}),30);n.transaction(e,i,s,t.length);for(const a of t)Pm(a,((a,h)=>{n.file(e,i,s,a,h),r++,r>=t.length&&i.dom&&i.dom.loadingMark&&(i.dom.loadingMark=!1,setTimeout((()=>{i.dom.style.background=o,clearInterval(l),console.log("Stop animation")}),2e3))}),(()=>{console.warn("Fauilure");const t=i.dom.style.background;i.dom.style.background="rgb(255 189 189 / 97%)";let e=97;const n=setInterval((()=>{i.dom.style.background="rgb(255 189 189 / "+Math.round(e)+"%)",e*=.95}),30);clearInterval(l),setTimeout((()=>{clearInterval(n),i.dom.style.background=t}),3e3)}))};function Pm(t,e,i){const n=new FileReader;n.addEventListener("load",(n=>{const s=n.target.result;if(s.byteLength/1024/1024>15)return alert("Files > 15Mb are not supported for drag and drop"),void i();let r=base64ArrayBuffer(s);e(t.name,r)})),n.addEventListener("progress",(t=>{if(t.loaded&&t.total){const e=t.loaded/t.total*100;console.log(e)}})),n.readAsArrayBuffer(t)}const Cm=(t,e)=>Ts.domEventHandlers({drop(e,i){e.preventDefault();const n=[];e.dataTransfer.items?[...e.dataTransfer.items].forEach(((t,e)=>{if("file"===t.kind){const i=t.getAsFile();console.log(`… file[${e}].name = ${i.name}`),n.push(i)}})):[...e.dataTransfer.files].forEach(((t,e)=>{console.log(`… file[${e}].name = ${t.name}`),n.push(t)})),$m(n,e,i,t)},paste(t,i){let n=t.clipboardData||window.clipboardData;for(const s of n.items)if("string"===s.kind)switch(s.type){case"text/plain":break;case"image/png":t.preventDefault(),$m([s.getAsFile()],t,i,e)}else t.preventDefault(),$m([s.getAsFile()],t,i,e)}}),_m=new pr({regexp:/\\\[(\w+)\]/g,decoration:t=>ni.replace({widget:new Zm(t[1])})}),Xm=_i.fromClass(class{constructor(t){this.Greekholder=_m.createDeco(t)}update(t){this.Greekholder=_m.updateDeco(t,this.Greekholder)}},{decorations:t=>t.Greekholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Greekholder||ni.none))});class Zm extends ei{constructor(t){super(),this.name=t}eq(t){return this.name===t.name}toDOM(){let t=document.createElement("span");return t.innerHTML="&"+this.name.toLowerCase().replace("sqrt","radic").replace("undirectededge","harr").replace("directededge","rarr").replace(/capital(.*)/,((t,e)=>e.charAt(0).toUpperCase()+e.slice(1))).replace(/curly(.*)/,((t,e)=>e)).replace(/script(.*)/,((t,e)=>"el"+e.toLowerCase())).replace("transpose","#7488").replace("degree","deg")+";",t}ignoreEvent(){return!1}}const Am=new pr({regexp:/(->|<-)/g,decoration:t=>ni.replace({widget:new Tm(t[1])})});_i.fromClass(class{constructor(t){this.Arrowholder=Am.createDeco(t)}update(t){this.Arrowholder=Am.updateDeco(t,this.Arrowholder)}},{decorations:t=>t.Arrowholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Arrowholder||ni.none))});class Tm extends ei{constructor(t){super(),this.dir=t}eq(t){return this.dir===t.dir}toDOM(){let t=document.createElement("span");return"->"===this.dir?t.innerText="→":t.innerText="←",t}ignoreEvent(){return!1}}function Rm(t){if(!(t=t||{}).open)throw new Error('Balanced: please provide a "open" property');if(!t.close)throw new Error('Balanced: please provide a "close" property');if(this.balance=t.balance||!1,this.exceptions=t.exceptions||!1,this.caseInsensitive=t.caseInsensitive,this.head=t.head||t.open,this.head=Array.isArray(this.head)?this.head:[this.head],this.open=Array.isArray(t.open)?t.open:[t.open],this.close=Array.isArray(t.close)?t.close:[t.close],!Array.isArray(this.head)||!Array.isArray(this.open)||!Array.isArray(this.close)||this.head.length!==this.open.length||this.open.length!==this.close.length)throw new Error('Balanced: if you use arrays for a "head,open,close" you must use matching arrays for all options');var e=Dm(this.head.map(this.regExpFromArrayGroupedMap,this)),i=Dm(this.open.map(this.regExpFromArrayGroupedMap,this)),n=Dm(this.close.map(this.regExpFromArrayGroupedMap,this));this.regExp=Dm([e,i,n],"g"+(this.caseInsensitive?"i":"")),this.regExpGroupLength=this.head.length}function Em(t,e,i){for(var n=Mm(e.substr(0,i+1),/^.*\n?$/gim),s=Mm(e,/^.*\n?$/gim),r=n.length-1,o=i+1-(n.length?n[n.length-1].index:0),a="",l=2;l>=0;l--)r-l>=0&&s[r-l]&&(a+=e.substr(s[r-l].index,s[r-l].length)+"\n");for(l=0;l=0&&s[r+l]&&(a+=e.substr(s[r+l].index,s[r+l].length)+"\n");a=a.replace(/\t/g," ").replace(/\n$/,"");var h=new Error(t+" at "+(r+1)+":"+o+"\n\n"+a);return h.line=r+1,h.column=o,h.index=i,h}function Vm(t,e){return t>=e.index&&t<=e.index+e.length-1}function Mm(t,e){var i,n=new RegExp(e),s=[];if(t)for(;i=n.exec(t);)s.push({index:i.index,length:i[0].length,match:i[0]}),i[0].length||n.lastIndex++;return s}function Dm(t,e,i){var n=t.map((function(t){return t instanceof RegExp?t.source:function(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}(t)}),this).join("|");return n=i?"("+n+")":"(?:"+n+")",new RegExp(n,e||void 0)}Rm.prototype={regExpFromArrayGroupedMap:function(t){return Dm([t],null,!0)},matchContentsInBetweenBrackets:function(t,e){for(var i,n=new RegExp(this.regExp),s=[],r=[],o=null,a=!0;i=n.exec(t);){if(e){for(var l=!1,h=0;h{const i=((t,e,i)=>{var n,s=new RegExp(t),r=[];if(e)for(;n=s.exec(e);){if(i){for(var o=!1,a=0;a{new qm({open:"(*"+t+"[*)",close:"(*]"+t+"*)",balance:!1}).matchContentsInBetweenBrackets(e.value,[]).forEach((function(t){const s=e.value.slice(t.index+t.head.length,t.index+t.length-t.tail.length);n(i+t.index,{length:t.length,pos:i+t.index,argsPos:i+t.index+t.head.length,str:s})}))})(e,t,i,s)},o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)r(o,a)}var Im,Bm=function(){function t(t){var e=t.tag,i=t.decoration,n=t.decorate,s=t.boundary,r=t.maxLength,o=void 0===r?1e3:r;if(this.tag=e,n)this.addMatch=function(t,e,i,s){return n(s,i,i+t.length,t,e)};else if("function"==typeof i)this.addMatch=function(t,e,n,s){var r=i(t,e,n);r&&s(n,n+t.length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=function(t,e,n,s){return s(n,n+t.length,i)}}this.boundary=s,this.maxLength=o}return t.prototype.createDeco=function(t){for(var e=this,i=new Xt,n=i.add.bind(i),s=0,r=function(t,e){var i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;for(var n=[],s=0,r=i;s=a?n[n.length-1].to=l:n.push({from:a,to:l})}return n}(t,this.maxLength);st.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e},t.prototype.updateRange=function(t,e,i,n){for(var s=this,r=function(r){var a=Math.max(r.from,i),l=Math.min(r.to,n);if(l>a){var h=t.state.doc.lineAt(a),c=h.toh.from;a--)if(o.boundary.test(h.text[a-1-h.from])){u=a;break}for(;ld},add:f})}},o=this,a=0,l=t.visibleRanges;a{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*FB[*)((_)(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*FB[*)(("+s+")(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let Nm=class{constructor(t,e,i,n,s,r){this.view=e,this.visibleValue=t,this.placeholder=r,console.log(r),this.args=Lm(t.str,/\(\*,\*\)/gm);const o=this;let a,l;console.log("creating InstanceWidget"),a=Im({doc:o.args[0].body.slice(2,-1),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(o.visibleValue.pos),e.dispatch({selection:{anchor:o.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return l.dispatch({selection:{anchor:0}}),l.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){l.focus(),t.editorLastCursor=void 0}}])]}),l=Im({doc:o.args[2].body.slice(1,-2),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:a.state.doc.length}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:o.visibleValue.pos+o.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus(),t.editorLastCursor=void 0}}])]}),o.args[0].length=o.args[0].body.length,o.args[2].length=o.args[2].body.length,delete o.args[2].body,delete o.args[1].body,delete o.args[0].body,this.topEditor=a,this.bottomEditor=l}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="(("+t+")",s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length));const r=e.length-i[0].length;i[0].to=i[0].to+r,i[2].from=i[2].from+r,i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e="("+t+"))",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length));const r=e.length-i[2].length;i[2].to=i[2].to+r,i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t,e){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm),console.log("recreating InstanceWidget"),n=Im.state({doc:e.args[0].body.slice(2,-1),update:t=>e.applyChanges(t,0),eval:()=>{i.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(e.visibleValue.pos),i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus(),t.editorLastCursor=void 0}}])]}),s=Im.state({doc:e.args[2].body.slice(1,-2),update:t=>e.applyChanges(t,2),eval:()=>{e.view.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus(),t.editorLastCursor=void 0}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),console.log(e),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.placeholder=e,this.visibleValue.argsPos=t.argsPos}destroy(){this.topEditor.destroy(),this.bottomEditor.destroy()}},Gm=class extends ei{constructor(t,e,i,n){super(),this.view=i,this.visibleValue=t,this.reference=e,this.placeholder=n}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue,this),!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("fraction");const i=document.createElement("table");i.classList.add("container"),e.appendChild(i);const n=document.createElement("tbody");i.appendChild(n);const s=document.createElement("tr"),r=document.createElement("tr");n.appendChild(s),n.appendChild(r);const o=document.createElement("td");o.classList.add("enumenator"),s.appendChild(o);const a=document.createElement("td");r.appendChild(a);const l=this;return e.EditorWidget=new Nm(this.visibleValue,t,o,a,[],this),this.DOMElement=e,this.reference.push({destroy:()=>{l.destroy(e)}}),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const Fm=(t,e,i)=>new Bm({tag:"FB",decoration:n=>ni.replace({widget:new Gm(n,t,e,i)})}),Hm=t=>_i.fromClass(class{constructor(e){this.disposable=[],this.placeholder=Fm(this.disposable,e,this).createDeco(e),t.placeholder=this}update(t){this.placeholder=Fm(this.disposable,t,this).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var Jm;function Km(t){return Jm=t,[nb,Ys.of([{key:"Ctrl-2",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt[_](*]SqB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt["+s+"](*]SqB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let tb=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;this.sliceRanges=n,this.length=t.str.length,console.log("creating InstanceWidget"),this.editor=Jm({doc:t.str.slice(...n),parent:i,update:t=>r.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]})}applyChanges(t){const e=t,i={from:this.visibleValue.argsPos+5,to:this.visibleValue.argsPos+this.length-1,insert:e};console.log(this.visibleValue);const n=e.length+6-this.length;this.length=this.length+n,this.visibleValue.length=this.visibleValue.length+n,this.visibleValue.str="Sqrt["+e+"]",this.view.dispatch({changes:i})}update(t){if(this.visibleValue.str==t.str)this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos;else{console.warn("Out of sync"),this.visibleValue=t;const e=this.sliceRanges,i=this.editor,n=this,s=this.view;this.length=t.str.length;const r=Jm.state({doc:t.str.slice(...e),update:t=>n.applyChanges(t),eval:()=>{s.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos+n.visibleValue.length}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]});i.setState(r)}}destroy(){console.warn("destroy Instance of Widget!"),this.editor.destroy()}},eb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("sqroot");const i=this,n=document.createElement("span");return n.classList.add("radicand"),e.EditorWidget=new tb(this.visibleValue,t,n,[5,-1],[]),e.appendChild(n),this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const ib=(t,e)=>new Bm({tag:"SqB",decoration:i=>ni.replace({widget:new eb(i,t,e)})}),nb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=ib(this.disposable,t).createDeco(t)}update(t){this.placeholder=ib(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var sb;function rb(t){return sb=t,[hb,Ys.of([{key:"Ctrl--",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SbB[*)Subscript[_(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SbB[*)Subscript["+s+"(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let ob=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),console.log(r.visibleValue),o=sb({doc:r.args[0].body.slice(10),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){a.focus()}}])]}),a=sb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Subscript["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),console.log(e.visibleValue),n=sb.state({doc:e.args[0].body.slice(10),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus()}}])]}),s=sb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},ab=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sub");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new ob(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const lb=(t,e)=>new Bm({tag:"SbB",decoration:i=>ni.replace({widget:new ab(i,t,e)})}),hb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=lb(this.disposable,t).createDeco(t)}update(t){this.placeholder=lb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var cb;function ub(t){return cb=t,[Ob,Ys.of([{key:"Ctrl-6",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SpB[*)Power[_(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SpB[*)Power["+s+"(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let db=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),o=cb({doc:r.args[0].body.slice(6),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus()}}])]}),a=cb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Power["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),n=cb.state({doc:e.args[0].body.slice(6),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.bottomEditor.focus()}}])]}),s=cb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},fb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sup");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new db(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}destroy(t){t.EditorWidget.destroy()}};const pb=(t,e)=>new Bm({tag:"SpB",decoration:i=>ni.replace({widget:new fb(i,t,e)})}),Ob=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=pb(this.disposable,t).createDeco(t)}update(t){this.placeholder=pb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var gb={},mb={},bb={},wb={};function vb(t){let e=t.length;for(;--e>=0;)t[e]=0}const yb=256,Sb=286,xb=30,kb=15,Qb=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),$b=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Pb=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Cb=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_b=new Array(576);vb(_b);const Xb=new Array(60);vb(Xb);const Zb=new Array(512);vb(Zb);const Ab=new Array(256);vb(Ab);const Tb=new Array(29);vb(Tb);const Rb=new Array(xb);function Eb(t,e,i,n,s){this.static_tree=t,this.extra_bits=e,this.extra_base=i,this.elems=n,this.max_length=s,this.has_stree=t&&t.length}let Vb,Mb,Db;function Wb(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}vb(Rb);const Ub=t=>t<256?Zb[t]:Zb[256+(t>>>7)],Yb=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},qb=(t,e,i)=>{t.bi_valid>16-i?(t.bi_buf|=e<>16-t.bi_valid,t.bi_valid+=i-16):(t.bi_buf|=e<{qb(t,i[2*e],i[2*e+1])},zb=(t,e)=>{let i=0;do{i|=1&t,t>>>=1,i<<=1}while(--e>0);return i>>>1},Ib=(t,e,i)=>{const n=new Array(16);let s,r,o=0;for(s=1;s<=kb;s++)o=o+i[s-1]<<1,n[s]=o;for(r=0;r<=e;r++){let e=t[2*r+1];0!==e&&(t[2*r]=zb(n[e]++,e))}},Bb=t=>{let e;for(e=0;e{t.bi_valid>8?Yb(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},Nb=(t,e,i,n)=>{const s=2*e,r=2*i;return t[s]{const n=t.heap[i];let s=i<<1;for(;s<=t.heap_len&&(s{let n,s,r,o,a=0;if(0!==t.sym_next)do{n=255&t.pending_buf[t.sym_buf+a++],n+=(255&t.pending_buf[t.sym_buf+a++])<<8,s=t.pending_buf[t.sym_buf+a++],0===n?Lb(t,s,e):(r=Ab[s],Lb(t,r+yb+1,e),o=Qb[r],0!==o&&(s-=Tb[r],qb(t,s,o)),n--,r=Ub(n),Lb(t,r,i),o=$b[r],0!==o&&(n-=Rb[r],qb(t,n,o)))}while(a{const i=e.dyn_tree,n=e.stat_desc.static_tree,s=e.stat_desc.has_stree,r=e.stat_desc.elems;let o,a,l,h=-1;for(t.heap_len=0,t.heap_max=573,o=0;o>1;o>=1;o--)Gb(t,i,o);l=r;do{o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Gb(t,i,1),a=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=a,i[2*l]=i[2*o]+i[2*a],t.depth[l]=(t.depth[o]>=t.depth[a]?t.depth[o]:t.depth[a])+1,i[2*o+1]=i[2*a+1]=l,t.heap[1]=l++,Gb(t,i,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const i=e.dyn_tree,n=e.max_code,s=e.stat_desc.static_tree,r=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,l=e.stat_desc.max_length;let h,c,u,d,f,p,O=0;for(d=0;d<=kb;d++)t.bl_count[d]=0;for(i[2*t.heap[t.heap_max]+1]=0,h=t.heap_max+1;h<573;h++)c=t.heap[h],d=i[2*i[2*c+1]+1]+1,d>l&&(d=l,O++),i[2*c+1]=d,c>n||(t.bl_count[d]++,f=0,c>=a&&(f=o[c-a]),p=i[2*c],t.opt_len+=p*(d+f),r&&(t.static_len+=p*(s[2*c+1]+f)));if(0!==O){do{for(d=l-1;0===t.bl_count[d];)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[l]--,O-=2}while(O>0);for(d=l;0!==d;d--)for(c=t.bl_count[d];0!==c;)u=t.heap[--h],u>n||(i[2*u+1]!==d&&(t.opt_len+=(d-i[2*u+1])*i[2*u],i[2*u+1]=d),c--)}})(t,e),Ib(i,h,t.bl_count)},Jb=(t,e,i)=>{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),e[2*(i+1)+1]=65535,n=0;n<=i;n++)s=o,o=e[2*(n+1)+1],++a{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),n=0;n<=i;n++)if(s=o,o=e[2*(n+1)+1],!(++a{qb(t,0+(n?1:0),3),jb(t),Yb(t,i),Yb(t,~i),i&&t.pending_buf.set(t.window.subarray(e,e+i),t.pending),t.pending+=i};wb._tr_init=t=>{tw||((()=>{let t,e,i,n,s;const r=new Array(16);for(i=0,n=0;n<28;n++)for(Tb[n]=i,t=0;t<1<>=7;n{let s,r,o=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e{let e;for(Jb(t,t.dyn_ltree,t.l_desc.max_code),Jb(t,t.dyn_dtree,t.d_desc.max_code),Hb(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*Cb[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=i+5,i+4<=s&&-1!==e?ew(t,e,i,n):4===t.strategy||r===s?(qb(t,2+(n?1:0),3),Fb(t,_b,Xb)):(qb(t,4+(n?1:0),3),((t,e,i,n)=>{let s;for(qb(t,e-257,5),qb(t,i-1,5),qb(t,n-4,4),s=0;s(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=i,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(Ab[i]+yb+1)]++,t.dyn_dtree[2*Ub(e)]++),t.sym_next===t.sym_end),wb._tr_align=t=>{qb(t,2,3),Lb(t,256,_b),(t=>{16===t.bi_valid?(Yb(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)};var iw=(t,e,i,n)=>{let s=65535&t|0,r=t>>>16&65535|0,o=0;for(;0!==i;){o=i>2e3?2e3:i,i-=o;do{s=s+e[n++]|0,r=r+s|0}while(--o);s%=65521,r%=65521}return s|r<<16|0};const nw=new Uint32Array((()=>{let t,e=[];for(var i=0;i<256;i++){t=i;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e})());var sw=(t,e,i,n)=>{const s=nw,r=n+i;t^=-1;for(let i=n;i>>8^s[255&(t^e[i])];return-1^t},rw={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},ow={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:aw,_tr_stored_block:lw,_tr_flush_block:hw,_tr_tally:cw,_tr_align:uw}=wb,dw=iw,fw=sw,pw=rw,{Z_NO_FLUSH:Ow,Z_PARTIAL_FLUSH:gw,Z_FULL_FLUSH:mw,Z_FINISH:bw,Z_BLOCK:ww,Z_OK:vw,Z_STREAM_END:yw,Z_STREAM_ERROR:Sw,Z_DATA_ERROR:xw,Z_BUF_ERROR:kw,Z_DEFAULT_COMPRESSION:Qw,Z_FILTERED:$w,Z_HUFFMAN_ONLY:Pw,Z_RLE:Cw,Z_FIXED:_w,Z_DEFAULT_STRATEGY:Xw,Z_UNKNOWN:Zw,Z_DEFLATED:Aw}=ow,Tw=258,Rw=262,Ew=42,Vw=113,Mw=666,Dw=(t,e)=>(t.msg=pw[e],e),Ww=t=>2*t-(t>4?9:0),Uw=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Yw=t=>{let e,i,n,s=t.w_size;e=t.hash_size,n=e;do{i=t.head[--n],t.head[n]=i>=s?i-s:0}while(--e);e=s,n=e;do{i=t.prev[--n],t.prev[n]=i>=s?i-s:0}while(--e)};let qw=(t,e,i)=>(e<{const e=t.state;let i=e.pending;i>t.avail_out&&(i=t.avail_out),0!==i&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+i),t.next_out),t.next_out+=i,e.pending_out+=i,t.total_out+=i,t.avail_out-=i,e.pending-=i,0===e.pending&&(e.pending_out=0))},zw=(t,e)=>{hw(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Lw(t.strm)},Iw=(t,e)=>{t.pending_buf[t.pending++]=e},Bw=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},jw=(t,e,i,n)=>{let s=t.avail_in;return s>n&&(s=n),0===s?0:(t.avail_in-=s,e.set(t.input.subarray(t.next_in,t.next_in+s),i),1===t.state.wrap?t.adler=dw(t.adler,e,s,i):2===t.state.wrap&&(t.adler=fw(t.adler,e,s,i)),t.next_in+=s,t.total_in+=s,s)},Nw=(t,e)=>{let i,n,s=t.max_chain_length,r=t.strstart,o=t.prev_length,a=t.nice_match;const l=t.strstart>t.w_size-Rw?t.strstart-(t.w_size-Rw):0,h=t.window,c=t.w_mask,u=t.prev,d=t.strstart+Tw;let f=h[r+o-1],p=h[r+o];t.prev_length>=t.good_match&&(s>>=2),a>t.lookahead&&(a=t.lookahead);do{if(i=e,h[i+o]===p&&h[i+o-1]===f&&h[i]===h[r]&&h[++i]===h[r+1]){r+=2,i++;do{}while(h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&ro){if(t.match_start=e,o=n,n>=a)break;f=h[r+o-1],p=h[r+o]}}}while((e=u[e&c])>l&&0!=--s);return o<=t.lookahead?o:t.lookahead},Gw=t=>{const e=t.w_size;let i,n,s;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Rw)&&(t.window.set(t.window.subarray(e,e+e-n),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Yw(t),n+=e),0===t.strm.avail_in)break;if(i=jw(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=i,t.lookahead+t.insert>=3)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=qw(t,t.ins_h,t.window[s+1]);t.insert&&(t.ins_h=qw(t,t.ins_h,t.window[s+3-1]),t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead{let i,n,s,r=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,o=0,a=t.strm.avail_in;do{if(i=65535,s=t.bi_valid+42>>3,t.strm.avail_outn+t.strm.avail_in&&(i=n+t.strm.avail_in),i>s&&(i=s),i>8,t.pending_buf[t.pending-2]=~i,t.pending_buf[t.pending-1]=~i>>8,Lw(t.strm),n&&(n>i&&(n=i),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+n),t.strm.next_out),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n,t.block_start+=n,i-=n),i&&(jw(t.strm,t.strm.output,t.strm.next_out,i),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i)}while(0===o);return a-=t.strm.avail_in,a&&(a>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=a&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-a,t.strm.next_in),t.strstart),t.strstart+=a,t.insert+=a>t.w_size-t.insert?t.w_size-t.insert:a),t.block_start=t.strstart),t.high_waters&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,s+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),s>t.strm.avail_in&&(s=t.strm.avail_in),s&&(jw(t.strm,t.window,t.strstart,s),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.high_water>3,s=t.pending_buf_size-s>65535?65535:t.pending_buf_size-s,r=s>t.w_size?t.w_size:s,n=t.strstart-t.block_start,(n>=r||(n||e===bw)&&e!==Ow&&0===t.strm.avail_in&&n<=s)&&(i=n>s?s:n,o=e===bw&&0===t.strm.avail_in&&i===n?1:0,lw(t,t.block_start,i,o),t.block_start+=i,Lw(t.strm)),o?3:1)},Hw=(t,e)=>{let i,n;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==i&&t.strstart-i<=t.w_size-Rw&&(t.match_length=Nw(t,i)),t.match_length>=3)if(n=cw(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=qw(t,t.ins_h,t.window[t.strstart+1]);else n=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2},Jw=(t,e)=>{let i,n,s;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==i&&t.prev_length4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){s=t.strstart+t.lookahead-3,n=cw(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=s&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(zw(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(n=cw(t,0,t.window[t.strstart-1]),n&&zw(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=cw(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2};function Kw(t,e,i,n,s){this.good_length=t,this.max_lazy=e,this.nice_length=i,this.max_chain=n,this.func=s}const tv=[new Kw(0,0,0,0,Fw),new Kw(4,4,8,4,Hw),new Kw(4,5,16,8,Hw),new Kw(4,6,32,32,Hw),new Kw(4,4,16,16,Jw),new Kw(8,16,32,32,Jw),new Kw(8,16,128,128,Jw),new Kw(8,32,128,256,Jw),new Kw(32,128,258,1024,Jw),new Kw(32,258,258,4096,Jw)];function ev(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Aw,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Uw(this.dyn_ltree),Uw(this.dyn_dtree),Uw(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Uw(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Uw(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const iv=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==Ew&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==Vw&&e.status!==Mw?1:0},nv=t=>{if(iv(t))return Dw(t,Sw);t.total_in=t.total_out=0,t.data_type=Zw;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?Ew:Vw,t.adler=2===e.wrap?0:1,e.last_flush=-2,aw(e),vw},sv=t=>{const e=nv(t);var i;return e===vw&&((i=t.state).window_size=2*i.w_size,Uw(i.head),i.max_lazy_match=tv[i.level].max_lazy,i.good_match=tv[i.level].good_length,i.nice_match=tv[i.level].nice_length,i.max_chain_length=tv[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=2,i.match_available=0,i.ins_h=0),e},rv=(t,e,i,n,s,r)=>{if(!t)return Sw;let o=1;if(e===Qw&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),s<1||s>9||i!==Aw||n<8||n>15||e<0||e>9||r<0||r>_w||8===n&&1!==o)return Dw(t,Sw);8===n&&(n=9);const a=new ev;return t.state=a,a.strm=t,a.status=Ew,a.wrap=o,a.gzhead=null,a.w_bits=n,a.w_size=1<rv(t,e,Aw,15,8,Xw),bb.deflateInit2=rv,bb.deflateReset=sv,bb.deflateResetKeep=nv,bb.deflateSetHeader=(t,e)=>iv(t)||2!==t.state.wrap?Sw:(t.state.gzhead=e,vw),bb.deflate=(t,e)=>{if(iv(t)||e>ww||e<0)return t?Dw(t,Sw):Sw;const i=t.state;if(!t.output||0!==t.avail_in&&!t.input||i.status===Mw&&e!==bw)return Dw(t,0===t.avail_out?kw:Sw);const n=i.last_flush;if(i.last_flush=e,0!==i.pending){if(Lw(t),0===t.avail_out)return i.last_flush=-1,vw}else if(0===t.avail_in&&Ww(e)<=Ww(n)&&e!==bw)return Dw(t,kw);if(i.status===Mw&&0!==t.avail_in)return Dw(t,kw);if(i.status===Ew&&0===i.wrap&&(i.status=Vw),i.status===Ew){let e=Aw+(i.w_bits-8<<4)<<8,n=-1;if(n=i.strategy>=Pw||i.level<2?0:i.level<6?1:6===i.level?2:3,e|=n<<6,0!==i.strstart&&(e|=32),e+=31-e%31,Bw(i,e),0!==i.strstart&&(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),t.adler=1,i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(57===i.status)if(t.adler=0,Iw(i,31),Iw(i,139),Iw(i,8),i.gzhead)Iw(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),Iw(i,255&i.gzhead.time),Iw(i,i.gzhead.time>>8&255),Iw(i,i.gzhead.time>>16&255),Iw(i,i.gzhead.time>>24&255),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(Iw(i,255&i.gzhead.extra.length),Iw(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=fw(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if(Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,3),i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw;if(69===i.status){if(i.gzhead.extra){let e=i.pending,n=(65535&i.gzhead.extra.length)-i.gzindex;for(;i.pending+n>i.pending_buf_size;){let s=i.pending_buf_size-i.pending;if(i.pending_buf.set(i.gzhead.extra.subarray(i.gzindex,i.gzindex+s),i.pending),i.pending=i.pending_buf_size,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex+=s,Lw(t),0!==i.pending)return i.last_flush=-1,vw;e=0,n-=s}let s=new Uint8Array(i.gzhead.extra);i.pending_buf.set(s.subarray(i.gzindex,i.gzindex+n),i.pending),i.pending+=n,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex=0}i.status=73}if(73===i.status){if(i.gzhead.name){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),i.gzindex=0}i.status=91}if(91===i.status){if(i.gzhead.comment){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n))}i.status=103}if(103===i.status){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size&&(Lw(t),0!==i.pending))return i.last_flush=-1,vw;Iw(i,255&t.adler),Iw(i,t.adler>>8&255),t.adler=0}if(i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(0!==t.avail_in||0!==i.lookahead||e!==Ow&&i.status!==Mw){let n=0===i.level?Fw(i,e):i.strategy===Pw?((t,e)=>{let i;for(;;){if(0===t.lookahead&&(Gw(t),0===t.lookahead)){if(e===Ow)return 1;break}if(t.match_length=0,i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):i.strategy===Cw?((t,e)=>{let i,n,s,r;const o=t.window;for(;;){if(t.lookahead<=Tw){if(Gw(t),t.lookahead<=Tw&&e===Ow)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(s=t.strstart-1,n=o[s],n===o[++s]&&n===o[++s]&&n===o[++s])){r=t.strstart+Tw;do{}while(n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&st.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(i=cw(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):tv[i.level].func(i,e);if(3!==n&&4!==n||(i.status=Mw),1===n||3===n)return 0===t.avail_out&&(i.last_flush=-1),vw;if(2===n&&(e===gw?uw(i):e!==ww&&(lw(i,0,0,!1),e===mw&&(Uw(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),Lw(t),0===t.avail_out))return i.last_flush=-1,vw}return e!==bw?vw:i.wrap<=0?yw:(2===i.wrap?(Iw(i,255&t.adler),Iw(i,t.adler>>8&255),Iw(i,t.adler>>16&255),Iw(i,t.adler>>24&255),Iw(i,255&t.total_in),Iw(i,t.total_in>>8&255),Iw(i,t.total_in>>16&255),Iw(i,t.total_in>>24&255)):(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),Lw(t),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?vw:yw)},bb.deflateEnd=t=>{if(iv(t))return Sw;const e=t.state.status;return t.state=null,e===Vw?Dw(t,xw):vw},bb.deflateSetDictionary=(t,e)=>{let i=e.length;if(iv(t))return Sw;const n=t.state,s=n.wrap;if(2===s||1===s&&n.status!==Ew||n.lookahead)return Sw;if(1===s&&(t.adler=dw(t.adler,e,i,0)),n.wrap=0,i>=n.w_size){0===s&&(Uw(n.head),n.strstart=0,n.block_start=0,n.insert=0);let t=new Uint8Array(n.w_size);t.set(e.subarray(i-n.w_size,i),0),e=t,i=n.w_size}const r=t.avail_in,o=t.next_in,a=t.input;for(t.avail_in=i,t.next_in=0,t.input=e,Gw(n);n.lookahead>=3;){let t=n.strstart,e=n.lookahead-2;do{n.ins_h=qw(n,n.ins_h,n.window[t+3-1]),n.prev[t&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=t,t++}while(--e);n.strstart=t,n.lookahead=2,Gw(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,t.next_in=o,t.input=a,t.avail_in=r,n.wrap=s,vw},bb.deflateInfo="pako deflate (from Nodeca project)";var ov={};const av=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);ov.assign=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const e in i)av(i,e)&&(t[e]=i[e])}}return t},ov.flattenChunks=t=>{let e=0;for(let i=0,n=t.length;i=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;cv[254]=cv[254]=1,lv.string2buf=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,i,n,s,r,o=t.length,a=0;for(s=0;s>>6,e[r++]=128|63&i):i<65536?(e[r++]=224|i>>>12,e[r++]=128|i>>>6&63,e[r++]=128|63&i):(e[r++]=240|i>>>18,e[r++]=128|i>>>12&63,e[r++]=128|i>>>6&63,e[r++]=128|63&i);return e};lv.buf2string=(t,e)=>{const i=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let n,s;const r=new Array(2*i);for(s=0,n=0;n4)r[s++]=65533,n+=o-1;else{for(e&=2===o?31:3===o?15:7;o>1&&n1?r[s++]=65533:e<65536?r[s++]=e:(e-=65536,r[s++]=55296|e>>10&1023,r[s++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&hv)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let i="";for(let n=0;n{(e=e||t.length)>t.length&&(e=t.length);let i=e-1;for(;i>=0&&128==(192&t[i]);)i--;return i<0||0===i?e:i+cv[t[i]]>e?i:e};var uv=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const dv=bb,fv=ov,pv=lv,Ov=rw,gv=uv,mv=Object.prototype.toString,{Z_NO_FLUSH:bv,Z_SYNC_FLUSH:wv,Z_FULL_FLUSH:vv,Z_FINISH:yv,Z_OK:Sv,Z_STREAM_END:xv,Z_DEFAULT_COMPRESSION:kv,Z_DEFAULT_STRATEGY:Qv,Z_DEFLATED:$v}=ow;function Pv(t){this.options=fv.assign({level:kv,method:$v,chunkSize:16384,windowBits:15,memLevel:8,strategy:Qv},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new gv,this.strm.avail_out=0;let i=dv.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(i!==Sv)throw new Error(Ov[i]);if(e.header&&dv.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?pv.string2buf(e.dictionary):"[object ArrayBuffer]"===mv.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,i=dv.deflateSetDictionary(this.strm,t),i!==Sv)throw new Error(Ov[i]);this._dict_set=!0}}function Cv(t,e){const i=new Pv(e);if(i.push(t,!0),i.err)throw i.msg||Ov[i.err];return i.result}Pv.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize;let s,r;if(this.ended)return!1;for(r=e===~~e?e:!0===e?yv:bv,"string"==typeof t?i.input=pv.string2buf(t):"[object ArrayBuffer]"===mv.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),(r===wv||r===vv)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(s=dv.deflate(i,r),s===xv)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),s=dv.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===Sv;if(0!==i.avail_out){if(r>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},Pv.prototype.onData=function(t){this.chunks.push(t)},Pv.prototype.onEnd=function(t){t===Sv&&(this.result=fv.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},mb.Deflate=Pv,mb.deflate=Cv,mb.deflateRaw=function(t,e){return(e=e||{}).raw=!0,Cv(t,e)},mb.gzip=function(t,e){return(e=e||{}).gzip=!0,Cv(t,e)},mb.constants=ow;var _v={},Xv={};const Zv=16209;const Av=15,Tv=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Rv=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Ev=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Vv=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Mv=(t,e,i,n,s,r,o,a)=>{const l=a.bits;let h,c,u,d,f,p,O=0,g=0,m=0,b=0,w=0,v=0,y=0,S=0,x=0,k=0,Q=null;const $=new Uint16Array(16),P=new Uint16Array(16);let C,_,X,Z=null;for(O=0;O<=Av;O++)$[O]=0;for(g=0;g=1&&0===$[b];b--);if(w>b&&(w=b),0===b)return s[r++]=20971520,s[r++]=20971520,a.bits=1,0;for(m=1;m0&&(0===t||1!==b))return-1;for(P[1]=0,O=1;O852||2===t&&x>592)return 1;for(;;){C=O-y,o[g]+1=p?(_=Z[o[g]-p],X=Q[o[g]-p]):(_=96,X=0),h=1<>y)+c]=C<<24|_<<16|X|0}while(0!==c);for(h=1<>=1;if(0!==h?(k&=h-1,k+=h):k=0,g++,0==--$[O]){if(O===b)break;O=e[i+o[g]]}if(O>w&&(k&d)!==u){for(0===y&&(y=w),f+=m,v=O-y,S=1<852||2===t&&x>592)return 1;u=k&d,s[u]=w<<24|v<<16|f-r|0}}return 0!==k&&(s[f+k]=O-y<<24|64<<16|0),a.bits=w,0};const Dv=iw,Wv=sw,Uv=function(t,e){let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,y,S,x,k,Q;const $=t.state;i=t.next_in,k=t.input,n=i+(t.avail_in-5),s=t.next_out,Q=t.output,r=s-(e-t.avail_out),o=s+(t.avail_out-257),a=$.dmax,l=$.wsize,h=$.whave,c=$.wnext,u=$.window,d=$.hold,f=$.bits,p=$.lencode,O=$.distcode,g=(1<<$.lenbits)-1,m=(1<<$.distbits)-1;t:do{f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,0===w)Q[s++]=65535&b;else{if(!(16&w)){if(0==(64&w)){b=p[(65535&b)+(d&(1<>>=w,f-=w),f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,!(16&w)){if(0==(64&w)){b=O[(65535&b)+(d&(1<a){t.msg="invalid distance too far back",$.mode=Zv;break t}if(d>>>=w,f-=w,w=s-r,y>w){if(w=y-w,w>h&&$.sane){t.msg="invalid distance too far back",$.mode=Zv;break t}if(S=0,x=u,0===c){if(S+=l-w,w2;)Q[s++]=x[S++],Q[s++]=x[S++],Q[s++]=x[S++],v-=3;v&&(Q[s++]=x[S++],v>1&&(Q[s++]=x[S++]))}else{S=s-y;do{Q[s++]=Q[S++],Q[s++]=Q[S++],Q[s++]=Q[S++],v-=3}while(v>2);v&&(Q[s++]=Q[S++],v>1&&(Q[s++]=Q[S++]))}break}}break}}while(i>3,i-=v,f-=v<<3,d&=(1<(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function hy(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const cy=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode16211?1:0},uy=t=>{if(cy(t))return Nv;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Kv,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,Iv},dy=t=>{if(cy(t))return Nv;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,uy(t)},fy=(t,e)=>{let i;if(cy(t))return Nv;const n=t.state;return e<0?(i=0,e=-e):(i=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?Nv:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=i,n.wbits=e,dy(t))},py=(t,e)=>{if(!t)return Nv;const i=new hy;t.state=i,i.strm=t,i.window=null,i.mode=Kv;const n=fy(t,e);return n!==Iv&&(t.state=null),n};let Oy,gy,my=!0;const by=t=>{if(my){Oy=new Int32Array(512),gy=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Yv(1,t.lens,0,288,Oy,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Yv(2,t.lens,0,32,gy,0,t.work,{bits:5}),my=!1}t.lencode=Oy,t.lenbits=9,t.distcode=gy,t.distbits=5},wy=(t,e,i,n)=>{let s;const r=t.state;return null===r.window&&(r.wsize=1<=r.wsize?(r.window.set(e.subarray(i-r.wsize,i),0),r.wnext=0,r.whave=r.wsize):(s=r.wsize-r.wnext,s>n&&(s=n),r.window.set(e.subarray(i-n,i-n+s),r.wnext),(n-=s)?(r.window.set(e.subarray(i-n,i),0),r.wnext=n,r.whave=r.wsize):(r.wnext+=s,r.wnext===r.wsize&&(r.wnext=0),r.whavepy(t,15),Xv.inflateInit2=py,Xv.inflate=(t,e)=>{let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,y,S,x,k=0;const Q=new Uint8Array(4);let $,P;const C=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(cy(t)||!t.output||!t.input&&0!==t.avail_in)return Nv;i=t.state,i.mode===ey&&(i.mode=iy),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,u=a,d=l,x=Iv;t:for(;;)switch(i.mode){case Kv:if(0===i.wrap){i.mode=iy;break}for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0),h=0,c=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",i.mode=ay;break}if((15&h)!==Jv){t.msg="unknown compression method",i.mode=ay;break}if(h>>>=4,c-=4,S=8+(15&h),0===i.wbits&&(i.wbits=S),S>15||S>i.wbits){t.msg="invalid window size",i.mode=ay;break}i.dmax=1<>8&1),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16182;case 16182:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>8&255,Q[2]=h>>>16&255,Q[3]=h>>>24&255,i.check=Wv(i.check,Q,4,0)),h=0,c=0,i.mode=16183;case 16183:for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>8),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16184;case 16184:if(1024&i.flags){for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(f=i.length,f>a&&(f=a),f&&(i.head&&(S=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(n.subarray(r,r+f),S)),512&i.flags&&4&i.wrap&&(i.check=Wv(i.check,n,f,r)),a-=f,r+=f,i.length-=f),i.length))break t;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===a)break t;f=0;do{S=n[r+f++],i.head&&S&&i.length<65536&&(i.head.name+=String.fromCharCode(S))}while(S&&f>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=ey;break;case 16189:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>=7&c,c-=7&c,i.mode=oy;break}for(;c<3;){if(0===a)break t;a--,h+=n[r++]<>>=1,c-=1,3&h){case 0:i.mode=16193;break;case 1:if(by(i),i.mode=sy,e===zv){h>>>=2,c-=2;break t}break;case 2:i.mode=16196;break;case 3:t.msg="invalid block type",i.mode=ay}h>>>=2,c-=2;break;case 16193:for(h>>>=7&c,c-=7&c;c<32;){if(0===a)break t;a--,h+=n[r++]<>>16^65535)){t.msg="invalid stored block lengths",i.mode=ay;break}if(i.length=65535&h,h=0,c=0,i.mode=ny,e===zv)break t;case ny:i.mode=16195;case 16195:if(f=i.length,f){if(f>a&&(f=a),f>l&&(f=l),0===f)break t;s.set(n.subarray(r,r+f),o),a-=f,r+=f,l-=f,o+=f,i.length-=f;break}i.mode=ey;break;case 16196:for(;c<14;){if(0===a)break t;a--,h+=n[r++]<>>=5,c-=5,i.ndist=1+(31&h),h>>>=5,c-=5,i.ncode=4+(15&h),h>>>=4,c-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=ay;break}i.have=0,i.mode=16197;case 16197:for(;i.have>>=3,c-=3}for(;i.have<19;)i.lens[C[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,$={bits:i.lenbits},x=Yv(0,i.lens,0,19,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid code lengths set",i.mode=ay;break}i.have=0,i.mode=16198;case 16198:for(;i.have>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=g,c-=g,i.lens[i.have++]=b;else{if(16===b){for(P=g+2;c>>=g,c-=g,0===i.have){t.msg="invalid bit length repeat",i.mode=ay;break}S=i.lens[i.have-1],f=3+(3&h),h>>>=2,c-=2}else if(17===b){for(P=g+3;c>>=g,c-=g,S=0,f=3+(7&h),h>>>=3,c-=3}else{for(P=g+7;c>>=g,c-=g,S=0,f=11+(127&h),h>>>=7,c-=7}if(i.have+f>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=ay;break}for(;f--;)i.lens[i.have++]=S}}if(i.mode===ay)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=ay;break}if(i.lenbits=9,$={bits:i.lenbits},x=Yv(1,i.lens,0,i.nlen,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid literal/lengths set",i.mode=ay;break}if(i.distbits=6,i.distcode=i.distdyn,$={bits:i.distbits},x=Yv(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,$),i.distbits=$.bits,x){t.msg="invalid distances set",i.mode=ay;break}if(i.mode=sy,e===zv)break t;case sy:i.mode=ry;case ry:if(a>=6&&l>=258){t.next_out=o,t.avail_out=l,t.next_in=r,t.avail_in=a,i.hold=h,i.bits=c,Uv(t,d),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,i.mode===ey&&(i.back=-1);break}for(i.back=0;k=i.lencode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,i.length=b,0===m){i.mode=16205;break}if(32&m){i.back=-1,i.mode=ey;break}if(64&m){t.msg="invalid literal/length code",i.mode=ay;break}i.extra=15&m,i.mode=16201;case 16201:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;k=i.distcode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,64&m){t.msg="invalid distance code",i.mode=ay;break}i.offset=b,i.extra=15&m,i.mode=16203;case 16203:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=ay;break}i.mode=16204;case 16204:if(0===l)break t;if(f=d-l,i.offset>f){if(f=i.offset-f,f>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=ay;break}f>i.wnext?(f-=i.wnext,p=i.wsize-f):p=i.wnext-f,f>i.length&&(f=i.length),O=i.window}else O=s,p=o-i.offset,f=i.length;f>l&&(f=l),l-=f,i.length-=f;do{s[o++]=O[p++]}while(--f);0===i.length&&(i.mode=ry);break;case 16205:if(0===l)break t;s[o++]=i.length,l--,i.mode=ry;break;case oy:if(i.wrap){for(;c<32;){if(0===a)break t;a--,h|=n[r++]<{if(cy(t))return Nv;let e=t.state;return e.window&&(e.window=null),t.state=null,Iv},Xv.inflateGetHeader=(t,e)=>{if(cy(t))return Nv;const i=t.state;return 0==(2&i.wrap)?Nv:(i.head=e,e.done=!1,Iv)},Xv.inflateSetDictionary=(t,e)=>{const i=e.length;let n,s,r;return cy(t)?Nv:(n=t.state,0!==n.wrap&&n.mode!==ty?Nv:n.mode===ty&&(s=1,s=Dv(s,e,i,0),s!==n.check)?Gv:(r=wy(t,e,i,i),r?(n.mode=16210,Fv):(n.havedict=1,Iv)))},Xv.inflateInfo="pako inflate (from Nodeca project)";const vy=Xv,yy=ov,Sy=lv,xy=rw,ky=uv,Qy=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},$y=Object.prototype.toString,{Z_NO_FLUSH:Py,Z_FINISH:Cy,Z_OK:_y,Z_STREAM_END:Xy,Z_NEED_DICT:Zy,Z_STREAM_ERROR:Ay,Z_DATA_ERROR:Ty,Z_MEM_ERROR:Ry}=ow;function Ey(t){this.options=yy.assign({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ky,this.strm.avail_out=0;let i=vy.inflateInit2(this.strm,e.windowBits);if(i!==_y)throw new Error(xy[i]);if(this.header=new Qy,vy.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=Sy.string2buf(e.dictionary):"[object ArrayBuffer]"===$y.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(i=vy.inflateSetDictionary(this.strm,e.dictionary),i!==_y)))throw new Error(xy[i])}function Vy(t,e){const i=new Ey(e);if(i.push(t),i.err)throw i.msg||xy[i.err];return i.result}Ey.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize,s=this.options.dictionary;let r,o,a;if(this.ended)return!1;for(o=e===~~e?e:!0===e?Cy:Py,"[object ArrayBuffer]"===$y.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),r=vy.inflate(i,o),r===Zy&&s&&(r=vy.inflateSetDictionary(i,s),r===_y?r=vy.inflate(i,o):r===Ty&&(r=Zy));i.avail_in>0&&r===Xy&&i.state.wrap>0&&0!==t[i.next_in];)vy.inflateReset(i),r=vy.inflate(i,o);switch(r){case Ay:case Ty:case Zy:case Ry:return this.onEnd(r),this.ended=!0,!1}if(a=i.avail_out,i.next_out&&(0===i.avail_out||r===Xy))if("string"===this.options.to){let t=Sy.utf8border(i.output,i.next_out),e=i.next_out-t,s=Sy.buf2string(i.output,t);i.next_out=e,i.avail_out=n-e,e&&i.output.set(i.output.subarray(t,t+e),0),this.onData(s)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(r!==_y||0!==a){if(r===Xy)return r=vy.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},Ey.prototype.onData=function(t){this.chunks.push(t)},Ey.prototype.onEnd=function(t){t===_y&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=yy.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},_v.Inflate=Ey,_v.inflate=Vy,_v.inflateRaw=function(t,e){return(e=e||{}).raw=!0,Vy(t,e)},_v.ungzip=Vy,_v.constants=ow;const{Deflate:My,deflate:Dy,deflateRaw:Wy,gzip:Uy}=mb,{Inflate:Yy,inflate:qy,inflateRaw:Ly,ungzip:zy}=_v,Iy=ow;gb.Deflate=My,gb.deflate=Dy,gb.deflateRaw=Wy,gb.gzip=Uy,gb.Inflate=Yy,gb.inflate=qy,gb.inflateRaw=Ly,gb.ungzip=zy,gb.constants=Iy;const By=gb;let jy={};var Ny;function Gy(t){return Ny=t,[tS]}jy.Util={},jy.Decode={},jy.Messages=[],jy.Log=function(t){jy.Messages.push(["I",t]),console.log("Mma.js INFO: ",t)},jy.Warn=function(t){jy.Messages.push(["W",t]),console.log("Mma.js WARNING: ",t)},jy.Fail=function(t){throw jy.Messages.push(["E",t]),"Mma.js ERROR: "+t},jy.Util.Base64Decode=function(t){for(var e=atob(t),i=e.length>>>0,n=new Uint8Array(i),s=0;s1&&0===t[0]&&jy.Fail("IntegerAP: input starts with 0: "+String(t)),this.nstring=t}else void 0===t?this.nstring=void 0:jy.Fail("Integer: invalid input: "+String(t))},jy.RealMP=function(t){"number"==typeof t?this.n=t:void 0===t?this.n=void 0:jy.Fail("RealMP: invalid input")},jy.RealAP=function(t){"string"==typeof t?(t.length>1&&0===t[0]&&jy.Fail("RealAP: input starts with 0: "+String(t)),this.nstring=t):void 0===t?this.nstring=void 0:jy.Fail("RealAP: invalid input: "+String(t))},jy.Symbol=function(t){"string"==typeof t?this.name=t:void 0===t?this.name=void 0:jy.Fail("Symbol: invalid input: "+String(t))},jy.String=function(t){"string"==typeof t?this.str=t:void 0===t?this.str=void 0:jy.Fail("String: invalid input: "+String(t))},jy.Expression=function(t,e){t instanceof jy.Symbol||jy.Fail("Expression: head must be an Mma.Symbol"),e instanceof Array||jy.Fail("Expression: parts must be an Array"),this.head=t,this.parts=e},jy.Decode.Int32=function(t,e){try{return new DataView(t.buffer).getInt32(e,!0)}catch(t){return 0}},jy.Decode.Float64=function(t,e){try{return new DataView(t.buffer).getFloat64(e,!0)}catch(t){return 0}},jy.Decode.String=function(t,e,i){return void 0===e&&(e=0),void 0===i&&(i=t.length),jy.Util.U8ArrayToString(t.slice(e,e+i))},jy.Decode.StringEntry=function(t,e){void 0===e&&(e=0);var i=jy.Decode.Int32(t,e);return{length:i,string:jy.Decode.String(t,e+4,i),bytesRead:i+4}},jy.Decode.Any=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=1/0);var n=e;for(var s=0,r=[];ee%2!=0?t:{...t,body:Lm(t.body,/\(\*\|\*\)/gm)})),Array.isArray(this.args[this.args.length-1].body)||(this.decorator=this.args.pop());const r=this.args;console.log("creating InstanceWidget");for(let t=0;t{e.viewState.state.config.eval()},update:e=>this.applyChanges(e,t,i),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to&&!t.stringOnly)return i-2>=0?(o[i-2].editor.dispatch({selection:{anchor:o[i-2].editor.state.doc.length}}),o[i-2].editor.focus(),void(t.editorLastCursor=void 0)):(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0));t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to&&!t.stringOnly)return i+2=0)return r[t-2].body[i].editor.focus(),void(e.editorLastCursor=void 0)}},{key:"ArrowDown",run:function(e,n){if(t+2{},focus:()=>{},dispatch:()=>{},stringOnly:!0};const t=l.match(Fy);if(t){a.innerHTML=t[1];const e=jy.DecompressDecode(t[2]),i=jy.toArray(e.parts[0]),n=uuidv4();interpretate(i,{global:{call:n},element:a})}else a.innerHTML=l.slice(1,-1)}delete o[i].body,n.appendChild(a)}i.appendChild(n)}if(this.decorator){const t=jy.DecompressDecode(this.decorator.body.slice(2,-2)),e=jy.toArray(t.parts[0]);let n={global:{call:uuidv4(),EditorWidget:s},element:i};this.interpretated=interpretate(e,n)}}applyChanges(t,e,i){const n=this.args,s=this.args[e].body,r=this.visibleValue.argsPos,o=this.args[e].from;let a=t;0==i&&0==e&&(a="{{"+a),0==i&&0!=e&&(a="{"+a),i==s.length-1&&e==n.length-1&&(a+="}}"),i==s.length-1&&e!=n.length-1&&(a+="}");const l=s[i].length,h={from:r+o+s[i].from,to:r+o+s[i].from+l,insert:a},c=a.length-l;for(let t=i+1;t{s.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.args[0].body[0].editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.args[0].body[0].editor.focus();else{const t=this.DOMElement.EditorWidget.args,e=t[t.length-1].body[t[t.length-1].body.length-1].editor;e.dispatch({selection:{anchor:e.state.doc.length}}),e.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const Ky=(t,e)=>new Bm({tag:"GB",decoration:i=>ni.replace({widget:new Jy(i,t,e)})}),tS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=Ky(this.disposable,t).createDeco(t)}update(t){this.placeholder=Ky(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});function eS(t){return[rS]}let iS=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.span=i,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this,r=this.args[1].body.slice(3,-3),o=jy.DecompressDecode(r),a=jy.toArray(o.parts[0]);this.data=a;const l="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}));this.cuid=l;let h={call:l,EditorWidget:s},c={global:h,element:i};this.expression=a,this.env=c,this.interpretated=interpretate(a,c),this.interpretated.then((()=>{if(c.options?.Event){console.warn("Event listeners are enabled!"),s.events=c.options.Event;let t=c;if(h.stack){const e=Object.values(h.stack);e.length>0&&(console.log("Attaching first found instance..."),t=e[0].env)}interpretate(["MetaMarker","'"+l+"'"],t).then((()=>{server.kernel.emitt(s.events,'"'+l+'"',"Mounted")}))}}))}getDoc(){return this.args[0].body.slice(1,-1)}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+t+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].length=s.length,this.view.dispatch({changes:r})}applyOuterChanges(t){const e=this.visibleValue,i=t,n={from:e.pos,to:e.pos+e.length,insert:i};this.view.dispatch({changes:n})}update(t){if(!this.deactivated){if(t.str!=this.visibleValue.str){console.warn("Out of sync"),console.log("recreate..."),this.destroy();const e=this.span;return e.replaceChildren(),void this._construct(t,this.view,e)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}}destroy(t){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.events&&server.kernel.emitt(this.events,'"'+this.cuid+'"',"Destroy"),delete this.data}},nS=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=this;let i=document.createElement("span");return i.classList.add("frontend-view"),i.EditorWidget=new iS(this.visibleValue,t,i),this.reference.push({destroy:()=>{e.destroy(i)}}),i}ignoreEvent(){return!0}destroy(t){console.log("destroy in general*"),t.EditorWidget.destroy()}};const sS=(t,e)=>new Bm({tag:"VB",decoration:i=>ni.replace({widget:new nS(i,t,e)})}),rS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=sS(this.disposable,t).createDeco(t)}update(t){this.placeholder=sS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var oS;function aS(t){return oS=t,[uS]}let lS=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.span=i,this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this;this.epilog={offset:0,string:""},this.prolog={offset:0,string:""};const r=this.args[1].body.slice(3,-3),o=jy.DecompressDecode(r),a=jy.toArray(o.parts[0]);this.data=a;let l={global:{call:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)})),element:i,origin:s},element:i};this.env=l,interpretate(a,l).then((()=>{if(l.options?.Head&&(s.prolog.offset=l.options.Head.length+1,s.prolog.string=l.options.Head+"[",s.epilog.offset=1,s.epilog.string="]"),l.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=l.options.Event),l.options?.String){s.prolog.offset=1,s.prolog.string='"',s.epilog.offset=1,s.epilog.string='"',l.options?.HeadString&&(s.prolog.string=l.options.HeadString,s.prolog.offset=s.prolog.string.length),l.options?.TailString&&(s.epilog.string=l.options.TailString,s.epilog.offset=s.epilog.string.length),s.editor={destroy:()=>{console.log("Nothing to destroy, this is just a text field.")}};const t=document.createElement("span");return this.aa,t.onkeydown=function(t){13===t.keyCode&&t.preventDefault()},t.contentEditable="plaintext-only",t.innerText=s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),t.addEventListener("input",console.log),t.addEventListener("input",(()=>{console.log("Update"),console.log(t.innerText),this.applyChanges(t.innerText)})),l.global.element.appendChild(t),void(s.events&&server.kernel.emitt(s.events,"Null","Mounted"))}s.editor=oS({doc:s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),parent:l.global.element,update:t=>this.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos+s.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]}),s.events&&server.kernel.emitt(s.events,"Null","Mounted")}))}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+this.prolog.string+t+this.epilog.string+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length));const o=s.length-i[0].length;i[0].length=s.length,this.visibleValue.length=this.visibleValue.length+o,this.view.dispatch({changes:r})}update(t){if(this.visibleValue.str!=t.str)return console.warn("Out of sync"),console.log("recreating InstanceWidget"),this.destroy(),this.span.replaceChildren(),void this._construct(t,this.view,this.span);this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.editor.destroy(),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}},hS=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("subscript-tail"),e.EditorWidget=new lS(this.visibleValue,t,e,[]);const i=this;return this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const cS=(t,e)=>new Bm({tag:"BB",decoration:i=>ni.replace({widget:new hS(i,t,e)})}),uS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=cS(this.disposable,t).createDeco(t)}update(t){this.placeholder=cS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var dS;function fS(t){return dS=t,[mS]}class pS{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm);const s=this,r=Array.from({length:Math.ceil((s.args.length-3)/2)},((t,e)=>2*e+1));s.indexes=r;const o=[];this.span=i,this.spans=o;for(let t=0;t{c.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=c.options.Event),s.editors=r.map(((t,i)=>dS({doc:s.args[t].body,parent:o[i],update:e=>this.applyChanges(e,t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i>0?s.editors[i-1].focus():(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus()),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return it.destroy())),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}}class OS extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("inline-flex"),e.EditorWidget=new pS(this.visibleValue,t,e,[]);const i=this;return this.DOMElement=e,this.reference.push({destroy:()=>{i.destroy(e)}}),e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;const n=this.DOMElement.EditorWidget.editors;return t.from-e.from<0?(n[n.length-1].dispatch({selection:{anchor:n[n.length-1].state.doc.length}}),n[n.length-1].focus()):(n[0].dispatch({selection:{anchor:0}}),n[0].focus()),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}}const gS=(t,e)=>new Bm({tag:"TB",decoration:i=>ni.replace({widget:new OS(i,t,e)})}),mS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=gS(this.disposable,t).createDeco(t)}update(t){this.placeholder=gS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});const bS=_i.fromClass(class{decorations=ni.none;constructor(t){this.view=t,this.recompute()}recompute(t){let e,i,n=[];for(let{from:t,to:e}of this.view.visibleRanges)this.getDecorationsFor(t,e,n);this.decorations=ni.set(n,!0),this.decorations=this.decorations.update({filter:(n,s)=>!(n>e&&s=e&&s.selection.main.head<=i)return!0;if(!n&&s.selection.main.head>e&&s.selection.main.headt.decorations});class wS extends ei{constructor(t,e){super(),this.rawValue=t,this.visibleValue=e}eq(t){return this.rawValue===t.rawValue}toDOM(){let t=document.createElement("div");t.classList.add("cell-type-widget");const e=this.rawValue.split(" "),i=e[0].split(".");if(console.log(i),t.classList.add("cell-type-"+i[1].trim()),t.innerText=e[0].trim(),e.length>1){const n=e.slice(1),s=document.createElement("span");return s.appendChild(t),n.forEach((t=>{const e=document.createElement("span");e.innerText=t,e.classList.add("cell-type-"+i[1].trim()+"-"+t.split("=")[0]),s.appendChild(e)})),s}return t}ignoreEvent(){return!1}}const vS=new F,yS=new F,SS=[],xS=Sl.define([{tag:Sa.meta,color:"var(--editor-key-meta)"},{tag:Sa.link,textDecoration:"underline"},{tag:Sa.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Sa.emphasis,fontStyle:"italic"},{tag:Sa.strong,fontWeight:"bold"},{tag:Sa.strikethrough,textDecoration:"line-through"},{tag:Sa.keyword,color:"var(--editor-key-keyword)"},{tag:[Sa.atom,Sa.bool,Sa.url,Sa.contentSeparator,Sa.labelName],color:"var(--editor-key-atom)"},{tag:[Sa.literal,Sa.inserted],color:"var(--editor-key-literal)"},{tag:[Sa.string,Sa.deleted],color:"var(--editor-key-string)"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],color:"var(--editor-key-escape)"},{tag:Sa.definition(Sa.variableName),color:"var(--editor-key-variable)"},{tag:Sa.local(Sa.variableName),color:"var(--editor-local-variable)"},{tag:[Sa.typeName,Sa.namespace],color:"var(--editor-key-type)"},{tag:Sa.className,color:"var(--editor-key-class)"},{tag:[Sa.special(Sa.variableName),Sa.macroName],color:"var(--editor-special-variable)"},{tag:Sa.definition(Sa.propertyName),color:"var(--editor-key-property)"},{tag:Sa.comment,color:"var(--editor-key-comment)"},{tag:Sa.invalid,color:"var(--editor-key-invalid)"}]),kS={data:[],extend:t=>{kS.data.push(...t),Qm.reBuild(kS.data)},replaceAll:t=>{kS.data=t,Qm.reBuild(kS.data)}},QS=Gl.define({name:"spreadsheet",startState:function(){return{stringType:null,stack:[]}},token:function(t,e){if(t){switch(0===e.stack.length&&('"'!=t.peek()&&"'"!=t.peek()||(e.stringType=t.peek(),t.next(),e.stack.unshift("string"))),e.stack[0]){case"string":for(;"string"===e.stack[0]&&!t.eol();)t.peek()===e.stringType?(t.next(),e.stack.shift()):"\\"===t.peek()?(t.next(),t.next()):t.match(/^.[^\\\"\']*/);return"string";case"characterClass":for(;"characterClass"===e.stack[0]&&!t.eol();)t.match(/^[^\]\\]+/)||t.match(/^\\./)||e.stack.shift();return"operator"}var i=t.peek();switch(i){case"[":return t.next(),e.stack.unshift("characterClass"),"bracket";case":":return t.next(),"operator";case"\\":return t.match(/\\[a-z]+/)?"string.special":(t.next(),"atom");case".":case",":case";":case"*":case"-":case"+":case"^":case"<":case"/":case"=":return t.next(),"atom";case"$":return t.next(),"builtin"}return t.match(/\d+/)?t.match(/^\w+/)?"error":"number":t.match(/^[a-zA-Z_]\w*/)?t.match(/(?=[\(.])/,!1)?"keyword":"variable":-1!=["[","]","(",")","{","}"].indexOf(i)?(t.next(),"bracket"):(t.eatSpace()||t.next(),null)}}}),$S=new RegExp(/^[\w]*\.[\w]+/);function PS(t){const e=$S.exec(t),i=Object.values(window.SupportedLanguages);for(let t=0;t{if(!t.docChanged)return null;let e=PS(t.newDoc.line(1).text);if(e.legacy){const i=t.startState.facet(Wa);if(i){if(i.name==e.name)return null}else if(t.startState.facet(CS)==e.name)return null;return console.log("switching... to "+e.name),{effects:vS.reconfigure(e.plugins)}}return e.name===t.startState.facet(Wa).name?null:(console.log("switching... to "+e.name),{effects:vS.reconfigure(e.plugins)})}));let XS,ZS=null;const AS=t=>{const e=t||XS;return e&&e.viewState?(console.log(),PS(e.state.doc.line(1).text).name):""},TS=t=>{const e=t||XS;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return!1;const n=i[0];return[n.from,n.to]},RS=t=>{const e=t||XS;return e&&e.viewState?e.state.doc.toString():""},ES=t=>{const e=t||XS;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return"";const n=i[0];return console.log("yoko"),console.log(n),console.log(e.state.doc.toString().slice(n.from,n.to)),console.log("processing"),e.state.doc.toString().slice(n.from,n.to)},VS=(t,e)=>{const i=e||XS;if(!i)return;if(!i.viewState)return;const n=i.viewState.state.selection.ranges;if(!n.length)return;const s=n[0];console.log("result"),console.log(t),i.dispatch({changes:{...s,insert:t}})},MS=()=>XS,DS=(t,e)=>{const i=e||XS;i&&i.viewState&&(console.log("result"),console.log(t),i.dispatch({changes:{from:0,to:i.viewState.state.doc.length,insert:t}}))};ZS=t=>{let e=new Ts({doc:t.doc,extensions:[Ys.of([{key:"Tab",run:function(t,e){return sd(t)}},{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,LS,Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(XS=e.view)}))],parent:t.parent});return e.viewState.state.config.eval=t.eval,e},ZS.state=t=>{let e=xt.create({doc:t.doc,extensions:[Ys.of([{key:"Tab",run:function(t,e){return sd(t)}},{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,LS,Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(XS=e.view)}))]});return e.config.eval=t.eval,e};const WS={transaction:(t,e,i,n)=>{if(console.log(e.dom.ocellref),e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:DropEvent"]')}},file:(t,e,i,n,s)=>{console.log(e.dom.ocellref),e.dom.ocellref&&server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},US={transaction:(t,e,i,n)=>{if(console.log(e.dom.ocellref),e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:PasteEvent"]')}},file:(t,e,i,n,s)=>{console.log(e.dom.ocellref),e.dom.ocellref&&server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},YS=[Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Cm(WS,US)];let qS=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"}}),LS=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"},".cm-scroller":{"line-height":"inherit","overflow-x":"overlay","overflow-y":"overlay","align-items":"initial"},".cm-content":{padding:"0px 0"},".rainbow-bracket-red":{color:"var(--editor-bracket-1)"},".rainbow-bracket-orange":{color:"var(--editor-bracket-2)"},".rainbow-bracket-yellow":{color:"var(--editor-bracket-3)"},".rainbow-bracket-green":{color:"var(--editor-bracket-4)"},".rainbow-bracket-blue":{color:"var(--editor-bracket-5)"},".rainbow-bracket-indigo":{color:"var(--editor-bracket-6)"},".rainbow-bracket-violet":{color:"var(--editor-bracket-7)"},".rainbow-bracket-red > span":{color:"var(--editor-bracket-1-a)"},".rainbow-bracket-orange > span":{color:"var(--editor-bracket-2-a)"},".rainbow-bracket-yellow > span":{color:"var(--editor-bracket-3-a)"},".rainbow-bracket-green > span":{color:"var(--editor-bracket-4-a)"},".rainbow-bracket-blue > span":{color:"var(--editor-bracket-5-a)"},".rainbow-bracket-indigo > span":{color:"var(--editor-bracket-6-a)"},".rainbow-bracket-violet > span":{color:"var(--editor-bracket-7-a)"}}),zS=!1;const IS=[()=>vr(),()=>Sh(),()=>ir(),()=>dr(),()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xS,{fallback:!1}),()=>tu()],BS={},jS=[()=>vr(),()=>Sh(),()=>ir(),()=>dr(),t=>NS.of(t),()=>BS.gutter?function(t={}){return[eo.of(t),jr(),so]}():[],()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xS,{fallback:!1}),()=>tu(),()=>bS,()=>function(t){return _i.fromClass(class{constructor(e){this.view=e,this.placeholder=ni.set([ni.widget({widget:new kr(t),side:1}).range(0)])}get decorations(){return this.view.state.doc.length?ni.none:this.placeholder}},{decorations:t=>t.decorations})}("Type WL Expression / .md / .js"),()=>xt.allowMultipleSelections.of(!0),(t,e)=>vS.of(e),()=>yS.of(xt.readOnly.of(!1)),()=>_S,()=>{return t?[ou.of(t),Yu]:Yu;var t},(t,e)=>Ys.of([{key:"Tab",run:function(t,e){const i=sd(t);return i||Rc(t)},shift:Ec},{key:"Backspace",run:function(e,i){if(0===e.state.doc.length)return t.origin.remove(),!0}},{key:"ArrowLeft",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus prev"),t.origin.focusPrev(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus next"),t.origin.focusNext(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"Shift-Enter",preventDefault:!0,run:function(e,i){console.log(e.state.doc.toString()),t.origin.eval(e.state.doc.toString())}},...Vc,...Wh,...Ru]),(t,e)=>Ts.updateListener.of((e=>{e.docChanged&&t.origin.save(encodeURIComponent(e.state.doc.toString())),e.selectionSet&&(XS=e.view)})),()=>qS];const NS=E.define();function GS(t){return t.replace(/\\\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\\\:/g,""),16))})).replaceAll("\\:F74E","I").replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))}function FS(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(t=>(+t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+t/4).toString(16)))}core.ReadOnly=()=>"ReadOnly",core.EditorView=async(t,e)=>{let i=await interpretate(t[0],e);i=GS(i),console.log("UNICODE Disaster");const n=await core._getRules(t,e);let s=()=>{},r=()=>{},o=i;const a=[];n.ReadOnly&&a.push(xt.readOnly.of(!0)),n.ForceUpdate&&(e.local.forceUpdate=n.ForceUpdate),n.Event&&(r=t=>{o=t,console.log("editor view emitt data: "+t),server.kernel.emitt(n.Event,'"'+t.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Input")},s=()=>{server.kernel.emitt(n.Event,'"'+o.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Evaluate")}),e.local?e.local.editor=ZS({doc:i,parent:e.element,eval:s,update:r,extensions:a}):ZS({doc:i,parent:e.element,eval:s,update:r,extensions:a}),e.element.style.verticalAlign="inherit"},core.StripOnInput=async()=>{},core.EditorView.update=async(t,e)=>{if(!e.local.editor)return;const i=GS(await interpretate(t[0],e));console.log("editor view: dispatch"),e.local.forceUpdate,e.local.editor.dispatch({changes:{from:0,to:e.local.editor.state.doc.length,insert:i}})},core.EditorView.destroy=async(t,e)=>{await interpretate(t[0],e),e.local&&e.local.editor&&e.local.editor.destroy()},core.EditorView.virtual=!0,core.PreviewCell=(t,e)=>{},window.SupportedLanguages.push({check:t=>null===t,legacy:!0,plugins:YS,name:"mathematica"}),window.SupportedLanguages.push({check:t=>null!=t[0].match(/\w+\.(wl|wls)$/),plugins:YS,legacy:!0,name:"mathematica"}),window.SupportedCells.codemirror={view:class{origin={};editor={};trash=[];forceFocusNext(){zS=!0}focus(t){t>0?this.editor.dispatch({selection:{anchor:0}}):t<0&&this.editor.dispatch({selection:{anchor:this.editor.state.doc.length}}),this.editor.focus()}setContent(t){if(console.warn("content mutation!"),!this.editor.viewState)return;const e=this.editor;console.log("result"),console.log(t),this.editor.dispatch({changes:{from:0,to:e.viewState.state.doc.length,insert:t}})}addDisposable(t){this.trash.push(t)}dispose(){this.editor.destroy()}readOnly(t){this.editor.dispatch({effects:yS.reconfigure(xt.readOnly.of(t))})}constructor(t,e){this.origin=t;const i=this.origin,n=PS(e).plugins,s=this;this.origin.element.ocellref=s;const r=new Ts({doc:(o=e,o.replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))),extensions:jS.map((t=>t(s,n))),parent:this.origin.element});var o;return this.editor=r,this.editor.dom.ocellref=s,this.editor.viewState.state.config.eval=()=>{i.eval(this.editor.state.doc.toString())},zS&&r.focus(),zS=!1,this}},context:{EditorAutocomplete:kS,javascriptLanguage:qf,javascript:Nf,markdownLanguage:rm,markdown:function(t={}){let{codeLanguages:e,defaultCodeLanguage:i,addKeymap:n=!0,base:{parser:s}=sm}=t;if(!(s instanceof Zp))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let r,o=t.extensions?[t.extensions]:[],a=[dm.support];i instanceof Ua?(a.push(i.support),r=i.language):i&&(r=i);let l=e||r?(h=e,c=r,t=>{if(t&&h){let e=null;if(t=/\S*/.exec(t)[0],e="function"==typeof h?h(t):Ya.matchLanguageName(h,t,!0),e instanceof Ya)return e.support?e.support.language.parser:Ta.getSkippingParser(e.load());if(e)return e.parser}return c?c.parser:null}):void 0;var h,c;return o.push(function(t){let{codeParser:e,htmlParser:i}=t,n=Do(((t,n)=>{let s=t.type.id;if(!e||s!=Kf.CodeBlock&&s!=Kf.FencedCode){if(i&&(s==Kf.HTMLBlock||s==Kf.HTMLTag))return{parser:i,overlay:rO(t.node,t.from,t.to)}}else{let i="";if(s==Kf.FencedCode){let e=t.node.getChild(Kf.CodeInfo);e&&(i=n.read(e.from,e.to))}let r=e(i);if(r)return{parser:r,overlay:t=>t.type.id==Kf.CodeText}}return null}));return{wrap:n}}({codeParser:l,htmlParser:dm.language.parser})),n&&a.push(N.high(Ys.of(um))),new Ua(nm(s.configure(o)),a)},htmlLanguage:jg,html:Ng,cssLanguage:kg,css:Qg,EditorView:Ts,EditorState:xt,highlightSpecialChars:vr,syntaxHighlighting:$l,defaultHighlightStyle:xS,editorCustomTheme:qS,foldGutter:function(t={}){let e=Object.assign(Object.assign({},wl),t),i=new vl(e,!0),n=new vl(e,!1),s=_i.fromClass(class{constructor(t){this.from=t.viewport.from,this.markers=this.buildMarkers(t)}update(t){(t.docChanged||t.viewportChanged||t.startState.facet(Wa)!=t.state.facet(Wa)||t.startState.field(dl,!1)!=t.state.field(dl,!1)||Xa(t.startState)!=Xa(t.state)||e.foldingChanged(t))&&(this.markers=this.buildMarkers(t.view))}buildMarkers(t){let e=new Xt;for(let s of t.viewportLineBlocks){let r=fl(t.state,s.from,s.to)?n:ll(t.state,s.from,s.to)?i:null;r&&e.add(s.from,s.from,r)}return e.finish()}}),{domEventHandlers:r}=e;return[s,Ir({class:"cm-foldGutter",markers(t){var e;return(null===(e=t.plugin(s))||void 0===e?void 0:e.markers)||_t.empty},initialSpacer:()=>new vl(e,!1),domEventHandlers:Object.assign(Object.assign({},r),{click:(t,e,i)=>{if(r.click&&r.click(t,e,i))return!0;let n=fl(t.state,e.from,e.to);if(n)return t.dispatch({effects:ul.of(n)}),!0;let s=ll(t.state,e.from,e.to);return!!s&&(t.dispatch({effects:cl.of(s)}),!0)}})}),ml()]},Facet:E,Compartment:F,mathematicaPlugins:YS,legacyLangNameFacet:CS,DropPasteHandlers:Cm,EditorExtensionsMinimal:IS,EditorParameters:BS,EditorExtensions:jS,StateField:q,Decoration:ni,ViewPlugin:_i,WidgetType:ei,originFacet:NS,MatchDecorator:pr}},window.OfflineMode&&SS.push(xt.readOnly.of(!0)),core.CellView=async(t,e)=>{const i=await core._getRules(t,e);i.Display||(i.Display="codemirror");const n=await interpretate(t[0],e),s={element:e.element,uid:FS()};i.Style&&(e.element.style=i.Style),i.Class&&e.element.classList.add(...i.Class.split(" ")),i.ImageSize&&(Array.isArray(i.ImageSize)?(e.element.style.width=i.ImageSize[0]+"px",e.element.style.height=i.ImageSize[1]+"px"):e.element.style.width=i.ImageSize+"px"),new window.SupportedCells[i.Display].view(s,n)};const HS={};core.FrontEditorSelected=async(t,e)=>{console.log("check");const i=await interpretate(t[0],e),n=await core._getRules(t,e);let s;switch(n.Editor&&(s=HS[n.Editor],console.log("Editor"),console.log(n.Editor),console.log(s)),i){case"Get":return ES(s);case"Set":let i=await interpretate(t[1],e);VS(i,s);break;case"GetDoc":return RS(s);case"SetDoc":let n=await interpretate(t[1],e);DS(n,s);break;case"Cursor":return TS(s);case"Type":return AS(s);case"Editor":const r=FS();return HS[r]=MS(),r}}; +class t{constructor(){}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 a(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}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 l(n,o,i,r);n=o+1,i++}}decompose(t,i,r,o){let a=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(a.text,t.text.slice(),0,a.length);if(i.length<=32)r.push(new e(i,t.length+a.length));else{let t=i.length>>1;r.push(new e(i.slice(0,t)),new e(i.slice(t)))}}else r.push(a)}replace(t,r,o){if(!(o instanceof e))return super.replace(t,r,o);let a=n(this.text,n(o.text,s(this.text,0,t)),r),l=this.length+o.length-(r-t);return a.length<=32?new e(a,l):i.from(e.split(a,[]),l)}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=a+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,a=i+r.lines-1;if((e?a:o)>=t)return r.lineInner(t,e,i,n);n=o+1,i=a+1}}decompose(t,e,i,n){for(let s=0,r=0;r<=e&&s=r){let s=n&((r<=t?1:0)|(a>=e?2:0));r>=t&&a<=e&&!s?i.push(o):o.decompose(t-r,e-r,i,s)}r=a+1}}replace(t,e,n){if(n.lines=r&&e<=a){let l=o.replace(t-r,e-r,n),h=this.lines-o.lines+l.lines;if(l.lines>4&&l.lines>h>>6){let r=this.children.slice();return r[s]=l,new i(r,this.length-(e-t)+n.length)}return super.replace(r,a,l)}r=a+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=a+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,a]=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==a)return n;let i=this.children[s],l=t.children[r];if(i!=l)return n+i.scanIdentical(l,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,a=r>>1,l=[],h=0,c=-1,u=[];function d(t){let n;if(t.lines>o&&t instanceof i)for(let e of t.children)d(e);else t.lines>a&&(h>a||!h)?(f(),l.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&&f(),h+=t.lines,c+=t.length+1,u.push(t))}function f(){0!=h&&(l.push(1==u.length?u[0]:i.from(u,c)),c=-1,h=u.length=0)}for(let e of t)d(e);return f(),1==l.length?l[0]:new i(l,n)}}function n(t,e,i=0,n=1e9){for(let s=0,r=0,o=!0;r=i&&(l>n&&(a=a.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,a=s instanceof e?s.text.length:s.children.length;if(o==(i>0?a: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 a{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]=a.prototype[Symbol.iterator]=function(){return this});let l=class{constructor(t,e,i,n){this.from=t,this.to=e,this.number=i,this.text=n}get length(){return this.to-this.from}},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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,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 d=8205;function f(t,e,i=!0,n=!0){return(i?p:O)(t,e,n)}function p(t,e,i){if(e==t.length)return e;e&&g(t.charCodeAt(e))&&m(t.charCodeAt(e-1))&&e--;let n=b(t,e);for(e+=v(n);e=0&&u(b(t,n));)i++,n-=2;if(i%2==0)break;e+=2}}}return e}function O(t,e,i){for(;e>0;){let n=p(t,e-2,i);if(n=56320&&t<57344}function m(t){return t>=55296&&t<56320}function b(t,e){let i=t.charCodeAt(e);if(!m(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return g(n)?n-56320+(i-55296<<10)+65536:i}function w(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function v(t){return t<65536?1:2}const y=/\r\n?|\n/;var S=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(S||(S={}));class x{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;et)return s+(t-n);s+=o}else{if(i!=S.Simple&&l>=t&&(i==S.TrackDel&&nt||i==S.TrackBefore&&nt))return null;if(l>t||l==t&&e<0&&!o)return t==n||e<0?s:s+a;s+=a}n=l}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 x(t)}static create(t){return new x(t)}}class k extends x{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 P(this,((e,i,n,s,r)=>t=t.replace(n,n+(i-e),r)),!1),t}mapDesc(t,e=!1){return C(this,t,e,!0)}invert(e){let i=this.sections.slice(),n=[];for(let s=0,r=0;s=0){i[s]=a,i[s+1]=o;let l=s>>1;for(;n.length0&&$(i,e,s.text),s.forward(t),o+=t}let l=t[r++];for(;o>1].toJSON()))}return t}static of(e,i,n){let s=[],r=[],o=0,a=null;function l(t=!1){if(!t&&!s.length)return;oa||e<0||a>i)throw new RangeError(`Invalid change range ${e} to ${a} (in doc of length ${i})`);let u=c?"string"==typeof c?t.of(c.split(n||y)):c:t.empty,d=u.length;if(e==a&&0==d)return;eo&&Q(s,e-o,-1),Q(s,a-e,d),$(r,s,u),o=a}}(e),l(!a),a}static empty(t){return new k(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 $(e,i,n){if(0==n.length)return;let s=i.length-2>>1;if(s>1])),!(n||a==e.sections.length||e.sections[a+1]<0);)l=e.sections[a++],h=e.sections[a++];i(r,c,o,u,d),r=c,o=u}}}function C(t,e,i,n=!1){let s=[],r=n?[]:null,o=new X(t),a=new X(e);for(let t=-1;;)if(-1==o.ins&&-1==a.ins){let t=Math.min(o.len,a.len);Q(s,t,-1),o.forward(t),a.forward(t)}else if(a.ins>=0&&(o.ins<0||t==o.i||0==o.off&&(a.len=0&&t=0)){if(o.done&&a.done)return r?k.createSet(s,r):x.create(s);throw new Error("Mismatched change set lengths")}{let e=0,i=o.len;for(;i;)if(-1==a.ins){let t=Math.min(i,a.len);e+=t,i-=t,a.forward(t)}else{if(!(0==a.ins&&a.lene||o.ins>=0&&o.len>e)&&(t||n.length>i),r.forward2(e),o.forward(e)}}else Q(n,0,o.ins,t),s&&$(s,n,o.text),o.next()}}class X{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 Z{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 Z(i,n,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return A.range(t,e);let i=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return A.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 A.range(t.anchor,t.head)}static create(t,e,i){return new Z(t,e,i)}}class A{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:A.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 A(t.ranges.map((t=>Z.fromJSON(t))),t.main)}static single(t,e=t){return new A([A.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?A.range(o,r):A.range(r,o))}}return new A(t,e)}}function T(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let R=0;class E{constructor(t,e,i,n,s){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=n,this.id=R++,this.default=t([]),this.extensions="function"==typeof s?s(this):s}static define(t={}){return new E(t.combine||(t=>t),t.compareInput||((t,e)=>t===e),t.compare||(t.combine?(t,e)=>t===e:V),!!t.static,t.enables)}of(t){return new M([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,2,e)}from(t,e){return e||(e=t=>t),this.compute([t],(i=>e(i.field(t))))}}function V(t,e){return t==e||t.length==e.length&&t.every(((t,i)=>t===e[i]))}class M{constructor(t,e,i,n){this.dependencies=t,this.facet=e,this.type=i,this.value=n,this.id=R++}dynamicSlot(t){var e;let i=this.value,n=this.facet.compareInput,s=this.id,r=t[s]>>1,o=2==this.type,a=!1,l=!1,h=[];for(let i of this.dependencies)"doc"==i?a=!0:"selection"==i?l=!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(a&&e.docChanged||l&&(e.docChanged||e.selection)||W(t,h)){let e=i(t);if(o?!D(e,t.values[r],n):!n(e,t.values[r]))return t.values[r]=e,1}return 0},reconfigure:(t,e)=>{let a,l=e.config.address[s];if(null!=l){let s=tt(e,l);if(this.dependencies.every((i=>i instanceof E?e.facet(i)===t.facet(i):!(i instanceof q)||e.field(i,!1)==t.field(i,!1)))||(o?D(a=i(t),s,n):n(a=i(t),s)))return t.values[r]=s,0}else a=i(t);return t.values[r]=a,1}}}}function D(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 a(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(Y).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,Y.of({field:this,create:t})]}get extension(){return this}}const L=4,z=3,I=2,B=1;function j(t){return e=>new G(e,t)}const N={highest:j(0),high:j(B),default:j(I),low:j(z),lowest:j(L)};class G{constructor(t,e){this.inner=t,this.prec=e}}class F{of(t){return new H(this,t)}reconfigure(t){return F.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class H{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;function r(t,o){let a=s.get(t);if(null!=a){if(a<=o)return;let e=n[a].indexOf(t);e>-1&&n[a].splice(e,1),t instanceof H&&i.delete(t.compartment)}if(s.set(t,o),Array.isArray(t))for(let e of t)r(e,o);else if(t instanceof H){if(i.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");let n=e.get(t.compartment)||t.inner;i.set(t.compartment,n),r(n,o)}else if(t instanceof G)r(t.inner,t.prec);else if(t instanceof q)n[o].push(t),t.provides&&r(t.provides,o);else if(t instanceof M)n[o].push(t),t.facet.extensions&&r(t.facet.extensions,I);else{let e=t.extension;if(!e)throw new Error(`Unrecognized extension value in extension set (${t}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(e,o)}}return r(t,I),n.reduce(((t,e)=>t.concat(e)))}(t,e,r))i instanceof q?n.push(i):(s[i.facet.id]||(s[i.facet.id]=[])).push(i);let o=Object.create(null),a=[],l=[];for(let t of n)o[t.id]=l.length<<1,l.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]=a.length<<1|1,V(r,e))a.push(i.facet(n));else{let t=n.combine(e.map((t=>t.value)));a.push(i&&n.compare(t,i.facet(n))?i.facet(n):t)}else{for(let t of e)0==t.type?(o[t.id]=a.length<<1|1,a.push(t.value)):(o[t.id]=l.length<<1,l.push((e=>t.dynamicSlot(e))));o[n.id]=l.length<<1,l.push((t=>U(t,n,e)))}}let c=l.map((t=>t(o)));return new J(t,r,c,o,a,s)}}function K(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 tt(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}const et=E.define(),it=E.define({combine:t=>t.some((t=>t)),static:!0}),nt=E.define({combine:t=>t.length?t[0]:void 0,static:!0}),st=E.define(),rt=E.define(),ot=E.define(),at=E.define({combine:t=>!!t.length&&t[0]});class lt{constructor(t,e){this.type=t,this.value=e}static define(){return new ht}}class ht{of(t){return new lt(this,t)}}class ct{constructor(t){this.map=t}of(t){return new ut(this,t)}}class ut{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 ut(this.type,e)}is(t){return this.type==t}static define(t={}){return new ct(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}}ut.reconfigure=ut.define(),ut.appendConfig=ut.define();class dt{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&&T(i,e.newLength),s.some((t=>t.type==dt.time))||(this.annotations=s.concat(dt.time.of(Date.now())))}static create(t,e,i,n,s,r){return new dt(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(dt.userEvent);return!(!e||!(e==t||e.length>t.length&&e.slice(0,t.length)==t&&"."==e[t.length]))}}function ft(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=pt(n,Ot(e,r,t.changes.newLength),!0))}return n==t?t:dt.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(st)){let e=n(t);if(!1===e){i=!1;break}Array.isArray(e)&&(i=!0===i?e:ft(i,e))}if(!0!==i){let n,s;if(!1===i)s=t.changes.invertedDesc,n=k.empty(e.doc.length);else{let e=t.changes.filter(i);n=e.changes,s=e.filtered.mapDesc(e.changes).invertedDesc}t=dt.create(e,n,t.selection&&t.selection.map(s),ut.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let n=e.facet(rt);for(let i=n.length-1;i>=0;i--){let s=n[i](t);t=s instanceof dt?s:Array.isArray(s)&&1==s.length&&s[0]instanceof dt?s[0]:gt(e,bt(s),!1)}return t}(s):s)}dt.time=lt.define(),dt.userEvent=lt.define(),dt.addToHistory=lt.define(),dt.remote=lt.define();const mt=[];function bt(t){return null==t?mt:Array.isArray(t)?t:[t]}var wt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(wt||(wt={}));const vt=/[\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){}function St(t){return e=>{if(!/\S/.test(e))return wt.Space;if(function(t){if(yt)return yt.test(t);for(let e=0;e"€"&&(i.toUpperCase()!=i.toLowerCase()||vt.test(i)))return!0}return!1}(e))return wt.Word;for(let i=0;i-1)return wt.Word;return wt.Other}}class xt{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(ut.reconfigure)?(i=null,n=e.value):e.is(ut.appendConfig)&&(i=null,n=bt(n).concat(e.value));if(i)e=t.startState.values.slice();else{i=J.resolve(n,s,this),e=new xt(i,this.doc,this.selection,i.dynamicSlots.map((()=>null)),((t,e)=>e.reconfigure(t,this)),null).values}new xt(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:A.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=bt(i.effects);for(let i=1;is.spec.fromJSON(r,t))))}return xt.create({doc:t.doc,selection:A.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(xt.lineSeparator)||y)),s=e.selection?e.selection instanceof A?e.selection:A.single(e.selection.anchor,e.selection.head):A.single(0);return T(s,n.length),i.staticFacet(it)||(s=s.asSingle()),new xt(i,n,s,i.dynamicSlots.map((()=>null)),((t,e)=>e.create(t)),null)}get tabSize(){return this.facet(xt.tabSize)}get lineBreak(){return this.facet(xt.lineSeparator)||"\n"}get readOnly(){return this.facet(at)}phrase(t,...e){for(let e of this.facet(xt.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(et))for(let r of s(this,e,i))Object.prototype.hasOwnProperty.call(r,t)&&n.push(r[t]);return n}charCategorizer(t){return St(this.languageDataAt("wordChars",t).join(""))}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=f(e,r,!1);if(s(e.slice(t,r))!=wt.Word)break;r=t}for(;ot.length?t[0]:4}),xt.lineSeparator=nt,xt.readOnly=at,xt.phrases=E.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]))}}),xt.languageData=et,xt.changeFilter=st,xt.transactionFilter=rt,xt.transactionExtender=ot,F.reconfigure=ut.define();class Qt{eq(t){return this==t}range(t,e=t){return $t.create(t,e,this)}}Qt.prototype.startSide=Qt.prototype.endSide=0,Qt.prototype.point=!1,Qt.prototype.mapMode=S.TrackDel;let $t=class t{constructor(t,e,i){this.from=t,this.to=e,this.value=i}static create(e,i,n){return new t(e,i,n)}};function Pt(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Ct{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,a=s[n]-t||(i?this.value[n].endSide:this.value[n].startSide)-e;if(n==r)return a>=0?r:o;a>=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||l==h&&c.startSide>0&&c.endSide<=0)continue;(h-l||c.endSide-c.startSide)<0||(r<0&&(r=l),c.point&&(o=Math.max(o,h-l)),i.push(c),n.push(l-r),s.push(h-r))}return{mapped:i.length?new Ct(n,s,i,o):null,pos:r}}}class _t{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 _t(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(Pt)),this.isEmpty)return e.length?_t.of(e):this;let o=new At(this,null,-1).goto(0),a=0,l=[],h=new Xt;for(;o.value||a=0){let t=e[a++];h.addInner(t.from,t.to,t.value)||l.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 Tt.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return Tt.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)),a=Zt(r,o,i),l=new Et(r,a,s),h=new Et(o,a,s);i.iterGaps(((t,e,i)=>Vt(l,t,h,e,i,n))),i.empty&&0==i.length&&Vt(l,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=Zt(s,r),a=new Et(s,o,0).goto(i),l=new Et(r,o,0).goto(i);for(;;){if(a.to!=l.to||!Mt(a.active,l.active)||a.point&&(!l.point||!a.point.eq(l.point)))return!1;if(a.to>n)return!0;a.next(),l.next()}}static spans(t,e,i,n,s=-1){let r=new Et(t,null,s).goto(e),o=e,a=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,a),a=r.openEnd(t));if(r.to>i)return a+(r.point&&r.to>i?1:0);o=r.to,r.next()}}static of(t,e=!1){let i=new Xt;for(let n of t instanceof $t?[t]:e?function(t){if(t.length>1)for(let e=t[0],i=1;i0)return t.slice().sort(Pt);e=n}return t}(t):t)i.add(n.from,n.to,n.value);return i.finish()}}_t.empty=new _t([],[],null,-1),_t.empty.nextLayer=_t.empty;class Xt{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}finishChunk(t){this.chunks.push(new Ct(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=[])}add(t,e,i){this.addInner(t,e,i)||(this.nextLayer||(this.nextLayer=new Xt)).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(_t.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;let e=_t.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function Zt(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 At(r,e,i,s));return 1==n.length?n[0]:new Tt(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--)Rt(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--)Rt(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(),Rt(this.heap,0)}}}function Rt(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 Et{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=Tt.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){Dt(this.active,t),Dt(this.activeTo,t),Dt(this.activeRank,t),this.minActive=Ut(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&&Dt(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 Vt(t,e,i,n,s,r){t.goto(e),i.goto(n);let o=n+s,a=n,l=n-e;for(;;){let e=t.to+l-i.to||t.endSide-i.endSide,n=e<0?t.to+l: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))&&Mt(t.activeForPoint(t.to+l),i.activeForPoint(i.to))||r.comparePoint(a,s,t.point,i.point):s>a&&!Mt(t.active,i.active)&&r.compareRange(a,s,t.active,i.active),n>o)break;a=n,e<=0&&t.next(),e>=0&&i.next()}}function Mt(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 Ut(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(!l)throw new RangeError("The value of a property ("+i+") should be a primitive value.");s(n(i),o,a,h)}else null!=o&&a.push(i.replace(/_.*/,"").replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))+": "+o+";")}(a.length||h)&&r.push((!i||l||o?t:t.map(i)).join(", ")+" {"+a.join(" ")+"}")}for(let e in t)s(n(e),t[e],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let t=zt[qt]||1;return zt[qt]=t+1,"ͼ"+t.toString(36)}static mount(t,e){(t[Lt]||new jt(t)).mount(Array.isArray(e)?e:[e])}}let Bt=new Map;class jt{constructor(t){let e=t.ownerDocument||t,i=e.defaultView;if(!t.head&&t.adoptedStyleSheets&&i.CSSStyleSheet){let n=Bt.get(e);if(n)return t.adoptedStyleSheets=[n.sheet,...t.adoptedStyleSheets],t[Lt]=n;this.sheet=new i.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets],Bt.set(e,this)}else{this.styleTag=e.createElement("style");let i=t.head||t;i.insertBefore(this.styleTag,i.firstChild)}this.modules=[],t[Lt]=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:'"'},Ft="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),Ht="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Jt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Kt=Ht||Ft&&+Ft[1]<57,te=0;te<10;te++)Nt[48+te]=Nt[96+te]=String(te);for(te=1;te<=24;te++)Nt[te+111]="F"+te;for(te=65;te<=90;te++)Nt[te]=String.fromCharCode(te+32),Gt[te]=String.fromCharCode(te);for(var ee in Nt)Gt.hasOwnProperty(ee)||(Gt[ee]=Nt[ee]);function ie(t){let e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection()}function ne(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function se(t,e){if(!e.anchorNode)return!1;try{return ne(t,e.anchorNode)}catch(t){return!1}}function re(t){return 3==t.nodeType?me(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function oe(t,e,i,n){return!!i&&(le(t,e,i,n,-1)||le(t,e,i,n,1))}function ae(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function le(t,e,i,n,s){for(;;){if(t==i&&e==n)return!0;if(e==(s<0?0:he(t))){if("DIV"==t.nodeName)return!1;let i=t.parentNode;if(!i||1!=i.nodeType)return!1;e=ae(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?he(t):0}}}function he(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}const ce={left:0,right:0,top:0,bottom:0};function ue(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function de(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}class fe{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){this.set(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset)}set(t,e,i,n){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=n}}let pe,Oe=null;function ge(t){if(t.setActive)return t.setActive();if(Oe)return t.focus(Oe);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==Oe?{get preventScroll(){return Oe={preventScroll:!0},!0}}:void 0),!Oe){Oe=!1;for(let t=0;te)return i.domBoundsAround(t,e,l);if(c>=t&&-1==n&&(n=a,s=l),l>e&&i.dom.parentNode==this.dom){r=a,o=h;break}h=c,l=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.dirty|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.dirty|=2),1&e.dirty)return;e.dirty|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,this.dirty&&this.markParentsDirty(!0))}setDOM(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=ye){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 Qe(t,e,i,n,s,r,o,a,l){let{children:h}=t,c=h.length?h[e]:null,u=r.length?r[r.length-1]:null,d=u?u.breakAfter:o;if(!(e==n&&c&&!o&&!d&&r.length<2&&c.merge(i,s,r.length?u:null,0==i,a,l))){if(n0&&(!o&&r.length&&c.merge(i,c.length,r[0],!1,a,0)?c.breakAfter=r.shift().breakAfter:(i2);var De={mac:Me||/Mac/.test(Pe.platform),windows:/Win/.test(Pe.platform),linux:/Linux|X11/.test(Pe.platform),ie:Ae,ie_version:Xe?Ce.documentMode||6:Ze?+Ze[1]:_e?+_e[1]:0,gecko:Te,gecko_version:Te?+(/Firefox\/(\d+)/.exec(Pe.userAgent)||[0,0])[1]:0,chrome:!!Re,chrome_version:Re?+Re[1]:0,ios:Me,android:/Android\b/.test(Pe.userAgent),webkit:Ee,safari:Ve,webkit_version:Ee?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Ce.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class We extends Se{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(!i||i instanceof We&&!(this.length-(e-t)+i.length>256))&&(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),!0)}split(t){let e=new We(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new ve(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 Ye(this.dom,t,e)}}class Ue extends Se{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(we(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}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.dirty|=6)}sync(t,e){this.dom?4&this.dirty&&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 Ue&&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 Ue(this.mark,e,r)}domAtPos(t){return Ge(this,t)}coordsAt(t,e){return He(this,t,e)}}function Ye(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?De.chrome||De.gecko||(e?(s--,o=1):r=0)?0:a.length-1];return De.safari&&!o&&0==l.width&&(l=Array.prototype.find.call(a,(t=>t.width))||l),o?ue(l,o<0):l||null}class qe extends Se{constructor(t,e,i){super(),this.widget=t,this.length=e,this.side=i,this.prevWidget=null}static create(t,e,i){return new(t.customView||qe)(t,e,i)}split(t){let e=qe.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 qe&&this.widget.compare(i.widget))||t>0&&s<=0||e0)?ve.before(this.dom):ve.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let i=this.dom.getClientRects(),n=null;if(!i.length)return ce;for(let e=t>0?i.length-1:0;n=i[e],!(t>0?0==e:e==i.length-1||n.top0?-1:1);return this.length?n:ue(n,this.side>0)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class Le extends qe{domAtPos(t){let{topView:e,text:i}=this.widget;return e?ze(t,0,e,i,this.length-e.length,((t,e)=>t.domAtPos(e)),((t,e)=>new ve(t,Math.min(e,t.nodeValue.length)))):new ve(i,Math.min(t,i.nodeValue.length))}sync(){this.setDOM(this.widget.toDOM())}localPosFromDOM(t,e){let{topView:i,text:n}=this.widget;return i?Be(t,e,i,n,this.length-i.length):Math.min(e,this.length)}ignoreMutation(){return!1}get overrideDOMText(){return null}coordsAt(t,e){let{topView:i,text:n}=this.widget;return i?ze(t,e,i,n,this.length-i.length,((t,e,i)=>t.coordsAt(e,i)),((t,e,i)=>Ye(t,e,i))):Ye(n,t,e)}destroy(){var t;super.destroy(),null===(t=this.widget.topView)||void 0===t||t.destroy()}get isEditable(){return!0}canReuseDOM(){return!0}}function ze(t,e,i,n,s,r,o){if(i instanceof Ue){for(let a=i.dom.firstChild;a;a=a.nextSibling){let i=Se.get(a);if(i){let l=ne(a,n),h=i.length+(l?s:0);if(t0?ve.before(this.dom):ve.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){let e=this.dom.getBoundingClientRect(),i=function(t,e){let i=t.parent,n=i?i.children.indexOf(t):-1;for(;i&&n>=0;)if(e<0?n>0:n0?-1:1);return i&&i.tope.top?{left:e.left,right:e.right,top:i.top,bottom:i.bottom}:e}get overrideDOMText(){return t.empty}get isHidden(){return!0}}function Ge(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 Ue&&s.length&&(n=s[s.length-1])instanceof Ue&&n.mark.eq(e.mark)?Fe(n,e.children[0],i-1):(s.push(e),e.setParent(t)),t.length+=e.length}function He(t,e,i){let n=null,s=-1,r=null,o=-1;!function t(e,a){for(let l=0,h=0;l=a&&(c.children.length?t(c,a-h):(!r||r instanceof Ne&&i>0)&&(u>a||h==u&&c.getSide()>0)?(r=c,o=a-h):(h0?3e8:-4e8:e>0?1e8:-1e8,new oi(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}=ai(t,n);e=(s?n?-3e8:-1:5e8)-1,i=1+(r?n?2e8:1:-6e8)}return new oi(t,e,i,n,t.widget||null,!0)}static line(t){return new ri(t)}static set(t,e=!1){return _t.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}ni.none=_t.empty;class si extends ni{constructor(t){let{start:e,end:i}=ai(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){return this==t||t instanceof si&&this.tagName==t.tagName&&this.class==t.class&&Ke(this.attrs,t.attrs)}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}si.prototype.point=!1;class ri extends ni{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof ri&&this.spec.class==t.spec.class&&Ke(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)}}ri.prototype.mapMode=S.TrackBefore,ri.prototype.point=!0;class oi extends ni{constructor(t,e,i,n,s,r){super(e,i,s,t),this.block=n,this.isReplace=r,this.mapMode=n?e<=0?S.TrackBefore:S.TrackAfter:S.TrackDel}get type(){return this.startSide=5}eq(t){return t instanceof oi&&(e=this.widget,i=t.widget,e==i||!!(e&&i&&e.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var e,i}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 ai(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 li(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)}oi.prototype.point=!0;class hi extends Se{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 hi))return!1;this.dom||i.transferDOM(this)}return n&&this.setDeco(i?i.attrs:null),$e(this,t,e,i?i.children:[],s,r),!0}split(t){let e=new hi;if(e.breakAfter=this.breakAfter,0==this.length)return e;let{i: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){Ke(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){Fe(this,t,e)}addLineDeco(t){let e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=Je(e,this.attrs||{})),i&&(this.attrs=Je({class:i},this.attrs||{}))}domAtPos(t){return Ge(this,t)}reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.dirty|=6)}sync(t,e){var i;this.dom?4&this.dirty&&(we(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&&(ti(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&&Se.get(n)instanceof Ue;)n=n.lastChild;if(!(n&&this.length&&("BR"==n.nodeName||0!=(null===(i=Se.get(n))||void 0===i?void 0:i.isEditable)||De.ios&&this.children.some((t=>t instanceof We))))){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 We)||/[^ -~]/.test(i.text))return null;let n=re(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=He(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 hi)return s;if(r>e)break}n=r+s.breakAfter}return null}}class ci extends Se{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 ci&&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(di(new We(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 oi){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let o=e-t;if(i instanceof oi)if(i.block){let{type:t}=i;t!=ii.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new ci(i.widget||new fi("div"),o,t))}else{let r=qe.create(i.widget||new fi("span"),o,o?0:i.startSide),a=this.atCursorPos&&!r.isEditable&&s<=n.length&&(t0),l=!r.isEditable&&(tn.length||i.startSide<=0),h=this.getLine();2!=this.pendingBuffer||a||r.isEditable||(this.pendingBuffer=0),this.flushBuffer(n),a&&(h.append(di(new Ne(1),n),s),s=n.length+Math.max(0,s-n.length)),h.append(di(r,n),s),this.atCursorPos=l,this.pendingBuffer=l?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 ui(t,e,i,s);return r.openEnd=_t.spans(n,e,i,r),r.openStart<0&&(r.openStart=r.openEnd),r.finish(r.openEnd),r}}function di(t,e){for(let i of e)t=new Ue(i,[t],t.length);return t}class fi extends ei{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 pi=E.define(),Oi=E.define(),gi=E.define(),mi=E.define(),bi=E.define(),wi=E.define(),vi=E.define(),yi=E.define({combine:t=>t.some((t=>t))}),Si=E.define({combine:t=>t.some((t=>t))});class xi{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 xi(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin)}}const ki=ut.define({map:(t,e)=>t.map(e)});function Qi(t,e,i){let n=t.facet(mi);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 $i=E.define({combine:t=>!t.length||t[0]});let Pi=0;const Ci=E.define();class _i{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 _i(Pi++,t,i,(t=>{let e=[Ci.of(t)];return s&&e.push(Ti.of((e=>{let i=e.plugin(t);return i?s(i):ni.none}))),n&&e.push(n(t)),e}))}static fromClass(t,e){return _i.define((e=>new t(e)),e)}}class Xi{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(Qi(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){Qi(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){Qi(t.state,e,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Zi=E.define(),Ai=E.define(),Ti=E.define(),Ri=E.define(),Ei=E.define(),Vi=E.define();class Mi{constructor(t,e,i,n){this.fromA=t,this.toA=e,this.fromB=i,this.toB=n}join(t){return new Mi(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(!a)return i;new Mi(a.fromA,a.toA,a.fromB,a.toB).addToSet(i),r=a.toA,o=a.toB}}}class Di{constructor(t,e,i){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=k.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 Mi(t,e,i,s)))),this.changedRanges=n}static create(t,e,i){return new Di(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 Wi=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Wi||(Wi={}));const Ui=Wi.LTR,Yi=Wi.RTL;function qi(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}}const Gi=[];function Fi(t){return[new Ni(0,t,0)]}let Hi="";function Ji(t,e,i,n,s){var r;let o=n.head-t.from,a=-1;if(0==o){if(!s||!t.length)return null;e[0].level!=i&&(o=e[0].side(!1,i),a=0)}else if(o==t.length){if(s)return null;let t=e[e.length-1];t.level!=i&&(o=t.side(!0,i),a=e.length-1)}a<0&&(a=Ni.find(e,o,null!==(r=n.bidiLevel)&&void 0!==r?r:-1,n.assoc));let l=e[a];o==l.side(s,i)&&(l=e[a+=s?1:-1],o=l.side(!s,i));let h=s==(l.dir==i),c=f(t.text,o,h);if(Hi=t.text.slice(Math.min(o,c),Math.max(o,c)),c!=l.side(s,i))return A.cursor(c+t.from,h?-1:1,l.level);let u=a==(s?e.length-1:0)?null:e[a+(s?1:-1)];return u||l.level==i?u&&u.level1)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=Se.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 en(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}class nn{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class sn extends Se{constructor(t){super(),this.view=t,this.compositionDeco=ni.none,this.decorations=[],this.dynamicDecorationMap=[],this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(t.contentDOM),this.children=[new hi],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Mi(0,0,0,t.state.doc.length)],0)}get length(){return this.view.state.doc.length}update(t){let e=t.changedRanges;this.minWidth>0&&e.length&&(e.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),this.view.inputState.composing<0?this.compositionDeco=ni.none:(t.transactions.length||this.dirty)&&(this.compositionDeco=function(t,e){let i=on(t);if(!i)return ni.none;let{from:n,to:s,node:r,text:o}=i,a=e.mapPos(n,1),l=Math.max(a,e.mapPos(s,-1)),{state:h}=t,c=3==r.nodeType?r.nodeValue:new tn([],h).readRange(r.firstChild,null).text;if(l-a{this.dom.style.height=this.view.viewState.contentHeight+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let t=De.chrome||De.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,t),this.dirty=0,t&&(t.written||i.selectionRange.focusNode!=t.node)&&(this.forceSelection=!0),this.dom.style.height=""}));let n=[];if(this.view.viewport.from||this.view.viewport.to=0?t[e]:null;if(!n)break;let{fromA:s,toA:r,fromB:o,toB:a}=n,{content:l,breakAtStart:h,openStart:c,openEnd:u}=ui.build(this.view.state.doc,o,a,this.decorations,this.dynamicDecorationMap),{i:d,off:f}=i.findPos(r,1),{i:p,off:O}=i.findPos(s,-1);Qe(this,p,O,d,f,l,h,c,u)}}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&&se(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,a=this.domAtPos(o.anchor),l=o.empty?a:this.domAtPos(o.head);if(De.gecko&&o.empty&&!this.compositionDeco.size&&(1==(h=a).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((()=>a.node.insertBefore(t,a.node.childNodes[a.offset]||null))),a=l=new ve(t,0),r=!0}var h;let c=this.view.observer.selectionRange;!r&&c.focusNode&&oe(a.node,a.offset,c.anchorNode,c.anchorOffset)&&oe(l.node,l.offset,c.focusNode,c.focusOffset)||(this.view.observer.ignore((()=>{De.android&&De.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=ie(this.view.root);if(t)if(o.empty){if(De.gecko){let t=(e=a.node,n=a.offset,1!=e.nodeType?0:(n&&"false"==e.childNodes[n-1].contentEditable?1:0)|(no.head&&([a,l]=[l,a]),e.setEnd(l.node,l.offset),e.setStart(a.node,a.offset),t.removeAllRanges(),t.addRange(e)}else;var e,n;s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())})),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new ve(c.anchorNode,c.anchorOffset),this.impreciseHead=l.precise?null:new ve(c.focusNode,c.focusOffset)}enforceCursorAssoc(){if(this.compositionDeco.size)return;let{view:t}=this,e=t.state.selection.main,i=ie(t.root),{anchorNode:n,anchorOffset:s}=t.observer.selectionRange;if(!(i&&e.empty&&e.assoc&&i.modify))return;let r=hi.find(this,e.head);if(!r)return;let o=r.posAtStart;if(e.head==o||e.head==o+r.length)return;let a=this.coordsAt(e.head,-1),l=this.coordsAt(e.head,1);if(!a||!l||a.bottom>l.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)}nearest(t){for(let e=t;e;){let t=Se.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!=ii.WidgetBefore&&s.type!=ii.WidgetAfter&&(!n||2==e||this.children[n-1].breakAfter||this.children[n-1].type==ii.WidgetBefore&&e>-2))return s.coordsAt(t-r,e);i=r}}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,a=this.view.textDirection==Wi.LTR;for(let t=0,l=0;ln)break;if(t>=i){let i=h.dom.getBoundingClientRect();if(e.push(i.height),r){let e=h.dom.lastChild,n=e?re(e):[];if(n.length){let e=n[n.length-1],r=a?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?Wi.RTL:Wi.LTR}measureTextSize(){for(let t of this.children)if(t instanceof hi){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.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(n);let s=re(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 ke(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;t.push(ni.replace({widget:new rn(n),block:!0,inclusive:!0,isBlockGap:!0}).range(i,r))}if(!s)break;i=s.to+1}return ni.set(t)}updateDeco(){let t=this.view.state.facet(Ti).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=0,r=0,o=0,a=0;for(let t of this.view.state.facet(Ei).map((t=>t(this.view))))if(t){let{left:e,right:i,top:n,bottom:l}=t;null!=e&&(s=Math.max(s,e)),null!=i&&(r=Math.max(r,i)),null!=n&&(o=Math.max(o,n)),null!=l&&(a=Math.max(a,l))}let l={left:n.left-s,top:n.top-o,right:n.right+r,bottom:n.bottom+a};!function(t,e,i,n,s,r,o,a){let l=t.ownerDocument,h=l.defaultView||window;for(let c=t;c;)if(1==c.nodeType){let t,u=c==l.body;if(u)t=de(h);else{if(c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let e=c.getBoundingClientRect();t={left:e.left,right:e.left+c.clientWidth,top:e.top,bottom:e.top+c.clientHeight}}let d=0,f=0;if("nearest"==s)e.top0&&e.bottom>t.bottom+f&&(f=e.bottom-t.bottom+f+o)):e.bottom>t.bottom&&(f=e.bottom-t.bottom+o,i<0&&e.top-f0&&e.right>t.right+d&&(d=e.right-t.right+d+r)):e.right>t.right&&(d=e.right-t.right+r,i<0&&e.left0))break;i=i.childNodes[n-1],n=he(i)}if(i>=0)for(let n=t,s=e;;){if(3==n.nodeType)return n;if(!(1==n.nodeType&&s=0))break;n=n.childNodes[s],s=0}return null}class hn{constructor(){this.changes=[]}compareRange(t,e){li(t,e,this.changes)}comparePoint(t,e){li(t,e,this.changes)}}function cn(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function un(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function dn(t,e){return t.tope.top+1}function fn(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,a,l,h,c,u=!1;for(let d=t.firstChild;d;d=d.nextSibling){let t=re(d);for(let f=0;fg||o==g&&r>O){n=d,s=p,r=O,o=g;let a=g?i0?f0)}0==O?i>p.bottom&&(!h||h.bottomp.top)&&(l=d,c=p):h&&dn(h,p)?h=pn(h,p.bottom):c&&dn(c,p)&&(c=fn(c,p.top))}}if(h&&h.bottom>=i?(n=a,s=h):c&&c.top<=i&&(n=l,s=c),!n)return{node:t,offset:0};let d=Math.max(s.left,Math.min(s.right,e));return 3==n.nodeType?gn(n,d,i):u&&"false"!=n.contentEditable?On(n,d,i):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,n)+(e>=(s.left+s.right)/2?1:0)}}function gn(t,e,i){let n=t.nodeValue.length,s=-1,r=1e9,o=0;for(let a=0;ai?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(De.chrome||De.gecko){me(t,a).getBoundingClientRect().left==h.right&&(n=!i)}if(c<=0)return{node:t,offset:a+(n?1:0)};s=a+(n?1:0),r=c}}}return{node:t,offset:s>-1?s:o>0?t.nodeValue.length:0}}function mn(t,e,i,n=-1){var s,r;let o,a=t.contentDOM.getBoundingClientRect(),l=a.top+t.viewState.paddingTop,{docHeight:h}=t.viewState,{x:c,y:u}=e,d=u-l;if(d<0)return 0;if(d>h)return t.state.doc.length;for(let e=t.defaultLineHeight/2,s=!1;o=t.elementAtHeight(d),o.type!=ii.Text;)for(;d=n>0?o.bottom+e:o.top-e,!(d>=0&&d<=h);){if(s)return i?null:0;s=!0,n=-n}u=l+d;let f=o.from;if(ft.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:bn(t,a,o,c,u);let p=t.dom.ownerDocument,O=t.root.elementFromPoint?t.root:p,g=O.elementFromPoint(c,u);g&&!t.contentDOM.contains(g)&&(g=null),g||(c=Math.max(a.left+1,Math.min(a.right-1,c)),g=O.elementFromPoint(c,u),g&&!t.contentDOM.contains(g)&&(g=null));let m,b=-1;if(g&&0!=(null===(s=t.docView.nearest(g))||void 0===s?void 0:s.isEditable))if(p.caretPositionFromPoint){let t=p.caretPositionFromPoint(c,u);t&&({offsetNode:m,offset:b}=t)}else if(p.caretRangeFromPoint){let e=p.caretRangeFromPoint(c,u);e&&(({startContainer:m,startOffset:b}=e),(!t.contentDOM.contains(m)||De.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 me(t,n-1,n).getBoundingClientRect().left>i}(m,b,c)||De.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}let n=1==t.nodeType?t.getBoundingClientRect():me(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return i-n.left>5}(m,b,c))&&(m=void 0))}if(!m||!t.docView.dom.contains(m)){let e=hi.find(t.docView,f);if(!e)return d>o.top+o.height/2?o.to:o.from;({node:m,offset:b}=On(e.dom,c,u))}let w=t.docView.nearest(m);if(!w)return null;if(w.isWidget&&1==(null===(r=w.dom)||void 0===r?void 0:r.nodeType)){let t=w.dom.getBoundingClientRect();return e.y1.5*t.defaultLineHeight){r+=Math.floor((s-i.top)/t.defaultLineHeight)*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=f(t,n)}return!0===n?-1:t.length}(o,r,t.state.tabSize)}function wn(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=t.bidiSpans(s),o=t.textDirectionAt(s.from);for(let a=e,l=null;;){let e=Ji(s,r,o,a,i),h=Hi;if(!e){if(s.number==(i?t.state.doc.lines:1))return a;h="\n",s=t.state.doc.line(s.number+(i?1:-1)),r=t.bidiSpans(s),e=A.cursor(i?s.from:s.to)}if(l){if(!l(h))return a}else{if(!n)return e;l=n(h)}a=e}}function vn(t,e,i,n){let s=t.state.facet(Ri).map((e=>e(t)));for(;;){let t=!1;for(let r of s)r.between(i.from-1,i.from+1,((s,r,o)=>{i.from>s&&i.fromi.from?A.cursor(s,1):A.cursor(r,-1),t=!0,o.widget.skipPosition&&(i=o.widget.skipPosition(i,e,n)))}));if(!t)return i}}class yn{constructor(t){this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null;let e=(e,i)=>{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 Cn){let n=Cn[i];t.contentDOM.addEventListener(i,(i=>{Pn(t,i)&&e(n,i)}),_n[i]),this.registeredEvents.push(i)}t.scrollDOM.addEventListener("mousedown",(i=>{if(i.target==t.scrollDOM&&i.clientY>t.contentDOM.getBoundingClientRect().bottom&&(e(Cn.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)}})),De.chrome&&102==De.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,De.safari&&t.contentDOM.addEventListener("input",(()=>null))}setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}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=>{Pn(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){Qi(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){Qi(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||xn.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,be(t.contentDOM,e.key,e.keyCode))}ignoreDuringComposition(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(De.safari&&!De.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 Sn=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],xn="dthko",kn=[16,17,18,20,91,92,224,225];function Qn(t){return.7*Math.max(0,t)+8}class $n{constructor(t,e,i,n){this.view=t,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);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(xt.allowMultipleSelections)&&function(t,e){let i=t.state.facet(pi);return i.length?i[0](e):(De.mac,e.altKey)}(t,e),this.dragMove=function(t,e){let i=t.state.facet(Oi);return i.length?i[0](e):De.mac?!e.altKey:!e.ctrlKey}(t,e),this.dragging=!(!function(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let n=ie(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!=Yn(e))&&null}start(t){!1===this.dragging&&(t.preventDefault(),this.select(t))}move(t){var e;if(0==t.buttons)return this.destroy();if(!1!==this.dragging)return;this.select(this.lastEvent=t);let i=0,n=0,s=(null===(e=this.scrollParent)||void 0===e?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight};t.clientX<=s.left+6?i=-Qn(s.left-t.clientX):t.clientX>=s.right-6&&(i=Qn(t.clientX-s.right)),t.clientY<=s.top+6?n=-Qn(s.top-t.clientY):t.clientY>=s.bottom-6&&(n=Qn(t.clientY-s.bottom)),this.setScrollSpeed(i,n)}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)}select(t){let e=this.style.get(t,this.extend,this.multiple);!this.mustSelect&&e.eq(this.view.state.selection)&&e.main.assoc==this.view.state.selection.main.assoc||this.view.dispatch({selection:e,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.docChanged&&this.dragging&&(this.dragging=this.dragging.map(t.changes)),this.style.update(t)&&setTimeout((()=>this.select(this.lastEvent)),20)}}function Pn(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=Se.get(n))&&i.ignoreEvent(e))return!1;return!0}const Cn=Object.create(null),_n=Object.create(null),Xn=De.ie&&De.ie_version<15||De.ios&&De.webkit_version<604;function Zn(t,e){let i,{state:n}=t,s=1,r=n.toText(e),o=r.lines==n.selection.ranges.length;if(null!=Ln&&n.selection.ranges.every((t=>t.empty))&&Ln==r.toString()){let t=-1;i=n.changeByRange((i=>{let a=n.doc.lineAt(i.from);if(a.from==t)return{range:i};t=a.from;let l=n.toText((o?r.line(s++).text:e)+n.lineBreak);return{changes:{from:a.from,insert:l},range:A.cursor(i.from+l.length)}}))}else i=o?n.changeByRange((t=>{let e=r.line(s++);return{changes:{from:t.from,to:t.to,insert:e.text},range:A.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 A.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 A.cursor(e);0==r?i=1:r==s.length&&(i=-1);let o=r,a=r;i<0?o=f(s.text,r,!1):a=f(s.text,r);let l=n(s.text.slice(o,a));for(;o>0;){let t=f(s.text,o,!1);if(n(s.text.slice(t,o))!=l)break;o=t}for(;a{t.inputState.setSelectionOrigin("select"),27==e.keyCode&&(t.inputState.lastEscPress=Date.now())},Cn.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},Cn.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},_n.touchstart=_n.touchmove={passive:!0},Cn.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return;let i=null;for(let n of t.state.facet(gi))if(i=n(t,e),i)break;if(i||0!=e.button||(i=function(t,e){let i=Vn(t,e),n=Yn(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 a,l=Vn(t,e),h=An(t,l.pos,l.bias,n);if(i.pos!=l.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&&(a=function(t,e){for(let i=0;i=e)return A.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,l.pos))?a:o?s.addRange(h):A.create([h])}}}(t,e)),i){let n=t.root.activeElement!=t.contentDOM;t.inputState.startMouseSelection(new $n(t,e,i,n)),n&&t.observer.ignore((()=>ge(t.contentDOM))),t.inputState.mouseSelection&&t.inputState.mouseSelection.start(e)}};let Tn=(t,e)=>t>=e.top&&t<=e.bottom,Rn=(t,e,i)=>Tn(e,i)&&t>=i.left&&t<=i.right;function En(t,e,i,n){let s=hi.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&&Rn(i,n,o))return-1;let a=s.coordsAt(r,1);return a&&Rn(i,n,a)?1:o&&Tn(n,o)?-1:1}function Vn(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:En(t,i,e.clientX,e.clientY)}}const Mn=De.ie&&De.ie_version<=11;let Dn=null,Wn=0,Un=0;function Yn(t){if(!Mn)return t.detail;let e=Dn,i=Un;return Dn=t,Un=Date.now(),Wn=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Wn+1)%3:1}function qn(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&&r.dragMove?{from:r.dragging.from,to:r.dragging.to}:null,a={from:s,insert:i},l=t.state.changes(o?[o,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(s,-1),head:l.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"})}Cn.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")},Cn.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&&qn(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 qn(t,e,e.dataTransfer.getData("Text"),!0)},Cn.paste=(t,e)=>{if(t.state.readOnly)return e.preventDefault();t.observer.flush();let i=Xn?null:e.clipboardData;i?(Zn(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(),Zn(t,i.value)}),50)}(t)};let Ln=null;Cn.copy=Cn.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;Ln=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 zn=lt.define();function In(t,e){let i=[];for(let n of t.facet(vi)){let s=n(t,e);s&&i.push(s)}return i?t.update({effects:i,annotations:zn.of(!0)}):null}function Bn(t){setTimeout((()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=In(t.state,e);i?t.dispatch(i):t.update([])}}),10)}Cn.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),Bn(t)},Cn.blur=t=>{t.observer.clearSelectionRange(),Bn(t)},Cn.compositionstart=Cn.compositionupdate=t=>{null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},Cn.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,De.chrome&&De.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then((()=>t.observer.flush())):setTimeout((()=>{t.inputState.composing<0&&t.docView.compositionDeco.size&&t.update([])}),50)},Cn.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},Cn.beforeinput=(t,e)=>{var i;let n;if(De.chrome&&De.android&&(n=Sn.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 jn=["pre-wrap","normal","pre-line","break-spaces"];class Nn{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){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return jn.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i-1,a=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,a){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)>Jn&&(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:a,toA:l,fromB:h,toB:c}=n[o],u=s.lineAt(a,Hn.ByPosNoHeight,i.setDoc(e),0,0),d=u.to>=l?u:s.lineAt(l,Hn.ByPosNoHeight,i,0,0);for(c+=d.to-l,l=d.to;o>0&&u.from<=n[o-1].toA;)a=n[o-1].fromA,h=n[o-1].fromB,o--,a2*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 es extends ts{constructor(t,e){super(t,e,ii.Text),this.collapsed=0,this.widgetHeight=0}replace(t,e,i){let n=i[0];return 1==i.length&&(n instanceof es||n instanceof is&&4&n.flags)&&Math.abs(this.length-n.length)<10?(n instanceof is?n=new es(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.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class is 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:a}=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),l=o+r.length*a,h=Math.max(i,t-l/2);return new Fn(r.from,r.length,h,l,ii.Text)}{let n=Math.max(0,Math.min(r-s,Math.floor((t-i)/o))),{from:a,length:l}=e.doc.line(s+n);return new Fn(a,l,i+o*n,o,ii.Text)}}lineAt(t,e,i,n,s){if(e==Hn.ByHeight)return this.blockAt(t,i,n,s);if(e==Hn.ByPosNoHeight){let{from:e,to:n}=i.doc.lineAt(t);return new Fn(e,n-e,0,0,ii.Text)}let{firstLine:r,perLine:o,perChar:a}=this.heightMetrics(i,s),l=i.doc.lineAt(t),h=o+l.length*a,c=l.number-r,u=n+o*c+a*(l.from-s-c);return new Fn(l.from,l.length,Math.max(n,Math.min(u,n+this.height-h)),h,ii.Text)}forEachLine(t,e,i,n,s,r){t=Math.max(t,s),e=Math.min(e,s+this.length);let{firstLine:o,perLine:a,perChar:l}=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+=a*i+l*(t-s-i)}let n=a+l*e.length;r(new Fn(e.from,e.length,c,n,ii.Text)),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 is?i[i.length-1]=new is(t.length+n):i.push(null,new is(n-1))}if(t>0){let e=i[0];e instanceof is?i[0]=new is(t+e.length):i.unshift(new is(t-1),null)}return Kn.of(i)}decomposeLeft(t,e){e.push(new is(t-1),null)}decomposeRight(t,e){e.push(null,new is(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 is(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)>=Jn&&(o=-2);let a=new es(e,s);a.outdated=!1,i.push(a),r+=e+1}r<=s&&i.push(null,new is(s-r).updateHeight(t,r));let a=Kn.of(i);return(o<0||Math.abs(a.height-this.height)>=Jn||Math.abs(o-this.heightMetrics(t,e).perLine)>=Jn)&&(t.heightChanged=!0),a}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class ns 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 l;let h=e==Hn.ByPosNoHeight?Hn.ByPosNoHeight:Hn.ByPos;return a?l.join(this.right.lineAt(o,h,i,r,o)):this.left.lineAt(o,h,i,n,s).join(l)}forEachLine(t,e,i,n,s,r){let o=n+this.left.height,a=s+this.left.length+this.break;if(this.break)t=a&&this.right.forEachLine(t,e,i,o,a,r);else{let l=this.lineAt(a,Hn.ByPos,i,n,s);t=t&&l.from<=e&&r(l),e>l.to&&this.right.forEachLine(l.to+1,e,i,o,a,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&&ss(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,a=null;return n&&n.from<=e+s.length&&n.more?a=s=s.updateHeight(t,e,i,n):s.updateHeight(t,e,i),n&&n.from<=o+r.length&&n.more?a=r=r.updateHeight(t,o,i,n):r.updateHeight(t,o,i),a?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 ss(t,e){let i,n;null==t[e]&&(i=t[e-1])instanceof is&&(n=t[e+1])instanceof is&&t.splice(e-1,3,new is(i.length+1+n.length))}class rs{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 es?i.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new es(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)}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 es(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let i=new is(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 es)return t;let e=new es(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine(),t.type!=ii.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,t.type!=ii.WidgetBefore&&(this.covering=t)}addLineDeco(t,e){let i=this.ensureLine();i.length+=e,i.collapsed+=e,i.widgetHeight=Math.max(i.widgetHeight,t),this.writtenTo=this.pos=this.pos+e}finish(t){let e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof es||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),a=Math.max(a,n.top),l=e==t.parentNode?n.bottom:Math.min(l,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:a-(i.top+e),bottom:Math.max(a,l)-(i.top+e)}}function ls(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class hs{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 Nn(i),this.stateDeco=e.facet(Ti).filter((t=>"function"!=typeof t)),this.heightMap=Kn.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle.setDoc(e.doc),[new Mi(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ni.set(this.lineGaps.map((t=>t.draw(!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 ds(e,i))}}this.viewports=t.sort(((t,e)=>t.from-e.from)),this.scaler=this.heightMap.height<=7e6?gs:new ms(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:bs(t,this.scaler))}))}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=this.state.facet(Ti).filter((t=>"function"!=typeof t));let n=t.changedRanges,s=Mi.extendWithRanges(n,function(t,e,i){let n=new os;return _t.compare(t,e,i,n,0),n.changes}(i,this.stateDeco,t?t.changes:k.empty(this.state.doc.length))),r=this.heightMap.height;this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),s),this.heightMap.height!=r&&(t.flags|=2);let o=s.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.heado.to)||!this.viewportIsAppropriate(o))&&(o=this.getViewport(0,e));let a=!t.changes.empty||2&t.flags||o.from!=this.viewport.from||o.to!=this.viewport.to;this.viewport=o,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(Si)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let i=e.contentDOM,n=window.getComputedStyle(i),s=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Wi.RTL:Wi.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),a=i.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let h=0,c=0,u=parseInt(n.paddingTop)||0,d=parseInt(n.paddingBottom)||0;this.paddingTop==u&&this.paddingBottom==d||(this.paddingTop=u,this.paddingBottom=d,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let f=(this.printing?ls:as)(i,this.paddingTop),p=f.top-this.pixelViewport.top,O=f.bottom-this.pixelViewport.bottom;this.pixelViewport=f;let g=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(g!=this.inView&&(this.inView=g,g&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let m=a.width;if(this.contentDOMWidth==m&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,h|=8),l){let i=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(i)&&(o=!0),o||s.lineWrapping&&Math.abs(m-this.contentDOMWidth)>s.charWidth){let{lineHeight:t,charWidth:n,textHeight:a}=e.docView.measureTextSize();o=t>0&&s.refresh(r,t,n,a,m/n,i),o&&(e.docView.minWidth=0,h|=8)}p>0&&O>0?c=Math.max(p,O):p<0&&O<0&&(c=Math.min(p,O)),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 Mi(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new Gn(n.from,r))}s.heightChanged&&(h|=2)}let b=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return b&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(2&h||b)&&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,a=new ds(n.lineAt(r-1e3*i,Hn.ByHeight,s,0,0).from,n.lineAt(o+1e3*(1-i),Hn.ByHeight,s,0,0).to);if(e){let{head:t}=e.range;if(ta.to){let i,r=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=n.lineAt(t,Hn.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!=Wi.LTR&&!i)return[];let o=[],a=(n,r,l,h)=>{if(r-nn&&tt.from>=l.from&&t.to<=l.to&&Math.abs(t.from-n)t.frome))));if(!d){if(rt.from<=r&&t.to>=r))){let t=e.moveToLineBoundary(A.cursor(r),!1,!0).head;t>n&&(r=t)}d=new hs(n,r,this.gapSize(l,n,r,h))}o.push(d)};for(let t of this.viewportLines){if(t.lengtht.from&&a(t.from,s,t,e),ot.draw(this.heightOracle.lineWrapping)))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];_t.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))||bs(this.heightMap.lineAt(t,Hn.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return bs(this.heightMap.lineAt(this.scaler.fromDOM(t),Hn.ByHeight,this.heightOracle,0,0),this.scaler)}elementAtHeight(t){return bs(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 ds{constructor(t,e){this.from=t,this.to=e}}function fs(t,e,i){let n=[],s=t,r=0;return _t.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 Os(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 gs={toDOM:t=>t,fromDOM:t=>t,scale:1};class ms{constructor(t,e,i){let n=0,s=0,r=0;this.viewports=i.map((({from:i,to:s})=>{let r=e.lineAt(i,Hn.ByPos,t,0,0).top,o=e.lineAt(s,Hn.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=ebs(t,e))):t.type)}const ws=E.define({combine:t=>t.join(" ")}),vs=E.define({combine:t=>t.indexOf(!0)>-1}),ys=It.newName(),Ss=It.newName(),xs=It.newName(),ks={"&light":"."+Ss,"&dark":"."+xs};function Qs(t,e,i){return new It(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 $s=Qs("."+ys,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",borderRadius:"4px",marginTop:"0.5rem",width:"30%",minWidth:"190px",marginLeft:"auto",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&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:"#333338",fontSize:"70%",padding:".2em 1em",borderRadius:"4px"},"&light .cm-button":{background:"#eee"},"&dark .cm-button":{background:"#eee"},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",borderRadius:"0.25rem",border:"1px solid silver",padding:".0em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},ks);class Ps{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;i&&(e.push(new nn(i,n)),s==i&&r==n||e.push(new nn(s,r)));return e}(t),i=new tn(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?A.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||!ne(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||!ne(t.contentDOM,e.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(e.anchorNode,e.anchorOffset);this.newSel=A.single(n,i)}}}function Cs(e,i){let n,{newSel:s}=i,r=e.state.selection.main;if(i.bounds){let{from:s,to:o}=i.bounds,a=r.from,l=null;(8===e.inputState.lastKeyCode&&e.inputState.lastKeyTime>Date.now()-100||De.android&&i.text.length0&&a>0&&t.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if("end"==n){i-=o+Math.max(0,r-Math.min(o,a))-r}if(o=o?r-i:0,a=r+(a-o),o=r}else if(a=a?r-i:0,o=r+(o-a),a=r}return{from:r,toA:o,toB:a}}(e.state.doc.sliceString(s,o,Ki),i.text,a-s,l);h&&(De.chrome&&13==e.inputState.lastKeyCode&&h.toB==h.from+2&&i.text.slice(h.from,h.toB)==Ki+Ki&&h.toB--,n={from:s+h.from,to:s+h.toA,insert:t.of(i.text.slice(h.from,h.toB).split(Ki))})}else s&&(!e.hasFocus&&e.state.facet($i)||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))}:(De.mac||De.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=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}):De.chrome&&n&&n.from==n.to&&n.from==r.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(s&&(s=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}),n){let t=e.state;if(De.ios&&e.inputState.flushIOSKey(e))return!0;if(De.android&&(n.from==r.from&&n.to==r.to&&1==n.insert.length&&2==n.insert.lines&&be(e.contentDOM,"Enter",13)||n.from==r.from-1&&n.to==r.to&&0==n.insert.length&&be(e.contentDOM,"Backspace",8)||n.from==r.from&&n.to==r.to+1&&0==n.insert.length&&be(e.contentDOM,"Delete",46)))return!0;let i,o=n.insert.toString();if(e.state.facet(wi).some((t=>t(e,n.from,n.to,o))))return!0;if(e.inputState.composing>=0&&e.inputState.composing++,n.from>=r.from&&n.to<=r.to&&n.to-n.from>=(r.to-r.from)/3&&(!s||s.main.empty&&s.main.from==n.from+n.insert.length)&&e.inputState.composing<0){let s=r.fromn.to?t.sliceDoc(n.to,r.to):"";i=t.replaceSelection(e.state.toText(s+n.insert.sliceString(0,void 0,e.state.lineBreak)+o))}else{let o=t.changes(n),a=s&&s.main.to<=o.newLength?s.main:void 0;if(t.selection.ranges.length>1&&e.inputState.composing>=0&&n.to<=r.to&&n.to>=r.to-10){let s=e.state.sliceDoc(n.from,n.to),l=on(e)||e.state.doc.lineAt(r.head),h=r.to-n.to,c=r.to-r.from;i=t.changeByRange((i=>{if(i.from==r.from&&i.to==r.to)return{changes:o,range:a||i.map(o)};let u=i.to-h,d=u-s.length;if(i.to-i.from!=c||e.state.sliceDoc(d,u)!=s||l&&i.to>=l.from&&i.from<=l.to)return{range:i};let f=t.changes({from:d,to:u,insert:n.insert}),p=i.to-r.to;return{changes:f,range:a?A.range(Math.max(0,a.anchor+p),Math.max(0,a.head+p)):i.map(f)}}))}else i={changes:o,selection:a&&t.selection.replaceRange(a)}}let a="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,a+=".compose",e.inputState.compositionFirstChange&&(a+=".start",e.inputState.compositionFirstChange=!1)),e.dispatch(i,{scrollIntoView:!0,userEvent:a}),!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 _s={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Xs=De.ie&&De.ie_version<=11;class Zs{constructor(t){this.view=t,this.active=!1,this.selectionRange=new fe,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);(De.ie&&De.ie_version<=11||De.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()})),Xs&&(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")))}),{}),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($i)?i.root.activeElement!=this.dom:!se(i.dom,n))return;let s=n.anchorNode&&i.docView.nearest(n.anchorNode);s&&s.ignoreEvent(t)?e||(this.selectionChanged=!1):(De.ie&&De.ie_version<=11||De.android&&De.chrome)&&!i.state.selection.main.empty&&n.focusNode&&oe(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=De.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,a=t.docView.domAtPos(t.state.selection.main.anchor);oe(a.node,a.offset,r,o)&&([n,s,r,o]=[r,o,n,s]);return{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:o}}(this.view)||ie(t.root);if(!e||this.selectionRange.eq(e))return!1;let i=se(this.dom,e);return i&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let t=this.delayedAndroidKey;t&&(this.clearDelayedAndroidKey(),!this.flush()&&t.force&&be(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&&se(this.dom,this.selectionRange);return t<0&&!n?null:(t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new Ps(this.view,t,e,i))}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=Cs(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.dirty|=4),"childList"==t.type){let i=As(e,t.previousSibling||t.target.previousSibling,-1),n=As(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 As(t,e,i){for(;e;){let n=Se.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 Ts{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),this._dispatch=t.dispatch||(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 us(t.state||xt.create(t)),this.plugins=this.state.facet(Ci).map((t=>new Xi(t)));for(let t of this.plugins)t.update(this);this.observer=new Zs(this),this.inputState=new yn(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new sn(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),t.parent&&t.parent.appendChild(this.dom)}get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}dispatch(...t){this._dispatch(1==t.length&&t[0]instanceof dt?t[0]:this.state.update(...t))}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,a=null;t.some((t=>t.annotation(zn)))?(this.inputState.notifiedFocused=r,o=1):r!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=r,a=In(s,r),a||(o=1));let l=this.observer.delayedAndroidKey,h=null;if(l?(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(xt.phrases)!=this.state.facet(xt.phrases))return this.setState(s);e=Di.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 xi(t.empty?t:A.cursor(t.head,t.head>t.anchor?-1:1))}for(let t of e.effects)t.is(ki)&&(c=t.value)}this.viewState.update(e,c),this.bidiCache=Vs.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),i=this.docView.update(e),this.state.facet(Vi)!=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(ws)!=e.state.facet(ws)&&(this.viewState.mustMeasureContent=!0),(i||n||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!e.empty)for(let t of this.state.facet(bi))t(e);(a||h)&&Promise.resolve().then((()=>{a&&this.state==a.startState&&this.dispatch(a),h&&!Cs(this,h)&&l.force&&be(this.contentDOM,l.key,l.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 us(t),this.plugins=t.facet(Ci).map((t=>new Xi(t))),this.pluginMap.clear();for(let t of this.plugins)t.update(this);this.docView=new sn(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(Ci),i=t.state.facet(Ci);if(e!=i){let n=[];for(let s of i){let i=e.indexOf(s);if(i<0)n.push(new Xi(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.measureScheduled=0,t&&this.observer.forceFlush();let e=null,{scrollHeight:i,scrollTop:n,clientHeight:s}=this.scrollDOM,r=n>i-s-4?i:n;try{for(let t=0;;t++){this.updateState=1;let i=this.viewport,n=this.viewState.lineBlockAtHeight(r),s=this.viewState.measure(this);if(!s&&!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 o=[];4&s||([this.measureRequests,o]=[o,this.measureRequests]);let a=o.map((t=>{try{return t.read(this)}catch(t){return Qi(this.state,t),Es}})),l=Di.create(this,this.state,[]),h=!1,c=!1;l.flags|=s,e?e.flags|=s:e=l,this.updateState=2,l.empty||(this.updatePlugins(l),this.inputState.update(l),this.updateAttrs(),h=this.docView.update(l));for(let t=0;t1||t<-1)&&(this.scrollDOM.scrollTop+=t,c=!0)}if(h&&this.docView.updateSelection(!0),this.viewport.from==i.from&&this.viewport.to==i.to&&!c&&0==this.measureRequests.length)break}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let t of this.state.facet(bi))t(e)}get themeClasses(){return ys+" "+(this.state.facet(vs)?xs:Ss)+" "+this.state.facet(ws)}updateAttrs(){let t=Ms(this,Zi,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet($i)?"true":"false",class:"cm-content",style:`${De.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Ms(this,Ai,e);let i=this.observer.ignore((()=>{let i=ti(this.contentDOM,this.contentAttrs,e),n=ti(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)if(t.is(Ts.announce)){e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(Vi),It.mount(this.root,this.styleModules.concat($s).reverse())}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}}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 vn(this,t,wn(this,t,e,i))}moveByCharSelected(t,e,i){return vn(this,t,wn(this,t,e,i),!0)}moveByGroup(t,e){return vn(this,t,wn(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==wt.Space&&(s=e),s==e}}(this,t.head,e))))}moveToLineBoundary(t,e,i=!0){return function(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=n&&t.lineWrapping?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==Wi.LTR)?e.right-1:e.left+1,y:(r.top+r.bottom)/2});if(null!=o)return A.cursor(o,i?-1:1)}let o=hi.find(t.docView,e.head),a=o?i?o.posAtEnd:o.posAtStart:i?s.to:s.from;return A.cursor(a,i?-1:1)}(this,t,e,i)}moveVertically(t,e,i){return vn(this,t,function(t,e,i,n){let s=e.head,r=i?1:-1;if(s==(i?t.state.doc.length:0))return A.cursor(s,e.assoc);let o,a=e.goalColumn,l=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s),c=t.documentTop;if(h)null==a&&(a=h.left-l.left),o=r<0?h.top:h.bottom;else{let e=t.viewState.lineBlockAt(s);null==a&&(a=Math.min(l.right-l.left,t.defaultCharacterWidth*(s-e.from))),o=(r<0?e.top:e.bottom)+c}let u=l.left+a,d=null!=n?n:t.defaultLineHeight>>1;for(let i=0;;i+=10){let n=o+(d+i)*r,h=mn(t,{x:u,y:n},!1,r);if(nl.bottom||(r<0?hs))return A.cursor(h,e.assoc,void 0,a)}}(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(),mn(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 ue(i,s[Ni.find(s,t-n.from,-1,e)].dir==Wi.LTR==e>0)}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(yi)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Rs)return Fi(t.length);let e=this.textDirectionAt(t.from);for(let i of this.bidiCache)if(i.from==t.from&&i.dir==e)return i.order;let i=function(t,e){let i=t.length,n=e==Ui?1:2,s=e==Ui?2:1;if(!t||1==n&&!ji.test(t))return Fi(i);for(let e=0,s=n,o=n;e=0;t-=3)if(Bi[t+1]==-r){let e=Bi[t+2],i=2&e?n:4&e?1&e?s:n:0;i&&(Gi[a]=Gi[Bi[t]]=i),l=t;break}}else{if(189==Bi.length)break;Bi[l++]=a,Bi[l++]=e,Bi[l++]=h}else if(2==(o=Gi[a])||1==o){let t=o==n;h=t?0:1;for(let e=l-3;e>=0;e-=3){let i=Bi[e+2];if(2&i)break;if(t)Bi[e+2]|=2;else{if(4&i)break;Bi[e+2]|=4}}}for(let t=0;te;){let t=i,n=2!=Gi[--i];for(;i>e&&n==(2!=Gi[i-1]);)i--;o.push(new Ni(i,t,n?2:1))}else o.push(new Ni(e,t,0))}else for(let t=0;tDate.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{ge(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 ki.of(new xi("number"==typeof t?A.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}static domEventHandlers(t){return _i.define((()=>({})),{eventHandlers:t})}static theme(t,e){let i=It.newName(),n=[ws.of(i),Vi.of(Qs(`.${i}`,t))];return e&&e.dark&&n.push(vs.of(!0)),n}static baseTheme(t){return N.lowest(Vi.of(Qs("."+ys,t,ks)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),n=i&&Se.get(i)||Se.get(t);return(null===(e=null==n?void 0:n.rootView)||void 0===e?void 0:e.view)||null}}Ts.styleModule=Vi,Ts.inputHandler=wi,Ts.focusChangeEffect=vi,Ts.perLineTextDirection=yi,Ts.exceptionSink=mi,Ts.updateListener=bi,Ts.editable=$i,Ts.mouseSelectionStyle=gi,Ts.dragMovesSelection=Oi,Ts.clickAddsSelectionRange=pi,Ts.decorations=Ti,Ts.atomicRanges=Ri,Ts.scrollMargins=Ei,Ts.darkTheme=vs,Ts.contentAttributes=Ai,Ts.editorAttributes=Zi,Ts.lineWrapping=Ts.contentAttributes.of({class:"cm-lineWrapping"}),Ts.announce=ut.define();const Rs=4096,Es={};class Vs{constructor(t,e,i,n){this.from=t,this.to=e,this.dir=i,this.order=n}static update(t,e){if(e.empty)return t;let i=[],n=t.length?t[t.length-1].dir:Wi.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&&Je(r,i)}return i}const Ds=De.mac?"mac":De.windows?"win":De.linux?"linux":"key";function Ws(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 Us=N.default(Ts.domEventHandlers({keydown:(t,e)=>Bs(Ls(e.state),t,e,"editor")})),Ys=E.define({enables:Us}),qs=new WeakMap;function Ls(t){let e=t.facet(Ys),i=qs.get(e);return i||qs.set(e,i=function(t,e=Ds){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)=>{var a,l;let h=i[t]||(i[t]=Object.create(null)),c=n.split(/ (?!$)/).map((t=>function(t,e){const i=t.split(/-(?!$)/);let n,s,r,o,a=i[i.length-1];"Space"==a&&(a=" ");for(let t=0;t{let n=zs={view:e,prefix:i,scope:t};return setTimeout((()=>{zs==n&&(zs=null)}),Is),!0}]})}let u=c.join(" ");s(u,!1);let d=h[u]||(h[u]={preventDefault:!1,run:(null===(l=null===(a=h._any)||void 0===a?void 0:a.run)||void 0===l?void 0:l.slice())||[]});r&&d.run.push(r),o&&(d.preventDefault=!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,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.shift&&r(e,"Shift-"+s,n.shift,n.preventDefault)}return i}(e.reduce(((t,e)=>t.concat(e)),[]))),i}let zs=null;const Is=4e3;function Bs(t,e,i,n){let s=function(t){var e=!(Kt&&(t.ctrlKey||t.altKey||t.metaKey)||Jt&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?Gt:Nt)[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=v(b(s,0))==s.length&&" "!=s,o="",a=!1;zs&&zs.view==i&&zs.scope==n&&(o=zs.prefix+" ",(a=kn.indexOf(e.keyCode)<0)&&(zs=null));let l,h,c=new Set,u=t=>{if(t){for(let n of t.run)if(!c.has(n)&&(c.add(n),n(i,e)))return!0;t.preventDefault&&(a=!0)}return!1},d=t[n];if(d){if(u(d[o+Ws(s,e,!r)]))return!0;if(r&&(e.altKey||e.metaKey||e.ctrlKey)&&!(De.windows&&e.ctrlKey&&e.altKey)&&(l=Nt[e.keyCode])&&l!=s){if(u(d[o+Ws(l,e,!0)]))return!0;if(e.shiftKey&&(h=Gt[e.keyCode])!=s&&h!=l&&u(d[o+Ws(h,e,!1)]))return!0}else if(r&&e.shiftKey&&u(d[o+Ws(s,e,!0)]))return!0;if(u(d._any))return!0}return a}class js{constructor(t,e,i,n,s){this.className=t,this.left=e,this.top=i,this.width=n,this.height=s}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className==this.className&&(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",null!=this.width&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,i){if(i.empty){let n=t.coordsAtPos(i.head,i.assoc||1);if(!n)return[];let s=Ns(t);return[new js(e,n.left-s.left,n.top-s.top,null,n.bottom-n.top)]}return function(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];let n=Math.max(i.from,t.viewport.from),s=Math.min(i.to,t.viewport.to),r=t.textDirection==Wi.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=Ns(t),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),u=a.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),d=a.right-(c?parseInt(c.paddingRight):0),f=Fs(t,n),p=Fs(t,s),O=f.type==ii.Text?f:null,g=p.type==ii.Text?p:null;t.lineWrapping&&(O&&(O=Gs(t,n,O)),g&&(g=Gs(t,s,g)));if(O&&g&&O.from==g.from)return b(w(i.from,i.to,O));{let e=O?w(i.from,null,O):v(f,!1),n=g?w(null,i.to,g):v(p,!0),s=[];return(O||f).to<(g||p).from-1?s.push(m(u,e.bottom,d,n.top)):e.bottomh&&n.from=r)break;a>s&&l(Math.max(t,s),null==e&&t<=h,Math.min(a,r),null==i&&a>=c,o.dir)}if(s=n.to+1,s>=r)break}return 0==a.length&&l(h,null==e,c,null==i,t.textDirection),{top:s,bottom:o,horizontal:a}}function v(t,e){let i=a.top+(e?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]}}}(t,e,i)}}function Ns(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Wi.LTR?e.left:e.right-t.scrollDOM.clientWidth)-t.scrollDOM.scrollLeft,top:e.top-t.scrollDOM.scrollTop}}function Gs(t,e,i){let n=A.cursor(e);return{from:Math.max(i.from,t.moveToLineBoundary(n,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(n,!0,!0).from),type:ii.Text}}function Fs(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==ii.Text))return t;return i}class Hs{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),e.above&&this.dom.classList.add("cm-layer-above"),e.class&&this.dom.classList.add(e.class),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(Js)!=t.state.facet(Js)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&t.view.requestMeasure(this.measureReq)}setOrder(t){let e=0,i=t.facet(Js);for(;e{return i=t,n=this.drawn[e],!(i.constructor==n.constructor&&i.eq(n));var i,n}))){let e=this.dom.firstChild,i=0;for(let n of t)n.update&&e&&n.constructor&&this.drawn[i].constructor&&n.update(e,this.drawn[i])?(e=e.nextSibling,i++):this.dom.insertBefore(n.draw(),e);for(;e;){let t=e.nextSibling;e.remove(),e=t}this.drawn=t}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Js=E.define();function Ks(t){return[_i.define((e=>new Hs(e,t))),Js.of(t)]}const tr=!De.ios,er=E.define({combine:t=>kt(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})});function ir(t={}){return[er.of(t),sr,or,lr,Si.of(!0)]}function nr(t){return t.startState.facet(er)!=t.state.facet(er)}const sr=Ks({above:!0,markers(t){let{state:e}=t,i=e.facet(er),n=[];for(let s of e.selection.ranges){let r=s==e.selection.main;if(s.empty?!r||tr:i.drawRangeCursor){let e=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",i=s.empty?s:A.cursor(s.head,s.head>s.anchor?-1:1);for(let s of js.forRange(t,e,i))n.push(s)}}return n},update(t,e){t.transactions.some((t=>t.selection))&&(e.style.animationName="cm-blink"==e.style.animationName?"cm-blink2":"cm-blink");let i=nr(t);return i&&rr(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){rr(e.state,t)},class:"cm-cursorLayer"});function rr(t,e){e.style.animationDuration=t.facet(er).cursorBlinkRate+"ms"}const or=Ks({above:!1,markers:t=>t.state.selection.ranges.map((e=>e.empty?[]:js.forRange(t,"cm-selectionBackground",e))).reduce(((t,e)=>t.concat(e))),update:(t,e)=>t.docChanged||t.selectionSet||t.viewportChanged||nr(t),class:"cm-selectionLayer"}),ar={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};tr&&(ar[".cm-line"].caretColor="transparent !important");const lr=N.highest(Ts.theme(ar)),hr=ut.define({map:(t,e)=>null==t?null:e.mapPos(t)}),cr=q.define({create:()=>null,update:(t,e)=>(null!=t&&(t=e.changes.mapPos(t)),e.effects.reduce(((t,e)=>e.is(hr)?e.value:t),t))}),ur=_i.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let i=t.state.field(cr);null==i?null!=this.cursor&&(null===(e=this.cursor)||void 0===e||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(cr)!=i||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let t=this.view.state.field(cr),e=null!=t&&this.view.coordsAtPos(t);if(!e)return null;let i=this.view.scrollDOM.getBoundingClientRect();return{left:e.left-i.left+this.view.scrollDOM.scrollLeft,top:e.top-i.top+this.view.scrollDOM.scrollTop,height:e.bottom-e.top}}drawCursor(t){this.cursor&&(t?(this.cursor.style.left=t.left+"px",this.cursor.style.top=t.top+"px",this.cursor.style.height=t.height+"px"):this.cursor.style.left="-100000px")}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(cr)!=t&&this.view.dispatch({effects:hr.of(t)})}},{eventHandlers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){t.target!=this.view.contentDOM&&this.view.contentDOM.contains(t.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function dr(){return[cr,ur]}function fr(t,e,i,n,s){e.lastIndex=0;for(let r,o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)if(!o.lineBreak)for(;r=e.exec(o.value);)s(a+r.index,r)}class pr{constructor(t){const{regexp:e,decoration:i,decorate:n,boundary:s,maxLength:r=1e3}=t;if(!e.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=e,n)this.addMatch=(t,e,i,s)=>n(s,i,i+t[0].length,t,e);else if("function"==typeof i)this.addMatch=(t,e,n,s)=>{let r=i(t,e,n);r&&s(n,n+t[0].length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(t,e,n,s)=>s(n,n+t[0].length,i)}this.boundary=s,this.maxLength=r}createDeco(t){let e=new Xt,i=e.add.bind(e);for(let{from:e,to:n}of function(t,e){let i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;let n=[];for(let{from:s,to:r}of i)s=Math.max(t.state.doc.lineAt(s).from,s-e),r=Math.min(t.state.doc.lineAt(r).to,r+e),n.length&&n[n.length-1].to>=s?n[n.length-1].to=r:n.push({from:s,to:r});return n}(t,this.maxLength))fr(t.state.doc,this.regexp,e,n,((e,n)=>this.addMatch(n,t,e,i)));return e.finish()}updateDeco(t,e){let i=1e9,n=-1;return t.docChanged&&t.changes.iterChanges(((e,s,r,o)=>{o>t.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e}updateRange(t,e,i,n){for(let s of t.visibleRanges){let r=Math.max(s.from,i),o=Math.min(s.to,n);if(o>r){let i=t.state.doc.lineAt(r),n=i.toi.from;r--)if(this.boundary.test(i.text[r-1-i.from])){a=r;break}for(;oc.push(i.range(t,e));if(i==n)for(this.regexp.lastIndex=a-i.from;(h=this.regexp.exec(i.text))&&h.indexthis.addMatch(i,t,e,u)));e=e.update({filterFrom:a,filterTo:l,filter:(t,e)=>tl,add:c})}}return e}}const Or=null!=/x/.unicode?"gu":"g",gr=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",Or),mr={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let br=null;const wr=E.define({combine(t){let e=kt(t,{render:null,specialChars:gr,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==br&&"undefined"!=typeof document&&document.body){let e=document.body.style;br=null!=(null!==(t=e.tabSize)&&void 0!==t?t:e.MozTabSize)}return br||!1}())&&(e.specialChars=new RegExp("\t|"+e.specialChars.source,Or)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Or)),e}});function vr(t={}){return[wr.of(t),yr||(yr=_i.fromClass(class{constructor(t){this.view=t,this.decorations=ni.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(wr)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new pr({regexp:t.specialChars,decoration:(e,i,n)=>{let{doc:s}=i.state,r=b(e[0],0);if(9==r){let t=s.lineAt(n),e=i.state.tabSize,r=Yt(t.text,e,n-t.from);return ni.replace({widget:new xr((e-r%e)*this.view.defaultCharacterWidth)})}return this.decorationCache[r]||(this.decorationCache[r]=ni.replace({widget:new Sr(t,r)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(wr);t.startState.facet(wr)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))]}let yr=null;class Sr extends ei{constructor(t,e){super(),this.options=t,this.code=e}eq(t){return t.code==this.code}toDOM(t){let e=function(t){return t>=32?"•":10==t?"␤":String.fromCharCode(9216+t)}(this.code),i=t.state.phrase("Control character")+" "+(mr[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,i,e);if(n)return n;let s=document.createElement("span");return s.textContent=e,s.title=i,s.setAttribute("aria-label",i),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class xr extends ei{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent="\t",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}class kr extends ei{constructor(t){super(),this.content=t}toDOM(){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):this.content),"string"==typeof this.content?t.setAttribute("aria-label","placeholder "+this.content):t.setAttribute("aria-hidden","true"),t}ignoreEvent(){return!1}}const Qr="-10000px";class $r{constructor(t,e,i){this.facet=e,this.createTooltipView=i,this.input=t.state.facet(e),this.tooltips=this.input.filter((t=>t)),this.tooltipViews=this.tooltips.map(i)}update(t){var e;let i=t.state.facet(this.facet),n=i.filter((t=>t));if(i===this.input){for(let e of this.tooltipViews)e.update&&e.update(t);return!1}let s=[];for(let e=0;e{var e,i,n;return{position:De.ios?"absolute":(null===(e=t.find((t=>t.position)))||void 0===e?void 0:e.position)||"fixed",parent:(null===(i=t.find((t=>t.parent)))||void 0===i?void 0:i.parent)||null,tooltipSpace:(null===(n=t.find((t=>t.tooltipSpace)))||void 0===n?void 0:n.tooltipSpace)||Pr}}}),_r=new WeakMap,Xr=_i.fromClass(class{constructor(t){this.view=t,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(Cr);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new $r(t,Tr,(t=>this.createTooltip(t))),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout((()=>{this.measureTimeout=-1,this.maybeMeasure()}),50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t);e&&this.observeIntersection();let i=e||t.geometryChanged,n=t.state.facet(Cr);if(n.position!=this.position){this.position=n.position;for(let t of this.manager.tooltipViews)t.dom.style.position=this.position;i=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let t of this.manager.tooltipViews)this.container.appendChild(t.dom);i=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure()}createTooltip(t){let e=t.create(this.view);if(e.dom.classList.add("cm-tooltip"),t.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",e.dom.appendChild(t)}return e.dom.style.position=this.position,e.dom.style.top=Qr,this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var t,e;this.view.win.removeEventListener("resize",this.measureSoon);for(let e of this.manager.tooltipViews)e.dom.remove(),null===(t=e.destroy)||void 0===t||t.call(e);null===(e=this.intersectionObserver)||void 0===e||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=this.view.dom.getBoundingClientRect();return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map(((t,e)=>{let i=this.manager.tooltipViews[e];return i.getCoords?i.getCoords(t.pos):this.view.coordsAtPos(t.pos)})),size:this.manager.tooltipViews.map((({dom:t})=>t.getBoundingClientRect())),space:this.view.state.facet(Cr).tooltipSpace(this.view)}}writeMeasure(t){var e;let{editor:i,space:n}=t,s=[];for(let r=0;r=Math.min(i.bottom,n.bottom)||h.rightMath.min(i.right,n.right)+.1){l.style.top=Qr;continue}let u=o.arrow?a.dom.querySelector(".cm-tooltip-arrow"):null,d=u?7:0,f=c.right-c.left,p=null!==(e=_r.get(a))&&void 0!==e?e:c.bottom-c.top,O=a.offset||Ar,g=this.view.textDirection==Wi.LTR,m=c.width>n.right-n.left?g?n.left:n.right-c.width:g?Math.min(h.left-(u?14:0)+O.x,n.right-f):Math.max(n.left,h.left-f+(u?14:0)-O.x),b=!!o.above;!o.strictSide&&(b?h.top-(c.bottom-c.top)-O.yn.bottom)&&b==n.bottom-h.bottom>h.top-n.top&&(b=!b);let w=(b?h.top-n.top:n.bottom-h.bottom)-d;if(wm&&t.topv&&(v=b?t.top-p-2-d:t.bottom+d+2);"absolute"==this.position?(l.style.top=v-t.parent.top+"px",l.style.left=m-t.parent.left+"px"):(l.style.top=v+"px",l.style.left=m+"px"),u&&(u.style.left=h.left+(g?O.x:-O.x)-(m+14-7)+"px"),!0!==a.overlap&&s.push({left:m,top:v,right:y,bottom:v+p}),l.classList.toggle("cm-tooltip-above",b),l.classList.toggle("cm-tooltip-below",!b),a.positioned&&a.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=Qr}},{eventHandlers:{scroll(){this.maybeMeasure()}}}),Zr=Ts.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Ar={x:0,y:0},Tr=E.define({enables:[Xr,Zr]});function Rr(t,e){let i=t.plugin(Xr);if(!i)return null;let n=i.manager.tooltips.indexOf(e);return n<0?null:i.manager.tooltipViews[n]}const Er=E.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 Vr(t,e){let i=t.plugin(Mr),n=i?i.specs.indexOf(e):-1;return n>-1?i.panels[n]:null}const Mr=_i.fromClass(class{constructor(t){this.input=t.state.facet(Ur),this.specs=this.input.filter((t=>t)),this.panels=this.specs.map((e=>e(t)));let e=t.state.facet(Er);this.top=new Dr(t,!0,e.topContainer),this.bottom=new Dr(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(Er);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Dr(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Dr(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(Ur);if(i!=this.input){let e=i.filter((t=>t)),n=[],s=[],r=[],o=[];for(let i of e){let e,a=this.specs.indexOf(i);a<0?(e=i(t.view),o.push(e)):(e=this.panels[a],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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}}))});class Dr{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=Wr(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=Wr(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 Wr(t){let e=t.nextSibling;return t.remove(),e}const Ur=E.define({enables:Mr});class Yr extends Qt{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Yr.prototype.elementClass="",Yr.prototype.toDOM=void 0,Yr.prototype.mapMode=S.TrackBefore,Yr.prototype.startSide=Yr.prototype.endSide=-1,Yr.prototype.point=!0;const qr=E.define(),Lr={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>_t.empty,lineMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},zr=E.define();function Ir(t){return[jr(),zr.of(Object.assign(Object.assign({},Lr),t))]}const Br=E.define({combine:t=>t.some((t=>t))});function jr(t){let e=[Nr];return t&&!1===t.fixed&&e.push(Br.of(!0)),e}const Nr=_i.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+"px",this.gutters=t.state.facet(zr).map((e=>new Jr(t,e)));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!t.state.facet(Br),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(Br)!=!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=_t.iter(this.view.state.facet(qr),this.view.viewport.from),n=[],s=this.gutters.map((t=>new Hr(t,this.view.viewport,-this.view.documentPadding.top)));for(let t of this.view.viewportLineBlocks){let e;if(Array.isArray(t.type)){for(let i of t.type)if(i.type==ii.Text){e=i;break}}else e=t.type==ii.Text?t:void 0;if(e){n.length&&(n=[]),Fr(i,n,t.from);for(let t of s)t.line(this.view,e,n)}}for(let t of s)t.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(zr),i=t.state.facet(zr),n=t.docChanged||t.heightChanged||t.viewportChanged||!_t.eq(t.startState.facet(qr),t.state.facet(qr),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 Jr(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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&0!=i.gutters.length&&i.fixed?e.textDirection==Wi.LTR?{left:i.dom.offsetWidth}:{right:i.dom.offsetWidth}:null}))});function Gr(t){return Array.isArray(t)?t:[t]}function Fr(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class Hr{constructor(t,e,i){this.gutter=t,this.height=i,this.i=0,this.cursor=_t.iter(t.markers,e.from)}line(t,e,i){let n=[];Fr(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;if(0==n.length&&!r.config.renderEmptyElements)return;let o=e.top-this.height;if(this.i==r.elements.length){let i=new Kr(t,e.height,o,n);r.elements.push(i),r.dom.appendChild(i.dom)}else r.elements[this.i].update(t,e.height,o,n);this.height=e.bottom,this.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 Jr{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=Gr(e.markers(t)),e.initialSpacer&&(this.spacer=new Kr(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=Gr(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!_t.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 Kr{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.dom.style.height=(this.height=e)+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),function(t,e){if(t.length!=e.length)return!1;for(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 io extends Yr{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function no(t,e){return t.state.facet(eo).formatNumber(e,t.state)}const so=zr.compute([eo],(t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:t=>t.state.facet(to),lineMarker:(t,e,i)=>i.some((t=>t.toDOM))?null:new io(no(t,t.state.doc.lineAt(e.from).number)),lineMarkerChange:t=>t.startState.facet(eo)!=t.state.facet(eo),initialSpacer:t=>new io(no(t,ro(t.state.doc.lines))),updateSpacer(t,e){let i=no(e.view,ro(e.view.state.doc.lines));return i==t.number?t:new io(i)},domEventHandlers:t.facet(eo).domEventHandlers})));function ro(t){let e=9;for(;e{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=fo.match(t)),e=>{let i=t(e);return void 0===i?null:[this,i]}}}ho.closedBy=new ho({deserialize:t=>t.split(" ")}),ho.openedBy=new ho({deserialize:t=>t.split(" ")}),ho.group=new ho({deserialize:t=>t.split(" ")}),ho.contextHash=new ho({perNode:!0}),ho.lookAhead=new ho({perNode:!0}),ho.mounted=new ho({perNode:!0});class co{constructor(t,e,i){this.tree=t,this.overlay=e,this.parser=i}}const uo=Object.create(null);class fo{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):uo,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),n=new fo(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(ho.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(ho.group),n=-1;n<(i?i.length:0);n++){let s=e[n<0?t.name:i[n]];if(s)return s}}}}fo.none=new fo("",Object.create(null),0,8);class po{constructor(t){this.types=t;for(let e=0;e=n&&(r.type.isAnonymous||!1!==e(r))){if(r.firstChild())continue;t=!0}for(;t&&i&&!r.type.isAnonymous&&i(r),!r.nextSibling();){if(!r.parent())return;t=!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:To(fo.none,this.children,this.positions,0,this.children.length,0,this.length,((t,e,i)=>new bo(this.type,t,e,i,this.propValues)),t.makeTree||((t,e,i)=>new bo(fo.none,t,e,i)))}static build(t){return function(t){var e;let{buffer:i,nodeSet:n,maxBufferLength:s=oo,reused:r=[],minRepeatType:o=n.types.length}=t,a=Array.isArray(i)?new wo(i,i.length):i,l=n.types,h=0,c=0;function u(t,e,i,m,b){let{id:w,start:v,end:y,size:S}=a,x=c;for(;S<0;){if(a.next(),-1==S){let e=r[w];return i.push(e),void m.push(v-t)}if(-3==S)return void(h=w);if(-4==S)return void(c=w);throw new RangeError(`Unrecognized record size: ${S}`)}let k,Q,$=l[w],P=v-t;if(y-v<=s&&(Q=O(a.pos-e,b))){let e=new Uint16Array(Q.size-Q.skip),i=a.pos-Q.size,s=e.length;for(;a.pos>i;)s=g(Q.start,e,s);k=new vo(e,y-Q.start,n),P=Q.start-t}else{let t=a.pos-S;a.next();let e=[],i=[],n=w>=o?w:-1,r=0,l=y;for(;a.pos>t;)n>=0&&a.id==n&&a.size>=0?(a.end<=l-s&&(f(e,i,v,r,a.end,l,n,x),r=e.length,l=a.end),a.next()):u(v,t,e,i,n);if(n>=0&&r>0&&r-1&&r>0){let t=d($);k=To($,e,i,0,e.length,0,y-v,t,t)}else k=p($,e,i,y-v,x-y)}i.push(k),m.push(P)}function d(t){return(e,i,n)=>{let s,r,o=0,a=e.length-1;if(a>=0&&(s=e[a])instanceof bo){if(!a&&s.type==t&&s.length==n)return s;(r=s.prop(ho.lookAhead))&&(o=i[a]+s.length+r)}return p(t,e,i,n,o)}}function f(t,e,i,s,r,o,a,l){let h=[],c=[];for(;t.length>s;)h.push(t.pop()),c.push(e.pop()+i-r);t.push(p(n.types[a],h,c,o-r,l-o)),e.push(r-i)}function p(t,e,i,n,s=0,r){if(h){let t=[ho.contextHash,h];r=r?[t].concat(r):[t]}if(s>25){let t=[ho.lookAhead,s];r=r?[t].concat(r):[t]}return new bo(t,e,i,n,r)}function O(t,e){let i=a.fork(),n=0,r=0,l=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=l,l+=4,n+=4,i.next();continue}let a=i.pos-t;if(t<0||a=o?4:0,d=i.start;for(i.next();i.pos>a;){if(i.size<0){if(-3!=i.size)break t;u+=4}else i.id>=o&&(u+=4);i.next()}r=d,n+=t,l+=u}return(e<0||n==t)&&(c.size=n,c.start=r,c.skip=l),c.size>4?c:void 0}function g(t,e,i){let{id:n,start:s,end:r,size:l}=a;if(a.next(),l>=0&&n4){let n=a.pos-(l-4);for(;a.pos>n;)i=g(t,e,i)}e[--i]=o,e[--i]=r-t,e[--i]=s-t,e[--i]=n}else-3==l?h=n:-4==l&&(c=n);return i}let m=[],b=[];for(;a.pos>0;)u(t.start||0,t.bufferStart||0,m,b,-1);let w=null!==(e=t.length)&&void 0!==e?e:m.length?b[0]+m[0].length:0;return new bo(l[t.topID],m.reverse(),b.reverse(),w)}(t)}}bo.empty=new bo(fo.none,[],[],0);class wo{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 wo(this.buffer,this.index)}}class vo{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return fo.none}toString(){let t=[];for(let e=0;e0));a=r[a+3]);return o}slice(t,e,i){let n=this.buffer,s=new Uint16Array(e-t),r=0;for(let o=t,a=0;o=e&&ie;case 1:return i<=e&&n>e;case 2:return n>e;case 4:return!0}}function So(t,e){let i=t.childBefore(e);for(;i;){let e=i.lastChild;if(!e||e.to!=i.to)break;e.type.isError&&e.from==e.to?(t=i,i=e.prevSibling):i=e}return t}function xo(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!=l;t+=e){let l=o[t],h=a[t]+r.from;if(yo(n,i,h,h+l.length))if(l instanceof vo){if(s&mo.ExcludeBuffers)continue;let o=l.findChild(0,l.buffer.length,e,i-h,n);if(o>-1)return new Co(new Po(r,l,t,h),null,o)}else if(s&mo.IncludeAnonymous||!l.type.isAnonymous||Xo(l)){let o;if(!(s&mo.IgnoreMounts)&&l.props&&(o=l.prop(ho.mounted))&&!o.overlay)return new ko(o.tree,h,t,r);let a=new ko(l,h,t,r);return s&mo.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(e<0?l.children.length-1:0,e,i,n)}}if(s&mo.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&mo.IgnoreOverlays)&&(n=this._tree.prop(ho.mounted))&&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 ko(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}cursor(t=0){return new _o(this,t)}get tree(){return this._tree}toTree(){return this._tree}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return So(this,t)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}toString(){return this._tree.toString()}get node(){return this}matchContext(t){return $o(this,t)}}function Qo(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 $o(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 Po{constructor(t,e,i,n){this.parent=t,this.buffer=e,this.index=i,this.start=n}}class Co{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){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 Co(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&mo.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 Co(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 Co(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 Co(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}cursor(t=0){return new _o(this,t)}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 bo(this.type,t,e,this.to-this.from)}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return So(this,t)}toString(){return this.context.buffer.childString(this.index)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}get node(){return this}matchContext(t){return $o(this,t)}}class _o{get name(){return this.type.name}constructor(t,e=0){if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof ko)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let e=t._parent;e;e=e._parent)this.stack.unshift(e.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return!!t&&(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0)}yieldBuf(t,e){this.index=t;let{start:i,buffer:n}=this.buffer;return this.type=e||n.set.types[n.buffer[t]],this.from=i+n.buffer[t+1],this.to=i+n.buffer[t+2],!0}yield(t){return!!t&&(t instanceof ko?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,i){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,i,this.mode));let{buffer:n}=this.buffer,s=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.buffer.start,i);return!(s<0)&&(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,i=this.mode){return this.buffer?!(i&mo.ExcludeBuffers)&&this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&mo.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&mo.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode));let{buffer:e}=this.buffer,i=this.stack.length-1;if(t<0){let t=i<0?0:this.stack[i]+4;if(this.index!=t)return this.yieldBuf(e.findChild(t,this.index,-1,0,4))}else{let t=e.buffer[this.index+3];if(t<(i<0?e.buffer.length:e.buffer[this.stack[i]+3]))return this.yieldBuf(t)}return i<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,i,{buffer:n}=this;if(n){if(t>0){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&mo.IncludeAnonymous||t instanceof vo||!t.type.isAnonymous||Xo(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 $o(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 Xo(t){return t.children.some((t=>t instanceof vo||!t.type.isAnonymous||Xo(t)))}const Zo=new WeakMap;function Ao(t,e){if(!t.isAnonymous||e instanceof vo||e.type!=t)return 1;let i=Zo.get(e);if(null==i){i=1;for(let n of e.children){if(n.type!=t||!(n instanceof bo)){i=1;break}i+=Ao(t,n)}Zo.set(e,i)}return i}function To(t,e,i,n,s,r,o,a,l){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]+a);continue}u.push(i[s])}else{let e=n[h-1]+i[h-1].length-f;u.push(To(t,i,n,s,h,f,e,null,l))}d.push(f+a-r)}}(e,i,n,s,0),(a||l)(u,d,o)}class Ro{constructor(){this.map=new WeakMap}setBuffer(t,e,i){let n=this.map.get(t);n||this.map.set(t,n=new Map),n.set(e,i)}getBuffer(t,e){let i=this.map.get(t);return i&&i.get(e)}set(t,e){t instanceof Co?this.setBuffer(t.context.buffer,t.index,e):t instanceof ko&&this.map.set(t.tree,e)}get(t){return t instanceof Co?this.getBuffer(t.context.buffer,t.index):t instanceof ko?this.map.get(t.tree):void 0}cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}}class Eo{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 Eo(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,a=0,l=0;;o++){let h=o=i)for(;r&&r.from=e.from||c<=e.to||l){let t=Math.max(e.from,a)-l,i=Math.min(e.to,c)-l;e=t>=i?null:new Eo(t,i,e.tree,e.offset+l,o>0,!!h)}if(e&&n.push(e),r.to>c)break;r=snew lo(t.from,t.to))):[new lo(0,0)]:[new lo(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 Mo{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)}}function Do(t){return(e,i,n,s)=>new qo(e,t,i,n,s)}class Wo{constructor(t,e,i,n,s){this.parser=t,this.parse=e,this.overlay=i,this.target=n,this.ranges=s}}class Uo{constructor(t,e,i,n,s,r,o){this.parser=t,this.predicate=e,this.mounts=i,this.index=n,this.start=s,this.target=r,this.prev=o,this.depth=0,this.ranges=[]}}const Yo=new ho({perNode:!0});class qo{constructor(t,e,i,n,s){this.nest=e,this.input=i,this.fragments=n,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=t}advance(){if(this.baseParse){let t=this.baseParse.advance();if(!t)return null;if(this.baseParse=null,this.baseTree=t,this.startInner(),null!=this.stoppedAt)for(let t of this.inner)t.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let t=this.baseTree;return null!=this.stoppedAt&&(t=new bo(t.type,t.children,t.positions,t.length,t.propValues.concat([[Yo,this.stoppedAt]]))),t}let t=this.inner[this.innerDone],e=t.parse.advance();if(e){this.innerDone++;let i=Object.assign(Object.create(null),t.target.props);i[ho.mounted.id]=new co(e,t.overlay,t.parser),t.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let t=this.input.length;for(let e=this.innerDone;et.frag.from<=n.from&&t.frag.to>=n.to&&t.mount.overlay));if(t)for(let i of t.mount.overlay){let s=i.from+t.pos,r=i.to+t.pos;s>=n.from&&r<=n.to&&!e.ranges.some((t=>t.froms))&&e.ranges.push({from:s,to:r})}}a=!1}else if(i&&(r=Lo(i.ranges,n.from,n.to)))a=2!=r;else if(!n.type.isAnonymous&&n.fromnew lo(t.from-n.from,t.to-n.from))):null,n.tree,t)),s.overlay?t.length&&(i={ranges:t,depth:0,prev:i}):a=!1}}else e&&(o=e.predicate(n))&&(!0===o&&(o=new lo(n.from,n.to)),o.fromnew lo(t.from-e.start,t.to-e.start))),e.target,t)),e=e.prev}i&&! --i.depth&&(i=i.prev)}}}}function Lo(t,e,i){for(let n of t){if(n.from>=i)break;if(n.to>e)return n.from<=e&&n.to>=i?2:1}return 0}function zo(t,e,i,n,s,r){if(e=e.to);n++);let o=s.children[n],a=o.buffer;s.children[n]=function t(i,n,s,l,h){let c=i;for(;a[c+2]+r<=e.from;)c=a[c+3];let u=[],d=[];zo(o,i,c,u,d,l);let f=a[c+1],p=a[c+2],O=f+r==e.from&&p+r==e.to&&a[c]==e.type.id;return u.push(O?e.toTree():t(c+4,a[c+3],o.set.types[a[c]],f,p-f)),d.push(f-l),zo(o,a[c+3],n,u,d,l),new bo(s,u,d,h)}(0,a.length,fo.none,0,o.length);for(let n=0;n<=i;n++)t.childAfter(e.from)}class Bo{constructor(t,e){this.offset=e,this.done=!1,this.cursor=t.cursor(mo.IncludeAnonymous|mo.IgnoreMounts)}moveTo(t){let{cursor:e}=this,i=t-this.offset;for(;!this.done&&e.from=t&&e.enter(i,1,mo.IgnoreOverlays|mo.ExcludeBuffers)||e.next(!1)||(this.done=!0)}hasNode(t){if(this.moveTo(t.from),!this.done&&this.cursor.from+this.offset==t.from&&this.cursor.tree)for(let e=this.cursor.tree;;){if(e==t.tree)return!0;if(!(e.children.length&&0==e.positions[0]&&e.children[0]instanceof bo))break;e=e.children[0]}return!1}}let jo=class{constructor(t){var e;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){let i=this.curFrag=t[0];this.curTo=null!==(e=i.tree.prop(Yo))&&void 0!==e?e:i.to,this.inner=new Bo(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t)}nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=null!==(t=e.tree.prop(Yo))&&void 0!==t?t:e.to,this.inner=new Bo(e.tree,-e.offset)}}findMounts(t,e){var i;let n=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let t=this.inner.cursor.node;t;t=t.parent){let s=null===(i=t.tree)||void 0===i?void 0:i.prop(ho.mounted);if(s&&s.parser==e)for(let e=this.fragI;e=t.to)break;i.tree==this.curFrag.tree&&n.push({frag:i,pos:t.from-i.offset,mount:s})}}}return n}};function No(t,e){let i=null,n=e;for(let s=1,r=0;s=a)break;t.to<=o||(i||(n=i=e.slice()),t.froma&&i.splice(r+1,0,new lo(a,t.to))):t.to>a?i[r--]=new lo(a,t.to):i.splice(r--,1))}}return n}function Go(t,e,i,n){let s=0,r=0,o=!1,a=!1,l=-1e9,h=[];for(;;){let c=s==t.length?1e9:o?t[s].to:t[s].from,u=r==e.length?1e9:a?e[r].to:e[r].from;if(o!=a){let t=Math.max(l,i),e=Math.min(c,u,n);tnew lo(t.from+n,t.to+n))),a,l);for(let e=0,n=a;;e++){let a=e==o.length,h=a?l:o[e].from;if(h>n&&i.push(new Eo(n,h,s.tree,-t,r.from>=n||r.openStart,r.to<=h||r.openEnd)),a)break;n=o[e].to}}else i.push(new Eo(a,l,s.tree,-t,r.from>=t||r.openStart,r.to<=o||r.openEnd))}return i}let Ho=0;class Jo{constructor(t,e,i){this.set=t,this.base=e,this.modified=i,this.id=Ho++}static define(t){if(null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let e=new Jo([],null,[]);if(e.set.push(e),t)for(let i of t.set)e.set.push(i);return e}static defineModifier(){let t=new ta;return e=>e.modified.indexOf(t)>-1?e:ta.get(e.base||e,e.modified.concat(t).sort(((t,e)=>t.id-e.id)))}}let Ko=0;class ta{constructor(){this.instances=[],this.id=Ko++}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 Jo(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(ta.get(e,t));return s}}function ea(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,a=i[o];if(!a)throw new RangeError("Invalid path: "+t);let l=new na(n,s,o>0?i.slice(0,o):null);e[a]=l.sort(e[a])}}return ia.add(e)}const ia=new ho;class na{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 ra(t,e,i,n=0,s=t.length){let r=new oa(n,Array.isArray(e)?e:[e],i);r.highlightRange(t.cursor(),n,s,"",r.highlighters),r.flush(s)}na.empty=new na([],2,null);class oa{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:a}=t;if(o>=i||a<=e)return;r.isTop&&(s=this.highlighters.filter((t=>!t.scope||t.scope(r))));let l=n,h=function(t){let e=t.type.prop(ia);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}(t)||na.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&&(l&&(l+=" "),l+=c,1==h.mode&&(n+=(n?" ":"")+c)),this.startSpan(t.from,l),h.opaque)return;let u=t.tree&&t.tree.prop(ho.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 d=0,f=o;;d++){let p=d=O)&&t.nextSibling()););if(!p||O>i)break;f=p.to+o,f>e&&(this.highlightRange(r.cursor(),Math.max(e,p.from+o),Math.min(i,f),n,h),this.startSpan(f,l))}c&&t.parent()}else if(t.firstChild()){do{if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,n,s),this.startSpan(Math.min(i,t.to),l)}}while(t.nextSibling());t.parent()}}}const aa=Jo.define,la=aa(),ha=aa(),ca=aa(ha),ua=aa(ha),da=aa(),fa=aa(da),pa=aa(da),Oa=aa(),ga=aa(Oa),ma=aa(),ba=aa(),wa=aa(),va=aa(wa),ya=aa(),Sa={comment:la,lineComment:aa(la),blockComment:aa(la),docComment:aa(la),name:ha,variableName:aa(ha),typeName:ca,tagName:aa(ca),propertyName:ua,attributeName:aa(ua),className:aa(ha),labelName:aa(ha),namespace:aa(ha),macroName:aa(ha),literal:da,string:fa,docString:aa(fa),character:aa(fa),attributeValue:aa(fa),number:pa,integer:aa(pa),float:aa(pa),bool:aa(da),regexp:aa(da),escape:aa(da),color:aa(da),url:aa(da),keyword:ma,self:aa(ma),null:aa(ma),atom:aa(ma),unit:aa(ma),modifier:aa(ma),operatorKeyword:aa(ma),controlKeyword:aa(ma),definitionKeyword:aa(ma),moduleKeyword:aa(ma),operator:ba,derefOperator:aa(ba),arithmeticOperator:aa(ba),logicOperator:aa(ba),bitwiseOperator:aa(ba),compareOperator:aa(ba),updateOperator:aa(ba),definitionOperator:aa(ba),typeOperator:aa(ba),controlOperator:aa(ba),punctuation:wa,separator:aa(wa),bracket:va,angleBracket:aa(va),squareBracket:aa(va),paren:aa(va),brace:aa(va),content:Oa,heading:ga,heading1:aa(ga),heading2:aa(ga),heading3:aa(ga),heading4:aa(ga),heading5:aa(ga),heading6:aa(ga),contentSeparator:aa(Oa),list:aa(Oa),quote:aa(Oa),emphasis:aa(Oa),strong:aa(Oa),link:aa(Oa),monospace:aa(Oa),strikethrough:aa(Oa),inserted:aa(),deleted:aa(),changed:aa(),invalid:aa(),meta:ya,documentMeta:aa(ya),annotation:aa(ya),processingInstruction:aa(ya),definition:Jo.defineModifier(),constant:Jo.defineModifier(),function:Jo.defineModifier(),standard:Jo.defineModifier(),local:Jo.defineModifier(),special:Jo.defineModifier()};var xa;sa([{tag:Sa.link,class:"tok-link"},{tag:Sa.heading,class:"tok-heading"},{tag:Sa.emphasis,class:"tok-emphasis"},{tag:Sa.strong,class:"tok-strong"},{tag:Sa.keyword,class:"tok-keyword"},{tag:Sa.atom,class:"tok-atom"},{tag:Sa.bool,class:"tok-bool"},{tag:Sa.url,class:"tok-url"},{tag:Sa.labelName,class:"tok-labelName"},{tag:Sa.inserted,class:"tok-inserted"},{tag:Sa.deleted,class:"tok-deleted"},{tag:Sa.literal,class:"tok-literal"},{tag:Sa.string,class:"tok-string"},{tag:Sa.number,class:"tok-number"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],class:"tok-string2"},{tag:Sa.variableName,class:"tok-variableName"},{tag:Sa.local(Sa.variableName),class:"tok-variableName tok-local"},{tag:Sa.definition(Sa.variableName),class:"tok-variableName tok-definition"},{tag:Sa.special(Sa.variableName),class:"tok-variableName2"},{tag:Sa.definition(Sa.propertyName),class:"tok-propertyName tok-definition"},{tag:Sa.typeName,class:"tok-typeName"},{tag:Sa.namespace,class:"tok-namespace"},{tag:Sa.className,class:"tok-className"},{tag:Sa.macroName,class:"tok-macroName"},{tag:Sa.propertyName,class:"tok-propertyName"},{tag:Sa.operator,class:"tok-operator"},{tag:Sa.comment,class:"tok-comment"},{tag:Sa.meta,class:"tok-meta"},{tag:Sa.invalid,class:"tok-invalid"},{tag:Sa.punctuation,class:"tok-punctuation"}]);const ka=new ho;function Qa(t){return E.define({combine:t?e=>e.concat(t):void 0})}const $a=new ho;class Pa{constructor(t,e,i=[],n=""){this.data=t,this.name=n,xt.prototype.hasOwnProperty("tree")||Object.defineProperty(xt.prototype,"tree",{get(){return Xa(this)}}),this.parser=e,this.extension=[Wa.of(this),xt.languageData.of(((t,e,i)=>{let n=Ca(t,e,i),s=n.type.prop(ka);if(!s)return[];let r=t.facet(s),o=n.type.prop($a);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 Ca(t,e,i).type.prop(ka)==this.data}findRegions(t){let e=t.facet(Wa);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(ka)==this.data)return void i.push({from:e,to:e+t.length});let s=t.prop(ho.mounted);if(s){if(s.tree.prop(ka)==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;it.isTop?e:void 0))]}),t.name)}configure(t,e){return new _a(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Xa(t){let e=t.field(Pa.state,!1);return e?e.tree:bo.empty}class Za{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let i=this.cursorPos-this.string.length;return t=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i)}}let Aa=null;class Ta{constructor(t,e,i=[],n,s,r,o,a){this.parser=t,this.state=e,this.fragments=i,this.tree=n,this.treeLen=s,this.viewport=r,this.skipped=o,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(t,e,i){return new Ta(t,e,[],bo.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Za(this.state.doc),this.fragments)}work(t,e){return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=bo.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(Eo.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Aa;Aa=this;try{return t()}finally{Aa=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=Ra(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=Eo.applyChanges(i,e),n=bo.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=Ra(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 Vo{createParse(e,i,n){let s=n[0].from,r=n[n.length-1].to;return{parsedPos:s,advance(){let e=Aa;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 bo(fo.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 Aa}}function Ra(t,e,i){return Eo.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class Ea{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 Ea(e)}static init(t){let e=Math.min(3e3,t.doc.length),i=Ta.create(t.facet(Wa).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new Ea(i)}}Pa.state=q.define({create:Ea.init,update(t,e){for(let t of e.effects)if(t.is(Pa.setState))return t.value;return e.startState.facet(Wa)!=e.state.facet(Wa)?Ea.init(e.state):t.apply(e)}});let Va=t=>{let e=setTimeout((()=>t()),500);return()=>clearTimeout(e)};"undefined"!=typeof requestIdleCallback&&(Va=t=>{let e=-1,i=setTimeout((()=>{e=requestIdleCallback(t,{timeout:400})}),100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const Ma="undefined"!=typeof navigator&&(null===(xa=navigator.scheduling)||void 0===xa?void 0:xa.isInputPending)?()=>navigator.scheduling.isInputPending():null,Da=_i.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(Pa.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),t.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(Pa.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=Va(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEndn+1e3,a=s.context.work((()=>Ma&&Ma()||Date.now()>r),n+(o?0:1e5));this.chunkBudget-=Date.now()-e,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Pa.setState.of(new Ea(s.context))})),this.chunkBudget>0&&(!a||o)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then((()=>this.scheduleWork())).catch((t=>Qi(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()}}}),Wa=E.define({combine:t=>t.length?t[0]:null,enables:t=>[Pa.state,Da,Ts.contentAttributes.compute([t],(e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}}))]});class Ua{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}class Ya{constructor(t,e,i,n,s,r=void 0){this.name=t,this.alias=e,this.extensions=i,this.filename=n,this.loadFunc=s,this.support=r,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then((t=>this.support=t),(t=>{throw this.loading=null,t})))}static of(t){let{load:e,support:i}=t;if(!e){if(!i)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");e=()=>Promise.resolve(i)}return new Ya(t.name,(t.alias||[]).concat(t.name).map((t=>t.toLowerCase())),t.extensions||[],t.filename,e,i)}static matchFilename(t,e){for(let i of t)if(i.filename&&i.filename.test(e))return i;let i=/\.([^.]+)$/.exec(e);if(i)for(let e of t)if(e.extensions.indexOf(i[1])>-1)return e;return null}static matchLanguageName(t,e,i=!0){e=e.toLowerCase();for(let i of t)if(i.alias.some((t=>t==e)))return i;if(i)for(let i of t)for(let t of i.alias){let n=e.indexOf(t);if(n>-1&&(t.length>2||!/\w/.test(e[n-1])&&!/\w/.test(e[n+t.length])))return i}return null}}const qa=E.define(),La=E.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 za(t){let e=t.facet(La);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function Ia(t,e){let i="",n=t.tabSize,s=t.facet(La)[0];if("\t"==s){for(;e>=n;)i+="\t",e-=n;s=" "}for(let t=0;t=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 Yt(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 Na=new ho;function Ga(t){let e=t.type.prop(Na);if(e)return e;let i,n=t.firstChild;if(n&&(i=n.type.prop(ho.closedBy))){let e=t.lastChild,n=e&&i.indexOf(e.name)>-1;return t=>el(t,!0,1,void 0,n&&!function(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}(t)?e.from:void 0)}return null==t.parent?Ha:null}function Fa(t,e,i){for(;t;t=t.parent){let n=Ga(t);if(n)return n(Ja.create(i,e,t))}return null}function Ha(){return 0}class Ja extends ja{constructor(t,e,i){super(t.state,t.options),this.base=t,this.pos=e,this.node=i}static create(t,e,i){return new Ja(t,e,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){let t=this.state.doc.lineAt(this.node.from);for(;;){let e=this.node.resolve(t.from);for(;e.parent&&e.parent.from==e.from;)e=e.parent;if(Ka(e,this.node))break;t=this.state.doc.lineAt(e.from)}return this.lineIndent(t.from)}continue(){let t=this.node.parent;return t?Fa(t,this.pos,this.base):0}}function Ka(t,e){for(let i=e;i;i=i.parent)if(t==i)return!0;return!1}function tl({closing:t,align:e=!0,units:i=1}){return n=>el(n,e,i,t)}function el(t,e,i,n,s){let r=t.textAfter,o=r.match(/^\s*/)[0].length,a=n&&r.slice(o,o+n.length)==n||s==t.pos+o,l=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.from{let n=t&&t.test(i.textAfter);return i.baseIndent+(n?0:e*i.unit)}}function nl(){return xt.transactionFilter.of((t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let i=t.newDoc,{head:n}=t.newSelection.main,s=i.lineAt(n);if(n>s.from+200)return t;let r=i.sliceString(s.from,n);if(!e.some((t=>t.test(r))))return t;let{state:o}=t,a=-1,l=[];for(let{head:t}of o.selection.ranges){let e=o.doc.lineAt(t);if(e.from==a)continue;a=e.from;let i=Ba(o,e.from);if(null==i)continue;let n=/^\s*/.exec(e.text)[0],s=Ia(o,i);n!=s&&l.push({from:e.from,to:e.from+n.length,insert:s})}return l.length?[t,{changes:l,sequential:!0}]:t}))}const sl=E.define(),rl=new ho;function ol(t){let e=t.firstChild,i=t.lastChild;return e&&e.toi)continue;if(s&&r.from=e&&n.to>i&&(s=n)}}return s}(t,e,i)}function hl(t,e){let i=e.mapPos(t.from,1),n=e.mapPos(t.to,-1);return i>=n?void 0:{from:i,to:n}}const cl=ut.define({map:hl}),ul=ut.define({map:hl}),dl=q.define({create:()=>ni.none,update(t,e){t=t.map(e.changes);for(let i of e.effects)i.is(cl)&&!pl(t,i.value.from,i.value.to)?t=t.update({add:[bl.range(i.value.from,i.value.to)]}):i.is(ul)&&(t=t.update({filter:(t,e)=>i.value.from!=t||i.value.to!=e,filterFrom:i.value.from,filterTo:i.value.to}));if(e.selection){let i=!1,{head:n}=e.selection.main;t.between(n,n,((t,e)=>{tn&&(i=!0)})),i&&(t=t.update({filterFrom:n,filterTo:n,filter:(t,e)=>e<=n||t>=n}))}return t},provide:t=>Ts.decorations.from(t),toJSON(t,e){let i=[];return t.between(0,e.doc.length,((t,e)=>{i.push(t,e)})),i},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let i=0;i{(!s||s.from>t)&&(s={from:t,to:e})})),s}function pl(t,e,i){let n=!1;return t.between(e,e,((t,s)=>{t==e&&s==i&&(n=!0)})),n}const Ol={placeholderDOM:null,placeholderText:"…"},gl=E.define({combine:t=>kt(t,Ol)});function ml(t){let e=[dl,yl];return t&&e.push(gl.of(t)),e}const bl=ni.replace({widget:new class extends ei{toDOM(t){let{state:e}=t,i=e.facet(gl),n=e=>{let i=t.lineBlockAt(t.posAtDOM(e.target)),n=fl(t.state,i.from,i.to);n&&t.dispatch({effects:ul.of(n)}),e.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(t,n);let s=document.createElement("span");return s.textContent=i.placeholderText,s.setAttribute("aria-label",e.phrase("folded code")),s.title=e.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=n,s}}}),wl={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class vl extends Yr{constructor(t,e){super(),this.config=t,this.open=e}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let e=document.createElement("span");return e.textContent=this.open?this.config.openText:this.config.closedText,e.title=t.state.phrase(this.open?"Fold line":"Unfold line"),e}}const yl=Ts.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Sl{constructor(t,e){let i;function n(t){let e=It.newName();return(i||(i=Object.create(null)))["."+e]=t,e}this.specs=t;const s="string"==typeof e.all?e.all:e.all?n(e.all):void 0,r=e.scope;this.scope=r instanceof Pa?t=>t.prop(ka)==r.data:r?t=>t==r:void 0,this.style=sa(t.map((t=>({tag:t.tag,class:t.class||n(Object.assign({},t,{tag:null}))}))),{all:s}).style,this.module=i?new It(i):null,this.themeType=e.themeType}static define(t,e){return new Sl(t,e||{})}}const xl=E.define(),kl=E.define({combine:t=>t.length?[t[0]]:null});function Ql(t){let e=t.facet(xl);return e.length?e:t.facet(kl)}function $l(t,e){let i,n=[Cl];return t instanceof Sl&&(t.module&&n.push(Ts.styleModule.of(t.module)),i=t.themeType),(null==e?void 0:e.fallback)?n.push(kl.of(t)):i?n.push(xl.computeN([Ts.darkTheme],(e=>e.facet(Ts.darkTheme)==("dark"==i)?[t]:[]))):n.push(xl.of(t)),n}class Pl{constructor(t){this.markCache=Object.create(null),this.tree=Xa(t.state),this.decorations=this.buildDeco(t,Ql(t.state))}update(t){let e=Xa(t.state),i=Ql(t.state),n=i!=Ql(t.startState);e.length{i.add(t,e,this.markCache[n]||(this.markCache[n]=ni.mark({class:n})))}),n,s);return i.finish()}}const Cl=N.high(_i.fromClass(Pl,{decorations:t=>t.decorations})),_l=Sl.define([{tag:Sa.meta,color:"#404740"},{tag:Sa.link,textDecoration:"underline"},{tag:Sa.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Sa.emphasis,fontStyle:"italic"},{tag:Sa.strong,fontWeight:"bold"},{tag:Sa.strikethrough,textDecoration:"line-through"},{tag:Sa.keyword,color:"#708"},{tag:[Sa.atom,Sa.bool,Sa.url,Sa.contentSeparator,Sa.labelName],color:"#219"},{tag:[Sa.literal,Sa.inserted],color:"#164"},{tag:[Sa.string,Sa.deleted],color:"#a11"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],color:"#e40"},{tag:Sa.definition(Sa.variableName),color:"#00f"},{tag:Sa.local(Sa.variableName),color:"#30a"},{tag:[Sa.typeName,Sa.namespace],color:"#085"},{tag:Sa.className,color:"#167"},{tag:[Sa.special(Sa.variableName),Sa.macroName],color:"#256"},{tag:Sa.definition(Sa.propertyName),color:"#00c"},{tag:Sa.comment,color:"#940"},{tag:Sa.invalid,color:"#f00"}]),Xl=Ts.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Zl=1e4,Al="()[]{}",Tl=E.define({combine:t=>kt(t,{afterCursor:!0,brackets:Al,maxScanDistance:Zl,renderMatch:Vl})}),Rl=ni.mark({class:"cm-matchingBracket"}),El=ni.mark({class:"cm-nonmatchingBracket"});function Vl(t){let e=[],i=t.matched?Rl:El;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 Ml=q.define({create:()=>ni.none,update(t,e){if(!e.docChanged&&!e.selection)return t;let i=[],n=e.state.facet(Tl);for(let t of e.state.selection.ranges){if(!t.empty)continue;let s=Ll(e.state,t.head,-1,n)||t.head>0&&Ll(e.state,t.head-1,1,n)||n.afterCursor&&(Ll(e.state,t.head,1,n)||t.headTs.decorations.from(t)}),Dl=[Ml,Xl];function Wl(t={}){return[Tl.of(t),Dl]}const Ul=new ho;function Yl(t,e,i){let n=t.prop(e<0?ho.openedBy:ho.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 ql(t){let e=t.type.prop(Ul);return e?e(t.node):t}function Ll(t,e,i,n={}){let s=n.maxScanDistance||Zl,r=n.brackets||Al,o=Xa(t),a=o.resolveInner(e,i);for(let n=a;n;n=n.parent){let s=Yl(n.type,i,r);if(s&&n.from0?e>=o.from&&eo.from&&e<=o.to))return zl(t,e,i,n,o,s,r)}}return function(t,e,i,n,s,r,o){let a=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%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 a=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(a+t,1).type!=s))if(e%2==0==i>0)u++;else{if(1==u)return{start:h,end:{from:a+t,to:a+t+1},matched:e>>1==l>>1};u--}}i>0&&(t+=r.length)}return c.done?{start:h,matched:!1}:null}(t,e,i,o,a.type,s,r)}function zl(t,e,i,n,s,r,o){let a=n.parent,l={from:s.from,to:s.to},h=0,c=null==a?void 0:a.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 jl(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 Nl=new WeakMap;class Gl extends Pa{constructor(t){let e,i=Qa(t.languageData),n={name:(s=t).name||"",token:s.token,blankLine:s.blankLine||(()=>{}),startState:s.startState||(()=>!0),copyState:s.copyState||jl,indent:s.indent||(()=>null),languageData:s.languageData||{},tokenTable:s.tokenTable||th};var s;super(i,new class extends Vo{createParse(t,i,n){return new Jl(e,t,i,n)}},[qa.of(((t,e)=>this.getIndent(t,e)))],t.name),this.topNode=function(t){let e=fo.define({id:eh.length,name:"Document",props:[ka.add((()=>t))]});return eh.push(e),e}(i),e=this,this.streamParser=n,this.stateAfter=new ho({perNode:!0}),this.tokenTable=t.tokenTable?new rh(n.tokenTable):oh}static define(t){return new Gl(t)}getIndent(t,e){let i,n=Xa(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=Nl.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],a=i+e.positions[r],l=o instanceof bo&&a=e.length)return e;s||e.type!=t.topNode||(s=!0);for(let r=e.children.length-1;r>=0;r--){let o,a=e.positions[r],l=e.children[r];if(ai&&Fl(t,n.tree,0-n.offset,i,r);if(o&&(e=Hl(t,n.tree,i+n.offset,o.pos+n.offset,!1)))return{state:o.state,tree:e}}return{state:t.streamParser.startState(n?za(n):4),tree:bo.empty}}(t,i,r,null==s?void 0:s.state);this.state=o,this.parsedPos=this.chunkStart=r+a.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 Bl(e,t?t.state.tabSize:4,t?za(t.state):2);if(r.eol())s.blankLine(this.state,r.indentUnit);else for(;!r.eol();){let t=Kl(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 th=Object.create(null),eh=[fo.none],ih=new po(eh),nh=[],sh=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"]])sh[t]=lh(th,e);class rh{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),sh)}resolve(t){return t?this.table[t]||(this.table[t]=lh(this.extra,t)):0}}const oh=new rh(th);function ah(t,e){nh.indexOf(t)>-1||(nh.push(t),console.warn(e))}function lh(t,e){let i=null;for(let n of e.split(".")){let e=t[n]||Sa[n];e?"function"==typeof e?i?i=e(i):ah(n,`Modifier ${n} used at start of tag`):i?ah(n,`Tag ${n} used as modifier`):i=e:ah(n,`Unknown highlighting tag ${n}`)}if(!i)return 0;let n=e.replace(/ /g,"_"),s=fo.define({id:eh.length,name:n,props:[ea({[n]:i})]});return eh.push(s),s.id}function hh(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 ch=hh(gh,0),uh=hh(Oh,0),dh=hh(((t,e)=>Oh(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 fh(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}const ph=50;function Oh(t,e,i=e.selection.ranges){let n=i.map((t=>fh(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,a=t.sliceDoc(n-ph,n),l=t.sliceDoc(s,s+ph),h=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(l)[0].length,u=a.length-h;if(a.slice(u-e.length,u)==e&&l.slice(c,c+i.length)==i)return{open:{pos:n-h,margin:h&&1},close:{pos:s+c,margin:c&&1}};s-n<=2*ph?r=o=t.sliceDoc(n,s):(r=t.sliceDoc(n,n+ph),o=t.sliceDoc(s-ph,s));let d=/^\s*/.exec(r)[0].length,f=/\s*$/.exec(o)[0].length,p=o.length-f-i.length;return r.slice(d,d+e.length)==e&&o.slice(p,p+i.length)==i?{open:{pos:n+d+e.length,margin:/\s/.test(r.charAt(d+e.length))?1:0},close:{pos:s-f-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>l.from)){s=l.from;let t=/^\s*/.exec(l.text)[0].length,e=t==l.length,i=l.text.slice(t,t+a.length)==a?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 mh=lt.define(),bh=lt.define(),wh=E.define(),vh=E.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)})});const yh=q.define({create:()=>Dh.empty,update(t,e){let i=e.state.facet(vh),n=e.annotation(mh);if(n){let s=e.docChanged?A.single(function(t){let e=0;return t.iterChangedRanges(((t,i)=>e=i)),e}(e.changes)):void 0,r=Ch.fromTransaction(e,s),o=n.side,a=0==o?t.undone:t.done;return a=r?_h(a,a.length,i.minDepth,r):Th(a,e.startState.selection),new Dh(0==o?n.rest:a,0==o?a:n.rest)}let s=e.annotation(bh);if("full"!=s&&"before"!=s||(t=t.isolate()),!1===e.annotation(dt.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);let r=Ch.fromTransaction(e),o=e.annotation(dt.time),a=e.annotation(dt.userEvent);return r?t=t.addChanges(r,o,a,i,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,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 Dh(t.done.map(Ch.fromJSON),t.undone.map(Ch.fromJSON))});function Sh(t={}){return[yh,vh.of(t),Ts.domEventHandlers({beforeinput(t,e){let i="historyUndo"==t.inputType?kh:"historyRedo"==t.inputType?Qh:null;return!!i&&(t.preventDefault(),i(e))}})]}function xh(t,e){return function({state:i,dispatch:n}){if(!e&&i.readOnly)return!1;let s=i.field(yh,!1);if(!s)return!1;let r=s.pop(t,i,e);return!!r&&(n(r),!0)}}const kh=xh(0,!1),Qh=xh(1,!1),$h=xh(0,!0),Ph=xh(1,!0);class Ch{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 Ch(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 Ch(t.changes&&k.fromJSON(t.changes),[],t.mapped&&x.fromJSON(t.mapped),t.startSelection&&A.fromJSON(t.startSelection),t.selectionsAfter.map(A.fromJSON))}static fromTransaction(t,e){let i=Zh;for(let e of t.startState.facet(wh)){let n=e(t);n.length&&(i=i.concat(n))}return!i.length&&t.changes.empty?null:new Ch(t.changes.invert(t.startState.doc),i,void 0,e||t.startState.selection,Zh)}static selection(t){return new Ch(void 0,Zh,void 0,void 0,t)}}function _h(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 Xh(t,e){return t.length?e.length?t.concat(e):t:e}const Zh=[],Ah=200;function Th(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-Ah));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),_h(t,t.length-1,1e9,i.setSelAfter(n)))}return[Ch.selection([e])]}function Rh(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 Eh(t,e){if(!t.length)return t;let i=t.length,n=Zh;for(;i;){let s=Vh(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?[Ch.selection(n)]:Zh}function Vh(t,e,i){let n=Xh(t.selectionsAfter.length?t.selectionsAfter.map((t=>t.map(e))):Zh,i);if(!t.changes)return Ch.selection(n);let s=t.changes.map(e),r=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(r):r;return new Ch(s,ut.mapEffects(t.effects,e),o,t.startSelection.map(r),n)}const Mh=/^(input\.type|delete)($|\.)/;class Dh{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 Dh(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||Mh.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)?_h(r,r.length-1,n.minDepth,new Ch(t.changes.compose(o.changes),Xh(t.effects,o.effects),o.mapped,o.startSelection,Zh)):_h(r,r.length,n.minDepth,t),new Dh(r,Zh,e,i)}addSelection(t,e,i,n){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Zh;return s.length>0&&e-this.prevTimet.empty!=o.ranges[e].empty)).length)?this:new Dh(Th(this.done,t),this.undone,e,i);var r,o}addMapping(t){return new Dh(Eh(this.done,t),Eh(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:mh.of({side:t,rest:Rh(n)}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let i=1==n.length?Zh:n.slice(0,n.length-1);return s.mapped&&(i=Eh(i,s.mapped)),e.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:mh.of({side:t,rest:i}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}}Dh.empty=new Dh(Zh,Zh);const Wh=[{key:"Mod-z",run:kh,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Qh,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Qh,preventDefault:!0},{key:"Mod-u",run:$h,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Ph,preventDefault:!0}];function Uh(t,e){return A.create(t.ranges.map(e),t.mainIndex)}function Yh(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function qh({state:t,dispatch:e},i){let n=Uh(t.selection,i);return!n.eq(t.selection)&&(e(Yh(t,n)),!0)}function Lh(t,e){return A.cursor(e?t.to:t.from)}function zh(t,e){return qh(t,(i=>i.empty?t.moveByChar(i,e):Lh(i,e)))}function Ih(t){return t.textDirectionAt(t.state.selection.main.head)==Wi.LTR}const Bh=t=>zh(t,!Ih(t)),jh=t=>zh(t,Ih(t));function Nh(t,e){return qh(t,(i=>i.empty?t.moveByGroup(i,e):Lh(i,e)))}function Gh(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 Fh(t,e,i){let n,s,r=Xa(t).resolveInner(e.head),o=i?ho.closedBy:ho.openedBy;for(let n=e.head;;){let e=i?r.childAfter(n):r.childBefore(n);if(!e)break;Gh(t,e,o)?r=e:n=i?e.to:e.from}return s=r.type.prop(o)&&(n=i?Ll(t,r.from,1):Ll(t,r.to,-1))&&n.matched?i?n.end.to:n.end.from:i?r.to:r.from,A.cursor(s,i?-1:1)}function Hh(t,e){return qh(t,(i=>{if(!i.empty)return Lh(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)}))}const Jh=t=>Hh(t,!1),Kh=t=>Hh(t,!0);function tc(t){let e,i=t.scrollDOM.clientHeighti.empty?t.moveVertically(i,e,n.height):Lh(i,e)));if(r.eq(s.selection))return!1;if(n.selfScroll){let e=t.coordsAtPos(s.selection.main.head),o=t.scrollDOM.getBoundingClientRect(),a=o.top+n.marginTop,l=o.bottom-n.marginBottom;e&&e.top>a&&e.bottomec(t,!1),nc=t=>ec(t,!0);function sc(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=A.cursor(n.from+i))}return s}function rc(t,e){let i=Uh(t.state.selection,(t=>{let i=e(t);return A.range(t.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)}));return!i.eq(t.state.selection)&&(t.dispatch(Yh(t.state,i)),!0)}function oc(t,e){return console.log("Select!"),rc(t,(i=>t.moveByCharSelected(i,e)))}const ac=t=>oc(t,!Ih(t)),lc=t=>oc(t,Ih(t));function hc(t,e){return rc(t,(i=>t.moveByGroup(i,e)))}function cc(t,e){return rc(t,(i=>t.moveVertically(i,e)))}const uc=t=>cc(t,!1),dc=t=>cc(t,!0);function fc(t,e){return rc(t,(i=>t.moveVertically(i,e,tc(t).height)))}const pc=t=>fc(t,!1),Oc=t=>fc(t,!0),gc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:0})),!0),mc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.doc.length})),!0),bc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:0})),!0),wc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0);function vc(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=yc(t,n,!0)),s=Math.min(s,n),r=Math.max(r,n)}else s=yc(t,s,!1),r=yc(t,r,!0);return s==r?{range:n}:{changes:{from:s,to:r},range:A.cursor(s)}}));return!s.changes.empty&&(t.dispatch(n.update(s,{scrollIntoView:!0,userEvent:i,effects:"delete.selection"==i?Ts.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function yc(t,e,i){if(t instanceof Ts)for(let n of t.state.facet(Ts.atomicRanges).map((e=>e(t))))n.between(e,e,((t,n)=>{te&&(e=i?n:t)}));return e}const Sc=(t,e)=>vc(t,(i=>{let n,s,{state:r}=t,o=r.doc.lineAt(i);if(!e&&i>o.from&&iSc(t,!1),kc=t=>Sc(t,!0),Qc=(t,e)=>vc(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 a=f(r.text,n-r.from,e)+r.from,l=r.text.slice(Math.min(n,a)-r.from,Math.max(n,a)-r.from),h=o(l);if(null!=t&&h!=t)break;" "==l&&n==i||(t=h),n=a}return n})),$c=t=>Qc(t,!1),Pc=t=>vc(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 _c(t,e,i){if(t.readOnly)return!1;let n=[],s=[];for(let e of Cc(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(A.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(A.range(t.anchor-o,t.head-o))}}return!!n.length&&(e(t.update({changes:n,scrollIntoView:!0,selection:A.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0)}function Xc(t,e,i){if(t.readOnly)return!1;let n=[];for(let e of Cc(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 Zc=Ac(!1);function Ac(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),a=!e&&s==r&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i,n=Xa(t).resolveInner(e),s=n.childBefore(e),r=n.childAfter(e);return s&&r&&s.to<=e&&r.from>=e&&(i=s.type.prop(ho.closedBy))&&i.indexOf(r.name)>-1&&t.doc.lineAt(s.to).from==t.doc.lineAt(r.from).from?{from:s.to,to:r.from}:null}(i,s);e&&(s=r=(r<=o.to?o:i.doc.lineAt(r)).to);let l=new ja(i,{simulateBreak:s,simulateDoubleBreak:!!a}),h=Ba(l,s);for(null==h&&(h=/^\s*/.exec(i.doc.lineAt(s).text)[0].length);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:A.range(r.mapPos(n.anchor,1),r.mapPos(n.head,1))}}))}const Rc=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{i.push({from:e.from,insert:t.facet(La)})})),{userEvent:"input.indent"})),!0),Ec=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{let n=/^\s*/.exec(e.text)[0];if(!n)return;let s=Yt(n,t.tabSize),r=0,o=Ia(t,Math.max(0,s-za(t)));for(;rqh(t,(e=>Fh(t.state,e,!Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,!Ih(t))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:t=>qh(t,(e=>Fh(t.state,e,Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,Ih(t))))},{key:"Alt-ArrowUp",run:({state:t,dispatch:e})=>_c(t,e,!1)},{key:"Shift-Alt-ArrowUp",run:({state:t,dispatch:e})=>Xc(t,e,!1)},{key:"Alt-ArrowDown",run:({state:t,dispatch:e})=>_c(t,e,!0)},{key:"Shift-Alt-ArrowDown",run:({state:t,dispatch:e})=>Xc(t,e,!0)},{key:"Escape",run:({state:t,dispatch:e})=>{let i=t.selection,n=null;return i.ranges.length>1?n=A.create([i.main]):i.main.empty||(n=A.create([A.cursor(i.main.head)])),!!n&&(e(Yh(t,n)),!0)}},{key:"Mod-Enter",run:Ac(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:t,dispatch:e})=>{let i=Cc(t).map((({from:e,to:i})=>A.range(e,Math.min(i+1,t.doc.length))));return e(t.update({selection:A.create(i),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:t,dispatch:e})=>{let i=Uh(t.selection,(e=>{var i;let n=Xa(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 A.range(n.to,n.from)}));return e(Yh(t,i)),!0},preventDefault:!0},{key:"Mod-[",run:Ec},{key:"Mod-]",run:Rc},{key:"Mod-Alt-\\",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new ja(t,{overrideIndentation:t=>{let e=i[t];return null==e?-1:e}}),s=Tc(t,((e,s,r)=>{let o=Ba(n,e.from);if(null==o)return;/\S/.test(e.text)||(o=0);let a=/^\s*/.exec(e.text)[0],l=Ia(t,o);(a!=l||r.from{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(Cc(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=Uh(t.selection,(e=>{let s=Ll(t,e.head,-1)||Ll(t,e.head,1)||e.head>0&&Ll(t,e.head-1,1)||e.head{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=fh(t.state,i.from);return n.line?ch(t):!!n.block&&dh(t)}},{key:"Alt-A",run:uh}].concat([{key:"ArrowLeft",run:Bh,shift:ac,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:t=>Nh(t,!Ih(t)),shift:t=>hc(t,!Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:t=>qh(t,(e=>sc(t,e,!Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,!Ih(t)))),preventDefault:!0},{key:"ArrowRight",run:jh,shift:lc,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:t=>Nh(t,Ih(t)),shift:t=>hc(t,Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:t=>qh(t,(e=>sc(t,e,Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,Ih(t)))),preventDefault:!0},{key:"ArrowUp",run:Jh,shift:uc,preventDefault:!0},{mac:"Cmd-ArrowUp",run:gc,shift:bc},{mac:"Ctrl-ArrowUp",run:ic,shift:pc},{key:"ArrowDown",run:Kh,shift:dc,preventDefault:!0},{mac:"Cmd-ArrowDown",run:mc,shift:wc},{mac:"Ctrl-ArrowDown",run:nc,shift:Oc},{key:"PageUp",run:ic,shift:pc},{key:"PageDown",run:nc,shift:Oc},{key:"Home",run:t=>qh(t,(e=>sc(t,e,!1))),shift:t=>rc(t,(e=>sc(t,e,!1))),preventDefault:!0},{key:"Mod-Home",run:gc,shift:bc},{key:"End",run:t=>qh(t,(e=>sc(t,e,!0))),shift:t=>rc(t,(e=>sc(t,e,!0))),preventDefault:!0},{key:"Mod-End",run:mc,shift:wc},{key:"Enter",run:Zc},{key:"Mod-a",run:({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:xc,shift:xc},{key:"Delete",run:kc},{key:"Mod-Backspace",mac:"Alt-Backspace",run:$c},{key:"Mod-Delete",mac:"Alt-Delete",run:t=>Qc(t,!0)},{mac:"Mod-Backspace",run:t=>vc(t,(e=>{let i=t.lineBlockAt(e).from;return e>i?i:Math.max(0,e-1)}))},{mac:"Mod-Delete",run:Pc}].concat([{key:"Ctrl-b",run:Bh,shift:ac,preventDefault:!0},{key:"Ctrl-f",run:jh,shift:lc},{key:"Ctrl-p",run:Jh,shift:uc},{key:"Ctrl-n",run:Kh,shift:dc},{key:"Ctrl-a",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).from,1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).from)))},{key:"Ctrl-e",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).to,-1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).to)))},{key:"Ctrl-d",run:kc},{key:"Ctrl-h",run:xc},{key:"Ctrl-k",run:Pc},{key:"Ctrl-Alt-h",run:$c},{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:A.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:f(n.text,i-n.from,!1)+n.from,r=i==n.to?i+1:f(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:A.cursor(r)}}));return!i.changes.empty&&(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:nc}].map((t=>({mac:t.key,run:t.run,shift:t.shift})))));function Mc(){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 Uc{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(Wc(t)):Wc,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 b(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=w(t),i=this.bufferStart+this.bufferPos;this.bufferPos+=v(t);let n=this.normalize(e);for(let t=0,s=i;;t++){let r=n.charCodeAt(t),o=this.match(r,s);if(o)return this.value=o,this;if(t==n.length-1)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=jc(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 Ic(e,t.sliceString(e,i));return zc.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=jc(this.text,i+(t==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ic.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function jc(t,e){if(e>=t.length)return e;let i,n=t.lineAt(e);for(;e=56320&&i<57344;)e++;return e}function Nc(t){let e=Mc("input",{class:"cm-textfield",name:"line"});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,a,l]=i,h=a?+a.slice(1):0,c=o?+o:s.number;if(o&&l){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)));t.dispatch({effects:Gc.of(!1),selection:A.cursor(u.from+Math.max(0,Math.min(h,u.length))),scrollIntoView:!0}),t.focus()}return{dom:Mc("form",{class:"cm-gotoLine",onkeydown:e=>{27==e.keyCode?(e.preventDefault(),t.dispatch({effects:Gc.of(!1)}),t.focus()):13==e.keyCode&&(e.preventDefault(),i())},onsubmit:t=>{t.preventDefault(),i()}},Mc("label",t.state.phrase("Go to line"),": ",e)," ",Mc("button",{class:"cm-button",type:"submit"},t.state.phrase("go")))}}"undefined"!=typeof Symbol&&(Lc.prototype[Symbol.iterator]=Bc.prototype[Symbol.iterator]=function(){return this});const Gc=ut.define(),Fc=q.define({create:()=>!0,update(t,e){for(let i of e.effects)i.is(Gc)&&(t=i.value);return t},provide:t=>Ur.from(t,(t=>t?Nc:null))}),Hc=Ts.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),Jc={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Kc=E.define({combine:t=>kt(t,Jc,{highlightWordAroundCursor:(t,e)=>t||e,minSelectionLength:Math.min,maxMatches:Math.min})});function tu(t){let e=[ru,su];return t&&e.push(Kc.of(t)),e}const eu=ni.mark({class:"cm-selectionMatch"}),iu=ni.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function nu(t,e,i,n){return!(0!=i&&t(e.sliceDoc(i-1,i))==wt.Word||n!=e.doc.length&&t(e.sliceDoc(n,n+1))==wt.Word)}const su=_i.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(Kc),{state:i}=t,n=i.selection;if(n.ranges.length>1)return ni.none;let s,r=n.main,o=null;if(r.empty){if(!e.highlightWordAroundCursor)return ni.none;let t=i.wordAt(r.head);if(!t)return ni.none;o=i.charCategorizer(r.head),s=i.sliceDoc(t.from,t.to)}else{let t=r.to-r.from;if(t200)return ni.none;if(e.wholeWords){if(s=i.sliceDoc(r.from,r.to),o=i.charCategorizer(r.head),!nu(o,i,r.from,r.to)||!function(t,e,i,n){return t(e.sliceDoc(i,i+1))==wt.Word&&t(e.sliceDoc(n-1,n))==wt.Word}(o,i,r.from,r.to))return ni.none}else if(s=i.sliceDoc(r.from,r.to).trim(),!s)return ni.none}let a=[];for(let n of t.visibleRanges){let t=new Uc(i.doc,s,n.from,n.to);for(;!t.next().done;){let{from:n,to:s}=t.value;if((!o||nu(o,i,n,s))&&(r.empty&&n<=r.from&&s>=r.to?a.push(iu.range(n,s)):(n>=r.to||s<=r.from)&&a.push(eu.range(n,s)),a.length>e.maxMatches))return ni.none}}return ni.set(a)}},{decorations:t=>t.decorations}),ru=Ts.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});const ou=E.define({combine:t=>kt(t,{top:!1,caseSensitive:!1,literal:!1,wholeWord:!1,createPanel:t=>new Eu(t),scrollToMatch:t=>Ts.scrollIntoView(t)})});class au{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,qc),!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 pu(this):new cu(this)}getCursor(t,e=0,i){let n=t.doc?t:xt.create({doc:t});return null==i&&(i=n.doc.length),this.regexp?uu(this,n,e,i):hu(this,n,e,i)}}class lu{constructor(t){this.spec=t}}function hu(t,e,i,n){return new Uc(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=hu(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 uu(t,e,i,n){return new Lc(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?(s=e.charCategorizer(e.selection.main.head),(t,e,i)=>!i[0].length||(s(du(i.input,i.index))!=wt.Word||s(fu(i.input,i.index))!=wt.Word)&&(s(fu(i.input,i.index+i[0].length))!=wt.Word||s(du(i.input,i.index+i[0].length))!=wt.Word)):void 0},i,n);var s}function du(t,e){return t.slice(f(t,e,!1),e)}function fu(t,e){return t.slice(e,f(t,e))}class pu extends lu{nextMatch(t,e,i){let n=uu(this.spec,t,i,t.doc.length).next();return n.done&&(n=uu(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=uu(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=uu(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 Ou=ut.define(),gu=ut.define(),mu=q.define({create:t=>new bu(_u(t).create(),null),update(t,e){for(let i of e.effects)i.is(Ou)?t=new bu(i.value.create(),t.panel):i.is(gu)&&(t=new bu(t.query,i.value?Cu:null));return t},provide:t=>Ur.from(t,(t=>t.panel))});class bu{constructor(t,e){this.query=t,this.panel=e}}const wu=ni.mark({class:"cm-searchMatch"}),vu=ni.mark({class:"cm-searchMatch cm-searchMatch-selected"}),yu=_i.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(mu))}update(t){let e=t.state.field(mu);(e!=t.startState.field(mu)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ni.none;let{view:i}=this,n=new Xt;for(let e=0,s=i.visibleRanges,r=s.length;es[e+1].from-500;)a=s[++e].to;t.highlight(i.state,o,a,((t,e)=>{let s=i.state.selection.ranges.some((i=>i.from==t&&i.to==e));n.add(t,e,s?vu:wu)}))}return n.finish()}},{decorations:t=>t.decorations});function Su(t){return e=>{let i=e.state.field(mu,!1);return i&&i.query.spec.valid?t(e,i):Au(e)}}const xu=Su(((t,{query:e})=>{let{to:i}=t.state.selection.main,n=e.nextMatch(t.state,i,i);if(!n)return!1;let s=A.single(n.from,n.to),r=t.state.facet(ou);return t.dispatch({selection:s,effects:[Wu(t,n),r.scrollToMatch(s.main,t)],userEvent:"select.search"}),Zu(t),!0})),ku=Su(((t,{query:e})=>{let{state:i}=t,{from:n}=i.selection.main,s=e.prevMatch(i,n,n);if(!s)return!1;let r=A.single(s.from,s.to),o=t.state.facet(ou);return t.dispatch({selection:r,effects:[Wu(t,s),o.scrollToMatch(r.main,t)],userEvent:"select.search"}),Zu(t),!0})),Qu=Su(((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!(!i||!i.length)&&(t.dispatch({selection:A.create(i.map((t=>A.range(t.from,t.to)))),userEvent:"select.search.matches"}),!0)})),$u=Su(((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,a,l=[],h=[];if(r.from==n&&r.to==s&&(a=i.toText(e.getReplacement(r)),l.push({from:r.from,to:r.to,insert:a}),r=e.nextMatch(i,r.from,r.to),h.push(Ts.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(n).number)+"."))),r){let e=0==l.length||l[0].from>=r.to?0:r.to-r.from-a.length;o=A.single(r.from-e,r.to-e),h.push(Wu(t,r)),h.push(i.facet(ou).scrollToMatch(o.main,t))}return t.dispatch({changes:l,selection:o,effects:h,userEvent:"input.replace"}),!0})),Pu=Su(((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:Ts.announce.of(n),userEvent:"input.replace.all"}),!0}));function Cu(t){return t.state.facet(ou).createPanel(t)}function _u(t,e){var i,n,s,r;let o=t.selection.main,a=o.empty||o.to>o.from+100?"":t.sliceDoc(o.from,o.to);if(e&&!a)return e;let l=t.facet(ou);return new au({search:(null!==(i=null==e?void 0:e.literal)&&void 0!==i?i:l.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:null!==(n=null==e?void 0:e.caseSensitive)&&void 0!==n?n:l.caseSensitive,literal:null!==(s=null==e?void 0:e.literal)&&void 0!==s?s:l.literal,wholeWord:null!==(r=null==e?void 0:e.wholeWord)&&void 0!==r?r:l.wholeWord})}function Xu(t){let e=Vr(t,Cu);return e&&e.dom.querySelector("[main-field]")}function Zu(t){let e=Xu(t);e&&e==t.root.activeElement&&e.select()}const Au=t=>{let e=t.state.field(mu,!1);if(e&&e.panel){let i=Xu(t);if(i&&i!=t.root.activeElement){let n=_u(t.state,e.query.spec);n.valid&&t.dispatch({effects:Ou.of(n)}),i.focus(),i.select()}}else t.dispatch({effects:[gu.of(!0),e?Ou.of(_u(t.state,e.query.spec)):ut.appendConfig.of(Yu)]});return!0},Tu=t=>{let e=t.state.field(mu,!1);if(!e||!e.panel)return!1;let i=Vr(t,Cu);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:gu.of(!1)}),!0},Ru=[{key:"Mod-f",run:Au,scope:"editor search-panel"},{key:"F3",run:xu,shift:ku,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:xu,shift:ku,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Tu,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 Uc(t.doc,t.sliceDoc(n,s));!e.next().done;){if(r.length>1e3)return!1;e.value.from==n&&(o=r.length),r.push(A.range(e.value.from,e.value.to))}return e(t.update({selection:A.create(r,o),userEvent:"select.search.matches"})),!0}},{key:"Alt-g",run:t=>{let e=Vr(t,Nc);if(!e){let i=[Gc.of(!0)];null==t.state.field(Fc,!1)&&i.push(ut.appendConfig.of([Fc,Hc])),t.dispatch({effects:i}),e=Vr(t,Nc)}return e&&e.dom.querySelector("input").focus(),!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=A.create(i.ranges.map((e=>t.wordAt(e.head)||A.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 Uc(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 Uc(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(A.range(s.from,s.to),!1),effects:Ts.scrollIntoView(s.to)})),!0)},preventDefault:!0}];class Eu{constructor(t){this.view=t;let e=this.query=t.state.field(mu).query.spec;function i(t,e,i){return Mc("button",{class:"cm-button",name:t,onclick:e,type:"button"},i)}this.commit=this.commit.bind(this),this.searchField=Mc("input",{value:e.search,placeholder:Vu(t,"Find"),"aria-label":Vu(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Mc("input",{value:e.replace,placeholder:Vu(t,"Replace"),"aria-label":Vu(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Mc("input",{type:"checkbox",name:"case",form:"",checked:e.caseSensitive,onchange:this.commit}),this.reField=Mc("input",{type:"checkbox",name:"re",form:"",checked:e.regexp,onchange:this.commit}),this.wordField=Mc("input",{type:"checkbox",name:"word",form:"",checked:e.wholeWord,onchange:this.commit}),this.dom=Mc("div",{onkeydown:t=>this.keydown(t),class:"cm-search"},[this.searchField,i("next",(()=>xu(t)),[Vu(t,"next")]),i("prev",(()=>ku(t)),[Vu(t,"previous")]),i("select",(()=>Qu(t)),[Vu(t,"all")]),...t.state.readOnly?[]:[Mc("br"),this.replaceField,i("replace",(()=>$u(t)),[Vu(t,"replace")]),i("replaceAll",(()=>Pu(t)),[Vu(t,"replace all")])],Mc("button",{name:"close",onclick:()=>Tu(t),"aria-label":Vu(t,"close"),type:"button"},["×"])])}commit(){let t=new au({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:Ou.of(t)}))}keydown(t){var e,i,n;e=this.view,i=t,n="search-panel",Bs(Ls(e.state),i,e,n)?t.preventDefault():13==t.keyCode&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?ku:xu)(this.view)):13==t.keyCode&&t.target==this.replaceField&&(t.preventDefault(),$u(this.view))}update(t){for(let e of t.transactions)for(let t of e.effects)t.is(Ou)&&!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(ou).top}}function Vu(t,e){return t.state.phrase(e)}const Mu=30,Du=/[\s\.,:;?!]/;function Wu(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-Mu),o=Math.min(s,i+Mu),a=t.state.sliceDoc(r,o);if(r!=n.from)for(let t=0;ta.length-Mu;t--)if(!Du.test(a[t-1])&&Du.test(a[t])){a=a.slice(0,t);break}return Ts.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${n.number}.`)}const Uu=Ts.baseTheme({".cm-panel.cm-search":{padding:"0.25rem 0.5rem 0.25rem 0.5rem",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"0.5rem",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"}}),Yu=[mu,N.lowest(yu),Uu];class qu{constructor(t,e,i){this.state=t,this.pos=e,this.explicit=i,this.abortListeners=[]}tokenBefore(t){let e=Xa(this.state).resolveInner(this.pos,-1);for(;e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null}matchBefore(t){let e=this.state.doc.lineAt(this.pos),i=Math.max(e.from,this.pos-250),n=e.text.slice(i-e.from,this.pos-e.from),s=n.search(ju(t,!1));return s<0?null:{from:i+s,to:this.pos,text:n.slice(s)}}get aborted(){return null==this.abortListeners}addEventListener(t,e){"abort"==t&&this.abortListeners&&this.abortListeners.push(e)}}function Lu(t){let e=Object.keys(t).join(""),i=/\w/.test(e);return i&&(e=e.replace(/\w/g,"")),`[${i?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function zu(t){let e=t.map((t=>"string"==typeof t?{label:t}:t)),[i,n]=e.every((t=>/^\w+$/.test(t.label)))?[/\w*$/,/\w+$/]:function(t){let e=Object.create(null),i=Object.create(null);for(let{label:n}of t){e[n[0]]=!0;for(let t=1;t{let s=t.matchBefore(n);return s||t.explicit?{from:s?s.from:t.pos,options:e,validFor:i}:null}}class Iu{constructor(t,e,i,n){this.completion=t,this.source=e,this.match=i,this.score=n}}function Bu(t){return t.selection.main.from}function ju(t,e){var i;let{source:n}=t,s=e&&"^"!=n[0],r="$"!=n[n.length-1];return s||r?new RegExp(`${s?"^":""}(?:${n})${r?"$":""}`,null!==(i=t.flags)&&void 0!==i?i:t.ignoreCase?"i":""):t}const Nu=lt.define();const Gu=new WeakMap;function Fu(t){if(!Array.isArray(t))return t;let e=Gu.get(t);return e||Gu.set(t,e=zu(t)),e}const Hu=ut.define(),Ju=ut.define();class Ku{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[];for(let e=0;e=48&&l<=57||l>=97&&l<=122?2:l>=65&&l<=90?1:0:(y=w(l))!=y.toLowerCase()?1:y!=y.toUpperCase()?2:0;(!n||1==S&&O||0==m&&0!=S)&&(e[c]==l||i[c]==l&&(u=!0)?r[c++]=n:r.length&&(g=!1)),m=S,n+=v(l)}return c==a&&0==r[0]&&g?this.result((u?-200:0)-100,r,t):d==a&&0==f?[-200-t.length+(p==t.length?0:-100),0,p]:o>-1?[-700-t.length,o,o+this.pattern.length]:d==a?[-900-t.length,f,p]:c==a?this.result((u?-200:0)-100-700+(g?0:-1100),r,t):2==e.length?null:this.result((n[0]?-700:0)-200-1100,n,t)}result(t,e,i){let n=[t-i.length],s=1;for(let t of e){let e=t+(this.astral?v(b(i,t)):1);s>1&&n[s-1]==t?n[s-1]=e:(n[s++]=t,n[s++]=e)}return n}}const td=E.define({combine:t=>kt(t,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:id,compareCompletions:(t,e)=>t.label.localeCompare(e.label),interactionDelay:75},{defaultKeymap:(t,e)=>t&&e,closeOnBlur:(t,e)=>t&&e,icons:(t,e)=>t&&e,tooltipClass:(t,e)=>i=>ed(t(i),e(i)),optionClass:(t,e)=>i=>ed(t(i),e(i)),addToOptions:(t,e)=>t.concat(e)})});function ed(t,e){return t?e?t+" "+e:t:e}function id(t,e,i,n,s){let r,o,a=t.textDirection==Wi.RTL,l=a,h=!1,c="top",u=e.left-s.left,d=s.right-e.right,f=n.right-n.left,p=n.bottom-n.top;if(l&&u=p||t>e.top?r=i.bottom-e.top:(c="bottom",r=e.bottom-i.top)}return{style:`${c}: ${r}px; max-width: ${o}px`,class:"cm-completionInfo-"+(h?a?"left-narrow":"right-narrow":l?"left":"right")}}function nd(t,e="option"){return i=>{let n=i.state.field(yd,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp-1?n.open.selected+r*(t?1:-1):t?0:o-1;return a<0?a="page"==e?0:o-1:a>=o&&(a="page"==e?o-1:0),i.dispatch({effects:vd.of(a)}),!0}}const sd=t=>{let e=t.state.field(yd,!1);return!(t.state.readOnly||!e||!e.open||e.open.selected<0||Date.now()-e.open.timestamp(t.selection||t.docChanged)&&!gd(t)));for(let e=0;e50&&Date.now()-n.time>1e3){for(let t of n.context.abortListeners)try{t()}catch(t){Qi(this.view.state,t)}n.context.abortListeners=null,this.running.splice(e--,1)}else n.updates.push(...t.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some((t=>1==t.state&&!this.running.some((e=>e.active.source==t.source))))?setTimeout((()=>this.startUpdate()),50):-1,0!=this.composing)for(let e of t.transactions)"input"==gd(e)?this.composing=2:2==this.composing&&e.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:t}=this.view,e=t.field(yd);for(let t of e.active)1!=t.state||this.running.some((e=>e.active.source==t.source))||this.startQuery(t)}startQuery(t){let{state:e}=this.view,i=Bu(e),n=new qu(e,i,t.explicitPos==i),s=new rd(t,n);this.running.push(s),Promise.resolve(t.source(n)).then((t=>{s.context.aborted||(s.done=t||null,this.scheduleAccept())}),(t=>{this.view.dispatch({effects:Ju.of(null)}),Qi(this.view.state,t)}))}scheduleAccept(){this.running.every((t=>void 0!==t.done))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((()=>this.accept()),50))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],i=this.view.state.facet(td);for(let n=0;nt.source==s.active.source));if(r&&1==r.state)if(null==s.done){let t=new md(s.active.source,0);for(let e of s.updates)t=t.update(e,i);1!=t.state&&e.push(t)}else this.startQuery(r)}e.length&&this.view.dispatch({effects:wd.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(yd,!1);if(e&&e.tooltip&&this.view.state.facet(td).closeOnBlur){let i=e.open&&Rr(this.view,e.open.tooltip);i&&i.dom.contains(t.relatedTarget)||this.view.dispatch({effects:Ju.of(null)})}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout((()=>this.view.dispatch({effects:Hu.of(!1)})),20),this.composing=0}}});function ad(t,e){const i=e.completion.apply||e.completion.label;let n=t.state.field(yd).active.find((t=>t.source==e.source));return n instanceof bd&&("string"==typeof i?t.dispatch(Object.assign(Object.assign({},function(t,e,i,n){let{main:s}=t.selection,r=i-s.from,o=n-s.from;return Object.assign(Object.assign({},t.changeByRange((a=>a!=s&&i!=n&&t.sliceDoc(a.from+r,a.from+o)!=t.sliceDoc(i,n)?{range:a}:{changes:{from:a.from+r,to:n==s.from?a.to:a.from+o,insert:e},range:A.cursor(a.from+r+e.length)}))),{userEvent:"input.complete"})}(t.state,i,n.from,n.to)),{annotations:Nu.of(e.completion)})):i(t,e.completion,n.from,n.to),!0)}function ld(t,e,i){if(t<=i)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let t=Math.floor(e/i);return{from:t*i,to:(t+1)*i}}let n=Math.floor((t-e)/i);return{from:t-(n+1)*i,to:t-n*i}}class hd{constructor(t,e){this.view=t,this.stateField=e,this.info=null,this.placeInfoReq={read:()=>this.measureInfo(),write:t=>this.placeInfo(t),key:this},this.space=null,this.currentClass="";let i=t.state.field(e),{options:n,selected:s}=i.open,r=t.state.facet(td);this.optionContent=function(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(t){let e=document.createElement("div");return e.classList.add("cm-completionIcon"),t.type&&e.classList.add(...t.type.split(/\s+/g).map((t=>"cm-completionIcon-"+t))),e.setAttribute("aria-hidden","true"),e},position:20}),e.push({render(t,e,i){let n=document.createElement("span");n.className="cm-completionLabel";let{label:s}=t,r=0;for(let t=1;tr&&n.appendChild(document.createTextNode(s.slice(r,e)));let a=n.appendChild(document.createElement("span"));a.appendChild(document.createTextNode(s.slice(e,o))),a.className="cm-completionMatchedText",r=o}return rt.position-e.position)).map((t=>t.render))}(r),this.optionClass=r.optionClass,this.tooltipClass=r.tooltipClass,this.range=ld(n.length,s,r.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",(e=>{for(let i,s=e.target;s&&s!=this.dom;s=s.parentNode)if("LI"==s.nodeName&&(i=/-(\d+)$/.exec(s.id))&&+i[1]{let i=t.state.field(this.stateField,!1);i&&i.tooltip&&t.state.facet(td).closeOnBlur&&e.relatedTarget!=t.contentDOM&&t.dispatch({effects:Ju.of(null)})})),this.list=this.dom.appendChild(this.createListBox(n,i.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))}mount(){this.updateSel()}update(t){var e,i,n;let s=t.state.field(this.stateField),r=t.startState.field(this.stateField);this.updateTooltipClass(t.state),s!=r&&(this.updateSel(),(null===(e=s.open)||void 0===e?void 0:e.disabled)!=(null===(i=r.open)||void 0===i?void 0:i.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!(null===(n=s.open)||void 0===n?void 0:n.disabled)))}updateTooltipClass(t){let e=this.tooltipClass(t);if(e!=this.currentClass){for(let t of this.currentClass.split(" "))t&&this.dom.classList.remove(t);for(let t of e.split(" "))t&&this.dom.classList.add(t);this.currentClass=e}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),e=t.open;if((e.selected>-1&&e.selected=this.range.to)&&(this.range=ld(e.options.length,e.selected,this.view.state.facet(td).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e.options,t.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))),this.updateSelectedOption(e.selected)){this.info&&(this.info.remove(),this.info=null);let{completion:i}=e.options[e.selected],{info:n,label:s,c:r}=i;if(!n)return;let o="string"==typeof n?document.createTextNode(n+" "):n(i);if(!o)return;if(!r){const t=document.createElement("span");t.appendChild(o),o=t;const e=document.createElement("a");e.innerText="🔎",e.href="/docFind/"+s,e.target="blank",o.appendChild(e)}if(!o)return;"then"in o?o.then((e=>{e&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(e)})).catch((t=>Qi(this.view.state,t,"completion info"))):this.addInfoPane(o)}}addInfoPane(t){let e=this.info=document.createElement("div");e.className="cm-tooltip cm-completionInfo",e.appendChild(t),this.dom.appendChild(e),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let e=null;for(let i=this.list.firstChild,n=this.range.from;i;i=i.nextSibling,n++)"LI"==i.nodeName&&i.id?n==t?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),e=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected"):n--;return e&&function(t,e){let i=t.getBoundingClientRect(),n=e.getBoundingClientRect();n.topi.bottom&&(t.scrollTop+=n.bottom-i.bottom)}(this.list,e),e}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let e=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),n=t.getBoundingClientRect(),s=this.space;if(!s){let t=this.dom.ownerDocument.defaultView||window;s={left:0,top:0,right:t.innerWidth,bottom:t.innerHeight}}return n.top>Math.min(s.bottom,e.bottom)-10||n.bottomi.from||0==i.from))if(s=t,"string"!=typeof l&&l.header)n.appendChild(l.header(l));else{n.appendChild(document.createElement("completion-section")).textContent=t}}const h=n.appendChild(document.createElement("li"));h.id=e+"-"+r,h.setAttribute("role","option");let c=this.optionClass(o);c&&(h.className=c);for(let t of this.optionContent){let e=t(o,this.view.state,a);e&&h.appendChild(e)}}return i.from&&n.classList.add("cm-completionListIncompleteTop"),i.to=this.options.length?this:new ud(this.options,pd(e,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,e,i,n,s){let r=function(t,e){let i=[],n=null,s=t=>{i.push(t);let{section:e}=t.completion;if(e){n||(n=[]);let t="string"==typeof e?e:e.name;n.some((e=>e.name==t))||n.push("string"==typeof e?{name:t}:e)}};for(let n of t)if(n.hasResult())if(!1===n.result.filter){let t=n.result.getMatch;for(let e of n.result.options){let r=[1e9-i.length];if(t)for(let i of t(e))r.push(i);s(new Iu(e,n.source,r,r[0]))}}else{let t,i=new Ku(e.sliceDoc(n.from,n.to));for(let e of n.result.options)(t=i.match(e.label))&&s(new Iu(e,n.source,t,t[0]+(e.boost||0)))}if(n){let t=Object.create(null),e=0,s=(t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:1e9)-(null!==(n=e.rank)&&void 0!==n?n:1e9)||(t.namee.score-t.score||a(t.completion,e.completion))))!o||o.label!=t.completion.label||o.detail!=t.completion.detail||null!=o.type&&null!=t.completion.type&&o.type!=t.completion.type||o.apply!=t.completion.apply?r.push(t):cd(t.completion)>cd(o)&&(r[r.length-1]=t),o=t.completion;return r}(t,e);if(!r.length)return n&&t.some((t=>1==t.state))?new ud(n.options,n.attrs,n.tooltip,n.timestamp,n.selected,!0):null;let o=e.facet(td).selectOnOpen?0:-1;if(n&&n.selected!=o&&-1!=n.selected){let t=n.options[n.selected].completion;for(let e=0;ee.hasResult()?Math.min(t,e.from):t),1e8),create:(a=yd,t=>new hd(t,a)),above:s.aboveCursor},n?n.timestamp:Date.now(),o,!1);var a}map(t){return new ud(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class dd{constructor(t,e,i){this.active=t,this.id=e,this.open=i}static start(){return new dd(Od,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(t){let{state:e}=t,i=e.facet(td),n=(i.override||e.languageDataAt("autocomplete",Bu(e)).map(Fu)).map((e=>(this.active.find((t=>t.source==e))||new md(e,this.active.some((t=>0!=t.state))?1:0)).update(t,i)));n.length==this.active.length&&n.every(((t,e)=>t==this.active[e]))&&(n=this.active);let s=this.open;s&&t.docChanged&&(s=s.map(t.changes)),t.selection||n.some((e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to)))||!function(t,e){if(t==e)return!0;for(let i=0,n=0;;){for(;i1==t.state))&&(s=null),!s&&n.every((t=>1!=t.state))&&n.some((t=>t.hasResult()))&&(n=n.map((t=>t.hasResult()?new md(t.source,0):t)));for(let e of t.effects)e.is(vd)&&(s=s&&s.setSelected(e.value,this.id));return n==this.active&&s==this.open?this:new dd(n,this.id,s)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:fd}}const fd={"aria-autocomplete":"list"};function pd(t,e){let i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(i["aria-activedescendant"]=t+"-"+e),i}const Od=[];function gd(t){return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null}class md{constructor(t,e,i=-1){this.source=t,this.state=e,this.explicitPos=i}hasResult(){return!1}update(t,e){let i=gd(t),n=this;i?n=n.handleUserEvent(t,i,e):t.docChanged?n=n.handleChange(t):t.selection&&0!=n.state&&(n=new md(n.source,0));for(let e of t.effects)if(e.is(Hu))n=new md(n.source,1,e.value?Bu(t.state):-1);else if(e.is(Ju))n=new md(n.source,0);else if(e.is(wd))for(let t of e.value)t.source==n.source&&(n=t);return n}handleUserEvent(t,e,i){return"delete"!=e&&i.activateOnTyping?new md(this.source,1):this.map(t.changes)}handleChange(t){return t.changes.touchesRange(Bu(t.startState))?new md(this.source,0):this.map(t.changes)}map(t){return t.empty||this.explicitPos<0?this:new md(this.source,this.state,t.mapPos(this.explicitPos))}}class bd extends md{constructor(t,e,i,n,s){super(t,2,e),this.result=i,this.from=n,this.to=s}hasResult(){return!0}handleUserEvent(t,e,i){var n;let s=t.changes.mapPos(this.from),r=t.changes.mapPos(this.to,1),o=Bu(t.state);if((this.explicitPos<0?o<=s:or||"delete"==e&&Bu(t.startState)==this.from)return new md(this.source,"input"==e&&i.activateOnTyping?1:0);let a,l=this.explicitPos<0?-1:t.changes.mapPos(this.explicitPos);return function(t,e,i,n){if(!t)return!1;let s=e.sliceDoc(i,n);return"function"==typeof t?t(s,i,n,e):ju(t,!0).test(s)}(this.result.validFor,t.state,s,r)?new bd(this.source,l,this.result,s,r):this.result.update&&(a=this.result.update(this.result,s,r,new qu(t.state,o,l>=0)))?new bd(this.source,l,a,a.from,null!==(n=a.to)&&void 0!==n?n:Bu(t.state)):new md(this.source,1,l)}handleChange(t){return t.changes.touchesRange(this.from,this.to)?new md(this.source,0):this.map(t.changes)}map(t){return t.empty?this:new bd(this.source,this.explicitPos<0?-1:t.mapPos(this.explicitPos),this.result,t.mapPos(this.from),t.mapPos(this.to,1))}}const wd=ut.define({map:(t,e)=>t.map((t=>t.map(e)))}),vd=ut.define(),yd=q.define({create:()=>dd.start(),update:(t,e)=>t.update(e),provide:t=>[Tr.from(t,(t=>t.tooltip)),Ts.contentAttributes.from(t,(t=>t.attrs))]}),Sd=Ts.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class xd{constructor(t,e,i,n){this.field=t,this.line=e,this.from=i,this.to=n}}class kd{constructor(t,e,i){this.field=t,this.from=e,this.to=i}map(t){let e=t.mapPos(this.from,-1,S.TrackDel),i=t.mapPos(this.to,1,S.TrackDel);return null==e||null==i?null:new kd(this.field,e,i)}}class Qd{constructor(t,e){this.lines=t,this.fieldPositions=e}instantiate(t,e){let i=[],n=[e],s=t.doc.lineAt(e),r=/^\s*/.exec(s.text)[0];for(let s of this.lines){if(i.length){let i=r,o=/^\t*/.exec(s)[0].length;for(let e=0;enew kd(t.field,n[t.line]+t.from,n[t.line]+t.to)));return{text:i,ranges:o}}static parse(t){let e,i=[],n=[],s=[];for(let r of t.split(/\r\n?|\n/)){for(;e=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(r);){let t=e[1]?+e[1]:null,o=e[2]||e[3]||"",a=-1;for(let e=0;e=a&&t.field++}s.push(new xd(a,n.length,e.index,e.index+o.length)),r=r.slice(0,e.index)+o+r.slice(e.index+e[0].length)}for(let t;t=/\\([{}])/.exec(r);){r=r.slice(0,t.index)+t[1]+r.slice(t.index+t[0].length);for(let e of s)e.line==n.length&&e.from>t.index&&(e.from--,e.to--)}n.push(r)}return new Qd(n,s)}}let $d=ni.widget({widget:new class extends ei{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),Pd=ni.mark({class:"cm-snippetField"});class Cd{constructor(t,e){this.ranges=t,this.active=e,this.deco=ni.set(t.map((t=>(t.from==t.to?$d:Pd).range(t.from,t.to))))}map(t){let e=[];for(let i of this.ranges){let n=i.map(t);if(!n)return null;e.push(n)}return new Cd(e,this.active)}selectionInsideField(t){return t.ranges.every((t=>this.ranges.some((e=>e.field==this.active&&e.from<=t.from&&e.to>=t.to))))}}const _d=ut.define({map:(t,e)=>t&&t.map(e)}),Xd=ut.define(),Zd=q.define({create:()=>null,update(t,e){for(let i of e.effects){if(i.is(_d))return i.value;if(i.is(Xd)&&t)return new Cd(t.ranges,i.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>Ts.decorations.from(t,(t=>t?t.deco:ni.none))});function Ad(t,e){return A.create(t.filter((t=>t.field==e)).map((t=>A.range(t.from,t.to))))}function Td(e){let i=Qd.parse(e);return(e,n,s,r)=>{let{text:o,ranges:a}=i.instantiate(e.state,s),l={changes:{from:s,to:r,insert:t.of(o)},scrollIntoView:!0,annotations:n?Nu.of(n):void 0};if(a.length&&(l.selection=Ad(a,0)),a.length>1){let t=new Cd(a,0),i=l.effects=[_d.of(t)];void 0===e.state.field(Zd,!1)&&i.push(ut.appendConfig.of([Zd,Md,Wd,Sd]))}e.dispatch(e.state.update(l))}}function Rd(t){return({state:e,dispatch:i})=>{let n=e.field(Zd,!1);if(!n||t<0&&0==n.active)return!1;let s=n.active+t,r=t>0&&!n.ranges.some((e=>e.field==s+t));return i(e.update({selection:Ad(n.ranges,s),effects:_d.of(r?null:new Cd(n.ranges,s))})),!0}}const Ed=[{key:"Tab",run:Rd(1),shift:Rd(-1)},{key:"Escape",run:({state:t,dispatch:e})=>!!t.field(Zd,!1)&&(e(t.update({effects:_d.of(null)})),!0)}],Vd=E.define({combine:t=>t.length?t[0]:Ed}),Md=N.highest(Ys.compute([Vd],(t=>t.facet(Vd))));function Dd(t,e){return Object.assign(Object.assign({},e),{apply:Td(t)})}const Wd=Ts.domEventHandlers({mousedown(t,e){let i,n=e.state.field(Zd,!1);if(!n||null==(i=e.posAtCoords({x:t.clientX,y:t.clientY})))return!1;let s=n.ranges.find((t=>t.from<=i&&t.to>=i));return!(!s||s.field==n.active)&&(e.dispatch({selection:Ad(n.ranges,s.field),effects:_d.of(n.ranges.some((t=>t.field>s.field))?new Cd(n.ranges,s.field):null)}),!0)}}),Ud=new class extends Qt{};function Yd(t={}){return[yd,td.of(t),od,Ld,Sd]}Ud.startSide=1,Ud.endSide=-1;const qd=[{key:"Ctrl-Space",run:t=>!!t.state.field(yd,!1)&&(t.dispatch({effects:Hu.of(!0)}),!0)},{key:"Escape",run:t=>{let e=t.state.field(yd,!1);return!(!e||!e.active.some((t=>0!=t.state)))&&(t.dispatch({effects:Ju.of(null)}),!0)}},{key:"ArrowDown",run:nd(!0)},{key:"ArrowUp",run:nd(!1)},{key:"PageDown",run:nd(!0,"page")},{key:"PageUp",run:nd(!1,"page")},{key:"Enter",run:sd}],Ld=N.highest(Ys.computeN([td],(t=>t.facet(td).defaultKeymap?[qd]:[]))),zd=(()=>[vr(),Sh(),ir(),$l(_l,{fallback:!0}),Ys.of([...Vc,...Wh])])();class Id{constructor(t,e,i,n,s,r,o,a,l,h=0,c){this.p=t,this.stack=e,this.state=i,this.reducePos=n,this.pos=s,this.score=r,this.buffer=o,this.bufferBase=a,this.curContext=l,this.lookAhead=h,this.parent=c}toString(){return`[${this.stack.filter(((t,e)=>e%3==0)).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,i=0){let n=t.parser.context;return new Id(t,[],e,i,i,0,[],0,n?new Bd(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let i=t>>19,n=65535&t,{parser:s}=this.p,r=s.dynamicPrecedence(n);if(r&&(this.score+=r),0==i)return this.pushState(s.getGoto(this.state,n,!0),this.reducePos),n=2e3&&!(null===(e=this.p.parser.nodeSet.types[n])||void 0===e?void 0:e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=l):this.p.lastBigReductionSizeo;)this.stack.pop();this.reduceContext(n,a)}storeNode(t,e,i,n=4,s=!1){if(0==t&&(!this.stack.length||this.stack[this.stack.length-1]0&&0==t.buffer[n-4]&&t.buffer[n-1]>-1){if(e==i)return;if(t.buffer[n-2]>=e)return void(t.buffer[n-2]=i)}}if(s&&this.pos!=i){let s=this.buffer.length;if(s>0&&0!=this.buffer[s-4])for(;s>0&&this.buffer[s-2]>i;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,n>4&&(n-=4);this.buffer[s]=t,this.buffer[s+1]=e,this.buffer[s+2]=i,this.buffer[s+3]=n}else this.buffer.push(t,e,i,n)}shift(t,e,i){let n=this.pos;if(131072&t)this.pushState(65535&t,this.pos);else if(0==(262144&t)){let s=t,{parser:r}=this.p;(i>this.pos||e<=r.maxNode)&&(this.pos=i,r.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,n),this.shiftContext(e,n),e<=r.maxNode&&this.buffer.push(e,n,i,4)}else this.pos=i,this.shiftContext(e,n),e<=this.p.parser.maxNode&&this.buffer.push(e,n,i,4)}apply(t,e,i){65536&t?this.reduce(t):this.shift(t,e,i)}useNode(t,e){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=t)&&(this.p.reused.push(t),i++);let n=this.pos;this.reducePos=this.pos=n+t.length,this.pushState(e,n),this.buffer.push(i,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let i=t.buffer.slice(e),n=t.bufferBase+e;for(;t&&n==t.bufferBase;)t=t.parent;return new Id(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,n,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let i=t<=this.p.parser.maxNode;i&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,i?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new Nd(this);;){let i=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(0==i)return!1;if(0==(65536&i))return!0;e.reduce(i)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let n,s=0;s1&e&&t==n))||i.push(e[t],n)}e=i}let i=[];for(let t=0;t>19,n=65535&t,s=this.stack.length-3*i;if(s<0||e.getGoto(this.stack[s],n,!1)<0)return!1;this.storeNode(0,this.reducePos,this.reducePos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:t}=this.p;return 65535==t.data[t.stateSlot(this.state,1)]&&!t.stateSlot(this.state,4)}restart(){this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;ethis.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Bd{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}var jd;!function(t){t[t.Insert=200]="Insert",t[t.Delete=190]="Delete",t[t.Reduce=100]="Reduce",t[t.MaxNext=4]="MaxNext",t[t.MaxInsertStackDepth=300]="MaxInsertStackDepth",t[t.DampenInsertStackDepth=120]="DampenInsertStackDepth",t[t.MinBigReduction=2e3]="MinBigReduction"}(jd||(jd={}));class Nd{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=65535&t,i=t>>19;0==i?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(i-1);let n=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=n}}class Gd{constructor(t,e,i){this.stack=t,this.pos=e,this.index=i,this.buffer=t.buffer,0==this.index&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new Gd(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;null!=t&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new Gd(this.stack,this.pos,this.index)}}function Fd(t,e=Uint16Array){if("string"!=typeof t)return t;let i=null;for(let n=0,s=0;n=92&&e--,e>=34&&e--;let s=e-32;if(s>=46&&(s-=46,i=!0),r+=s,i)break;r*=46}i?i[s++]=r:i=new e(r)}return i}class Hd{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Jd=new Hd;class Kd{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Jd,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let i=this.range,n=this.rangeIndex,s=this.pos+t;for(;si.to:s>=i.to;){if(n==this.ranges.length-1)return null;let t=this.ranges[++n];s+=t.from-i.to,i=t}return s}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,e.from);return this.end}peek(t){let e,i,n=this.chunkOff+t;if(n>=0&&n=this.chunk2Pos&&en.to&&(this.chunk2=this.chunk2.slice(0,n.to-e)),i=this.chunk2.charCodeAt(0)}}return e>=this.token.lookAhead&&(this.token.lookAhead=e+1),i}acceptToken(t,e=0){let i=e?this.resolveOffset(e,-1):this.pos;if(null==i||i=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=Jd,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let i="";for(let n of this.ranges){if(n.from>=e)break;n.to>t&&(i+=this.input.read(Math.max(n.from,t),Math.min(n.to,e)))}return i}}class tf{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:i}=e.p;sf(this.data,t,e,this.id,i.data,i.tokenPrecTable)}}tf.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class ef{constructor(t,e,i){this.precTable=e,this.elseToken=i,this.data="string"==typeof t?Fd(t):t}token(t,e){let i=t.pos,n=0;for(;sf(this.data,t,e,0,this.data,this.precTable),!(t.token.value>-1);){if(null==this.elseToken)return;if(t.next<0)break;t.advance(),t.reset(t.pos,t.token),n++}n&&(t.reset(i,t.token),t.acceptToken(this.elseToken,n))}}ef.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class nf{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function sf(t,e,i,n,s,r){let o=0,a=1<0){let i=t[n];if(l.allows(i)&&(-1==e.token.value||e.token.value==i||of(i,e.token.value,s,r))){e.acceptToken(i);break}}let n=e.next,h=0,c=t[o+2];if(!(e.next<0&&c>h&&65535==t[i+3*c-3]&&65535==t[i+3*c-3])){for(;h>1,r=i+s+(s<<1),a=t[r],l=t[r+1]||65536;if(n=l)){o=t[r+2],e.advance();continue t}h=s+1}}break}o=t[i+3*c-1]}}function rf(t,e,i){for(let n,s=e;65535!=(n=t[s]);s++)if(n==i)return s-e;return-1}function of(t,e,i,n){let s=rf(i,n,e);return s<0||rf(i,n,t)e)&&!n.type.isError)return i<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(t.length,Math.max(n.from+1,e+25));if(i<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return i<0?0:t.length}}!function(t){t[t.Margin=25]="Margin"}(hf||(hf={}));let uf=class{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?cf(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?cf(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=r,null;if(s instanceof bo){if(r==t){if(r=Math.max(this.safeFrom,t)&&(this.trees.push(s),this.start.push(r),this.index.push(0))}else this.index[e]++,this.nextStart=r+s.length}}};class df{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map((t=>new Hd))}getActions(t){let e=0,i=null,{parser:n}=t.p,{tokenizers:s}=n,r=n.stateSlot(t.state,3),o=t.curContext?t.curContext.hash:0,a=0;for(let n=0;nh.end+25&&(a=Math.max(h.lookAhead,a)),0!=h.value)){let n=e;if(h.extended>-1&&(e=this.addActions(t,h.extended,h.end,e)),e=this.addActions(t,h.value,h.end,e),!l.extend&&(i=h,e>n))break}}for(;this.actions.length>e;)this.actions.pop();return a&&t.setLookAhead(a),i||t.pos!=this.stream.end||(i=new Hd,i.value=t.p.parser.eofTerm,i.start=i.end=t.pos,e=this.addActions(t,i.value,i.end,e)),this.mainToken=i,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new Hd,{pos:i,p:n}=t;return e.start=i,e.end=Math.min(i+1,n.stream.end),e.value=i==n.stream.end?n.parser.eofTerm:0,e}updateCachedToken(t,e,i){let n=this.stream.clipPos(i.pos);if(e.token(this.stream.reset(n,t),i),t.value>-1){let{parser:e}=i.p;for(let n=0;n=0&&i.p.parser.dialect.allows(s>>1)){0==(1&s)?t.value=s>>1:t.extended=s>>1;break}}}else t.value=0,t.end=this.stream.clipPos(n+1)}putAction(t,e,i,n){for(let e=0;e4*t.bufferLength?new uf(i,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t,e,i=this.stacks,n=this.minStackPos,s=this.stacks=[];if(this.bigReductionCount>300&&1==i.length){let[t]=i;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;rn)s.push(o);else{if(this.advanceStack(o,s,i))continue;{t||(t=[],e=[]),t.push(o);let i=this.tokens.getMainToken(o);e.push(i.value,i.end)}}break}}if(!s.length){let e=t&&function(t){let e=null;for(let i of t){let t=i.p.stoppedAt;(i.pos==i.p.stream.end||null!=t&&i.pos>t)&&i.p.parser.stateFlag(i.state,2)&&(!e||e.scorethis.stoppedAt?t[0]:this.runRecovery(t,e,s);if(i)return this.stackToTree(i.forceAll())}if(this.recovering){let t=1==this.recovering?1:3*this.recovering;if(s.length>t)for(s.sort(((t,e)=>e.score-t.score));s.length>t;)s.pop();s.some((t=>t.reducePos>n))&&this.recovering--}else if(s.length>1){t:for(let t=0;t500&&n.buffer.length>500){if(!((e.score-n.score||e.buffer.length-n.buffer.length)>0)){s.splice(t--,1);continue t}s.splice(i--,1)}}}s.length>12&&s.splice(12,s.length-12)}this.minStackPos=s[0].pos;for(let t=1;t ":"";if(null!=this.stoppedAt&&n>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let e=t.curContext&&t.curContext.tracker.strict,i=e?t.curContext.hash:0;for(let o=this.fragments.nodeAt(n);o;){let n=this.parser.nodeSet.types[o.type.id]==o.type?s.getGoto(t.state,o.type.id):-1;if(n>-1&&o.length&&(!e||(o.prop(ho.contextHash)||0)==i))return t.useNode(o,n),af&&console.log(r+this.stackID(t)+` (via reuse of ${s.getName(o.type.id)})`),!0;if(!(o instanceof bo)||0==o.children.length||o.positions[0]>0)break;let a=o.children[0];if(!(a instanceof bo&&0==o.positions[0]))break;o=a}}let o=s.stateSlot(t.state,4);if(o>0)return t.reduce(o),af&&console.log(r+this.stackID(t)+` (via always-reduce ${s.getName(65535&o)})`),!0;if(t.stack.length>=15e3)for(;t.stack.length>9e3&&t.forceReduce(););let a=this.tokens.getActions(t);for(let o=0;on?e.push(d):i.push(d)}return!1}advanceFully(t,e){let i=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>i)return Of(t,e),!0}}runRecovery(t,e,i){let n=null,s=!1;for(let r=0;r ":"";if(o.deadEnd){if(s)continue;if(s=!0,o.restart(),af&&console.log(h+this.stackID(o)+" (restarted)"),this.advanceFully(o,i))continue}let c=o.split(),u=h;for(let t=0;c.forceReduce()&&t<10;t++){if(af&&console.log(u+this.stackID(c)+" (via force-reduce)"),this.advanceFully(c,i))break;af&&(u=this.stackID(c)+" -> ")}for(let t of o.recoverByInsert(a))af&&console.log(h+this.stackID(t)+" (via recover-insert)"),this.advanceFully(t,i);this.stream.end>o.pos?(l==o.pos&&(l++,a=0),o.recoverByDelete(a,l),af&&console.log(h+this.stackID(o)+` (via recover-delete ${this.parser.getName(a)})`),Of(o,i)):(!n||n.scoret;class bf{constructor(t){this.start=t.start,this.shift=t.shift||mf,this.reduce=t.reduce||mf,this.reuse=t.reuse||mf,this.hash=t.hash||(()=>0),this.strict=!1!==t.strict}}class wf extends Vo{constructor(t){if(super(),this.wrappers=[],14!=t.version)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let i=0;it.topRules[e][1])),n=[];for(let t=0;t=0)s(n,t,e[i++]);else{let r=e[i+-n];for(let o=-n;o>0;o--)s(e[i++],t,r);i++}}}this.nodeSet=new po(e.map(((e,s)=>fo.define({name:s>=this.minRepeatTerm?void 0:e,id:s,props:n[s],top:i.indexOf(s)>-1,error:0==s,skipped:t.skippedNodes&&t.skippedNodes.indexOf(s)>-1})))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=oo;let r=Fd(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let t=0;t"number"==typeof t?new tf(r,t):t)),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,i){let n=new pf(this,t,e,i);for(let s of this.wrappers)n=s(n,t,e,i);return n}getGoto(t,e,i=!1){let n=this.goto;if(e>=n[0])return-1;for(let s=n[e+1];;){let e=n[s++],r=1&e,o=n[s++];if(r&&i)return o;for(let i=s+(e>>1);s0}validAction(t,e){if(e==this.stateSlot(t,4))return!0;for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])return!1;i=vf(this.data,i+2)}if(e==vf(this.data,i+1))return!0}}nextStates(t){let e=[];for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])break;i=vf(this.data,i+2)}if(0==(1&this.data[i+2])){let t=this.data[i+1];e.some(((e,i)=>1&i&&e==t))||e.push(this.data[i],t)}}return e}configure(t){let e=Object.assign(Object.create(wf.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let i=this.topRules[t.top];if(!i)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=i}return t.tokenizers&&(e.tokenizers=this.tokenizers.map((e=>{let i=t.tokenizers.find((t=>t.from==e));return i?i.to:e}))),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map(((i,n)=>{let s=t.specializers.find((t=>t.from==i.external));if(!s)return i;let r=Object.assign(Object.assign({},i),{external:s.to});return e.specializers[n]=yf(r),r}))),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),null!=t.strict&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),null!=t.bufferLength&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return null==e?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),i=e.map((()=>!1));if(t)for(let n of t.split(" ")){let t=e.indexOf(n);t>=0&&(i[t]=!0)}let n=null;for(let t=0;tt.external(i,n)<<1|e}return t.get}const Sf=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],xf=new bf({start:!1,shift:(t,e)=>3==e||4==e||305==e?t:306==e,strict:!1}),kf=new nf(((t,e)=>{let{next:i}=t;(125==i||-1==i||e.context)&&e.canShift(303)&&t.acceptToken(303)}),{contextual:!0,fallback:!0}),Qf=new nf(((t,e)=>{let i,{next:n}=t;Sf.indexOf(n)>-1||(47!=n||47!=(i=t.peek(1))&&42!=i)&&125!=n&&59!=n&&-1!=n&&!e.context&&e.canShift(302)&&t.acceptToken(302)}),{contextual:!0}),$f=new nf(((t,e)=>{let{next:i}=t;if((43==i||45==i)&&(t.advance(),i==t.next)){t.advance();let i=!e.context&&e.canShift(1);t.acceptToken(i?1:2)}}),{contextual:!0}),Pf=ea({"get set async static":Sa.modifier,"for while do if else switch try catch finally return throw break continue default case":Sa.controlKeyword,"in of await yield void typeof delete instanceof":Sa.operatorKeyword,"let var const function class extends":Sa.definitionKeyword,"import export from":Sa.moduleKeyword,"with debugger as new":Sa.keyword,TemplateString:Sa.special(Sa.string),super:Sa.atom,BooleanLiteral:Sa.bool,this:Sa.self,null:Sa.null,Star:Sa.modifier,VariableName:Sa.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":Sa.function(Sa.variableName),VariableDefinition:Sa.definition(Sa.variableName),Label:Sa.labelName,PropertyName:Sa.propertyName,PrivatePropertyName:Sa.special(Sa.propertyName),"CallExpression/MemberExpression/PropertyName":Sa.function(Sa.propertyName),"FunctionDeclaration/VariableDefinition":Sa.function(Sa.definition(Sa.variableName)),"ClassDeclaration/VariableDefinition":Sa.definition(Sa.className),PropertyDefinition:Sa.definition(Sa.propertyName),PrivatePropertyDefinition:Sa.definition(Sa.special(Sa.propertyName)),UpdateOp:Sa.updateOperator,LineComment:Sa.lineComment,BlockComment:Sa.blockComment,Number:Sa.number,String:Sa.string,Escape:Sa.escape,ArithOp:Sa.arithmeticOperator,LogicOp:Sa.logicOperator,BitOp:Sa.bitwiseOperator,CompareOp:Sa.compareOperator,RegExp:Sa.regexp,Equals:Sa.definitionOperator,Arrow:Sa.function(Sa.punctuation),": Spread":Sa.punctuation,"( )":Sa.paren,"[ ]":Sa.squareBracket,"{ }":Sa.brace,"InterpolationStart InterpolationEnd":Sa.special(Sa.brace),".":Sa.derefOperator,", ;":Sa.separator,"@":Sa.meta,TypeName:Sa.typeName,TypeDefinition:Sa.definition(Sa.typeName),"type enum interface implements namespace module declare":Sa.definitionKeyword,"abstract global Privacy readonly override":Sa.modifier,"is keyof unique infer":Sa.operatorKeyword,JSXAttributeValue:Sa.attributeValue,JSXText:Sa.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":Sa.angleBracket,"JSXIdentifier JSXNameSpacedName":Sa.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":Sa.attributeName,"JSXBuiltin/JSXIdentifier":Sa.standard(Sa.tagName)}),Cf={__proto__:null,export:14,as:19,from:27,default:30,async:35,function:36,extends:46,this:50,true:58,false:58,null:70,void:74,typeof:78,super:96,new:130,delete:146,yield:155,await:159,class:164,public:221,private:221,protected:221,readonly:223,instanceof:242,satisfies:245,in:246,const:248,import:280,keyof:335,unique:339,infer:345,is:381,abstract:401,implements:403,type:405,let:408,var:410,interface:417,enum:421,namespace:427,module:429,declare:433,global:437,for:456,of:465,while:468,with:472,do:476,if:480,else:482,switch:486,case:492,try:498,catch:502,finally:506,return:510,throw:514,break:518,continue:522,debugger:526},_f={__proto__:null,async:117,get:119,set:121,declare:181,public:183,private:183,protected:183,static:185,abstract:187,override:189,readonly:195,accessor:197,new:385},Xf={__proto__:null,"<":137},Zf=wf.deserialize({version:14,states:"$6[O`QUOOO%QQUOOO'TQWOOP(bOSOOO*pQ(CjO'#CfO*wOpO'#CgO+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vS'u#S'}S'z#V+eS,t&y+fT-h't-mT'O!c%wQ$hfR)j$mT)_$h)`R3Z.kT*O$u*QR*W$xQ/}*zQ2e.OQ4s0wQ5{2iQ7X4vQ7x5zQ8e7WQ8w7wQ9W8gQ9`8yQ9e9XR9h9alpOXr!X#`%]&d&f&g&i,],b1b1eQ&^!TR,Q&ZV%z|},ZR0q+qR,P&XQ%szR+c%tR+X%nT&b!U&eT&c!U&eT1d,b1e",nodeNames:"⚠ ArithOp ArithOp LineComment BlockComment Script ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXStartTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:364,context:xf,nodeProps:[["group",-26,6,14,16,62,199,203,206,207,209,212,215,225,227,233,235,237,239,242,248,254,256,258,260,262,264,265,"Statement",-32,10,11,25,28,29,35,45,48,49,51,56,64,72,76,78,80,81,103,104,113,114,131,134,136,137,138,139,141,142,162,163,165,"Expression",-23,24,26,30,34,36,38,166,168,170,171,173,174,175,177,178,179,181,182,183,193,195,197,198,"Type",-3,84,96,102,"ClassItem"],["openedBy",31,"InterpolationStart",50,"[",54,"{",69,"(",143,"JSXStartTag",155,"JSXStartTag JSXStartCloseTag"],["closedBy",33,"InterpolationEnd",44,"]",55,"}",70,")",144,"JSXSelfCloseEndTag JSXEndTag",160,"JSXEndTag"]],propSources:[Pf],skippedNodes:[0,3,4,268],repeatNodeCount:33,tokenData:"$>y(CSR!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tu>PuvBavwDxwxGgxyMvyz! Qz{!![{|!%O|}!&]}!O!%O!O!P!'g!P!Q!1w!Q!R#0t!R![#3T![!]#@T!]!^#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rec:12712}),Af=[Dd("function ${name}(${params}) {\n\t${}\n}",{label:"function",detail:"definition",type:"keyword"}),Dd("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n\t${}\n}",{label:"for",detail:"loop",type:"keyword"}),Dd("for (let ${name} of ${collection}) {\n\t${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Dd("do {\n\t${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),Dd("while (${}) {\n\t${}\n}",{label:"while",detail:"loop",type:"keyword"}),Dd("try {\n\t${}\n} catch (${error}) {\n\t${}\n}",{label:"try",detail:"/ catch block",type:"keyword"}),Dd("if (${}) {\n\t${}\n}",{label:"if",detail:"block",type:"keyword"}),Dd("if (${}) {\n\t${}\n} else {\n\t${}\n}",{label:"if",detail:"/ else block",type:"keyword"}),Dd("class ${name} {\n\tconstructor(${params}) {\n\t\t${}\n\t}\n}",{label:"class",detail:"definition",type:"keyword"}),Dd('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Dd('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Tf=new Ro,Rf=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Ef(t){return(e,i)=>{let n=e.node.getChild("VariableDefinition");return n&&i(n,t),!0}}const Vf=["FunctionDeclaration"],Mf={FunctionDeclaration:Ef("function"),ClassDeclaration:Ef("class"),ClassExpression:()=>!0,EnumDeclaration:Ef("constant"),TypeAliasDeclaration:Ef("type"),NamespaceDeclaration:Ef("namespace"),VariableDefinition(t,e){t.matchContext(Vf)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function Df(t,e){let i=Tf.get(e);if(i)return i;let n=[],s=!0;function r(e,i){let s=t.sliceString(e.from,e.to);n.push({label:s,type:i})}return e.cursor(mo.IncludeAnonymous).iterate((e=>{if(s)s=!1;else if(e.name){let t=Mf[e.name];if(t&&t(e,r)||Rf.has(e.name))return!1}else if(e.to-e.from>8192){for(let i of Df(t,e.node))n.push(i);return!1}})),Tf.set(e,n),n}const Wf=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Uf=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName"];function Yf(t){let e=Xa(t.state).resolveInner(t.pos,-1);if(Uf.indexOf(e.name)>-1)return null;let i="VariableName"==e.name||e.to-e.from<20&&Wf.test(t.state.sliceDoc(e.from,e.to));if(!i&&!t.explicit)return null;let n=[];for(let i=e;i;i=i.parent)Rf.has(i.name)&&(n=n.concat(Df(t.state.doc,i)));return{options:n,from:i?e.from:t.pos,validFor:Wf}}const qf=_a.define({name:"javascript",parser:Zf.configure({props:[Na.add({IfStatement:il({except:/^\s*({|else\b)/}),TryStatement:il({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:t=>t.baseIndent,SwitchBody:t=>{let e=t.textAfter,i=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return t.baseIndent+(i?0:n?1:2)*t.unit},Block:tl({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":il({except:/^{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag":t=>t.column(t.node.from)+t.unit}),rl.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression":ol,BlockComment:t=>({from:t.from+2,to:t.to-2})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Lf={test:t=>/^JSX/.test(t.name),facet:Qa({commentTokens:{block:{open:"{/*",close:"*/}"}}})},zf=qf.configure({dialect:"ts"},"typescript"),If=qf.configure({dialect:"jsx",props:[$a.add((t=>t.isTop?[Lf]:void 0))]}),Bf=qf.configure({dialect:"jsx ts",props:[$a.add((t=>t.isTop?[Lf]:void 0))]},"typescript"),jf="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map((t=>({label:t,type:"keyword"})));function Nf(t={}){let e=t.jsx?t.typescript?Bf:If:t.typescript?zf:qf;return new Ua(e,[qf.data.of({autocomplete:(i=Uf,n=zu(Af.concat(jf)),t=>{for(let e=Xa(t.state).resolveInner(t.pos,-1);e;e=e.parent){if(i.indexOf(e.name)>-1)return null;if(e.type.isTop)break}return n(t)})}),qf.data.of({autocomplete:Yf}),t.jsx?Hf:[]]);var i,n}function Gf(t,e,i=t.length){for(let n=null==e?void 0:e.firstChild;n;n=n.nextSibling)if("JSXIdentifier"==n.name||"JSXBuiltin"==n.name||"JSXNamespacedName"==n.name||"JSXMemberExpression"==n.name)return t.sliceString(n.from,Math.min(n.to,i));return""}const Ff="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),Hf=Ts.inputHandler.of(((t,e,i,n)=>{if((Ff?t.composing:t.compositionStarted)||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!qf.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((t=>{var e,i;let r,{head:o}=t,a=Xa(s).resolveInner(o,-1);if("JSXStartTag"==a.name&&(a=a.parent),">"==n&&"JSXFragmentTag"==a.name)return{range:A.cursor(o+1),changes:{from:o,insert:">"}};if("/"==n&&"JSXFragmentTag"==a.name){let t=a.parent,i=null==t?void 0:t.parent;if(t.from==o-1&&"JSXEndTag"!=(null===(e=i.lastChild)||void 0===e?void 0:e.name)&&(r=Gf(s.doc,null==i?void 0:i.firstChild,o))){let t=`/${r}>`;return{range:A.cursor(o+t.length),changes:{from:o,insert:t}}}}else if(">"==n){let t=function(t){for(;;){if("JSXOpenTag"==t.name||"JSXSelfClosingTag"==t.name||"JSXFragmentTag"==t.name)return t;if(!t.parent)return null;t=t.parent}}(a);if(t&&"JSXEndTag"!=(null===(i=t.lastChild)||void 0===i?void 0:i.name)&&"`}}}return{range:t}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)}));class Jf{constructor(t,e,i,n,s,r,o){this.type=t,this.value=e,this.from=i,this.hash=n,this.end=s,this.children=r,this.positions=o,this.hashProp=[[ho.contextHash,n]]}static create(t,e,i,n,s){return new Jf(t,e,i,n+(n<<8)+t+(e<<4)|0,s,[],[])}addChild(t,e){t.prop(ho.contextHash)!=this.hash&&(t=new bo(t.type,t.children,t.positions,t.length,this.hashProp)),this.children.push(t),this.positions.push(e)}toTree(t,e=this.end){let i=this.children.length-1;return i>=0&&(e=Math.max(e,this.positions[i]+this.children[i].length+this.from)),new bo(t.types[this.type],this.children,this.positions,e-this.from).balance({makeTree:(t,e,i)=>new bo(fo.none,t,e,i,this.hashProp)})}}var Kf;!function(t){t[t.Document=1]="Document",t[t.CodeBlock=2]="CodeBlock",t[t.FencedCode=3]="FencedCode",t[t.Blockquote=4]="Blockquote",t[t.HorizontalRule=5]="HorizontalRule",t[t.BulletList=6]="BulletList",t[t.OrderedList=7]="OrderedList",t[t.ListItem=8]="ListItem",t[t.ATXHeading1=9]="ATXHeading1",t[t.ATXHeading2=10]="ATXHeading2",t[t.ATXHeading3=11]="ATXHeading3",t[t.ATXHeading4=12]="ATXHeading4",t[t.ATXHeading5=13]="ATXHeading5",t[t.ATXHeading6=14]="ATXHeading6",t[t.SetextHeading1=15]="SetextHeading1",t[t.SetextHeading2=16]="SetextHeading2",t[t.HTMLBlock=17]="HTMLBlock",t[t.LinkReference=18]="LinkReference",t[t.Paragraph=19]="Paragraph",t[t.CommentBlock=20]="CommentBlock",t[t.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",t[t.Escape=22]="Escape",t[t.Entity=23]="Entity",t[t.HardBreak=24]="HardBreak",t[t.Emphasis=25]="Emphasis",t[t.StrongEmphasis=26]="StrongEmphasis",t[t.Link=27]="Link",t[t.Image=28]="Image",t[t.InlineCode=29]="InlineCode",t[t.HTMLTag=30]="HTMLTag",t[t.Comment=31]="Comment",t[t.ProcessingInstruction=32]="ProcessingInstruction",t[t.URL=33]="URL",t[t.HeaderMark=34]="HeaderMark",t[t.QuoteMark=35]="QuoteMark",t[t.ListMark=36]="ListMark",t[t.LinkMark=37]="LinkMark",t[t.EmphasisMark=38]="EmphasisMark",t[t.CodeMark=39]="CodeMark",t[t.CodeText=40]="CodeText",t[t.CodeInfo=41]="CodeInfo",t[t.LinkTitle=42]="LinkTitle",t[t.LinkLabel=43]="LinkLabel"}(Kf||(Kf={}));class tp{constructor(t,e){this.start=t,this.content=e,this.marks=[],this.parsers=[]}}class ep{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let t=this.skipSpace(this.basePos);this.indent=this.countIndent(t,this.pos,this.indent),this.pos=t,this.next=t==this.text.length?-1:this.text.charCodeAt(t)}skipSpace(t){return rp(this.text,t)}reset(t){for(this.text=t,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(t){this.basePos=t,this.baseIndent=this.countIndent(t,this.pos,this.indent)}moveBaseColumn(t){this.baseIndent=t,this.basePos=this.findColumn(t)}addMarker(t){this.markers.push(t)}countIndent(t,e=0,i=0){for(let n=e;n=e.stack[i.depth+1].value+i.baseIndent)return!0;if(i.indent>=i.baseIndent+4)return!1;let n=(t.type==Kf.OrderedList?dp:up)(i,e,!1);return n>0&&(t.type!=Kf.BulletList||hp(i,e,!1)<0)&&i.text.charCodeAt(i.pos+n-1)==t.value}const np={[Kf.Blockquote]:(t,e,i)=>62==i.next&&(i.markers.push(Up(Kf.QuoteMark,e.lineStart+i.pos,e.lineStart+i.pos+1)),i.moveBase(i.pos+(sp(i.text.charCodeAt(i.pos+1))?2:1)),t.end=e.lineStart+i.text.length,!0),[Kf.ListItem]:(t,e,i)=>!(i.indent-1)&&(i.moveBaseColumn(i.baseIndent+t.value),!0),[Kf.OrderedList]:ip,[Kf.BulletList]:ip,[Kf.Document]:()=>!0};function sp(t){return 32==t||9==t||10==t||13==t}function rp(t,e=0){for(;ei&&sp(t.charCodeAt(e-1));)e--;return e}function ap(t){if(96!=t.next&&126!=t.next)return-1;let e=t.pos+1;for(;e-1&&t.depth==e.stack.length||n<3?-1:1}function cp(t,e){for(let i=t.stack.length-1;i>=0;i--)if(t.stack[i].type==e)return!0;return!1}function up(t,e,i){return 45!=t.next&&43!=t.next&&42!=t.next||t.pos!=t.text.length-1&&!sp(t.text.charCodeAt(t.pos+1))||!(!i||cp(e,Kf.BulletList)||t.skipSpace(t.pos+2)=48&&s<=57;){if(n++,n==t.text.length)return-1;s=t.text.charCodeAt(n)}return n==t.pos||n>t.pos+9||46!=s&&41!=s||nt.pos+1||49!=t.next)?-1:n+1-t.pos}function fp(t){if(35!=t.next)return-1;let e=t.pos+1;for(;e6?-1:i}function pp(t){if(45!=t.next&&61!=t.next||t.indent>=t.baseIndent+4)return-1;let e=t.pos+1;for(;e/,mp=/\?>/,bp=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*/i.exec(n);if(r)return t.append(Up(Kf.Comment,i,i+1+r[0].length));let o=/^\?[^]*?\?>/.exec(n);if(o)return t.append(Up(Kf.ProcessingInstruction,i,i+1+o[0].length));let a=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(n);return a?t.append(Up(Kf.HTMLTag,i,i+1+a[0].length)):-1},Emphasis(t,e,i){if(95!=e&&42!=e)return-1;let n=i+1;for(;t.char(n)==e;)n++;let s=t.slice(i-1,i),r=t.slice(n,n+1),o=jp.test(s),a=jp.test(r),l=/\s|^$/.test(s),h=/\s|^$/.test(r),c=!h&&(!a||l||o),u=!l&&(!o||h||a),d=c&&(42==e||!u||o),f=u&&(42==e||!c||a);return t.append(new Ip(95==e?Yp:qp,i,n,(d?1:0)|(f?2:0)))},HardBreak(t,e,i){if(92==e&&10==t.char(i+1))return t.append(Up(Kf.HardBreak,i,i+2));if(32==e){let e=i+1;for(;32==t.char(e);)e++;if(10==t.char(e)&&e>=i+2)return t.append(Up(Kf.HardBreak,i,e+1))}return-1},Link:(t,e,i)=>91==e?t.append(new Ip(Lp,i,i+1,1)):-1,Image:(t,e,i)=>33==e&&91==t.char(i+1)?t.append(new Ip(zp,i,i+2,1)):-1,LinkEnd(t,e,i){if(93!=e)return-1;for(let e=t.parts.length-1;e>=0;e--){let n=t.parts[e];if(n instanceof Ip&&(n.type==Lp||n.type==zp)){if(!n.side||t.skipSpace(n.to)==i&&!/[(\[]/.test(t.slice(i+1,i+2)))return t.parts[e]=null,-1;let s=t.takeContent(e),r=t.parts[e]=Gp(t,s,n.type==Lp?Kf.Link:Kf.Image,n.from,i+1);if(n.type==Lp)for(let i=0;ie?Up(Kf.URL,e+i,s+i):s==t.length&&null}}function Hp(t,e,i){let n=t.charCodeAt(e);if(39!=n&&34!=n&&40!=n)return!1;let s=40==n?41:n;for(let n=e+1,r=!1;n=this.end?-1:this.text.charCodeAt(t-this.offset)}get end(){return this.offset+this.text.length}slice(t,e){return this.text.slice(t-this.offset,e-this.offset)}append(t){return this.parts.push(t),t.to}addDelimiter(t,e,i,n,s){return this.append(new Ip(t,e,i,(n?1:0)|(s?2:0)))}addElement(t){return this.append(t)}resolveMarkers(t){for(let e=t;e=t;o--){let t=this.parts[o];if(t instanceof Ip&&1&t.side&&t.type==i.type&&!(s&&(1&i.side||2&t.side)&&(t.to-t.from+r)%3==0&&((t.to-t.from)%3||r%3))){n=t;break}}if(!n)continue;let a=i.type.resolve,l=[],h=n.from,c=i.to;if(s){let t=Math.min(2,n.to-n.from,r);h=n.to-t,c=i.from+t,a=1==t?"Emphasis":"StrongEmphasis"}n.type.mark&&l.push(this.elt(n.type.mark,h,n.to));for(let t=o+1;t=0;e--){let i=this.parts[e];if(i instanceof Ip&&i.type==t)return e}return null}takeContent(t){let e=this.resolveMarkers(t);return this.parts.length=t,e}skipSpace(t){return rp(this.text,t-this.offset)+this.offset}elt(t,e,i,n){return"string"==typeof t?Up(this.parser.getNodeType(t),e,i,n):new Wp(t,e)}}function tO(t,e){if(!e.length)return t;if(!t.length)return e;let i=t.slice(),n=0;for(let t of e){for(;n(t?t-1:0))return!1;if(this.fragmentEnd<0){let t=this.fragment.to;for(;t>0&&"\n"!=this.input.read(t-1,t);)t--;this.fragmentEnd=t?t-1:0}let i=this.cursor;i||(i=this.cursor=this.fragment.tree.cursor(),i.firstChild());let n=t+this.fragment.offset;for(;i.to<=n;)if(!i.parent())return!1;for(;;){if(i.from>=n)return this.fragment.from<=e;if(!i.childAfter(n))return!1}}matches(t){let e=this.cursor.tree;return e&&e.prop(ho.contextHash)==t}takeNodes(t){let e=this.cursor,i=this.fragment.offset,n=this.fragmentEnd-(this.fragment.openEnd?1:0),s=t.absoluteLineStart,r=s,o=t.block.children.length,a=r,l=o;for(;;){if(e.to-i>n){if(e.type.isAnonymous&&e.firstChild())continue;break}if(t.dontInject.add(e.tree),t.addNode(e.tree,e.from-i),e.type.is("Block")&&(eO.indexOf(e.type.id)<0?(r=e.to-i,o=t.block.children.length):(r=a,o=l,a=e.to-i,l=t.block.children.length)),!e.nextSibling())break}for(;t.block.children.length>o;)t.block.children.pop(),t.block.positions.pop();return r-s}}const nO=ea({"Blockquote/...":Sa.quote,HorizontalRule:Sa.contentSeparator,"ATXHeading1/... SetextHeading1/...":Sa.heading1,"ATXHeading2/... SetextHeading2/...":Sa.heading2,"ATXHeading3/...":Sa.heading3,"ATXHeading4/...":Sa.heading4,"ATXHeading5/...":Sa.heading5,"ATXHeading6/...":Sa.heading6,"Comment CommentBlock":Sa.comment,Escape:Sa.escape,Entity:Sa.character,"Emphasis/...":Sa.emphasis,"StrongEmphasis/...":Sa.strong,"Link/... Image/...":Sa.link,"OrderedList/... BulletList/...":Sa.list,"BlockQuote/...":Sa.quote,"InlineCode CodeText":Sa.monospace,URL:Sa.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":Sa.processingInstruction,"CodeInfo LinkLabel":Sa.labelName,LinkTitle:Sa.string,Paragraph:Sa.content}),sO=new Zp(new po(Ep).extend(nO),Object.keys(Sp).map((t=>Sp[t])),Object.keys(Sp).map((t=>$p[t])),Object.keys(Sp),Pp,np,Object.keys(Np).map((t=>Np[t])),Object.keys(Np),[]);function rO(t,e,i){let n=[];for(let s=t.firstChild,r=e;;s=s.nextSibling){let t=s?s.from:i;if(t>r&&n.push({from:r,to:t}),!s)break;r=s.to}return n}const oO={resolve:"Strikethrough",mark:"StrikethroughMark"},aO={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":Sa.strikethrough}},{name:"StrikethroughMark",style:Sa.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,i){if(126!=e||126!=t.char(i+1)||126==t.char(i+2))return-1;let n=t.slice(i-1,i),s=t.slice(i+2,i+3),r=/\s|^$/.test(n),o=/\s|^$/.test(s),a=jp.test(n),l=jp.test(s);return t.addDelimiter(oO,i,i+2,!o&&(!l||r||a),!r&&(!a||o||l))},after:"Emphasis"}]};function lO(t,e,i=0,n,s=0){let r=0,o=!0,a=-1,l=-1,h=!1,c=()=>{n.push(t.elt("TableCell",s+a,s+l,t.parser.parseInline(e.slice(a,l),s+a)))};for(let u=i;u-1)&&r++,o=!1,n&&(a>-1&&c(),n.push(t.elt("TableDelimiter",u+s,u+s+1))),a=l=-1),h=!h&&92==i}return a>-1&&(r++,n&&c()),r}function hO(t,e){for(let i=e;ihO(e.content,0)?new uO:null,endLeaf(t,e,i){if(i.parsers.some((t=>t instanceof uO))||!hO(e.text,e.basePos))return!1;let n=t.scanLine(t.absoluteLineEnd+1).text;return cO.test(n)&&lO(t,e.text,e.basePos)==lO(t,n,e.basePos)},before:"SetextHeading"}]};class fO{nextLine(){return!1}finish(t,e){return t.addLeafElement(e,t.elt("Task",e.start,e.start+e.content.length,[t.elt("TaskMarker",e.start,e.start+3),...t.parser.parseInline(e.content.slice(3),e.start+3)])),!0}}const pO=[dO,{defineNodes:[{name:"Task",block:!0,style:Sa.list},{name:"TaskMarker",style:Sa.atom}],parseBlock:[{name:"TaskList",leaf:(t,e)=>/^\[[ xX]\]/.test(e.content)&&"ListItem"==t.parentType().name?new fO:null,after:"SetextHeading"}]},aO];function OO(t,e,i){return(n,s,r)=>{if(s!=t||n.char(r+1)==t)return-1;let o=[n.elt(i,r,r+1)];for(let s=r+1;s=65&&r<=90||95==r||r>=97&&r<=122||r>=161;)s+=String.fromCharCode(n),n=t.peek(++e);var r;return RO=t,EO=i,TO=s?s.toLowerCase():n==MO||n==DO?void 0:null}const MO=63,DO=33;function WO(t,e){this.name=t,this.parent=e,this.hash=e?e.hash:0;for(let e=0;eUO.indexOf(e)>-1?new WO(VO(n,1)||"",t):t,reduce:(t,e)=>e==wO&&t?t.parent:t,reuse(t,e,i,n){let s=e.type.id;return 6==s||36==s?new WO(VO(n,1)||"",t):t},hash:t=>t?t.hash:0,strict:!1}),qO=new nf(((t,e)=>{if(60!=t.next)return void(t.next<0&&e.context&&t.acceptToken(57));t.advance();let i=47==t.next;i&&t.advance();let n=VO(t,0);if(void 0===n)return;if(!n)return t.acceptToken(i?14:6);let s=e.context?e.context.name:null;if(i){if(n==s)return t.acceptToken(11);if(s&&XO[s])return t.acceptToken(57,-2);if(e.dialectEnabled(0))return t.acceptToken(12);for(let t=e.context;t;t=t.parent)if(t.name==n)return;t.acceptToken(13)}else{if("script"==n)return t.acceptToken(7);if("style"==n)return t.acceptToken(8);if("textarea"==n)return t.acceptToken(9);if(_O.hasOwnProperty(n))return t.acceptToken(10);s&&ZO[s]&&ZO[s][n]?t.acceptToken(57,-1):t.acceptToken(6)}}),{contextual:!0}),LO=new nf((t=>{for(let e=0,i=0;;i++){if(t.next<0){i&&t.acceptToken(58);break}if(45==t.next)e++;else{if(62==t.next&&e>=2){i>3&&t.acceptToken(58,-2);break}e=0}t.advance()}}));const zO=new nf(((t,e)=>{if(47==t.next&&62==t.peek(1)){let i=e.dialectEnabled(1)||function(t){for(;t;t=t.parent)if("svg"==t.name||"math"==t.name)return!0;return!1}(e.context);t.acceptToken(i?5:4,2)}else 62==t.next&&t.acceptToken(4,1)}));function IO(t,e,i){let n=2+t.length;return new nf((s=>{for(let r=0,o=0,a=0;;a++){if(s.next<0){a&&s.acceptToken(e);break}if(0==r&&60==s.next||1==r&&47==s.next||r>=2&&ro?s.acceptToken(e,-o):s.acceptToken(i,-(o-2));break}if((10==s.next||13==s.next)&&a){s.acceptToken(e,1);break}r=o=0}else o++;s.advance()}}))}const BO=IO("script",54,1),jO=IO("style",55,2),NO=IO("textarea",56,3),GO=ea({"Text RawText":Sa.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":Sa.angleBracket,TagName:Sa.tagName,"MismatchedCloseTag/TagName":[Sa.tagName,Sa.invalid],AttributeName:Sa.attributeName,"AttributeValue UnquotedAttributeValue":Sa.attributeValue,Is:Sa.definitionOperator,"EntityReference CharacterReference":Sa.character,Comment:Sa.blockComment,ProcessingInst:Sa.processingInstruction,DoctypeDecl:Sa.documentMeta}),FO=wf.deserialize({version:14,states:",xOVO!rOOO!WQ#tO'#CqO!]Q#tO'#CzO!bQ#tO'#C}O!gQ#tO'#DQO!lQ#tO'#DSO!qOaO'#CpO!|ObO'#CpO#XOdO'#CpO$eO!rO'#CpOOO`'#Cp'#CpO$lO$fO'#DTO$tQ#tO'#DVO$yQ#tO'#DWOOO`'#Dk'#DkOOO`'#DY'#DYQVO!rOOO%OQ&rO,59]O%WQ&rO,59fO%`Q&rO,59iO%hQ&rO,59lO%s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hyO~OS!QOhyO~OS!SOT!TOhyO~OS!TOhyO~O!WfOPlX!ZlX~OP!WO!Z!XO~O!XiOQoX!ZoX~OQ!ZO!Z!XO~O!YlORrX!ZrX~OR!]O!Z!XO~O!Z!XO~P#dOf!_O~O![sO!e!aO~OS!bO~OS!cO~Oi!dOSgXhgXTgX~OS!fOhyO~OS!gOhyO~OS!hOhyO~OS!iOT!jOhyO~OS!jOhyO~Of!kO~Of!lO~Of!mO~OS!nO~Ok!qO!`!oO!b!pO~OS!rO~OS!sO~OS!tO~Oa!uOb!uOc!uO!`!wO!a!uO~Oa!xOb!xOc!xO!b!wO!c!xO~Oa!uOb!uOc!uO!`!{O!a!uO~Oa!xOb!xOc!xO!b!{O!c!xO~OT~bac!dx{!d~",goto:"%p!`PPPPPPPPPPPPPPPPPPPP!a!gP!mPP!yP!|#P#S#Y#]#`#f#i#l#r#x!aP!a!aP$O$U$l$r$x%O%U%[%bPPPPPPPP%hX^OX`pXUOX`pezabcde{}!P!R!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ}bQ!PcQ!RdQ!UeZ!e{}!P!R!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:67,context:YO,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,21,30,33,36,"CloseTag"],["openedBy",4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!R!N`P;=`<%l!G_T!NhbhSOq!Hpqr!Ncrs!Hpsw!Ncwx!Hpx!P!Nc!P!Q!Hp!Q!_!Nc!_!a!Hp!a!b# p!b#s!Nc#s$f!Hp$f;'S!Nc;'S;=`#!}<%l?Ah!Nc?Ah?BY!Hp?BY?Mn!Nc?MnO!HpT# ubhSOq!Hpqr!Ncrs!Hpsw!Ncwx!Hpx!P!Nc!P!Q!Hp!Q!_!Nc!_!`!Hp!`!a!If!a#s!Nc#s$f!Hp$f;'S!Nc;'S;=`#!}<%l?Ah!Nc?Ah?BY!Hp?BY?Mn!Nc?MnO!HpT##QP;=`<%l!Nc!V##^chS!a`!cpOq!G_qr!Eyrs!HUsv!Eyvw!Ncwx!Jvx!P!Ey!P!Q!G_!Q!_!Ey!_!`!G_!`!a!Mm!a#s!Ey#s$f!G_$f;'S!Ey;'S;=`#$i<%l?Ah!Ey?Ah?BY!G_?BY?Mn!Ey?MnO!G_!V#$lP;=`<%l!Ey!V#$zXiS`P!a`!cpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X",tokenizers:[BO,jO,NO,zO,qO,LO,0,1,2,3,4,5],topRules:{Document:[0,15]},dialects:{noMatch:0,selfClosing:485},tokenPrec:487});function HO(t,e){let i=Object.create(null);for(let n of t.getChildren(yO)){let t=n.getChild(SO),s=n.getChild(xO)||n.getChild(kO);t&&(i[e.read(t.from,t.to)]=s?s.type.id==xO?e.read(s.from+1,s.to-1):e.read(s.from,s.to):"")}return i}function JO(t,e){let i=t.getChild(vO);return i?e.read(i.from,i.to):" "}function KO(t,e,i){let n;for(let s of i)if(!s.attrs||s.attrs(n||(n=HO(t.node.parent.firstChild,e))))return{parser:s.parser};return null}function tg(t=[],e=[]){let i=[],n=[],s=[],r=[];for(let e of t){("script"==e.tag?i:"style"==e.tag?n:"textarea"==e.tag?s:r).push(e)}let o=e.length?Object.create(null):null;for(let t of e)(o[t.name]||(o[t.name]=[])).push(t);return Do(((t,e)=>{let a=t.type.id;if(a==QO)return KO(t,e,i);if(a==$O)return KO(t,e,n);if(a==PO)return KO(t,e,s);if(a==wO&&r.length){let i,n=t.node,s=n.firstChild,o=s&&JO(s,e);if(o)for(let t of r)if(t.tag==o&&(!t.attrs||t.attrs(i||(i=HO(n,e))))){let e=n.lastChild;return{parser:t.parser,overlay:[{from:s.to,to:e.type.id==CO?e.from:n.to}]}}}if(o&&a==yO){let i,n=t.node;if(i=n.firstChild){let t=o[e.read(i.from,i.to)];if(t)for(let i of t){if(i.tagName&&i.tagName!=JO(n.parent,e))continue;let t=n.lastChild;if(t.type.id==xO){let e=t.from+1,n=t.lastChild,s=t.to-(n&&n.isError?0:1);if(s>e)return{parser:i.parser,overlay:[{from:e,to:s}]}}else if(t.type.id==kO)return{parser:i.parser,overlay:[{from:t.from,to:t.to}]}}}}return null}))}const eg=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288];function ig(t){return t>=65&&t<=90||t>=97&&t<=122||t>=161}const ng=new nf(((t,e)=>{for(let n=!1,s=0,r=0;;r++){let{next:o}=t;if(!(ig(o)||45==o||95==o||n&&(i=o,i>=48&&i<=57))){n&&t.acceptToken(40==o?95:2==s&&e.canShift(2)?2:96);break}!n&&(45!=o||r>0)&&(n=!0),s===r&&45==o&&s++,t.advance()}var i})),sg=new nf((t=>{if(eg.includes(t.peek(-1))){let{next:e}=t;(ig(e)||95==e||35==e||46==e||91==e||58==e||45==e)&&t.acceptToken(94)}})),rg=new nf((t=>{if(!eg.includes(t.peek(-1))){let{next:e}=t;if(37==e&&(t.advance(),t.acceptToken(1)),ig(e)){do{t.advance()}while(ig(t.next));t.acceptToken(1)}}})),og=ea({"AtKeyword import charset namespace keyframes media supports":Sa.definitionKeyword,"from to selector":Sa.keyword,NamespaceName:Sa.namespace,KeyframeName:Sa.labelName,TagName:Sa.tagName,ClassName:Sa.className,PseudoClassName:Sa.constant(Sa.className),IdName:Sa.labelName,"FeatureName PropertyName":Sa.propertyName,AttributeName:Sa.attributeName,NumberLiteral:Sa.number,KeywordQuery:Sa.keyword,UnaryQueryOp:Sa.operatorKeyword,"CallTag ValueName":Sa.atom,VariableName:Sa.variableName,Callee:Sa.operatorKeyword,Unit:Sa.unit,"UniversalSelector NestingSelector":Sa.definitionOperator,MatchOp:Sa.compareOperator,"ChildOp SiblingOp, LogicOp":Sa.logicOperator,BinOp:Sa.arithmeticOperator,Important:Sa.modifier,Comment:Sa.blockComment,ParenthesizedContent:Sa.special(Sa.name),ColorLiteral:Sa.color,StringLiteral:Sa.string,":":Sa.punctuation,"PseudoOp #":Sa.derefOperator,"; ,":Sa.separator,"( )":Sa.paren,"[ ]":Sa.squareBracket,"{ }":Sa.brace}),ag={__proto__:null,lang:32,"nth-child":32,"nth-last-child":32,"nth-of-type":32,"nth-last-of-type":32,dir:32,"host-context":32,url:60,"url-prefix":60,domain:60,regexp:60,selector:134},lg={__proto__:null,"@import":114,"@media":138,"@charset":142,"@namespace":146,"@keyframes":152,"@supports":164},hg={__proto__:null,not:128,only:128,from:158,to:160},cg=wf.deserialize({version:14,states:"7WQYQ[OOO#_Q[OOOOQP'#Cd'#CdOOQP'#Cc'#CcO#fQ[O'#CfO$YQXO'#CaO$aQ[O'#ChO$lQ[O'#DPO$qQ[O'#DTOOQP'#Ed'#EdO$vQdO'#DeO%bQ[O'#DrO$vQdO'#DtO%sQ[O'#DvO&OQ[O'#DyO&TQ[O'#EPO&cQ[O'#EROOQS'#Ec'#EcOOQS'#ET'#ETQYQ[OOO&jQXO'#CdO'_QWO'#DaO'dQWO'#EjO'oQ[O'#EjQOQWOOOOQP'#Cg'#CgOOQP,59Q,59QO#fQ[O,59QO'yQ[O'#EWO(eQWO,58{O(mQ[O,59SO$lQ[O,59kO$qQ[O,59oO'yQ[O,59sO'yQ[O,59uO'yQ[O,59vO(xQ[O'#D`OOQS,58{,58{OOQP'#Ck'#CkOOQO'#C}'#C}OOQP,59S,59SO)PQ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z;'S%^;'S;=`%o<%lO%^XG_WOy%^z!c%^!c!}Gw!}#T%^#T#oGw#o;'S%^;'S;=`%o<%lO%^XHO[!YPoWOy%^z}%^}!OGw!O!Q%^!Q![Gw![!c%^!c!}Gw!}#T%^#T#oGw#o;'S%^;'S;=`%o<%lO%^XHySxPOy%^z;'S%^;'S;=`%o<%lO%^^I[SvUOy%^z;'S%^;'S;=`%o<%lO%^XIkUOy%^z#b%^#b#cI}#c;'S%^;'S;=`%o<%lO%^XJSUoWOy%^z#W%^#W#XJf#X;'S%^;'S;=`%o<%lO%^XJmS!`PoWOy%^z;'S%^;'S;=`%o<%lO%^XJ|UOy%^z#f%^#f#gJf#g;'S%^;'S;=`%o<%lO%^XKeS!RPOy%^z;'S%^;'S;=`%o<%lO%^_KvS!QVOy%^z;'S%^;'S;=`%o<%lO%^ZLXU!PPOy%^z!_%^!_!`6y!`;'S%^;'S;=`%o<%lO%^WLnP;=`<%l$}",tokenizers:[sg,rg,ng,0,1,2,3],topRules:{StyleSheet:[0,4],Styles:[1,84]},specialized:[{term:95,get:t=>ag[t]||-1},{term:56,get:t=>lg[t]||-1},{term:96,get:t=>hg[t]||-1}],tokenPrec:1123});let ug=null;function dg(){if(!ug&&"object"==typeof document&&document.body){let{style:t}=document.body,e=[],i=new Set;for(let n in t)"cssText"!=n&&"cssFloat"!=n&&"string"==typeof t[n]&&(/[A-Z]/.test(n)&&(n=n.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))),i.has(n)||(e.push(n),i.add(n)));ug=e.sort().map((t=>({type:"property",label:t})))}return ug||[]}const fg=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map((t=>({type:"class",label:t}))),pg=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map((t=>({type:"keyword",label:t}))).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map((t=>({type:"constant",label:t})))),Og=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map((t=>({type:"type",label:t}))),gg=/^(\w[\w-]*|-\w[\w-]*|)$/,mg=/^-(-[\w-]*)?$/;const bg=new Ro,wg=["Declaration"];function vg(t){for(let e=t;;){if(e.type.isTop)return e;if(!(e=e.parent))return t}}function yg(t,e,i){if(e.to-e.from>4096){let n=bg.get(e);if(n)return n;let s=[],r=new Set,o=e.cursor(mo.IncludeAnonymous);if(o.firstChild())do{for(let e of yg(t,o.node,i))r.has(e.label)||(r.add(e.label),s.push(e))}while(o.nextSibling());return bg.set(e,s),s}{let n=[],s=new Set;return e.cursor().iterate((e=>{var r;if(i(e)&&e.matchContext(wg)&&":"==(null===(r=e.node.nextSibling)||void 0===r?void 0:r.name)){let i=t.sliceString(e.from,e.to);s.has(i)||(s.add(i),n.push({label:i,type:"variable"}))}})),n}}const Sg=t=>e=>{let{state:i,pos:n}=e,s=Xa(i).resolveInner(n,-1),r=s.type.isError&&s.from==s.to-1&&"-"==i.doc.sliceString(s.from,s.to);if("PropertyName"==s.name||(r||"TagName"==s.name)&&/^(Block|Styles)$/.test(s.resolve(s.to).name))return{from:s.from,options:dg(),validFor:gg};if("ValueName"==s.name)return{from:s.from,options:pg,validFor:gg};if("PseudoClassName"==s.name)return{from:s.from,options:fg,validFor:gg};if(t(s)||(e.explicit||r)&&function(t,e){var i;if(("("==t.name||t.type.isError)&&(t=t.parent||t),"ArgList"!=t.name)return!1;let n=null===(i=t.parent)||void 0===i?void 0:i.firstChild;return"Callee"==(null==n?void 0:n.name)&&"var"==e.sliceString(n.from,n.to)}(s,i.doc))return{from:t(s)||r?s.from:n,options:yg(i.doc,vg(s),t),validFor:mg};if("TagName"==s.name){for(let{parent:t}=s;t;t=t.parent)if("Block"==t.name)return{from:s.from,options:dg(),validFor:gg};return{from:s.from,options:Og,validFor:gg}}if(!e.explicit)return null;let o=s.resolve(n),a=o.childBefore(n);return a&&":"==a.name&&"PseudoClassSelector"==o.name?{from:n,options:fg,validFor:gg}:a&&":"==a.name&&"Declaration"==o.name||"ArgList"==o.name?{from:n,options:pg,validFor:gg}:"Block"==o.name||"Styles"==o.name?{from:n,options:dg(),validFor:gg}:null},xg=Sg((t=>"VariableName"==t.name)),kg=_a.define({name:"css",parser:cg.configure({props:[Na.add({Declaration:il()}),rl.add({"Block KeyframeList":ol})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function Qg(){return new Ua(kg,kg.data.of({autocomplete:xg}))}const $g=["_blank","_self","_top","_parent"],Pg=["ascii","utf-8","utf-16","latin1","latin1"],Cg=["get","post","put","delete"],_g=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Xg=["true","false"],Zg={},Ag={a:{attrs:{href:null,ping:null,type:null,media:null,target:$g,hreflang:null}},abbr:Zg,address:Zg,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Zg,aside:Zg,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Zg,base:{attrs:{href:null,target:$g}},bdi:Zg,bdo:Zg,blockquote:{attrs:{cite:null}},body:Zg,br:Zg,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Zg,center:Zg,cite:Zg,code:Zg,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:Zg,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Zg,div:Zg,dl:Zg,dt:Zg,em:Zg,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Zg,figure:Zg,footer:Zg,form:{attrs:{action:null,name:null,"accept-charset":Pg,autocomplete:["on","off"],enctype:_g,method:Cg,novalidate:["novalidate"],target:$g}},h1:Zg,h2:Zg,h3:Zg,h4:Zg,h5:Zg,h6:Zg,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Zg,hgroup:Zg,hr:Zg,html:{attrs:{manifest:null}},i:Zg,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:Zg,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Zg,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:Zg,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Pg,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:Zg,noscript:Zg,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:Zg,param:{attrs:{name:null,value:null}},pre:Zg,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Zg,rt:Zg,ruby:Zg,samp:Zg,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Pg}},section:Zg,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Zg,source:{attrs:{src:null,type:null,media:null}},span:Zg,strong:Zg,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Zg,summary:Zg,sup:Zg,table:Zg,tbody:Zg,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Zg,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:Zg,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Zg,time:{attrs:{datetime:null}},title:Zg,tr:Zg,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Zg,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:Zg},Tg={accesskey:null,class:null,contenteditable:Xg,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Xg,autocorrect:Xg,autocapitalize:Xg,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Xg,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Xg,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Xg,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Xg,"aria-hidden":Xg,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Xg,"aria-multiselectable":Xg,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Xg,"aria-relevant":null,"aria-required":Xg,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},Rg="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map((t=>"on"+t));for(let t of Rg)Tg[t]=null;class Eg{constructor(t,e){this.tags=Object.assign(Object.assign({},Ag),t),this.globalAttrs=Object.assign(Object.assign({},Tg),e),this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}function Vg(t,e,i=t.length){if(!e)return"";let n=e.firstChild,s=n&&n.getChild("TagName");return s?t.sliceString(s.from,Math.min(s.to,i)):""}function Mg(t,e=!1){for(let i=t.parent;i;i=i.parent)if("Element"==i.name){if(!e)return i;e=!1}return null}function Dg(t,e,i){let n=i.tags[Vg(t,Mg(e,!0))];return(null==n?void 0:n.children)||i.allTags}function Wg(t,e){let i=[];for(let n=e;n=Mg(n);){let s=Vg(t,n);if(s&&"CloseTag"==n.lastChild.name)break;s&&i.indexOf(s)<0&&("EndTag"==e.name||e.from>=n.firstChild.to)&&i.push(s)}return i}Eg.default=new Eg;const Ug=/^[:\-\.\w\u00b7-\uffff]*$/;function Yg(t,e,i,n,s){let r=/\s*>/.test(t.sliceDoc(s,s+5))?"":">";return{from:n,to:s,options:Dg(t.doc,i,e).map((t=>({label:t,type:"type"}))).concat(Wg(t.doc,i).map(((t,e)=>({label:"/"+t,apply:"/"+t+r,type:"type",boost:99-e})))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function qg(t,e,i,n){let s=/\s*>/.test(t.sliceDoc(n,n+5))?"":">";return{from:i,to:n,options:Wg(t.doc,e).map(((t,e)=>({label:t,apply:t+s,type:"type",boost:99-e}))),validFor:Ug}}function Lg(t,e){let{state:i,pos:n}=e,s=Xa(i).resolveInner(n),r=s.resolve(n,-1);for(let t,e=n;s==r&&(t=r.childBefore(e));){let i=t.lastChild;if(!i||!i.type.isError||i.from({label:t,type:"property"}))),validFor:Ug}}(i,t,r,"AttributeName"==r.name?r.from:n,n):"Is"==r.name||"AttributeValue"==r.name||"UnquotedAttributeValue"==r.name?function(t,e,i,n,s){var r;let o,a=null===(r=i.parent)||void 0===r?void 0:r.getChild("AttributeName"),l=[];if(a){let r=t.sliceDoc(a.from,a.to),h=e.globalAttrs[r];if(!h){let n=Mg(i),s=n?e.tags[Vg(t.doc,n)]:null;h=(null==s?void 0:s.attrs)&&s.attrs[r]}if(h){let e=t.sliceDoc(n,s).toLowerCase(),i='"',r='"';/^['"]/.test(e)?(o='"'==e[0]?/^[^"]*$/:/^[^']*$/,i="",r=t.sliceDoc(s,s+1)==e[0]?"":e[0],e=e.slice(1),n++):o=/^[^\s<>='"]*$/;for(let t of h)l.push({label:t,apply:i+t+r,type:"constant"})}}return{from:n,to:s,options:l,validFor:o}}(i,t,r,"Is"==r.name?n:r.from,n):!e.explicit||"Element"!=s.name&&"Text"!=s.name&&"Document"!=s.name?null:function(t,e,i,n){let s=[],r=0;for(let n of Dg(t.doc,i,e))s.push({label:"<"+n,type:"type"});for(let e of Wg(t.doc,i))s.push({label:"",type:"type",boost:99-r++});return{from:n,to:n,options:s,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}(i,t,r,n)}function zg(t){let{extraTags:e,extraGlobalAttributes:i}=t,n=i||e?new Eg(e,i):Eg.default;return t=>Lg(n,t)}const Ig=[{tag:"script",attrs:t=>"text/typescript"==t.type||"ts"==t.lang,parser:zf.parser},{tag:"script",attrs:t=>"text/babel"==t.type||"text/jsx"==t.type,parser:If.parser},{tag:"script",attrs:t=>"text/typescript-jsx"==t.type,parser:Bf.parser},{tag:"script",attrs:t=>!t.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(t.type),parser:qf.parser},{tag:"style",attrs:t=>(!t.lang||"css"==t.lang)&&(!t.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(t.type)),parser:kg.parser}],Bg=[{name:"style",parser:kg.parser.configure({top:"Styles"})}].concat(Rg.map((t=>({name:t,parser:qf.parser})))),jg=_a.define({name:"html",parser:FO.configure({props:[Na.add({Element(t){let e=/^(\s*)(<\/)?/.exec(t.textAfter);return t.node.to<=t.pos+e[0].length?t.continue():t.lineIndent(t.node.from)+(e[2]?0:t.unit)},"OpenTag CloseTag SelfClosingTag":t=>t.column(t.node.from)+t.unit,Document(t){if(t.pos+/\s*/.exec(t.textAfter)[0].lengtht.getChild("TagName")})],wrap:tg(Ig,Bg)}),languageData:{commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-._"}});function Ng(t={}){let e,i="";!1===t.matchClosingTags&&(i="noMatch"),!0===t.selfClosingTags&&(i=(i?i+" ":"")+"selfClosing"),(t.nestedLanguages&&t.nestedLanguages.length||t.nestedAttributes&&t.nestedAttributes.length)&&(e=tg((t.nestedLanguages||[]).concat(Ig),(t.nestedAttributes||[]).concat(Bg)));let n=e||i?jg.configure({dialect:i,wrap:e}):jg;return new Ua(n,[jg.data.of({autocomplete:zg(t)}),!1!==t.autoCloseTags?Fg:[],Nf().support,Qg().support])}const Gg=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),Fg=Ts.inputHandler.of(((t,e,i,n)=>{if(t.composing||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!jg.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((e=>{var i,r,o;let a,{head:l}=e,h=Xa(s).resolveInner(l,-1);if("TagName"!=h.name&&"StartTag"!=h.name||(h=h.parent),">"==n&&"OpenTag"==h.name){if("CloseTag"!=(null===(r=null===(i=h.parent)||void 0===i?void 0:i.lastChild)||void 0===r?void 0:r.name)&&(a=Vg(s.doc,h.parent,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`${e?"":">"}`;return{range:A.cursor(l+1),changes:{from:l+(e?1:0),insert:i}}}}else if("/"==n&&"OpenTag"==h.name){let e=h.parent,i=null==e?void 0:e.parent;if(e.from==l-1&&"CloseTag"!=(null===(o=i.lastChild)||void 0===o?void 0:o.name)&&(a=Vg(s.doc,i,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`/${a}${e?"":">"}`,n=l+i.length+(e?1:0);return{range:A.cursor(n),changes:{from:l,insert:i}}}}return{range:e}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)})),Hg=Qa({commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}}}),Jg=new ho,Kg=sO.configure({props:[rl.add((t=>!t.is("Block")||t.is("Document")||null!=tm(t)?void 0:(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to}))),Jg.add(tm),Na.add({Document:()=>null}),ka.add({Document:Hg})]});function tm(t){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(t.name);return e?+e[1]:void 0}function em(t,e){let i=t;for(;;){let t,n=i.nextSibling;if(!n||null!=(t=tm(n.type))&&t<=e)break;i=n}return i.to}const im=sl.of(((t,e,i)=>{for(let n=Xa(t).resolveInner(i,-1);n&&!(n.fromi)return{from:i,to:e}}return null}));function nm(t){return new Pa(Hg,t,[im],"markdown")}const sm=nm(Kg),rm=nm(Kg.configure([pO,mO,gO,bO]));class om{constructor(t,e,i,n,s,r,o){this.node=t,this.from=e,this.to=i,this.spaceBefore=n,this.spaceAfter=s,this.type=r,this.item=o}blank(t,e=!0){let i=this.spaceBefore+("Blockquote"==this.node.name?">":"");if(null!=t){for(;i.length0;t--)i+=" ";return i+(e?this.spaceAfter:"")}marker(t,e){let i="OrderedList"==this.node.name?String(+lm(this.item,t)[2]+e):"";return this.spaceBefore+i+this.type+this.spaceAfter}}function am(t,e){let i=[];for(let e=t;e&&"Document"!=e.name;e=e.parent)"ListItem"!=e.name&&"Blockquote"!=e.name&&"FencedCode"!=e.name||i.push(e);let n=[];for(let t=i.length-1;t>=0;t--){let s,r=i[t],o=e.lineAt(r.from),a=r.from-o.from;if("FencedCode"==r.name)n.push(new om(r,a,a,"","","",null));else if("Blockquote"==r.name&&(s=/^[ \t]*>( ?)/.exec(o.text.slice(a))))n.push(new om(r,a,a+s[0].length,"",s[1],">",null));else if("ListItem"==r.name&&"OrderedList"==r.parent.name&&(s=/^([ \t]*)\d+([.)])([ \t]*)/.exec(o.text.slice(a)))){let t=s[3],e=s[0].length;t.length>=4&&(t=t.slice(0,t.length-4),e-=4),n.push(new om(r.parent,a,a+e,s[1],t,s[2],r))}else if("ListItem"==r.name&&"BulletList"==r.parent.name&&(s=/^([ \t]*)([-+*])([ \t]{1,4}\[[ xX]\])?([ \t]+)/.exec(o.text.slice(a)))){let t=s[4],e=s[0].length;t.length>4&&(t=t.slice(0,t.length-4),e-=4);let i=s[2];s[3]&&(i+=s[3].replace(/[xX]/," ")),n.push(new om(r.parent,a,a+e,s[1],t,i,r))}}return n}function lm(t,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(t.from,t.from+10))}function hm(t,e,i,n=0){for(let s=-1,r=t;;){if("ListItem"==r.name){let t=lm(r,e),o=+t[2];if(s>=0){if(o!=s+1)return;i.push({from:r.from+t[1].length,to:r.from+t[0].length,insert:String(s+2+n)})}s=o}let t=r.nextSibling;if(!t)break;r=t}}function cm(t){return"QuoteMark"==t.name||"ListMark"==t.name}const um=[{key:"Enter",run:({state:t,dispatch:e})=>{let i=Xa(t),{doc:n}=t,s=null,r=t.changeByRange((e=>{if(!e.empty||!rm.isActiveAt(t,e.from))return s={range:e};let r=e.from,o=n.lineAt(r),a=am(i.resolveInner(r,-1),n);for(;a.length&&a[a.length-1].from>r-o.from;)a.pop();if(!a.length)return s={range:e};let l=a[a.length-1];if(l.to-l.spaceAfter.length>r-o.from)return s={range:e};let h=r>=l.to-l.spaceAfter.length&&!/\S/.test(o.text.slice(l.to));if(l.item&&h){if(l.node.firstChild.to>=r||o.from>0&&!/[^\s>]/.test(n.lineAt(o.from-1).text)){let t,e=a.length>1?a[a.length-2]:null,i="";e&&e.item?(t=o.from+e.from,i=e.marker(n,1)):t=o.from+(e?e.to:0);let s=[{from:t,to:r,insert:i}];return"OrderedList"==l.node.name&&hm(l.item,n,s,-2),e&&"OrderedList"==e.node.name&&hm(e.item,n,s),{range:A.cursor(t+i.length),changes:s}}{let e="";for(let t=0,i=a.length-2;t<=i;t++)e+=a[t].blank(t\s*$/.exec(i.text);if(s&&s.index==l.from){let n=t.changes([{from:i.from+s.index,to:i.to},{from:o.from+l.from,to:o.to}]);return{range:e.map(n),changes:n}}}let c=[];"OrderedList"==l.node.name&&hm(l.item,n,c);let u=l.item&&l.item.from]*/.exec(o.text)[0].length>=l.to)for(let t=0,e=a.length-1;t<=e;t++)d+=t!=e||u?a[t].blank(to.from&&/\s/.test(o.text.charAt(f-o.from-1));)f--;return d=t.lineBreak+d,c.push({from:f,to:r,insert:d}),{range:A.cursor(f+d.length),changes:c}}));return!s&&(e(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0)}},{key:"Backspace",run:({state:t,dispatch:e})=>{let i=Xa(t),n=null,s=t.changeByRange((e=>{let s=e.from,{doc:r}=t;if(e.empty&&rm.isActiveAt(t,e.from)){let t=r.lineAt(s),n=am(function(t,e){let i=t.resolveInner(e,-1),n=e;cm(i)&&(n=i.from,i=i.parent);for(let t;t=i.childBefore(n);)if(cm(t))n=t.from;else{if("OrderedList"!=t.name&&"BulletList"!=t.name)break;i=t.lastChild,n=i.to}return i}(i,s),r);if(n.length){let i=n[n.length-1],r=i.to-i.spaceAfter.length+(i.spaceAfter?1:0);if(s-t.from>r&&!/\S/.test(t.text.slice(r,s-t.from)))return{range:A.cursor(t.from+r),changes:{from:t.from+r,to:s}};if(s-t.from==r&&(!i.item||t.from<=i.item.from||!/\S/.test(t.text.slice(0,i.to)))){let n=t.from+i.from;if(i.item&&i.node.fromt.from-e.from||t.startSide-e.startSide)),ni.set(i)}getMatchingBracket(t){switch(t){case")":return"(";case"]":return"[";case"}":return"{";default:return null}}},{decorations:t=>t.decorations});var fm="[a-zA-Z\\$][a-zA-Z0-9\\$]*",pm="(?:\\.\\d+|\\d+\\.\\d*|\\d+)",Om="(?:`(?:`?"+pm+")?)",gm=new RegExp("(?:(?:\\d+)(?:\\^\\^(?:\\.\\w+|\\w+\\.\\w*|\\w+)"+Om+"?(?:\\*\\^[+-]?\\d+)?))"),mm=new RegExp("(?:"+pm+Om+"?(?:\\*\\^[+-]?\\d+)?)"),bm=new RegExp("(?:`?)(?:"+fm+")(?:`(?:"+fm+"))*(?:`?)");let wm=[];const vm=["True","False","All","None","Null","Full","$Failed","$Aborted"];function ym(t,e){var i;return'"'===(i=t.next())?(e.tokenize=Sm,e.tokenize(t,e)):"("===i&&t.eat("*")?(e.commentLevel++,e.tokenize=xm,e.tokenize(t,e)):(t.backUp(1),t.match(gm,!0,!1)||t.match(mm,!0,!1)?"number":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::usage)/,!0,!1)?"meta":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::[a-zA-Z\$][a-zA-Z0-9\$]*):?/,!0,!1)?"string.special":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*\s*:)(?:(?:[a-zA-Z\$][a-zA-Z0-9\$]*)|(?:[^:=>~@\^\&\*\)\[\]'\?,\|])).*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+/,!0,!1)||t.match(/_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)?"variableName.special":t.match(/\\\[[a-zA-Z\$][a-zA-Z0-9\$]*\]/,!0,!1)?"character":t.match(/(?:\[|\]|{|}|\(|\))/,!0,!1)?"bracket":t.match(/(?:#[a-zA-Z\$][a-zA-Z0-9\$]*|#+[0-9]?)/,!0,!1)?"variableName.constant":t.match(bm,!0,!1)?vm.indexOf(t.current())>-1?"number":wm.indexOf(t.current())>-1||0==wm.length?"keyword":t.current()in e.localVars?"atom":(e.localVars[t.current()]=!0,"function"):t.match(/(?:\\|\+|\-|\*|\/|,|;|\.|:|@|~|=|>|<|&|\||_|`|'|\^|\?|!|%)/,!0,!1)?"operator":(t.next(),"error"))}function Sm(t,e){for(var i,n=!1,s=!1;null!=(i=t.next());){if('"'===i&&!s){n=!0;break}s=!s&&"\\"===i}return n&&!s&&(e.tokenize=ym),"string"}function xm(t,e){for(var i,n;e.commentLevel>0&&null!=(n=t.next());)"("===i&&"*"===n&&e.commentLevel++,"*"===i&&")"===n&&e.commentLevel--,i=n;return e.commentLevel<=0&&(e.tokenize=ym),"comment"}const km={name:"mathematica",extendVariables:function(t){},startState:function(){return{tokenize:ym,commentLevel:0,localVars:{}}},token:function(t,e){return t.eatSpace()?null:e.tokenize(t,e)},languageData:{commentTokens:{block:{open:"(*",close:"*)"}}}};let Qm={of:t=>[Gl.define(km),Yd({override:[async e=>function(t,e){let i=t.matchBefore(/\w*/);return i.from!==i.to||t.explicit?{from:i.from,options:e.data}:null}(e,t)]}),Ys.of([{key:"Escape",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((t=>{let{from:e,to:i}=t;return{changes:{from:e,to:i,insert:"EC"},range:A.cursor(e+2)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])],reBuild:t=>{wm=t.map((t=>t.label))}};const $m=(t,e,i,n)=>{if(0==t.length)return;const s=(new Date).valueOf();let r=0;i.dom.loadingMark=!0;const o=i.dom.style.background;let a=0;console.log("Start animation");const l=setInterval((()=>{i.dom.style.setProperty("background","hsl("+a+"deg 100% 97%)","important"),a+=2,a>360&&(a=0)}),30);n.transaction(e,i,s,t.length);for(const a of t)Pm(a,((a,h)=>{n.file(e,i,s,a,h),r++,r>=t.length&&i.dom&&i.dom.loadingMark&&(i.dom.loadingMark=!1,setTimeout((()=>{i.dom.style.background=o,clearInterval(l),console.log("Stop animation")}),2e3))}),(()=>{console.warn("Fauilure");const t=i.dom.style.background;i.dom.style.background="rgb(255 189 189 / 97%)";let e=97;const n=setInterval((()=>{i.dom.style.background="rgb(255 189 189 / "+Math.round(e)+"%)",e*=.95}),30);clearInterval(l),setTimeout((()=>{clearInterval(n),i.dom.style.background=t}),3e3)}))};function Pm(t,e,i){const n=new FileReader;n.addEventListener("load",(n=>{const s=n.target.result;if(s.byteLength/1024/1024>15)return alert("Files > 15Mb are not supported for drag and drop"),void i();let r=base64ArrayBuffer(s);e(t.name,r)})),n.addEventListener("progress",(t=>{if(t.loaded&&t.total){const e=t.loaded/t.total*100;console.log(e)}})),n.readAsArrayBuffer(t)}const Cm=(t,e)=>Ts.domEventHandlers({drop(e,i){e.preventDefault();const n=[];e.dataTransfer.items?[...e.dataTransfer.items].forEach(((t,e)=>{if("file"===t.kind){const i=t.getAsFile();console.log(`… file[${e}].name = ${i.name}`),n.push(i)}})):[...e.dataTransfer.files].forEach(((t,e)=>{console.log(`… file[${e}].name = ${t.name}`),n.push(t)})),$m(n,e,i,t)},paste(t,i){let n=t.clipboardData||window.clipboardData;for(const s of n.items)if("string"===s.kind)switch(s.type){case"text/plain":break;case"image/png":t.preventDefault(),$m([s.getAsFile()],t,i,e)}else t.preventDefault(),$m([s.getAsFile()],t,i,e)}}),_m=new pr({regexp:/\\\[(\w+)\]/g,decoration:t=>ni.replace({widget:new Zm(t[1])})}),Xm=_i.fromClass(class{constructor(t){this.Greekholder=_m.createDeco(t)}update(t){this.Greekholder=_m.updateDeco(t,this.Greekholder)}},{decorations:t=>t.Greekholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Greekholder||ni.none))});class Zm extends ei{constructor(t){super(),this.name=t}eq(t){return this.name===t.name}toDOM(){let t=document.createElement("span");return t.innerHTML="&"+this.name.toLowerCase().replace("sqrt","radic").replace("undirectededge","harr").replace("directededge","rarr").replace(/capital(.*)/,((t,e)=>e.charAt(0).toUpperCase()+e.slice(1))).replace(/curly(.*)/,((t,e)=>e)).replace(/script(.*)/,((t,e)=>"el"+e.toLowerCase())).replace("transpose","#7488").replace("degree","deg")+";",t}ignoreEvent(){return!1}}const Am=new pr({regexp:/(->|<-)/g,decoration:t=>ni.replace({widget:new Tm(t[1])})});_i.fromClass(class{constructor(t){this.Arrowholder=Am.createDeco(t)}update(t){this.Arrowholder=Am.updateDeco(t,this.Arrowholder)}},{decorations:t=>t.Arrowholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Arrowholder||ni.none))});class Tm extends ei{constructor(t){super(),this.dir=t}eq(t){return this.dir===t.dir}toDOM(){let t=document.createElement("span");return"->"===this.dir?t.innerText="→":t.innerText="←",t}ignoreEvent(){return!1}}function Rm(t){if(!(t=t||{}).open)throw new Error('Balanced: please provide a "open" property');if(!t.close)throw new Error('Balanced: please provide a "close" property');if(this.balance=t.balance||!1,this.exceptions=t.exceptions||!1,this.caseInsensitive=t.caseInsensitive,this.head=t.head||t.open,this.head=Array.isArray(this.head)?this.head:[this.head],this.open=Array.isArray(t.open)?t.open:[t.open],this.close=Array.isArray(t.close)?t.close:[t.close],!Array.isArray(this.head)||!Array.isArray(this.open)||!Array.isArray(this.close)||this.head.length!==this.open.length||this.open.length!==this.close.length)throw new Error('Balanced: if you use arrays for a "head,open,close" you must use matching arrays for all options');var e=Dm(this.head.map(this.regExpFromArrayGroupedMap,this)),i=Dm(this.open.map(this.regExpFromArrayGroupedMap,this)),n=Dm(this.close.map(this.regExpFromArrayGroupedMap,this));this.regExp=Dm([e,i,n],"g"+(this.caseInsensitive?"i":"")),this.regExpGroupLength=this.head.length}function Em(t,e,i){for(var n=Mm(e.substr(0,i+1),/^.*\n?$/gim),s=Mm(e,/^.*\n?$/gim),r=n.length-1,o=i+1-(n.length?n[n.length-1].index:0),a="",l=2;l>=0;l--)r-l>=0&&s[r-l]&&(a+=e.substr(s[r-l].index,s[r-l].length)+"\n");for(l=0;l=0&&s[r+l]&&(a+=e.substr(s[r+l].index,s[r+l].length)+"\n");a=a.replace(/\t/g," ").replace(/\n$/,"");var h=new Error(t+" at "+(r+1)+":"+o+"\n\n"+a);return h.line=r+1,h.column=o,h.index=i,h}function Vm(t,e){return t>=e.index&&t<=e.index+e.length-1}function Mm(t,e){var i,n=new RegExp(e),s=[];if(t)for(;i=n.exec(t);)s.push({index:i.index,length:i[0].length,match:i[0]}),i[0].length||n.lastIndex++;return s}function Dm(t,e,i){var n=t.map((function(t){return t instanceof RegExp?t.source:function(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}(t)}),this).join("|");return n=i?"("+n+")":"(?:"+n+")",new RegExp(n,e||void 0)}Rm.prototype={regExpFromArrayGroupedMap:function(t){return Dm([t],null,!0)},matchContentsInBetweenBrackets:function(t,e){for(var i,n=new RegExp(this.regExp),s=[],r=[],o=null,a=!0;i=n.exec(t);){if(e){for(var l=!1,h=0;h{const i=((t,e,i)=>{var n,s=new RegExp(t),r=[];if(e)for(;n=s.exec(e);){if(i){for(var o=!1,a=0;a{new qm({open:"(*"+t+"[*)",close:"(*]"+t+"*)",balance:!1}).matchContentsInBetweenBrackets(e.value,[]).forEach((function(t){const s=e.value.slice(t.index+t.head.length,t.index+t.length-t.tail.length);n(i+t.index,{length:t.length,pos:i+t.index,argsPos:i+t.index+t.head.length,str:s})}))})(e,t,i,s)},o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)r(o,a)}var Im,Bm=function(){function t(t){var e=t.tag,i=t.decoration,n=t.decorate,s=t.boundary,r=t.maxLength,o=void 0===r?1e3:r;if(this.tag=e,n)this.addMatch=function(t,e,i,s){return n(s,i,i+t.length,t,e)};else if("function"==typeof i)this.addMatch=function(t,e,n,s){var r=i(t,e,n);r&&s(n,n+t.length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=function(t,e,n,s){return s(n,n+t.length,i)}}this.boundary=s,this.maxLength=o}return t.prototype.createDeco=function(t){for(var e=this,i=new Xt,n=i.add.bind(i),s=0,r=function(t,e){var i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;for(var n=[],s=0,r=i;s=a?n[n.length-1].to=l:n.push({from:a,to:l})}return n}(t,this.maxLength);st.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e},t.prototype.updateRange=function(t,e,i,n){for(var s=this,r=function(r){var a=Math.max(r.from,i),l=Math.min(r.to,n);if(l>a){var h=t.state.doc.lineAt(a),c=h.toh.from;a--)if(o.boundary.test(h.text[a-1-h.from])){u=a;break}for(;ld},add:f})}},o=this,a=0,l=t.visibleRanges;a{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*FB[*)((_)(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*FB[*)(("+s+")(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let Nm=class{constructor(t,e,i,n,s,r){this.view=e,this.visibleValue=t,this.placeholder=r,console.log(r),this.args=Lm(t.str,/\(\*,\*\)/gm);const o=this;let a,l;console.log("creating InstanceWidget"),a=Im({doc:o.args[0].body.slice(2,-1),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(o.visibleValue.pos),e.dispatch({selection:{anchor:o.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return l.dispatch({selection:{anchor:0}}),l.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){l.focus(),t.editorLastCursor=void 0}}])]}),l=Im({doc:o.args[2].body.slice(1,-2),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:a.state.doc.length}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:o.visibleValue.pos+o.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus(),t.editorLastCursor=void 0}}])]}),o.args[0].length=o.args[0].body.length,o.args[2].length=o.args[2].body.length,delete o.args[2].body,delete o.args[1].body,delete o.args[0].body,this.topEditor=a,this.bottomEditor=l}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="(("+t+")",s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length));const r=e.length-i[0].length;i[0].to=i[0].to+r,i[2].from=i[2].from+r,i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e="("+t+"))",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length));const r=e.length-i[2].length;i[2].to=i[2].to+r,i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t,e){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm),console.log("recreating InstanceWidget"),n=Im.state({doc:e.args[0].body.slice(2,-1),update:t=>e.applyChanges(t,0),eval:()=>{i.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(e.visibleValue.pos),i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus(),t.editorLastCursor=void 0}}])]}),s=Im.state({doc:e.args[2].body.slice(1,-2),update:t=>e.applyChanges(t,2),eval:()=>{e.view.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus(),t.editorLastCursor=void 0}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),console.log(e),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.placeholder=e,this.visibleValue.argsPos=t.argsPos}destroy(){this.topEditor.destroy(),this.bottomEditor.destroy()}},Gm=class extends ei{constructor(t,e,i,n){super(),this.view=i,this.visibleValue=t,this.reference=e,this.placeholder=n}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue,this),!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("fraction");const i=document.createElement("table");i.classList.add("container"),e.appendChild(i);const n=document.createElement("tbody");i.appendChild(n);const s=document.createElement("tr"),r=document.createElement("tr");n.appendChild(s),n.appendChild(r);const o=document.createElement("td");o.classList.add("enumenator"),s.appendChild(o);const a=document.createElement("td");r.appendChild(a);const l=this;return e.EditorWidget=new Nm(this.visibleValue,t,o,a,[],this),this.DOMElement=e,this.reference.push({destroy:()=>{l.destroy(e)}}),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const Fm=(t,e,i)=>new Bm({tag:"FB",decoration:n=>ni.replace({widget:new Gm(n,t,e,i)})}),Hm=t=>_i.fromClass(class{constructor(e){this.disposable=[],this.placeholder=Fm(this.disposable,e,this).createDeco(e),t.placeholder=this}update(t){this.placeholder=Fm(this.disposable,t,this).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var Jm;function Km(t){return Jm=t,[nb,Ys.of([{key:"Ctrl-2",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt[_](*]SqB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt["+s+"](*]SqB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let tb=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;this.sliceRanges=n,this.length=t.str.length,console.log("creating InstanceWidget"),this.editor=Jm({doc:t.str.slice(...n),parent:i,update:t=>r.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]})}applyChanges(t){const e=t,i={from:this.visibleValue.argsPos+5,to:this.visibleValue.argsPos+this.length-1,insert:e};console.log(this.visibleValue);const n=e.length+6-this.length;this.length=this.length+n,this.visibleValue.length=this.visibleValue.length+n,this.visibleValue.str="Sqrt["+e+"]",this.view.dispatch({changes:i})}update(t){if(this.visibleValue.str==t.str)this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos;else{console.warn("Out of sync"),this.visibleValue=t;const e=this.sliceRanges,i=this.editor,n=this,s=this.view;this.length=t.str.length;const r=Jm.state({doc:t.str.slice(...e),update:t=>n.applyChanges(t),eval:()=>{s.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos+n.visibleValue.length}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]});i.setState(r)}}destroy(){console.warn("destroy Instance of Widget!"),this.editor.destroy()}},eb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("sqroot");const i=this,n=document.createElement("span");return n.classList.add("radicand"),e.EditorWidget=new tb(this.visibleValue,t,n,[5,-1],[]),e.appendChild(n),this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const ib=(t,e)=>new Bm({tag:"SqB",decoration:i=>ni.replace({widget:new eb(i,t,e)})}),nb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=ib(this.disposable,t).createDeco(t)}update(t){this.placeholder=ib(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var sb;function rb(t){return sb=t,[hb,Ys.of([{key:"Ctrl--",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SbB[*)Subscript[_(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SbB[*)Subscript["+s+"(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let ob=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),console.log(r.visibleValue),o=sb({doc:r.args[0].body.slice(10),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){a.focus()}}])]}),a=sb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Subscript["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),console.log(e.visibleValue),n=sb.state({doc:e.args[0].body.slice(10),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus()}}])]}),s=sb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},ab=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sub");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new ob(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const lb=(t,e)=>new Bm({tag:"SbB",decoration:i=>ni.replace({widget:new ab(i,t,e)})}),hb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=lb(this.disposable,t).createDeco(t)}update(t){this.placeholder=lb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var cb;function ub(t){return cb=t,[Ob,Ys.of([{key:"Ctrl-6",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SpB[*)Power[_(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SpB[*)Power["+s+"(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let db=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),o=cb({doc:r.args[0].body.slice(6),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus()}}])]}),a=cb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Power["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),n=cb.state({doc:e.args[0].body.slice(6),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.bottomEditor.focus()}}])]}),s=cb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},fb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sup");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new db(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}destroy(t){t.EditorWidget.destroy()}};const pb=(t,e)=>new Bm({tag:"SpB",decoration:i=>ni.replace({widget:new fb(i,t,e)})}),Ob=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=pb(this.disposable,t).createDeco(t)}update(t){this.placeholder=pb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var gb={},mb={},bb={},wb={};function vb(t){let e=t.length;for(;--e>=0;)t[e]=0}const yb=256,Sb=286,xb=30,kb=15,Qb=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),$b=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Pb=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Cb=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_b=new Array(576);vb(_b);const Xb=new Array(60);vb(Xb);const Zb=new Array(512);vb(Zb);const Ab=new Array(256);vb(Ab);const Tb=new Array(29);vb(Tb);const Rb=new Array(xb);function Eb(t,e,i,n,s){this.static_tree=t,this.extra_bits=e,this.extra_base=i,this.elems=n,this.max_length=s,this.has_stree=t&&t.length}let Vb,Mb,Db;function Wb(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}vb(Rb);const Ub=t=>t<256?Zb[t]:Zb[256+(t>>>7)],Yb=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},qb=(t,e,i)=>{t.bi_valid>16-i?(t.bi_buf|=e<>16-t.bi_valid,t.bi_valid+=i-16):(t.bi_buf|=e<{qb(t,i[2*e],i[2*e+1])},zb=(t,e)=>{let i=0;do{i|=1&t,t>>>=1,i<<=1}while(--e>0);return i>>>1},Ib=(t,e,i)=>{const n=new Array(16);let s,r,o=0;for(s=1;s<=kb;s++)o=o+i[s-1]<<1,n[s]=o;for(r=0;r<=e;r++){let e=t[2*r+1];0!==e&&(t[2*r]=zb(n[e]++,e))}},Bb=t=>{let e;for(e=0;e{t.bi_valid>8?Yb(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},Nb=(t,e,i,n)=>{const s=2*e,r=2*i;return t[s]{const n=t.heap[i];let s=i<<1;for(;s<=t.heap_len&&(s{let n,s,r,o,a=0;if(0!==t.sym_next)do{n=255&t.pending_buf[t.sym_buf+a++],n+=(255&t.pending_buf[t.sym_buf+a++])<<8,s=t.pending_buf[t.sym_buf+a++],0===n?Lb(t,s,e):(r=Ab[s],Lb(t,r+yb+1,e),o=Qb[r],0!==o&&(s-=Tb[r],qb(t,s,o)),n--,r=Ub(n),Lb(t,r,i),o=$b[r],0!==o&&(n-=Rb[r],qb(t,n,o)))}while(a{const i=e.dyn_tree,n=e.stat_desc.static_tree,s=e.stat_desc.has_stree,r=e.stat_desc.elems;let o,a,l,h=-1;for(t.heap_len=0,t.heap_max=573,o=0;o>1;o>=1;o--)Gb(t,i,o);l=r;do{o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Gb(t,i,1),a=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=a,i[2*l]=i[2*o]+i[2*a],t.depth[l]=(t.depth[o]>=t.depth[a]?t.depth[o]:t.depth[a])+1,i[2*o+1]=i[2*a+1]=l,t.heap[1]=l++,Gb(t,i,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const i=e.dyn_tree,n=e.max_code,s=e.stat_desc.static_tree,r=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,l=e.stat_desc.max_length;let h,c,u,d,f,p,O=0;for(d=0;d<=kb;d++)t.bl_count[d]=0;for(i[2*t.heap[t.heap_max]+1]=0,h=t.heap_max+1;h<573;h++)c=t.heap[h],d=i[2*i[2*c+1]+1]+1,d>l&&(d=l,O++),i[2*c+1]=d,c>n||(t.bl_count[d]++,f=0,c>=a&&(f=o[c-a]),p=i[2*c],t.opt_len+=p*(d+f),r&&(t.static_len+=p*(s[2*c+1]+f)));if(0!==O){do{for(d=l-1;0===t.bl_count[d];)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[l]--,O-=2}while(O>0);for(d=l;0!==d;d--)for(c=t.bl_count[d];0!==c;)u=t.heap[--h],u>n||(i[2*u+1]!==d&&(t.opt_len+=(d-i[2*u+1])*i[2*u],i[2*u+1]=d),c--)}})(t,e),Ib(i,h,t.bl_count)},Jb=(t,e,i)=>{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),e[2*(i+1)+1]=65535,n=0;n<=i;n++)s=o,o=e[2*(n+1)+1],++a{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),n=0;n<=i;n++)if(s=o,o=e[2*(n+1)+1],!(++a{qb(t,0+(n?1:0),3),jb(t),Yb(t,i),Yb(t,~i),i&&t.pending_buf.set(t.window.subarray(e,e+i),t.pending),t.pending+=i};wb._tr_init=t=>{tw||((()=>{let t,e,i,n,s;const r=new Array(16);for(i=0,n=0;n<28;n++)for(Tb[n]=i,t=0;t<1<>=7;n{let s,r,o=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e{let e;for(Jb(t,t.dyn_ltree,t.l_desc.max_code),Jb(t,t.dyn_dtree,t.d_desc.max_code),Hb(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*Cb[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=i+5,i+4<=s&&-1!==e?ew(t,e,i,n):4===t.strategy||r===s?(qb(t,2+(n?1:0),3),Fb(t,_b,Xb)):(qb(t,4+(n?1:0),3),((t,e,i,n)=>{let s;for(qb(t,e-257,5),qb(t,i-1,5),qb(t,n-4,4),s=0;s(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=i,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(Ab[i]+yb+1)]++,t.dyn_dtree[2*Ub(e)]++),t.sym_next===t.sym_end),wb._tr_align=t=>{qb(t,2,3),Lb(t,256,_b),(t=>{16===t.bi_valid?(Yb(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)};var iw=(t,e,i,n)=>{let s=65535&t|0,r=t>>>16&65535|0,o=0;for(;0!==i;){o=i>2e3?2e3:i,i-=o;do{s=s+e[n++]|0,r=r+s|0}while(--o);s%=65521,r%=65521}return s|r<<16|0};const nw=new Uint32Array((()=>{let t,e=[];for(var i=0;i<256;i++){t=i;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e})());var sw=(t,e,i,n)=>{const s=nw,r=n+i;t^=-1;for(let i=n;i>>8^s[255&(t^e[i])];return-1^t},rw={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},ow={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:aw,_tr_stored_block:lw,_tr_flush_block:hw,_tr_tally:cw,_tr_align:uw}=wb,dw=iw,fw=sw,pw=rw,{Z_NO_FLUSH:Ow,Z_PARTIAL_FLUSH:gw,Z_FULL_FLUSH:mw,Z_FINISH:bw,Z_BLOCK:ww,Z_OK:vw,Z_STREAM_END:yw,Z_STREAM_ERROR:Sw,Z_DATA_ERROR:xw,Z_BUF_ERROR:kw,Z_DEFAULT_COMPRESSION:Qw,Z_FILTERED:$w,Z_HUFFMAN_ONLY:Pw,Z_RLE:Cw,Z_FIXED:_w,Z_DEFAULT_STRATEGY:Xw,Z_UNKNOWN:Zw,Z_DEFLATED:Aw}=ow,Tw=258,Rw=262,Ew=42,Vw=113,Mw=666,Dw=(t,e)=>(t.msg=pw[e],e),Ww=t=>2*t-(t>4?9:0),Uw=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Yw=t=>{let e,i,n,s=t.w_size;e=t.hash_size,n=e;do{i=t.head[--n],t.head[n]=i>=s?i-s:0}while(--e);e=s,n=e;do{i=t.prev[--n],t.prev[n]=i>=s?i-s:0}while(--e)};let qw=(t,e,i)=>(e<{const e=t.state;let i=e.pending;i>t.avail_out&&(i=t.avail_out),0!==i&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+i),t.next_out),t.next_out+=i,e.pending_out+=i,t.total_out+=i,t.avail_out-=i,e.pending-=i,0===e.pending&&(e.pending_out=0))},zw=(t,e)=>{hw(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Lw(t.strm)},Iw=(t,e)=>{t.pending_buf[t.pending++]=e},Bw=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},jw=(t,e,i,n)=>{let s=t.avail_in;return s>n&&(s=n),0===s?0:(t.avail_in-=s,e.set(t.input.subarray(t.next_in,t.next_in+s),i),1===t.state.wrap?t.adler=dw(t.adler,e,s,i):2===t.state.wrap&&(t.adler=fw(t.adler,e,s,i)),t.next_in+=s,t.total_in+=s,s)},Nw=(t,e)=>{let i,n,s=t.max_chain_length,r=t.strstart,o=t.prev_length,a=t.nice_match;const l=t.strstart>t.w_size-Rw?t.strstart-(t.w_size-Rw):0,h=t.window,c=t.w_mask,u=t.prev,d=t.strstart+Tw;let f=h[r+o-1],p=h[r+o];t.prev_length>=t.good_match&&(s>>=2),a>t.lookahead&&(a=t.lookahead);do{if(i=e,h[i+o]===p&&h[i+o-1]===f&&h[i]===h[r]&&h[++i]===h[r+1]){r+=2,i++;do{}while(h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&ro){if(t.match_start=e,o=n,n>=a)break;f=h[r+o-1],p=h[r+o]}}}while((e=u[e&c])>l&&0!=--s);return o<=t.lookahead?o:t.lookahead},Gw=t=>{const e=t.w_size;let i,n,s;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Rw)&&(t.window.set(t.window.subarray(e,e+e-n),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Yw(t),n+=e),0===t.strm.avail_in)break;if(i=jw(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=i,t.lookahead+t.insert>=3)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=qw(t,t.ins_h,t.window[s+1]);t.insert&&(t.ins_h=qw(t,t.ins_h,t.window[s+3-1]),t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead{let i,n,s,r=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,o=0,a=t.strm.avail_in;do{if(i=65535,s=t.bi_valid+42>>3,t.strm.avail_outn+t.strm.avail_in&&(i=n+t.strm.avail_in),i>s&&(i=s),i>8,t.pending_buf[t.pending-2]=~i,t.pending_buf[t.pending-1]=~i>>8,Lw(t.strm),n&&(n>i&&(n=i),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+n),t.strm.next_out),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n,t.block_start+=n,i-=n),i&&(jw(t.strm,t.strm.output,t.strm.next_out,i),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i)}while(0===o);return a-=t.strm.avail_in,a&&(a>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=a&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-a,t.strm.next_in),t.strstart),t.strstart+=a,t.insert+=a>t.w_size-t.insert?t.w_size-t.insert:a),t.block_start=t.strstart),t.high_waters&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,s+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),s>t.strm.avail_in&&(s=t.strm.avail_in),s&&(jw(t.strm,t.window,t.strstart,s),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.high_water>3,s=t.pending_buf_size-s>65535?65535:t.pending_buf_size-s,r=s>t.w_size?t.w_size:s,n=t.strstart-t.block_start,(n>=r||(n||e===bw)&&e!==Ow&&0===t.strm.avail_in&&n<=s)&&(i=n>s?s:n,o=e===bw&&0===t.strm.avail_in&&i===n?1:0,lw(t,t.block_start,i,o),t.block_start+=i,Lw(t.strm)),o?3:1)},Hw=(t,e)=>{let i,n;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==i&&t.strstart-i<=t.w_size-Rw&&(t.match_length=Nw(t,i)),t.match_length>=3)if(n=cw(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=qw(t,t.ins_h,t.window[t.strstart+1]);else n=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2},Jw=(t,e)=>{let i,n,s;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==i&&t.prev_length4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){s=t.strstart+t.lookahead-3,n=cw(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=s&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(zw(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(n=cw(t,0,t.window[t.strstart-1]),n&&zw(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=cw(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2};function Kw(t,e,i,n,s){this.good_length=t,this.max_lazy=e,this.nice_length=i,this.max_chain=n,this.func=s}const tv=[new Kw(0,0,0,0,Fw),new Kw(4,4,8,4,Hw),new Kw(4,5,16,8,Hw),new Kw(4,6,32,32,Hw),new Kw(4,4,16,16,Jw),new Kw(8,16,32,32,Jw),new Kw(8,16,128,128,Jw),new Kw(8,32,128,256,Jw),new Kw(32,128,258,1024,Jw),new Kw(32,258,258,4096,Jw)];function ev(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Aw,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Uw(this.dyn_ltree),Uw(this.dyn_dtree),Uw(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Uw(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Uw(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const iv=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==Ew&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==Vw&&e.status!==Mw?1:0},nv=t=>{if(iv(t))return Dw(t,Sw);t.total_in=t.total_out=0,t.data_type=Zw;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?Ew:Vw,t.adler=2===e.wrap?0:1,e.last_flush=-2,aw(e),vw},sv=t=>{const e=nv(t);var i;return e===vw&&((i=t.state).window_size=2*i.w_size,Uw(i.head),i.max_lazy_match=tv[i.level].max_lazy,i.good_match=tv[i.level].good_length,i.nice_match=tv[i.level].nice_length,i.max_chain_length=tv[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=2,i.match_available=0,i.ins_h=0),e},rv=(t,e,i,n,s,r)=>{if(!t)return Sw;let o=1;if(e===Qw&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),s<1||s>9||i!==Aw||n<8||n>15||e<0||e>9||r<0||r>_w||8===n&&1!==o)return Dw(t,Sw);8===n&&(n=9);const a=new ev;return t.state=a,a.strm=t,a.status=Ew,a.wrap=o,a.gzhead=null,a.w_bits=n,a.w_size=1<rv(t,e,Aw,15,8,Xw),bb.deflateInit2=rv,bb.deflateReset=sv,bb.deflateResetKeep=nv,bb.deflateSetHeader=(t,e)=>iv(t)||2!==t.state.wrap?Sw:(t.state.gzhead=e,vw),bb.deflate=(t,e)=>{if(iv(t)||e>ww||e<0)return t?Dw(t,Sw):Sw;const i=t.state;if(!t.output||0!==t.avail_in&&!t.input||i.status===Mw&&e!==bw)return Dw(t,0===t.avail_out?kw:Sw);const n=i.last_flush;if(i.last_flush=e,0!==i.pending){if(Lw(t),0===t.avail_out)return i.last_flush=-1,vw}else if(0===t.avail_in&&Ww(e)<=Ww(n)&&e!==bw)return Dw(t,kw);if(i.status===Mw&&0!==t.avail_in)return Dw(t,kw);if(i.status===Ew&&0===i.wrap&&(i.status=Vw),i.status===Ew){let e=Aw+(i.w_bits-8<<4)<<8,n=-1;if(n=i.strategy>=Pw||i.level<2?0:i.level<6?1:6===i.level?2:3,e|=n<<6,0!==i.strstart&&(e|=32),e+=31-e%31,Bw(i,e),0!==i.strstart&&(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),t.adler=1,i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(57===i.status)if(t.adler=0,Iw(i,31),Iw(i,139),Iw(i,8),i.gzhead)Iw(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),Iw(i,255&i.gzhead.time),Iw(i,i.gzhead.time>>8&255),Iw(i,i.gzhead.time>>16&255),Iw(i,i.gzhead.time>>24&255),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(Iw(i,255&i.gzhead.extra.length),Iw(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=fw(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if(Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,3),i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw;if(69===i.status){if(i.gzhead.extra){let e=i.pending,n=(65535&i.gzhead.extra.length)-i.gzindex;for(;i.pending+n>i.pending_buf_size;){let s=i.pending_buf_size-i.pending;if(i.pending_buf.set(i.gzhead.extra.subarray(i.gzindex,i.gzindex+s),i.pending),i.pending=i.pending_buf_size,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex+=s,Lw(t),0!==i.pending)return i.last_flush=-1,vw;e=0,n-=s}let s=new Uint8Array(i.gzhead.extra);i.pending_buf.set(s.subarray(i.gzindex,i.gzindex+n),i.pending),i.pending+=n,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex=0}i.status=73}if(73===i.status){if(i.gzhead.name){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),i.gzindex=0}i.status=91}if(91===i.status){if(i.gzhead.comment){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n))}i.status=103}if(103===i.status){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size&&(Lw(t),0!==i.pending))return i.last_flush=-1,vw;Iw(i,255&t.adler),Iw(i,t.adler>>8&255),t.adler=0}if(i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(0!==t.avail_in||0!==i.lookahead||e!==Ow&&i.status!==Mw){let n=0===i.level?Fw(i,e):i.strategy===Pw?((t,e)=>{let i;for(;;){if(0===t.lookahead&&(Gw(t),0===t.lookahead)){if(e===Ow)return 1;break}if(t.match_length=0,i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):i.strategy===Cw?((t,e)=>{let i,n,s,r;const o=t.window;for(;;){if(t.lookahead<=Tw){if(Gw(t),t.lookahead<=Tw&&e===Ow)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(s=t.strstart-1,n=o[s],n===o[++s]&&n===o[++s]&&n===o[++s])){r=t.strstart+Tw;do{}while(n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&st.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(i=cw(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):tv[i.level].func(i,e);if(3!==n&&4!==n||(i.status=Mw),1===n||3===n)return 0===t.avail_out&&(i.last_flush=-1),vw;if(2===n&&(e===gw?uw(i):e!==ww&&(lw(i,0,0,!1),e===mw&&(Uw(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),Lw(t),0===t.avail_out))return i.last_flush=-1,vw}return e!==bw?vw:i.wrap<=0?yw:(2===i.wrap?(Iw(i,255&t.adler),Iw(i,t.adler>>8&255),Iw(i,t.adler>>16&255),Iw(i,t.adler>>24&255),Iw(i,255&t.total_in),Iw(i,t.total_in>>8&255),Iw(i,t.total_in>>16&255),Iw(i,t.total_in>>24&255)):(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),Lw(t),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?vw:yw)},bb.deflateEnd=t=>{if(iv(t))return Sw;const e=t.state.status;return t.state=null,e===Vw?Dw(t,xw):vw},bb.deflateSetDictionary=(t,e)=>{let i=e.length;if(iv(t))return Sw;const n=t.state,s=n.wrap;if(2===s||1===s&&n.status!==Ew||n.lookahead)return Sw;if(1===s&&(t.adler=dw(t.adler,e,i,0)),n.wrap=0,i>=n.w_size){0===s&&(Uw(n.head),n.strstart=0,n.block_start=0,n.insert=0);let t=new Uint8Array(n.w_size);t.set(e.subarray(i-n.w_size,i),0),e=t,i=n.w_size}const r=t.avail_in,o=t.next_in,a=t.input;for(t.avail_in=i,t.next_in=0,t.input=e,Gw(n);n.lookahead>=3;){let t=n.strstart,e=n.lookahead-2;do{n.ins_h=qw(n,n.ins_h,n.window[t+3-1]),n.prev[t&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=t,t++}while(--e);n.strstart=t,n.lookahead=2,Gw(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,t.next_in=o,t.input=a,t.avail_in=r,n.wrap=s,vw},bb.deflateInfo="pako deflate (from Nodeca project)";var ov={};const av=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);ov.assign=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const e in i)av(i,e)&&(t[e]=i[e])}}return t},ov.flattenChunks=t=>{let e=0;for(let i=0,n=t.length;i=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;cv[254]=cv[254]=1,lv.string2buf=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,i,n,s,r,o=t.length,a=0;for(s=0;s>>6,e[r++]=128|63&i):i<65536?(e[r++]=224|i>>>12,e[r++]=128|i>>>6&63,e[r++]=128|63&i):(e[r++]=240|i>>>18,e[r++]=128|i>>>12&63,e[r++]=128|i>>>6&63,e[r++]=128|63&i);return e};lv.buf2string=(t,e)=>{const i=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let n,s;const r=new Array(2*i);for(s=0,n=0;n4)r[s++]=65533,n+=o-1;else{for(e&=2===o?31:3===o?15:7;o>1&&n1?r[s++]=65533:e<65536?r[s++]=e:(e-=65536,r[s++]=55296|e>>10&1023,r[s++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&hv)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let i="";for(let n=0;n{(e=e||t.length)>t.length&&(e=t.length);let i=e-1;for(;i>=0&&128==(192&t[i]);)i--;return i<0||0===i?e:i+cv[t[i]]>e?i:e};var uv=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const dv=bb,fv=ov,pv=lv,Ov=rw,gv=uv,mv=Object.prototype.toString,{Z_NO_FLUSH:bv,Z_SYNC_FLUSH:wv,Z_FULL_FLUSH:vv,Z_FINISH:yv,Z_OK:Sv,Z_STREAM_END:xv,Z_DEFAULT_COMPRESSION:kv,Z_DEFAULT_STRATEGY:Qv,Z_DEFLATED:$v}=ow;function Pv(t){this.options=fv.assign({level:kv,method:$v,chunkSize:16384,windowBits:15,memLevel:8,strategy:Qv},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new gv,this.strm.avail_out=0;let i=dv.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(i!==Sv)throw new Error(Ov[i]);if(e.header&&dv.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?pv.string2buf(e.dictionary):"[object ArrayBuffer]"===mv.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,i=dv.deflateSetDictionary(this.strm,t),i!==Sv)throw new Error(Ov[i]);this._dict_set=!0}}function Cv(t,e){const i=new Pv(e);if(i.push(t,!0),i.err)throw i.msg||Ov[i.err];return i.result}Pv.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize;let s,r;if(this.ended)return!1;for(r=e===~~e?e:!0===e?yv:bv,"string"==typeof t?i.input=pv.string2buf(t):"[object ArrayBuffer]"===mv.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),(r===wv||r===vv)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(s=dv.deflate(i,r),s===xv)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),s=dv.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===Sv;if(0!==i.avail_out){if(r>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},Pv.prototype.onData=function(t){this.chunks.push(t)},Pv.prototype.onEnd=function(t){t===Sv&&(this.result=fv.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},mb.Deflate=Pv,mb.deflate=Cv,mb.deflateRaw=function(t,e){return(e=e||{}).raw=!0,Cv(t,e)},mb.gzip=function(t,e){return(e=e||{}).gzip=!0,Cv(t,e)},mb.constants=ow;var _v={},Xv={};const Zv=16209;const Av=15,Tv=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Rv=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Ev=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Vv=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Mv=(t,e,i,n,s,r,o,a)=>{const l=a.bits;let h,c,u,d,f,p,O=0,g=0,m=0,b=0,w=0,v=0,y=0,S=0,x=0,k=0,Q=null;const $=new Uint16Array(16),P=new Uint16Array(16);let C,_,X,Z=null;for(O=0;O<=Av;O++)$[O]=0;for(g=0;g=1&&0===$[b];b--);if(w>b&&(w=b),0===b)return s[r++]=20971520,s[r++]=20971520,a.bits=1,0;for(m=1;m0&&(0===t||1!==b))return-1;for(P[1]=0,O=1;O852||2===t&&x>592)return 1;for(;;){C=O-y,o[g]+1=p?(_=Z[o[g]-p],X=Q[o[g]-p]):(_=96,X=0),h=1<>y)+c]=C<<24|_<<16|X|0}while(0!==c);for(h=1<>=1;if(0!==h?(k&=h-1,k+=h):k=0,g++,0==--$[O]){if(O===b)break;O=e[i+o[g]]}if(O>w&&(k&d)!==u){for(0===y&&(y=w),f+=m,v=O-y,S=1<852||2===t&&x>592)return 1;u=k&d,s[u]=w<<24|v<<16|f-r|0}}return 0!==k&&(s[f+k]=O-y<<24|64<<16|0),a.bits=w,0};const Dv=iw,Wv=sw,Uv=function(t,e){let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,y,S,x,k,Q;const $=t.state;i=t.next_in,k=t.input,n=i+(t.avail_in-5),s=t.next_out,Q=t.output,r=s-(e-t.avail_out),o=s+(t.avail_out-257),a=$.dmax,l=$.wsize,h=$.whave,c=$.wnext,u=$.window,d=$.hold,f=$.bits,p=$.lencode,O=$.distcode,g=(1<<$.lenbits)-1,m=(1<<$.distbits)-1;t:do{f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,0===w)Q[s++]=65535&b;else{if(!(16&w)){if(0==(64&w)){b=p[(65535&b)+(d&(1<>>=w,f-=w),f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,!(16&w)){if(0==(64&w)){b=O[(65535&b)+(d&(1<a){t.msg="invalid distance too far back",$.mode=Zv;break t}if(d>>>=w,f-=w,w=s-r,y>w){if(w=y-w,w>h&&$.sane){t.msg="invalid distance too far back",$.mode=Zv;break t}if(S=0,x=u,0===c){if(S+=l-w,w2;)Q[s++]=x[S++],Q[s++]=x[S++],Q[s++]=x[S++],v-=3;v&&(Q[s++]=x[S++],v>1&&(Q[s++]=x[S++]))}else{S=s-y;do{Q[s++]=Q[S++],Q[s++]=Q[S++],Q[s++]=Q[S++],v-=3}while(v>2);v&&(Q[s++]=Q[S++],v>1&&(Q[s++]=Q[S++]))}break}}break}}while(i>3,i-=v,f-=v<<3,d&=(1<(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function hy(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const cy=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode16211?1:0},uy=t=>{if(cy(t))return Nv;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Kv,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,Iv},dy=t=>{if(cy(t))return Nv;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,uy(t)},fy=(t,e)=>{let i;if(cy(t))return Nv;const n=t.state;return e<0?(i=0,e=-e):(i=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?Nv:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=i,n.wbits=e,dy(t))},py=(t,e)=>{if(!t)return Nv;const i=new hy;t.state=i,i.strm=t,i.window=null,i.mode=Kv;const n=fy(t,e);return n!==Iv&&(t.state=null),n};let Oy,gy,my=!0;const by=t=>{if(my){Oy=new Int32Array(512),gy=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Yv(1,t.lens,0,288,Oy,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Yv(2,t.lens,0,32,gy,0,t.work,{bits:5}),my=!1}t.lencode=Oy,t.lenbits=9,t.distcode=gy,t.distbits=5},wy=(t,e,i,n)=>{let s;const r=t.state;return null===r.window&&(r.wsize=1<=r.wsize?(r.window.set(e.subarray(i-r.wsize,i),0),r.wnext=0,r.whave=r.wsize):(s=r.wsize-r.wnext,s>n&&(s=n),r.window.set(e.subarray(i-n,i-n+s),r.wnext),(n-=s)?(r.window.set(e.subarray(i-n,i),0),r.wnext=n,r.whave=r.wsize):(r.wnext+=s,r.wnext===r.wsize&&(r.wnext=0),r.whavepy(t,15),Xv.inflateInit2=py,Xv.inflate=(t,e)=>{let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,y,S,x,k=0;const Q=new Uint8Array(4);let $,P;const C=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(cy(t)||!t.output||!t.input&&0!==t.avail_in)return Nv;i=t.state,i.mode===ey&&(i.mode=iy),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,u=a,d=l,x=Iv;t:for(;;)switch(i.mode){case Kv:if(0===i.wrap){i.mode=iy;break}for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0),h=0,c=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",i.mode=ay;break}if((15&h)!==Jv){t.msg="unknown compression method",i.mode=ay;break}if(h>>>=4,c-=4,S=8+(15&h),0===i.wbits&&(i.wbits=S),S>15||S>i.wbits){t.msg="invalid window size",i.mode=ay;break}i.dmax=1<>8&1),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16182;case 16182:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>8&255,Q[2]=h>>>16&255,Q[3]=h>>>24&255,i.check=Wv(i.check,Q,4,0)),h=0,c=0,i.mode=16183;case 16183:for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>8),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16184;case 16184:if(1024&i.flags){for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(f=i.length,f>a&&(f=a),f&&(i.head&&(S=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(n.subarray(r,r+f),S)),512&i.flags&&4&i.wrap&&(i.check=Wv(i.check,n,f,r)),a-=f,r+=f,i.length-=f),i.length))break t;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===a)break t;f=0;do{S=n[r+f++],i.head&&S&&i.length<65536&&(i.head.name+=String.fromCharCode(S))}while(S&&f>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=ey;break;case 16189:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>=7&c,c-=7&c,i.mode=oy;break}for(;c<3;){if(0===a)break t;a--,h+=n[r++]<>>=1,c-=1,3&h){case 0:i.mode=16193;break;case 1:if(by(i),i.mode=sy,e===zv){h>>>=2,c-=2;break t}break;case 2:i.mode=16196;break;case 3:t.msg="invalid block type",i.mode=ay}h>>>=2,c-=2;break;case 16193:for(h>>>=7&c,c-=7&c;c<32;){if(0===a)break t;a--,h+=n[r++]<>>16^65535)){t.msg="invalid stored block lengths",i.mode=ay;break}if(i.length=65535&h,h=0,c=0,i.mode=ny,e===zv)break t;case ny:i.mode=16195;case 16195:if(f=i.length,f){if(f>a&&(f=a),f>l&&(f=l),0===f)break t;s.set(n.subarray(r,r+f),o),a-=f,r+=f,l-=f,o+=f,i.length-=f;break}i.mode=ey;break;case 16196:for(;c<14;){if(0===a)break t;a--,h+=n[r++]<>>=5,c-=5,i.ndist=1+(31&h),h>>>=5,c-=5,i.ncode=4+(15&h),h>>>=4,c-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=ay;break}i.have=0,i.mode=16197;case 16197:for(;i.have>>=3,c-=3}for(;i.have<19;)i.lens[C[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,$={bits:i.lenbits},x=Yv(0,i.lens,0,19,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid code lengths set",i.mode=ay;break}i.have=0,i.mode=16198;case 16198:for(;i.have>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=g,c-=g,i.lens[i.have++]=b;else{if(16===b){for(P=g+2;c>>=g,c-=g,0===i.have){t.msg="invalid bit length repeat",i.mode=ay;break}S=i.lens[i.have-1],f=3+(3&h),h>>>=2,c-=2}else if(17===b){for(P=g+3;c>>=g,c-=g,S=0,f=3+(7&h),h>>>=3,c-=3}else{for(P=g+7;c>>=g,c-=g,S=0,f=11+(127&h),h>>>=7,c-=7}if(i.have+f>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=ay;break}for(;f--;)i.lens[i.have++]=S}}if(i.mode===ay)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=ay;break}if(i.lenbits=9,$={bits:i.lenbits},x=Yv(1,i.lens,0,i.nlen,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid literal/lengths set",i.mode=ay;break}if(i.distbits=6,i.distcode=i.distdyn,$={bits:i.distbits},x=Yv(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,$),i.distbits=$.bits,x){t.msg="invalid distances set",i.mode=ay;break}if(i.mode=sy,e===zv)break t;case sy:i.mode=ry;case ry:if(a>=6&&l>=258){t.next_out=o,t.avail_out=l,t.next_in=r,t.avail_in=a,i.hold=h,i.bits=c,Uv(t,d),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,i.mode===ey&&(i.back=-1);break}for(i.back=0;k=i.lencode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,i.length=b,0===m){i.mode=16205;break}if(32&m){i.back=-1,i.mode=ey;break}if(64&m){t.msg="invalid literal/length code",i.mode=ay;break}i.extra=15&m,i.mode=16201;case 16201:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;k=i.distcode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,64&m){t.msg="invalid distance code",i.mode=ay;break}i.offset=b,i.extra=15&m,i.mode=16203;case 16203:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=ay;break}i.mode=16204;case 16204:if(0===l)break t;if(f=d-l,i.offset>f){if(f=i.offset-f,f>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=ay;break}f>i.wnext?(f-=i.wnext,p=i.wsize-f):p=i.wnext-f,f>i.length&&(f=i.length),O=i.window}else O=s,p=o-i.offset,f=i.length;f>l&&(f=l),l-=f,i.length-=f;do{s[o++]=O[p++]}while(--f);0===i.length&&(i.mode=ry);break;case 16205:if(0===l)break t;s[o++]=i.length,l--,i.mode=ry;break;case oy:if(i.wrap){for(;c<32;){if(0===a)break t;a--,h|=n[r++]<{if(cy(t))return Nv;let e=t.state;return e.window&&(e.window=null),t.state=null,Iv},Xv.inflateGetHeader=(t,e)=>{if(cy(t))return Nv;const i=t.state;return 0==(2&i.wrap)?Nv:(i.head=e,e.done=!1,Iv)},Xv.inflateSetDictionary=(t,e)=>{const i=e.length;let n,s,r;return cy(t)?Nv:(n=t.state,0!==n.wrap&&n.mode!==ty?Nv:n.mode===ty&&(s=1,s=Dv(s,e,i,0),s!==n.check)?Gv:(r=wy(t,e,i,i),r?(n.mode=16210,Fv):(n.havedict=1,Iv)))},Xv.inflateInfo="pako inflate (from Nodeca project)";const vy=Xv,yy=ov,Sy=lv,xy=rw,ky=uv,Qy=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},$y=Object.prototype.toString,{Z_NO_FLUSH:Py,Z_FINISH:Cy,Z_OK:_y,Z_STREAM_END:Xy,Z_NEED_DICT:Zy,Z_STREAM_ERROR:Ay,Z_DATA_ERROR:Ty,Z_MEM_ERROR:Ry}=ow;function Ey(t){this.options=yy.assign({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ky,this.strm.avail_out=0;let i=vy.inflateInit2(this.strm,e.windowBits);if(i!==_y)throw new Error(xy[i]);if(this.header=new Qy,vy.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=Sy.string2buf(e.dictionary):"[object ArrayBuffer]"===$y.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(i=vy.inflateSetDictionary(this.strm,e.dictionary),i!==_y)))throw new Error(xy[i])}function Vy(t,e){const i=new Ey(e);if(i.push(t),i.err)throw i.msg||xy[i.err];return i.result}Ey.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize,s=this.options.dictionary;let r,o,a;if(this.ended)return!1;for(o=e===~~e?e:!0===e?Cy:Py,"[object ArrayBuffer]"===$y.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),r=vy.inflate(i,o),r===Zy&&s&&(r=vy.inflateSetDictionary(i,s),r===_y?r=vy.inflate(i,o):r===Ty&&(r=Zy));i.avail_in>0&&r===Xy&&i.state.wrap>0&&0!==t[i.next_in];)vy.inflateReset(i),r=vy.inflate(i,o);switch(r){case Ay:case Ty:case Zy:case Ry:return this.onEnd(r),this.ended=!0,!1}if(a=i.avail_out,i.next_out&&(0===i.avail_out||r===Xy))if("string"===this.options.to){let t=Sy.utf8border(i.output,i.next_out),e=i.next_out-t,s=Sy.buf2string(i.output,t);i.next_out=e,i.avail_out=n-e,e&&i.output.set(i.output.subarray(t,t+e),0),this.onData(s)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(r!==_y||0!==a){if(r===Xy)return r=vy.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},Ey.prototype.onData=function(t){this.chunks.push(t)},Ey.prototype.onEnd=function(t){t===_y&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=yy.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},_v.Inflate=Ey,_v.inflate=Vy,_v.inflateRaw=function(t,e){return(e=e||{}).raw=!0,Vy(t,e)},_v.ungzip=Vy,_v.constants=ow;const{Deflate:My,deflate:Dy,deflateRaw:Wy,gzip:Uy}=mb,{Inflate:Yy,inflate:qy,inflateRaw:Ly,ungzip:zy}=_v,Iy=ow;gb.Deflate=My,gb.deflate=Dy,gb.deflateRaw=Wy,gb.gzip=Uy,gb.Inflate=Yy,gb.inflate=qy,gb.inflateRaw=Ly,gb.ungzip=zy,gb.constants=Iy;const By=gb;let jy={};var Ny;function Gy(t){return Ny=t,[tS]}jy.Util={},jy.Decode={},jy.Messages=[],jy.Log=function(t){jy.Messages.push(["I",t]),console.log("Mma.js INFO: ",t)},jy.Warn=function(t){jy.Messages.push(["W",t]),console.log("Mma.js WARNING: ",t)},jy.Fail=function(t){throw jy.Messages.push(["E",t]),"Mma.js ERROR: "+t},jy.Util.Base64Decode=function(t){for(var e=atob(t),i=e.length>>>0,n=new Uint8Array(i),s=0;s1&&0===t[0]&&jy.Fail("IntegerAP: input starts with 0: "+String(t)),this.nstring=t}else void 0===t?this.nstring=void 0:jy.Fail("Integer: invalid input: "+String(t))},jy.RealMP=function(t){"number"==typeof t?this.n=t:void 0===t?this.n=void 0:jy.Fail("RealMP: invalid input")},jy.RealAP=function(t){"string"==typeof t?(t.length>1&&0===t[0]&&jy.Fail("RealAP: input starts with 0: "+String(t)),this.nstring=t):void 0===t?this.nstring=void 0:jy.Fail("RealAP: invalid input: "+String(t))},jy.Symbol=function(t){"string"==typeof t?this.name=t:void 0===t?this.name=void 0:jy.Fail("Symbol: invalid input: "+String(t))},jy.String=function(t){"string"==typeof t?this.str=t:void 0===t?this.str=void 0:jy.Fail("String: invalid input: "+String(t))},jy.Expression=function(t,e){t instanceof jy.Symbol||jy.Fail("Expression: head must be an Mma.Symbol"),e instanceof Array||jy.Fail("Expression: parts must be an Array"),this.head=t,this.parts=e},jy.Decode.Int32=function(t,e){try{return new DataView(t.buffer).getInt32(e,!0)}catch(t){return 0}},jy.Decode.Float64=function(t,e){try{return new DataView(t.buffer).getFloat64(e,!0)}catch(t){return 0}},jy.Decode.String=function(t,e,i){return void 0===e&&(e=0),void 0===i&&(i=t.length),jy.Util.U8ArrayToString(t.slice(e,e+i))},jy.Decode.StringEntry=function(t,e){void 0===e&&(e=0);var i=jy.Decode.Int32(t,e);return{length:i,string:jy.Decode.String(t,e+4,i),bytesRead:i+4}},jy.Decode.Any=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=1/0);var n=e;for(var s=0,r=[];ee%2!=0?t:{...t,body:Lm(t.body,/\(\*\|\*\)/gm)})),Array.isArray(this.args[this.args.length-1].body)||(this.decorator=this.args.pop());const r=this.args;console.log("creating InstanceWidget");for(let t=0;t{e.viewState.state.config.eval()},update:e=>this.applyChanges(e,t,i),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to&&!t.stringOnly)return i-2>=0?(o[i-2].editor.dispatch({selection:{anchor:o[i-2].editor.state.doc.length}}),o[i-2].editor.focus(),void(t.editorLastCursor=void 0)):(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0));t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to&&!t.stringOnly)return i+2=0)return r[t-2].body[i].editor.focus(),void(e.editorLastCursor=void 0)}},{key:"ArrowDown",run:function(e,n){if(t+2{},focus:()=>{},dispatch:()=>{},stringOnly:!0};const t=l.match(Fy);if(t){a.innerHTML=t[1];const e=jy.DecompressDecode(t[2]),i=jy.toArray(e.parts[0]),n=uuidv4();interpretate(i,{global:{call:n},element:a})}else a.innerHTML=l.slice(1,-1)}delete o[i].body,n.appendChild(a)}i.appendChild(n)}if(this.decorator){const t=jy.DecompressDecode(this.decorator.body.slice(2,-2)),e=jy.toArray(t.parts[0]);let n={global:{call:uuidv4(),EditorWidget:s},element:i};this.interpretated=interpretate(e,n)}}applyChanges(t,e,i){const n=this.args,s=this.args[e].body,r=this.visibleValue.argsPos,o=this.args[e].from;let a=t;0==i&&0==e&&(a="{{"+a),0==i&&0!=e&&(a="{"+a),i==s.length-1&&e==n.length-1&&(a+="}}"),i==s.length-1&&e!=n.length-1&&(a+="}");const l=s[i].length,h={from:r+o+s[i].from,to:r+o+s[i].from+l,insert:a},c=a.length-l;for(let t=i+1;t{s.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.args[0].body[0].editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.args[0].body[0].editor.focus();else{const t=this.DOMElement.EditorWidget.args,e=t[t.length-1].body[t[t.length-1].body.length-1].editor;e.dispatch({selection:{anchor:e.state.doc.length}}),e.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const Ky=(t,e)=>new Bm({tag:"GB",decoration:i=>ni.replace({widget:new Jy(i,t,e)})}),tS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=Ky(this.disposable,t).createDeco(t)}update(t){this.placeholder=Ky(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});function eS(t){return[rS]}let iS=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.span=i,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this,r=this.args[1].body.slice(3,-3),o=jy.DecompressDecode(r),a=jy.toArray(o.parts[0]);this.data=a;const l="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}));this.cuid=l;let h={call:l,EditorWidget:s},c={global:h,element:i};this.expression=a,this.env=c,this.interpretated=interpretate(a,c),this.interpretated.then((()=>{if(c.options?.Event){console.warn("Event listeners are enabled!"),s.events=c.options.Event;let t=c;if(h.stack){const e=Object.values(h.stack);e.length>0&&(console.log("Attaching first found instance..."),t=e[0].env)}interpretate(["MetaMarker","'"+l+"'"],t).then((()=>{server.kernel.emitt(s.events,'"'+l+'"',"Mounted")}))}}))}getDoc(){return this.args[0].body.slice(1,-1)}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+t+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].length=s.length,this.view.dispatch({changes:r})}applyOuterChanges(t){const e=this.visibleValue,i=t,n={from:e.pos,to:e.pos+e.length,insert:i};this.view.dispatch({changes:n})}update(t){if(!this.deactivated){if(t.str!=this.visibleValue.str){console.warn("Out of sync"),console.log("recreate..."),this.destroy();const e=this.span;return e.replaceChildren(),void this._construct(t,this.view,e)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}}destroy(t){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.events&&server.kernel.emitt(this.events,'"'+this.cuid+'"',"Destroy"),delete this.data}},nS=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=this;let i=document.createElement("span");return i.classList.add("frontend-view"),i.EditorWidget=new iS(this.visibleValue,t,i),this.reference.push({destroy:()=>{e.destroy(i)}}),i}ignoreEvent(){return!0}destroy(t){console.log("destroy in general*"),t.EditorWidget.destroy()}};const sS=(t,e)=>new Bm({tag:"VB",decoration:i=>ni.replace({widget:new nS(i,t,e)})}),rS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=sS(this.disposable,t).createDeco(t)}update(t){this.placeholder=sS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var oS;function aS(t){return oS=t,[uS]}let lS=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.span=i,this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this;this.epilog={offset:0,string:""},this.prolog={offset:0,string:""};const r=this.args[1].body.slice(3,-3),o=jy.DecompressDecode(r),a=jy.toArray(o.parts[0]);this.data=a;let l={global:{call:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)})),element:i,origin:s},element:i};this.env=l,interpretate(a,l).then((()=>{if(l.options?.Head&&(s.prolog.offset=l.options.Head.length+1,s.prolog.string=l.options.Head+"[",s.epilog.offset=1,s.epilog.string="]"),l.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=l.options.Event),l.options?.String){s.prolog.offset=1,s.prolog.string='"',s.epilog.offset=1,s.epilog.string='"',l.options?.HeadString&&(s.prolog.string=l.options.HeadString,s.prolog.offset=s.prolog.string.length),l.options?.TailString&&(s.epilog.string=l.options.TailString,s.epilog.offset=s.epilog.string.length),s.editor={destroy:()=>{console.log("Nothing to destroy, this is just a text field.")}};const t=document.createElement("span");return this.aa,t.onkeydown=function(t){13===t.keyCode&&t.preventDefault()},t.contentEditable="plaintext-only",t.innerText=s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),t.addEventListener("input",console.log),t.addEventListener("input",(()=>{console.log("Update"),console.log(t.innerText),this.applyChanges(t.innerText)})),l.global.element.appendChild(t),void(s.events&&server.kernel.emitt(s.events,"Null","Mounted"))}s.editor=oS({doc:s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),parent:l.global.element,update:t=>this.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos+s.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]}),s.events&&server.kernel.emitt(s.events,"Null","Mounted")}))}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+this.prolog.string+t+this.epilog.string+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length));const o=s.length-i[0].length;i[0].length=s.length,this.visibleValue.length=this.visibleValue.length+o,this.view.dispatch({changes:r})}update(t){if(this.visibleValue.str!=t.str)return console.warn("Out of sync"),console.log("recreating InstanceWidget"),this.destroy(),this.span.replaceChildren(),void this._construct(t,this.view,this.span);this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.editor.destroy(),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}},hS=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("subscript-tail"),e.EditorWidget=new lS(this.visibleValue,t,e,[]);const i=this;return this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const cS=(t,e)=>new Bm({tag:"BB",decoration:i=>ni.replace({widget:new hS(i,t,e)})}),uS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=cS(this.disposable,t).createDeco(t)}update(t){this.placeholder=cS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var dS;function fS(t){return dS=t,[mS]}class pS{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm);const s=this,r=Array.from({length:Math.ceil((s.args.length-3)/2)},((t,e)=>2*e+1));s.indexes=r;const o=[];this.span=i,this.spans=o;for(let t=0;t{c.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=c.options.Event),s.editors=r.map(((t,i)=>dS({doc:s.args[t].body,parent:o[i],update:e=>this.applyChanges(e,t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i>0?s.editors[i-1].focus():(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus()),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return it.destroy())),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}}class OS extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("inline-flex"),e.EditorWidget=new pS(this.visibleValue,t,e,[]);const i=this;return this.DOMElement=e,this.reference.push({destroy:()=>{i.destroy(e)}}),e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;const n=this.DOMElement.EditorWidget.editors;return t.from-e.from<0?(n[n.length-1].dispatch({selection:{anchor:n[n.length-1].state.doc.length}}),n[n.length-1].focus()):(n[0].dispatch({selection:{anchor:0}}),n[0].focus()),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}}const gS=(t,e)=>new Bm({tag:"TB",decoration:i=>ni.replace({widget:new OS(i,t,e)})}),mS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=gS(this.disposable,t).createDeco(t)}update(t){this.placeholder=gS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});const bS=_i.fromClass(class{decorations=ni.none;constructor(t){this.view=t,this.recompute()}recompute(t){let e,i,n=[];for(let{from:t,to:e}of this.view.visibleRanges)this.getDecorationsFor(t,e,n);this.decorations=ni.set(n,!0),this.decorations=this.decorations.update({filter:(n,s)=>!(n>e&&s=e&&s.selection.main.head<=i)return!0;if(!n&&s.selection.main.head>e&&s.selection.main.headt.decorations});class wS extends ei{constructor(t,e){super(),this.rawValue=t,this.visibleValue=e}eq(t){return this.rawValue===t.rawValue}toDOM(){let t=document.createElement("div");t.classList.add("cell-type-widget");const e=this.rawValue.split(" "),i=e[0].split(".");if(console.log(i),t.classList.add("cell-type-"+i[1].trim()),t.innerText=e[0].trim(),e.length>1){const n=e.slice(1),s=document.createElement("span");return s.appendChild(t),n.forEach((t=>{const e=document.createElement("span");e.innerText=t,e.classList.add("cell-type-"+i[1].trim()+"-"+t.split("=")[0]),s.appendChild(e)})),s}return t}ignoreEvent(){return!1}}const vS=new F,yS=new F,SS=[],xS=Sl.define([{tag:Sa.meta,color:"var(--editor-key-meta)"},{tag:Sa.link,textDecoration:"underline"},{tag:Sa.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Sa.emphasis,fontStyle:"italic"},{tag:Sa.strong,fontWeight:"bold"},{tag:Sa.strikethrough,textDecoration:"line-through"},{tag:Sa.keyword,color:"var(--editor-key-keyword)"},{tag:[Sa.atom,Sa.bool,Sa.url,Sa.contentSeparator,Sa.labelName],color:"var(--editor-key-atom)"},{tag:[Sa.literal,Sa.inserted],color:"var(--editor-key-literal)"},{tag:[Sa.string,Sa.deleted],color:"var(--editor-key-string)"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],color:"var(--editor-key-escape)"},{tag:Sa.definition(Sa.variableName),color:"var(--editor-key-variable)"},{tag:Sa.local(Sa.variableName),color:"var(--editor-local-variable)"},{tag:[Sa.typeName,Sa.namespace],color:"var(--editor-key-type)"},{tag:Sa.className,color:"var(--editor-key-class)"},{tag:[Sa.special(Sa.variableName),Sa.macroName],color:"var(--editor-special-variable)"},{tag:Sa.definition(Sa.propertyName),color:"var(--editor-key-property)"},{tag:Sa.comment,color:"var(--editor-key-comment)"},{tag:Sa.invalid,color:"var(--editor-key-invalid)"}]),kS={data:[],extend:t=>{kS.data.push(...t),Qm.reBuild(kS.data)},replaceAll:t=>{kS.data=t,Qm.reBuild(kS.data)}},QS=Gl.define({name:"spreadsheet",startState:function(){return{stringType:null,stack:[]}},token:function(t,e){if(t){switch(0===e.stack.length&&('"'!=t.peek()&&"'"!=t.peek()||(e.stringType=t.peek(),t.next(),e.stack.unshift("string"))),e.stack[0]){case"string":for(;"string"===e.stack[0]&&!t.eol();)t.peek()===e.stringType?(t.next(),e.stack.shift()):"\\"===t.peek()?(t.next(),t.next()):t.match(/^.[^\\\"\']*/);return"string";case"characterClass":for(;"characterClass"===e.stack[0]&&!t.eol();)t.match(/^[^\]\\]+/)||t.match(/^\\./)||e.stack.shift();return"operator"}var i=t.peek();switch(i){case"[":return t.next(),e.stack.unshift("characterClass"),"bracket";case":":return t.next(),"operator";case"\\":return t.match(/\\[a-z]+/)?"string.special":(t.next(),"atom");case".":case",":case";":case"*":case"-":case"+":case"^":case"<":case"/":case"=":return t.next(),"atom";case"$":return t.next(),"builtin"}return t.match(/\d+/)?t.match(/^\w+/)?"error":"number":t.match(/^[a-zA-Z_]\w*/)?t.match(/(?=[\(.])/,!1)?"keyword":"variable":-1!=["[","]","(",")","{","}"].indexOf(i)?(t.next(),"bracket"):(t.eatSpace()||t.next(),null)}}}),$S=new RegExp(/^[\w]*\.[\w]+/);function PS(t){const e=$S.exec(t),i=Object.values(window.SupportedLanguages);for(let t=0;t{if(!t.docChanged)return null;let e=PS(t.newDoc.line(1).text);if(e.legacy){const i=t.startState.facet(Wa);if(i){if(i.name==e.name)return null}else if(t.startState.facet(CS)==e.name)return null;return console.log("switching... to "+e.name),{effects:vS.reconfigure(e.plugins)}}return e.name===t.startState.facet(Wa).name?null:(console.log("switching... to "+e.name),{effects:vS.reconfigure(e.plugins)})}));let XS,ZS=null;const AS=t=>{const e=t||XS;return e&&e.viewState?(console.log(),PS(e.state.doc.line(1).text).name):""},TS=t=>{const e=t||XS;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return!1;const n=i[0];return[n.from,n.to]},RS=t=>{const e=t||XS;return e&&e.viewState?e.state.doc.toString():""},ES=t=>{const e=t||XS;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return"";const n=i[0];return console.log("yoko"),console.log(n),console.log(e.state.doc.toString().slice(n.from,n.to)),console.log("processing"),e.state.doc.toString().slice(n.from,n.to)},VS=(t,e)=>{const i=e||XS;if(!i)return;if(!i.viewState)return;const n=i.viewState.state.selection.ranges;if(!n.length)return;const s=n[0];console.log("result"),console.log(t),i.dispatch({changes:{...s,insert:t}})},MS=()=>XS,DS=(t,e)=>{const i=e||XS;i&&i.viewState&&(console.log("result"),console.log(t),i.dispatch({changes:{from:0,to:i.viewState.state.doc.length,insert:t}}))};ZS=t=>{let e=new Ts({doc:t.doc,extensions:[Ys.of([{key:"Tab",run:function(t,e){return sd(t)}},{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,LS,Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(XS=e.view)}))],parent:t.parent});return e.viewState.state.config.eval=t.eval,e},ZS.state=t=>{let e=xt.create({doc:t.doc,extensions:[Ys.of([{key:"Tab",run:function(t,e){return sd(t)}},{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,LS,Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(XS=e.view)}))]});return e.config.eval=t.eval,e};const WS={transaction:(t,e,i,n)=>{if(console.log(e.dom.ocellref),e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:DropEvent"]')}},file:(t,e,i,n,s)=>{console.log(e.dom.ocellref),e.dom.ocellref&&server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},US={transaction:(t,e,i,n)=>{if(console.log(e.dom.ocellref),e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:PasteEvent"]')}},file:(t,e,i,n,s)=>{console.log(e.dom.ocellref),e.dom.ocellref&&server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},YS=[Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Cm(WS,US)];let qS=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"}}),LS=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"},".cm-scroller":{"line-height":"inherit","overflow-x":"overlay","overflow-y":"overlay","align-items":"initial"},".cm-content":{padding:"0px 0"},".rainbow-bracket-red":{color:"var(--editor-bracket-1)"},".rainbow-bracket-orange":{color:"var(--editor-bracket-2)"},".rainbow-bracket-yellow":{color:"var(--editor-bracket-3)"},".rainbow-bracket-green":{color:"var(--editor-bracket-4)"},".rainbow-bracket-blue":{color:"var(--editor-bracket-5)"},".rainbow-bracket-indigo":{color:"var(--editor-bracket-6)"},".rainbow-bracket-violet":{color:"var(--editor-bracket-7)"},".rainbow-bracket-red > span":{color:"var(--editor-bracket-1-a)"},".rainbow-bracket-orange > span":{color:"var(--editor-bracket-2-a)"},".rainbow-bracket-yellow > span":{color:"var(--editor-bracket-3-a)"},".rainbow-bracket-green > span":{color:"var(--editor-bracket-4-a)"},".rainbow-bracket-blue > span":{color:"var(--editor-bracket-5-a)"},".rainbow-bracket-indigo > span":{color:"var(--editor-bracket-6-a)"},".rainbow-bracket-violet > span":{color:"var(--editor-bracket-7-a)"}}),zS=!1;const IS=[()=>vr(),()=>Sh(),()=>ir(),()=>dr(),()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xS,{fallback:!1}),()=>tu()],BS={},jS=[()=>vr(),()=>Sh(),()=>ir(),()=>dr(),t=>NS.of(t),()=>BS.gutter?function(t={}){return[eo.of(t),jr(),so]}():[],()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xS,{fallback:!1}),()=>tu(),()=>bS,()=>function(t){return _i.fromClass(class{constructor(e){this.view=e,this.placeholder=ni.set([ni.widget({widget:new kr(t),side:1}).range(0)])}get decorations(){return this.view.state.doc.length?ni.none:this.placeholder}},{decorations:t=>t.decorations})}("Type WL Expression / .md / .js"),()=>xt.allowMultipleSelections.of(!0),(t,e)=>vS.of(e),()=>yS.of(xt.readOnly.of(!1)),()=>_S,()=>{return t?[ou.of(t),Yu]:Yu;var t},(t,e)=>Ys.of([{key:"Tab",run:function(t,e){const i=sd(t);return i||Rc(t)},shift:Ec},{key:"Backspace",run:function(e,i){if(0===e.state.doc.length)return t.origin.remove(),!0}},{key:"ArrowLeft",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus prev"),t.origin.focusPrev(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus next"),t.origin.focusNext(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"Shift-Enter",preventDefault:!0,run:function(e,i){console.log(e.state.doc.toString()),t.origin.eval(e.state.doc.toString())}},...Vc,...Wh,...Ru]),(t,e)=>Ts.updateListener.of((e=>{e.docChanged&&t.origin.save(encodeURIComponent(e.state.doc.toString())),e.selectionSet&&(XS=e.view)})),()=>qS];const NS=E.define();function GS(t){return t.replace(/\\\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\\\:/g,""),16))})).replaceAll("\\:F74E","I").replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))}function FS(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(t=>(+t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+t/4).toString(16)))}core.ReadOnly=()=>"ReadOnly",core.EditorView=async(t,e)=>{let i=await interpretate(t[0],e);i=GS(i),console.log("UNICODE Disaster");const n=await core._getRules(t,e);let s=()=>{},r=()=>{},o=i;const a=[];n.ReadOnly&&a.push(xt.readOnly.of(!0)),n.ForceUpdate&&(e.local.forceUpdate=n.ForceUpdate),n.Event&&(r=t=>{o=t,console.log("editor view emitt data: "+t),server.kernel.emitt(n.Event,'"'+t.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Input")},s=()=>{server.kernel.emitt(n.Event,'"'+o.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Evaluate")}),e.local?e.local.editor=ZS({doc:i,parent:e.element,eval:s,update:r,extensions:a}):ZS({doc:i,parent:e.element,eval:s,update:r,extensions:a}),e.element.style.verticalAlign="inherit"},core.StripOnInput=async()=>{},core.EditorView.update=async(t,e)=>{if(!e.local.editor)return;const i=GS(await interpretate(t[0],e));console.log("editor view: dispatch"),e.local.forceUpdate,e.local.editor.dispatch({changes:{from:0,to:e.local.editor.state.doc.length,insert:i}})},core.EditorView.destroy=async(t,e)=>{await interpretate(t[0],e),e.local&&e.local.editor&&e.local.editor.destroy()},core.EditorView.virtual=!0,core.PreviewCell=(t,e)=>{},window.SupportedLanguages.push({check:t=>null===t,legacy:!0,plugins:YS,name:"mathematica"}),window.SupportedLanguages.push({check:t=>null!=t[0].match(/\w+\.(wl|wls)$/),plugins:YS,legacy:!0,name:"mathematica"}),window.SupportedCells.codemirror={view:class{origin={};editor={};trash=[];forceFocusNext(){zS=!0}focus(t){t>0?this.editor.dispatch({selection:{anchor:0}}):t<0&&this.editor.dispatch({selection:{anchor:this.editor.state.doc.length}}),this.editor.focus()}setContent(t){if(console.warn("content mutation!"),!this.editor.viewState)return;const e=this.editor;console.log("result"),console.log(t),this.editor.dispatch({changes:{from:0,to:e.viewState.state.doc.length,insert:t}})}addDisposable(t){this.trash.push(t)}dispose(){this.editor.destroy()}readOnly(t){this.editor.dispatch({effects:yS.reconfigure(xt.readOnly.of(t))})}constructor(t,e){this.origin=t;const i=this.origin,n=PS(e).plugins,s=this;this.origin.element.ocellref=s;const r=new Ts({doc:(o=e,o.replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))),extensions:jS.map((t=>t(s,n))),parent:this.origin.element});var o;return this.editor=r,this.editor.dom.ocellref=s,this.editor.viewState.state.config.eval=()=>{i.eval(this.editor.state.doc.toString())},zS&&r.focus(),zS=!1,this}},context:{EditorAutocomplete:kS,javascriptLanguage:qf,javascript:Nf,markdownLanguage:rm,markdown:function(t={}){let{codeLanguages:e,defaultCodeLanguage:i,addKeymap:n=!0,base:{parser:s}=sm}=t;if(!(s instanceof Zp))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let r,o=t.extensions?[t.extensions]:[],a=[dm.support];i instanceof Ua?(a.push(i.support),r=i.language):i&&(r=i);let l=e||r?(h=e,c=r,t=>{if(t&&h){let e=null;if(t=/\S*/.exec(t)[0],e="function"==typeof h?h(t):Ya.matchLanguageName(h,t,!0),e instanceof Ya)return e.support?e.support.language.parser:Ta.getSkippingParser(e.load());if(e)return e.parser}return c?c.parser:null}):void 0;var h,c;return o.push(function(t){let{codeParser:e,htmlParser:i}=t,n=Do(((t,n)=>{let s=t.type.id;if(!e||s!=Kf.CodeBlock&&s!=Kf.FencedCode){if(i&&(s==Kf.HTMLBlock||s==Kf.HTMLTag))return{parser:i,overlay:rO(t.node,t.from,t.to)}}else{let i="";if(s==Kf.FencedCode){let e=t.node.getChild(Kf.CodeInfo);e&&(i=n.read(e.from,e.to))}let r=e(i);if(r)return{parser:r,overlay:t=>t.type.id==Kf.CodeText}}return null}));return{wrap:n}}({codeParser:l,htmlParser:dm.language.parser})),n&&a.push(N.high(Ys.of(um))),new Ua(nm(s.configure(o)),a)},htmlLanguage:jg,html:Ng,cssLanguage:kg,css:Qg,EditorView:Ts,EditorState:xt,highlightSpecialChars:vr,syntaxHighlighting:$l,defaultHighlightStyle:xS,editorCustomTheme:qS,foldGutter:function(t={}){let e=Object.assign(Object.assign({},wl),t),i=new vl(e,!0),n=new vl(e,!1),s=_i.fromClass(class{constructor(t){this.from=t.viewport.from,this.markers=this.buildMarkers(t)}update(t){(t.docChanged||t.viewportChanged||t.startState.facet(Wa)!=t.state.facet(Wa)||t.startState.field(dl,!1)!=t.state.field(dl,!1)||Xa(t.startState)!=Xa(t.state)||e.foldingChanged(t))&&(this.markers=this.buildMarkers(t.view))}buildMarkers(t){let e=new Xt;for(let s of t.viewportLineBlocks){let r=fl(t.state,s.from,s.to)?n:ll(t.state,s.from,s.to)?i:null;r&&e.add(s.from,s.from,r)}return e.finish()}}),{domEventHandlers:r}=e;return[s,Ir({class:"cm-foldGutter",markers(t){var e;return(null===(e=t.plugin(s))||void 0===e?void 0:e.markers)||_t.empty},initialSpacer:()=>new vl(e,!1),domEventHandlers:Object.assign(Object.assign({},r),{click:(t,e,i)=>{if(r.click&&r.click(t,e,i))return!0;let n=fl(t.state,e.from,e.to);if(n)return t.dispatch({effects:ul.of(n)}),!0;let s=ll(t.state,e.from,e.to);return!!s&&(t.dispatch({effects:cl.of(s)}),!0)}})}),ml()]},Facet:E,Compartment:F,mathematicaPlugins:YS,legacyLangNameFacet:CS,DropPasteHandlers:Cm,EditorExtensionsMinimal:IS,EditorParameters:BS,EditorExtensions:jS,StateField:q,Decoration:ni,ViewPlugin:_i,WidgetType:ei,originFacet:NS,MatchDecorator:pr}},window.OfflineMode&&SS.push(xt.readOnly.of(!0)),core.CellView=async(t,e)=>{const i=await core._getRules(t,e);i.Display||(i.Display="codemirror");const n=await interpretate(t[0],e),s={element:e.element,uid:FS()};i.Style&&(e.element.style=i.Style),i.Class&&e.element.classList.add(...i.Class.split(" ")),i.ImageSize&&(Array.isArray(i.ImageSize)?(e.element.style.width=i.ImageSize[0]+"px",e.element.style.height=i.ImageSize[1]+"px"):e.element.style.width=i.ImageSize+"px"),new window.SupportedCells[i.Display].view(s,n)};const HS={};core.FrontEditorSelected=async(t,e)=>{console.log("check");const i=await interpretate(t[0],e),n=await core._getRules(t,e);let s;switch(n.Editor&&(s=HS[n.Editor],console.log("Editor"),console.log(n.Editor),console.log(s)),i){case"Get":return ES(s);case"Set":let i=await interpretate(t[1],e);VS(i,s);break;case"GetDoc":return RS(s);case"SetDoc":let n=await interpretate(t[1],e);DS(n,s);break;case"Cursor":return TS(s);case"Type":return AS(s);case"Editor":const r=FS();return HS[r]=MS(),r}};window.SupportedCells.shell={view:class{dispose(){}constructor(t,e){this.origin=t;const i=document.createElement("div");return i.classList.add(..."flex sc-b max-h-60 text-sm overflow-y-scroll".split(" ")),i.style.overflowAnchor="auto",i.style.flexDirection="column-reverse",i.innerText=e,this.origin.element.appendChild(i),this}}}; diff --git a/src/Frontend.wl b/src/Frontend.wl index a6366cd..afcb36d 100644 --- a/src/Frontend.wl +++ b/src/Frontend.wl @@ -173,6 +173,46 @@ CheckSyntax[str_String] := ]; + +SHQ[t_Transaction] := (StringMatchQ[t["Data"], ".sh\n"~~___] ) + +sh = StandardEvaluator["Name" -> "Shell Evaluator", "InitKernel" -> (#&), "Pattern" -> (_?SHQ), "Priority"->(3)]; + +StandardEvaluator`ReadyQ[sh, k_] := (True) + +processEnv = Inherited; +If[$OperatingSystem === "MacOSX", processEnv = <|"PATH"->Import["!source ~/.bash_profile; echo $PATH", "Text"]|>]; + + +limitString[_] := "$Failed"; +limitString[s_String, lim_:1000] := StringTake[s, Min[StringLength[s], lim]]; + +StandardEvaluator`Evaluate[sh, k_, t_] := Module[{list}, + t["Data"] = StringTrim[StringDrop[t["Data"], 4]]; + + If[MemberQ[t["Properties"], "EvaluationContext"], + With[{refCell = CellObj`HashMap[t["EvaluationContext"]["Ref"]]}, + If[MatchQ[refCell, _CellObj], + With[{path = If[DirectoryQ[#], #, DirectoryName[#] ] &@ refCell["Notebook"]["Path"]}, + With[{result = RunProcess[StringSplit[t["Data"], " "], ProcessDirectory->path, ProcessEnvironment->processEnv]}, + If[result["ExitCode"] === 0, + EventFire[t, "Result", <|"Data" -> (limitString[result["StandardOutput"], 10000]), "Meta" -> Sequence["Display"->"shell"] |> ]; + EventFire[t, "Finished", True]; + , + EventFire[t, "Error", limitString @ result["StandardError"]]; + ] + ] + ] + , + EventFire[t, "Error", "Reference cell not found"]; + ] + ] + , + EventFire[t, "Error", "EvaluationContext is missing"]; + ]; + +]; + End[] EndPackage[] \ No newline at end of file diff --git a/src/kernel.js b/src/kernel.js index c384f27..518cc14 100644 --- a/src/kernel.js +++ b/src/kernel.js @@ -1013,3 +1013,27 @@ core.FrontEditorSelected = async (args, env) => { break; } } + + +class ShellCell { + + dispose() { + + } + + constructor(parent, data) { + this.origin = parent; + const result = document.createElement('div'); + result.classList.add(...('flex sc-b max-h-60 text-sm overflow-y-scroll'.split(' '))); + result.style.overflowAnchor = 'auto'; + result.style.flexDirection = 'column-reverse'; + result.innerText = data; + this.origin.element.appendChild(result); + + return this; + } +} + +window.SupportedCells['shell'] = { + view: ShellCell +}; From b391e487553d0684bacd1516a583b19c46230b39 Mon Sep 17 00:00:00 2001 From: Kirill Vasin Date: Sun, 17 Nov 2024 23:28:53 +0100 Subject: [PATCH 15/26] version up --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4cb80d7..0a3dc4d 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wljs-editor", - "version": "1.2.5", + "version": "1.2.6", "description": "WLJS Code editor", "scripts": { "build": "node --max-old-space-size=8192 ./node_modules/.bin/rollup --config rollup.config.mjs", From bb0b54901caf0957f28d918b2bb75efdaf80820d Mon Sep 17 00:00:00 2001 From: Kirill Vasin Date: Tue, 19 Nov 2024 15:08:21 +0100 Subject: [PATCH 16/26] beeper system --- src/NotificationsKernel.wl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/NotificationsKernel.wl b/src/NotificationsKernel.wl index fd89b21..43eaa6b 100644 --- a/src/NotificationsKernel.wl +++ b/src/NotificationsKernel.wl @@ -12,9 +12,11 @@ notRule[_] = True Unprotect[Beep] ClearAll[Beep] Beep[] := EventFire[Internal`Kernel`Stdout[ Internal`Kernel`Hash ], Notifications`Beeper[], True]; +Beep["System"] := EventFire[Internal`Kernel`Stdout[ Internal`Kernel`Hash ], Notifications`Beeper[], "System"]; Beep[_] := Beep[] + HapticFeedback[] := EventFire[Internal`Kernel`Stdout[ Internal`Kernel`Hash ], Notifications`Rumble[], True]; HapticFeedback[_] := HapticFeedback[] From e359f9030e36e5b5e41add2d2eab6342c2cf941f Mon Sep 17 00:00:00 2001 From: Kirill Vasin Date: Fri, 22 Nov 2024 17:14:04 +0100 Subject: [PATCH 17/26] support for chunks --- dist/kernel.js | 36 +++++++++++-- dist/kernel.min.js | 2 +- .../src/mathematica/dropevents.js | 4 +- src/FileUpload.wl | 51 +++++++++++++++---- src/kernel.js | 32 ++++++++++-- 5 files changed, 105 insertions(+), 20 deletions(-) diff --git a/dist/kernel.js b/dist/kernel.js index 2feb14f..89013bc 100644 --- a/dist/kernel.js +++ b/dist/kernel.js @@ -28812,8 +28812,8 @@ function readFile(file, cbk, fail) { reader.addEventListener('load', (event) => { const payload = event.target.result; - if (payload.byteLength / 1024 / 1024 > 15) { - alert('Files > 15Mb are not supported for drag and drop'); + if (payload.byteLength / 1024 / 1024 > 100) { + alert('Files > 100Mb are not supported for drag and drop'); fail(); return; //throw 'Files > 15Mb are not supported for drag and drop'; @@ -40232,6 +40232,16 @@ compactWLEditor.state = (args) => { return state; }; +const splitStringIntoChunks = (str, chunkSize) => { + if (!str || chunkSize <= 0) return []; + + const chunks = []; + for (let i = 0; i < str.length; i += chunkSize) { + chunks.push(str.slice(i, Math.min(i + chunkSize, str.length))); + } + return chunks; +}; + const wlDrop = { transaction: (ev, view, id, length) => { console.log(view.dom.ocellref); @@ -40242,9 +40252,18 @@ const wlDrop = { }, file: (ev, view, id, name, result) => { - console.log(view.dom.ocellref); + //console.log(view.dom.ocellref); + //console.log(result); if (view.dom.ocellref) { - server.emitt(id, `<|"Data"->"${result}", "Name"->"${name}"|>`, 'File'); + //throw result.length; + if (result.length > 5 * 1024 * 1024) { + const chunks = splitStringIntoChunks(result, 5 * 1024 * 1024); + chunks.forEach((chunk, index) => { + server.emitt(id, `<|"Data"->"${chunk}", "Name"->"${name}", "Chunk"->${index+1}, "Chunks"->${chunks.length}|>`, 'Chunk'); + }); + } else { + server.emitt(id, `<|"Data"->"${result}", "Name"->"${name}"|>`, 'File'); + } } } }; @@ -40261,7 +40280,14 @@ const wlPaste = { file: (ev, view, id, name, result) => { console.log(view.dom.ocellref); if (view.dom.ocellref) { - server.emitt(id, `<|"Data"->"${result}", "Name"->"${name}"|>`, 'File'); + if (result.length > 5 * 1024 * 1024) { + const chunks = splitStringIntoChunks(result, 5 * 1024 * 1024); + chunks.forEach((chunk, index) => { + server.emitt(id, `<|"Data"->"${chunk}", "Name"->"${name}", "Chunk"->${index+1}, "Chunks"->${chunks.length}|>`, 'Chunk'); + }); + } else { + server.emitt(id, `<|"Data"->"${result}", "Name"->"${name}"|>`, 'File'); + } } } }; diff --git a/dist/kernel.min.js b/dist/kernel.min.js index 8c5f9a2..8ad2e98 100644 --- a/dist/kernel.min.js +++ b/dist/kernel.min.js @@ -1 +1 @@ -class t{constructor(){}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 a(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}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 l(n,o,i,r);n=o+1,i++}}decompose(t,i,r,o){let a=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(a.text,t.text.slice(),0,a.length);if(i.length<=32)r.push(new e(i,t.length+a.length));else{let t=i.length>>1;r.push(new e(i.slice(0,t)),new e(i.slice(t)))}}else r.push(a)}replace(t,r,o){if(!(o instanceof e))return super.replace(t,r,o);let a=n(this.text,n(o.text,s(this.text,0,t)),r),l=this.length+o.length-(r-t);return a.length<=32?new e(a,l):i.from(e.split(a,[]),l)}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=a+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,a=i+r.lines-1;if((e?a:o)>=t)return r.lineInner(t,e,i,n);n=o+1,i=a+1}}decompose(t,e,i,n){for(let s=0,r=0;r<=e&&s=r){let s=n&((r<=t?1:0)|(a>=e?2:0));r>=t&&a<=e&&!s?i.push(o):o.decompose(t-r,e-r,i,s)}r=a+1}}replace(t,e,n){if(n.lines=r&&e<=a){let l=o.replace(t-r,e-r,n),h=this.lines-o.lines+l.lines;if(l.lines>4&&l.lines>h>>6){let r=this.children.slice();return r[s]=l,new i(r,this.length-(e-t)+n.length)}return super.replace(r,a,l)}r=a+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=a+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,a]=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==a)return n;let i=this.children[s],l=t.children[r];if(i!=l)return n+i.scanIdentical(l,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,a=r>>1,l=[],h=0,c=-1,u=[];function d(t){let n;if(t.lines>o&&t instanceof i)for(let e of t.children)d(e);else t.lines>a&&(h>a||!h)?(f(),l.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&&f(),h+=t.lines,c+=t.length+1,u.push(t))}function f(){0!=h&&(l.push(1==u.length?u[0]:i.from(u,c)),c=-1,h=u.length=0)}for(let e of t)d(e);return f(),1==l.length?l[0]:new i(l,n)}}function n(t,e,i=0,n=1e9){for(let s=0,r=0,o=!0;r=i&&(l>n&&(a=a.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,a=s instanceof e?s.text.length:s.children.length;if(o==(i>0?a: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 a{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]=a.prototype[Symbol.iterator]=function(){return this});let l=class{constructor(t,e,i,n){this.from=t,this.to=e,this.number=i,this.text=n}get length(){return this.to-this.from}},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 d=8205;function f(t,e,i=!0,n=!0){return(i?p:O)(t,e,n)}function p(t,e,i){if(e==t.length)return e;e&&g(t.charCodeAt(e))&&m(t.charCodeAt(e-1))&&e--;let n=b(t,e);for(e+=v(n);e=0&&u(b(t,n));)i++,n-=2;if(i%2==0)break;e+=2}}}return e}function O(t,e,i){for(;e>0;){let n=p(t,e-2,i);if(n=56320&&t<57344}function m(t){return t>=55296&&t<56320}function b(t,e){let i=t.charCodeAt(e);if(!m(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return g(n)?n-56320+(i-55296<<10)+65536:i}function w(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function v(t){return t<65536?1:2}const y=/\r\n?|\n/;var S=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(S||(S={}));class x{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;et)return s+(t-n);s+=o}else{if(i!=S.Simple&&l>=t&&(i==S.TrackDel&&nt||i==S.TrackBefore&&nt))return null;if(l>t||l==t&&e<0&&!o)return t==n||e<0?s:s+a;s+=a}n=l}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 x(t)}static create(t){return new x(t)}}class k extends x{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 P(this,((e,i,n,s,r)=>t=t.replace(n,n+(i-e),r)),!1),t}mapDesc(t,e=!1){return C(this,t,e,!0)}invert(e){let i=this.sections.slice(),n=[];for(let s=0,r=0;s=0){i[s]=a,i[s+1]=o;let l=s>>1;for(;n.length0&&$(i,e,s.text),s.forward(t),o+=t}let l=t[r++];for(;o>1].toJSON()))}return t}static of(e,i,n){let s=[],r=[],o=0,a=null;function l(t=!1){if(!t&&!s.length)return;oa||e<0||a>i)throw new RangeError(`Invalid change range ${e} to ${a} (in doc of length ${i})`);let u=c?"string"==typeof c?t.of(c.split(n||y)):c:t.empty,d=u.length;if(e==a&&0==d)return;eo&&Q(s,e-o,-1),Q(s,a-e,d),$(r,s,u),o=a}}(e),l(!a),a}static empty(t){return new k(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 $(e,i,n){if(0==n.length)return;let s=i.length-2>>1;if(s>1])),!(n||a==e.sections.length||e.sections[a+1]<0);)l=e.sections[a++],h=e.sections[a++];i(r,c,o,u,d),r=c,o=u}}}function C(t,e,i,n=!1){let s=[],r=n?[]:null,o=new X(t),a=new X(e);for(let t=-1;;)if(-1==o.ins&&-1==a.ins){let t=Math.min(o.len,a.len);Q(s,t,-1),o.forward(t),a.forward(t)}else if(a.ins>=0&&(o.ins<0||t==o.i||0==o.off&&(a.len=0&&t=0)){if(o.done&&a.done)return r?k.createSet(s,r):x.create(s);throw new Error("Mismatched change set lengths")}{let e=0,i=o.len;for(;i;)if(-1==a.ins){let t=Math.min(i,a.len);e+=t,i-=t,a.forward(t)}else{if(!(0==a.ins&&a.lene||o.ins>=0&&o.len>e)&&(t||n.length>i),r.forward2(e),o.forward(e)}}else Q(n,0,o.ins,t),s&&$(s,n,o.text),o.next()}}class X{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 Z{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 Z(i,n,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return A.range(t,e);let i=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return A.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 A.range(t.anchor,t.head)}static create(t,e,i){return new Z(t,e,i)}}class A{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:A.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 A(t.ranges.map((t=>Z.fromJSON(t))),t.main)}static single(t,e=t){return new A([A.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?A.range(o,r):A.range(r,o))}}return new A(t,e)}}function T(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let R=0;class E{constructor(t,e,i,n,s){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=n,this.id=R++,this.default=t([]),this.extensions="function"==typeof s?s(this):s}static define(t={}){return new E(t.combine||(t=>t),t.compareInput||((t,e)=>t===e),t.compare||(t.combine?(t,e)=>t===e:V),!!t.static,t.enables)}of(t){return new M([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,2,e)}from(t,e){return e||(e=t=>t),this.compute([t],(i=>e(i.field(t))))}}function V(t,e){return t==e||t.length==e.length&&t.every(((t,i)=>t===e[i]))}class M{constructor(t,e,i,n){this.dependencies=t,this.facet=e,this.type=i,this.value=n,this.id=R++}dynamicSlot(t){var e;let i=this.value,n=this.facet.compareInput,s=this.id,r=t[s]>>1,o=2==this.type,a=!1,l=!1,h=[];for(let i of this.dependencies)"doc"==i?a=!0:"selection"==i?l=!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(a&&e.docChanged||l&&(e.docChanged||e.selection)||W(t,h)){let e=i(t);if(o?!D(e,t.values[r],n):!n(e,t.values[r]))return t.values[r]=e,1}return 0},reconfigure:(t,e)=>{let a,l=e.config.address[s];if(null!=l){let s=tt(e,l);if(this.dependencies.every((i=>i instanceof E?e.facet(i)===t.facet(i):!(i instanceof q)||e.field(i,!1)==t.field(i,!1)))||(o?D(a=i(t),s,n):n(a=i(t),s)))return t.values[r]=s,0}else a=i(t);return t.values[r]=a,1}}}}function D(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 a(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(Y).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,Y.of({field:this,create:t})]}get extension(){return this}}const L=4,z=3,I=2,B=1;function j(t){return e=>new G(e,t)}const N={highest:j(0),high:j(B),default:j(I),low:j(z),lowest:j(L)};class G{constructor(t,e){this.inner=t,this.prec=e}}class F{of(t){return new H(this,t)}reconfigure(t){return F.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class H{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;function r(t,o){let a=s.get(t);if(null!=a){if(a<=o)return;let e=n[a].indexOf(t);e>-1&&n[a].splice(e,1),t instanceof H&&i.delete(t.compartment)}if(s.set(t,o),Array.isArray(t))for(let e of t)r(e,o);else if(t instanceof H){if(i.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");let n=e.get(t.compartment)||t.inner;i.set(t.compartment,n),r(n,o)}else if(t instanceof G)r(t.inner,t.prec);else if(t instanceof q)n[o].push(t),t.provides&&r(t.provides,o);else if(t instanceof M)n[o].push(t),t.facet.extensions&&r(t.facet.extensions,I);else{let e=t.extension;if(!e)throw new Error(`Unrecognized extension value in extension set (${t}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(e,o)}}return r(t,I),n.reduce(((t,e)=>t.concat(e)))}(t,e,r))i instanceof q?n.push(i):(s[i.facet.id]||(s[i.facet.id]=[])).push(i);let o=Object.create(null),a=[],l=[];for(let t of n)o[t.id]=l.length<<1,l.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]=a.length<<1|1,V(r,e))a.push(i.facet(n));else{let t=n.combine(e.map((t=>t.value)));a.push(i&&n.compare(t,i.facet(n))?i.facet(n):t)}else{for(let t of e)0==t.type?(o[t.id]=a.length<<1|1,a.push(t.value)):(o[t.id]=l.length<<1,l.push((e=>t.dynamicSlot(e))));o[n.id]=l.length<<1,l.push((t=>U(t,n,e)))}}let c=l.map((t=>t(o)));return new J(t,r,c,o,a,s)}}function K(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 tt(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}const et=E.define(),it=E.define({combine:t=>t.some((t=>t)),static:!0}),nt=E.define({combine:t=>t.length?t[0]:void 0,static:!0}),st=E.define(),rt=E.define(),ot=E.define(),at=E.define({combine:t=>!!t.length&&t[0]});class lt{constructor(t,e){this.type=t,this.value=e}static define(){return new ht}}class ht{of(t){return new lt(this,t)}}class ct{constructor(t){this.map=t}of(t){return new ut(this,t)}}class ut{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 ut(this.type,e)}is(t){return this.type==t}static define(t={}){return new ct(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}}ut.reconfigure=ut.define(),ut.appendConfig=ut.define();class dt{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&&T(i,e.newLength),s.some((t=>t.type==dt.time))||(this.annotations=s.concat(dt.time.of(Date.now())))}static create(t,e,i,n,s,r){return new dt(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(dt.userEvent);return!(!e||!(e==t||e.length>t.length&&e.slice(0,t.length)==t&&"."==e[t.length]))}}function ft(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=pt(n,Ot(e,r,t.changes.newLength),!0))}return n==t?t:dt.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(st)){let e=n(t);if(!1===e){i=!1;break}Array.isArray(e)&&(i=!0===i?e:ft(i,e))}if(!0!==i){let n,s;if(!1===i)s=t.changes.invertedDesc,n=k.empty(e.doc.length);else{let e=t.changes.filter(i);n=e.changes,s=e.filtered.mapDesc(e.changes).invertedDesc}t=dt.create(e,n,t.selection&&t.selection.map(s),ut.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let n=e.facet(rt);for(let i=n.length-1;i>=0;i--){let s=n[i](t);t=s instanceof dt?s:Array.isArray(s)&&1==s.length&&s[0]instanceof dt?s[0]:gt(e,bt(s),!1)}return t}(s):s)}dt.time=lt.define(),dt.userEvent=lt.define(),dt.addToHistory=lt.define(),dt.remote=lt.define();const mt=[];function bt(t){return null==t?mt:Array.isArray(t)?t:[t]}var wt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(wt||(wt={}));const vt=/[\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){}function St(t){return e=>{if(!/\S/.test(e))return wt.Space;if(function(t){if(yt)return yt.test(t);for(let e=0;e"€"&&(i.toUpperCase()!=i.toLowerCase()||vt.test(i)))return!0}return!1}(e))return wt.Word;for(let i=0;i-1)return wt.Word;return wt.Other}}class xt{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(ut.reconfigure)?(i=null,n=e.value):e.is(ut.appendConfig)&&(i=null,n=bt(n).concat(e.value));if(i)e=t.startState.values.slice();else{i=J.resolve(n,s,this),e=new xt(i,this.doc,this.selection,i.dynamicSlots.map((()=>null)),((t,e)=>e.reconfigure(t,this)),null).values}new xt(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:A.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=bt(i.effects);for(let i=1;is.spec.fromJSON(r,t))))}return xt.create({doc:t.doc,selection:A.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(xt.lineSeparator)||y)),s=e.selection?e.selection instanceof A?e.selection:A.single(e.selection.anchor,e.selection.head):A.single(0);return T(s,n.length),i.staticFacet(it)||(s=s.asSingle()),new xt(i,n,s,i.dynamicSlots.map((()=>null)),((t,e)=>e.create(t)),null)}get tabSize(){return this.facet(xt.tabSize)}get lineBreak(){return this.facet(xt.lineSeparator)||"\n"}get readOnly(){return this.facet(at)}phrase(t,...e){for(let e of this.facet(xt.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(et))for(let r of s(this,e,i))Object.prototype.hasOwnProperty.call(r,t)&&n.push(r[t]);return n}charCategorizer(t){return St(this.languageDataAt("wordChars",t).join(""))}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=f(e,r,!1);if(s(e.slice(t,r))!=wt.Word)break;r=t}for(;ot.length?t[0]:4}),xt.lineSeparator=nt,xt.readOnly=at,xt.phrases=E.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]))}}),xt.languageData=et,xt.changeFilter=st,xt.transactionFilter=rt,xt.transactionExtender=ot,F.reconfigure=ut.define();class Qt{eq(t){return this==t}range(t,e=t){return $t.create(t,e,this)}}Qt.prototype.startSide=Qt.prototype.endSide=0,Qt.prototype.point=!1,Qt.prototype.mapMode=S.TrackDel;let $t=class t{constructor(t,e,i){this.from=t,this.to=e,this.value=i}static create(e,i,n){return new t(e,i,n)}};function Pt(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Ct{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,a=s[n]-t||(i?this.value[n].endSide:this.value[n].startSide)-e;if(n==r)return a>=0?r:o;a>=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||l==h&&c.startSide>0&&c.endSide<=0)continue;(h-l||c.endSide-c.startSide)<0||(r<0&&(r=l),c.point&&(o=Math.max(o,h-l)),i.push(c),n.push(l-r),s.push(h-r))}return{mapped:i.length?new Ct(n,s,i,o):null,pos:r}}}class _t{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 _t(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(Pt)),this.isEmpty)return e.length?_t.of(e):this;let o=new At(this,null,-1).goto(0),a=0,l=[],h=new Xt;for(;o.value||a=0){let t=e[a++];h.addInner(t.from,t.to,t.value)||l.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 Tt.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return Tt.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)),a=Zt(r,o,i),l=new Et(r,a,s),h=new Et(o,a,s);i.iterGaps(((t,e,i)=>Vt(l,t,h,e,i,n))),i.empty&&0==i.length&&Vt(l,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=Zt(s,r),a=new Et(s,o,0).goto(i),l=new Et(r,o,0).goto(i);for(;;){if(a.to!=l.to||!Mt(a.active,l.active)||a.point&&(!l.point||!a.point.eq(l.point)))return!1;if(a.to>n)return!0;a.next(),l.next()}}static spans(t,e,i,n,s=-1){let r=new Et(t,null,s).goto(e),o=e,a=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,a),a=r.openEnd(t));if(r.to>i)return a+(r.point&&r.to>i?1:0);o=r.to,r.next()}}static of(t,e=!1){let i=new Xt;for(let n of t instanceof $t?[t]:e?function(t){if(t.length>1)for(let e=t[0],i=1;i0)return t.slice().sort(Pt);e=n}return t}(t):t)i.add(n.from,n.to,n.value);return i.finish()}}_t.empty=new _t([],[],null,-1),_t.empty.nextLayer=_t.empty;class Xt{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}finishChunk(t){this.chunks.push(new Ct(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=[])}add(t,e,i){this.addInner(t,e,i)||(this.nextLayer||(this.nextLayer=new Xt)).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(_t.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;let e=_t.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function Zt(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 At(r,e,i,s));return 1==n.length?n[0]:new Tt(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--)Rt(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--)Rt(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(),Rt(this.heap,0)}}}function Rt(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 Et{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=Tt.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){Dt(this.active,t),Dt(this.activeTo,t),Dt(this.activeRank,t),this.minActive=Ut(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&&Dt(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 Vt(t,e,i,n,s,r){t.goto(e),i.goto(n);let o=n+s,a=n,l=n-e;for(;;){let e=t.to+l-i.to||t.endSide-i.endSide,n=e<0?t.to+l: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))&&Mt(t.activeForPoint(t.to+l),i.activeForPoint(i.to))||r.comparePoint(a,s,t.point,i.point):s>a&&!Mt(t.active,i.active)&&r.compareRange(a,s,t.active,i.active),n>o)break;a=n,e<=0&&t.next(),e>=0&&i.next()}}function Mt(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 Ut(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(!l)throw new RangeError("The value of a property ("+i+") should be a primitive value.");s(n(i),o,a,h)}else null!=o&&a.push(i.replace(/_.*/,"").replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))+": "+o+";")}(a.length||h)&&r.push((!i||l||o?t:t.map(i)).join(", ")+" {"+a.join(" ")+"}")}for(let e in t)s(n(e),t[e],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let t=zt[qt]||1;return zt[qt]=t+1,"ͼ"+t.toString(36)}static mount(t,e){(t[Lt]||new jt(t)).mount(Array.isArray(e)?e:[e])}}let Bt=new Map;class jt{constructor(t){let e=t.ownerDocument||t,i=e.defaultView;if(!t.head&&t.adoptedStyleSheets&&i.CSSStyleSheet){let n=Bt.get(e);if(n)return t.adoptedStyleSheets=[n.sheet,...t.adoptedStyleSheets],t[Lt]=n;this.sheet=new i.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets],Bt.set(e,this)}else{this.styleTag=e.createElement("style");let i=t.head||t;i.insertBefore(this.styleTag,i.firstChild)}this.modules=[],t[Lt]=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:'"'},Ft="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),Ht="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Jt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Kt=Ht||Ft&&+Ft[1]<57,te=0;te<10;te++)Nt[48+te]=Nt[96+te]=String(te);for(te=1;te<=24;te++)Nt[te+111]="F"+te;for(te=65;te<=90;te++)Nt[te]=String.fromCharCode(te+32),Gt[te]=String.fromCharCode(te);for(var ee in Nt)Gt.hasOwnProperty(ee)||(Gt[ee]=Nt[ee]);function ie(t){let e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection()}function ne(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function se(t,e){if(!e.anchorNode)return!1;try{return ne(t,e.anchorNode)}catch(t){return!1}}function re(t){return 3==t.nodeType?me(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function oe(t,e,i,n){return!!i&&(le(t,e,i,n,-1)||le(t,e,i,n,1))}function ae(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function le(t,e,i,n,s){for(;;){if(t==i&&e==n)return!0;if(e==(s<0?0:he(t))){if("DIV"==t.nodeName)return!1;let i=t.parentNode;if(!i||1!=i.nodeType)return!1;e=ae(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?he(t):0}}}function he(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}const ce={left:0,right:0,top:0,bottom:0};function ue(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function de(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}class fe{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){this.set(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset)}set(t,e,i,n){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=n}}let pe,Oe=null;function ge(t){if(t.setActive)return t.setActive();if(Oe)return t.focus(Oe);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==Oe?{get preventScroll(){return Oe={preventScroll:!0},!0}}:void 0),!Oe){Oe=!1;for(let t=0;te)return i.domBoundsAround(t,e,l);if(c>=t&&-1==n&&(n=a,s=l),l>e&&i.dom.parentNode==this.dom){r=a,o=h;break}h=c,l=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.dirty|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.dirty|=2),1&e.dirty)return;e.dirty|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,this.dirty&&this.markParentsDirty(!0))}setDOM(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=ye){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 Qe(t,e,i,n,s,r,o,a,l){let{children:h}=t,c=h.length?h[e]:null,u=r.length?r[r.length-1]:null,d=u?u.breakAfter:o;if(!(e==n&&c&&!o&&!d&&r.length<2&&c.merge(i,s,r.length?u:null,0==i,a,l))){if(n0&&(!o&&r.length&&c.merge(i,c.length,r[0],!1,a,0)?c.breakAfter=r.shift().breakAfter:(i2);var De={mac:Me||/Mac/.test(Pe.platform),windows:/Win/.test(Pe.platform),linux:/Linux|X11/.test(Pe.platform),ie:Ae,ie_version:Xe?Ce.documentMode||6:Ze?+Ze[1]:_e?+_e[1]:0,gecko:Te,gecko_version:Te?+(/Firefox\/(\d+)/.exec(Pe.userAgent)||[0,0])[1]:0,chrome:!!Re,chrome_version:Re?+Re[1]:0,ios:Me,android:/Android\b/.test(Pe.userAgent),webkit:Ee,safari:Ve,webkit_version:Ee?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Ce.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class We extends Se{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(!i||i instanceof We&&!(this.length-(e-t)+i.length>256))&&(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),!0)}split(t){let e=new We(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new ve(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 Ye(this.dom,t,e)}}class Ue extends Se{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(we(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}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.dirty|=6)}sync(t,e){this.dom?4&this.dirty&&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 Ue&&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 Ue(this.mark,e,r)}domAtPos(t){return Ge(this,t)}coordsAt(t,e){return He(this,t,e)}}function Ye(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?De.chrome||De.gecko||(e?(s--,o=1):r=0)?0:a.length-1];return De.safari&&!o&&0==l.width&&(l=Array.prototype.find.call(a,(t=>t.width))||l),o?ue(l,o<0):l||null}class qe extends Se{constructor(t,e,i){super(),this.widget=t,this.length=e,this.side=i,this.prevWidget=null}static create(t,e,i){return new(t.customView||qe)(t,e,i)}split(t){let e=qe.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 qe&&this.widget.compare(i.widget))||t>0&&s<=0||e0)?ve.before(this.dom):ve.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let i=this.dom.getClientRects(),n=null;if(!i.length)return ce;for(let e=t>0?i.length-1:0;n=i[e],!(t>0?0==e:e==i.length-1||n.top0?-1:1);return this.length?n:ue(n,this.side>0)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class Le extends qe{domAtPos(t){let{topView:e,text:i}=this.widget;return e?ze(t,0,e,i,this.length-e.length,((t,e)=>t.domAtPos(e)),((t,e)=>new ve(t,Math.min(e,t.nodeValue.length)))):new ve(i,Math.min(t,i.nodeValue.length))}sync(){this.setDOM(this.widget.toDOM())}localPosFromDOM(t,e){let{topView:i,text:n}=this.widget;return i?Be(t,e,i,n,this.length-i.length):Math.min(e,this.length)}ignoreMutation(){return!1}get overrideDOMText(){return null}coordsAt(t,e){let{topView:i,text:n}=this.widget;return i?ze(t,e,i,n,this.length-i.length,((t,e,i)=>t.coordsAt(e,i)),((t,e,i)=>Ye(t,e,i))):Ye(n,t,e)}destroy(){var t;super.destroy(),null===(t=this.widget.topView)||void 0===t||t.destroy()}get isEditable(){return!0}canReuseDOM(){return!0}}function ze(t,e,i,n,s,r,o){if(i instanceof Ue){for(let a=i.dom.firstChild;a;a=a.nextSibling){let i=Se.get(a);if(i){let l=ne(a,n),h=i.length+(l?s:0);if(t0?ve.before(this.dom):ve.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){let e=this.dom.getBoundingClientRect(),i=function(t,e){let i=t.parent,n=i?i.children.indexOf(t):-1;for(;i&&n>=0;)if(e<0?n>0:n0?-1:1);return i&&i.tope.top?{left:e.left,right:e.right,top:i.top,bottom:i.bottom}:e}get overrideDOMText(){return t.empty}get isHidden(){return!0}}function Ge(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 Ue&&s.length&&(n=s[s.length-1])instanceof Ue&&n.mark.eq(e.mark)?Fe(n,e.children[0],i-1):(s.push(e),e.setParent(t)),t.length+=e.length}function He(t,e,i){let n=null,s=-1,r=null,o=-1;!function t(e,a){for(let l=0,h=0;l=a&&(c.children.length?t(c,a-h):(!r||r instanceof Ne&&i>0)&&(u>a||h==u&&c.getSide()>0)?(r=c,o=a-h):(h0?3e8:-4e8:e>0?1e8:-1e8,new oi(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}=ai(t,n);e=(s?n?-3e8:-1:5e8)-1,i=1+(r?n?2e8:1:-6e8)}return new oi(t,e,i,n,t.widget||null,!0)}static line(t){return new ri(t)}static set(t,e=!1){return _t.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}ni.none=_t.empty;class si extends ni{constructor(t){let{start:e,end:i}=ai(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){return this==t||t instanceof si&&this.tagName==t.tagName&&this.class==t.class&&Ke(this.attrs,t.attrs)}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}si.prototype.point=!1;class ri extends ni{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof ri&&this.spec.class==t.spec.class&&Ke(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)}}ri.prototype.mapMode=S.TrackBefore,ri.prototype.point=!0;class oi extends ni{constructor(t,e,i,n,s,r){super(e,i,s,t),this.block=n,this.isReplace=r,this.mapMode=n?e<=0?S.TrackBefore:S.TrackAfter:S.TrackDel}get type(){return this.startSide=5}eq(t){return t instanceof oi&&(e=this.widget,i=t.widget,e==i||!!(e&&i&&e.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var e,i}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 ai(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 li(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)}oi.prototype.point=!0;class hi extends Se{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 hi))return!1;this.dom||i.transferDOM(this)}return n&&this.setDeco(i?i.attrs:null),$e(this,t,e,i?i.children:[],s,r),!0}split(t){let e=new hi;if(e.breakAfter=this.breakAfter,0==this.length)return e;let{i: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){Ke(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){Fe(this,t,e)}addLineDeco(t){let e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=Je(e,this.attrs||{})),i&&(this.attrs=Je({class:i},this.attrs||{}))}domAtPos(t){return Ge(this,t)}reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.dirty|=6)}sync(t,e){var i;this.dom?4&this.dirty&&(we(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&&(ti(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&&Se.get(n)instanceof Ue;)n=n.lastChild;if(!(n&&this.length&&("BR"==n.nodeName||0!=(null===(i=Se.get(n))||void 0===i?void 0:i.isEditable)||De.ios&&this.children.some((t=>t instanceof We))))){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 We)||/[^ -~]/.test(i.text))return null;let n=re(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=He(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 hi)return s;if(r>e)break}n=r+s.breakAfter}return null}}class ci extends Se{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 ci&&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(di(new We(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 oi){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let o=e-t;if(i instanceof oi)if(i.block){let{type:t}=i;t!=ii.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new ci(i.widget||new fi("div"),o,t))}else{let r=qe.create(i.widget||new fi("span"),o,o?0:i.startSide),a=this.atCursorPos&&!r.isEditable&&s<=n.length&&(t0),l=!r.isEditable&&(tn.length||i.startSide<=0),h=this.getLine();2!=this.pendingBuffer||a||r.isEditable||(this.pendingBuffer=0),this.flushBuffer(n),a&&(h.append(di(new Ne(1),n),s),s=n.length+Math.max(0,s-n.length)),h.append(di(r,n),s),this.atCursorPos=l,this.pendingBuffer=l?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 ui(t,e,i,s);return r.openEnd=_t.spans(n,e,i,r),r.openStart<0&&(r.openStart=r.openEnd),r.finish(r.openEnd),r}}function di(t,e){for(let i of e)t=new Ue(i,[t],t.length);return t}class fi extends ei{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 pi=E.define(),Oi=E.define(),gi=E.define(),mi=E.define(),bi=E.define(),wi=E.define(),vi=E.define(),yi=E.define({combine:t=>t.some((t=>t))}),Si=E.define({combine:t=>t.some((t=>t))});class xi{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 xi(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin)}}const ki=ut.define({map:(t,e)=>t.map(e)});function Qi(t,e,i){let n=t.facet(mi);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 $i=E.define({combine:t=>!t.length||t[0]});let Pi=0;const Ci=E.define();class _i{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 _i(Pi++,t,i,(t=>{let e=[Ci.of(t)];return s&&e.push(Ti.of((e=>{let i=e.plugin(t);return i?s(i):ni.none}))),n&&e.push(n(t)),e}))}static fromClass(t,e){return _i.define((e=>new t(e)),e)}}class Xi{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(Qi(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){Qi(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){Qi(t.state,e,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Zi=E.define(),Ai=E.define(),Ti=E.define(),Ri=E.define(),Ei=E.define(),Vi=E.define();class Mi{constructor(t,e,i,n){this.fromA=t,this.toA=e,this.fromB=i,this.toB=n}join(t){return new Mi(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(!a)return i;new Mi(a.fromA,a.toA,a.fromB,a.toB).addToSet(i),r=a.toA,o=a.toB}}}class Di{constructor(t,e,i){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=k.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 Mi(t,e,i,s)))),this.changedRanges=n}static create(t,e,i){return new Di(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 Wi=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Wi||(Wi={}));const Ui=Wi.LTR,Yi=Wi.RTL;function qi(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}}const Gi=[];function Fi(t){return[new Ni(0,t,0)]}let Hi="";function Ji(t,e,i,n,s){var r;let o=n.head-t.from,a=-1;if(0==o){if(!s||!t.length)return null;e[0].level!=i&&(o=e[0].side(!1,i),a=0)}else if(o==t.length){if(s)return null;let t=e[e.length-1];t.level!=i&&(o=t.side(!0,i),a=e.length-1)}a<0&&(a=Ni.find(e,o,null!==(r=n.bidiLevel)&&void 0!==r?r:-1,n.assoc));let l=e[a];o==l.side(s,i)&&(l=e[a+=s?1:-1],o=l.side(!s,i));let h=s==(l.dir==i),c=f(t.text,o,h);if(Hi=t.text.slice(Math.min(o,c),Math.max(o,c)),c!=l.side(s,i))return A.cursor(c+t.from,h?-1:1,l.level);let u=a==(s?e.length-1:0)?null:e[a+(s?1:-1)];return u||l.level==i?u&&u.level1)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=Se.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 en(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}class nn{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class sn extends Se{constructor(t){super(),this.view=t,this.compositionDeco=ni.none,this.decorations=[],this.dynamicDecorationMap=[],this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(t.contentDOM),this.children=[new hi],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Mi(0,0,0,t.state.doc.length)],0)}get length(){return this.view.state.doc.length}update(t){let e=t.changedRanges;this.minWidth>0&&e.length&&(e.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),this.view.inputState.composing<0?this.compositionDeco=ni.none:(t.transactions.length||this.dirty)&&(this.compositionDeco=function(t,e){let i=on(t);if(!i)return ni.none;let{from:n,to:s,node:r,text:o}=i,a=e.mapPos(n,1),l=Math.max(a,e.mapPos(s,-1)),{state:h}=t,c=3==r.nodeType?r.nodeValue:new tn([],h).readRange(r.firstChild,null).text;if(l-a{this.dom.style.height=this.view.viewState.contentHeight+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let t=De.chrome||De.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,t),this.dirty=0,t&&(t.written||i.selectionRange.focusNode!=t.node)&&(this.forceSelection=!0),this.dom.style.height=""}));let n=[];if(this.view.viewport.from||this.view.viewport.to=0?t[e]:null;if(!n)break;let{fromA:s,toA:r,fromB:o,toB:a}=n,{content:l,breakAtStart:h,openStart:c,openEnd:u}=ui.build(this.view.state.doc,o,a,this.decorations,this.dynamicDecorationMap),{i:d,off:f}=i.findPos(r,1),{i:p,off:O}=i.findPos(s,-1);Qe(this,p,O,d,f,l,h,c,u)}}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&&se(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,a=this.domAtPos(o.anchor),l=o.empty?a:this.domAtPos(o.head);if(De.gecko&&o.empty&&!this.compositionDeco.size&&(1==(h=a).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((()=>a.node.insertBefore(t,a.node.childNodes[a.offset]||null))),a=l=new ve(t,0),r=!0}var h;let c=this.view.observer.selectionRange;!r&&c.focusNode&&oe(a.node,a.offset,c.anchorNode,c.anchorOffset)&&oe(l.node,l.offset,c.focusNode,c.focusOffset)||(this.view.observer.ignore((()=>{De.android&&De.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=ie(this.view.root);if(t)if(o.empty){if(De.gecko){let t=(e=a.node,n=a.offset,1!=e.nodeType?0:(n&&"false"==e.childNodes[n-1].contentEditable?1:0)|(no.head&&([a,l]=[l,a]),e.setEnd(l.node,l.offset),e.setStart(a.node,a.offset),t.removeAllRanges(),t.addRange(e)}else;var e,n;s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())})),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new ve(c.anchorNode,c.anchorOffset),this.impreciseHead=l.precise?null:new ve(c.focusNode,c.focusOffset)}enforceCursorAssoc(){if(this.compositionDeco.size)return;let{view:t}=this,e=t.state.selection.main,i=ie(t.root),{anchorNode:n,anchorOffset:s}=t.observer.selectionRange;if(!(i&&e.empty&&e.assoc&&i.modify))return;let r=hi.find(this,e.head);if(!r)return;let o=r.posAtStart;if(e.head==o||e.head==o+r.length)return;let a=this.coordsAt(e.head,-1),l=this.coordsAt(e.head,1);if(!a||!l||a.bottom>l.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)}nearest(t){for(let e=t;e;){let t=Se.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!=ii.WidgetBefore&&s.type!=ii.WidgetAfter&&(!n||2==e||this.children[n-1].breakAfter||this.children[n-1].type==ii.WidgetBefore&&e>-2))return s.coordsAt(t-r,e);i=r}}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,a=this.view.textDirection==Wi.LTR;for(let t=0,l=0;ln)break;if(t>=i){let i=h.dom.getBoundingClientRect();if(e.push(i.height),r){let e=h.dom.lastChild,n=e?re(e):[];if(n.length){let e=n[n.length-1],r=a?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?Wi.RTL:Wi.LTR}measureTextSize(){for(let t of this.children)if(t instanceof hi){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.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(n);let s=re(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 ke(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;t.push(ni.replace({widget:new rn(n),block:!0,inclusive:!0,isBlockGap:!0}).range(i,r))}if(!s)break;i=s.to+1}return ni.set(t)}updateDeco(){let t=this.view.state.facet(Ti).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=0,r=0,o=0,a=0;for(let t of this.view.state.facet(Ei).map((t=>t(this.view))))if(t){let{left:e,right:i,top:n,bottom:l}=t;null!=e&&(s=Math.max(s,e)),null!=i&&(r=Math.max(r,i)),null!=n&&(o=Math.max(o,n)),null!=l&&(a=Math.max(a,l))}let l={left:n.left-s,top:n.top-o,right:n.right+r,bottom:n.bottom+a};!function(t,e,i,n,s,r,o,a){let l=t.ownerDocument,h=l.defaultView||window;for(let c=t;c;)if(1==c.nodeType){let t,u=c==l.body;if(u)t=de(h);else{if(c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let e=c.getBoundingClientRect();t={left:e.left,right:e.left+c.clientWidth,top:e.top,bottom:e.top+c.clientHeight}}let d=0,f=0;if("nearest"==s)e.top0&&e.bottom>t.bottom+f&&(f=e.bottom-t.bottom+f+o)):e.bottom>t.bottom&&(f=e.bottom-t.bottom+o,i<0&&e.top-f0&&e.right>t.right+d&&(d=e.right-t.right+d+r)):e.right>t.right&&(d=e.right-t.right+r,i<0&&e.left0))break;i=i.childNodes[n-1],n=he(i)}if(i>=0)for(let n=t,s=e;;){if(3==n.nodeType)return n;if(!(1==n.nodeType&&s=0))break;n=n.childNodes[s],s=0}return null}class hn{constructor(){this.changes=[]}compareRange(t,e){li(t,e,this.changes)}comparePoint(t,e){li(t,e,this.changes)}}function cn(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function un(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function dn(t,e){return t.tope.top+1}function fn(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,a,l,h,c,u=!1;for(let d=t.firstChild;d;d=d.nextSibling){let t=re(d);for(let f=0;fg||o==g&&r>O){n=d,s=p,r=O,o=g;let a=g?i0?f0)}0==O?i>p.bottom&&(!h||h.bottomp.top)&&(l=d,c=p):h&&dn(h,p)?h=pn(h,p.bottom):c&&dn(c,p)&&(c=fn(c,p.top))}}if(h&&h.bottom>=i?(n=a,s=h):c&&c.top<=i&&(n=l,s=c),!n)return{node:t,offset:0};let d=Math.max(s.left,Math.min(s.right,e));return 3==n.nodeType?gn(n,d,i):u&&"false"!=n.contentEditable?On(n,d,i):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,n)+(e>=(s.left+s.right)/2?1:0)}}function gn(t,e,i){let n=t.nodeValue.length,s=-1,r=1e9,o=0;for(let a=0;ai?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(De.chrome||De.gecko){me(t,a).getBoundingClientRect().left==h.right&&(n=!i)}if(c<=0)return{node:t,offset:a+(n?1:0)};s=a+(n?1:0),r=c}}}return{node:t,offset:s>-1?s:o>0?t.nodeValue.length:0}}function mn(t,e,i,n=-1){var s,r;let o,a=t.contentDOM.getBoundingClientRect(),l=a.top+t.viewState.paddingTop,{docHeight:h}=t.viewState,{x:c,y:u}=e,d=u-l;if(d<0)return 0;if(d>h)return t.state.doc.length;for(let e=t.defaultLineHeight/2,s=!1;o=t.elementAtHeight(d),o.type!=ii.Text;)for(;d=n>0?o.bottom+e:o.top-e,!(d>=0&&d<=h);){if(s)return i?null:0;s=!0,n=-n}u=l+d;let f=o.from;if(ft.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:bn(t,a,o,c,u);let p=t.dom.ownerDocument,O=t.root.elementFromPoint?t.root:p,g=O.elementFromPoint(c,u);g&&!t.contentDOM.contains(g)&&(g=null),g||(c=Math.max(a.left+1,Math.min(a.right-1,c)),g=O.elementFromPoint(c,u),g&&!t.contentDOM.contains(g)&&(g=null));let m,b=-1;if(g&&0!=(null===(s=t.docView.nearest(g))||void 0===s?void 0:s.isEditable))if(p.caretPositionFromPoint){let t=p.caretPositionFromPoint(c,u);t&&({offsetNode:m,offset:b}=t)}else if(p.caretRangeFromPoint){let e=p.caretRangeFromPoint(c,u);e&&(({startContainer:m,startOffset:b}=e),(!t.contentDOM.contains(m)||De.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 me(t,n-1,n).getBoundingClientRect().left>i}(m,b,c)||De.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}let n=1==t.nodeType?t.getBoundingClientRect():me(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return i-n.left>5}(m,b,c))&&(m=void 0))}if(!m||!t.docView.dom.contains(m)){let e=hi.find(t.docView,f);if(!e)return d>o.top+o.height/2?o.to:o.from;({node:m,offset:b}=On(e.dom,c,u))}let w=t.docView.nearest(m);if(!w)return null;if(w.isWidget&&1==(null===(r=w.dom)||void 0===r?void 0:r.nodeType)){let t=w.dom.getBoundingClientRect();return e.y1.5*t.defaultLineHeight){r+=Math.floor((s-i.top)/t.defaultLineHeight)*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=f(t,n)}return!0===n?-1:t.length}(o,r,t.state.tabSize)}function wn(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=t.bidiSpans(s),o=t.textDirectionAt(s.from);for(let a=e,l=null;;){let e=Ji(s,r,o,a,i),h=Hi;if(!e){if(s.number==(i?t.state.doc.lines:1))return a;h="\n",s=t.state.doc.line(s.number+(i?1:-1)),r=t.bidiSpans(s),e=A.cursor(i?s.from:s.to)}if(l){if(!l(h))return a}else{if(!n)return e;l=n(h)}a=e}}function vn(t,e,i,n){let s=t.state.facet(Ri).map((e=>e(t)));for(;;){let t=!1;for(let r of s)r.between(i.from-1,i.from+1,((s,r,o)=>{i.from>s&&i.fromi.from?A.cursor(s,1):A.cursor(r,-1),t=!0,o.widget.skipPosition&&(i=o.widget.skipPosition(i,e,n)))}));if(!t)return i}}class yn{constructor(t){this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null;let e=(e,i)=>{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 Cn){let n=Cn[i];t.contentDOM.addEventListener(i,(i=>{Pn(t,i)&&e(n,i)}),_n[i]),this.registeredEvents.push(i)}t.scrollDOM.addEventListener("mousedown",(i=>{if(i.target==t.scrollDOM&&i.clientY>t.contentDOM.getBoundingClientRect().bottom&&(e(Cn.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)}})),De.chrome&&102==De.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,De.safari&&t.contentDOM.addEventListener("input",(()=>null))}setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}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=>{Pn(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){Qi(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){Qi(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||xn.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,be(t.contentDOM,e.key,e.keyCode))}ignoreDuringComposition(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(De.safari&&!De.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 Sn=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],xn="dthko",kn=[16,17,18,20,91,92,224,225];function Qn(t){return.7*Math.max(0,t)+8}class $n{constructor(t,e,i,n){this.view=t,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);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(xt.allowMultipleSelections)&&function(t,e){let i=t.state.facet(pi);return i.length?i[0](e):(De.mac,e.altKey)}(t,e),this.dragMove=function(t,e){let i=t.state.facet(Oi);return i.length?i[0](e):De.mac?!e.altKey:!e.ctrlKey}(t,e),this.dragging=!(!function(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let n=ie(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!=Yn(e))&&null}start(t){!1===this.dragging&&(t.preventDefault(),this.select(t))}move(t){var e;if(0==t.buttons)return this.destroy();if(!1!==this.dragging)return;this.select(this.lastEvent=t);let i=0,n=0,s=(null===(e=this.scrollParent)||void 0===e?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight};t.clientX<=s.left+6?i=-Qn(s.left-t.clientX):t.clientX>=s.right-6&&(i=Qn(t.clientX-s.right)),t.clientY<=s.top+6?n=-Qn(s.top-t.clientY):t.clientY>=s.bottom-6&&(n=Qn(t.clientY-s.bottom)),this.setScrollSpeed(i,n)}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)}select(t){let e=this.style.get(t,this.extend,this.multiple);!this.mustSelect&&e.eq(this.view.state.selection)&&e.main.assoc==this.view.state.selection.main.assoc||this.view.dispatch({selection:e,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.docChanged&&this.dragging&&(this.dragging=this.dragging.map(t.changes)),this.style.update(t)&&setTimeout((()=>this.select(this.lastEvent)),20)}}function Pn(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=Se.get(n))&&i.ignoreEvent(e))return!1;return!0}const Cn=Object.create(null),_n=Object.create(null),Xn=De.ie&&De.ie_version<15||De.ios&&De.webkit_version<604;function Zn(t,e){let i,{state:n}=t,s=1,r=n.toText(e),o=r.lines==n.selection.ranges.length;if(null!=Ln&&n.selection.ranges.every((t=>t.empty))&&Ln==r.toString()){let t=-1;i=n.changeByRange((i=>{let a=n.doc.lineAt(i.from);if(a.from==t)return{range:i};t=a.from;let l=n.toText((o?r.line(s++).text:e)+n.lineBreak);return{changes:{from:a.from,insert:l},range:A.cursor(i.from+l.length)}}))}else i=o?n.changeByRange((t=>{let e=r.line(s++);return{changes:{from:t.from,to:t.to,insert:e.text},range:A.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 A.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 A.cursor(e);0==r?i=1:r==s.length&&(i=-1);let o=r,a=r;i<0?o=f(s.text,r,!1):a=f(s.text,r);let l=n(s.text.slice(o,a));for(;o>0;){let t=f(s.text,o,!1);if(n(s.text.slice(t,o))!=l)break;o=t}for(;a{t.inputState.setSelectionOrigin("select"),27==e.keyCode&&(t.inputState.lastEscPress=Date.now())},Cn.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},Cn.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},_n.touchstart=_n.touchmove={passive:!0},Cn.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return;let i=null;for(let n of t.state.facet(gi))if(i=n(t,e),i)break;if(i||0!=e.button||(i=function(t,e){let i=Vn(t,e),n=Yn(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 a,l=Vn(t,e),h=An(t,l.pos,l.bias,n);if(i.pos!=l.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&&(a=function(t,e){for(let i=0;i=e)return A.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,l.pos))?a:o?s.addRange(h):A.create([h])}}}(t,e)),i){let n=t.root.activeElement!=t.contentDOM;t.inputState.startMouseSelection(new $n(t,e,i,n)),n&&t.observer.ignore((()=>ge(t.contentDOM))),t.inputState.mouseSelection&&t.inputState.mouseSelection.start(e)}};let Tn=(t,e)=>t>=e.top&&t<=e.bottom,Rn=(t,e,i)=>Tn(e,i)&&t>=i.left&&t<=i.right;function En(t,e,i,n){let s=hi.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&&Rn(i,n,o))return-1;let a=s.coordsAt(r,1);return a&&Rn(i,n,a)?1:o&&Tn(n,o)?-1:1}function Vn(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:En(t,i,e.clientX,e.clientY)}}const Mn=De.ie&&De.ie_version<=11;let Dn=null,Wn=0,Un=0;function Yn(t){if(!Mn)return t.detail;let e=Dn,i=Un;return Dn=t,Un=Date.now(),Wn=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Wn+1)%3:1}function qn(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&&r.dragMove?{from:r.dragging.from,to:r.dragging.to}:null,a={from:s,insert:i},l=t.state.changes(o?[o,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(s,-1),head:l.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"})}Cn.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")},Cn.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&&qn(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 qn(t,e,e.dataTransfer.getData("Text"),!0)},Cn.paste=(t,e)=>{if(t.state.readOnly)return e.preventDefault();t.observer.flush();let i=Xn?null:e.clipboardData;i?(Zn(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(),Zn(t,i.value)}),50)}(t)};let Ln=null;Cn.copy=Cn.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;Ln=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 zn=lt.define();function In(t,e){let i=[];for(let n of t.facet(vi)){let s=n(t,e);s&&i.push(s)}return i?t.update({effects:i,annotations:zn.of(!0)}):null}function Bn(t){setTimeout((()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=In(t.state,e);i?t.dispatch(i):t.update([])}}),10)}Cn.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),Bn(t)},Cn.blur=t=>{t.observer.clearSelectionRange(),Bn(t)},Cn.compositionstart=Cn.compositionupdate=t=>{null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},Cn.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,De.chrome&&De.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then((()=>t.observer.flush())):setTimeout((()=>{t.inputState.composing<0&&t.docView.compositionDeco.size&&t.update([])}),50)},Cn.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},Cn.beforeinput=(t,e)=>{var i;let n;if(De.chrome&&De.android&&(n=Sn.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 jn=["pre-wrap","normal","pre-line","break-spaces"];class Nn{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){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return jn.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i-1,a=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,a){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)>Jn&&(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:a,toA:l,fromB:h,toB:c}=n[o],u=s.lineAt(a,Hn.ByPosNoHeight,i.setDoc(e),0,0),d=u.to>=l?u:s.lineAt(l,Hn.ByPosNoHeight,i,0,0);for(c+=d.to-l,l=d.to;o>0&&u.from<=n[o-1].toA;)a=n[o-1].fromA,h=n[o-1].fromB,o--,a2*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 es extends ts{constructor(t,e){super(t,e,ii.Text),this.collapsed=0,this.widgetHeight=0}replace(t,e,i){let n=i[0];return 1==i.length&&(n instanceof es||n instanceof is&&4&n.flags)&&Math.abs(this.length-n.length)<10?(n instanceof is?n=new es(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.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class is 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:a}=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),l=o+r.length*a,h=Math.max(i,t-l/2);return new Fn(r.from,r.length,h,l,ii.Text)}{let n=Math.max(0,Math.min(r-s,Math.floor((t-i)/o))),{from:a,length:l}=e.doc.line(s+n);return new Fn(a,l,i+o*n,o,ii.Text)}}lineAt(t,e,i,n,s){if(e==Hn.ByHeight)return this.blockAt(t,i,n,s);if(e==Hn.ByPosNoHeight){let{from:e,to:n}=i.doc.lineAt(t);return new Fn(e,n-e,0,0,ii.Text)}let{firstLine:r,perLine:o,perChar:a}=this.heightMetrics(i,s),l=i.doc.lineAt(t),h=o+l.length*a,c=l.number-r,u=n+o*c+a*(l.from-s-c);return new Fn(l.from,l.length,Math.max(n,Math.min(u,n+this.height-h)),h,ii.Text)}forEachLine(t,e,i,n,s,r){t=Math.max(t,s),e=Math.min(e,s+this.length);let{firstLine:o,perLine:a,perChar:l}=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+=a*i+l*(t-s-i)}let n=a+l*e.length;r(new Fn(e.from,e.length,c,n,ii.Text)),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 is?i[i.length-1]=new is(t.length+n):i.push(null,new is(n-1))}if(t>0){let e=i[0];e instanceof is?i[0]=new is(t+e.length):i.unshift(new is(t-1),null)}return Kn.of(i)}decomposeLeft(t,e){e.push(new is(t-1),null)}decomposeRight(t,e){e.push(null,new is(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 is(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)>=Jn&&(o=-2);let a=new es(e,s);a.outdated=!1,i.push(a),r+=e+1}r<=s&&i.push(null,new is(s-r).updateHeight(t,r));let a=Kn.of(i);return(o<0||Math.abs(a.height-this.height)>=Jn||Math.abs(o-this.heightMetrics(t,e).perLine)>=Jn)&&(t.heightChanged=!0),a}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class ns 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 l;let h=e==Hn.ByPosNoHeight?Hn.ByPosNoHeight:Hn.ByPos;return a?l.join(this.right.lineAt(o,h,i,r,o)):this.left.lineAt(o,h,i,n,s).join(l)}forEachLine(t,e,i,n,s,r){let o=n+this.left.height,a=s+this.left.length+this.break;if(this.break)t=a&&this.right.forEachLine(t,e,i,o,a,r);else{let l=this.lineAt(a,Hn.ByPos,i,n,s);t=t&&l.from<=e&&r(l),e>l.to&&this.right.forEachLine(l.to+1,e,i,o,a,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&&ss(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,a=null;return n&&n.from<=e+s.length&&n.more?a=s=s.updateHeight(t,e,i,n):s.updateHeight(t,e,i),n&&n.from<=o+r.length&&n.more?a=r=r.updateHeight(t,o,i,n):r.updateHeight(t,o,i),a?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 ss(t,e){let i,n;null==t[e]&&(i=t[e-1])instanceof is&&(n=t[e+1])instanceof is&&t.splice(e-1,3,new is(i.length+1+n.length))}class rs{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 es?i.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new es(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)}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 es(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let i=new is(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 es)return t;let e=new es(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine(),t.type!=ii.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,t.type!=ii.WidgetBefore&&(this.covering=t)}addLineDeco(t,e){let i=this.ensureLine();i.length+=e,i.collapsed+=e,i.widgetHeight=Math.max(i.widgetHeight,t),this.writtenTo=this.pos=this.pos+e}finish(t){let e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof es||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),a=Math.max(a,n.top),l=e==t.parentNode?n.bottom:Math.min(l,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:a-(i.top+e),bottom:Math.max(a,l)-(i.top+e)}}function ls(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class hs{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 Nn(i),this.stateDeco=e.facet(Ti).filter((t=>"function"!=typeof t)),this.heightMap=Kn.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle.setDoc(e.doc),[new Mi(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ni.set(this.lineGaps.map((t=>t.draw(!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 ds(e,i))}}this.viewports=t.sort(((t,e)=>t.from-e.from)),this.scaler=this.heightMap.height<=7e6?gs:new ms(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:bs(t,this.scaler))}))}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=this.state.facet(Ti).filter((t=>"function"!=typeof t));let n=t.changedRanges,s=Mi.extendWithRanges(n,function(t,e,i){let n=new os;return _t.compare(t,e,i,n,0),n.changes}(i,this.stateDeco,t?t.changes:k.empty(this.state.doc.length))),r=this.heightMap.height;this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),s),this.heightMap.height!=r&&(t.flags|=2);let o=s.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.heado.to)||!this.viewportIsAppropriate(o))&&(o=this.getViewport(0,e));let a=!t.changes.empty||2&t.flags||o.from!=this.viewport.from||o.to!=this.viewport.to;this.viewport=o,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(Si)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let i=e.contentDOM,n=window.getComputedStyle(i),s=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Wi.RTL:Wi.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),a=i.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let h=0,c=0,u=parseInt(n.paddingTop)||0,d=parseInt(n.paddingBottom)||0;this.paddingTop==u&&this.paddingBottom==d||(this.paddingTop=u,this.paddingBottom=d,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let f=(this.printing?ls:as)(i,this.paddingTop),p=f.top-this.pixelViewport.top,O=f.bottom-this.pixelViewport.bottom;this.pixelViewport=f;let g=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(g!=this.inView&&(this.inView=g,g&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let m=a.width;if(this.contentDOMWidth==m&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,h|=8),l){let i=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(i)&&(o=!0),o||s.lineWrapping&&Math.abs(m-this.contentDOMWidth)>s.charWidth){let{lineHeight:t,charWidth:n,textHeight:a}=e.docView.measureTextSize();o=t>0&&s.refresh(r,t,n,a,m/n,i),o&&(e.docView.minWidth=0,h|=8)}p>0&&O>0?c=Math.max(p,O):p<0&&O<0&&(c=Math.min(p,O)),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 Mi(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new Gn(n.from,r))}s.heightChanged&&(h|=2)}let b=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return b&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(2&h||b)&&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,a=new ds(n.lineAt(r-1e3*i,Hn.ByHeight,s,0,0).from,n.lineAt(o+1e3*(1-i),Hn.ByHeight,s,0,0).to);if(e){let{head:t}=e.range;if(ta.to){let i,r=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=n.lineAt(t,Hn.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!=Wi.LTR&&!i)return[];let o=[],a=(n,r,l,h)=>{if(r-nn&&tt.from>=l.from&&t.to<=l.to&&Math.abs(t.from-n)t.frome))));if(!d){if(rt.from<=r&&t.to>=r))){let t=e.moveToLineBoundary(A.cursor(r),!1,!0).head;t>n&&(r=t)}d=new hs(n,r,this.gapSize(l,n,r,h))}o.push(d)};for(let t of this.viewportLines){if(t.lengtht.from&&a(t.from,s,t,e),ot.draw(this.heightOracle.lineWrapping)))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];_t.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))||bs(this.heightMap.lineAt(t,Hn.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return bs(this.heightMap.lineAt(this.scaler.fromDOM(t),Hn.ByHeight,this.heightOracle,0,0),this.scaler)}elementAtHeight(t){return bs(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 ds{constructor(t,e){this.from=t,this.to=e}}function fs(t,e,i){let n=[],s=t,r=0;return _t.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 Os(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 gs={toDOM:t=>t,fromDOM:t=>t,scale:1};class ms{constructor(t,e,i){let n=0,s=0,r=0;this.viewports=i.map((({from:i,to:s})=>{let r=e.lineAt(i,Hn.ByPos,t,0,0).top,o=e.lineAt(s,Hn.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=ebs(t,e))):t.type)}const ws=E.define({combine:t=>t.join(" ")}),vs=E.define({combine:t=>t.indexOf(!0)>-1}),ys=It.newName(),Ss=It.newName(),xs=It.newName(),ks={"&light":"."+Ss,"&dark":"."+xs};function Qs(t,e,i){return new It(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 $s=Qs("."+ys,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",borderRadius:"4px",marginTop:"0.5rem",width:"30%",minWidth:"190px",marginLeft:"auto",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&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:"#333338",fontSize:"70%",padding:".2em 1em",borderRadius:"4px"},"&light .cm-button":{background:"#eee"},"&dark .cm-button":{background:"#eee"},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",borderRadius:"0.25rem",border:"1px solid silver",padding:".0em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},ks);class Ps{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;i&&(e.push(new nn(i,n)),s==i&&r==n||e.push(new nn(s,r)));return e}(t),i=new tn(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?A.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||!ne(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||!ne(t.contentDOM,e.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(e.anchorNode,e.anchorOffset);this.newSel=A.single(n,i)}}}function Cs(e,i){let n,{newSel:s}=i,r=e.state.selection.main;if(i.bounds){let{from:s,to:o}=i.bounds,a=r.from,l=null;(8===e.inputState.lastKeyCode&&e.inputState.lastKeyTime>Date.now()-100||De.android&&i.text.length0&&a>0&&t.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if("end"==n){i-=o+Math.max(0,r-Math.min(o,a))-r}if(o=o?r-i:0,a=r+(a-o),o=r}else if(a=a?r-i:0,o=r+(o-a),a=r}return{from:r,toA:o,toB:a}}(e.state.doc.sliceString(s,o,Ki),i.text,a-s,l);h&&(De.chrome&&13==e.inputState.lastKeyCode&&h.toB==h.from+2&&i.text.slice(h.from,h.toB)==Ki+Ki&&h.toB--,n={from:s+h.from,to:s+h.toA,insert:t.of(i.text.slice(h.from,h.toB).split(Ki))})}else s&&(!e.hasFocus&&e.state.facet($i)||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))}:(De.mac||De.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=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}):De.chrome&&n&&n.from==n.to&&n.from==r.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(s&&(s=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}),n){let t=e.state;if(De.ios&&e.inputState.flushIOSKey(e))return!0;if(De.android&&(n.from==r.from&&n.to==r.to&&1==n.insert.length&&2==n.insert.lines&&be(e.contentDOM,"Enter",13)||n.from==r.from-1&&n.to==r.to&&0==n.insert.length&&be(e.contentDOM,"Backspace",8)||n.from==r.from&&n.to==r.to+1&&0==n.insert.length&&be(e.contentDOM,"Delete",46)))return!0;let i,o=n.insert.toString();if(e.state.facet(wi).some((t=>t(e,n.from,n.to,o))))return!0;if(e.inputState.composing>=0&&e.inputState.composing++,n.from>=r.from&&n.to<=r.to&&n.to-n.from>=(r.to-r.from)/3&&(!s||s.main.empty&&s.main.from==n.from+n.insert.length)&&e.inputState.composing<0){let s=r.fromn.to?t.sliceDoc(n.to,r.to):"";i=t.replaceSelection(e.state.toText(s+n.insert.sliceString(0,void 0,e.state.lineBreak)+o))}else{let o=t.changes(n),a=s&&s.main.to<=o.newLength?s.main:void 0;if(t.selection.ranges.length>1&&e.inputState.composing>=0&&n.to<=r.to&&n.to>=r.to-10){let s=e.state.sliceDoc(n.from,n.to),l=on(e)||e.state.doc.lineAt(r.head),h=r.to-n.to,c=r.to-r.from;i=t.changeByRange((i=>{if(i.from==r.from&&i.to==r.to)return{changes:o,range:a||i.map(o)};let u=i.to-h,d=u-s.length;if(i.to-i.from!=c||e.state.sliceDoc(d,u)!=s||l&&i.to>=l.from&&i.from<=l.to)return{range:i};let f=t.changes({from:d,to:u,insert:n.insert}),p=i.to-r.to;return{changes:f,range:a?A.range(Math.max(0,a.anchor+p),Math.max(0,a.head+p)):i.map(f)}}))}else i={changes:o,selection:a&&t.selection.replaceRange(a)}}let a="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,a+=".compose",e.inputState.compositionFirstChange&&(a+=".start",e.inputState.compositionFirstChange=!1)),e.dispatch(i,{scrollIntoView:!0,userEvent:a}),!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 _s={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Xs=De.ie&&De.ie_version<=11;class Zs{constructor(t){this.view=t,this.active=!1,this.selectionRange=new fe,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);(De.ie&&De.ie_version<=11||De.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()})),Xs&&(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")))}),{}),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($i)?i.root.activeElement!=this.dom:!se(i.dom,n))return;let s=n.anchorNode&&i.docView.nearest(n.anchorNode);s&&s.ignoreEvent(t)?e||(this.selectionChanged=!1):(De.ie&&De.ie_version<=11||De.android&&De.chrome)&&!i.state.selection.main.empty&&n.focusNode&&oe(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=De.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,a=t.docView.domAtPos(t.state.selection.main.anchor);oe(a.node,a.offset,r,o)&&([n,s,r,o]=[r,o,n,s]);return{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:o}}(this.view)||ie(t.root);if(!e||this.selectionRange.eq(e))return!1;let i=se(this.dom,e);return i&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let t=this.delayedAndroidKey;t&&(this.clearDelayedAndroidKey(),!this.flush()&&t.force&&be(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&&se(this.dom,this.selectionRange);return t<0&&!n?null:(t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new Ps(this.view,t,e,i))}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=Cs(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.dirty|=4),"childList"==t.type){let i=As(e,t.previousSibling||t.target.previousSibling,-1),n=As(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 As(t,e,i){for(;e;){let n=Se.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 Ts{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),this._dispatch=t.dispatch||(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 us(t.state||xt.create(t)),this.plugins=this.state.facet(Ci).map((t=>new Xi(t)));for(let t of this.plugins)t.update(this);this.observer=new Zs(this),this.inputState=new yn(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new sn(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),t.parent&&t.parent.appendChild(this.dom)}get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}dispatch(...t){this._dispatch(1==t.length&&t[0]instanceof dt?t[0]:this.state.update(...t))}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,a=null;t.some((t=>t.annotation(zn)))?(this.inputState.notifiedFocused=r,o=1):r!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=r,a=In(s,r),a||(o=1));let l=this.observer.delayedAndroidKey,h=null;if(l?(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(xt.phrases)!=this.state.facet(xt.phrases))return this.setState(s);e=Di.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 xi(t.empty?t:A.cursor(t.head,t.head>t.anchor?-1:1))}for(let t of e.effects)t.is(ki)&&(c=t.value)}this.viewState.update(e,c),this.bidiCache=Vs.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),i=this.docView.update(e),this.state.facet(Vi)!=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(ws)!=e.state.facet(ws)&&(this.viewState.mustMeasureContent=!0),(i||n||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!e.empty)for(let t of this.state.facet(bi))t(e);(a||h)&&Promise.resolve().then((()=>{a&&this.state==a.startState&&this.dispatch(a),h&&!Cs(this,h)&&l.force&&be(this.contentDOM,l.key,l.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 us(t),this.plugins=t.facet(Ci).map((t=>new Xi(t))),this.pluginMap.clear();for(let t of this.plugins)t.update(this);this.docView=new sn(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(Ci),i=t.state.facet(Ci);if(e!=i){let n=[];for(let s of i){let i=e.indexOf(s);if(i<0)n.push(new Xi(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.measureScheduled=0,t&&this.observer.forceFlush();let e=null,{scrollHeight:i,scrollTop:n,clientHeight:s}=this.scrollDOM,r=n>i-s-4?i:n;try{for(let t=0;;t++){this.updateState=1;let i=this.viewport,n=this.viewState.lineBlockAtHeight(r),s=this.viewState.measure(this);if(!s&&!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 o=[];4&s||([this.measureRequests,o]=[o,this.measureRequests]);let a=o.map((t=>{try{return t.read(this)}catch(t){return Qi(this.state,t),Es}})),l=Di.create(this,this.state,[]),h=!1,c=!1;l.flags|=s,e?e.flags|=s:e=l,this.updateState=2,l.empty||(this.updatePlugins(l),this.inputState.update(l),this.updateAttrs(),h=this.docView.update(l));for(let t=0;t1||t<-1)&&(this.scrollDOM.scrollTop+=t,c=!0)}if(h&&this.docView.updateSelection(!0),this.viewport.from==i.from&&this.viewport.to==i.to&&!c&&0==this.measureRequests.length)break}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let t of this.state.facet(bi))t(e)}get themeClasses(){return ys+" "+(this.state.facet(vs)?xs:Ss)+" "+this.state.facet(ws)}updateAttrs(){let t=Ms(this,Zi,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet($i)?"true":"false",class:"cm-content",style:`${De.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Ms(this,Ai,e);let i=this.observer.ignore((()=>{let i=ti(this.contentDOM,this.contentAttrs,e),n=ti(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)if(t.is(Ts.announce)){e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(Vi),It.mount(this.root,this.styleModules.concat($s).reverse())}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}}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 vn(this,t,wn(this,t,e,i))}moveByCharSelected(t,e,i){return vn(this,t,wn(this,t,e,i),!0)}moveByGroup(t,e){return vn(this,t,wn(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==wt.Space&&(s=e),s==e}}(this,t.head,e))))}moveToLineBoundary(t,e,i=!0){return function(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=n&&t.lineWrapping?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==Wi.LTR)?e.right-1:e.left+1,y:(r.top+r.bottom)/2});if(null!=o)return A.cursor(o,i?-1:1)}let o=hi.find(t.docView,e.head),a=o?i?o.posAtEnd:o.posAtStart:i?s.to:s.from;return A.cursor(a,i?-1:1)}(this,t,e,i)}moveVertically(t,e,i){return vn(this,t,function(t,e,i,n){let s=e.head,r=i?1:-1;if(s==(i?t.state.doc.length:0))return A.cursor(s,e.assoc);let o,a=e.goalColumn,l=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s),c=t.documentTop;if(h)null==a&&(a=h.left-l.left),o=r<0?h.top:h.bottom;else{let e=t.viewState.lineBlockAt(s);null==a&&(a=Math.min(l.right-l.left,t.defaultCharacterWidth*(s-e.from))),o=(r<0?e.top:e.bottom)+c}let u=l.left+a,d=null!=n?n:t.defaultLineHeight>>1;for(let i=0;;i+=10){let n=o+(d+i)*r,h=mn(t,{x:u,y:n},!1,r);if(nl.bottom||(r<0?hs))return A.cursor(h,e.assoc,void 0,a)}}(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(),mn(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 ue(i,s[Ni.find(s,t-n.from,-1,e)].dir==Wi.LTR==e>0)}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(yi)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Rs)return Fi(t.length);let e=this.textDirectionAt(t.from);for(let i of this.bidiCache)if(i.from==t.from&&i.dir==e)return i.order;let i=function(t,e){let i=t.length,n=e==Ui?1:2,s=e==Ui?2:1;if(!t||1==n&&!ji.test(t))return Fi(i);for(let e=0,s=n,o=n;e=0;t-=3)if(Bi[t+1]==-r){let e=Bi[t+2],i=2&e?n:4&e?1&e?s:n:0;i&&(Gi[a]=Gi[Bi[t]]=i),l=t;break}}else{if(189==Bi.length)break;Bi[l++]=a,Bi[l++]=e,Bi[l++]=h}else if(2==(o=Gi[a])||1==o){let t=o==n;h=t?0:1;for(let e=l-3;e>=0;e-=3){let i=Bi[e+2];if(2&i)break;if(t)Bi[e+2]|=2;else{if(4&i)break;Bi[e+2]|=4}}}for(let t=0;te;){let t=i,n=2!=Gi[--i];for(;i>e&&n==(2!=Gi[i-1]);)i--;o.push(new Ni(i,t,n?2:1))}else o.push(new Ni(e,t,0))}else for(let t=0;tDate.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{ge(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 ki.of(new xi("number"==typeof t?A.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}static domEventHandlers(t){return _i.define((()=>({})),{eventHandlers:t})}static theme(t,e){let i=It.newName(),n=[ws.of(i),Vi.of(Qs(`.${i}`,t))];return e&&e.dark&&n.push(vs.of(!0)),n}static baseTheme(t){return N.lowest(Vi.of(Qs("."+ys,t,ks)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),n=i&&Se.get(i)||Se.get(t);return(null===(e=null==n?void 0:n.rootView)||void 0===e?void 0:e.view)||null}}Ts.styleModule=Vi,Ts.inputHandler=wi,Ts.focusChangeEffect=vi,Ts.perLineTextDirection=yi,Ts.exceptionSink=mi,Ts.updateListener=bi,Ts.editable=$i,Ts.mouseSelectionStyle=gi,Ts.dragMovesSelection=Oi,Ts.clickAddsSelectionRange=pi,Ts.decorations=Ti,Ts.atomicRanges=Ri,Ts.scrollMargins=Ei,Ts.darkTheme=vs,Ts.contentAttributes=Ai,Ts.editorAttributes=Zi,Ts.lineWrapping=Ts.contentAttributes.of({class:"cm-lineWrapping"}),Ts.announce=ut.define();const Rs=4096,Es={};class Vs{constructor(t,e,i,n){this.from=t,this.to=e,this.dir=i,this.order=n}static update(t,e){if(e.empty)return t;let i=[],n=t.length?t[t.length-1].dir:Wi.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&&Je(r,i)}return i}const Ds=De.mac?"mac":De.windows?"win":De.linux?"linux":"key";function Ws(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 Us=N.default(Ts.domEventHandlers({keydown:(t,e)=>Bs(Ls(e.state),t,e,"editor")})),Ys=E.define({enables:Us}),qs=new WeakMap;function Ls(t){let e=t.facet(Ys),i=qs.get(e);return i||qs.set(e,i=function(t,e=Ds){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)=>{var a,l;let h=i[t]||(i[t]=Object.create(null)),c=n.split(/ (?!$)/).map((t=>function(t,e){const i=t.split(/-(?!$)/);let n,s,r,o,a=i[i.length-1];"Space"==a&&(a=" ");for(let t=0;t{let n=zs={view:e,prefix:i,scope:t};return setTimeout((()=>{zs==n&&(zs=null)}),Is),!0}]})}let u=c.join(" ");s(u,!1);let d=h[u]||(h[u]={preventDefault:!1,run:(null===(l=null===(a=h._any)||void 0===a?void 0:a.run)||void 0===l?void 0:l.slice())||[]});r&&d.run.push(r),o&&(d.preventDefault=!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,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.shift&&r(e,"Shift-"+s,n.shift,n.preventDefault)}return i}(e.reduce(((t,e)=>t.concat(e)),[]))),i}let zs=null;const Is=4e3;function Bs(t,e,i,n){let s=function(t){var e=!(Kt&&(t.ctrlKey||t.altKey||t.metaKey)||Jt&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?Gt:Nt)[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=v(b(s,0))==s.length&&" "!=s,o="",a=!1;zs&&zs.view==i&&zs.scope==n&&(o=zs.prefix+" ",(a=kn.indexOf(e.keyCode)<0)&&(zs=null));let l,h,c=new Set,u=t=>{if(t){for(let n of t.run)if(!c.has(n)&&(c.add(n),n(i,e)))return!0;t.preventDefault&&(a=!0)}return!1},d=t[n];if(d){if(u(d[o+Ws(s,e,!r)]))return!0;if(r&&(e.altKey||e.metaKey||e.ctrlKey)&&!(De.windows&&e.ctrlKey&&e.altKey)&&(l=Nt[e.keyCode])&&l!=s){if(u(d[o+Ws(l,e,!0)]))return!0;if(e.shiftKey&&(h=Gt[e.keyCode])!=s&&h!=l&&u(d[o+Ws(h,e,!1)]))return!0}else if(r&&e.shiftKey&&u(d[o+Ws(s,e,!0)]))return!0;if(u(d._any))return!0}return a}class js{constructor(t,e,i,n,s){this.className=t,this.left=e,this.top=i,this.width=n,this.height=s}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className==this.className&&(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",null!=this.width&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,i){if(i.empty){let n=t.coordsAtPos(i.head,i.assoc||1);if(!n)return[];let s=Ns(t);return[new js(e,n.left-s.left,n.top-s.top,null,n.bottom-n.top)]}return function(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];let n=Math.max(i.from,t.viewport.from),s=Math.min(i.to,t.viewport.to),r=t.textDirection==Wi.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=Ns(t),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),u=a.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),d=a.right-(c?parseInt(c.paddingRight):0),f=Fs(t,n),p=Fs(t,s),O=f.type==ii.Text?f:null,g=p.type==ii.Text?p:null;t.lineWrapping&&(O&&(O=Gs(t,n,O)),g&&(g=Gs(t,s,g)));if(O&&g&&O.from==g.from)return b(w(i.from,i.to,O));{let e=O?w(i.from,null,O):v(f,!1),n=g?w(null,i.to,g):v(p,!0),s=[];return(O||f).to<(g||p).from-1?s.push(m(u,e.bottom,d,n.top)):e.bottomh&&n.from=r)break;a>s&&l(Math.max(t,s),null==e&&t<=h,Math.min(a,r),null==i&&a>=c,o.dir)}if(s=n.to+1,s>=r)break}return 0==a.length&&l(h,null==e,c,null==i,t.textDirection),{top:s,bottom:o,horizontal:a}}function v(t,e){let i=a.top+(e?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]}}}(t,e,i)}}function Ns(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Wi.LTR?e.left:e.right-t.scrollDOM.clientWidth)-t.scrollDOM.scrollLeft,top:e.top-t.scrollDOM.scrollTop}}function Gs(t,e,i){let n=A.cursor(e);return{from:Math.max(i.from,t.moveToLineBoundary(n,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(n,!0,!0).from),type:ii.Text}}function Fs(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==ii.Text))return t;return i}class Hs{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),e.above&&this.dom.classList.add("cm-layer-above"),e.class&&this.dom.classList.add(e.class),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(Js)!=t.state.facet(Js)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&t.view.requestMeasure(this.measureReq)}setOrder(t){let e=0,i=t.facet(Js);for(;e{return i=t,n=this.drawn[e],!(i.constructor==n.constructor&&i.eq(n));var i,n}))){let e=this.dom.firstChild,i=0;for(let n of t)n.update&&e&&n.constructor&&this.drawn[i].constructor&&n.update(e,this.drawn[i])?(e=e.nextSibling,i++):this.dom.insertBefore(n.draw(),e);for(;e;){let t=e.nextSibling;e.remove(),e=t}this.drawn=t}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Js=E.define();function Ks(t){return[_i.define((e=>new Hs(e,t))),Js.of(t)]}const tr=!De.ios,er=E.define({combine:t=>kt(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})});function ir(t={}){return[er.of(t),sr,or,lr,Si.of(!0)]}function nr(t){return t.startState.facet(er)!=t.state.facet(er)}const sr=Ks({above:!0,markers(t){let{state:e}=t,i=e.facet(er),n=[];for(let s of e.selection.ranges){let r=s==e.selection.main;if(s.empty?!r||tr:i.drawRangeCursor){let e=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",i=s.empty?s:A.cursor(s.head,s.head>s.anchor?-1:1);for(let s of js.forRange(t,e,i))n.push(s)}}return n},update(t,e){t.transactions.some((t=>t.selection))&&(e.style.animationName="cm-blink"==e.style.animationName?"cm-blink2":"cm-blink");let i=nr(t);return i&&rr(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){rr(e.state,t)},class:"cm-cursorLayer"});function rr(t,e){e.style.animationDuration=t.facet(er).cursorBlinkRate+"ms"}const or=Ks({above:!1,markers:t=>t.state.selection.ranges.map((e=>e.empty?[]:js.forRange(t,"cm-selectionBackground",e))).reduce(((t,e)=>t.concat(e))),update:(t,e)=>t.docChanged||t.selectionSet||t.viewportChanged||nr(t),class:"cm-selectionLayer"}),ar={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};tr&&(ar[".cm-line"].caretColor="transparent !important");const lr=N.highest(Ts.theme(ar)),hr=ut.define({map:(t,e)=>null==t?null:e.mapPos(t)}),cr=q.define({create:()=>null,update:(t,e)=>(null!=t&&(t=e.changes.mapPos(t)),e.effects.reduce(((t,e)=>e.is(hr)?e.value:t),t))}),ur=_i.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let i=t.state.field(cr);null==i?null!=this.cursor&&(null===(e=this.cursor)||void 0===e||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(cr)!=i||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let t=this.view.state.field(cr),e=null!=t&&this.view.coordsAtPos(t);if(!e)return null;let i=this.view.scrollDOM.getBoundingClientRect();return{left:e.left-i.left+this.view.scrollDOM.scrollLeft,top:e.top-i.top+this.view.scrollDOM.scrollTop,height:e.bottom-e.top}}drawCursor(t){this.cursor&&(t?(this.cursor.style.left=t.left+"px",this.cursor.style.top=t.top+"px",this.cursor.style.height=t.height+"px"):this.cursor.style.left="-100000px")}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(cr)!=t&&this.view.dispatch({effects:hr.of(t)})}},{eventHandlers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){t.target!=this.view.contentDOM&&this.view.contentDOM.contains(t.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function dr(){return[cr,ur]}function fr(t,e,i,n,s){e.lastIndex=0;for(let r,o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)if(!o.lineBreak)for(;r=e.exec(o.value);)s(a+r.index,r)}class pr{constructor(t){const{regexp:e,decoration:i,decorate:n,boundary:s,maxLength:r=1e3}=t;if(!e.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=e,n)this.addMatch=(t,e,i,s)=>n(s,i,i+t[0].length,t,e);else if("function"==typeof i)this.addMatch=(t,e,n,s)=>{let r=i(t,e,n);r&&s(n,n+t[0].length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(t,e,n,s)=>s(n,n+t[0].length,i)}this.boundary=s,this.maxLength=r}createDeco(t){let e=new Xt,i=e.add.bind(e);for(let{from:e,to:n}of function(t,e){let i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;let n=[];for(let{from:s,to:r}of i)s=Math.max(t.state.doc.lineAt(s).from,s-e),r=Math.min(t.state.doc.lineAt(r).to,r+e),n.length&&n[n.length-1].to>=s?n[n.length-1].to=r:n.push({from:s,to:r});return n}(t,this.maxLength))fr(t.state.doc,this.regexp,e,n,((e,n)=>this.addMatch(n,t,e,i)));return e.finish()}updateDeco(t,e){let i=1e9,n=-1;return t.docChanged&&t.changes.iterChanges(((e,s,r,o)=>{o>t.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e}updateRange(t,e,i,n){for(let s of t.visibleRanges){let r=Math.max(s.from,i),o=Math.min(s.to,n);if(o>r){let i=t.state.doc.lineAt(r),n=i.toi.from;r--)if(this.boundary.test(i.text[r-1-i.from])){a=r;break}for(;oc.push(i.range(t,e));if(i==n)for(this.regexp.lastIndex=a-i.from;(h=this.regexp.exec(i.text))&&h.indexthis.addMatch(i,t,e,u)));e=e.update({filterFrom:a,filterTo:l,filter:(t,e)=>tl,add:c})}}return e}}const Or=null!=/x/.unicode?"gu":"g",gr=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",Or),mr={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let br=null;const wr=E.define({combine(t){let e=kt(t,{render:null,specialChars:gr,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==br&&"undefined"!=typeof document&&document.body){let e=document.body.style;br=null!=(null!==(t=e.tabSize)&&void 0!==t?t:e.MozTabSize)}return br||!1}())&&(e.specialChars=new RegExp("\t|"+e.specialChars.source,Or)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Or)),e}});function vr(t={}){return[wr.of(t),yr||(yr=_i.fromClass(class{constructor(t){this.view=t,this.decorations=ni.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(wr)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new pr({regexp:t.specialChars,decoration:(e,i,n)=>{let{doc:s}=i.state,r=b(e[0],0);if(9==r){let t=s.lineAt(n),e=i.state.tabSize,r=Yt(t.text,e,n-t.from);return ni.replace({widget:new xr((e-r%e)*this.view.defaultCharacterWidth)})}return this.decorationCache[r]||(this.decorationCache[r]=ni.replace({widget:new Sr(t,r)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(wr);t.startState.facet(wr)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))]}let yr=null;class Sr extends ei{constructor(t,e){super(),this.options=t,this.code=e}eq(t){return t.code==this.code}toDOM(t){let e=function(t){return t>=32?"•":10==t?"␤":String.fromCharCode(9216+t)}(this.code),i=t.state.phrase("Control character")+" "+(mr[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,i,e);if(n)return n;let s=document.createElement("span");return s.textContent=e,s.title=i,s.setAttribute("aria-label",i),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class xr extends ei{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent="\t",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}class kr extends ei{constructor(t){super(),this.content=t}toDOM(){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):this.content),"string"==typeof this.content?t.setAttribute("aria-label","placeholder "+this.content):t.setAttribute("aria-hidden","true"),t}ignoreEvent(){return!1}}const Qr="-10000px";class $r{constructor(t,e,i){this.facet=e,this.createTooltipView=i,this.input=t.state.facet(e),this.tooltips=this.input.filter((t=>t)),this.tooltipViews=this.tooltips.map(i)}update(t){var e;let i=t.state.facet(this.facet),n=i.filter((t=>t));if(i===this.input){for(let e of this.tooltipViews)e.update&&e.update(t);return!1}let s=[];for(let e=0;e{var e,i,n;return{position:De.ios?"absolute":(null===(e=t.find((t=>t.position)))||void 0===e?void 0:e.position)||"fixed",parent:(null===(i=t.find((t=>t.parent)))||void 0===i?void 0:i.parent)||null,tooltipSpace:(null===(n=t.find((t=>t.tooltipSpace)))||void 0===n?void 0:n.tooltipSpace)||Pr}}}),_r=new WeakMap,Xr=_i.fromClass(class{constructor(t){this.view=t,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(Cr);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new $r(t,Tr,(t=>this.createTooltip(t))),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout((()=>{this.measureTimeout=-1,this.maybeMeasure()}),50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t);e&&this.observeIntersection();let i=e||t.geometryChanged,n=t.state.facet(Cr);if(n.position!=this.position){this.position=n.position;for(let t of this.manager.tooltipViews)t.dom.style.position=this.position;i=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let t of this.manager.tooltipViews)this.container.appendChild(t.dom);i=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure()}createTooltip(t){let e=t.create(this.view);if(e.dom.classList.add("cm-tooltip"),t.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",e.dom.appendChild(t)}return e.dom.style.position=this.position,e.dom.style.top=Qr,this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var t,e;this.view.win.removeEventListener("resize",this.measureSoon);for(let e of this.manager.tooltipViews)e.dom.remove(),null===(t=e.destroy)||void 0===t||t.call(e);null===(e=this.intersectionObserver)||void 0===e||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=this.view.dom.getBoundingClientRect();return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map(((t,e)=>{let i=this.manager.tooltipViews[e];return i.getCoords?i.getCoords(t.pos):this.view.coordsAtPos(t.pos)})),size:this.manager.tooltipViews.map((({dom:t})=>t.getBoundingClientRect())),space:this.view.state.facet(Cr).tooltipSpace(this.view)}}writeMeasure(t){var e;let{editor:i,space:n}=t,s=[];for(let r=0;r=Math.min(i.bottom,n.bottom)||h.rightMath.min(i.right,n.right)+.1){l.style.top=Qr;continue}let u=o.arrow?a.dom.querySelector(".cm-tooltip-arrow"):null,d=u?7:0,f=c.right-c.left,p=null!==(e=_r.get(a))&&void 0!==e?e:c.bottom-c.top,O=a.offset||Ar,g=this.view.textDirection==Wi.LTR,m=c.width>n.right-n.left?g?n.left:n.right-c.width:g?Math.min(h.left-(u?14:0)+O.x,n.right-f):Math.max(n.left,h.left-f+(u?14:0)-O.x),b=!!o.above;!o.strictSide&&(b?h.top-(c.bottom-c.top)-O.yn.bottom)&&b==n.bottom-h.bottom>h.top-n.top&&(b=!b);let w=(b?h.top-n.top:n.bottom-h.bottom)-d;if(wm&&t.topv&&(v=b?t.top-p-2-d:t.bottom+d+2);"absolute"==this.position?(l.style.top=v-t.parent.top+"px",l.style.left=m-t.parent.left+"px"):(l.style.top=v+"px",l.style.left=m+"px"),u&&(u.style.left=h.left+(g?O.x:-O.x)-(m+14-7)+"px"),!0!==a.overlap&&s.push({left:m,top:v,right:y,bottom:v+p}),l.classList.toggle("cm-tooltip-above",b),l.classList.toggle("cm-tooltip-below",!b),a.positioned&&a.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=Qr}},{eventHandlers:{scroll(){this.maybeMeasure()}}}),Zr=Ts.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Ar={x:0,y:0},Tr=E.define({enables:[Xr,Zr]});function Rr(t,e){let i=t.plugin(Xr);if(!i)return null;let n=i.manager.tooltips.indexOf(e);return n<0?null:i.manager.tooltipViews[n]}const Er=E.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 Vr(t,e){let i=t.plugin(Mr),n=i?i.specs.indexOf(e):-1;return n>-1?i.panels[n]:null}const Mr=_i.fromClass(class{constructor(t){this.input=t.state.facet(Ur),this.specs=this.input.filter((t=>t)),this.panels=this.specs.map((e=>e(t)));let e=t.state.facet(Er);this.top=new Dr(t,!0,e.topContainer),this.bottom=new Dr(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(Er);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Dr(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Dr(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(Ur);if(i!=this.input){let e=i.filter((t=>t)),n=[],s=[],r=[],o=[];for(let i of e){let e,a=this.specs.indexOf(i);a<0?(e=i(t.view),o.push(e)):(e=this.panels[a],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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}}))});class Dr{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=Wr(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=Wr(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 Wr(t){let e=t.nextSibling;return t.remove(),e}const Ur=E.define({enables:Mr});class Yr extends Qt{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Yr.prototype.elementClass="",Yr.prototype.toDOM=void 0,Yr.prototype.mapMode=S.TrackBefore,Yr.prototype.startSide=Yr.prototype.endSide=-1,Yr.prototype.point=!0;const qr=E.define(),Lr={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>_t.empty,lineMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},zr=E.define();function Ir(t){return[jr(),zr.of(Object.assign(Object.assign({},Lr),t))]}const Br=E.define({combine:t=>t.some((t=>t))});function jr(t){let e=[Nr];return t&&!1===t.fixed&&e.push(Br.of(!0)),e}const Nr=_i.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+"px",this.gutters=t.state.facet(zr).map((e=>new Jr(t,e)));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!t.state.facet(Br),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(Br)!=!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=_t.iter(this.view.state.facet(qr),this.view.viewport.from),n=[],s=this.gutters.map((t=>new Hr(t,this.view.viewport,-this.view.documentPadding.top)));for(let t of this.view.viewportLineBlocks){let e;if(Array.isArray(t.type)){for(let i of t.type)if(i.type==ii.Text){e=i;break}}else e=t.type==ii.Text?t:void 0;if(e){n.length&&(n=[]),Fr(i,n,t.from);for(let t of s)t.line(this.view,e,n)}}for(let t of s)t.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(zr),i=t.state.facet(zr),n=t.docChanged||t.heightChanged||t.viewportChanged||!_t.eq(t.startState.facet(qr),t.state.facet(qr),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 Jr(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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&0!=i.gutters.length&&i.fixed?e.textDirection==Wi.LTR?{left:i.dom.offsetWidth}:{right:i.dom.offsetWidth}:null}))});function Gr(t){return Array.isArray(t)?t:[t]}function Fr(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class Hr{constructor(t,e,i){this.gutter=t,this.height=i,this.i=0,this.cursor=_t.iter(t.markers,e.from)}line(t,e,i){let n=[];Fr(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;if(0==n.length&&!r.config.renderEmptyElements)return;let o=e.top-this.height;if(this.i==r.elements.length){let i=new Kr(t,e.height,o,n);r.elements.push(i),r.dom.appendChild(i.dom)}else r.elements[this.i].update(t,e.height,o,n);this.height=e.bottom,this.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 Jr{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=Gr(e.markers(t)),e.initialSpacer&&(this.spacer=new Kr(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=Gr(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!_t.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 Kr{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.dom.style.height=(this.height=e)+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),function(t,e){if(t.length!=e.length)return!1;for(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 io extends Yr{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function no(t,e){return t.state.facet(eo).formatNumber(e,t.state)}const so=zr.compute([eo],(t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:t=>t.state.facet(to),lineMarker:(t,e,i)=>i.some((t=>t.toDOM))?null:new io(no(t,t.state.doc.lineAt(e.from).number)),lineMarkerChange:t=>t.startState.facet(eo)!=t.state.facet(eo),initialSpacer:t=>new io(no(t,ro(t.state.doc.lines))),updateSpacer(t,e){let i=no(e.view,ro(e.view.state.doc.lines));return i==t.number?t:new io(i)},domEventHandlers:t.facet(eo).domEventHandlers})));function ro(t){let e=9;for(;e{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=fo.match(t)),e=>{let i=t(e);return void 0===i?null:[this,i]}}}ho.closedBy=new ho({deserialize:t=>t.split(" ")}),ho.openedBy=new ho({deserialize:t=>t.split(" ")}),ho.group=new ho({deserialize:t=>t.split(" ")}),ho.contextHash=new ho({perNode:!0}),ho.lookAhead=new ho({perNode:!0}),ho.mounted=new ho({perNode:!0});class co{constructor(t,e,i){this.tree=t,this.overlay=e,this.parser=i}}const uo=Object.create(null);class fo{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):uo,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),n=new fo(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(ho.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(ho.group),n=-1;n<(i?i.length:0);n++){let s=e[n<0?t.name:i[n]];if(s)return s}}}}fo.none=new fo("",Object.create(null),0,8);class po{constructor(t){this.types=t;for(let e=0;e=n&&(r.type.isAnonymous||!1!==e(r))){if(r.firstChild())continue;t=!0}for(;t&&i&&!r.type.isAnonymous&&i(r),!r.nextSibling();){if(!r.parent())return;t=!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:To(fo.none,this.children,this.positions,0,this.children.length,0,this.length,((t,e,i)=>new bo(this.type,t,e,i,this.propValues)),t.makeTree||((t,e,i)=>new bo(fo.none,t,e,i)))}static build(t){return function(t){var e;let{buffer:i,nodeSet:n,maxBufferLength:s=oo,reused:r=[],minRepeatType:o=n.types.length}=t,a=Array.isArray(i)?new wo(i,i.length):i,l=n.types,h=0,c=0;function u(t,e,i,m,b){let{id:w,start:v,end:y,size:S}=a,x=c;for(;S<0;){if(a.next(),-1==S){let e=r[w];return i.push(e),void m.push(v-t)}if(-3==S)return void(h=w);if(-4==S)return void(c=w);throw new RangeError(`Unrecognized record size: ${S}`)}let k,Q,$=l[w],P=v-t;if(y-v<=s&&(Q=O(a.pos-e,b))){let e=new Uint16Array(Q.size-Q.skip),i=a.pos-Q.size,s=e.length;for(;a.pos>i;)s=g(Q.start,e,s);k=new vo(e,y-Q.start,n),P=Q.start-t}else{let t=a.pos-S;a.next();let e=[],i=[],n=w>=o?w:-1,r=0,l=y;for(;a.pos>t;)n>=0&&a.id==n&&a.size>=0?(a.end<=l-s&&(f(e,i,v,r,a.end,l,n,x),r=e.length,l=a.end),a.next()):u(v,t,e,i,n);if(n>=0&&r>0&&r-1&&r>0){let t=d($);k=To($,e,i,0,e.length,0,y-v,t,t)}else k=p($,e,i,y-v,x-y)}i.push(k),m.push(P)}function d(t){return(e,i,n)=>{let s,r,o=0,a=e.length-1;if(a>=0&&(s=e[a])instanceof bo){if(!a&&s.type==t&&s.length==n)return s;(r=s.prop(ho.lookAhead))&&(o=i[a]+s.length+r)}return p(t,e,i,n,o)}}function f(t,e,i,s,r,o,a,l){let h=[],c=[];for(;t.length>s;)h.push(t.pop()),c.push(e.pop()+i-r);t.push(p(n.types[a],h,c,o-r,l-o)),e.push(r-i)}function p(t,e,i,n,s=0,r){if(h){let t=[ho.contextHash,h];r=r?[t].concat(r):[t]}if(s>25){let t=[ho.lookAhead,s];r=r?[t].concat(r):[t]}return new bo(t,e,i,n,r)}function O(t,e){let i=a.fork(),n=0,r=0,l=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=l,l+=4,n+=4,i.next();continue}let a=i.pos-t;if(t<0||a=o?4:0,d=i.start;for(i.next();i.pos>a;){if(i.size<0){if(-3!=i.size)break t;u+=4}else i.id>=o&&(u+=4);i.next()}r=d,n+=t,l+=u}return(e<0||n==t)&&(c.size=n,c.start=r,c.skip=l),c.size>4?c:void 0}function g(t,e,i){let{id:n,start:s,end:r,size:l}=a;if(a.next(),l>=0&&n4){let n=a.pos-(l-4);for(;a.pos>n;)i=g(t,e,i)}e[--i]=o,e[--i]=r-t,e[--i]=s-t,e[--i]=n}else-3==l?h=n:-4==l&&(c=n);return i}let m=[],b=[];for(;a.pos>0;)u(t.start||0,t.bufferStart||0,m,b,-1);let w=null!==(e=t.length)&&void 0!==e?e:m.length?b[0]+m[0].length:0;return new bo(l[t.topID],m.reverse(),b.reverse(),w)}(t)}}bo.empty=new bo(fo.none,[],[],0);class wo{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 wo(this.buffer,this.index)}}class vo{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return fo.none}toString(){let t=[];for(let e=0;e0));a=r[a+3]);return o}slice(t,e,i){let n=this.buffer,s=new Uint16Array(e-t),r=0;for(let o=t,a=0;o=e&&ie;case 1:return i<=e&&n>e;case 2:return n>e;case 4:return!0}}function So(t,e){let i=t.childBefore(e);for(;i;){let e=i.lastChild;if(!e||e.to!=i.to)break;e.type.isError&&e.from==e.to?(t=i,i=e.prevSibling):i=e}return t}function xo(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!=l;t+=e){let l=o[t],h=a[t]+r.from;if(yo(n,i,h,h+l.length))if(l instanceof vo){if(s&mo.ExcludeBuffers)continue;let o=l.findChild(0,l.buffer.length,e,i-h,n);if(o>-1)return new Co(new Po(r,l,t,h),null,o)}else if(s&mo.IncludeAnonymous||!l.type.isAnonymous||Xo(l)){let o;if(!(s&mo.IgnoreMounts)&&l.props&&(o=l.prop(ho.mounted))&&!o.overlay)return new ko(o.tree,h,t,r);let a=new ko(l,h,t,r);return s&mo.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(e<0?l.children.length-1:0,e,i,n)}}if(s&mo.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&mo.IgnoreOverlays)&&(n=this._tree.prop(ho.mounted))&&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 ko(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}cursor(t=0){return new _o(this,t)}get tree(){return this._tree}toTree(){return this._tree}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return So(this,t)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}toString(){return this._tree.toString()}get node(){return this}matchContext(t){return $o(this,t)}}function Qo(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 $o(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 Po{constructor(t,e,i,n){this.parent=t,this.buffer=e,this.index=i,this.start=n}}class Co{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){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 Co(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&mo.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 Co(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 Co(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 Co(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}cursor(t=0){return new _o(this,t)}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 bo(this.type,t,e,this.to-this.from)}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return So(this,t)}toString(){return this.context.buffer.childString(this.index)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}get node(){return this}matchContext(t){return $o(this,t)}}class _o{get name(){return this.type.name}constructor(t,e=0){if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof ko)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let e=t._parent;e;e=e._parent)this.stack.unshift(e.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return!!t&&(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0)}yieldBuf(t,e){this.index=t;let{start:i,buffer:n}=this.buffer;return this.type=e||n.set.types[n.buffer[t]],this.from=i+n.buffer[t+1],this.to=i+n.buffer[t+2],!0}yield(t){return!!t&&(t instanceof ko?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,i){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,i,this.mode));let{buffer:n}=this.buffer,s=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.buffer.start,i);return!(s<0)&&(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,i=this.mode){return this.buffer?!(i&mo.ExcludeBuffers)&&this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&mo.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&mo.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode));let{buffer:e}=this.buffer,i=this.stack.length-1;if(t<0){let t=i<0?0:this.stack[i]+4;if(this.index!=t)return this.yieldBuf(e.findChild(t,this.index,-1,0,4))}else{let t=e.buffer[this.index+3];if(t<(i<0?e.buffer.length:e.buffer[this.stack[i]+3]))return this.yieldBuf(t)}return i<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,i,{buffer:n}=this;if(n){if(t>0){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&mo.IncludeAnonymous||t instanceof vo||!t.type.isAnonymous||Xo(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 $o(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 Xo(t){return t.children.some((t=>t instanceof vo||!t.type.isAnonymous||Xo(t)))}const Zo=new WeakMap;function Ao(t,e){if(!t.isAnonymous||e instanceof vo||e.type!=t)return 1;let i=Zo.get(e);if(null==i){i=1;for(let n of e.children){if(n.type!=t||!(n instanceof bo)){i=1;break}i+=Ao(t,n)}Zo.set(e,i)}return i}function To(t,e,i,n,s,r,o,a,l){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]+a);continue}u.push(i[s])}else{let e=n[h-1]+i[h-1].length-f;u.push(To(t,i,n,s,h,f,e,null,l))}d.push(f+a-r)}}(e,i,n,s,0),(a||l)(u,d,o)}class Ro{constructor(){this.map=new WeakMap}setBuffer(t,e,i){let n=this.map.get(t);n||this.map.set(t,n=new Map),n.set(e,i)}getBuffer(t,e){let i=this.map.get(t);return i&&i.get(e)}set(t,e){t instanceof Co?this.setBuffer(t.context.buffer,t.index,e):t instanceof ko&&this.map.set(t.tree,e)}get(t){return t instanceof Co?this.getBuffer(t.context.buffer,t.index):t instanceof ko?this.map.get(t.tree):void 0}cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}}class Eo{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 Eo(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,a=0,l=0;;o++){let h=o=i)for(;r&&r.from=e.from||c<=e.to||l){let t=Math.max(e.from,a)-l,i=Math.min(e.to,c)-l;e=t>=i?null:new Eo(t,i,e.tree,e.offset+l,o>0,!!h)}if(e&&n.push(e),r.to>c)break;r=snew lo(t.from,t.to))):[new lo(0,0)]:[new lo(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 Mo{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)}}function Do(t){return(e,i,n,s)=>new qo(e,t,i,n,s)}class Wo{constructor(t,e,i,n,s){this.parser=t,this.parse=e,this.overlay=i,this.target=n,this.ranges=s}}class Uo{constructor(t,e,i,n,s,r,o){this.parser=t,this.predicate=e,this.mounts=i,this.index=n,this.start=s,this.target=r,this.prev=o,this.depth=0,this.ranges=[]}}const Yo=new ho({perNode:!0});class qo{constructor(t,e,i,n,s){this.nest=e,this.input=i,this.fragments=n,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=t}advance(){if(this.baseParse){let t=this.baseParse.advance();if(!t)return null;if(this.baseParse=null,this.baseTree=t,this.startInner(),null!=this.stoppedAt)for(let t of this.inner)t.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let t=this.baseTree;return null!=this.stoppedAt&&(t=new bo(t.type,t.children,t.positions,t.length,t.propValues.concat([[Yo,this.stoppedAt]]))),t}let t=this.inner[this.innerDone],e=t.parse.advance();if(e){this.innerDone++;let i=Object.assign(Object.create(null),t.target.props);i[ho.mounted.id]=new co(e,t.overlay,t.parser),t.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let t=this.input.length;for(let e=this.innerDone;et.frag.from<=n.from&&t.frag.to>=n.to&&t.mount.overlay));if(t)for(let i of t.mount.overlay){let s=i.from+t.pos,r=i.to+t.pos;s>=n.from&&r<=n.to&&!e.ranges.some((t=>t.froms))&&e.ranges.push({from:s,to:r})}}a=!1}else if(i&&(r=Lo(i.ranges,n.from,n.to)))a=2!=r;else if(!n.type.isAnonymous&&n.fromnew lo(t.from-n.from,t.to-n.from))):null,n.tree,t)),s.overlay?t.length&&(i={ranges:t,depth:0,prev:i}):a=!1}}else e&&(o=e.predicate(n))&&(!0===o&&(o=new lo(n.from,n.to)),o.fromnew lo(t.from-e.start,t.to-e.start))),e.target,t)),e=e.prev}i&&! --i.depth&&(i=i.prev)}}}}function Lo(t,e,i){for(let n of t){if(n.from>=i)break;if(n.to>e)return n.from<=e&&n.to>=i?2:1}return 0}function zo(t,e,i,n,s,r){if(e=e.to);n++);let o=s.children[n],a=o.buffer;s.children[n]=function t(i,n,s,l,h){let c=i;for(;a[c+2]+r<=e.from;)c=a[c+3];let u=[],d=[];zo(o,i,c,u,d,l);let f=a[c+1],p=a[c+2],O=f+r==e.from&&p+r==e.to&&a[c]==e.type.id;return u.push(O?e.toTree():t(c+4,a[c+3],o.set.types[a[c]],f,p-f)),d.push(f-l),zo(o,a[c+3],n,u,d,l),new bo(s,u,d,h)}(0,a.length,fo.none,0,o.length);for(let n=0;n<=i;n++)t.childAfter(e.from)}class Bo{constructor(t,e){this.offset=e,this.done=!1,this.cursor=t.cursor(mo.IncludeAnonymous|mo.IgnoreMounts)}moveTo(t){let{cursor:e}=this,i=t-this.offset;for(;!this.done&&e.from=t&&e.enter(i,1,mo.IgnoreOverlays|mo.ExcludeBuffers)||e.next(!1)||(this.done=!0)}hasNode(t){if(this.moveTo(t.from),!this.done&&this.cursor.from+this.offset==t.from&&this.cursor.tree)for(let e=this.cursor.tree;;){if(e==t.tree)return!0;if(!(e.children.length&&0==e.positions[0]&&e.children[0]instanceof bo))break;e=e.children[0]}return!1}}let jo=class{constructor(t){var e;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){let i=this.curFrag=t[0];this.curTo=null!==(e=i.tree.prop(Yo))&&void 0!==e?e:i.to,this.inner=new Bo(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t)}nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=null!==(t=e.tree.prop(Yo))&&void 0!==t?t:e.to,this.inner=new Bo(e.tree,-e.offset)}}findMounts(t,e){var i;let n=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let t=this.inner.cursor.node;t;t=t.parent){let s=null===(i=t.tree)||void 0===i?void 0:i.prop(ho.mounted);if(s&&s.parser==e)for(let e=this.fragI;e=t.to)break;i.tree==this.curFrag.tree&&n.push({frag:i,pos:t.from-i.offset,mount:s})}}}return n}};function No(t,e){let i=null,n=e;for(let s=1,r=0;s=a)break;t.to<=o||(i||(n=i=e.slice()),t.froma&&i.splice(r+1,0,new lo(a,t.to))):t.to>a?i[r--]=new lo(a,t.to):i.splice(r--,1))}}return n}function Go(t,e,i,n){let s=0,r=0,o=!1,a=!1,l=-1e9,h=[];for(;;){let c=s==t.length?1e9:o?t[s].to:t[s].from,u=r==e.length?1e9:a?e[r].to:e[r].from;if(o!=a){let t=Math.max(l,i),e=Math.min(c,u,n);tnew lo(t.from+n,t.to+n))),a,l);for(let e=0,n=a;;e++){let a=e==o.length,h=a?l:o[e].from;if(h>n&&i.push(new Eo(n,h,s.tree,-t,r.from>=n||r.openStart,r.to<=h||r.openEnd)),a)break;n=o[e].to}}else i.push(new Eo(a,l,s.tree,-t,r.from>=t||r.openStart,r.to<=o||r.openEnd))}return i}let Ho=0;class Jo{constructor(t,e,i){this.set=t,this.base=e,this.modified=i,this.id=Ho++}static define(t){if(null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let e=new Jo([],null,[]);if(e.set.push(e),t)for(let i of t.set)e.set.push(i);return e}static defineModifier(){let t=new ta;return e=>e.modified.indexOf(t)>-1?e:ta.get(e.base||e,e.modified.concat(t).sort(((t,e)=>t.id-e.id)))}}let Ko=0;class ta{constructor(){this.instances=[],this.id=Ko++}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 Jo(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(ta.get(e,t));return s}}function ea(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,a=i[o];if(!a)throw new RangeError("Invalid path: "+t);let l=new na(n,s,o>0?i.slice(0,o):null);e[a]=l.sort(e[a])}}return ia.add(e)}const ia=new ho;class na{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 ra(t,e,i,n=0,s=t.length){let r=new oa(n,Array.isArray(e)?e:[e],i);r.highlightRange(t.cursor(),n,s,"",r.highlighters),r.flush(s)}na.empty=new na([],2,null);class oa{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:a}=t;if(o>=i||a<=e)return;r.isTop&&(s=this.highlighters.filter((t=>!t.scope||t.scope(r))));let l=n,h=function(t){let e=t.type.prop(ia);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}(t)||na.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&&(l&&(l+=" "),l+=c,1==h.mode&&(n+=(n?" ":"")+c)),this.startSpan(t.from,l),h.opaque)return;let u=t.tree&&t.tree.prop(ho.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 d=0,f=o;;d++){let p=d=O)&&t.nextSibling()););if(!p||O>i)break;f=p.to+o,f>e&&(this.highlightRange(r.cursor(),Math.max(e,p.from+o),Math.min(i,f),n,h),this.startSpan(f,l))}c&&t.parent()}else if(t.firstChild()){do{if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,n,s),this.startSpan(Math.min(i,t.to),l)}}while(t.nextSibling());t.parent()}}}const aa=Jo.define,la=aa(),ha=aa(),ca=aa(ha),ua=aa(ha),da=aa(),fa=aa(da),pa=aa(da),Oa=aa(),ga=aa(Oa),ma=aa(),ba=aa(),wa=aa(),va=aa(wa),ya=aa(),Sa={comment:la,lineComment:aa(la),blockComment:aa(la),docComment:aa(la),name:ha,variableName:aa(ha),typeName:ca,tagName:aa(ca),propertyName:ua,attributeName:aa(ua),className:aa(ha),labelName:aa(ha),namespace:aa(ha),macroName:aa(ha),literal:da,string:fa,docString:aa(fa),character:aa(fa),attributeValue:aa(fa),number:pa,integer:aa(pa),float:aa(pa),bool:aa(da),regexp:aa(da),escape:aa(da),color:aa(da),url:aa(da),keyword:ma,self:aa(ma),null:aa(ma),atom:aa(ma),unit:aa(ma),modifier:aa(ma),operatorKeyword:aa(ma),controlKeyword:aa(ma),definitionKeyword:aa(ma),moduleKeyword:aa(ma),operator:ba,derefOperator:aa(ba),arithmeticOperator:aa(ba),logicOperator:aa(ba),bitwiseOperator:aa(ba),compareOperator:aa(ba),updateOperator:aa(ba),definitionOperator:aa(ba),typeOperator:aa(ba),controlOperator:aa(ba),punctuation:wa,separator:aa(wa),bracket:va,angleBracket:aa(va),squareBracket:aa(va),paren:aa(va),brace:aa(va),content:Oa,heading:ga,heading1:aa(ga),heading2:aa(ga),heading3:aa(ga),heading4:aa(ga),heading5:aa(ga),heading6:aa(ga),contentSeparator:aa(Oa),list:aa(Oa),quote:aa(Oa),emphasis:aa(Oa),strong:aa(Oa),link:aa(Oa),monospace:aa(Oa),strikethrough:aa(Oa),inserted:aa(),deleted:aa(),changed:aa(),invalid:aa(),meta:ya,documentMeta:aa(ya),annotation:aa(ya),processingInstruction:aa(ya),definition:Jo.defineModifier(),constant:Jo.defineModifier(),function:Jo.defineModifier(),standard:Jo.defineModifier(),local:Jo.defineModifier(),special:Jo.defineModifier()};var xa;sa([{tag:Sa.link,class:"tok-link"},{tag:Sa.heading,class:"tok-heading"},{tag:Sa.emphasis,class:"tok-emphasis"},{tag:Sa.strong,class:"tok-strong"},{tag:Sa.keyword,class:"tok-keyword"},{tag:Sa.atom,class:"tok-atom"},{tag:Sa.bool,class:"tok-bool"},{tag:Sa.url,class:"tok-url"},{tag:Sa.labelName,class:"tok-labelName"},{tag:Sa.inserted,class:"tok-inserted"},{tag:Sa.deleted,class:"tok-deleted"},{tag:Sa.literal,class:"tok-literal"},{tag:Sa.string,class:"tok-string"},{tag:Sa.number,class:"tok-number"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],class:"tok-string2"},{tag:Sa.variableName,class:"tok-variableName"},{tag:Sa.local(Sa.variableName),class:"tok-variableName tok-local"},{tag:Sa.definition(Sa.variableName),class:"tok-variableName tok-definition"},{tag:Sa.special(Sa.variableName),class:"tok-variableName2"},{tag:Sa.definition(Sa.propertyName),class:"tok-propertyName tok-definition"},{tag:Sa.typeName,class:"tok-typeName"},{tag:Sa.namespace,class:"tok-namespace"},{tag:Sa.className,class:"tok-className"},{tag:Sa.macroName,class:"tok-macroName"},{tag:Sa.propertyName,class:"tok-propertyName"},{tag:Sa.operator,class:"tok-operator"},{tag:Sa.comment,class:"tok-comment"},{tag:Sa.meta,class:"tok-meta"},{tag:Sa.invalid,class:"tok-invalid"},{tag:Sa.punctuation,class:"tok-punctuation"}]);const ka=new ho;function Qa(t){return E.define({combine:t?e=>e.concat(t):void 0})}const $a=new ho;class Pa{constructor(t,e,i=[],n=""){this.data=t,this.name=n,xt.prototype.hasOwnProperty("tree")||Object.defineProperty(xt.prototype,"tree",{get(){return Xa(this)}}),this.parser=e,this.extension=[Wa.of(this),xt.languageData.of(((t,e,i)=>{let n=Ca(t,e,i),s=n.type.prop(ka);if(!s)return[];let r=t.facet(s),o=n.type.prop($a);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 Ca(t,e,i).type.prop(ka)==this.data}findRegions(t){let e=t.facet(Wa);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(ka)==this.data)return void i.push({from:e,to:e+t.length});let s=t.prop(ho.mounted);if(s){if(s.tree.prop(ka)==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;it.isTop?e:void 0))]}),t.name)}configure(t,e){return new _a(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Xa(t){let e=t.field(Pa.state,!1);return e?e.tree:bo.empty}class Za{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let i=this.cursorPos-this.string.length;return t=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i)}}let Aa=null;class Ta{constructor(t,e,i=[],n,s,r,o,a){this.parser=t,this.state=e,this.fragments=i,this.tree=n,this.treeLen=s,this.viewport=r,this.skipped=o,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(t,e,i){return new Ta(t,e,[],bo.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Za(this.state.doc),this.fragments)}work(t,e){return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=bo.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(Eo.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Aa;Aa=this;try{return t()}finally{Aa=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=Ra(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=Eo.applyChanges(i,e),n=bo.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=Ra(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 Vo{createParse(e,i,n){let s=n[0].from,r=n[n.length-1].to;return{parsedPos:s,advance(){let e=Aa;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 bo(fo.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 Aa}}function Ra(t,e,i){return Eo.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class Ea{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 Ea(e)}static init(t){let e=Math.min(3e3,t.doc.length),i=Ta.create(t.facet(Wa).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new Ea(i)}}Pa.state=q.define({create:Ea.init,update(t,e){for(let t of e.effects)if(t.is(Pa.setState))return t.value;return e.startState.facet(Wa)!=e.state.facet(Wa)?Ea.init(e.state):t.apply(e)}});let Va=t=>{let e=setTimeout((()=>t()),500);return()=>clearTimeout(e)};"undefined"!=typeof requestIdleCallback&&(Va=t=>{let e=-1,i=setTimeout((()=>{e=requestIdleCallback(t,{timeout:400})}),100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const Ma="undefined"!=typeof navigator&&(null===(xa=navigator.scheduling)||void 0===xa?void 0:xa.isInputPending)?()=>navigator.scheduling.isInputPending():null,Da=_i.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(Pa.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),t.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(Pa.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=Va(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEndn+1e3,a=s.context.work((()=>Ma&&Ma()||Date.now()>r),n+(o?0:1e5));this.chunkBudget-=Date.now()-e,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Pa.setState.of(new Ea(s.context))})),this.chunkBudget>0&&(!a||o)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then((()=>this.scheduleWork())).catch((t=>Qi(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()}}}),Wa=E.define({combine:t=>t.length?t[0]:null,enables:t=>[Pa.state,Da,Ts.contentAttributes.compute([t],(e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}}))]});class Ua{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}class Ya{constructor(t,e,i,n,s,r=void 0){this.name=t,this.alias=e,this.extensions=i,this.filename=n,this.loadFunc=s,this.support=r,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then((t=>this.support=t),(t=>{throw this.loading=null,t})))}static of(t){let{load:e,support:i}=t;if(!e){if(!i)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");e=()=>Promise.resolve(i)}return new Ya(t.name,(t.alias||[]).concat(t.name).map((t=>t.toLowerCase())),t.extensions||[],t.filename,e,i)}static matchFilename(t,e){for(let i of t)if(i.filename&&i.filename.test(e))return i;let i=/\.([^.]+)$/.exec(e);if(i)for(let e of t)if(e.extensions.indexOf(i[1])>-1)return e;return null}static matchLanguageName(t,e,i=!0){e=e.toLowerCase();for(let i of t)if(i.alias.some((t=>t==e)))return i;if(i)for(let i of t)for(let t of i.alias){let n=e.indexOf(t);if(n>-1&&(t.length>2||!/\w/.test(e[n-1])&&!/\w/.test(e[n+t.length])))return i}return null}}const qa=E.define(),La=E.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 za(t){let e=t.facet(La);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function Ia(t,e){let i="",n=t.tabSize,s=t.facet(La)[0];if("\t"==s){for(;e>=n;)i+="\t",e-=n;s=" "}for(let t=0;t=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 Yt(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 Na=new ho;function Ga(t){let e=t.type.prop(Na);if(e)return e;let i,n=t.firstChild;if(n&&(i=n.type.prop(ho.closedBy))){let e=t.lastChild,n=e&&i.indexOf(e.name)>-1;return t=>el(t,!0,1,void 0,n&&!function(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}(t)?e.from:void 0)}return null==t.parent?Ha:null}function Fa(t,e,i){for(;t;t=t.parent){let n=Ga(t);if(n)return n(Ja.create(i,e,t))}return null}function Ha(){return 0}class Ja extends ja{constructor(t,e,i){super(t.state,t.options),this.base=t,this.pos=e,this.node=i}static create(t,e,i){return new Ja(t,e,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){let t=this.state.doc.lineAt(this.node.from);for(;;){let e=this.node.resolve(t.from);for(;e.parent&&e.parent.from==e.from;)e=e.parent;if(Ka(e,this.node))break;t=this.state.doc.lineAt(e.from)}return this.lineIndent(t.from)}continue(){let t=this.node.parent;return t?Fa(t,this.pos,this.base):0}}function Ka(t,e){for(let i=e;i;i=i.parent)if(t==i)return!0;return!1}function tl({closing:t,align:e=!0,units:i=1}){return n=>el(n,e,i,t)}function el(t,e,i,n,s){let r=t.textAfter,o=r.match(/^\s*/)[0].length,a=n&&r.slice(o,o+n.length)==n||s==t.pos+o,l=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.from{let n=t&&t.test(i.textAfter);return i.baseIndent+(n?0:e*i.unit)}}function nl(){return xt.transactionFilter.of((t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let i=t.newDoc,{head:n}=t.newSelection.main,s=i.lineAt(n);if(n>s.from+200)return t;let r=i.sliceString(s.from,n);if(!e.some((t=>t.test(r))))return t;let{state:o}=t,a=-1,l=[];for(let{head:t}of o.selection.ranges){let e=o.doc.lineAt(t);if(e.from==a)continue;a=e.from;let i=Ba(o,e.from);if(null==i)continue;let n=/^\s*/.exec(e.text)[0],s=Ia(o,i);n!=s&&l.push({from:e.from,to:e.from+n.length,insert:s})}return l.length?[t,{changes:l,sequential:!0}]:t}))}const sl=E.define(),rl=new ho;function ol(t){let e=t.firstChild,i=t.lastChild;return e&&e.toi)continue;if(s&&r.from=e&&n.to>i&&(s=n)}}return s}(t,e,i)}function hl(t,e){let i=e.mapPos(t.from,1),n=e.mapPos(t.to,-1);return i>=n?void 0:{from:i,to:n}}const cl=ut.define({map:hl}),ul=ut.define({map:hl}),dl=q.define({create:()=>ni.none,update(t,e){t=t.map(e.changes);for(let i of e.effects)i.is(cl)&&!pl(t,i.value.from,i.value.to)?t=t.update({add:[bl.range(i.value.from,i.value.to)]}):i.is(ul)&&(t=t.update({filter:(t,e)=>i.value.from!=t||i.value.to!=e,filterFrom:i.value.from,filterTo:i.value.to}));if(e.selection){let i=!1,{head:n}=e.selection.main;t.between(n,n,((t,e)=>{tn&&(i=!0)})),i&&(t=t.update({filterFrom:n,filterTo:n,filter:(t,e)=>e<=n||t>=n}))}return t},provide:t=>Ts.decorations.from(t),toJSON(t,e){let i=[];return t.between(0,e.doc.length,((t,e)=>{i.push(t,e)})),i},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let i=0;i{(!s||s.from>t)&&(s={from:t,to:e})})),s}function pl(t,e,i){let n=!1;return t.between(e,e,((t,s)=>{t==e&&s==i&&(n=!0)})),n}const Ol={placeholderDOM:null,placeholderText:"…"},gl=E.define({combine:t=>kt(t,Ol)});function ml(t){let e=[dl,yl];return t&&e.push(gl.of(t)),e}const bl=ni.replace({widget:new class extends ei{toDOM(t){let{state:e}=t,i=e.facet(gl),n=e=>{let i=t.lineBlockAt(t.posAtDOM(e.target)),n=fl(t.state,i.from,i.to);n&&t.dispatch({effects:ul.of(n)}),e.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(t,n);let s=document.createElement("span");return s.textContent=i.placeholderText,s.setAttribute("aria-label",e.phrase("folded code")),s.title=e.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=n,s}}}),wl={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class vl extends Yr{constructor(t,e){super(),this.config=t,this.open=e}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let e=document.createElement("span");return e.textContent=this.open?this.config.openText:this.config.closedText,e.title=t.state.phrase(this.open?"Fold line":"Unfold line"),e}}const yl=Ts.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Sl{constructor(t,e){let i;function n(t){let e=It.newName();return(i||(i=Object.create(null)))["."+e]=t,e}this.specs=t;const s="string"==typeof e.all?e.all:e.all?n(e.all):void 0,r=e.scope;this.scope=r instanceof Pa?t=>t.prop(ka)==r.data:r?t=>t==r:void 0,this.style=sa(t.map((t=>({tag:t.tag,class:t.class||n(Object.assign({},t,{tag:null}))}))),{all:s}).style,this.module=i?new It(i):null,this.themeType=e.themeType}static define(t,e){return new Sl(t,e||{})}}const xl=E.define(),kl=E.define({combine:t=>t.length?[t[0]]:null});function Ql(t){let e=t.facet(xl);return e.length?e:t.facet(kl)}function $l(t,e){let i,n=[Cl];return t instanceof Sl&&(t.module&&n.push(Ts.styleModule.of(t.module)),i=t.themeType),(null==e?void 0:e.fallback)?n.push(kl.of(t)):i?n.push(xl.computeN([Ts.darkTheme],(e=>e.facet(Ts.darkTheme)==("dark"==i)?[t]:[]))):n.push(xl.of(t)),n}class Pl{constructor(t){this.markCache=Object.create(null),this.tree=Xa(t.state),this.decorations=this.buildDeco(t,Ql(t.state))}update(t){let e=Xa(t.state),i=Ql(t.state),n=i!=Ql(t.startState);e.length{i.add(t,e,this.markCache[n]||(this.markCache[n]=ni.mark({class:n})))}),n,s);return i.finish()}}const Cl=N.high(_i.fromClass(Pl,{decorations:t=>t.decorations})),_l=Sl.define([{tag:Sa.meta,color:"#404740"},{tag:Sa.link,textDecoration:"underline"},{tag:Sa.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Sa.emphasis,fontStyle:"italic"},{tag:Sa.strong,fontWeight:"bold"},{tag:Sa.strikethrough,textDecoration:"line-through"},{tag:Sa.keyword,color:"#708"},{tag:[Sa.atom,Sa.bool,Sa.url,Sa.contentSeparator,Sa.labelName],color:"#219"},{tag:[Sa.literal,Sa.inserted],color:"#164"},{tag:[Sa.string,Sa.deleted],color:"#a11"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],color:"#e40"},{tag:Sa.definition(Sa.variableName),color:"#00f"},{tag:Sa.local(Sa.variableName),color:"#30a"},{tag:[Sa.typeName,Sa.namespace],color:"#085"},{tag:Sa.className,color:"#167"},{tag:[Sa.special(Sa.variableName),Sa.macroName],color:"#256"},{tag:Sa.definition(Sa.propertyName),color:"#00c"},{tag:Sa.comment,color:"#940"},{tag:Sa.invalid,color:"#f00"}]),Xl=Ts.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Zl=1e4,Al="()[]{}",Tl=E.define({combine:t=>kt(t,{afterCursor:!0,brackets:Al,maxScanDistance:Zl,renderMatch:Vl})}),Rl=ni.mark({class:"cm-matchingBracket"}),El=ni.mark({class:"cm-nonmatchingBracket"});function Vl(t){let e=[],i=t.matched?Rl:El;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 Ml=q.define({create:()=>ni.none,update(t,e){if(!e.docChanged&&!e.selection)return t;let i=[],n=e.state.facet(Tl);for(let t of e.state.selection.ranges){if(!t.empty)continue;let s=Ll(e.state,t.head,-1,n)||t.head>0&&Ll(e.state,t.head-1,1,n)||n.afterCursor&&(Ll(e.state,t.head,1,n)||t.headTs.decorations.from(t)}),Dl=[Ml,Xl];function Wl(t={}){return[Tl.of(t),Dl]}const Ul=new ho;function Yl(t,e,i){let n=t.prop(e<0?ho.openedBy:ho.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 ql(t){let e=t.type.prop(Ul);return e?e(t.node):t}function Ll(t,e,i,n={}){let s=n.maxScanDistance||Zl,r=n.brackets||Al,o=Xa(t),a=o.resolveInner(e,i);for(let n=a;n;n=n.parent){let s=Yl(n.type,i,r);if(s&&n.from0?e>=o.from&&eo.from&&e<=o.to))return zl(t,e,i,n,o,s,r)}}return function(t,e,i,n,s,r,o){let a=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%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 a=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(a+t,1).type!=s))if(e%2==0==i>0)u++;else{if(1==u)return{start:h,end:{from:a+t,to:a+t+1},matched:e>>1==l>>1};u--}}i>0&&(t+=r.length)}return c.done?{start:h,matched:!1}:null}(t,e,i,o,a.type,s,r)}function zl(t,e,i,n,s,r,o){let a=n.parent,l={from:s.from,to:s.to},h=0,c=null==a?void 0:a.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 jl(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 Nl=new WeakMap;class Gl extends Pa{constructor(t){let e,i=Qa(t.languageData),n={name:(s=t).name||"",token:s.token,blankLine:s.blankLine||(()=>{}),startState:s.startState||(()=>!0),copyState:s.copyState||jl,indent:s.indent||(()=>null),languageData:s.languageData||{},tokenTable:s.tokenTable||th};var s;super(i,new class extends Vo{createParse(t,i,n){return new Jl(e,t,i,n)}},[qa.of(((t,e)=>this.getIndent(t,e)))],t.name),this.topNode=function(t){let e=fo.define({id:eh.length,name:"Document",props:[ka.add((()=>t))]});return eh.push(e),e}(i),e=this,this.streamParser=n,this.stateAfter=new ho({perNode:!0}),this.tokenTable=t.tokenTable?new rh(n.tokenTable):oh}static define(t){return new Gl(t)}getIndent(t,e){let i,n=Xa(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=Nl.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],a=i+e.positions[r],l=o instanceof bo&&a=e.length)return e;s||e.type!=t.topNode||(s=!0);for(let r=e.children.length-1;r>=0;r--){let o,a=e.positions[r],l=e.children[r];if(ai&&Fl(t,n.tree,0-n.offset,i,r);if(o&&(e=Hl(t,n.tree,i+n.offset,o.pos+n.offset,!1)))return{state:o.state,tree:e}}return{state:t.streamParser.startState(n?za(n):4),tree:bo.empty}}(t,i,r,null==s?void 0:s.state);this.state=o,this.parsedPos=this.chunkStart=r+a.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 Bl(e,t?t.state.tabSize:4,t?za(t.state):2);if(r.eol())s.blankLine(this.state,r.indentUnit);else for(;!r.eol();){let t=Kl(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 th=Object.create(null),eh=[fo.none],ih=new po(eh),nh=[],sh=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"]])sh[t]=lh(th,e);class rh{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),sh)}resolve(t){return t?this.table[t]||(this.table[t]=lh(this.extra,t)):0}}const oh=new rh(th);function ah(t,e){nh.indexOf(t)>-1||(nh.push(t),console.warn(e))}function lh(t,e){let i=null;for(let n of e.split(".")){let e=t[n]||Sa[n];e?"function"==typeof e?i?i=e(i):ah(n,`Modifier ${n} used at start of tag`):i?ah(n,`Tag ${n} used as modifier`):i=e:ah(n,`Unknown highlighting tag ${n}`)}if(!i)return 0;let n=e.replace(/ /g,"_"),s=fo.define({id:eh.length,name:n,props:[ea({[n]:i})]});return eh.push(s),s.id}function hh(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 ch=hh(gh,0),uh=hh(Oh,0),dh=hh(((t,e)=>Oh(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 fh(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}const ph=50;function Oh(t,e,i=e.selection.ranges){let n=i.map((t=>fh(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,a=t.sliceDoc(n-ph,n),l=t.sliceDoc(s,s+ph),h=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(l)[0].length,u=a.length-h;if(a.slice(u-e.length,u)==e&&l.slice(c,c+i.length)==i)return{open:{pos:n-h,margin:h&&1},close:{pos:s+c,margin:c&&1}};s-n<=2*ph?r=o=t.sliceDoc(n,s):(r=t.sliceDoc(n,n+ph),o=t.sliceDoc(s-ph,s));let d=/^\s*/.exec(r)[0].length,f=/\s*$/.exec(o)[0].length,p=o.length-f-i.length;return r.slice(d,d+e.length)==e&&o.slice(p,p+i.length)==i?{open:{pos:n+d+e.length,margin:/\s/.test(r.charAt(d+e.length))?1:0},close:{pos:s-f-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>l.from)){s=l.from;let t=/^\s*/.exec(l.text)[0].length,e=t==l.length,i=l.text.slice(t,t+a.length)==a?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 mh=lt.define(),bh=lt.define(),wh=E.define(),vh=E.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)})});const yh=q.define({create:()=>Dh.empty,update(t,e){let i=e.state.facet(vh),n=e.annotation(mh);if(n){let s=e.docChanged?A.single(function(t){let e=0;return t.iterChangedRanges(((t,i)=>e=i)),e}(e.changes)):void 0,r=Ch.fromTransaction(e,s),o=n.side,a=0==o?t.undone:t.done;return a=r?_h(a,a.length,i.minDepth,r):Th(a,e.startState.selection),new Dh(0==o?n.rest:a,0==o?a:n.rest)}let s=e.annotation(bh);if("full"!=s&&"before"!=s||(t=t.isolate()),!1===e.annotation(dt.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);let r=Ch.fromTransaction(e),o=e.annotation(dt.time),a=e.annotation(dt.userEvent);return r?t=t.addChanges(r,o,a,i,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,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 Dh(t.done.map(Ch.fromJSON),t.undone.map(Ch.fromJSON))});function Sh(t={}){return[yh,vh.of(t),Ts.domEventHandlers({beforeinput(t,e){let i="historyUndo"==t.inputType?kh:"historyRedo"==t.inputType?Qh:null;return!!i&&(t.preventDefault(),i(e))}})]}function xh(t,e){return function({state:i,dispatch:n}){if(!e&&i.readOnly)return!1;let s=i.field(yh,!1);if(!s)return!1;let r=s.pop(t,i,e);return!!r&&(n(r),!0)}}const kh=xh(0,!1),Qh=xh(1,!1),$h=xh(0,!0),Ph=xh(1,!0);class Ch{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 Ch(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 Ch(t.changes&&k.fromJSON(t.changes),[],t.mapped&&x.fromJSON(t.mapped),t.startSelection&&A.fromJSON(t.startSelection),t.selectionsAfter.map(A.fromJSON))}static fromTransaction(t,e){let i=Zh;for(let e of t.startState.facet(wh)){let n=e(t);n.length&&(i=i.concat(n))}return!i.length&&t.changes.empty?null:new Ch(t.changes.invert(t.startState.doc),i,void 0,e||t.startState.selection,Zh)}static selection(t){return new Ch(void 0,Zh,void 0,void 0,t)}}function _h(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 Xh(t,e){return t.length?e.length?t.concat(e):t:e}const Zh=[],Ah=200;function Th(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-Ah));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),_h(t,t.length-1,1e9,i.setSelAfter(n)))}return[Ch.selection([e])]}function Rh(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 Eh(t,e){if(!t.length)return t;let i=t.length,n=Zh;for(;i;){let s=Vh(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?[Ch.selection(n)]:Zh}function Vh(t,e,i){let n=Xh(t.selectionsAfter.length?t.selectionsAfter.map((t=>t.map(e))):Zh,i);if(!t.changes)return Ch.selection(n);let s=t.changes.map(e),r=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(r):r;return new Ch(s,ut.mapEffects(t.effects,e),o,t.startSelection.map(r),n)}const Mh=/^(input\.type|delete)($|\.)/;class Dh{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 Dh(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||Mh.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)?_h(r,r.length-1,n.minDepth,new Ch(t.changes.compose(o.changes),Xh(t.effects,o.effects),o.mapped,o.startSelection,Zh)):_h(r,r.length,n.minDepth,t),new Dh(r,Zh,e,i)}addSelection(t,e,i,n){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Zh;return s.length>0&&e-this.prevTimet.empty!=o.ranges[e].empty)).length)?this:new Dh(Th(this.done,t),this.undone,e,i);var r,o}addMapping(t){return new Dh(Eh(this.done,t),Eh(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:mh.of({side:t,rest:Rh(n)}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let i=1==n.length?Zh:n.slice(0,n.length-1);return s.mapped&&(i=Eh(i,s.mapped)),e.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:mh.of({side:t,rest:i}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}}Dh.empty=new Dh(Zh,Zh);const Wh=[{key:"Mod-z",run:kh,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Qh,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Qh,preventDefault:!0},{key:"Mod-u",run:$h,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Ph,preventDefault:!0}];function Uh(t,e){return A.create(t.ranges.map(e),t.mainIndex)}function Yh(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function qh({state:t,dispatch:e},i){let n=Uh(t.selection,i);return!n.eq(t.selection)&&(e(Yh(t,n)),!0)}function Lh(t,e){return A.cursor(e?t.to:t.from)}function zh(t,e){return qh(t,(i=>i.empty?t.moveByChar(i,e):Lh(i,e)))}function Ih(t){return t.textDirectionAt(t.state.selection.main.head)==Wi.LTR}const Bh=t=>zh(t,!Ih(t)),jh=t=>zh(t,Ih(t));function Nh(t,e){return qh(t,(i=>i.empty?t.moveByGroup(i,e):Lh(i,e)))}function Gh(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 Fh(t,e,i){let n,s,r=Xa(t).resolveInner(e.head),o=i?ho.closedBy:ho.openedBy;for(let n=e.head;;){let e=i?r.childAfter(n):r.childBefore(n);if(!e)break;Gh(t,e,o)?r=e:n=i?e.to:e.from}return s=r.type.prop(o)&&(n=i?Ll(t,r.from,1):Ll(t,r.to,-1))&&n.matched?i?n.end.to:n.end.from:i?r.to:r.from,A.cursor(s,i?-1:1)}function Hh(t,e){return qh(t,(i=>{if(!i.empty)return Lh(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)}))}const Jh=t=>Hh(t,!1),Kh=t=>Hh(t,!0);function tc(t){let e,i=t.scrollDOM.clientHeighti.empty?t.moveVertically(i,e,n.height):Lh(i,e)));if(r.eq(s.selection))return!1;if(n.selfScroll){let e=t.coordsAtPos(s.selection.main.head),o=t.scrollDOM.getBoundingClientRect(),a=o.top+n.marginTop,l=o.bottom-n.marginBottom;e&&e.top>a&&e.bottomec(t,!1),nc=t=>ec(t,!0);function sc(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=A.cursor(n.from+i))}return s}function rc(t,e){let i=Uh(t.state.selection,(t=>{let i=e(t);return A.range(t.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)}));return!i.eq(t.state.selection)&&(t.dispatch(Yh(t.state,i)),!0)}function oc(t,e){return console.log("Select!"),rc(t,(i=>t.moveByCharSelected(i,e)))}const ac=t=>oc(t,!Ih(t)),lc=t=>oc(t,Ih(t));function hc(t,e){return rc(t,(i=>t.moveByGroup(i,e)))}function cc(t,e){return rc(t,(i=>t.moveVertically(i,e)))}const uc=t=>cc(t,!1),dc=t=>cc(t,!0);function fc(t,e){return rc(t,(i=>t.moveVertically(i,e,tc(t).height)))}const pc=t=>fc(t,!1),Oc=t=>fc(t,!0),gc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:0})),!0),mc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.doc.length})),!0),bc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:0})),!0),wc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0);function vc(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=yc(t,n,!0)),s=Math.min(s,n),r=Math.max(r,n)}else s=yc(t,s,!1),r=yc(t,r,!0);return s==r?{range:n}:{changes:{from:s,to:r},range:A.cursor(s)}}));return!s.changes.empty&&(t.dispatch(n.update(s,{scrollIntoView:!0,userEvent:i,effects:"delete.selection"==i?Ts.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function yc(t,e,i){if(t instanceof Ts)for(let n of t.state.facet(Ts.atomicRanges).map((e=>e(t))))n.between(e,e,((t,n)=>{te&&(e=i?n:t)}));return e}const Sc=(t,e)=>vc(t,(i=>{let n,s,{state:r}=t,o=r.doc.lineAt(i);if(!e&&i>o.from&&iSc(t,!1),kc=t=>Sc(t,!0),Qc=(t,e)=>vc(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 a=f(r.text,n-r.from,e)+r.from,l=r.text.slice(Math.min(n,a)-r.from,Math.max(n,a)-r.from),h=o(l);if(null!=t&&h!=t)break;" "==l&&n==i||(t=h),n=a}return n})),$c=t=>Qc(t,!1),Pc=t=>vc(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 _c(t,e,i){if(t.readOnly)return!1;let n=[],s=[];for(let e of Cc(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(A.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(A.range(t.anchor-o,t.head-o))}}return!!n.length&&(e(t.update({changes:n,scrollIntoView:!0,selection:A.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0)}function Xc(t,e,i){if(t.readOnly)return!1;let n=[];for(let e of Cc(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 Zc=Ac(!1);function Ac(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),a=!e&&s==r&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i,n=Xa(t).resolveInner(e),s=n.childBefore(e),r=n.childAfter(e);return s&&r&&s.to<=e&&r.from>=e&&(i=s.type.prop(ho.closedBy))&&i.indexOf(r.name)>-1&&t.doc.lineAt(s.to).from==t.doc.lineAt(r.from).from?{from:s.to,to:r.from}:null}(i,s);e&&(s=r=(r<=o.to?o:i.doc.lineAt(r)).to);let l=new ja(i,{simulateBreak:s,simulateDoubleBreak:!!a}),h=Ba(l,s);for(null==h&&(h=/^\s*/.exec(i.doc.lineAt(s).text)[0].length);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:A.range(r.mapPos(n.anchor,1),r.mapPos(n.head,1))}}))}const Rc=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{i.push({from:e.from,insert:t.facet(La)})})),{userEvent:"input.indent"})),!0),Ec=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{let n=/^\s*/.exec(e.text)[0];if(!n)return;let s=Yt(n,t.tabSize),r=0,o=Ia(t,Math.max(0,s-za(t)));for(;rqh(t,(e=>Fh(t.state,e,!Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,!Ih(t))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:t=>qh(t,(e=>Fh(t.state,e,Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,Ih(t))))},{key:"Alt-ArrowUp",run:({state:t,dispatch:e})=>_c(t,e,!1)},{key:"Shift-Alt-ArrowUp",run:({state:t,dispatch:e})=>Xc(t,e,!1)},{key:"Alt-ArrowDown",run:({state:t,dispatch:e})=>_c(t,e,!0)},{key:"Shift-Alt-ArrowDown",run:({state:t,dispatch:e})=>Xc(t,e,!0)},{key:"Escape",run:({state:t,dispatch:e})=>{let i=t.selection,n=null;return i.ranges.length>1?n=A.create([i.main]):i.main.empty||(n=A.create([A.cursor(i.main.head)])),!!n&&(e(Yh(t,n)),!0)}},{key:"Mod-Enter",run:Ac(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:t,dispatch:e})=>{let i=Cc(t).map((({from:e,to:i})=>A.range(e,Math.min(i+1,t.doc.length))));return e(t.update({selection:A.create(i),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:t,dispatch:e})=>{let i=Uh(t.selection,(e=>{var i;let n=Xa(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 A.range(n.to,n.from)}));return e(Yh(t,i)),!0},preventDefault:!0},{key:"Mod-[",run:Ec},{key:"Mod-]",run:Rc},{key:"Mod-Alt-\\",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new ja(t,{overrideIndentation:t=>{let e=i[t];return null==e?-1:e}}),s=Tc(t,((e,s,r)=>{let o=Ba(n,e.from);if(null==o)return;/\S/.test(e.text)||(o=0);let a=/^\s*/.exec(e.text)[0],l=Ia(t,o);(a!=l||r.from{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(Cc(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=Uh(t.selection,(e=>{let s=Ll(t,e.head,-1)||Ll(t,e.head,1)||e.head>0&&Ll(t,e.head-1,1)||e.head{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=fh(t.state,i.from);return n.line?ch(t):!!n.block&&dh(t)}},{key:"Alt-A",run:uh}].concat([{key:"ArrowLeft",run:Bh,shift:ac,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:t=>Nh(t,!Ih(t)),shift:t=>hc(t,!Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:t=>qh(t,(e=>sc(t,e,!Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,!Ih(t)))),preventDefault:!0},{key:"ArrowRight",run:jh,shift:lc,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:t=>Nh(t,Ih(t)),shift:t=>hc(t,Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:t=>qh(t,(e=>sc(t,e,Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,Ih(t)))),preventDefault:!0},{key:"ArrowUp",run:Jh,shift:uc,preventDefault:!0},{mac:"Cmd-ArrowUp",run:gc,shift:bc},{mac:"Ctrl-ArrowUp",run:ic,shift:pc},{key:"ArrowDown",run:Kh,shift:dc,preventDefault:!0},{mac:"Cmd-ArrowDown",run:mc,shift:wc},{mac:"Ctrl-ArrowDown",run:nc,shift:Oc},{key:"PageUp",run:ic,shift:pc},{key:"PageDown",run:nc,shift:Oc},{key:"Home",run:t=>qh(t,(e=>sc(t,e,!1))),shift:t=>rc(t,(e=>sc(t,e,!1))),preventDefault:!0},{key:"Mod-Home",run:gc,shift:bc},{key:"End",run:t=>qh(t,(e=>sc(t,e,!0))),shift:t=>rc(t,(e=>sc(t,e,!0))),preventDefault:!0},{key:"Mod-End",run:mc,shift:wc},{key:"Enter",run:Zc},{key:"Mod-a",run:({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:xc,shift:xc},{key:"Delete",run:kc},{key:"Mod-Backspace",mac:"Alt-Backspace",run:$c},{key:"Mod-Delete",mac:"Alt-Delete",run:t=>Qc(t,!0)},{mac:"Mod-Backspace",run:t=>vc(t,(e=>{let i=t.lineBlockAt(e).from;return e>i?i:Math.max(0,e-1)}))},{mac:"Mod-Delete",run:Pc}].concat([{key:"Ctrl-b",run:Bh,shift:ac,preventDefault:!0},{key:"Ctrl-f",run:jh,shift:lc},{key:"Ctrl-p",run:Jh,shift:uc},{key:"Ctrl-n",run:Kh,shift:dc},{key:"Ctrl-a",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).from,1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).from)))},{key:"Ctrl-e",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).to,-1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).to)))},{key:"Ctrl-d",run:kc},{key:"Ctrl-h",run:xc},{key:"Ctrl-k",run:Pc},{key:"Ctrl-Alt-h",run:$c},{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:A.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:f(n.text,i-n.from,!1)+n.from,r=i==n.to?i+1:f(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:A.cursor(r)}}));return!i.changes.empty&&(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:nc}].map((t=>({mac:t.key,run:t.run,shift:t.shift})))));function Mc(){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 Uc{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(Wc(t)):Wc,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 b(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=w(t),i=this.bufferStart+this.bufferPos;this.bufferPos+=v(t);let n=this.normalize(e);for(let t=0,s=i;;t++){let r=n.charCodeAt(t),o=this.match(r,s);if(o)return this.value=o,this;if(t==n.length-1)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=jc(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 Ic(e,t.sliceString(e,i));return zc.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=jc(this.text,i+(t==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ic.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function jc(t,e){if(e>=t.length)return e;let i,n=t.lineAt(e);for(;e=56320&&i<57344;)e++;return e}function Nc(t){let e=Mc("input",{class:"cm-textfield",name:"line"});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,a,l]=i,h=a?+a.slice(1):0,c=o?+o:s.number;if(o&&l){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)));t.dispatch({effects:Gc.of(!1),selection:A.cursor(u.from+Math.max(0,Math.min(h,u.length))),scrollIntoView:!0}),t.focus()}return{dom:Mc("form",{class:"cm-gotoLine",onkeydown:e=>{27==e.keyCode?(e.preventDefault(),t.dispatch({effects:Gc.of(!1)}),t.focus()):13==e.keyCode&&(e.preventDefault(),i())},onsubmit:t=>{t.preventDefault(),i()}},Mc("label",t.state.phrase("Go to line"),": ",e)," ",Mc("button",{class:"cm-button",type:"submit"},t.state.phrase("go")))}}"undefined"!=typeof Symbol&&(Lc.prototype[Symbol.iterator]=Bc.prototype[Symbol.iterator]=function(){return this});const Gc=ut.define(),Fc=q.define({create:()=>!0,update(t,e){for(let i of e.effects)i.is(Gc)&&(t=i.value);return t},provide:t=>Ur.from(t,(t=>t?Nc:null))}),Hc=Ts.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),Jc={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Kc=E.define({combine:t=>kt(t,Jc,{highlightWordAroundCursor:(t,e)=>t||e,minSelectionLength:Math.min,maxMatches:Math.min})});function tu(t){let e=[ru,su];return t&&e.push(Kc.of(t)),e}const eu=ni.mark({class:"cm-selectionMatch"}),iu=ni.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function nu(t,e,i,n){return!(0!=i&&t(e.sliceDoc(i-1,i))==wt.Word||n!=e.doc.length&&t(e.sliceDoc(n,n+1))==wt.Word)}const su=_i.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(Kc),{state:i}=t,n=i.selection;if(n.ranges.length>1)return ni.none;let s,r=n.main,o=null;if(r.empty){if(!e.highlightWordAroundCursor)return ni.none;let t=i.wordAt(r.head);if(!t)return ni.none;o=i.charCategorizer(r.head),s=i.sliceDoc(t.from,t.to)}else{let t=r.to-r.from;if(t200)return ni.none;if(e.wholeWords){if(s=i.sliceDoc(r.from,r.to),o=i.charCategorizer(r.head),!nu(o,i,r.from,r.to)||!function(t,e,i,n){return t(e.sliceDoc(i,i+1))==wt.Word&&t(e.sliceDoc(n-1,n))==wt.Word}(o,i,r.from,r.to))return ni.none}else if(s=i.sliceDoc(r.from,r.to).trim(),!s)return ni.none}let a=[];for(let n of t.visibleRanges){let t=new Uc(i.doc,s,n.from,n.to);for(;!t.next().done;){let{from:n,to:s}=t.value;if((!o||nu(o,i,n,s))&&(r.empty&&n<=r.from&&s>=r.to?a.push(iu.range(n,s)):(n>=r.to||s<=r.from)&&a.push(eu.range(n,s)),a.length>e.maxMatches))return ni.none}}return ni.set(a)}},{decorations:t=>t.decorations}),ru=Ts.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});const ou=E.define({combine:t=>kt(t,{top:!1,caseSensitive:!1,literal:!1,wholeWord:!1,createPanel:t=>new Eu(t),scrollToMatch:t=>Ts.scrollIntoView(t)})});class au{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,qc),!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 pu(this):new cu(this)}getCursor(t,e=0,i){let n=t.doc?t:xt.create({doc:t});return null==i&&(i=n.doc.length),this.regexp?uu(this,n,e,i):hu(this,n,e,i)}}class lu{constructor(t){this.spec=t}}function hu(t,e,i,n){return new Uc(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=hu(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 uu(t,e,i,n){return new Lc(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?(s=e.charCategorizer(e.selection.main.head),(t,e,i)=>!i[0].length||(s(du(i.input,i.index))!=wt.Word||s(fu(i.input,i.index))!=wt.Word)&&(s(fu(i.input,i.index+i[0].length))!=wt.Word||s(du(i.input,i.index+i[0].length))!=wt.Word)):void 0},i,n);var s}function du(t,e){return t.slice(f(t,e,!1),e)}function fu(t,e){return t.slice(e,f(t,e))}class pu extends lu{nextMatch(t,e,i){let n=uu(this.spec,t,i,t.doc.length).next();return n.done&&(n=uu(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=uu(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=uu(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 Ou=ut.define(),gu=ut.define(),mu=q.define({create:t=>new bu(_u(t).create(),null),update(t,e){for(let i of e.effects)i.is(Ou)?t=new bu(i.value.create(),t.panel):i.is(gu)&&(t=new bu(t.query,i.value?Cu:null));return t},provide:t=>Ur.from(t,(t=>t.panel))});class bu{constructor(t,e){this.query=t,this.panel=e}}const wu=ni.mark({class:"cm-searchMatch"}),vu=ni.mark({class:"cm-searchMatch cm-searchMatch-selected"}),yu=_i.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(mu))}update(t){let e=t.state.field(mu);(e!=t.startState.field(mu)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ni.none;let{view:i}=this,n=new Xt;for(let e=0,s=i.visibleRanges,r=s.length;es[e+1].from-500;)a=s[++e].to;t.highlight(i.state,o,a,((t,e)=>{let s=i.state.selection.ranges.some((i=>i.from==t&&i.to==e));n.add(t,e,s?vu:wu)}))}return n.finish()}},{decorations:t=>t.decorations});function Su(t){return e=>{let i=e.state.field(mu,!1);return i&&i.query.spec.valid?t(e,i):Au(e)}}const xu=Su(((t,{query:e})=>{let{to:i}=t.state.selection.main,n=e.nextMatch(t.state,i,i);if(!n)return!1;let s=A.single(n.from,n.to),r=t.state.facet(ou);return t.dispatch({selection:s,effects:[Wu(t,n),r.scrollToMatch(s.main,t)],userEvent:"select.search"}),Zu(t),!0})),ku=Su(((t,{query:e})=>{let{state:i}=t,{from:n}=i.selection.main,s=e.prevMatch(i,n,n);if(!s)return!1;let r=A.single(s.from,s.to),o=t.state.facet(ou);return t.dispatch({selection:r,effects:[Wu(t,s),o.scrollToMatch(r.main,t)],userEvent:"select.search"}),Zu(t),!0})),Qu=Su(((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!(!i||!i.length)&&(t.dispatch({selection:A.create(i.map((t=>A.range(t.from,t.to)))),userEvent:"select.search.matches"}),!0)})),$u=Su(((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,a,l=[],h=[];if(r.from==n&&r.to==s&&(a=i.toText(e.getReplacement(r)),l.push({from:r.from,to:r.to,insert:a}),r=e.nextMatch(i,r.from,r.to),h.push(Ts.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(n).number)+"."))),r){let e=0==l.length||l[0].from>=r.to?0:r.to-r.from-a.length;o=A.single(r.from-e,r.to-e),h.push(Wu(t,r)),h.push(i.facet(ou).scrollToMatch(o.main,t))}return t.dispatch({changes:l,selection:o,effects:h,userEvent:"input.replace"}),!0})),Pu=Su(((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:Ts.announce.of(n),userEvent:"input.replace.all"}),!0}));function Cu(t){return t.state.facet(ou).createPanel(t)}function _u(t,e){var i,n,s,r;let o=t.selection.main,a=o.empty||o.to>o.from+100?"":t.sliceDoc(o.from,o.to);if(e&&!a)return e;let l=t.facet(ou);return new au({search:(null!==(i=null==e?void 0:e.literal)&&void 0!==i?i:l.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:null!==(n=null==e?void 0:e.caseSensitive)&&void 0!==n?n:l.caseSensitive,literal:null!==(s=null==e?void 0:e.literal)&&void 0!==s?s:l.literal,wholeWord:null!==(r=null==e?void 0:e.wholeWord)&&void 0!==r?r:l.wholeWord})}function Xu(t){let e=Vr(t,Cu);return e&&e.dom.querySelector("[main-field]")}function Zu(t){let e=Xu(t);e&&e==t.root.activeElement&&e.select()}const Au=t=>{let e=t.state.field(mu,!1);if(e&&e.panel){let i=Xu(t);if(i&&i!=t.root.activeElement){let n=_u(t.state,e.query.spec);n.valid&&t.dispatch({effects:Ou.of(n)}),i.focus(),i.select()}}else t.dispatch({effects:[gu.of(!0),e?Ou.of(_u(t.state,e.query.spec)):ut.appendConfig.of(Yu)]});return!0},Tu=t=>{let e=t.state.field(mu,!1);if(!e||!e.panel)return!1;let i=Vr(t,Cu);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:gu.of(!1)}),!0},Ru=[{key:"Mod-f",run:Au,scope:"editor search-panel"},{key:"F3",run:xu,shift:ku,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:xu,shift:ku,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Tu,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 Uc(t.doc,t.sliceDoc(n,s));!e.next().done;){if(r.length>1e3)return!1;e.value.from==n&&(o=r.length),r.push(A.range(e.value.from,e.value.to))}return e(t.update({selection:A.create(r,o),userEvent:"select.search.matches"})),!0}},{key:"Alt-g",run:t=>{let e=Vr(t,Nc);if(!e){let i=[Gc.of(!0)];null==t.state.field(Fc,!1)&&i.push(ut.appendConfig.of([Fc,Hc])),t.dispatch({effects:i}),e=Vr(t,Nc)}return e&&e.dom.querySelector("input").focus(),!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=A.create(i.ranges.map((e=>t.wordAt(e.head)||A.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 Uc(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 Uc(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(A.range(s.from,s.to),!1),effects:Ts.scrollIntoView(s.to)})),!0)},preventDefault:!0}];class Eu{constructor(t){this.view=t;let e=this.query=t.state.field(mu).query.spec;function i(t,e,i){return Mc("button",{class:"cm-button",name:t,onclick:e,type:"button"},i)}this.commit=this.commit.bind(this),this.searchField=Mc("input",{value:e.search,placeholder:Vu(t,"Find"),"aria-label":Vu(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Mc("input",{value:e.replace,placeholder:Vu(t,"Replace"),"aria-label":Vu(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Mc("input",{type:"checkbox",name:"case",form:"",checked:e.caseSensitive,onchange:this.commit}),this.reField=Mc("input",{type:"checkbox",name:"re",form:"",checked:e.regexp,onchange:this.commit}),this.wordField=Mc("input",{type:"checkbox",name:"word",form:"",checked:e.wholeWord,onchange:this.commit}),this.dom=Mc("div",{onkeydown:t=>this.keydown(t),class:"cm-search"},[this.searchField,i("next",(()=>xu(t)),[Vu(t,"next")]),i("prev",(()=>ku(t)),[Vu(t,"previous")]),i("select",(()=>Qu(t)),[Vu(t,"all")]),...t.state.readOnly?[]:[Mc("br"),this.replaceField,i("replace",(()=>$u(t)),[Vu(t,"replace")]),i("replaceAll",(()=>Pu(t)),[Vu(t,"replace all")])],Mc("button",{name:"close",onclick:()=>Tu(t),"aria-label":Vu(t,"close"),type:"button"},["×"])])}commit(){let t=new au({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:Ou.of(t)}))}keydown(t){var e,i,n;e=this.view,i=t,n="search-panel",Bs(Ls(e.state),i,e,n)?t.preventDefault():13==t.keyCode&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?ku:xu)(this.view)):13==t.keyCode&&t.target==this.replaceField&&(t.preventDefault(),$u(this.view))}update(t){for(let e of t.transactions)for(let t of e.effects)t.is(Ou)&&!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(ou).top}}function Vu(t,e){return t.state.phrase(e)}const Mu=30,Du=/[\s\.,:;?!]/;function Wu(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-Mu),o=Math.min(s,i+Mu),a=t.state.sliceDoc(r,o);if(r!=n.from)for(let t=0;ta.length-Mu;t--)if(!Du.test(a[t-1])&&Du.test(a[t])){a=a.slice(0,t);break}return Ts.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${n.number}.`)}const Uu=Ts.baseTheme({".cm-panel.cm-search":{padding:"0.25rem 0.5rem 0.25rem 0.5rem",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"0.5rem",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"}}),Yu=[mu,N.lowest(yu),Uu];class qu{constructor(t,e,i){this.state=t,this.pos=e,this.explicit=i,this.abortListeners=[]}tokenBefore(t){let e=Xa(this.state).resolveInner(this.pos,-1);for(;e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null}matchBefore(t){let e=this.state.doc.lineAt(this.pos),i=Math.max(e.from,this.pos-250),n=e.text.slice(i-e.from,this.pos-e.from),s=n.search(ju(t,!1));return s<0?null:{from:i+s,to:this.pos,text:n.slice(s)}}get aborted(){return null==this.abortListeners}addEventListener(t,e){"abort"==t&&this.abortListeners&&this.abortListeners.push(e)}}function Lu(t){let e=Object.keys(t).join(""),i=/\w/.test(e);return i&&(e=e.replace(/\w/g,"")),`[${i?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function zu(t){let e=t.map((t=>"string"==typeof t?{label:t}:t)),[i,n]=e.every((t=>/^\w+$/.test(t.label)))?[/\w*$/,/\w+$/]:function(t){let e=Object.create(null),i=Object.create(null);for(let{label:n}of t){e[n[0]]=!0;for(let t=1;t{let s=t.matchBefore(n);return s||t.explicit?{from:s?s.from:t.pos,options:e,validFor:i}:null}}class Iu{constructor(t,e,i,n){this.completion=t,this.source=e,this.match=i,this.score=n}}function Bu(t){return t.selection.main.from}function ju(t,e){var i;let{source:n}=t,s=e&&"^"!=n[0],r="$"!=n[n.length-1];return s||r?new RegExp(`${s?"^":""}(?:${n})${r?"$":""}`,null!==(i=t.flags)&&void 0!==i?i:t.ignoreCase?"i":""):t}const Nu=lt.define();const Gu=new WeakMap;function Fu(t){if(!Array.isArray(t))return t;let e=Gu.get(t);return e||Gu.set(t,e=zu(t)),e}const Hu=ut.define(),Ju=ut.define();class Ku{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[];for(let e=0;e=48&&l<=57||l>=97&&l<=122?2:l>=65&&l<=90?1:0:(y=w(l))!=y.toLowerCase()?1:y!=y.toUpperCase()?2:0;(!n||1==S&&O||0==m&&0!=S)&&(e[c]==l||i[c]==l&&(u=!0)?r[c++]=n:r.length&&(g=!1)),m=S,n+=v(l)}return c==a&&0==r[0]&&g?this.result((u?-200:0)-100,r,t):d==a&&0==f?[-200-t.length+(p==t.length?0:-100),0,p]:o>-1?[-700-t.length,o,o+this.pattern.length]:d==a?[-900-t.length,f,p]:c==a?this.result((u?-200:0)-100-700+(g?0:-1100),r,t):2==e.length?null:this.result((n[0]?-700:0)-200-1100,n,t)}result(t,e,i){let n=[t-i.length],s=1;for(let t of e){let e=t+(this.astral?v(b(i,t)):1);s>1&&n[s-1]==t?n[s-1]=e:(n[s++]=t,n[s++]=e)}return n}}const td=E.define({combine:t=>kt(t,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:id,compareCompletions:(t,e)=>t.label.localeCompare(e.label),interactionDelay:75},{defaultKeymap:(t,e)=>t&&e,closeOnBlur:(t,e)=>t&&e,icons:(t,e)=>t&&e,tooltipClass:(t,e)=>i=>ed(t(i),e(i)),optionClass:(t,e)=>i=>ed(t(i),e(i)),addToOptions:(t,e)=>t.concat(e)})});function ed(t,e){return t?e?t+" "+e:t:e}function id(t,e,i,n,s){let r,o,a=t.textDirection==Wi.RTL,l=a,h=!1,c="top",u=e.left-s.left,d=s.right-e.right,f=n.right-n.left,p=n.bottom-n.top;if(l&&u=p||t>e.top?r=i.bottom-e.top:(c="bottom",r=e.bottom-i.top)}return{style:`${c}: ${r}px; max-width: ${o}px`,class:"cm-completionInfo-"+(h?a?"left-narrow":"right-narrow":l?"left":"right")}}function nd(t,e="option"){return i=>{let n=i.state.field(yd,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp-1?n.open.selected+r*(t?1:-1):t?0:o-1;return a<0?a="page"==e?0:o-1:a>=o&&(a="page"==e?o-1:0),i.dispatch({effects:vd.of(a)}),!0}}const sd=t=>{let e=t.state.field(yd,!1);return!(t.state.readOnly||!e||!e.open||e.open.selected<0||Date.now()-e.open.timestamp(t.selection||t.docChanged)&&!gd(t)));for(let e=0;e50&&Date.now()-n.time>1e3){for(let t of n.context.abortListeners)try{t()}catch(t){Qi(this.view.state,t)}n.context.abortListeners=null,this.running.splice(e--,1)}else n.updates.push(...t.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some((t=>1==t.state&&!this.running.some((e=>e.active.source==t.source))))?setTimeout((()=>this.startUpdate()),50):-1,0!=this.composing)for(let e of t.transactions)"input"==gd(e)?this.composing=2:2==this.composing&&e.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:t}=this.view,e=t.field(yd);for(let t of e.active)1!=t.state||this.running.some((e=>e.active.source==t.source))||this.startQuery(t)}startQuery(t){let{state:e}=this.view,i=Bu(e),n=new qu(e,i,t.explicitPos==i),s=new rd(t,n);this.running.push(s),Promise.resolve(t.source(n)).then((t=>{s.context.aborted||(s.done=t||null,this.scheduleAccept())}),(t=>{this.view.dispatch({effects:Ju.of(null)}),Qi(this.view.state,t)}))}scheduleAccept(){this.running.every((t=>void 0!==t.done))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((()=>this.accept()),50))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],i=this.view.state.facet(td);for(let n=0;nt.source==s.active.source));if(r&&1==r.state)if(null==s.done){let t=new md(s.active.source,0);for(let e of s.updates)t=t.update(e,i);1!=t.state&&e.push(t)}else this.startQuery(r)}e.length&&this.view.dispatch({effects:wd.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(yd,!1);if(e&&e.tooltip&&this.view.state.facet(td).closeOnBlur){let i=e.open&&Rr(this.view,e.open.tooltip);i&&i.dom.contains(t.relatedTarget)||this.view.dispatch({effects:Ju.of(null)})}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout((()=>this.view.dispatch({effects:Hu.of(!1)})),20),this.composing=0}}});function ad(t,e){const i=e.completion.apply||e.completion.label;let n=t.state.field(yd).active.find((t=>t.source==e.source));return n instanceof bd&&("string"==typeof i?t.dispatch(Object.assign(Object.assign({},function(t,e,i,n){let{main:s}=t.selection,r=i-s.from,o=n-s.from;return Object.assign(Object.assign({},t.changeByRange((a=>a!=s&&i!=n&&t.sliceDoc(a.from+r,a.from+o)!=t.sliceDoc(i,n)?{range:a}:{changes:{from:a.from+r,to:n==s.from?a.to:a.from+o,insert:e},range:A.cursor(a.from+r+e.length)}))),{userEvent:"input.complete"})}(t.state,i,n.from,n.to)),{annotations:Nu.of(e.completion)})):i(t,e.completion,n.from,n.to),!0)}function ld(t,e,i){if(t<=i)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let t=Math.floor(e/i);return{from:t*i,to:(t+1)*i}}let n=Math.floor((t-e)/i);return{from:t-(n+1)*i,to:t-n*i}}class hd{constructor(t,e){this.view=t,this.stateField=e,this.info=null,this.placeInfoReq={read:()=>this.measureInfo(),write:t=>this.placeInfo(t),key:this},this.space=null,this.currentClass="";let i=t.state.field(e),{options:n,selected:s}=i.open,r=t.state.facet(td);this.optionContent=function(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(t){let e=document.createElement("div");return e.classList.add("cm-completionIcon"),t.type&&e.classList.add(...t.type.split(/\s+/g).map((t=>"cm-completionIcon-"+t))),e.setAttribute("aria-hidden","true"),e},position:20}),e.push({render(t,e,i){let n=document.createElement("span");n.className="cm-completionLabel";let{label:s}=t,r=0;for(let t=1;tr&&n.appendChild(document.createTextNode(s.slice(r,e)));let a=n.appendChild(document.createElement("span"));a.appendChild(document.createTextNode(s.slice(e,o))),a.className="cm-completionMatchedText",r=o}return rt.position-e.position)).map((t=>t.render))}(r),this.optionClass=r.optionClass,this.tooltipClass=r.tooltipClass,this.range=ld(n.length,s,r.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",(e=>{for(let i,s=e.target;s&&s!=this.dom;s=s.parentNode)if("LI"==s.nodeName&&(i=/-(\d+)$/.exec(s.id))&&+i[1]{let i=t.state.field(this.stateField,!1);i&&i.tooltip&&t.state.facet(td).closeOnBlur&&e.relatedTarget!=t.contentDOM&&t.dispatch({effects:Ju.of(null)})})),this.list=this.dom.appendChild(this.createListBox(n,i.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))}mount(){this.updateSel()}update(t){var e,i,n;let s=t.state.field(this.stateField),r=t.startState.field(this.stateField);this.updateTooltipClass(t.state),s!=r&&(this.updateSel(),(null===(e=s.open)||void 0===e?void 0:e.disabled)!=(null===(i=r.open)||void 0===i?void 0:i.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!(null===(n=s.open)||void 0===n?void 0:n.disabled)))}updateTooltipClass(t){let e=this.tooltipClass(t);if(e!=this.currentClass){for(let t of this.currentClass.split(" "))t&&this.dom.classList.remove(t);for(let t of e.split(" "))t&&this.dom.classList.add(t);this.currentClass=e}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),e=t.open;if((e.selected>-1&&e.selected=this.range.to)&&(this.range=ld(e.options.length,e.selected,this.view.state.facet(td).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e.options,t.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))),this.updateSelectedOption(e.selected)){this.info&&(this.info.remove(),this.info=null);let{completion:i}=e.options[e.selected],{info:n,label:s,c:r}=i;if(!n)return;let o="string"==typeof n?document.createTextNode(n+" "):n(i);if(!o)return;if(!r){const t=document.createElement("span");t.appendChild(o),o=t;const e=document.createElement("a");e.innerText="🔎",e.href="/docFind/"+s,e.target="blank",o.appendChild(e)}if(!o)return;"then"in o?o.then((e=>{e&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(e)})).catch((t=>Qi(this.view.state,t,"completion info"))):this.addInfoPane(o)}}addInfoPane(t){let e=this.info=document.createElement("div");e.className="cm-tooltip cm-completionInfo",e.appendChild(t),this.dom.appendChild(e),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let e=null;for(let i=this.list.firstChild,n=this.range.from;i;i=i.nextSibling,n++)"LI"==i.nodeName&&i.id?n==t?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),e=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected"):n--;return e&&function(t,e){let i=t.getBoundingClientRect(),n=e.getBoundingClientRect();n.topi.bottom&&(t.scrollTop+=n.bottom-i.bottom)}(this.list,e),e}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let e=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),n=t.getBoundingClientRect(),s=this.space;if(!s){let t=this.dom.ownerDocument.defaultView||window;s={left:0,top:0,right:t.innerWidth,bottom:t.innerHeight}}return n.top>Math.min(s.bottom,e.bottom)-10||n.bottomi.from||0==i.from))if(s=t,"string"!=typeof l&&l.header)n.appendChild(l.header(l));else{n.appendChild(document.createElement("completion-section")).textContent=t}}const h=n.appendChild(document.createElement("li"));h.id=e+"-"+r,h.setAttribute("role","option");let c=this.optionClass(o);c&&(h.className=c);for(let t of this.optionContent){let e=t(o,this.view.state,a);e&&h.appendChild(e)}}return i.from&&n.classList.add("cm-completionListIncompleteTop"),i.to=this.options.length?this:new ud(this.options,pd(e,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,e,i,n,s){let r=function(t,e){let i=[],n=null,s=t=>{i.push(t);let{section:e}=t.completion;if(e){n||(n=[]);let t="string"==typeof e?e:e.name;n.some((e=>e.name==t))||n.push("string"==typeof e?{name:t}:e)}};for(let n of t)if(n.hasResult())if(!1===n.result.filter){let t=n.result.getMatch;for(let e of n.result.options){let r=[1e9-i.length];if(t)for(let i of t(e))r.push(i);s(new Iu(e,n.source,r,r[0]))}}else{let t,i=new Ku(e.sliceDoc(n.from,n.to));for(let e of n.result.options)(t=i.match(e.label))&&s(new Iu(e,n.source,t,t[0]+(e.boost||0)))}if(n){let t=Object.create(null),e=0,s=(t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:1e9)-(null!==(n=e.rank)&&void 0!==n?n:1e9)||(t.namee.score-t.score||a(t.completion,e.completion))))!o||o.label!=t.completion.label||o.detail!=t.completion.detail||null!=o.type&&null!=t.completion.type&&o.type!=t.completion.type||o.apply!=t.completion.apply?r.push(t):cd(t.completion)>cd(o)&&(r[r.length-1]=t),o=t.completion;return r}(t,e);if(!r.length)return n&&t.some((t=>1==t.state))?new ud(n.options,n.attrs,n.tooltip,n.timestamp,n.selected,!0):null;let o=e.facet(td).selectOnOpen?0:-1;if(n&&n.selected!=o&&-1!=n.selected){let t=n.options[n.selected].completion;for(let e=0;ee.hasResult()?Math.min(t,e.from):t),1e8),create:(a=yd,t=>new hd(t,a)),above:s.aboveCursor},n?n.timestamp:Date.now(),o,!1);var a}map(t){return new ud(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class dd{constructor(t,e,i){this.active=t,this.id=e,this.open=i}static start(){return new dd(Od,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(t){let{state:e}=t,i=e.facet(td),n=(i.override||e.languageDataAt("autocomplete",Bu(e)).map(Fu)).map((e=>(this.active.find((t=>t.source==e))||new md(e,this.active.some((t=>0!=t.state))?1:0)).update(t,i)));n.length==this.active.length&&n.every(((t,e)=>t==this.active[e]))&&(n=this.active);let s=this.open;s&&t.docChanged&&(s=s.map(t.changes)),t.selection||n.some((e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to)))||!function(t,e){if(t==e)return!0;for(let i=0,n=0;;){for(;i1==t.state))&&(s=null),!s&&n.every((t=>1!=t.state))&&n.some((t=>t.hasResult()))&&(n=n.map((t=>t.hasResult()?new md(t.source,0):t)));for(let e of t.effects)e.is(vd)&&(s=s&&s.setSelected(e.value,this.id));return n==this.active&&s==this.open?this:new dd(n,this.id,s)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:fd}}const fd={"aria-autocomplete":"list"};function pd(t,e){let i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(i["aria-activedescendant"]=t+"-"+e),i}const Od=[];function gd(t){return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null}class md{constructor(t,e,i=-1){this.source=t,this.state=e,this.explicitPos=i}hasResult(){return!1}update(t,e){let i=gd(t),n=this;i?n=n.handleUserEvent(t,i,e):t.docChanged?n=n.handleChange(t):t.selection&&0!=n.state&&(n=new md(n.source,0));for(let e of t.effects)if(e.is(Hu))n=new md(n.source,1,e.value?Bu(t.state):-1);else if(e.is(Ju))n=new md(n.source,0);else if(e.is(wd))for(let t of e.value)t.source==n.source&&(n=t);return n}handleUserEvent(t,e,i){return"delete"!=e&&i.activateOnTyping?new md(this.source,1):this.map(t.changes)}handleChange(t){return t.changes.touchesRange(Bu(t.startState))?new md(this.source,0):this.map(t.changes)}map(t){return t.empty||this.explicitPos<0?this:new md(this.source,this.state,t.mapPos(this.explicitPos))}}class bd extends md{constructor(t,e,i,n,s){super(t,2,e),this.result=i,this.from=n,this.to=s}hasResult(){return!0}handleUserEvent(t,e,i){var n;let s=t.changes.mapPos(this.from),r=t.changes.mapPos(this.to,1),o=Bu(t.state);if((this.explicitPos<0?o<=s:or||"delete"==e&&Bu(t.startState)==this.from)return new md(this.source,"input"==e&&i.activateOnTyping?1:0);let a,l=this.explicitPos<0?-1:t.changes.mapPos(this.explicitPos);return function(t,e,i,n){if(!t)return!1;let s=e.sliceDoc(i,n);return"function"==typeof t?t(s,i,n,e):ju(t,!0).test(s)}(this.result.validFor,t.state,s,r)?new bd(this.source,l,this.result,s,r):this.result.update&&(a=this.result.update(this.result,s,r,new qu(t.state,o,l>=0)))?new bd(this.source,l,a,a.from,null!==(n=a.to)&&void 0!==n?n:Bu(t.state)):new md(this.source,1,l)}handleChange(t){return t.changes.touchesRange(this.from,this.to)?new md(this.source,0):this.map(t.changes)}map(t){return t.empty?this:new bd(this.source,this.explicitPos<0?-1:t.mapPos(this.explicitPos),this.result,t.mapPos(this.from),t.mapPos(this.to,1))}}const wd=ut.define({map:(t,e)=>t.map((t=>t.map(e)))}),vd=ut.define(),yd=q.define({create:()=>dd.start(),update:(t,e)=>t.update(e),provide:t=>[Tr.from(t,(t=>t.tooltip)),Ts.contentAttributes.from(t,(t=>t.attrs))]}),Sd=Ts.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class xd{constructor(t,e,i,n){this.field=t,this.line=e,this.from=i,this.to=n}}class kd{constructor(t,e,i){this.field=t,this.from=e,this.to=i}map(t){let e=t.mapPos(this.from,-1,S.TrackDel),i=t.mapPos(this.to,1,S.TrackDel);return null==e||null==i?null:new kd(this.field,e,i)}}class Qd{constructor(t,e){this.lines=t,this.fieldPositions=e}instantiate(t,e){let i=[],n=[e],s=t.doc.lineAt(e),r=/^\s*/.exec(s.text)[0];for(let s of this.lines){if(i.length){let i=r,o=/^\t*/.exec(s)[0].length;for(let e=0;enew kd(t.field,n[t.line]+t.from,n[t.line]+t.to)));return{text:i,ranges:o}}static parse(t){let e,i=[],n=[],s=[];for(let r of t.split(/\r\n?|\n/)){for(;e=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(r);){let t=e[1]?+e[1]:null,o=e[2]||e[3]||"",a=-1;for(let e=0;e=a&&t.field++}s.push(new xd(a,n.length,e.index,e.index+o.length)),r=r.slice(0,e.index)+o+r.slice(e.index+e[0].length)}for(let t;t=/\\([{}])/.exec(r);){r=r.slice(0,t.index)+t[1]+r.slice(t.index+t[0].length);for(let e of s)e.line==n.length&&e.from>t.index&&(e.from--,e.to--)}n.push(r)}return new Qd(n,s)}}let $d=ni.widget({widget:new class extends ei{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),Pd=ni.mark({class:"cm-snippetField"});class Cd{constructor(t,e){this.ranges=t,this.active=e,this.deco=ni.set(t.map((t=>(t.from==t.to?$d:Pd).range(t.from,t.to))))}map(t){let e=[];for(let i of this.ranges){let n=i.map(t);if(!n)return null;e.push(n)}return new Cd(e,this.active)}selectionInsideField(t){return t.ranges.every((t=>this.ranges.some((e=>e.field==this.active&&e.from<=t.from&&e.to>=t.to))))}}const _d=ut.define({map:(t,e)=>t&&t.map(e)}),Xd=ut.define(),Zd=q.define({create:()=>null,update(t,e){for(let i of e.effects){if(i.is(_d))return i.value;if(i.is(Xd)&&t)return new Cd(t.ranges,i.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>Ts.decorations.from(t,(t=>t?t.deco:ni.none))});function Ad(t,e){return A.create(t.filter((t=>t.field==e)).map((t=>A.range(t.from,t.to))))}function Td(e){let i=Qd.parse(e);return(e,n,s,r)=>{let{text:o,ranges:a}=i.instantiate(e.state,s),l={changes:{from:s,to:r,insert:t.of(o)},scrollIntoView:!0,annotations:n?Nu.of(n):void 0};if(a.length&&(l.selection=Ad(a,0)),a.length>1){let t=new Cd(a,0),i=l.effects=[_d.of(t)];void 0===e.state.field(Zd,!1)&&i.push(ut.appendConfig.of([Zd,Md,Wd,Sd]))}e.dispatch(e.state.update(l))}}function Rd(t){return({state:e,dispatch:i})=>{let n=e.field(Zd,!1);if(!n||t<0&&0==n.active)return!1;let s=n.active+t,r=t>0&&!n.ranges.some((e=>e.field==s+t));return i(e.update({selection:Ad(n.ranges,s),effects:_d.of(r?null:new Cd(n.ranges,s))})),!0}}const Ed=[{key:"Tab",run:Rd(1),shift:Rd(-1)},{key:"Escape",run:({state:t,dispatch:e})=>!!t.field(Zd,!1)&&(e(t.update({effects:_d.of(null)})),!0)}],Vd=E.define({combine:t=>t.length?t[0]:Ed}),Md=N.highest(Ys.compute([Vd],(t=>t.facet(Vd))));function Dd(t,e){return Object.assign(Object.assign({},e),{apply:Td(t)})}const Wd=Ts.domEventHandlers({mousedown(t,e){let i,n=e.state.field(Zd,!1);if(!n||null==(i=e.posAtCoords({x:t.clientX,y:t.clientY})))return!1;let s=n.ranges.find((t=>t.from<=i&&t.to>=i));return!(!s||s.field==n.active)&&(e.dispatch({selection:Ad(n.ranges,s.field),effects:_d.of(n.ranges.some((t=>t.field>s.field))?new Cd(n.ranges,s.field):null)}),!0)}}),Ud=new class extends Qt{};function Yd(t={}){return[yd,td.of(t),od,Ld,Sd]}Ud.startSide=1,Ud.endSide=-1;const qd=[{key:"Ctrl-Space",run:t=>!!t.state.field(yd,!1)&&(t.dispatch({effects:Hu.of(!0)}),!0)},{key:"Escape",run:t=>{let e=t.state.field(yd,!1);return!(!e||!e.active.some((t=>0!=t.state)))&&(t.dispatch({effects:Ju.of(null)}),!0)}},{key:"ArrowDown",run:nd(!0)},{key:"ArrowUp",run:nd(!1)},{key:"PageDown",run:nd(!0,"page")},{key:"PageUp",run:nd(!1,"page")},{key:"Enter",run:sd}],Ld=N.highest(Ys.computeN([td],(t=>t.facet(td).defaultKeymap?[qd]:[]))),zd=(()=>[vr(),Sh(),ir(),$l(_l,{fallback:!0}),Ys.of([...Vc,...Wh])])();class Id{constructor(t,e,i,n,s,r,o,a,l,h=0,c){this.p=t,this.stack=e,this.state=i,this.reducePos=n,this.pos=s,this.score=r,this.buffer=o,this.bufferBase=a,this.curContext=l,this.lookAhead=h,this.parent=c}toString(){return`[${this.stack.filter(((t,e)=>e%3==0)).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,i=0){let n=t.parser.context;return new Id(t,[],e,i,i,0,[],0,n?new Bd(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let i=t>>19,n=65535&t,{parser:s}=this.p,r=s.dynamicPrecedence(n);if(r&&(this.score+=r),0==i)return this.pushState(s.getGoto(this.state,n,!0),this.reducePos),n=2e3&&!(null===(e=this.p.parser.nodeSet.types[n])||void 0===e?void 0:e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=l):this.p.lastBigReductionSizeo;)this.stack.pop();this.reduceContext(n,a)}storeNode(t,e,i,n=4,s=!1){if(0==t&&(!this.stack.length||this.stack[this.stack.length-1]0&&0==t.buffer[n-4]&&t.buffer[n-1]>-1){if(e==i)return;if(t.buffer[n-2]>=e)return void(t.buffer[n-2]=i)}}if(s&&this.pos!=i){let s=this.buffer.length;if(s>0&&0!=this.buffer[s-4])for(;s>0&&this.buffer[s-2]>i;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,n>4&&(n-=4);this.buffer[s]=t,this.buffer[s+1]=e,this.buffer[s+2]=i,this.buffer[s+3]=n}else this.buffer.push(t,e,i,n)}shift(t,e,i){let n=this.pos;if(131072&t)this.pushState(65535&t,this.pos);else if(0==(262144&t)){let s=t,{parser:r}=this.p;(i>this.pos||e<=r.maxNode)&&(this.pos=i,r.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,n),this.shiftContext(e,n),e<=r.maxNode&&this.buffer.push(e,n,i,4)}else this.pos=i,this.shiftContext(e,n),e<=this.p.parser.maxNode&&this.buffer.push(e,n,i,4)}apply(t,e,i){65536&t?this.reduce(t):this.shift(t,e,i)}useNode(t,e){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=t)&&(this.p.reused.push(t),i++);let n=this.pos;this.reducePos=this.pos=n+t.length,this.pushState(e,n),this.buffer.push(i,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let i=t.buffer.slice(e),n=t.bufferBase+e;for(;t&&n==t.bufferBase;)t=t.parent;return new Id(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,n,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let i=t<=this.p.parser.maxNode;i&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,i?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new Nd(this);;){let i=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(0==i)return!1;if(0==(65536&i))return!0;e.reduce(i)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let n,s=0;s1&e&&t==n))||i.push(e[t],n)}e=i}let i=[];for(let t=0;t>19,n=65535&t,s=this.stack.length-3*i;if(s<0||e.getGoto(this.stack[s],n,!1)<0)return!1;this.storeNode(0,this.reducePos,this.reducePos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:t}=this.p;return 65535==t.data[t.stateSlot(this.state,1)]&&!t.stateSlot(this.state,4)}restart(){this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;ethis.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Bd{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}var jd;!function(t){t[t.Insert=200]="Insert",t[t.Delete=190]="Delete",t[t.Reduce=100]="Reduce",t[t.MaxNext=4]="MaxNext",t[t.MaxInsertStackDepth=300]="MaxInsertStackDepth",t[t.DampenInsertStackDepth=120]="DampenInsertStackDepth",t[t.MinBigReduction=2e3]="MinBigReduction"}(jd||(jd={}));class Nd{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=65535&t,i=t>>19;0==i?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(i-1);let n=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=n}}class Gd{constructor(t,e,i){this.stack=t,this.pos=e,this.index=i,this.buffer=t.buffer,0==this.index&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new Gd(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;null!=t&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new Gd(this.stack,this.pos,this.index)}}function Fd(t,e=Uint16Array){if("string"!=typeof t)return t;let i=null;for(let n=0,s=0;n=92&&e--,e>=34&&e--;let s=e-32;if(s>=46&&(s-=46,i=!0),r+=s,i)break;r*=46}i?i[s++]=r:i=new e(r)}return i}class Hd{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Jd=new Hd;class Kd{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Jd,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let i=this.range,n=this.rangeIndex,s=this.pos+t;for(;si.to:s>=i.to;){if(n==this.ranges.length-1)return null;let t=this.ranges[++n];s+=t.from-i.to,i=t}return s}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,e.from);return this.end}peek(t){let e,i,n=this.chunkOff+t;if(n>=0&&n=this.chunk2Pos&&en.to&&(this.chunk2=this.chunk2.slice(0,n.to-e)),i=this.chunk2.charCodeAt(0)}}return e>=this.token.lookAhead&&(this.token.lookAhead=e+1),i}acceptToken(t,e=0){let i=e?this.resolveOffset(e,-1):this.pos;if(null==i||i=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=Jd,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let i="";for(let n of this.ranges){if(n.from>=e)break;n.to>t&&(i+=this.input.read(Math.max(n.from,t),Math.min(n.to,e)))}return i}}class tf{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:i}=e.p;sf(this.data,t,e,this.id,i.data,i.tokenPrecTable)}}tf.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class ef{constructor(t,e,i){this.precTable=e,this.elseToken=i,this.data="string"==typeof t?Fd(t):t}token(t,e){let i=t.pos,n=0;for(;sf(this.data,t,e,0,this.data,this.precTable),!(t.token.value>-1);){if(null==this.elseToken)return;if(t.next<0)break;t.advance(),t.reset(t.pos,t.token),n++}n&&(t.reset(i,t.token),t.acceptToken(this.elseToken,n))}}ef.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class nf{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function sf(t,e,i,n,s,r){let o=0,a=1<0){let i=t[n];if(l.allows(i)&&(-1==e.token.value||e.token.value==i||of(i,e.token.value,s,r))){e.acceptToken(i);break}}let n=e.next,h=0,c=t[o+2];if(!(e.next<0&&c>h&&65535==t[i+3*c-3]&&65535==t[i+3*c-3])){for(;h>1,r=i+s+(s<<1),a=t[r],l=t[r+1]||65536;if(n=l)){o=t[r+2],e.advance();continue t}h=s+1}}break}o=t[i+3*c-1]}}function rf(t,e,i){for(let n,s=e;65535!=(n=t[s]);s++)if(n==i)return s-e;return-1}function of(t,e,i,n){let s=rf(i,n,e);return s<0||rf(i,n,t)e)&&!n.type.isError)return i<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(t.length,Math.max(n.from+1,e+25));if(i<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return i<0?0:t.length}}!function(t){t[t.Margin=25]="Margin"}(hf||(hf={}));let uf=class{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?cf(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?cf(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=r,null;if(s instanceof bo){if(r==t){if(r=Math.max(this.safeFrom,t)&&(this.trees.push(s),this.start.push(r),this.index.push(0))}else this.index[e]++,this.nextStart=r+s.length}}};class df{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map((t=>new Hd))}getActions(t){let e=0,i=null,{parser:n}=t.p,{tokenizers:s}=n,r=n.stateSlot(t.state,3),o=t.curContext?t.curContext.hash:0,a=0;for(let n=0;nh.end+25&&(a=Math.max(h.lookAhead,a)),0!=h.value)){let n=e;if(h.extended>-1&&(e=this.addActions(t,h.extended,h.end,e)),e=this.addActions(t,h.value,h.end,e),!l.extend&&(i=h,e>n))break}}for(;this.actions.length>e;)this.actions.pop();return a&&t.setLookAhead(a),i||t.pos!=this.stream.end||(i=new Hd,i.value=t.p.parser.eofTerm,i.start=i.end=t.pos,e=this.addActions(t,i.value,i.end,e)),this.mainToken=i,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new Hd,{pos:i,p:n}=t;return e.start=i,e.end=Math.min(i+1,n.stream.end),e.value=i==n.stream.end?n.parser.eofTerm:0,e}updateCachedToken(t,e,i){let n=this.stream.clipPos(i.pos);if(e.token(this.stream.reset(n,t),i),t.value>-1){let{parser:e}=i.p;for(let n=0;n=0&&i.p.parser.dialect.allows(s>>1)){0==(1&s)?t.value=s>>1:t.extended=s>>1;break}}}else t.value=0,t.end=this.stream.clipPos(n+1)}putAction(t,e,i,n){for(let e=0;e4*t.bufferLength?new uf(i,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t,e,i=this.stacks,n=this.minStackPos,s=this.stacks=[];if(this.bigReductionCount>300&&1==i.length){let[t]=i;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;rn)s.push(o);else{if(this.advanceStack(o,s,i))continue;{t||(t=[],e=[]),t.push(o);let i=this.tokens.getMainToken(o);e.push(i.value,i.end)}}break}}if(!s.length){let e=t&&function(t){let e=null;for(let i of t){let t=i.p.stoppedAt;(i.pos==i.p.stream.end||null!=t&&i.pos>t)&&i.p.parser.stateFlag(i.state,2)&&(!e||e.scorethis.stoppedAt?t[0]:this.runRecovery(t,e,s);if(i)return this.stackToTree(i.forceAll())}if(this.recovering){let t=1==this.recovering?1:3*this.recovering;if(s.length>t)for(s.sort(((t,e)=>e.score-t.score));s.length>t;)s.pop();s.some((t=>t.reducePos>n))&&this.recovering--}else if(s.length>1){t:for(let t=0;t500&&n.buffer.length>500){if(!((e.score-n.score||e.buffer.length-n.buffer.length)>0)){s.splice(t--,1);continue t}s.splice(i--,1)}}}s.length>12&&s.splice(12,s.length-12)}this.minStackPos=s[0].pos;for(let t=1;t ":"";if(null!=this.stoppedAt&&n>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let e=t.curContext&&t.curContext.tracker.strict,i=e?t.curContext.hash:0;for(let o=this.fragments.nodeAt(n);o;){let n=this.parser.nodeSet.types[o.type.id]==o.type?s.getGoto(t.state,o.type.id):-1;if(n>-1&&o.length&&(!e||(o.prop(ho.contextHash)||0)==i))return t.useNode(o,n),af&&console.log(r+this.stackID(t)+` (via reuse of ${s.getName(o.type.id)})`),!0;if(!(o instanceof bo)||0==o.children.length||o.positions[0]>0)break;let a=o.children[0];if(!(a instanceof bo&&0==o.positions[0]))break;o=a}}let o=s.stateSlot(t.state,4);if(o>0)return t.reduce(o),af&&console.log(r+this.stackID(t)+` (via always-reduce ${s.getName(65535&o)})`),!0;if(t.stack.length>=15e3)for(;t.stack.length>9e3&&t.forceReduce(););let a=this.tokens.getActions(t);for(let o=0;on?e.push(d):i.push(d)}return!1}advanceFully(t,e){let i=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>i)return Of(t,e),!0}}runRecovery(t,e,i){let n=null,s=!1;for(let r=0;r ":"";if(o.deadEnd){if(s)continue;if(s=!0,o.restart(),af&&console.log(h+this.stackID(o)+" (restarted)"),this.advanceFully(o,i))continue}let c=o.split(),u=h;for(let t=0;c.forceReduce()&&t<10;t++){if(af&&console.log(u+this.stackID(c)+" (via force-reduce)"),this.advanceFully(c,i))break;af&&(u=this.stackID(c)+" -> ")}for(let t of o.recoverByInsert(a))af&&console.log(h+this.stackID(t)+" (via recover-insert)"),this.advanceFully(t,i);this.stream.end>o.pos?(l==o.pos&&(l++,a=0),o.recoverByDelete(a,l),af&&console.log(h+this.stackID(o)+` (via recover-delete ${this.parser.getName(a)})`),Of(o,i)):(!n||n.scoret;class bf{constructor(t){this.start=t.start,this.shift=t.shift||mf,this.reduce=t.reduce||mf,this.reuse=t.reuse||mf,this.hash=t.hash||(()=>0),this.strict=!1!==t.strict}}class wf extends Vo{constructor(t){if(super(),this.wrappers=[],14!=t.version)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let i=0;it.topRules[e][1])),n=[];for(let t=0;t=0)s(n,t,e[i++]);else{let r=e[i+-n];for(let o=-n;o>0;o--)s(e[i++],t,r);i++}}}this.nodeSet=new po(e.map(((e,s)=>fo.define({name:s>=this.minRepeatTerm?void 0:e,id:s,props:n[s],top:i.indexOf(s)>-1,error:0==s,skipped:t.skippedNodes&&t.skippedNodes.indexOf(s)>-1})))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=oo;let r=Fd(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let t=0;t"number"==typeof t?new tf(r,t):t)),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,i){let n=new pf(this,t,e,i);for(let s of this.wrappers)n=s(n,t,e,i);return n}getGoto(t,e,i=!1){let n=this.goto;if(e>=n[0])return-1;for(let s=n[e+1];;){let e=n[s++],r=1&e,o=n[s++];if(r&&i)return o;for(let i=s+(e>>1);s0}validAction(t,e){if(e==this.stateSlot(t,4))return!0;for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])return!1;i=vf(this.data,i+2)}if(e==vf(this.data,i+1))return!0}}nextStates(t){let e=[];for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])break;i=vf(this.data,i+2)}if(0==(1&this.data[i+2])){let t=this.data[i+1];e.some(((e,i)=>1&i&&e==t))||e.push(this.data[i],t)}}return e}configure(t){let e=Object.assign(Object.create(wf.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let i=this.topRules[t.top];if(!i)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=i}return t.tokenizers&&(e.tokenizers=this.tokenizers.map((e=>{let i=t.tokenizers.find((t=>t.from==e));return i?i.to:e}))),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map(((i,n)=>{let s=t.specializers.find((t=>t.from==i.external));if(!s)return i;let r=Object.assign(Object.assign({},i),{external:s.to});return e.specializers[n]=yf(r),r}))),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),null!=t.strict&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),null!=t.bufferLength&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return null==e?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),i=e.map((()=>!1));if(t)for(let n of t.split(" ")){let t=e.indexOf(n);t>=0&&(i[t]=!0)}let n=null;for(let t=0;tt.external(i,n)<<1|e}return t.get}const Sf=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],xf=new bf({start:!1,shift:(t,e)=>3==e||4==e||305==e?t:306==e,strict:!1}),kf=new nf(((t,e)=>{let{next:i}=t;(125==i||-1==i||e.context)&&e.canShift(303)&&t.acceptToken(303)}),{contextual:!0,fallback:!0}),Qf=new nf(((t,e)=>{let i,{next:n}=t;Sf.indexOf(n)>-1||(47!=n||47!=(i=t.peek(1))&&42!=i)&&125!=n&&59!=n&&-1!=n&&!e.context&&e.canShift(302)&&t.acceptToken(302)}),{contextual:!0}),$f=new nf(((t,e)=>{let{next:i}=t;if((43==i||45==i)&&(t.advance(),i==t.next)){t.advance();let i=!e.context&&e.canShift(1);t.acceptToken(i?1:2)}}),{contextual:!0}),Pf=ea({"get set async static":Sa.modifier,"for while do if else switch try catch finally return throw break continue default case":Sa.controlKeyword,"in of await yield void typeof delete instanceof":Sa.operatorKeyword,"let var const function class extends":Sa.definitionKeyword,"import export from":Sa.moduleKeyword,"with debugger as new":Sa.keyword,TemplateString:Sa.special(Sa.string),super:Sa.atom,BooleanLiteral:Sa.bool,this:Sa.self,null:Sa.null,Star:Sa.modifier,VariableName:Sa.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":Sa.function(Sa.variableName),VariableDefinition:Sa.definition(Sa.variableName),Label:Sa.labelName,PropertyName:Sa.propertyName,PrivatePropertyName:Sa.special(Sa.propertyName),"CallExpression/MemberExpression/PropertyName":Sa.function(Sa.propertyName),"FunctionDeclaration/VariableDefinition":Sa.function(Sa.definition(Sa.variableName)),"ClassDeclaration/VariableDefinition":Sa.definition(Sa.className),PropertyDefinition:Sa.definition(Sa.propertyName),PrivatePropertyDefinition:Sa.definition(Sa.special(Sa.propertyName)),UpdateOp:Sa.updateOperator,LineComment:Sa.lineComment,BlockComment:Sa.blockComment,Number:Sa.number,String:Sa.string,Escape:Sa.escape,ArithOp:Sa.arithmeticOperator,LogicOp:Sa.logicOperator,BitOp:Sa.bitwiseOperator,CompareOp:Sa.compareOperator,RegExp:Sa.regexp,Equals:Sa.definitionOperator,Arrow:Sa.function(Sa.punctuation),": Spread":Sa.punctuation,"( )":Sa.paren,"[ ]":Sa.squareBracket,"{ }":Sa.brace,"InterpolationStart InterpolationEnd":Sa.special(Sa.brace),".":Sa.derefOperator,", ;":Sa.separator,"@":Sa.meta,TypeName:Sa.typeName,TypeDefinition:Sa.definition(Sa.typeName),"type enum interface implements namespace module declare":Sa.definitionKeyword,"abstract global Privacy readonly override":Sa.modifier,"is keyof unique infer":Sa.operatorKeyword,JSXAttributeValue:Sa.attributeValue,JSXText:Sa.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":Sa.angleBracket,"JSXIdentifier JSXNameSpacedName":Sa.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":Sa.attributeName,"JSXBuiltin/JSXIdentifier":Sa.standard(Sa.tagName)}),Cf={__proto__:null,export:14,as:19,from:27,default:30,async:35,function:36,extends:46,this:50,true:58,false:58,null:70,void:74,typeof:78,super:96,new:130,delete:146,yield:155,await:159,class:164,public:221,private:221,protected:221,readonly:223,instanceof:242,satisfies:245,in:246,const:248,import:280,keyof:335,unique:339,infer:345,is:381,abstract:401,implements:403,type:405,let:408,var:410,interface:417,enum:421,namespace:427,module:429,declare:433,global:437,for:456,of:465,while:468,with:472,do:476,if:480,else:482,switch:486,case:492,try:498,catch:502,finally:506,return:510,throw:514,break:518,continue:522,debugger:526},_f={__proto__:null,async:117,get:119,set:121,declare:181,public:183,private:183,protected:183,static:185,abstract:187,override:189,readonly:195,accessor:197,new:385},Xf={__proto__:null,"<":137},Zf=wf.deserialize({version:14,states:"$6[O`QUOOO%QQUOOO'TQWOOP(bOSOOO*pQ(CjO'#CfO*wOpO'#CgO+VO!bO'#CgO+eO07`O'#DZO-vQUO'#DaO.WQUO'#DlO%QQUO'#DvO0[QUO'#EOOOQ(CY'#EW'#EWO0uQSO'#ETOOQO'#Ei'#EiOOQO'#Ib'#IbO0}QSO'#GkO1YQSO'#EhO1_QSO'#EhO3aQ(CjO'#JcO6QQ(CjO'#JdO6nQSO'#FWO6sQ#tO'#FoOOQ(CY'#F`'#F`O7OO&jO'#F`O7^Q,UO'#FvO8tQSO'#FuOOQ(CY'#Jd'#JdOOQ(CW'#Jc'#JcOOQQ'#KO'#KOO8yQSO'#IOO9OQ(C[O'#IPOOQQ'#JP'#JPOOQQ'#IT'#ITQ`QUOOO%QQUO'#DnO9WQUO'#DzO%QQUO'#D|O9_QSO'#GkO9dQ,UO'#ClO9rQSO'#EgO9}QSO'#ErO:SQ,UO'#F_O:qQSO'#GkO:vQSO'#GoO;RQSO'#GoO;aQSO'#GrO;aQSO'#GsO;aQSO'#GuO9_QSO'#GxOQQSO'#HnO>VQ(C]O'#HtO%QQUO'#HvO>bQ(C]O'#HxO>mQ(C]O'#HzO9OQ(C[O'#H|O>xQ(CjO'#CfO?zQWO'#DfQOQSOOO@bQSO'#EPO9dQ,UO'#EgO@mQSO'#EgO@xQ`O'#F_OOQQ'#Cd'#CdOOQ(CW'#Dk'#DkOOQ(CW'#Jg'#JgO%QQUO'#JgOOQO'#Jk'#JkOOQO'#I_'#I_OAxQWO'#E`OOQ(CW'#E_'#E_OBtQ(C`O'#E`OCOQWO'#ESOOQO'#J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^'^'_Q-`'`Q1{,{R2Z-_R(k#tR(n#uQ!dQT,|'Q,}]!nQ!o'Q,}0u4pQ#l]R'Z9mT#gZ%ZS#fZ%ZU%y|},ZU(W#d#e#hS-r(X(YQ-v(ZQ0h+hQ2`-sU2a-t-u-wS5v2b2cR7u5w`#YW#S#V%v't'}+e-mt#cZ|}#d#e#h%Z(X(Y(Z+h-s-t-u-w2b2c5wQ1_,ZQ1r,oQ5e1jQ7m5fT:x&y+fT#]W%vS#[W%vS'u#S'}S'z#V+eS,t&y+fT-h't-mT'O!c%wQ$hfR)j$mT)_$h)`R3Z.kT*O$u*QR*W$xQ/}*zQ2e.OQ4s0wQ5{2iQ7X4vQ7x5zQ8e7WQ8w7wQ9W8gQ9`8yQ9e9XR9h9alpOXr!X#`%]&d&f&g&i,],b1b1eQ&^!TR,Q&ZV%z|},ZR0q+qR,P&XQ%szR+c%tR+X%nT&b!U&eT&c!U&eT1d,b1e",nodeNames:"⚠ ArithOp ArithOp LineComment BlockComment Script ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXStartTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:364,context:xf,nodeProps:[["group",-26,6,14,16,62,199,203,206,207,209,212,215,225,227,233,235,237,239,242,248,254,256,258,260,262,264,265,"Statement",-32,10,11,25,28,29,35,45,48,49,51,56,64,72,76,78,80,81,103,104,113,114,131,134,136,137,138,139,141,142,162,163,165,"Expression",-23,24,26,30,34,36,38,166,168,170,171,173,174,175,177,178,179,181,182,183,193,195,197,198,"Type",-3,84,96,102,"ClassItem"],["openedBy",31,"InterpolationStart",50,"[",54,"{",69,"(",143,"JSXStartTag",155,"JSXStartTag JSXStartCloseTag"],["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z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(T~~",141,326),new ef("j~RQYZXz{^~^O'q~~aP!P!Qd~iO'r~~",25,308)],topRules:{Script:[0,5],SingleExpression:[1,266],SingleClassItem:[2,267]},dialects:{jsx:12686,ts:12688},dynamicPrecedences:{76:1,78:1,163:1,191:1},specialized:[{term:312,get:t=>Cf[t]||-1},{term:328,get:t=>_f[t]||-1},{term:67,get:t=>Xf[t]||-1}],tokenPrec:12712}),Af=[Dd("function ${name}(${params}) {\n\t${}\n}",{label:"function",detail:"definition",type:"keyword"}),Dd("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n\t${}\n}",{label:"for",detail:"loop",type:"keyword"}),Dd("for (let ${name} of ${collection}) {\n\t${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Dd("do {\n\t${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),Dd("while (${}) {\n\t${}\n}",{label:"while",detail:"loop",type:"keyword"}),Dd("try {\n\t${}\n} catch (${error}) {\n\t${}\n}",{label:"try",detail:"/ catch block",type:"keyword"}),Dd("if (${}) {\n\t${}\n}",{label:"if",detail:"block",type:"keyword"}),Dd("if (${}) {\n\t${}\n} else {\n\t${}\n}",{label:"if",detail:"/ else block",type:"keyword"}),Dd("class ${name} {\n\tconstructor(${params}) {\n\t\t${}\n\t}\n}",{label:"class",detail:"definition",type:"keyword"}),Dd('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Dd('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Tf=new Ro,Rf=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Ef(t){return(e,i)=>{let n=e.node.getChild("VariableDefinition");return n&&i(n,t),!0}}const Vf=["FunctionDeclaration"],Mf={FunctionDeclaration:Ef("function"),ClassDeclaration:Ef("class"),ClassExpression:()=>!0,EnumDeclaration:Ef("constant"),TypeAliasDeclaration:Ef("type"),NamespaceDeclaration:Ef("namespace"),VariableDefinition(t,e){t.matchContext(Vf)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function Df(t,e){let i=Tf.get(e);if(i)return i;let n=[],s=!0;function r(e,i){let s=t.sliceString(e.from,e.to);n.push({label:s,type:i})}return e.cursor(mo.IncludeAnonymous).iterate((e=>{if(s)s=!1;else if(e.name){let t=Mf[e.name];if(t&&t(e,r)||Rf.has(e.name))return!1}else if(e.to-e.from>8192){for(let i of Df(t,e.node))n.push(i);return!1}})),Tf.set(e,n),n}const Wf=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Uf=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName"];function Yf(t){let e=Xa(t.state).resolveInner(t.pos,-1);if(Uf.indexOf(e.name)>-1)return null;let i="VariableName"==e.name||e.to-e.from<20&&Wf.test(t.state.sliceDoc(e.from,e.to));if(!i&&!t.explicit)return null;let n=[];for(let i=e;i;i=i.parent)Rf.has(i.name)&&(n=n.concat(Df(t.state.doc,i)));return{options:n,from:i?e.from:t.pos,validFor:Wf}}const qf=_a.define({name:"javascript",parser:Zf.configure({props:[Na.add({IfStatement:il({except:/^\s*({|else\b)/}),TryStatement:il({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:t=>t.baseIndent,SwitchBody:t=>{let e=t.textAfter,i=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return t.baseIndent+(i?0:n?1:2)*t.unit},Block:tl({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":il({except:/^{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag":t=>t.column(t.node.from)+t.unit}),rl.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression":ol,BlockComment:t=>({from:t.from+2,to:t.to-2})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Lf={test:t=>/^JSX/.test(t.name),facet:Qa({commentTokens:{block:{open:"{/*",close:"*/}"}}})},zf=qf.configure({dialect:"ts"},"typescript"),If=qf.configure({dialect:"jsx",props:[$a.add((t=>t.isTop?[Lf]:void 0))]}),Bf=qf.configure({dialect:"jsx ts",props:[$a.add((t=>t.isTop?[Lf]:void 0))]},"typescript"),jf="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map((t=>({label:t,type:"keyword"})));function Nf(t={}){let e=t.jsx?t.typescript?Bf:If:t.typescript?zf:qf;return new Ua(e,[qf.data.of({autocomplete:(i=Uf,n=zu(Af.concat(jf)),t=>{for(let e=Xa(t.state).resolveInner(t.pos,-1);e;e=e.parent){if(i.indexOf(e.name)>-1)return null;if(e.type.isTop)break}return n(t)})}),qf.data.of({autocomplete:Yf}),t.jsx?Hf:[]]);var i,n}function Gf(t,e,i=t.length){for(let n=null==e?void 0:e.firstChild;n;n=n.nextSibling)if("JSXIdentifier"==n.name||"JSXBuiltin"==n.name||"JSXNamespacedName"==n.name||"JSXMemberExpression"==n.name)return t.sliceString(n.from,Math.min(n.to,i));return""}const Ff="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),Hf=Ts.inputHandler.of(((t,e,i,n)=>{if((Ff?t.composing:t.compositionStarted)||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!qf.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((t=>{var e,i;let r,{head:o}=t,a=Xa(s).resolveInner(o,-1);if("JSXStartTag"==a.name&&(a=a.parent),">"==n&&"JSXFragmentTag"==a.name)return{range:A.cursor(o+1),changes:{from:o,insert:">"}};if("/"==n&&"JSXFragmentTag"==a.name){let t=a.parent,i=null==t?void 0:t.parent;if(t.from==o-1&&"JSXEndTag"!=(null===(e=i.lastChild)||void 0===e?void 0:e.name)&&(r=Gf(s.doc,null==i?void 0:i.firstChild,o))){let t=`/${r}>`;return{range:A.cursor(o+t.length),changes:{from:o,insert:t}}}}else if(">"==n){let t=function(t){for(;;){if("JSXOpenTag"==t.name||"JSXSelfClosingTag"==t.name||"JSXFragmentTag"==t.name)return t;if(!t.parent)return null;t=t.parent}}(a);if(t&&"JSXEndTag"!=(null===(i=t.lastChild)||void 0===i?void 0:i.name)&&"`}}}return{range:t}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)}));class Jf{constructor(t,e,i,n,s,r,o){this.type=t,this.value=e,this.from=i,this.hash=n,this.end=s,this.children=r,this.positions=o,this.hashProp=[[ho.contextHash,n]]}static create(t,e,i,n,s){return new Jf(t,e,i,n+(n<<8)+t+(e<<4)|0,s,[],[])}addChild(t,e){t.prop(ho.contextHash)!=this.hash&&(t=new bo(t.type,t.children,t.positions,t.length,this.hashProp)),this.children.push(t),this.positions.push(e)}toTree(t,e=this.end){let i=this.children.length-1;return i>=0&&(e=Math.max(e,this.positions[i]+this.children[i].length+this.from)),new bo(t.types[this.type],this.children,this.positions,e-this.from).balance({makeTree:(t,e,i)=>new bo(fo.none,t,e,i,this.hashProp)})}}var Kf;!function(t){t[t.Document=1]="Document",t[t.CodeBlock=2]="CodeBlock",t[t.FencedCode=3]="FencedCode",t[t.Blockquote=4]="Blockquote",t[t.HorizontalRule=5]="HorizontalRule",t[t.BulletList=6]="BulletList",t[t.OrderedList=7]="OrderedList",t[t.ListItem=8]="ListItem",t[t.ATXHeading1=9]="ATXHeading1",t[t.ATXHeading2=10]="ATXHeading2",t[t.ATXHeading3=11]="ATXHeading3",t[t.ATXHeading4=12]="ATXHeading4",t[t.ATXHeading5=13]="ATXHeading5",t[t.ATXHeading6=14]="ATXHeading6",t[t.SetextHeading1=15]="SetextHeading1",t[t.SetextHeading2=16]="SetextHeading2",t[t.HTMLBlock=17]="HTMLBlock",t[t.LinkReference=18]="LinkReference",t[t.Paragraph=19]="Paragraph",t[t.CommentBlock=20]="CommentBlock",t[t.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",t[t.Escape=22]="Escape",t[t.Entity=23]="Entity",t[t.HardBreak=24]="HardBreak",t[t.Emphasis=25]="Emphasis",t[t.StrongEmphasis=26]="StrongEmphasis",t[t.Link=27]="Link",t[t.Image=28]="Image",t[t.InlineCode=29]="InlineCode",t[t.HTMLTag=30]="HTMLTag",t[t.Comment=31]="Comment",t[t.ProcessingInstruction=32]="ProcessingInstruction",t[t.URL=33]="URL",t[t.HeaderMark=34]="HeaderMark",t[t.QuoteMark=35]="QuoteMark",t[t.ListMark=36]="ListMark",t[t.LinkMark=37]="LinkMark",t[t.EmphasisMark=38]="EmphasisMark",t[t.CodeMark=39]="CodeMark",t[t.CodeText=40]="CodeText",t[t.CodeInfo=41]="CodeInfo",t[t.LinkTitle=42]="LinkTitle",t[t.LinkLabel=43]="LinkLabel"}(Kf||(Kf={}));class tp{constructor(t,e){this.start=t,this.content=e,this.marks=[],this.parsers=[]}}class ep{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let t=this.skipSpace(this.basePos);this.indent=this.countIndent(t,this.pos,this.indent),this.pos=t,this.next=t==this.text.length?-1:this.text.charCodeAt(t)}skipSpace(t){return rp(this.text,t)}reset(t){for(this.text=t,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(t){this.basePos=t,this.baseIndent=this.countIndent(t,this.pos,this.indent)}moveBaseColumn(t){this.baseIndent=t,this.basePos=this.findColumn(t)}addMarker(t){this.markers.push(t)}countIndent(t,e=0,i=0){for(let n=e;n=e.stack[i.depth+1].value+i.baseIndent)return!0;if(i.indent>=i.baseIndent+4)return!1;let n=(t.type==Kf.OrderedList?dp:up)(i,e,!1);return n>0&&(t.type!=Kf.BulletList||hp(i,e,!1)<0)&&i.text.charCodeAt(i.pos+n-1)==t.value}const np={[Kf.Blockquote]:(t,e,i)=>62==i.next&&(i.markers.push(Up(Kf.QuoteMark,e.lineStart+i.pos,e.lineStart+i.pos+1)),i.moveBase(i.pos+(sp(i.text.charCodeAt(i.pos+1))?2:1)),t.end=e.lineStart+i.text.length,!0),[Kf.ListItem]:(t,e,i)=>!(i.indent-1)&&(i.moveBaseColumn(i.baseIndent+t.value),!0),[Kf.OrderedList]:ip,[Kf.BulletList]:ip,[Kf.Document]:()=>!0};function sp(t){return 32==t||9==t||10==t||13==t}function rp(t,e=0){for(;ei&&sp(t.charCodeAt(e-1));)e--;return e}function ap(t){if(96!=t.next&&126!=t.next)return-1;let e=t.pos+1;for(;e-1&&t.depth==e.stack.length||n<3?-1:1}function cp(t,e){for(let i=t.stack.length-1;i>=0;i--)if(t.stack[i].type==e)return!0;return!1}function up(t,e,i){return 45!=t.next&&43!=t.next&&42!=t.next||t.pos!=t.text.length-1&&!sp(t.text.charCodeAt(t.pos+1))||!(!i||cp(e,Kf.BulletList)||t.skipSpace(t.pos+2)=48&&s<=57;){if(n++,n==t.text.length)return-1;s=t.text.charCodeAt(n)}return n==t.pos||n>t.pos+9||46!=s&&41!=s||nt.pos+1||49!=t.next)?-1:n+1-t.pos}function fp(t){if(35!=t.next)return-1;let e=t.pos+1;for(;e6?-1:i}function pp(t){if(45!=t.next&&61!=t.next||t.indent>=t.baseIndent+4)return-1;let e=t.pos+1;for(;e/,mp=/\?>/,bp=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*/i.exec(n);if(r)return t.append(Up(Kf.Comment,i,i+1+r[0].length));let o=/^\?[^]*?\?>/.exec(n);if(o)return t.append(Up(Kf.ProcessingInstruction,i,i+1+o[0].length));let a=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(n);return a?t.append(Up(Kf.HTMLTag,i,i+1+a[0].length)):-1},Emphasis(t,e,i){if(95!=e&&42!=e)return-1;let n=i+1;for(;t.char(n)==e;)n++;let s=t.slice(i-1,i),r=t.slice(n,n+1),o=jp.test(s),a=jp.test(r),l=/\s|^$/.test(s),h=/\s|^$/.test(r),c=!h&&(!a||l||o),u=!l&&(!o||h||a),d=c&&(42==e||!u||o),f=u&&(42==e||!c||a);return t.append(new Ip(95==e?Yp:qp,i,n,(d?1:0)|(f?2:0)))},HardBreak(t,e,i){if(92==e&&10==t.char(i+1))return t.append(Up(Kf.HardBreak,i,i+2));if(32==e){let e=i+1;for(;32==t.char(e);)e++;if(10==t.char(e)&&e>=i+2)return t.append(Up(Kf.HardBreak,i,e+1))}return-1},Link:(t,e,i)=>91==e?t.append(new Ip(Lp,i,i+1,1)):-1,Image:(t,e,i)=>33==e&&91==t.char(i+1)?t.append(new Ip(zp,i,i+2,1)):-1,LinkEnd(t,e,i){if(93!=e)return-1;for(let e=t.parts.length-1;e>=0;e--){let n=t.parts[e];if(n instanceof Ip&&(n.type==Lp||n.type==zp)){if(!n.side||t.skipSpace(n.to)==i&&!/[(\[]/.test(t.slice(i+1,i+2)))return t.parts[e]=null,-1;let s=t.takeContent(e),r=t.parts[e]=Gp(t,s,n.type==Lp?Kf.Link:Kf.Image,n.from,i+1);if(n.type==Lp)for(let i=0;ie?Up(Kf.URL,e+i,s+i):s==t.length&&null}}function Hp(t,e,i){let n=t.charCodeAt(e);if(39!=n&&34!=n&&40!=n)return!1;let s=40==n?41:n;for(let n=e+1,r=!1;n=this.end?-1:this.text.charCodeAt(t-this.offset)}get end(){return this.offset+this.text.length}slice(t,e){return this.text.slice(t-this.offset,e-this.offset)}append(t){return this.parts.push(t),t.to}addDelimiter(t,e,i,n,s){return this.append(new Ip(t,e,i,(n?1:0)|(s?2:0)))}addElement(t){return this.append(t)}resolveMarkers(t){for(let e=t;e=t;o--){let t=this.parts[o];if(t instanceof Ip&&1&t.side&&t.type==i.type&&!(s&&(1&i.side||2&t.side)&&(t.to-t.from+r)%3==0&&((t.to-t.from)%3||r%3))){n=t;break}}if(!n)continue;let a=i.type.resolve,l=[],h=n.from,c=i.to;if(s){let t=Math.min(2,n.to-n.from,r);h=n.to-t,c=i.from+t,a=1==t?"Emphasis":"StrongEmphasis"}n.type.mark&&l.push(this.elt(n.type.mark,h,n.to));for(let t=o+1;t=0;e--){let i=this.parts[e];if(i instanceof Ip&&i.type==t)return e}return null}takeContent(t){let e=this.resolveMarkers(t);return this.parts.length=t,e}skipSpace(t){return rp(this.text,t-this.offset)+this.offset}elt(t,e,i,n){return"string"==typeof t?Up(this.parser.getNodeType(t),e,i,n):new Wp(t,e)}}function tO(t,e){if(!e.length)return t;if(!t.length)return e;let i=t.slice(),n=0;for(let t of e){for(;n(t?t-1:0))return!1;if(this.fragmentEnd<0){let t=this.fragment.to;for(;t>0&&"\n"!=this.input.read(t-1,t);)t--;this.fragmentEnd=t?t-1:0}let i=this.cursor;i||(i=this.cursor=this.fragment.tree.cursor(),i.firstChild());let n=t+this.fragment.offset;for(;i.to<=n;)if(!i.parent())return!1;for(;;){if(i.from>=n)return this.fragment.from<=e;if(!i.childAfter(n))return!1}}matches(t){let e=this.cursor.tree;return e&&e.prop(ho.contextHash)==t}takeNodes(t){let e=this.cursor,i=this.fragment.offset,n=this.fragmentEnd-(this.fragment.openEnd?1:0),s=t.absoluteLineStart,r=s,o=t.block.children.length,a=r,l=o;for(;;){if(e.to-i>n){if(e.type.isAnonymous&&e.firstChild())continue;break}if(t.dontInject.add(e.tree),t.addNode(e.tree,e.from-i),e.type.is("Block")&&(eO.indexOf(e.type.id)<0?(r=e.to-i,o=t.block.children.length):(r=a,o=l,a=e.to-i,l=t.block.children.length)),!e.nextSibling())break}for(;t.block.children.length>o;)t.block.children.pop(),t.block.positions.pop();return r-s}}const nO=ea({"Blockquote/...":Sa.quote,HorizontalRule:Sa.contentSeparator,"ATXHeading1/... SetextHeading1/...":Sa.heading1,"ATXHeading2/... SetextHeading2/...":Sa.heading2,"ATXHeading3/...":Sa.heading3,"ATXHeading4/...":Sa.heading4,"ATXHeading5/...":Sa.heading5,"ATXHeading6/...":Sa.heading6,"Comment CommentBlock":Sa.comment,Escape:Sa.escape,Entity:Sa.character,"Emphasis/...":Sa.emphasis,"StrongEmphasis/...":Sa.strong,"Link/... Image/...":Sa.link,"OrderedList/... BulletList/...":Sa.list,"BlockQuote/...":Sa.quote,"InlineCode CodeText":Sa.monospace,URL:Sa.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":Sa.processingInstruction,"CodeInfo LinkLabel":Sa.labelName,LinkTitle:Sa.string,Paragraph:Sa.content}),sO=new Zp(new po(Ep).extend(nO),Object.keys(Sp).map((t=>Sp[t])),Object.keys(Sp).map((t=>$p[t])),Object.keys(Sp),Pp,np,Object.keys(Np).map((t=>Np[t])),Object.keys(Np),[]);function rO(t,e,i){let n=[];for(let s=t.firstChild,r=e;;s=s.nextSibling){let t=s?s.from:i;if(t>r&&n.push({from:r,to:t}),!s)break;r=s.to}return n}const oO={resolve:"Strikethrough",mark:"StrikethroughMark"},aO={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":Sa.strikethrough}},{name:"StrikethroughMark",style:Sa.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,i){if(126!=e||126!=t.char(i+1)||126==t.char(i+2))return-1;let n=t.slice(i-1,i),s=t.slice(i+2,i+3),r=/\s|^$/.test(n),o=/\s|^$/.test(s),a=jp.test(n),l=jp.test(s);return t.addDelimiter(oO,i,i+2,!o&&(!l||r||a),!r&&(!a||o||l))},after:"Emphasis"}]};function lO(t,e,i=0,n,s=0){let r=0,o=!0,a=-1,l=-1,h=!1,c=()=>{n.push(t.elt("TableCell",s+a,s+l,t.parser.parseInline(e.slice(a,l),s+a)))};for(let u=i;u-1)&&r++,o=!1,n&&(a>-1&&c(),n.push(t.elt("TableDelimiter",u+s,u+s+1))),a=l=-1),h=!h&&92==i}return a>-1&&(r++,n&&c()),r}function hO(t,e){for(let i=e;ihO(e.content,0)?new uO:null,endLeaf(t,e,i){if(i.parsers.some((t=>t instanceof uO))||!hO(e.text,e.basePos))return!1;let n=t.scanLine(t.absoluteLineEnd+1).text;return cO.test(n)&&lO(t,e.text,e.basePos)==lO(t,n,e.basePos)},before:"SetextHeading"}]};class fO{nextLine(){return!1}finish(t,e){return t.addLeafElement(e,t.elt("Task",e.start,e.start+e.content.length,[t.elt("TaskMarker",e.start,e.start+3),...t.parser.parseInline(e.content.slice(3),e.start+3)])),!0}}const pO=[dO,{defineNodes:[{name:"Task",block:!0,style:Sa.list},{name:"TaskMarker",style:Sa.atom}],parseBlock:[{name:"TaskList",leaf:(t,e)=>/^\[[ xX]\]/.test(e.content)&&"ListItem"==t.parentType().name?new fO:null,after:"SetextHeading"}]},aO];function OO(t,e,i){return(n,s,r)=>{if(s!=t||n.char(r+1)==t)return-1;let o=[n.elt(i,r,r+1)];for(let s=r+1;s=65&&r<=90||95==r||r>=97&&r<=122||r>=161;)s+=String.fromCharCode(n),n=t.peek(++e);var r;return RO=t,EO=i,TO=s?s.toLowerCase():n==MO||n==DO?void 0:null}const MO=63,DO=33;function WO(t,e){this.name=t,this.parent=e,this.hash=e?e.hash:0;for(let e=0;eUO.indexOf(e)>-1?new WO(VO(n,1)||"",t):t,reduce:(t,e)=>e==wO&&t?t.parent:t,reuse(t,e,i,n){let s=e.type.id;return 6==s||36==s?new WO(VO(n,1)||"",t):t},hash:t=>t?t.hash:0,strict:!1}),qO=new nf(((t,e)=>{if(60!=t.next)return void(t.next<0&&e.context&&t.acceptToken(57));t.advance();let i=47==t.next;i&&t.advance();let n=VO(t,0);if(void 0===n)return;if(!n)return t.acceptToken(i?14:6);let s=e.context?e.context.name:null;if(i){if(n==s)return t.acceptToken(11);if(s&&XO[s])return t.acceptToken(57,-2);if(e.dialectEnabled(0))return t.acceptToken(12);for(let t=e.context;t;t=t.parent)if(t.name==n)return;t.acceptToken(13)}else{if("script"==n)return t.acceptToken(7);if("style"==n)return t.acceptToken(8);if("textarea"==n)return t.acceptToken(9);if(_O.hasOwnProperty(n))return t.acceptToken(10);s&&ZO[s]&&ZO[s][n]?t.acceptToken(57,-1):t.acceptToken(6)}}),{contextual:!0}),LO=new nf((t=>{for(let e=0,i=0;;i++){if(t.next<0){i&&t.acceptToken(58);break}if(45==t.next)e++;else{if(62==t.next&&e>=2){i>3&&t.acceptToken(58,-2);break}e=0}t.advance()}}));const zO=new nf(((t,e)=>{if(47==t.next&&62==t.peek(1)){let i=e.dialectEnabled(1)||function(t){for(;t;t=t.parent)if("svg"==t.name||"math"==t.name)return!0;return!1}(e.context);t.acceptToken(i?5:4,2)}else 62==t.next&&t.acceptToken(4,1)}));function IO(t,e,i){let n=2+t.length;return new nf((s=>{for(let r=0,o=0,a=0;;a++){if(s.next<0){a&&s.acceptToken(e);break}if(0==r&&60==s.next||1==r&&47==s.next||r>=2&&ro?s.acceptToken(e,-o):s.acceptToken(i,-(o-2));break}if((10==s.next||13==s.next)&&a){s.acceptToken(e,1);break}r=o=0}else o++;s.advance()}}))}const BO=IO("script",54,1),jO=IO("style",55,2),NO=IO("textarea",56,3),GO=ea({"Text RawText":Sa.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":Sa.angleBracket,TagName:Sa.tagName,"MismatchedCloseTag/TagName":[Sa.tagName,Sa.invalid],AttributeName:Sa.attributeName,"AttributeValue UnquotedAttributeValue":Sa.attributeValue,Is:Sa.definitionOperator,"EntityReference CharacterReference":Sa.character,Comment:Sa.blockComment,ProcessingInst:Sa.processingInstruction,DoctypeDecl:Sa.documentMeta}),FO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Tag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:67,context:YO,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,21,30,33,36,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,29,32,35,37,"OpenTag"],["group",-9,14,17,18,19,20,39,40,41,42,"Entity",16,"Entity TextContent",-3,28,31,34,"TextContent Entity"]],propSources:[GO],skippedNodes:[0],repeatNodeCount:9,tokenData:"#%g!aR!YOX$qXY,QYZ,QZ[$q[]&X]^,Q^p$qpq,Qqr-_rs4ysv-_vw5iwxJ^x}-_}!OKP!O!P-_!P!Q$q!Q![-_![!]!!O!]!^-_!^!_!&W!_!`#$o!`!a&X!a!c-_!c!}!!O!}#R-_#R#S!!O#S#T3V#T#o!!O#o#s-_#s$f$q$f%W-_%W%o!!O%o%p-_%p&a!!O&a&b-_&b1p!!O1p4U-_4U4d!!O4d4e-_4e$IS!!O$IS$I`-_$I`$Ib!!O$Ib$Kh-_$Kh%#t!!O%#t&/x-_&/x&Et!!O&Et&FV-_&FV;'S!!O;'S;:j!&Q;:j;=`4s<%l?&r-_?&r?Ah!!O?Ah?BY$q?BY?Mn!!O?MnO$q!Z$|c`PkW!a`!cpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr$qrs&}sv$qvw+Pwx(tx!^$q!^!_*V!_!a&X!a#S$q#S#T&X#T;'S$q;'S;=`+z<%lO$q!R&bX`P!a`!cpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&Xq'UV`P!cpOv&}wx'kx!^&}!^!_(V!_;'S&};'S;=`(n<%lO&}P'pT`POv'kw!^'k!_;'S'k;'S;=`(P<%lO'k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to):"")}return i}function JO(t,e){let i=t.getChild(vO);return i?e.read(i.from,i.to):" "}function KO(t,e,i){let n;for(let s of i)if(!s.attrs||s.attrs(n||(n=HO(t.node.parent.firstChild,e))))return{parser:s.parser};return null}function tg(t=[],e=[]){let i=[],n=[],s=[],r=[];for(let e of t){("script"==e.tag?i:"style"==e.tag?n:"textarea"==e.tag?s:r).push(e)}let o=e.length?Object.create(null):null;for(let t of e)(o[t.name]||(o[t.name]=[])).push(t);return Do(((t,e)=>{let a=t.type.id;if(a==QO)return KO(t,e,i);if(a==$O)return KO(t,e,n);if(a==PO)return KO(t,e,s);if(a==wO&&r.length){let i,n=t.node,s=n.firstChild,o=s&&JO(s,e);if(o)for(let t of r)if(t.tag==o&&(!t.attrs||t.attrs(i||(i=HO(n,e))))){let e=n.lastChild;return{parser:t.parser,overlay:[{from:s.to,to:e.type.id==CO?e.from:n.to}]}}}if(o&&a==yO){let i,n=t.node;if(i=n.firstChild){let t=o[e.read(i.from,i.to)];if(t)for(let i of t){if(i.tagName&&i.tagName!=JO(n.parent,e))continue;let t=n.lastChild;if(t.type.id==xO){let e=t.from+1,n=t.lastChild,s=t.to-(n&&n.isError?0:1);if(s>e)return{parser:i.parser,overlay:[{from:e,to:s}]}}else if(t.type.id==kO)return{parser:i.parser,overlay:[{from:t.from,to:t.to}]}}}}return null}))}const eg=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288];function ig(t){return t>=65&&t<=90||t>=97&&t<=122||t>=161}const ng=new nf(((t,e)=>{for(let n=!1,s=0,r=0;;r++){let{next:o}=t;if(!(ig(o)||45==o||95==o||n&&(i=o,i>=48&&i<=57))){n&&t.acceptToken(40==o?95:2==s&&e.canShift(2)?2:96);break}!n&&(45!=o||r>0)&&(n=!0),s===r&&45==o&&s++,t.advance()}var i})),sg=new nf((t=>{if(eg.includes(t.peek(-1))){let{next:e}=t;(ig(e)||95==e||35==e||46==e||91==e||58==e||45==e)&&t.acceptToken(94)}})),rg=new nf((t=>{if(!eg.includes(t.peek(-1))){let{next:e}=t;if(37==e&&(t.advance(),t.acceptToken(1)),ig(e)){do{t.advance()}while(ig(t.next));t.acceptToken(1)}}})),og=ea({"AtKeyword import charset namespace keyframes media supports":Sa.definitionKeyword,"from to selector":Sa.keyword,NamespaceName:Sa.namespace,KeyframeName:Sa.labelName,TagName:Sa.tagName,ClassName:Sa.className,PseudoClassName:Sa.constant(Sa.className),IdName:Sa.labelName,"FeatureName PropertyName":Sa.propertyName,AttributeName:Sa.attributeName,NumberLiteral:Sa.number,KeywordQuery:Sa.keyword,UnaryQueryOp:Sa.operatorKeyword,"CallTag ValueName":Sa.atom,VariableName:Sa.variableName,Callee:Sa.operatorKeyword,Unit:Sa.unit,"UniversalSelector NestingSelector":Sa.definitionOperator,MatchOp:Sa.compareOperator,"ChildOp SiblingOp, LogicOp":Sa.logicOperator,BinOp:Sa.arithmeticOperator,Important:Sa.modifier,Comment:Sa.blockComment,ParenthesizedContent:Sa.special(Sa.name),ColorLiteral:Sa.color,StringLiteral:Sa.string,":":Sa.punctuation,"PseudoOp #":Sa.derefOperator,"; ,":Sa.separator,"( )":Sa.paren,"[ ]":Sa.squareBracket,"{ }":Sa.brace}),ag={__proto__:null,lang:32,"nth-child":32,"nth-last-child":32,"nth-of-type":32,"nth-last-of-type":32,dir:32,"host-context":32,url:60,"url-prefix":60,domain:60,regexp:60,selector:134},lg={__proto__:null,"@import":114,"@media":138,"@charset":142,"@namespace":146,"@keyframes":152,"@supports":164},hg={__proto__:null,not:128,only:128,from:158,to:160},cg=wf.deserialize({version:14,states:"7WQYQ[OOO#_Q[OOOOQP'#Cd'#CdOOQP'#Cc'#CcO#fQ[O'#CfO$YQXO'#CaO$aQ[O'#ChO$lQ[O'#DPO$qQ[O'#DTOOQP'#Ed'#EdO$vQdO'#DeO%bQ[O'#DrO$vQdO'#DtO%sQ[O'#DvO&OQ[O'#DyO&TQ[O'#EPO&cQ[O'#ERO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O%^!O!P;g!P!Q%^!Q![>T![!g%^!g!h<^!h#X%^#X#Y<^#Y;'S%^;'S;=`%o<%lO%^XDuU]POy%^z![%^![!]EX!];'S%^;'S;=`%o<%lO%^XE`S^PoWOy%^z;'S%^;'S;=`%o<%lO%^_EqS!WVOy%^z;'S%^;'S;=`%o<%lO%^YFSSzQOy%^z;'S%^;'S;=`%o<%lO%^XFeU|POy%^z!`%^!`!aFw!a;'S%^;'S;=`%o<%lO%^XGOS|PoWOy%^z;'S%^;'S;=`%o<%lO%^XG_WOy%^z!c%^!c!}Gw!}#T%^#T#oGw#o;'S%^;'S;=`%o<%lO%^XHO[!YPoWOy%^z}%^}!OGw!O!Q%^!Q![Gw![!c%^!c!}Gw!}#T%^#T#oGw#o;'S%^;'S;=`%o<%lO%^XHySxPOy%^z;'S%^;'S;=`%o<%lO%^^I[SvUOy%^z;'S%^;'S;=`%o<%lO%^XIkUOy%^z#b%^#b#cI}#c;'S%^;'S;=`%o<%lO%^XJSUoWOy%^z#W%^#W#XJf#X;'S%^;'S;=`%o<%lO%^XJmS!`PoWOy%^z;'S%^;'S;=`%o<%lO%^XJ|UOy%^z#f%^#f#gJf#g;'S%^;'S;=`%o<%lO%^XKeS!RPOy%^z;'S%^;'S;=`%o<%lO%^_KvS!QVOy%^z;'S%^;'S;=`%o<%lO%^ZLXU!PPOy%^z!_%^!_!`6y!`;'S%^;'S;=`%o<%lO%^WLnP;=`<%l$}",tokenizers:[sg,rg,ng,0,1,2,3],topRules:{StyleSheet:[0,4],Styles:[1,84]},specialized:[{term:95,get:t=>ag[t]||-1},{term:56,get:t=>lg[t]||-1},{term:96,get:t=>hg[t]||-1}],tokenPrec:1123});let ug=null;function dg(){if(!ug&&"object"==typeof document&&document.body){let{style:t}=document.body,e=[],i=new Set;for(let n in t)"cssText"!=n&&"cssFloat"!=n&&"string"==typeof t[n]&&(/[A-Z]/.test(n)&&(n=n.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))),i.has(n)||(e.push(n),i.add(n)));ug=e.sort().map((t=>({type:"property",label:t})))}return ug||[]}const fg=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map((t=>({type:"class",label:t}))),pg=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map((t=>({type:"keyword",label:t}))).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map((t=>({type:"constant",label:t})))),Og=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map((t=>({type:"type",label:t}))),gg=/^(\w[\w-]*|-\w[\w-]*|)$/,mg=/^-(-[\w-]*)?$/;const bg=new Ro,wg=["Declaration"];function vg(t){for(let e=t;;){if(e.type.isTop)return e;if(!(e=e.parent))return t}}function yg(t,e,i){if(e.to-e.from>4096){let n=bg.get(e);if(n)return n;let s=[],r=new Set,o=e.cursor(mo.IncludeAnonymous);if(o.firstChild())do{for(let e of yg(t,o.node,i))r.has(e.label)||(r.add(e.label),s.push(e))}while(o.nextSibling());return bg.set(e,s),s}{let n=[],s=new Set;return e.cursor().iterate((e=>{var r;if(i(e)&&e.matchContext(wg)&&":"==(null===(r=e.node.nextSibling)||void 0===r?void 0:r.name)){let i=t.sliceString(e.from,e.to);s.has(i)||(s.add(i),n.push({label:i,type:"variable"}))}})),n}}const Sg=t=>e=>{let{state:i,pos:n}=e,s=Xa(i).resolveInner(n,-1),r=s.type.isError&&s.from==s.to-1&&"-"==i.doc.sliceString(s.from,s.to);if("PropertyName"==s.name||(r||"TagName"==s.name)&&/^(Block|Styles)$/.test(s.resolve(s.to).name))return{from:s.from,options:dg(),validFor:gg};if("ValueName"==s.name)return{from:s.from,options:pg,validFor:gg};if("PseudoClassName"==s.name)return{from:s.from,options:fg,validFor:gg};if(t(s)||(e.explicit||r)&&function(t,e){var i;if(("("==t.name||t.type.isError)&&(t=t.parent||t),"ArgList"!=t.name)return!1;let n=null===(i=t.parent)||void 0===i?void 0:i.firstChild;return"Callee"==(null==n?void 0:n.name)&&"var"==e.sliceString(n.from,n.to)}(s,i.doc))return{from:t(s)||r?s.from:n,options:yg(i.doc,vg(s),t),validFor:mg};if("TagName"==s.name){for(let{parent:t}=s;t;t=t.parent)if("Block"==t.name)return{from:s.from,options:dg(),validFor:gg};return{from:s.from,options:Og,validFor:gg}}if(!e.explicit)return null;let o=s.resolve(n),a=o.childBefore(n);return a&&":"==a.name&&"PseudoClassSelector"==o.name?{from:n,options:fg,validFor:gg}:a&&":"==a.name&&"Declaration"==o.name||"ArgList"==o.name?{from:n,options:pg,validFor:gg}:"Block"==o.name||"Styles"==o.name?{from:n,options:dg(),validFor:gg}:null},xg=Sg((t=>"VariableName"==t.name)),kg=_a.define({name:"css",parser:cg.configure({props:[Na.add({Declaration:il()}),rl.add({"Block KeyframeList":ol})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function Qg(){return new Ua(kg,kg.data.of({autocomplete:xg}))}const $g=["_blank","_self","_top","_parent"],Pg=["ascii","utf-8","utf-16","latin1","latin1"],Cg=["get","post","put","delete"],_g=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Xg=["true","false"],Zg={},Ag={a:{attrs:{href:null,ping:null,type:null,media:null,target:$g,hreflang:null}},abbr:Zg,address:Zg,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Zg,aside:Zg,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Zg,base:{attrs:{href:null,target:$g}},bdi:Zg,bdo:Zg,blockquote:{attrs:{cite:null}},body:Zg,br:Zg,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Zg,center:Zg,cite:Zg,code:Zg,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:Zg,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Zg,div:Zg,dl:Zg,dt:Zg,em:Zg,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Zg,figure:Zg,footer:Zg,form:{attrs:{action:null,name:null,"accept-charset":Pg,autocomplete:["on","off"],enctype:_g,method:Cg,novalidate:["novalidate"],target:$g}},h1:Zg,h2:Zg,h3:Zg,h4:Zg,h5:Zg,h6:Zg,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Zg,hgroup:Zg,hr:Zg,html:{attrs:{manifest:null}},i:Zg,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:Zg,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Zg,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:Zg,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Pg,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:Zg,noscript:Zg,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:Zg,param:{attrs:{name:null,value:null}},pre:Zg,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Zg,rt:Zg,ruby:Zg,samp:Zg,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Pg}},section:Zg,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Zg,source:{attrs:{src:null,type:null,media:null}},span:Zg,strong:Zg,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Zg,summary:Zg,sup:Zg,table:Zg,tbody:Zg,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Zg,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:Zg,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Zg,time:{attrs:{datetime:null}},title:Zg,tr:Zg,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Zg,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:Zg},Tg={accesskey:null,class:null,contenteditable:Xg,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Xg,autocorrect:Xg,autocapitalize:Xg,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Xg,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Xg,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Xg,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Xg,"aria-hidden":Xg,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Xg,"aria-multiselectable":Xg,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Xg,"aria-relevant":null,"aria-required":Xg,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},Rg="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map((t=>"on"+t));for(let t of Rg)Tg[t]=null;class Eg{constructor(t,e){this.tags=Object.assign(Object.assign({},Ag),t),this.globalAttrs=Object.assign(Object.assign({},Tg),e),this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}function Vg(t,e,i=t.length){if(!e)return"";let n=e.firstChild,s=n&&n.getChild("TagName");return s?t.sliceString(s.from,Math.min(s.to,i)):""}function Mg(t,e=!1){for(let i=t.parent;i;i=i.parent)if("Element"==i.name){if(!e)return i;e=!1}return null}function Dg(t,e,i){let n=i.tags[Vg(t,Mg(e,!0))];return(null==n?void 0:n.children)||i.allTags}function Wg(t,e){let i=[];for(let n=e;n=Mg(n);){let s=Vg(t,n);if(s&&"CloseTag"==n.lastChild.name)break;s&&i.indexOf(s)<0&&("EndTag"==e.name||e.from>=n.firstChild.to)&&i.push(s)}return i}Eg.default=new Eg;const Ug=/^[:\-\.\w\u00b7-\uffff]*$/;function Yg(t,e,i,n,s){let r=/\s*>/.test(t.sliceDoc(s,s+5))?"":">";return{from:n,to:s,options:Dg(t.doc,i,e).map((t=>({label:t,type:"type"}))).concat(Wg(t.doc,i).map(((t,e)=>({label:"/"+t,apply:"/"+t+r,type:"type",boost:99-e})))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function qg(t,e,i,n){let s=/\s*>/.test(t.sliceDoc(n,n+5))?"":">";return{from:i,to:n,options:Wg(t.doc,e).map(((t,e)=>({label:t,apply:t+s,type:"type",boost:99-e}))),validFor:Ug}}function Lg(t,e){let{state:i,pos:n}=e,s=Xa(i).resolveInner(n),r=s.resolve(n,-1);for(let t,e=n;s==r&&(t=r.childBefore(e));){let i=t.lastChild;if(!i||!i.type.isError||i.from({label:t,type:"property"}))),validFor:Ug}}(i,t,r,"AttributeName"==r.name?r.from:n,n):"Is"==r.name||"AttributeValue"==r.name||"UnquotedAttributeValue"==r.name?function(t,e,i,n,s){var r;let o,a=null===(r=i.parent)||void 0===r?void 0:r.getChild("AttributeName"),l=[];if(a){let r=t.sliceDoc(a.from,a.to),h=e.globalAttrs[r];if(!h){let n=Mg(i),s=n?e.tags[Vg(t.doc,n)]:null;h=(null==s?void 0:s.attrs)&&s.attrs[r]}if(h){let e=t.sliceDoc(n,s).toLowerCase(),i='"',r='"';/^['"]/.test(e)?(o='"'==e[0]?/^[^"]*$/:/^[^']*$/,i="",r=t.sliceDoc(s,s+1)==e[0]?"":e[0],e=e.slice(1),n++):o=/^[^\s<>='"]*$/;for(let t of h)l.push({label:t,apply:i+t+r,type:"constant"})}}return{from:n,to:s,options:l,validFor:o}}(i,t,r,"Is"==r.name?n:r.from,n):!e.explicit||"Element"!=s.name&&"Text"!=s.name&&"Document"!=s.name?null:function(t,e,i,n){let s=[],r=0;for(let n of Dg(t.doc,i,e))s.push({label:"<"+n,type:"type"});for(let e of Wg(t.doc,i))s.push({label:"",type:"type",boost:99-r++});return{from:n,to:n,options:s,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}(i,t,r,n)}function zg(t){let{extraTags:e,extraGlobalAttributes:i}=t,n=i||e?new Eg(e,i):Eg.default;return t=>Lg(n,t)}const Ig=[{tag:"script",attrs:t=>"text/typescript"==t.type||"ts"==t.lang,parser:zf.parser},{tag:"script",attrs:t=>"text/babel"==t.type||"text/jsx"==t.type,parser:If.parser},{tag:"script",attrs:t=>"text/typescript-jsx"==t.type,parser:Bf.parser},{tag:"script",attrs:t=>!t.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(t.type),parser:qf.parser},{tag:"style",attrs:t=>(!t.lang||"css"==t.lang)&&(!t.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(t.type)),parser:kg.parser}],Bg=[{name:"style",parser:kg.parser.configure({top:"Styles"})}].concat(Rg.map((t=>({name:t,parser:qf.parser})))),jg=_a.define({name:"html",parser:FO.configure({props:[Na.add({Element(t){let e=/^(\s*)(<\/)?/.exec(t.textAfter);return t.node.to<=t.pos+e[0].length?t.continue():t.lineIndent(t.node.from)+(e[2]?0:t.unit)},"OpenTag CloseTag SelfClosingTag":t=>t.column(t.node.from)+t.unit,Document(t){if(t.pos+/\s*/.exec(t.textAfter)[0].lengtht.getChild("TagName")})],wrap:tg(Ig,Bg)}),languageData:{commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-._"}});function Ng(t={}){let e,i="";!1===t.matchClosingTags&&(i="noMatch"),!0===t.selfClosingTags&&(i=(i?i+" ":"")+"selfClosing"),(t.nestedLanguages&&t.nestedLanguages.length||t.nestedAttributes&&t.nestedAttributes.length)&&(e=tg((t.nestedLanguages||[]).concat(Ig),(t.nestedAttributes||[]).concat(Bg)));let n=e||i?jg.configure({dialect:i,wrap:e}):jg;return new Ua(n,[jg.data.of({autocomplete:zg(t)}),!1!==t.autoCloseTags?Fg:[],Nf().support,Qg().support])}const Gg=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),Fg=Ts.inputHandler.of(((t,e,i,n)=>{if(t.composing||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!jg.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((e=>{var i,r,o;let a,{head:l}=e,h=Xa(s).resolveInner(l,-1);if("TagName"!=h.name&&"StartTag"!=h.name||(h=h.parent),">"==n&&"OpenTag"==h.name){if("CloseTag"!=(null===(r=null===(i=h.parent)||void 0===i?void 0:i.lastChild)||void 0===r?void 0:r.name)&&(a=Vg(s.doc,h.parent,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`${e?"":">"}`;return{range:A.cursor(l+1),changes:{from:l+(e?1:0),insert:i}}}}else if("/"==n&&"OpenTag"==h.name){let e=h.parent,i=null==e?void 0:e.parent;if(e.from==l-1&&"CloseTag"!=(null===(o=i.lastChild)||void 0===o?void 0:o.name)&&(a=Vg(s.doc,i,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`/${a}${e?"":">"}`,n=l+i.length+(e?1:0);return{range:A.cursor(n),changes:{from:l,insert:i}}}}return{range:e}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)})),Hg=Qa({commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}}}),Jg=new ho,Kg=sO.configure({props:[rl.add((t=>!t.is("Block")||t.is("Document")||null!=tm(t)?void 0:(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to}))),Jg.add(tm),Na.add({Document:()=>null}),ka.add({Document:Hg})]});function tm(t){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(t.name);return e?+e[1]:void 0}function em(t,e){let i=t;for(;;){let t,n=i.nextSibling;if(!n||null!=(t=tm(n.type))&&t<=e)break;i=n}return i.to}const im=sl.of(((t,e,i)=>{for(let n=Xa(t).resolveInner(i,-1);n&&!(n.fromi)return{from:i,to:e}}return null}));function nm(t){return new Pa(Hg,t,[im],"markdown")}const sm=nm(Kg),rm=nm(Kg.configure([pO,mO,gO,bO]));class om{constructor(t,e,i,n,s,r,o){this.node=t,this.from=e,this.to=i,this.spaceBefore=n,this.spaceAfter=s,this.type=r,this.item=o}blank(t,e=!0){let i=this.spaceBefore+("Blockquote"==this.node.name?">":"");if(null!=t){for(;i.length0;t--)i+=" ";return i+(e?this.spaceAfter:"")}marker(t,e){let i="OrderedList"==this.node.name?String(+lm(this.item,t)[2]+e):"";return this.spaceBefore+i+this.type+this.spaceAfter}}function am(t,e){let i=[];for(let e=t;e&&"Document"!=e.name;e=e.parent)"ListItem"!=e.name&&"Blockquote"!=e.name&&"FencedCode"!=e.name||i.push(e);let n=[];for(let t=i.length-1;t>=0;t--){let s,r=i[t],o=e.lineAt(r.from),a=r.from-o.from;if("FencedCode"==r.name)n.push(new om(r,a,a,"","","",null));else if("Blockquote"==r.name&&(s=/^[ \t]*>( ?)/.exec(o.text.slice(a))))n.push(new om(r,a,a+s[0].length,"",s[1],">",null));else if("ListItem"==r.name&&"OrderedList"==r.parent.name&&(s=/^([ \t]*)\d+([.)])([ \t]*)/.exec(o.text.slice(a)))){let t=s[3],e=s[0].length;t.length>=4&&(t=t.slice(0,t.length-4),e-=4),n.push(new om(r.parent,a,a+e,s[1],t,s[2],r))}else if("ListItem"==r.name&&"BulletList"==r.parent.name&&(s=/^([ \t]*)([-+*])([ \t]{1,4}\[[ xX]\])?([ \t]+)/.exec(o.text.slice(a)))){let t=s[4],e=s[0].length;t.length>4&&(t=t.slice(0,t.length-4),e-=4);let i=s[2];s[3]&&(i+=s[3].replace(/[xX]/," ")),n.push(new om(r.parent,a,a+e,s[1],t,i,r))}}return n}function lm(t,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(t.from,t.from+10))}function hm(t,e,i,n=0){for(let s=-1,r=t;;){if("ListItem"==r.name){let t=lm(r,e),o=+t[2];if(s>=0){if(o!=s+1)return;i.push({from:r.from+t[1].length,to:r.from+t[0].length,insert:String(s+2+n)})}s=o}let t=r.nextSibling;if(!t)break;r=t}}function cm(t){return"QuoteMark"==t.name||"ListMark"==t.name}const um=[{key:"Enter",run:({state:t,dispatch:e})=>{let i=Xa(t),{doc:n}=t,s=null,r=t.changeByRange((e=>{if(!e.empty||!rm.isActiveAt(t,e.from))return s={range:e};let r=e.from,o=n.lineAt(r),a=am(i.resolveInner(r,-1),n);for(;a.length&&a[a.length-1].from>r-o.from;)a.pop();if(!a.length)return s={range:e};let l=a[a.length-1];if(l.to-l.spaceAfter.length>r-o.from)return s={range:e};let h=r>=l.to-l.spaceAfter.length&&!/\S/.test(o.text.slice(l.to));if(l.item&&h){if(l.node.firstChild.to>=r||o.from>0&&!/[^\s>]/.test(n.lineAt(o.from-1).text)){let t,e=a.length>1?a[a.length-2]:null,i="";e&&e.item?(t=o.from+e.from,i=e.marker(n,1)):t=o.from+(e?e.to:0);let s=[{from:t,to:r,insert:i}];return"OrderedList"==l.node.name&&hm(l.item,n,s,-2),e&&"OrderedList"==e.node.name&&hm(e.item,n,s),{range:A.cursor(t+i.length),changes:s}}{let e="";for(let t=0,i=a.length-2;t<=i;t++)e+=a[t].blank(t\s*$/.exec(i.text);if(s&&s.index==l.from){let n=t.changes([{from:i.from+s.index,to:i.to},{from:o.from+l.from,to:o.to}]);return{range:e.map(n),changes:n}}}let c=[];"OrderedList"==l.node.name&&hm(l.item,n,c);let u=l.item&&l.item.from]*/.exec(o.text)[0].length>=l.to)for(let t=0,e=a.length-1;t<=e;t++)d+=t!=e||u?a[t].blank(to.from&&/\s/.test(o.text.charAt(f-o.from-1));)f--;return d=t.lineBreak+d,c.push({from:f,to:r,insert:d}),{range:A.cursor(f+d.length),changes:c}}));return!s&&(e(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0)}},{key:"Backspace",run:({state:t,dispatch:e})=>{let i=Xa(t),n=null,s=t.changeByRange((e=>{let s=e.from,{doc:r}=t;if(e.empty&&rm.isActiveAt(t,e.from)){let t=r.lineAt(s),n=am(function(t,e){let i=t.resolveInner(e,-1),n=e;cm(i)&&(n=i.from,i=i.parent);for(let t;t=i.childBefore(n);)if(cm(t))n=t.from;else{if("OrderedList"!=t.name&&"BulletList"!=t.name)break;i=t.lastChild,n=i.to}return i}(i,s),r);if(n.length){let i=n[n.length-1],r=i.to-i.spaceAfter.length+(i.spaceAfter?1:0);if(s-t.from>r&&!/\S/.test(t.text.slice(r,s-t.from)))return{range:A.cursor(t.from+r),changes:{from:t.from+r,to:s}};if(s-t.from==r&&(!i.item||t.from<=i.item.from||!/\S/.test(t.text.slice(0,i.to)))){let n=t.from+i.from;if(i.item&&i.node.fromt.from-e.from||t.startSide-e.startSide)),ni.set(i)}getMatchingBracket(t){switch(t){case")":return"(";case"]":return"[";case"}":return"{";default:return null}}},{decorations:t=>t.decorations});var fm="[a-zA-Z\\$][a-zA-Z0-9\\$]*",pm="(?:\\.\\d+|\\d+\\.\\d*|\\d+)",Om="(?:`(?:`?"+pm+")?)",gm=new RegExp("(?:(?:\\d+)(?:\\^\\^(?:\\.\\w+|\\w+\\.\\w*|\\w+)"+Om+"?(?:\\*\\^[+-]?\\d+)?))"),mm=new RegExp("(?:"+pm+Om+"?(?:\\*\\^[+-]?\\d+)?)"),bm=new RegExp("(?:`?)(?:"+fm+")(?:`(?:"+fm+"))*(?:`?)");let wm=[];const vm=["True","False","All","None","Null","Full","$Failed","$Aborted"];function ym(t,e){var i;return'"'===(i=t.next())?(e.tokenize=Sm,e.tokenize(t,e)):"("===i&&t.eat("*")?(e.commentLevel++,e.tokenize=xm,e.tokenize(t,e)):(t.backUp(1),t.match(gm,!0,!1)||t.match(mm,!0,!1)?"number":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::usage)/,!0,!1)?"meta":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::[a-zA-Z\$][a-zA-Z0-9\$]*):?/,!0,!1)?"string.special":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*\s*:)(?:(?:[a-zA-Z\$][a-zA-Z0-9\$]*)|(?:[^:=>~@\^\&\*\)\[\]'\?,\|])).*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+/,!0,!1)||t.match(/_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)?"variableName.special":t.match(/\\\[[a-zA-Z\$][a-zA-Z0-9\$]*\]/,!0,!1)?"character":t.match(/(?:\[|\]|{|}|\(|\))/,!0,!1)?"bracket":t.match(/(?:#[a-zA-Z\$][a-zA-Z0-9\$]*|#+[0-9]?)/,!0,!1)?"variableName.constant":t.match(bm,!0,!1)?vm.indexOf(t.current())>-1?"number":wm.indexOf(t.current())>-1||0==wm.length?"keyword":t.current()in e.localVars?"atom":(e.localVars[t.current()]=!0,"function"):t.match(/(?:\\|\+|\-|\*|\/|,|;|\.|:|@|~|=|>|<|&|\||_|`|'|\^|\?|!|%)/,!0,!1)?"operator":(t.next(),"error"))}function Sm(t,e){for(var i,n=!1,s=!1;null!=(i=t.next());){if('"'===i&&!s){n=!0;break}s=!s&&"\\"===i}return n&&!s&&(e.tokenize=ym),"string"}function xm(t,e){for(var i,n;e.commentLevel>0&&null!=(n=t.next());)"("===i&&"*"===n&&e.commentLevel++,"*"===i&&")"===n&&e.commentLevel--,i=n;return e.commentLevel<=0&&(e.tokenize=ym),"comment"}const km={name:"mathematica",extendVariables:function(t){},startState:function(){return{tokenize:ym,commentLevel:0,localVars:{}}},token:function(t,e){return t.eatSpace()?null:e.tokenize(t,e)},languageData:{commentTokens:{block:{open:"(*",close:"*)"}}}};let Qm={of:t=>[Gl.define(km),Yd({override:[async e=>function(t,e){let i=t.matchBefore(/\w*/);return i.from!==i.to||t.explicit?{from:i.from,options:e.data}:null}(e,t)]}),Ys.of([{key:"Escape",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((t=>{let{from:e,to:i}=t;return{changes:{from:e,to:i,insert:"EC"},range:A.cursor(e+2)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])],reBuild:t=>{wm=t.map((t=>t.label))}};const $m=(t,e,i,n)=>{if(0==t.length)return;const s=(new Date).valueOf();let r=0;i.dom.loadingMark=!0;const o=i.dom.style.background;let a=0;console.log("Start animation");const l=setInterval((()=>{i.dom.style.setProperty("background","hsl("+a+"deg 100% 97%)","important"),a+=2,a>360&&(a=0)}),30);n.transaction(e,i,s,t.length);for(const a of t)Pm(a,((a,h)=>{n.file(e,i,s,a,h),r++,r>=t.length&&i.dom&&i.dom.loadingMark&&(i.dom.loadingMark=!1,setTimeout((()=>{i.dom.style.background=o,clearInterval(l),console.log("Stop animation")}),2e3))}),(()=>{console.warn("Fauilure");const t=i.dom.style.background;i.dom.style.background="rgb(255 189 189 / 97%)";let e=97;const n=setInterval((()=>{i.dom.style.background="rgb(255 189 189 / "+Math.round(e)+"%)",e*=.95}),30);clearInterval(l),setTimeout((()=>{clearInterval(n),i.dom.style.background=t}),3e3)}))};function Pm(t,e,i){const n=new FileReader;n.addEventListener("load",(n=>{const s=n.target.result;if(s.byteLength/1024/1024>15)return alert("Files > 15Mb are not supported for drag and drop"),void i();let r=base64ArrayBuffer(s);e(t.name,r)})),n.addEventListener("progress",(t=>{if(t.loaded&&t.total){const e=t.loaded/t.total*100;console.log(e)}})),n.readAsArrayBuffer(t)}const Cm=(t,e)=>Ts.domEventHandlers({drop(e,i){e.preventDefault();const n=[];e.dataTransfer.items?[...e.dataTransfer.items].forEach(((t,e)=>{if("file"===t.kind){const i=t.getAsFile();console.log(`… file[${e}].name = ${i.name}`),n.push(i)}})):[...e.dataTransfer.files].forEach(((t,e)=>{console.log(`… file[${e}].name = ${t.name}`),n.push(t)})),$m(n,e,i,t)},paste(t,i){let n=t.clipboardData||window.clipboardData;for(const s of n.items)if("string"===s.kind)switch(s.type){case"text/plain":break;case"image/png":t.preventDefault(),$m([s.getAsFile()],t,i,e)}else t.preventDefault(),$m([s.getAsFile()],t,i,e)}}),_m=new pr({regexp:/\\\[(\w+)\]/g,decoration:t=>ni.replace({widget:new Zm(t[1])})}),Xm=_i.fromClass(class{constructor(t){this.Greekholder=_m.createDeco(t)}update(t){this.Greekholder=_m.updateDeco(t,this.Greekholder)}},{decorations:t=>t.Greekholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Greekholder||ni.none))});class Zm extends ei{constructor(t){super(),this.name=t}eq(t){return this.name===t.name}toDOM(){let t=document.createElement("span");return t.innerHTML="&"+this.name.toLowerCase().replace("sqrt","radic").replace("undirectededge","harr").replace("directededge","rarr").replace(/capital(.*)/,((t,e)=>e.charAt(0).toUpperCase()+e.slice(1))).replace(/curly(.*)/,((t,e)=>e)).replace(/script(.*)/,((t,e)=>"el"+e.toLowerCase())).replace("transpose","#7488").replace("degree","deg")+";",t}ignoreEvent(){return!1}}const Am=new pr({regexp:/(->|<-)/g,decoration:t=>ni.replace({widget:new Tm(t[1])})});_i.fromClass(class{constructor(t){this.Arrowholder=Am.createDeco(t)}update(t){this.Arrowholder=Am.updateDeco(t,this.Arrowholder)}},{decorations:t=>t.Arrowholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Arrowholder||ni.none))});class Tm extends ei{constructor(t){super(),this.dir=t}eq(t){return this.dir===t.dir}toDOM(){let t=document.createElement("span");return"->"===this.dir?t.innerText="→":t.innerText="←",t}ignoreEvent(){return!1}}function Rm(t){if(!(t=t||{}).open)throw new Error('Balanced: please provide a "open" property');if(!t.close)throw new Error('Balanced: please provide a "close" property');if(this.balance=t.balance||!1,this.exceptions=t.exceptions||!1,this.caseInsensitive=t.caseInsensitive,this.head=t.head||t.open,this.head=Array.isArray(this.head)?this.head:[this.head],this.open=Array.isArray(t.open)?t.open:[t.open],this.close=Array.isArray(t.close)?t.close:[t.close],!Array.isArray(this.head)||!Array.isArray(this.open)||!Array.isArray(this.close)||this.head.length!==this.open.length||this.open.length!==this.close.length)throw new Error('Balanced: if you use arrays for a "head,open,close" you must use matching arrays for all options');var e=Dm(this.head.map(this.regExpFromArrayGroupedMap,this)),i=Dm(this.open.map(this.regExpFromArrayGroupedMap,this)),n=Dm(this.close.map(this.regExpFromArrayGroupedMap,this));this.regExp=Dm([e,i,n],"g"+(this.caseInsensitive?"i":"")),this.regExpGroupLength=this.head.length}function Em(t,e,i){for(var n=Mm(e.substr(0,i+1),/^.*\n?$/gim),s=Mm(e,/^.*\n?$/gim),r=n.length-1,o=i+1-(n.length?n[n.length-1].index:0),a="",l=2;l>=0;l--)r-l>=0&&s[r-l]&&(a+=e.substr(s[r-l].index,s[r-l].length)+"\n");for(l=0;l=0&&s[r+l]&&(a+=e.substr(s[r+l].index,s[r+l].length)+"\n");a=a.replace(/\t/g," ").replace(/\n$/,"");var h=new Error(t+" at "+(r+1)+":"+o+"\n\n"+a);return h.line=r+1,h.column=o,h.index=i,h}function Vm(t,e){return t>=e.index&&t<=e.index+e.length-1}function Mm(t,e){var i,n=new RegExp(e),s=[];if(t)for(;i=n.exec(t);)s.push({index:i.index,length:i[0].length,match:i[0]}),i[0].length||n.lastIndex++;return s}function Dm(t,e,i){var n=t.map((function(t){return t instanceof RegExp?t.source:function(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}(t)}),this).join("|");return n=i?"("+n+")":"(?:"+n+")",new RegExp(n,e||void 0)}Rm.prototype={regExpFromArrayGroupedMap:function(t){return Dm([t],null,!0)},matchContentsInBetweenBrackets:function(t,e){for(var i,n=new RegExp(this.regExp),s=[],r=[],o=null,a=!0;i=n.exec(t);){if(e){for(var l=!1,h=0;h{const i=((t,e,i)=>{var n,s=new RegExp(t),r=[];if(e)for(;n=s.exec(e);){if(i){for(var o=!1,a=0;a{new qm({open:"(*"+t+"[*)",close:"(*]"+t+"*)",balance:!1}).matchContentsInBetweenBrackets(e.value,[]).forEach((function(t){const s=e.value.slice(t.index+t.head.length,t.index+t.length-t.tail.length);n(i+t.index,{length:t.length,pos:i+t.index,argsPos:i+t.index+t.head.length,str:s})}))})(e,t,i,s)},o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)r(o,a)}var Im,Bm=function(){function t(t){var e=t.tag,i=t.decoration,n=t.decorate,s=t.boundary,r=t.maxLength,o=void 0===r?1e3:r;if(this.tag=e,n)this.addMatch=function(t,e,i,s){return n(s,i,i+t.length,t,e)};else if("function"==typeof i)this.addMatch=function(t,e,n,s){var r=i(t,e,n);r&&s(n,n+t.length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=function(t,e,n,s){return s(n,n+t.length,i)}}this.boundary=s,this.maxLength=o}return t.prototype.createDeco=function(t){for(var e=this,i=new Xt,n=i.add.bind(i),s=0,r=function(t,e){var i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;for(var n=[],s=0,r=i;s=a?n[n.length-1].to=l:n.push({from:a,to:l})}return n}(t,this.maxLength);st.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e},t.prototype.updateRange=function(t,e,i,n){for(var s=this,r=function(r){var a=Math.max(r.from,i),l=Math.min(r.to,n);if(l>a){var h=t.state.doc.lineAt(a),c=h.toh.from;a--)if(o.boundary.test(h.text[a-1-h.from])){u=a;break}for(;ld},add:f})}},o=this,a=0,l=t.visibleRanges;a{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*FB[*)((_)(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*FB[*)(("+s+")(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let Nm=class{constructor(t,e,i,n,s,r){this.view=e,this.visibleValue=t,this.placeholder=r,console.log(r),this.args=Lm(t.str,/\(\*,\*\)/gm);const o=this;let a,l;console.log("creating InstanceWidget"),a=Im({doc:o.args[0].body.slice(2,-1),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(o.visibleValue.pos),e.dispatch({selection:{anchor:o.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return l.dispatch({selection:{anchor:0}}),l.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){l.focus(),t.editorLastCursor=void 0}}])]}),l=Im({doc:o.args[2].body.slice(1,-2),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:a.state.doc.length}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:o.visibleValue.pos+o.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus(),t.editorLastCursor=void 0}}])]}),o.args[0].length=o.args[0].body.length,o.args[2].length=o.args[2].body.length,delete o.args[2].body,delete o.args[1].body,delete o.args[0].body,this.topEditor=a,this.bottomEditor=l}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="(("+t+")",s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length));const r=e.length-i[0].length;i[0].to=i[0].to+r,i[2].from=i[2].from+r,i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e="("+t+"))",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length));const r=e.length-i[2].length;i[2].to=i[2].to+r,i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t,e){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm),console.log("recreating InstanceWidget"),n=Im.state({doc:e.args[0].body.slice(2,-1),update:t=>e.applyChanges(t,0),eval:()=>{i.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(e.visibleValue.pos),i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus(),t.editorLastCursor=void 0}}])]}),s=Im.state({doc:e.args[2].body.slice(1,-2),update:t=>e.applyChanges(t,2),eval:()=>{e.view.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus(),t.editorLastCursor=void 0}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),console.log(e),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.placeholder=e,this.visibleValue.argsPos=t.argsPos}destroy(){this.topEditor.destroy(),this.bottomEditor.destroy()}},Gm=class extends ei{constructor(t,e,i,n){super(),this.view=i,this.visibleValue=t,this.reference=e,this.placeholder=n}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue,this),!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("fraction");const i=document.createElement("table");i.classList.add("container"),e.appendChild(i);const n=document.createElement("tbody");i.appendChild(n);const s=document.createElement("tr"),r=document.createElement("tr");n.appendChild(s),n.appendChild(r);const o=document.createElement("td");o.classList.add("enumenator"),s.appendChild(o);const a=document.createElement("td");r.appendChild(a);const l=this;return e.EditorWidget=new Nm(this.visibleValue,t,o,a,[],this),this.DOMElement=e,this.reference.push({destroy:()=>{l.destroy(e)}}),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const Fm=(t,e,i)=>new Bm({tag:"FB",decoration:n=>ni.replace({widget:new Gm(n,t,e,i)})}),Hm=t=>_i.fromClass(class{constructor(e){this.disposable=[],this.placeholder=Fm(this.disposable,e,this).createDeco(e),t.placeholder=this}update(t){this.placeholder=Fm(this.disposable,t,this).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var Jm;function Km(t){return Jm=t,[nb,Ys.of([{key:"Ctrl-2",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt[_](*]SqB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt["+s+"](*]SqB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let tb=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;this.sliceRanges=n,this.length=t.str.length,console.log("creating InstanceWidget"),this.editor=Jm({doc:t.str.slice(...n),parent:i,update:t=>r.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]})}applyChanges(t){const e=t,i={from:this.visibleValue.argsPos+5,to:this.visibleValue.argsPos+this.length-1,insert:e};console.log(this.visibleValue);const n=e.length+6-this.length;this.length=this.length+n,this.visibleValue.length=this.visibleValue.length+n,this.visibleValue.str="Sqrt["+e+"]",this.view.dispatch({changes:i})}update(t){if(this.visibleValue.str==t.str)this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos;else{console.warn("Out of sync"),this.visibleValue=t;const e=this.sliceRanges,i=this.editor,n=this,s=this.view;this.length=t.str.length;const r=Jm.state({doc:t.str.slice(...e),update:t=>n.applyChanges(t),eval:()=>{s.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos+n.visibleValue.length}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]});i.setState(r)}}destroy(){console.warn("destroy Instance of Widget!"),this.editor.destroy()}},eb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("sqroot");const i=this,n=document.createElement("span");return n.classList.add("radicand"),e.EditorWidget=new tb(this.visibleValue,t,n,[5,-1],[]),e.appendChild(n),this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const ib=(t,e)=>new Bm({tag:"SqB",decoration:i=>ni.replace({widget:new eb(i,t,e)})}),nb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=ib(this.disposable,t).createDeco(t)}update(t){this.placeholder=ib(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var sb;function rb(t){return sb=t,[hb,Ys.of([{key:"Ctrl--",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SbB[*)Subscript[_(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SbB[*)Subscript["+s+"(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let ob=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),console.log(r.visibleValue),o=sb({doc:r.args[0].body.slice(10),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){a.focus()}}])]}),a=sb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Subscript["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),console.log(e.visibleValue),n=sb.state({doc:e.args[0].body.slice(10),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus()}}])]}),s=sb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},ab=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sub");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new ob(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const lb=(t,e)=>new Bm({tag:"SbB",decoration:i=>ni.replace({widget:new ab(i,t,e)})}),hb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=lb(this.disposable,t).createDeco(t)}update(t){this.placeholder=lb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var cb;function ub(t){return cb=t,[Ob,Ys.of([{key:"Ctrl-6",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SpB[*)Power[_(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SpB[*)Power["+s+"(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let db=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),o=cb({doc:r.args[0].body.slice(6),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus()}}])]}),a=cb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Power["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),n=cb.state({doc:e.args[0].body.slice(6),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.bottomEditor.focus()}}])]}),s=cb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},fb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sup");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new db(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}destroy(t){t.EditorWidget.destroy()}};const pb=(t,e)=>new Bm({tag:"SpB",decoration:i=>ni.replace({widget:new fb(i,t,e)})}),Ob=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=pb(this.disposable,t).createDeco(t)}update(t){this.placeholder=pb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var gb={},mb={},bb={},wb={};function vb(t){let e=t.length;for(;--e>=0;)t[e]=0}const yb=256,Sb=286,xb=30,kb=15,Qb=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),$b=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Pb=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Cb=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_b=new Array(576);vb(_b);const Xb=new Array(60);vb(Xb);const Zb=new Array(512);vb(Zb);const Ab=new Array(256);vb(Ab);const Tb=new Array(29);vb(Tb);const Rb=new Array(xb);function Eb(t,e,i,n,s){this.static_tree=t,this.extra_bits=e,this.extra_base=i,this.elems=n,this.max_length=s,this.has_stree=t&&t.length}let Vb,Mb,Db;function Wb(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}vb(Rb);const Ub=t=>t<256?Zb[t]:Zb[256+(t>>>7)],Yb=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},qb=(t,e,i)=>{t.bi_valid>16-i?(t.bi_buf|=e<>16-t.bi_valid,t.bi_valid+=i-16):(t.bi_buf|=e<{qb(t,i[2*e],i[2*e+1])},zb=(t,e)=>{let i=0;do{i|=1&t,t>>>=1,i<<=1}while(--e>0);return i>>>1},Ib=(t,e,i)=>{const n=new Array(16);let s,r,o=0;for(s=1;s<=kb;s++)o=o+i[s-1]<<1,n[s]=o;for(r=0;r<=e;r++){let e=t[2*r+1];0!==e&&(t[2*r]=zb(n[e]++,e))}},Bb=t=>{let e;for(e=0;e{t.bi_valid>8?Yb(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},Nb=(t,e,i,n)=>{const s=2*e,r=2*i;return t[s]{const n=t.heap[i];let s=i<<1;for(;s<=t.heap_len&&(s{let n,s,r,o,a=0;if(0!==t.sym_next)do{n=255&t.pending_buf[t.sym_buf+a++],n+=(255&t.pending_buf[t.sym_buf+a++])<<8,s=t.pending_buf[t.sym_buf+a++],0===n?Lb(t,s,e):(r=Ab[s],Lb(t,r+yb+1,e),o=Qb[r],0!==o&&(s-=Tb[r],qb(t,s,o)),n--,r=Ub(n),Lb(t,r,i),o=$b[r],0!==o&&(n-=Rb[r],qb(t,n,o)))}while(a{const i=e.dyn_tree,n=e.stat_desc.static_tree,s=e.stat_desc.has_stree,r=e.stat_desc.elems;let o,a,l,h=-1;for(t.heap_len=0,t.heap_max=573,o=0;o>1;o>=1;o--)Gb(t,i,o);l=r;do{o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Gb(t,i,1),a=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=a,i[2*l]=i[2*o]+i[2*a],t.depth[l]=(t.depth[o]>=t.depth[a]?t.depth[o]:t.depth[a])+1,i[2*o+1]=i[2*a+1]=l,t.heap[1]=l++,Gb(t,i,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const i=e.dyn_tree,n=e.max_code,s=e.stat_desc.static_tree,r=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,l=e.stat_desc.max_length;let h,c,u,d,f,p,O=0;for(d=0;d<=kb;d++)t.bl_count[d]=0;for(i[2*t.heap[t.heap_max]+1]=0,h=t.heap_max+1;h<573;h++)c=t.heap[h],d=i[2*i[2*c+1]+1]+1,d>l&&(d=l,O++),i[2*c+1]=d,c>n||(t.bl_count[d]++,f=0,c>=a&&(f=o[c-a]),p=i[2*c],t.opt_len+=p*(d+f),r&&(t.static_len+=p*(s[2*c+1]+f)));if(0!==O){do{for(d=l-1;0===t.bl_count[d];)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[l]--,O-=2}while(O>0);for(d=l;0!==d;d--)for(c=t.bl_count[d];0!==c;)u=t.heap[--h],u>n||(i[2*u+1]!==d&&(t.opt_len+=(d-i[2*u+1])*i[2*u],i[2*u+1]=d),c--)}})(t,e),Ib(i,h,t.bl_count)},Jb=(t,e,i)=>{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),e[2*(i+1)+1]=65535,n=0;n<=i;n++)s=o,o=e[2*(n+1)+1],++a{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),n=0;n<=i;n++)if(s=o,o=e[2*(n+1)+1],!(++a{qb(t,0+(n?1:0),3),jb(t),Yb(t,i),Yb(t,~i),i&&t.pending_buf.set(t.window.subarray(e,e+i),t.pending),t.pending+=i};wb._tr_init=t=>{tw||((()=>{let t,e,i,n,s;const r=new Array(16);for(i=0,n=0;n<28;n++)for(Tb[n]=i,t=0;t<1<>=7;n{let s,r,o=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e{let e;for(Jb(t,t.dyn_ltree,t.l_desc.max_code),Jb(t,t.dyn_dtree,t.d_desc.max_code),Hb(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*Cb[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=i+5,i+4<=s&&-1!==e?ew(t,e,i,n):4===t.strategy||r===s?(qb(t,2+(n?1:0),3),Fb(t,_b,Xb)):(qb(t,4+(n?1:0),3),((t,e,i,n)=>{let s;for(qb(t,e-257,5),qb(t,i-1,5),qb(t,n-4,4),s=0;s(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=i,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(Ab[i]+yb+1)]++,t.dyn_dtree[2*Ub(e)]++),t.sym_next===t.sym_end),wb._tr_align=t=>{qb(t,2,3),Lb(t,256,_b),(t=>{16===t.bi_valid?(Yb(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)};var iw=(t,e,i,n)=>{let s=65535&t|0,r=t>>>16&65535|0,o=0;for(;0!==i;){o=i>2e3?2e3:i,i-=o;do{s=s+e[n++]|0,r=r+s|0}while(--o);s%=65521,r%=65521}return s|r<<16|0};const nw=new Uint32Array((()=>{let t,e=[];for(var i=0;i<256;i++){t=i;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e})());var sw=(t,e,i,n)=>{const s=nw,r=n+i;t^=-1;for(let i=n;i>>8^s[255&(t^e[i])];return-1^t},rw={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},ow={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:aw,_tr_stored_block:lw,_tr_flush_block:hw,_tr_tally:cw,_tr_align:uw}=wb,dw=iw,fw=sw,pw=rw,{Z_NO_FLUSH:Ow,Z_PARTIAL_FLUSH:gw,Z_FULL_FLUSH:mw,Z_FINISH:bw,Z_BLOCK:ww,Z_OK:vw,Z_STREAM_END:yw,Z_STREAM_ERROR:Sw,Z_DATA_ERROR:xw,Z_BUF_ERROR:kw,Z_DEFAULT_COMPRESSION:Qw,Z_FILTERED:$w,Z_HUFFMAN_ONLY:Pw,Z_RLE:Cw,Z_FIXED:_w,Z_DEFAULT_STRATEGY:Xw,Z_UNKNOWN:Zw,Z_DEFLATED:Aw}=ow,Tw=258,Rw=262,Ew=42,Vw=113,Mw=666,Dw=(t,e)=>(t.msg=pw[e],e),Ww=t=>2*t-(t>4?9:0),Uw=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Yw=t=>{let e,i,n,s=t.w_size;e=t.hash_size,n=e;do{i=t.head[--n],t.head[n]=i>=s?i-s:0}while(--e);e=s,n=e;do{i=t.prev[--n],t.prev[n]=i>=s?i-s:0}while(--e)};let qw=(t,e,i)=>(e<{const e=t.state;let i=e.pending;i>t.avail_out&&(i=t.avail_out),0!==i&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+i),t.next_out),t.next_out+=i,e.pending_out+=i,t.total_out+=i,t.avail_out-=i,e.pending-=i,0===e.pending&&(e.pending_out=0))},zw=(t,e)=>{hw(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Lw(t.strm)},Iw=(t,e)=>{t.pending_buf[t.pending++]=e},Bw=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},jw=(t,e,i,n)=>{let s=t.avail_in;return s>n&&(s=n),0===s?0:(t.avail_in-=s,e.set(t.input.subarray(t.next_in,t.next_in+s),i),1===t.state.wrap?t.adler=dw(t.adler,e,s,i):2===t.state.wrap&&(t.adler=fw(t.adler,e,s,i)),t.next_in+=s,t.total_in+=s,s)},Nw=(t,e)=>{let i,n,s=t.max_chain_length,r=t.strstart,o=t.prev_length,a=t.nice_match;const l=t.strstart>t.w_size-Rw?t.strstart-(t.w_size-Rw):0,h=t.window,c=t.w_mask,u=t.prev,d=t.strstart+Tw;let f=h[r+o-1],p=h[r+o];t.prev_length>=t.good_match&&(s>>=2),a>t.lookahead&&(a=t.lookahead);do{if(i=e,h[i+o]===p&&h[i+o-1]===f&&h[i]===h[r]&&h[++i]===h[r+1]){r+=2,i++;do{}while(h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&ro){if(t.match_start=e,o=n,n>=a)break;f=h[r+o-1],p=h[r+o]}}}while((e=u[e&c])>l&&0!=--s);return o<=t.lookahead?o:t.lookahead},Gw=t=>{const e=t.w_size;let i,n,s;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Rw)&&(t.window.set(t.window.subarray(e,e+e-n),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Yw(t),n+=e),0===t.strm.avail_in)break;if(i=jw(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=i,t.lookahead+t.insert>=3)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=qw(t,t.ins_h,t.window[s+1]);t.insert&&(t.ins_h=qw(t,t.ins_h,t.window[s+3-1]),t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead{let i,n,s,r=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,o=0,a=t.strm.avail_in;do{if(i=65535,s=t.bi_valid+42>>3,t.strm.avail_outn+t.strm.avail_in&&(i=n+t.strm.avail_in),i>s&&(i=s),i>8,t.pending_buf[t.pending-2]=~i,t.pending_buf[t.pending-1]=~i>>8,Lw(t.strm),n&&(n>i&&(n=i),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+n),t.strm.next_out),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n,t.block_start+=n,i-=n),i&&(jw(t.strm,t.strm.output,t.strm.next_out,i),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i)}while(0===o);return a-=t.strm.avail_in,a&&(a>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=a&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-a,t.strm.next_in),t.strstart),t.strstart+=a,t.insert+=a>t.w_size-t.insert?t.w_size-t.insert:a),t.block_start=t.strstart),t.high_waters&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,s+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),s>t.strm.avail_in&&(s=t.strm.avail_in),s&&(jw(t.strm,t.window,t.strstart,s),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.high_water>3,s=t.pending_buf_size-s>65535?65535:t.pending_buf_size-s,r=s>t.w_size?t.w_size:s,n=t.strstart-t.block_start,(n>=r||(n||e===bw)&&e!==Ow&&0===t.strm.avail_in&&n<=s)&&(i=n>s?s:n,o=e===bw&&0===t.strm.avail_in&&i===n?1:0,lw(t,t.block_start,i,o),t.block_start+=i,Lw(t.strm)),o?3:1)},Hw=(t,e)=>{let i,n;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==i&&t.strstart-i<=t.w_size-Rw&&(t.match_length=Nw(t,i)),t.match_length>=3)if(n=cw(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=qw(t,t.ins_h,t.window[t.strstart+1]);else n=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2},Jw=(t,e)=>{let i,n,s;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==i&&t.prev_length4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){s=t.strstart+t.lookahead-3,n=cw(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=s&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(zw(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(n=cw(t,0,t.window[t.strstart-1]),n&&zw(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=cw(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2};function Kw(t,e,i,n,s){this.good_length=t,this.max_lazy=e,this.nice_length=i,this.max_chain=n,this.func=s}const tv=[new Kw(0,0,0,0,Fw),new Kw(4,4,8,4,Hw),new Kw(4,5,16,8,Hw),new Kw(4,6,32,32,Hw),new Kw(4,4,16,16,Jw),new Kw(8,16,32,32,Jw),new Kw(8,16,128,128,Jw),new Kw(8,32,128,256,Jw),new Kw(32,128,258,1024,Jw),new Kw(32,258,258,4096,Jw)];function ev(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Aw,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Uw(this.dyn_ltree),Uw(this.dyn_dtree),Uw(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Uw(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Uw(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const iv=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==Ew&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==Vw&&e.status!==Mw?1:0},nv=t=>{if(iv(t))return Dw(t,Sw);t.total_in=t.total_out=0,t.data_type=Zw;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?Ew:Vw,t.adler=2===e.wrap?0:1,e.last_flush=-2,aw(e),vw},sv=t=>{const e=nv(t);var i;return e===vw&&((i=t.state).window_size=2*i.w_size,Uw(i.head),i.max_lazy_match=tv[i.level].max_lazy,i.good_match=tv[i.level].good_length,i.nice_match=tv[i.level].nice_length,i.max_chain_length=tv[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=2,i.match_available=0,i.ins_h=0),e},rv=(t,e,i,n,s,r)=>{if(!t)return Sw;let o=1;if(e===Qw&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),s<1||s>9||i!==Aw||n<8||n>15||e<0||e>9||r<0||r>_w||8===n&&1!==o)return Dw(t,Sw);8===n&&(n=9);const a=new ev;return t.state=a,a.strm=t,a.status=Ew,a.wrap=o,a.gzhead=null,a.w_bits=n,a.w_size=1<rv(t,e,Aw,15,8,Xw),bb.deflateInit2=rv,bb.deflateReset=sv,bb.deflateResetKeep=nv,bb.deflateSetHeader=(t,e)=>iv(t)||2!==t.state.wrap?Sw:(t.state.gzhead=e,vw),bb.deflate=(t,e)=>{if(iv(t)||e>ww||e<0)return t?Dw(t,Sw):Sw;const i=t.state;if(!t.output||0!==t.avail_in&&!t.input||i.status===Mw&&e!==bw)return Dw(t,0===t.avail_out?kw:Sw);const n=i.last_flush;if(i.last_flush=e,0!==i.pending){if(Lw(t),0===t.avail_out)return i.last_flush=-1,vw}else if(0===t.avail_in&&Ww(e)<=Ww(n)&&e!==bw)return Dw(t,kw);if(i.status===Mw&&0!==t.avail_in)return Dw(t,kw);if(i.status===Ew&&0===i.wrap&&(i.status=Vw),i.status===Ew){let e=Aw+(i.w_bits-8<<4)<<8,n=-1;if(n=i.strategy>=Pw||i.level<2?0:i.level<6?1:6===i.level?2:3,e|=n<<6,0!==i.strstart&&(e|=32),e+=31-e%31,Bw(i,e),0!==i.strstart&&(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),t.adler=1,i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(57===i.status)if(t.adler=0,Iw(i,31),Iw(i,139),Iw(i,8),i.gzhead)Iw(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),Iw(i,255&i.gzhead.time),Iw(i,i.gzhead.time>>8&255),Iw(i,i.gzhead.time>>16&255),Iw(i,i.gzhead.time>>24&255),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(Iw(i,255&i.gzhead.extra.length),Iw(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=fw(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if(Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,3),i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw;if(69===i.status){if(i.gzhead.extra){let e=i.pending,n=(65535&i.gzhead.extra.length)-i.gzindex;for(;i.pending+n>i.pending_buf_size;){let s=i.pending_buf_size-i.pending;if(i.pending_buf.set(i.gzhead.extra.subarray(i.gzindex,i.gzindex+s),i.pending),i.pending=i.pending_buf_size,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex+=s,Lw(t),0!==i.pending)return i.last_flush=-1,vw;e=0,n-=s}let s=new Uint8Array(i.gzhead.extra);i.pending_buf.set(s.subarray(i.gzindex,i.gzindex+n),i.pending),i.pending+=n,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex=0}i.status=73}if(73===i.status){if(i.gzhead.name){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),i.gzindex=0}i.status=91}if(91===i.status){if(i.gzhead.comment){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n))}i.status=103}if(103===i.status){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size&&(Lw(t),0!==i.pending))return i.last_flush=-1,vw;Iw(i,255&t.adler),Iw(i,t.adler>>8&255),t.adler=0}if(i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(0!==t.avail_in||0!==i.lookahead||e!==Ow&&i.status!==Mw){let n=0===i.level?Fw(i,e):i.strategy===Pw?((t,e)=>{let i;for(;;){if(0===t.lookahead&&(Gw(t),0===t.lookahead)){if(e===Ow)return 1;break}if(t.match_length=0,i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):i.strategy===Cw?((t,e)=>{let i,n,s,r;const o=t.window;for(;;){if(t.lookahead<=Tw){if(Gw(t),t.lookahead<=Tw&&e===Ow)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(s=t.strstart-1,n=o[s],n===o[++s]&&n===o[++s]&&n===o[++s])){r=t.strstart+Tw;do{}while(n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&st.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(i=cw(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):tv[i.level].func(i,e);if(3!==n&&4!==n||(i.status=Mw),1===n||3===n)return 0===t.avail_out&&(i.last_flush=-1),vw;if(2===n&&(e===gw?uw(i):e!==ww&&(lw(i,0,0,!1),e===mw&&(Uw(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),Lw(t),0===t.avail_out))return i.last_flush=-1,vw}return e!==bw?vw:i.wrap<=0?yw:(2===i.wrap?(Iw(i,255&t.adler),Iw(i,t.adler>>8&255),Iw(i,t.adler>>16&255),Iw(i,t.adler>>24&255),Iw(i,255&t.total_in),Iw(i,t.total_in>>8&255),Iw(i,t.total_in>>16&255),Iw(i,t.total_in>>24&255)):(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),Lw(t),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?vw:yw)},bb.deflateEnd=t=>{if(iv(t))return Sw;const e=t.state.status;return t.state=null,e===Vw?Dw(t,xw):vw},bb.deflateSetDictionary=(t,e)=>{let i=e.length;if(iv(t))return Sw;const n=t.state,s=n.wrap;if(2===s||1===s&&n.status!==Ew||n.lookahead)return Sw;if(1===s&&(t.adler=dw(t.adler,e,i,0)),n.wrap=0,i>=n.w_size){0===s&&(Uw(n.head),n.strstart=0,n.block_start=0,n.insert=0);let t=new Uint8Array(n.w_size);t.set(e.subarray(i-n.w_size,i),0),e=t,i=n.w_size}const r=t.avail_in,o=t.next_in,a=t.input;for(t.avail_in=i,t.next_in=0,t.input=e,Gw(n);n.lookahead>=3;){let t=n.strstart,e=n.lookahead-2;do{n.ins_h=qw(n,n.ins_h,n.window[t+3-1]),n.prev[t&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=t,t++}while(--e);n.strstart=t,n.lookahead=2,Gw(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,t.next_in=o,t.input=a,t.avail_in=r,n.wrap=s,vw},bb.deflateInfo="pako deflate (from Nodeca project)";var ov={};const av=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);ov.assign=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const e in i)av(i,e)&&(t[e]=i[e])}}return t},ov.flattenChunks=t=>{let e=0;for(let i=0,n=t.length;i=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;cv[254]=cv[254]=1,lv.string2buf=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,i,n,s,r,o=t.length,a=0;for(s=0;s>>6,e[r++]=128|63&i):i<65536?(e[r++]=224|i>>>12,e[r++]=128|i>>>6&63,e[r++]=128|63&i):(e[r++]=240|i>>>18,e[r++]=128|i>>>12&63,e[r++]=128|i>>>6&63,e[r++]=128|63&i);return e};lv.buf2string=(t,e)=>{const i=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let n,s;const r=new Array(2*i);for(s=0,n=0;n4)r[s++]=65533,n+=o-1;else{for(e&=2===o?31:3===o?15:7;o>1&&n1?r[s++]=65533:e<65536?r[s++]=e:(e-=65536,r[s++]=55296|e>>10&1023,r[s++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&hv)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let i="";for(let n=0;n{(e=e||t.length)>t.length&&(e=t.length);let i=e-1;for(;i>=0&&128==(192&t[i]);)i--;return i<0||0===i?e:i+cv[t[i]]>e?i:e};var uv=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const dv=bb,fv=ov,pv=lv,Ov=rw,gv=uv,mv=Object.prototype.toString,{Z_NO_FLUSH:bv,Z_SYNC_FLUSH:wv,Z_FULL_FLUSH:vv,Z_FINISH:yv,Z_OK:Sv,Z_STREAM_END:xv,Z_DEFAULT_COMPRESSION:kv,Z_DEFAULT_STRATEGY:Qv,Z_DEFLATED:$v}=ow;function Pv(t){this.options=fv.assign({level:kv,method:$v,chunkSize:16384,windowBits:15,memLevel:8,strategy:Qv},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new gv,this.strm.avail_out=0;let i=dv.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(i!==Sv)throw new Error(Ov[i]);if(e.header&&dv.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?pv.string2buf(e.dictionary):"[object ArrayBuffer]"===mv.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,i=dv.deflateSetDictionary(this.strm,t),i!==Sv)throw new Error(Ov[i]);this._dict_set=!0}}function Cv(t,e){const i=new Pv(e);if(i.push(t,!0),i.err)throw i.msg||Ov[i.err];return i.result}Pv.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize;let s,r;if(this.ended)return!1;for(r=e===~~e?e:!0===e?yv:bv,"string"==typeof t?i.input=pv.string2buf(t):"[object ArrayBuffer]"===mv.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),(r===wv||r===vv)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(s=dv.deflate(i,r),s===xv)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),s=dv.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===Sv;if(0!==i.avail_out){if(r>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},Pv.prototype.onData=function(t){this.chunks.push(t)},Pv.prototype.onEnd=function(t){t===Sv&&(this.result=fv.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},mb.Deflate=Pv,mb.deflate=Cv,mb.deflateRaw=function(t,e){return(e=e||{}).raw=!0,Cv(t,e)},mb.gzip=function(t,e){return(e=e||{}).gzip=!0,Cv(t,e)},mb.constants=ow;var _v={},Xv={};const Zv=16209;const Av=15,Tv=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Rv=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Ev=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Vv=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Mv=(t,e,i,n,s,r,o,a)=>{const l=a.bits;let h,c,u,d,f,p,O=0,g=0,m=0,b=0,w=0,v=0,y=0,S=0,x=0,k=0,Q=null;const $=new Uint16Array(16),P=new Uint16Array(16);let C,_,X,Z=null;for(O=0;O<=Av;O++)$[O]=0;for(g=0;g=1&&0===$[b];b--);if(w>b&&(w=b),0===b)return s[r++]=20971520,s[r++]=20971520,a.bits=1,0;for(m=1;m0&&(0===t||1!==b))return-1;for(P[1]=0,O=1;O852||2===t&&x>592)return 1;for(;;){C=O-y,o[g]+1=p?(_=Z[o[g]-p],X=Q[o[g]-p]):(_=96,X=0),h=1<>y)+c]=C<<24|_<<16|X|0}while(0!==c);for(h=1<>=1;if(0!==h?(k&=h-1,k+=h):k=0,g++,0==--$[O]){if(O===b)break;O=e[i+o[g]]}if(O>w&&(k&d)!==u){for(0===y&&(y=w),f+=m,v=O-y,S=1<852||2===t&&x>592)return 1;u=k&d,s[u]=w<<24|v<<16|f-r|0}}return 0!==k&&(s[f+k]=O-y<<24|64<<16|0),a.bits=w,0};const Dv=iw,Wv=sw,Uv=function(t,e){let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,y,S,x,k,Q;const $=t.state;i=t.next_in,k=t.input,n=i+(t.avail_in-5),s=t.next_out,Q=t.output,r=s-(e-t.avail_out),o=s+(t.avail_out-257),a=$.dmax,l=$.wsize,h=$.whave,c=$.wnext,u=$.window,d=$.hold,f=$.bits,p=$.lencode,O=$.distcode,g=(1<<$.lenbits)-1,m=(1<<$.distbits)-1;t:do{f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,0===w)Q[s++]=65535&b;else{if(!(16&w)){if(0==(64&w)){b=p[(65535&b)+(d&(1<>>=w,f-=w),f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,!(16&w)){if(0==(64&w)){b=O[(65535&b)+(d&(1<a){t.msg="invalid distance too far back",$.mode=Zv;break t}if(d>>>=w,f-=w,w=s-r,y>w){if(w=y-w,w>h&&$.sane){t.msg="invalid distance too far back",$.mode=Zv;break t}if(S=0,x=u,0===c){if(S+=l-w,w2;)Q[s++]=x[S++],Q[s++]=x[S++],Q[s++]=x[S++],v-=3;v&&(Q[s++]=x[S++],v>1&&(Q[s++]=x[S++]))}else{S=s-y;do{Q[s++]=Q[S++],Q[s++]=Q[S++],Q[s++]=Q[S++],v-=3}while(v>2);v&&(Q[s++]=Q[S++],v>1&&(Q[s++]=Q[S++]))}break}}break}}while(i>3,i-=v,f-=v<<3,d&=(1<(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function hy(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const cy=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode16211?1:0},uy=t=>{if(cy(t))return Nv;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Kv,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,Iv},dy=t=>{if(cy(t))return Nv;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,uy(t)},fy=(t,e)=>{let i;if(cy(t))return Nv;const n=t.state;return e<0?(i=0,e=-e):(i=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?Nv:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=i,n.wbits=e,dy(t))},py=(t,e)=>{if(!t)return Nv;const i=new hy;t.state=i,i.strm=t,i.window=null,i.mode=Kv;const n=fy(t,e);return n!==Iv&&(t.state=null),n};let Oy,gy,my=!0;const by=t=>{if(my){Oy=new Int32Array(512),gy=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Yv(1,t.lens,0,288,Oy,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Yv(2,t.lens,0,32,gy,0,t.work,{bits:5}),my=!1}t.lencode=Oy,t.lenbits=9,t.distcode=gy,t.distbits=5},wy=(t,e,i,n)=>{let s;const r=t.state;return null===r.window&&(r.wsize=1<=r.wsize?(r.window.set(e.subarray(i-r.wsize,i),0),r.wnext=0,r.whave=r.wsize):(s=r.wsize-r.wnext,s>n&&(s=n),r.window.set(e.subarray(i-n,i-n+s),r.wnext),(n-=s)?(r.window.set(e.subarray(i-n,i),0),r.wnext=n,r.whave=r.wsize):(r.wnext+=s,r.wnext===r.wsize&&(r.wnext=0),r.whavepy(t,15),Xv.inflateInit2=py,Xv.inflate=(t,e)=>{let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,y,S,x,k=0;const Q=new Uint8Array(4);let $,P;const C=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(cy(t)||!t.output||!t.input&&0!==t.avail_in)return Nv;i=t.state,i.mode===ey&&(i.mode=iy),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,u=a,d=l,x=Iv;t:for(;;)switch(i.mode){case Kv:if(0===i.wrap){i.mode=iy;break}for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0),h=0,c=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",i.mode=ay;break}if((15&h)!==Jv){t.msg="unknown compression method",i.mode=ay;break}if(h>>>=4,c-=4,S=8+(15&h),0===i.wbits&&(i.wbits=S),S>15||S>i.wbits){t.msg="invalid window size",i.mode=ay;break}i.dmax=1<>8&1),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16182;case 16182:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>8&255,Q[2]=h>>>16&255,Q[3]=h>>>24&255,i.check=Wv(i.check,Q,4,0)),h=0,c=0,i.mode=16183;case 16183:for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>8),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16184;case 16184:if(1024&i.flags){for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(f=i.length,f>a&&(f=a),f&&(i.head&&(S=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(n.subarray(r,r+f),S)),512&i.flags&&4&i.wrap&&(i.check=Wv(i.check,n,f,r)),a-=f,r+=f,i.length-=f),i.length))break t;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===a)break t;f=0;do{S=n[r+f++],i.head&&S&&i.length<65536&&(i.head.name+=String.fromCharCode(S))}while(S&&f>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=ey;break;case 16189:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>=7&c,c-=7&c,i.mode=oy;break}for(;c<3;){if(0===a)break t;a--,h+=n[r++]<>>=1,c-=1,3&h){case 0:i.mode=16193;break;case 1:if(by(i),i.mode=sy,e===zv){h>>>=2,c-=2;break t}break;case 2:i.mode=16196;break;case 3:t.msg="invalid block type",i.mode=ay}h>>>=2,c-=2;break;case 16193:for(h>>>=7&c,c-=7&c;c<32;){if(0===a)break t;a--,h+=n[r++]<>>16^65535)){t.msg="invalid stored block lengths",i.mode=ay;break}if(i.length=65535&h,h=0,c=0,i.mode=ny,e===zv)break t;case ny:i.mode=16195;case 16195:if(f=i.length,f){if(f>a&&(f=a),f>l&&(f=l),0===f)break t;s.set(n.subarray(r,r+f),o),a-=f,r+=f,l-=f,o+=f,i.length-=f;break}i.mode=ey;break;case 16196:for(;c<14;){if(0===a)break t;a--,h+=n[r++]<>>=5,c-=5,i.ndist=1+(31&h),h>>>=5,c-=5,i.ncode=4+(15&h),h>>>=4,c-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=ay;break}i.have=0,i.mode=16197;case 16197:for(;i.have>>=3,c-=3}for(;i.have<19;)i.lens[C[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,$={bits:i.lenbits},x=Yv(0,i.lens,0,19,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid code lengths set",i.mode=ay;break}i.have=0,i.mode=16198;case 16198:for(;i.have>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=g,c-=g,i.lens[i.have++]=b;else{if(16===b){for(P=g+2;c>>=g,c-=g,0===i.have){t.msg="invalid bit length repeat",i.mode=ay;break}S=i.lens[i.have-1],f=3+(3&h),h>>>=2,c-=2}else if(17===b){for(P=g+3;c>>=g,c-=g,S=0,f=3+(7&h),h>>>=3,c-=3}else{for(P=g+7;c>>=g,c-=g,S=0,f=11+(127&h),h>>>=7,c-=7}if(i.have+f>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=ay;break}for(;f--;)i.lens[i.have++]=S}}if(i.mode===ay)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=ay;break}if(i.lenbits=9,$={bits:i.lenbits},x=Yv(1,i.lens,0,i.nlen,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid literal/lengths set",i.mode=ay;break}if(i.distbits=6,i.distcode=i.distdyn,$={bits:i.distbits},x=Yv(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,$),i.distbits=$.bits,x){t.msg="invalid distances set",i.mode=ay;break}if(i.mode=sy,e===zv)break t;case sy:i.mode=ry;case ry:if(a>=6&&l>=258){t.next_out=o,t.avail_out=l,t.next_in=r,t.avail_in=a,i.hold=h,i.bits=c,Uv(t,d),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,i.mode===ey&&(i.back=-1);break}for(i.back=0;k=i.lencode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,i.length=b,0===m){i.mode=16205;break}if(32&m){i.back=-1,i.mode=ey;break}if(64&m){t.msg="invalid literal/length code",i.mode=ay;break}i.extra=15&m,i.mode=16201;case 16201:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;k=i.distcode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,64&m){t.msg="invalid distance code",i.mode=ay;break}i.offset=b,i.extra=15&m,i.mode=16203;case 16203:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=ay;break}i.mode=16204;case 16204:if(0===l)break t;if(f=d-l,i.offset>f){if(f=i.offset-f,f>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=ay;break}f>i.wnext?(f-=i.wnext,p=i.wsize-f):p=i.wnext-f,f>i.length&&(f=i.length),O=i.window}else O=s,p=o-i.offset,f=i.length;f>l&&(f=l),l-=f,i.length-=f;do{s[o++]=O[p++]}while(--f);0===i.length&&(i.mode=ry);break;case 16205:if(0===l)break t;s[o++]=i.length,l--,i.mode=ry;break;case oy:if(i.wrap){for(;c<32;){if(0===a)break t;a--,h|=n[r++]<{if(cy(t))return Nv;let e=t.state;return e.window&&(e.window=null),t.state=null,Iv},Xv.inflateGetHeader=(t,e)=>{if(cy(t))return Nv;const i=t.state;return 0==(2&i.wrap)?Nv:(i.head=e,e.done=!1,Iv)},Xv.inflateSetDictionary=(t,e)=>{const i=e.length;let n,s,r;return cy(t)?Nv:(n=t.state,0!==n.wrap&&n.mode!==ty?Nv:n.mode===ty&&(s=1,s=Dv(s,e,i,0),s!==n.check)?Gv:(r=wy(t,e,i,i),r?(n.mode=16210,Fv):(n.havedict=1,Iv)))},Xv.inflateInfo="pako inflate (from Nodeca project)";const vy=Xv,yy=ov,Sy=lv,xy=rw,ky=uv,Qy=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},$y=Object.prototype.toString,{Z_NO_FLUSH:Py,Z_FINISH:Cy,Z_OK:_y,Z_STREAM_END:Xy,Z_NEED_DICT:Zy,Z_STREAM_ERROR:Ay,Z_DATA_ERROR:Ty,Z_MEM_ERROR:Ry}=ow;function Ey(t){this.options=yy.assign({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ky,this.strm.avail_out=0;let i=vy.inflateInit2(this.strm,e.windowBits);if(i!==_y)throw new Error(xy[i]);if(this.header=new Qy,vy.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=Sy.string2buf(e.dictionary):"[object ArrayBuffer]"===$y.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(i=vy.inflateSetDictionary(this.strm,e.dictionary),i!==_y)))throw new Error(xy[i])}function Vy(t,e){const i=new Ey(e);if(i.push(t),i.err)throw i.msg||xy[i.err];return i.result}Ey.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize,s=this.options.dictionary;let r,o,a;if(this.ended)return!1;for(o=e===~~e?e:!0===e?Cy:Py,"[object ArrayBuffer]"===$y.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),r=vy.inflate(i,o),r===Zy&&s&&(r=vy.inflateSetDictionary(i,s),r===_y?r=vy.inflate(i,o):r===Ty&&(r=Zy));i.avail_in>0&&r===Xy&&i.state.wrap>0&&0!==t[i.next_in];)vy.inflateReset(i),r=vy.inflate(i,o);switch(r){case Ay:case Ty:case Zy:case Ry:return this.onEnd(r),this.ended=!0,!1}if(a=i.avail_out,i.next_out&&(0===i.avail_out||r===Xy))if("string"===this.options.to){let t=Sy.utf8border(i.output,i.next_out),e=i.next_out-t,s=Sy.buf2string(i.output,t);i.next_out=e,i.avail_out=n-e,e&&i.output.set(i.output.subarray(t,t+e),0),this.onData(s)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(r!==_y||0!==a){if(r===Xy)return r=vy.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},Ey.prototype.onData=function(t){this.chunks.push(t)},Ey.prototype.onEnd=function(t){t===_y&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=yy.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},_v.Inflate=Ey,_v.inflate=Vy,_v.inflateRaw=function(t,e){return(e=e||{}).raw=!0,Vy(t,e)},_v.ungzip=Vy,_v.constants=ow;const{Deflate:My,deflate:Dy,deflateRaw:Wy,gzip:Uy}=mb,{Inflate:Yy,inflate:qy,inflateRaw:Ly,ungzip:zy}=_v,Iy=ow;gb.Deflate=My,gb.deflate=Dy,gb.deflateRaw=Wy,gb.gzip=Uy,gb.Inflate=Yy,gb.inflate=qy,gb.inflateRaw=Ly,gb.ungzip=zy,gb.constants=Iy;const By=gb;let jy={};var Ny;function Gy(t){return Ny=t,[tS]}jy.Util={},jy.Decode={},jy.Messages=[],jy.Log=function(t){jy.Messages.push(["I",t]),console.log("Mma.js INFO: ",t)},jy.Warn=function(t){jy.Messages.push(["W",t]),console.log("Mma.js WARNING: ",t)},jy.Fail=function(t){throw jy.Messages.push(["E",t]),"Mma.js ERROR: "+t},jy.Util.Base64Decode=function(t){for(var e=atob(t),i=e.length>>>0,n=new Uint8Array(i),s=0;s1&&0===t[0]&&jy.Fail("IntegerAP: input starts with 0: "+String(t)),this.nstring=t}else void 0===t?this.nstring=void 0:jy.Fail("Integer: invalid input: "+String(t))},jy.RealMP=function(t){"number"==typeof t?this.n=t:void 0===t?this.n=void 0:jy.Fail("RealMP: invalid input")},jy.RealAP=function(t){"string"==typeof t?(t.length>1&&0===t[0]&&jy.Fail("RealAP: input starts with 0: "+String(t)),this.nstring=t):void 0===t?this.nstring=void 0:jy.Fail("RealAP: invalid input: "+String(t))},jy.Symbol=function(t){"string"==typeof t?this.name=t:void 0===t?this.name=void 0:jy.Fail("Symbol: invalid input: "+String(t))},jy.String=function(t){"string"==typeof t?this.str=t:void 0===t?this.str=void 0:jy.Fail("String: invalid input: "+String(t))},jy.Expression=function(t,e){t instanceof jy.Symbol||jy.Fail("Expression: head must be an Mma.Symbol"),e instanceof Array||jy.Fail("Expression: parts must be an Array"),this.head=t,this.parts=e},jy.Decode.Int32=function(t,e){try{return new DataView(t.buffer).getInt32(e,!0)}catch(t){return 0}},jy.Decode.Float64=function(t,e){try{return new DataView(t.buffer).getFloat64(e,!0)}catch(t){return 0}},jy.Decode.String=function(t,e,i){return void 0===e&&(e=0),void 0===i&&(i=t.length),jy.Util.U8ArrayToString(t.slice(e,e+i))},jy.Decode.StringEntry=function(t,e){void 0===e&&(e=0);var i=jy.Decode.Int32(t,e);return{length:i,string:jy.Decode.String(t,e+4,i),bytesRead:i+4}},jy.Decode.Any=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=1/0);var n=e;for(var s=0,r=[];ee%2!=0?t:{...t,body:Lm(t.body,/\(\*\|\*\)/gm)})),Array.isArray(this.args[this.args.length-1].body)||(this.decorator=this.args.pop());const r=this.args;console.log("creating InstanceWidget");for(let t=0;t{e.viewState.state.config.eval()},update:e=>this.applyChanges(e,t,i),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to&&!t.stringOnly)return i-2>=0?(o[i-2].editor.dispatch({selection:{anchor:o[i-2].editor.state.doc.length}}),o[i-2].editor.focus(),void(t.editorLastCursor=void 0)):(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0));t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to&&!t.stringOnly)return i+2=0)return r[t-2].body[i].editor.focus(),void(e.editorLastCursor=void 0)}},{key:"ArrowDown",run:function(e,n){if(t+2{},focus:()=>{},dispatch:()=>{},stringOnly:!0};const t=l.match(Fy);if(t){a.innerHTML=t[1];const e=jy.DecompressDecode(t[2]),i=jy.toArray(e.parts[0]),n=uuidv4();interpretate(i,{global:{call:n},element:a})}else a.innerHTML=l.slice(1,-1)}delete o[i].body,n.appendChild(a)}i.appendChild(n)}if(this.decorator){const t=jy.DecompressDecode(this.decorator.body.slice(2,-2)),e=jy.toArray(t.parts[0]);let n={global:{call:uuidv4(),EditorWidget:s},element:i};this.interpretated=interpretate(e,n)}}applyChanges(t,e,i){const n=this.args,s=this.args[e].body,r=this.visibleValue.argsPos,o=this.args[e].from;let a=t;0==i&&0==e&&(a="{{"+a),0==i&&0!=e&&(a="{"+a),i==s.length-1&&e==n.length-1&&(a+="}}"),i==s.length-1&&e!=n.length-1&&(a+="}");const l=s[i].length,h={from:r+o+s[i].from,to:r+o+s[i].from+l,insert:a},c=a.length-l;for(let t=i+1;t{s.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.args[0].body[0].editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.args[0].body[0].editor.focus();else{const t=this.DOMElement.EditorWidget.args,e=t[t.length-1].body[t[t.length-1].body.length-1].editor;e.dispatch({selection:{anchor:e.state.doc.length}}),e.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const Ky=(t,e)=>new Bm({tag:"GB",decoration:i=>ni.replace({widget:new Jy(i,t,e)})}),tS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=Ky(this.disposable,t).createDeco(t)}update(t){this.placeholder=Ky(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});function eS(t){return[rS]}let iS=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.span=i,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this,r=this.args[1].body.slice(3,-3),o=jy.DecompressDecode(r),a=jy.toArray(o.parts[0]);this.data=a;const l="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}));this.cuid=l;let h={call:l,EditorWidget:s},c={global:h,element:i};this.expression=a,this.env=c,this.interpretated=interpretate(a,c),this.interpretated.then((()=>{if(c.options?.Event){console.warn("Event listeners are enabled!"),s.events=c.options.Event;let t=c;if(h.stack){const e=Object.values(h.stack);e.length>0&&(console.log("Attaching first found instance..."),t=e[0].env)}interpretate(["MetaMarker","'"+l+"'"],t).then((()=>{server.kernel.emitt(s.events,'"'+l+'"',"Mounted")}))}}))}getDoc(){return this.args[0].body.slice(1,-1)}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+t+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].length=s.length,this.view.dispatch({changes:r})}applyOuterChanges(t){const e=this.visibleValue,i=t,n={from:e.pos,to:e.pos+e.length,insert:i};this.view.dispatch({changes:n})}update(t){if(!this.deactivated){if(t.str!=this.visibleValue.str){console.warn("Out of sync"),console.log("recreate..."),this.destroy();const e=this.span;return e.replaceChildren(),void this._construct(t,this.view,e)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}}destroy(t){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.events&&server.kernel.emitt(this.events,'"'+this.cuid+'"',"Destroy"),delete this.data}},nS=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=this;let i=document.createElement("span");return i.classList.add("frontend-view"),i.EditorWidget=new iS(this.visibleValue,t,i),this.reference.push({destroy:()=>{e.destroy(i)}}),i}ignoreEvent(){return!0}destroy(t){console.log("destroy in general*"),t.EditorWidget.destroy()}};const sS=(t,e)=>new Bm({tag:"VB",decoration:i=>ni.replace({widget:new nS(i,t,e)})}),rS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=sS(this.disposable,t).createDeco(t)}update(t){this.placeholder=sS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var oS;function aS(t){return oS=t,[uS]}let lS=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.span=i,this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this;this.epilog={offset:0,string:""},this.prolog={offset:0,string:""};const r=this.args[1].body.slice(3,-3),o=jy.DecompressDecode(r),a=jy.toArray(o.parts[0]);this.data=a;let l={global:{call:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)})),element:i,origin:s},element:i};this.env=l,interpretate(a,l).then((()=>{if(l.options?.Head&&(s.prolog.offset=l.options.Head.length+1,s.prolog.string=l.options.Head+"[",s.epilog.offset=1,s.epilog.string="]"),l.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=l.options.Event),l.options?.String){s.prolog.offset=1,s.prolog.string='"',s.epilog.offset=1,s.epilog.string='"',l.options?.HeadString&&(s.prolog.string=l.options.HeadString,s.prolog.offset=s.prolog.string.length),l.options?.TailString&&(s.epilog.string=l.options.TailString,s.epilog.offset=s.epilog.string.length),s.editor={destroy:()=>{console.log("Nothing to destroy, this is just a text field.")}};const t=document.createElement("span");return this.aa,t.onkeydown=function(t){13===t.keyCode&&t.preventDefault()},t.contentEditable="plaintext-only",t.innerText=s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),t.addEventListener("input",console.log),t.addEventListener("input",(()=>{console.log("Update"),console.log(t.innerText),this.applyChanges(t.innerText)})),l.global.element.appendChild(t),void(s.events&&server.kernel.emitt(s.events,"Null","Mounted"))}s.editor=oS({doc:s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),parent:l.global.element,update:t=>this.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos+s.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]}),s.events&&server.kernel.emitt(s.events,"Null","Mounted")}))}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+this.prolog.string+t+this.epilog.string+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length));const o=s.length-i[0].length;i[0].length=s.length,this.visibleValue.length=this.visibleValue.length+o,this.view.dispatch({changes:r})}update(t){if(this.visibleValue.str!=t.str)return console.warn("Out of sync"),console.log("recreating InstanceWidget"),this.destroy(),this.span.replaceChildren(),void this._construct(t,this.view,this.span);this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.editor.destroy(),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}},hS=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("subscript-tail"),e.EditorWidget=new lS(this.visibleValue,t,e,[]);const i=this;return this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const cS=(t,e)=>new Bm({tag:"BB",decoration:i=>ni.replace({widget:new hS(i,t,e)})}),uS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=cS(this.disposable,t).createDeco(t)}update(t){this.placeholder=cS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var dS;function fS(t){return dS=t,[mS]}class pS{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm);const s=this,r=Array.from({length:Math.ceil((s.args.length-3)/2)},((t,e)=>2*e+1));s.indexes=r;const o=[];this.span=i,this.spans=o;for(let t=0;t{c.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=c.options.Event),s.editors=r.map(((t,i)=>dS({doc:s.args[t].body,parent:o[i],update:e=>this.applyChanges(e,t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i>0?s.editors[i-1].focus():(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus()),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return it.destroy())),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}}class OS extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("inline-flex"),e.EditorWidget=new pS(this.visibleValue,t,e,[]);const i=this;return this.DOMElement=e,this.reference.push({destroy:()=>{i.destroy(e)}}),e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;const n=this.DOMElement.EditorWidget.editors;return t.from-e.from<0?(n[n.length-1].dispatch({selection:{anchor:n[n.length-1].state.doc.length}}),n[n.length-1].focus()):(n[0].dispatch({selection:{anchor:0}}),n[0].focus()),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}}const gS=(t,e)=>new Bm({tag:"TB",decoration:i=>ni.replace({widget:new OS(i,t,e)})}),mS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=gS(this.disposable,t).createDeco(t)}update(t){this.placeholder=gS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});const bS=_i.fromClass(class{decorations=ni.none;constructor(t){this.view=t,this.recompute()}recompute(t){let e,i,n=[];for(let{from:t,to:e}of this.view.visibleRanges)this.getDecorationsFor(t,e,n);this.decorations=ni.set(n,!0),this.decorations=this.decorations.update({filter:(n,s)=>!(n>e&&s=e&&s.selection.main.head<=i)return!0;if(!n&&s.selection.main.head>e&&s.selection.main.headt.decorations});class wS extends ei{constructor(t,e){super(),this.rawValue=t,this.visibleValue=e}eq(t){return this.rawValue===t.rawValue}toDOM(){let t=document.createElement("div");t.classList.add("cell-type-widget");const e=this.rawValue.split(" "),i=e[0].split(".");if(console.log(i),t.classList.add("cell-type-"+i[1].trim()),t.innerText=e[0].trim(),e.length>1){const n=e.slice(1),s=document.createElement("span");return s.appendChild(t),n.forEach((t=>{const e=document.createElement("span");e.innerText=t,e.classList.add("cell-type-"+i[1].trim()+"-"+t.split("=")[0]),s.appendChild(e)})),s}return t}ignoreEvent(){return!1}}const vS=new F,yS=new F,SS=[],xS=Sl.define([{tag:Sa.meta,color:"var(--editor-key-meta)"},{tag:Sa.link,textDecoration:"underline"},{tag:Sa.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Sa.emphasis,fontStyle:"italic"},{tag:Sa.strong,fontWeight:"bold"},{tag:Sa.strikethrough,textDecoration:"line-through"},{tag:Sa.keyword,color:"var(--editor-key-keyword)"},{tag:[Sa.atom,Sa.bool,Sa.url,Sa.contentSeparator,Sa.labelName],color:"var(--editor-key-atom)"},{tag:[Sa.literal,Sa.inserted],color:"var(--editor-key-literal)"},{tag:[Sa.string,Sa.deleted],color:"var(--editor-key-string)"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],color:"var(--editor-key-escape)"},{tag:Sa.definition(Sa.variableName),color:"var(--editor-key-variable)"},{tag:Sa.local(Sa.variableName),color:"var(--editor-local-variable)"},{tag:[Sa.typeName,Sa.namespace],color:"var(--editor-key-type)"},{tag:Sa.className,color:"var(--editor-key-class)"},{tag:[Sa.special(Sa.variableName),Sa.macroName],color:"var(--editor-special-variable)"},{tag:Sa.definition(Sa.propertyName),color:"var(--editor-key-property)"},{tag:Sa.comment,color:"var(--editor-key-comment)"},{tag:Sa.invalid,color:"var(--editor-key-invalid)"}]),kS={data:[],extend:t=>{kS.data.push(...t),Qm.reBuild(kS.data)},replaceAll:t=>{kS.data=t,Qm.reBuild(kS.data)}},QS=Gl.define({name:"spreadsheet",startState:function(){return{stringType:null,stack:[]}},token:function(t,e){if(t){switch(0===e.stack.length&&('"'!=t.peek()&&"'"!=t.peek()||(e.stringType=t.peek(),t.next(),e.stack.unshift("string"))),e.stack[0]){case"string":for(;"string"===e.stack[0]&&!t.eol();)t.peek()===e.stringType?(t.next(),e.stack.shift()):"\\"===t.peek()?(t.next(),t.next()):t.match(/^.[^\\\"\']*/);return"string";case"characterClass":for(;"characterClass"===e.stack[0]&&!t.eol();)t.match(/^[^\]\\]+/)||t.match(/^\\./)||e.stack.shift();return"operator"}var i=t.peek();switch(i){case"[":return t.next(),e.stack.unshift("characterClass"),"bracket";case":":return t.next(),"operator";case"\\":return t.match(/\\[a-z]+/)?"string.special":(t.next(),"atom");case".":case",":case";":case"*":case"-":case"+":case"^":case"<":case"/":case"=":return t.next(),"atom";case"$":return t.next(),"builtin"}return t.match(/\d+/)?t.match(/^\w+/)?"error":"number":t.match(/^[a-zA-Z_]\w*/)?t.match(/(?=[\(.])/,!1)?"keyword":"variable":-1!=["[","]","(",")","{","}"].indexOf(i)?(t.next(),"bracket"):(t.eatSpace()||t.next(),null)}}}),$S=new RegExp(/^[\w]*\.[\w]+/);function PS(t){const e=$S.exec(t),i=Object.values(window.SupportedLanguages);for(let t=0;t{if(!t.docChanged)return null;let e=PS(t.newDoc.line(1).text);if(e.legacy){const i=t.startState.facet(Wa);if(i){if(i.name==e.name)return null}else if(t.startState.facet(CS)==e.name)return null;return console.log("switching... to "+e.name),{effects:vS.reconfigure(e.plugins)}}return e.name===t.startState.facet(Wa).name?null:(console.log("switching... to "+e.name),{effects:vS.reconfigure(e.plugins)})}));let XS,ZS=null;const AS=t=>{const e=t||XS;return e&&e.viewState?(console.log(),PS(e.state.doc.line(1).text).name):""},TS=t=>{const e=t||XS;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return!1;const n=i[0];return[n.from,n.to]},RS=t=>{const e=t||XS;return e&&e.viewState?e.state.doc.toString():""},ES=t=>{const e=t||XS;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return"";const n=i[0];return console.log("yoko"),console.log(n),console.log(e.state.doc.toString().slice(n.from,n.to)),console.log("processing"),e.state.doc.toString().slice(n.from,n.to)},VS=(t,e)=>{const i=e||XS;if(!i)return;if(!i.viewState)return;const n=i.viewState.state.selection.ranges;if(!n.length)return;const s=n[0];console.log("result"),console.log(t),i.dispatch({changes:{...s,insert:t}})},MS=()=>XS,DS=(t,e)=>{const i=e||XS;i&&i.viewState&&(console.log("result"),console.log(t),i.dispatch({changes:{from:0,to:i.viewState.state.doc.length,insert:t}}))};ZS=t=>{let e=new Ts({doc:t.doc,extensions:[Ys.of([{key:"Tab",run:function(t,e){return sd(t)}},{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,LS,Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(XS=e.view)}))],parent:t.parent});return e.viewState.state.config.eval=t.eval,e},ZS.state=t=>{let e=xt.create({doc:t.doc,extensions:[Ys.of([{key:"Tab",run:function(t,e){return sd(t)}},{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,LS,Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(XS=e.view)}))]});return e.config.eval=t.eval,e};const WS={transaction:(t,e,i,n)=>{if(console.log(e.dom.ocellref),e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:DropEvent"]')}},file:(t,e,i,n,s)=>{console.log(e.dom.ocellref),e.dom.ocellref&&server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},US={transaction:(t,e,i,n)=>{if(console.log(e.dom.ocellref),e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:PasteEvent"]')}},file:(t,e,i,n,s)=>{console.log(e.dom.ocellref),e.dom.ocellref&&server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},YS=[Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Cm(WS,US)];let qS=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"}}),LS=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"},".cm-scroller":{"line-height":"inherit","overflow-x":"overlay","overflow-y":"overlay","align-items":"initial"},".cm-content":{padding:"0px 0"},".rainbow-bracket-red":{color:"var(--editor-bracket-1)"},".rainbow-bracket-orange":{color:"var(--editor-bracket-2)"},".rainbow-bracket-yellow":{color:"var(--editor-bracket-3)"},".rainbow-bracket-green":{color:"var(--editor-bracket-4)"},".rainbow-bracket-blue":{color:"var(--editor-bracket-5)"},".rainbow-bracket-indigo":{color:"var(--editor-bracket-6)"},".rainbow-bracket-violet":{color:"var(--editor-bracket-7)"},".rainbow-bracket-red > span":{color:"var(--editor-bracket-1-a)"},".rainbow-bracket-orange > span":{color:"var(--editor-bracket-2-a)"},".rainbow-bracket-yellow > span":{color:"var(--editor-bracket-3-a)"},".rainbow-bracket-green > span":{color:"var(--editor-bracket-4-a)"},".rainbow-bracket-blue > span":{color:"var(--editor-bracket-5-a)"},".rainbow-bracket-indigo > span":{color:"var(--editor-bracket-6-a)"},".rainbow-bracket-violet > span":{color:"var(--editor-bracket-7-a)"}}),zS=!1;const IS=[()=>vr(),()=>Sh(),()=>ir(),()=>dr(),()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xS,{fallback:!1}),()=>tu()],BS={},jS=[()=>vr(),()=>Sh(),()=>ir(),()=>dr(),t=>NS.of(t),()=>BS.gutter?function(t={}){return[eo.of(t),jr(),so]}():[],()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xS,{fallback:!1}),()=>tu(),()=>bS,()=>function(t){return _i.fromClass(class{constructor(e){this.view=e,this.placeholder=ni.set([ni.widget({widget:new kr(t),side:1}).range(0)])}get decorations(){return this.view.state.doc.length?ni.none:this.placeholder}},{decorations:t=>t.decorations})}("Type WL Expression / .md / .js"),()=>xt.allowMultipleSelections.of(!0),(t,e)=>vS.of(e),()=>yS.of(xt.readOnly.of(!1)),()=>_S,()=>{return t?[ou.of(t),Yu]:Yu;var t},(t,e)=>Ys.of([{key:"Tab",run:function(t,e){const i=sd(t);return i||Rc(t)},shift:Ec},{key:"Backspace",run:function(e,i){if(0===e.state.doc.length)return t.origin.remove(),!0}},{key:"ArrowLeft",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus prev"),t.origin.focusPrev(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus next"),t.origin.focusNext(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"Shift-Enter",preventDefault:!0,run:function(e,i){console.log(e.state.doc.toString()),t.origin.eval(e.state.doc.toString())}},...Vc,...Wh,...Ru]),(t,e)=>Ts.updateListener.of((e=>{e.docChanged&&t.origin.save(encodeURIComponent(e.state.doc.toString())),e.selectionSet&&(XS=e.view)})),()=>qS];const NS=E.define();function GS(t){return t.replace(/\\\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\\\:/g,""),16))})).replaceAll("\\:F74E","I").replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))}function FS(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(t=>(+t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+t/4).toString(16)))}core.ReadOnly=()=>"ReadOnly",core.EditorView=async(t,e)=>{let i=await interpretate(t[0],e);i=GS(i),console.log("UNICODE Disaster");const n=await core._getRules(t,e);let s=()=>{},r=()=>{},o=i;const a=[];n.ReadOnly&&a.push(xt.readOnly.of(!0)),n.ForceUpdate&&(e.local.forceUpdate=n.ForceUpdate),n.Event&&(r=t=>{o=t,console.log("editor view emitt data: "+t),server.kernel.emitt(n.Event,'"'+t.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Input")},s=()=>{server.kernel.emitt(n.Event,'"'+o.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Evaluate")}),e.local?e.local.editor=ZS({doc:i,parent:e.element,eval:s,update:r,extensions:a}):ZS({doc:i,parent:e.element,eval:s,update:r,extensions:a}),e.element.style.verticalAlign="inherit"},core.StripOnInput=async()=>{},core.EditorView.update=async(t,e)=>{if(!e.local.editor)return;const i=GS(await interpretate(t[0],e));console.log("editor view: dispatch"),e.local.forceUpdate,e.local.editor.dispatch({changes:{from:0,to:e.local.editor.state.doc.length,insert:i}})},core.EditorView.destroy=async(t,e)=>{await interpretate(t[0],e),e.local&&e.local.editor&&e.local.editor.destroy()},core.EditorView.virtual=!0,core.PreviewCell=(t,e)=>{},window.SupportedLanguages.push({check:t=>null===t,legacy:!0,plugins:YS,name:"mathematica"}),window.SupportedLanguages.push({check:t=>null!=t[0].match(/\w+\.(wl|wls)$/),plugins:YS,legacy:!0,name:"mathematica"}),window.SupportedCells.codemirror={view:class{origin={};editor={};trash=[];forceFocusNext(){zS=!0}focus(t){t>0?this.editor.dispatch({selection:{anchor:0}}):t<0&&this.editor.dispatch({selection:{anchor:this.editor.state.doc.length}}),this.editor.focus()}setContent(t){if(console.warn("content mutation!"),!this.editor.viewState)return;const e=this.editor;console.log("result"),console.log(t),this.editor.dispatch({changes:{from:0,to:e.viewState.state.doc.length,insert:t}})}addDisposable(t){this.trash.push(t)}dispose(){this.editor.destroy()}readOnly(t){this.editor.dispatch({effects:yS.reconfigure(xt.readOnly.of(t))})}constructor(t,e){this.origin=t;const i=this.origin,n=PS(e).plugins,s=this;this.origin.element.ocellref=s;const r=new Ts({doc:(o=e,o.replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))),extensions:jS.map((t=>t(s,n))),parent:this.origin.element});var o;return this.editor=r,this.editor.dom.ocellref=s,this.editor.viewState.state.config.eval=()=>{i.eval(this.editor.state.doc.toString())},zS&&r.focus(),zS=!1,this}},context:{EditorAutocomplete:kS,javascriptLanguage:qf,javascript:Nf,markdownLanguage:rm,markdown:function(t={}){let{codeLanguages:e,defaultCodeLanguage:i,addKeymap:n=!0,base:{parser:s}=sm}=t;if(!(s instanceof Zp))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let r,o=t.extensions?[t.extensions]:[],a=[dm.support];i instanceof Ua?(a.push(i.support),r=i.language):i&&(r=i);let l=e||r?(h=e,c=r,t=>{if(t&&h){let e=null;if(t=/\S*/.exec(t)[0],e="function"==typeof h?h(t):Ya.matchLanguageName(h,t,!0),e instanceof Ya)return e.support?e.support.language.parser:Ta.getSkippingParser(e.load());if(e)return e.parser}return c?c.parser:null}):void 0;var h,c;return o.push(function(t){let{codeParser:e,htmlParser:i}=t,n=Do(((t,n)=>{let s=t.type.id;if(!e||s!=Kf.CodeBlock&&s!=Kf.FencedCode){if(i&&(s==Kf.HTMLBlock||s==Kf.HTMLTag))return{parser:i,overlay:rO(t.node,t.from,t.to)}}else{let i="";if(s==Kf.FencedCode){let e=t.node.getChild(Kf.CodeInfo);e&&(i=n.read(e.from,e.to))}let r=e(i);if(r)return{parser:r,overlay:t=>t.type.id==Kf.CodeText}}return null}));return{wrap:n}}({codeParser:l,htmlParser:dm.language.parser})),n&&a.push(N.high(Ys.of(um))),new Ua(nm(s.configure(o)),a)},htmlLanguage:jg,html:Ng,cssLanguage:kg,css:Qg,EditorView:Ts,EditorState:xt,highlightSpecialChars:vr,syntaxHighlighting:$l,defaultHighlightStyle:xS,editorCustomTheme:qS,foldGutter:function(t={}){let e=Object.assign(Object.assign({},wl),t),i=new vl(e,!0),n=new vl(e,!1),s=_i.fromClass(class{constructor(t){this.from=t.viewport.from,this.markers=this.buildMarkers(t)}update(t){(t.docChanged||t.viewportChanged||t.startState.facet(Wa)!=t.state.facet(Wa)||t.startState.field(dl,!1)!=t.state.field(dl,!1)||Xa(t.startState)!=Xa(t.state)||e.foldingChanged(t))&&(this.markers=this.buildMarkers(t.view))}buildMarkers(t){let e=new Xt;for(let s of t.viewportLineBlocks){let r=fl(t.state,s.from,s.to)?n:ll(t.state,s.from,s.to)?i:null;r&&e.add(s.from,s.from,r)}return e.finish()}}),{domEventHandlers:r}=e;return[s,Ir({class:"cm-foldGutter",markers(t){var e;return(null===(e=t.plugin(s))||void 0===e?void 0:e.markers)||_t.empty},initialSpacer:()=>new vl(e,!1),domEventHandlers:Object.assign(Object.assign({},r),{click:(t,e,i)=>{if(r.click&&r.click(t,e,i))return!0;let n=fl(t.state,e.from,e.to);if(n)return t.dispatch({effects:ul.of(n)}),!0;let s=ll(t.state,e.from,e.to);return!!s&&(t.dispatch({effects:cl.of(s)}),!0)}})}),ml()]},Facet:E,Compartment:F,mathematicaPlugins:YS,legacyLangNameFacet:CS,DropPasteHandlers:Cm,EditorExtensionsMinimal:IS,EditorParameters:BS,EditorExtensions:jS,StateField:q,Decoration:ni,ViewPlugin:_i,WidgetType:ei,originFacet:NS,MatchDecorator:pr}},window.OfflineMode&&SS.push(xt.readOnly.of(!0)),core.CellView=async(t,e)=>{const i=await core._getRules(t,e);i.Display||(i.Display="codemirror");const n=await interpretate(t[0],e),s={element:e.element,uid:FS()};i.Style&&(e.element.style=i.Style),i.Class&&e.element.classList.add(...i.Class.split(" ")),i.ImageSize&&(Array.isArray(i.ImageSize)?(e.element.style.width=i.ImageSize[0]+"px",e.element.style.height=i.ImageSize[1]+"px"):e.element.style.width=i.ImageSize+"px"),new window.SupportedCells[i.Display].view(s,n)};const HS={};core.FrontEditorSelected=async(t,e)=>{console.log("check");const i=await interpretate(t[0],e),n=await core._getRules(t,e);let s;switch(n.Editor&&(s=HS[n.Editor],console.log("Editor"),console.log(n.Editor),console.log(s)),i){case"Get":return ES(s);case"Set":let i=await interpretate(t[1],e);VS(i,s);break;case"GetDoc":return RS(s);case"SetDoc":let n=await interpretate(t[1],e);DS(n,s);break;case"Cursor":return TS(s);case"Type":return AS(s);case"Editor":const r=FS();return HS[r]=MS(),r}};window.SupportedCells.shell={view:class{dispose(){}constructor(t,e){this.origin=t;const i=document.createElement("div");return i.classList.add(..."flex sc-b max-h-60 text-sm overflow-y-scroll".split(" ")),i.style.overflowAnchor="auto",i.style.flexDirection="column-reverse",i.innerText=e,this.origin.element.appendChild(i),this}}}; +class t{constructor(){}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 a(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}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 l(n,o,i,r);n=o+1,i++}}decompose(t,i,r,o){let a=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(a.text,t.text.slice(),0,a.length);if(i.length<=32)r.push(new e(i,t.length+a.length));else{let t=i.length>>1;r.push(new e(i.slice(0,t)),new e(i.slice(t)))}}else r.push(a)}replace(t,r,o){if(!(o instanceof e))return super.replace(t,r,o);let a=n(this.text,n(o.text,s(this.text,0,t)),r),l=this.length+o.length-(r-t);return a.length<=32?new e(a,l):i.from(e.split(a,[]),l)}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=a+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,a=i+r.lines-1;if((e?a:o)>=t)return r.lineInner(t,e,i,n);n=o+1,i=a+1}}decompose(t,e,i,n){for(let s=0,r=0;r<=e&&s=r){let s=n&((r<=t?1:0)|(a>=e?2:0));r>=t&&a<=e&&!s?i.push(o):o.decompose(t-r,e-r,i,s)}r=a+1}}replace(t,e,n){if(n.lines=r&&e<=a){let l=o.replace(t-r,e-r,n),h=this.lines-o.lines+l.lines;if(l.lines>4&&l.lines>h>>6){let r=this.children.slice();return r[s]=l,new i(r,this.length-(e-t)+n.length)}return super.replace(r,a,l)}r=a+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=a+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,a]=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==a)return n;let i=this.children[s],l=t.children[r];if(i!=l)return n+i.scanIdentical(l,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,a=r>>1,l=[],h=0,c=-1,u=[];function d(t){let n;if(t.lines>o&&t instanceof i)for(let e of t.children)d(e);else t.lines>a&&(h>a||!h)?(f(),l.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&&f(),h+=t.lines,c+=t.length+1,u.push(t))}function f(){0!=h&&(l.push(1==u.length?u[0]:i.from(u,c)),c=-1,h=u.length=0)}for(let e of t)d(e);return f(),1==l.length?l[0]:new i(l,n)}}function n(t,e,i=0,n=1e9){for(let s=0,r=0,o=!0;r=i&&(l>n&&(a=a.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,a=s instanceof e?s.text.length:s.children.length;if(o==(i>0?a: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 a{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]=a.prototype[Symbol.iterator]=function(){return this});let l=class{constructor(t,e,i,n){this.from=t,this.to=e,this.number=i,this.text=n}get length(){return this.to-this.from}},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 d=8205;function f(t,e,i=!0,n=!0){return(i?p:O)(t,e,n)}function p(t,e,i){if(e==t.length)return e;e&&g(t.charCodeAt(e))&&m(t.charCodeAt(e-1))&&e--;let n=b(t,e);for(e+=v(n);e=0&&u(b(t,n));)i++,n-=2;if(i%2==0)break;e+=2}}}return e}function O(t,e,i){for(;e>0;){let n=p(t,e-2,i);if(n=56320&&t<57344}function m(t){return t>=55296&&t<56320}function b(t,e){let i=t.charCodeAt(e);if(!m(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return g(n)?n-56320+(i-55296<<10)+65536:i}function w(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function v(t){return t<65536?1:2}const y=/\r\n?|\n/;var S=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(S||(S={}));class x{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;et)return s+(t-n);s+=o}else{if(i!=S.Simple&&l>=t&&(i==S.TrackDel&&nt||i==S.TrackBefore&&nt))return null;if(l>t||l==t&&e<0&&!o)return t==n||e<0?s:s+a;s+=a}n=l}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 x(t)}static create(t){return new x(t)}}class k extends x{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 P(this,((e,i,n,s,r)=>t=t.replace(n,n+(i-e),r)),!1),t}mapDesc(t,e=!1){return C(this,t,e,!0)}invert(e){let i=this.sections.slice(),n=[];for(let s=0,r=0;s=0){i[s]=a,i[s+1]=o;let l=s>>1;for(;n.length0&&$(i,e,s.text),s.forward(t),o+=t}let l=t[r++];for(;o>1].toJSON()))}return t}static of(e,i,n){let s=[],r=[],o=0,a=null;function l(t=!1){if(!t&&!s.length)return;oa||e<0||a>i)throw new RangeError(`Invalid change range ${e} to ${a} (in doc of length ${i})`);let u=c?"string"==typeof c?t.of(c.split(n||y)):c:t.empty,d=u.length;if(e==a&&0==d)return;eo&&Q(s,e-o,-1),Q(s,a-e,d),$(r,s,u),o=a}}(e),l(!a),a}static empty(t){return new k(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 $(e,i,n){if(0==n.length)return;let s=i.length-2>>1;if(s>1])),!(n||a==e.sections.length||e.sections[a+1]<0);)l=e.sections[a++],h=e.sections[a++];i(r,c,o,u,d),r=c,o=u}}}function C(t,e,i,n=!1){let s=[],r=n?[]:null,o=new X(t),a=new X(e);for(let t=-1;;)if(-1==o.ins&&-1==a.ins){let t=Math.min(o.len,a.len);Q(s,t,-1),o.forward(t),a.forward(t)}else if(a.ins>=0&&(o.ins<0||t==o.i||0==o.off&&(a.len=0&&t=0)){if(o.done&&a.done)return r?k.createSet(s,r):x.create(s);throw new Error("Mismatched change set lengths")}{let e=0,i=o.len;for(;i;)if(-1==a.ins){let t=Math.min(i,a.len);e+=t,i-=t,a.forward(t)}else{if(!(0==a.ins&&a.lene||o.ins>=0&&o.len>e)&&(t||n.length>i),r.forward2(e),o.forward(e)}}else Q(n,0,o.ins,t),s&&$(s,n,o.text),o.next()}}class X{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 Z{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 Z(i,n,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return A.range(t,e);let i=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return A.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 A.range(t.anchor,t.head)}static create(t,e,i){return new Z(t,e,i)}}class A{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:A.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 A(t.ranges.map((t=>Z.fromJSON(t))),t.main)}static single(t,e=t){return new A([A.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?A.range(o,r):A.range(r,o))}}return new A(t,e)}}function T(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let R=0;class E{constructor(t,e,i,n,s){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=n,this.id=R++,this.default=t([]),this.extensions="function"==typeof s?s(this):s}static define(t={}){return new E(t.combine||(t=>t),t.compareInput||((t,e)=>t===e),t.compare||(t.combine?(t,e)=>t===e:V),!!t.static,t.enables)}of(t){return new M([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,2,e)}from(t,e){return e||(e=t=>t),this.compute([t],(i=>e(i.field(t))))}}function V(t,e){return t==e||t.length==e.length&&t.every(((t,i)=>t===e[i]))}class M{constructor(t,e,i,n){this.dependencies=t,this.facet=e,this.type=i,this.value=n,this.id=R++}dynamicSlot(t){var e;let i=this.value,n=this.facet.compareInput,s=this.id,r=t[s]>>1,o=2==this.type,a=!1,l=!1,h=[];for(let i of this.dependencies)"doc"==i?a=!0:"selection"==i?l=!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(a&&e.docChanged||l&&(e.docChanged||e.selection)||W(t,h)){let e=i(t);if(o?!D(e,t.values[r],n):!n(e,t.values[r]))return t.values[r]=e,1}return 0},reconfigure:(t,e)=>{let a,l=e.config.address[s];if(null!=l){let s=tt(e,l);if(this.dependencies.every((i=>i instanceof E?e.facet(i)===t.facet(i):!(i instanceof q)||e.field(i,!1)==t.field(i,!1)))||(o?D(a=i(t),s,n):n(a=i(t),s)))return t.values[r]=s,0}else a=i(t);return t.values[r]=a,1}}}}function D(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 a(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(Y).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,Y.of({field:this,create:t})]}get extension(){return this}}const L=4,z=3,I=2,B=1;function j(t){return e=>new G(e,t)}const N={highest:j(0),high:j(B),default:j(I),low:j(z),lowest:j(L)};class G{constructor(t,e){this.inner=t,this.prec=e}}class F{of(t){return new H(this,t)}reconfigure(t){return F.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class H{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;function r(t,o){let a=s.get(t);if(null!=a){if(a<=o)return;let e=n[a].indexOf(t);e>-1&&n[a].splice(e,1),t instanceof H&&i.delete(t.compartment)}if(s.set(t,o),Array.isArray(t))for(let e of t)r(e,o);else if(t instanceof H){if(i.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");let n=e.get(t.compartment)||t.inner;i.set(t.compartment,n),r(n,o)}else if(t instanceof G)r(t.inner,t.prec);else if(t instanceof q)n[o].push(t),t.provides&&r(t.provides,o);else if(t instanceof M)n[o].push(t),t.facet.extensions&&r(t.facet.extensions,I);else{let e=t.extension;if(!e)throw new Error(`Unrecognized extension value in extension set (${t}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(e,o)}}return r(t,I),n.reduce(((t,e)=>t.concat(e)))}(t,e,r))i instanceof q?n.push(i):(s[i.facet.id]||(s[i.facet.id]=[])).push(i);let o=Object.create(null),a=[],l=[];for(let t of n)o[t.id]=l.length<<1,l.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]=a.length<<1|1,V(r,e))a.push(i.facet(n));else{let t=n.combine(e.map((t=>t.value)));a.push(i&&n.compare(t,i.facet(n))?i.facet(n):t)}else{for(let t of e)0==t.type?(o[t.id]=a.length<<1|1,a.push(t.value)):(o[t.id]=l.length<<1,l.push((e=>t.dynamicSlot(e))));o[n.id]=l.length<<1,l.push((t=>U(t,n,e)))}}let c=l.map((t=>t(o)));return new J(t,r,c,o,a,s)}}function K(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 tt(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}const et=E.define(),it=E.define({combine:t=>t.some((t=>t)),static:!0}),nt=E.define({combine:t=>t.length?t[0]:void 0,static:!0}),st=E.define(),rt=E.define(),ot=E.define(),at=E.define({combine:t=>!!t.length&&t[0]});class lt{constructor(t,e){this.type=t,this.value=e}static define(){return new ht}}class ht{of(t){return new lt(this,t)}}class ct{constructor(t){this.map=t}of(t){return new ut(this,t)}}class ut{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 ut(this.type,e)}is(t){return this.type==t}static define(t={}){return new ct(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}}ut.reconfigure=ut.define(),ut.appendConfig=ut.define();class dt{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&&T(i,e.newLength),s.some((t=>t.type==dt.time))||(this.annotations=s.concat(dt.time.of(Date.now())))}static create(t,e,i,n,s,r){return new dt(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(dt.userEvent);return!(!e||!(e==t||e.length>t.length&&e.slice(0,t.length)==t&&"."==e[t.length]))}}function ft(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=pt(n,Ot(e,r,t.changes.newLength),!0))}return n==t?t:dt.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(st)){let e=n(t);if(!1===e){i=!1;break}Array.isArray(e)&&(i=!0===i?e:ft(i,e))}if(!0!==i){let n,s;if(!1===i)s=t.changes.invertedDesc,n=k.empty(e.doc.length);else{let e=t.changes.filter(i);n=e.changes,s=e.filtered.mapDesc(e.changes).invertedDesc}t=dt.create(e,n,t.selection&&t.selection.map(s),ut.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let n=e.facet(rt);for(let i=n.length-1;i>=0;i--){let s=n[i](t);t=s instanceof dt?s:Array.isArray(s)&&1==s.length&&s[0]instanceof dt?s[0]:gt(e,bt(s),!1)}return t}(s):s)}dt.time=lt.define(),dt.userEvent=lt.define(),dt.addToHistory=lt.define(),dt.remote=lt.define();const mt=[];function bt(t){return null==t?mt:Array.isArray(t)?t:[t]}var wt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(wt||(wt={}));const vt=/[\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){}function St(t){return e=>{if(!/\S/.test(e))return wt.Space;if(function(t){if(yt)return yt.test(t);for(let e=0;e"€"&&(i.toUpperCase()!=i.toLowerCase()||vt.test(i)))return!0}return!1}(e))return wt.Word;for(let i=0;i-1)return wt.Word;return wt.Other}}class xt{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(ut.reconfigure)?(i=null,n=e.value):e.is(ut.appendConfig)&&(i=null,n=bt(n).concat(e.value));if(i)e=t.startState.values.slice();else{i=J.resolve(n,s,this),e=new xt(i,this.doc,this.selection,i.dynamicSlots.map((()=>null)),((t,e)=>e.reconfigure(t,this)),null).values}new xt(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:A.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=bt(i.effects);for(let i=1;is.spec.fromJSON(r,t))))}return xt.create({doc:t.doc,selection:A.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(xt.lineSeparator)||y)),s=e.selection?e.selection instanceof A?e.selection:A.single(e.selection.anchor,e.selection.head):A.single(0);return T(s,n.length),i.staticFacet(it)||(s=s.asSingle()),new xt(i,n,s,i.dynamicSlots.map((()=>null)),((t,e)=>e.create(t)),null)}get tabSize(){return this.facet(xt.tabSize)}get lineBreak(){return this.facet(xt.lineSeparator)||"\n"}get readOnly(){return this.facet(at)}phrase(t,...e){for(let e of this.facet(xt.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(et))for(let r of s(this,e,i))Object.prototype.hasOwnProperty.call(r,t)&&n.push(r[t]);return n}charCategorizer(t){return St(this.languageDataAt("wordChars",t).join(""))}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=f(e,r,!1);if(s(e.slice(t,r))!=wt.Word)break;r=t}for(;ot.length?t[0]:4}),xt.lineSeparator=nt,xt.readOnly=at,xt.phrases=E.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]))}}),xt.languageData=et,xt.changeFilter=st,xt.transactionFilter=rt,xt.transactionExtender=ot,F.reconfigure=ut.define();class Qt{eq(t){return this==t}range(t,e=t){return $t.create(t,e,this)}}Qt.prototype.startSide=Qt.prototype.endSide=0,Qt.prototype.point=!1,Qt.prototype.mapMode=S.TrackDel;let $t=class t{constructor(t,e,i){this.from=t,this.to=e,this.value=i}static create(e,i,n){return new t(e,i,n)}};function Pt(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Ct{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,a=s[n]-t||(i?this.value[n].endSide:this.value[n].startSide)-e;if(n==r)return a>=0?r:o;a>=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||l==h&&c.startSide>0&&c.endSide<=0)continue;(h-l||c.endSide-c.startSide)<0||(r<0&&(r=l),c.point&&(o=Math.max(o,h-l)),i.push(c),n.push(l-r),s.push(h-r))}return{mapped:i.length?new Ct(n,s,i,o):null,pos:r}}}class _t{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 _t(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(Pt)),this.isEmpty)return e.length?_t.of(e):this;let o=new At(this,null,-1).goto(0),a=0,l=[],h=new Xt;for(;o.value||a=0){let t=e[a++];h.addInner(t.from,t.to,t.value)||l.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 Tt.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return Tt.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)),a=Zt(r,o,i),l=new Et(r,a,s),h=new Et(o,a,s);i.iterGaps(((t,e,i)=>Vt(l,t,h,e,i,n))),i.empty&&0==i.length&&Vt(l,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=Zt(s,r),a=new Et(s,o,0).goto(i),l=new Et(r,o,0).goto(i);for(;;){if(a.to!=l.to||!Mt(a.active,l.active)||a.point&&(!l.point||!a.point.eq(l.point)))return!1;if(a.to>n)return!0;a.next(),l.next()}}static spans(t,e,i,n,s=-1){let r=new Et(t,null,s).goto(e),o=e,a=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,a),a=r.openEnd(t));if(r.to>i)return a+(r.point&&r.to>i?1:0);o=r.to,r.next()}}static of(t,e=!1){let i=new Xt;for(let n of t instanceof $t?[t]:e?function(t){if(t.length>1)for(let e=t[0],i=1;i0)return t.slice().sort(Pt);e=n}return t}(t):t)i.add(n.from,n.to,n.value);return i.finish()}}_t.empty=new _t([],[],null,-1),_t.empty.nextLayer=_t.empty;class Xt{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}finishChunk(t){this.chunks.push(new Ct(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=[])}add(t,e,i){this.addInner(t,e,i)||(this.nextLayer||(this.nextLayer=new Xt)).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(_t.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;let e=_t.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function Zt(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 At(r,e,i,s));return 1==n.length?n[0]:new Tt(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--)Rt(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--)Rt(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(),Rt(this.heap,0)}}}function Rt(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 Et{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=Tt.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){Dt(this.active,t),Dt(this.activeTo,t),Dt(this.activeRank,t),this.minActive=Ut(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&&Dt(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 Vt(t,e,i,n,s,r){t.goto(e),i.goto(n);let o=n+s,a=n,l=n-e;for(;;){let e=t.to+l-i.to||t.endSide-i.endSide,n=e<0?t.to+l: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))&&Mt(t.activeForPoint(t.to+l),i.activeForPoint(i.to))||r.comparePoint(a,s,t.point,i.point):s>a&&!Mt(t.active,i.active)&&r.compareRange(a,s,t.active,i.active),n>o)break;a=n,e<=0&&t.next(),e>=0&&i.next()}}function Mt(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 Ut(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(!l)throw new RangeError("The value of a property ("+i+") should be a primitive value.");s(n(i),o,a,h)}else null!=o&&a.push(i.replace(/_.*/,"").replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))+": "+o+";")}(a.length||h)&&r.push((!i||l||o?t:t.map(i)).join(", ")+" {"+a.join(" ")+"}")}for(let e in t)s(n(e),t[e],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let t=zt[qt]||1;return zt[qt]=t+1,"ͼ"+t.toString(36)}static mount(t,e){(t[Lt]||new jt(t)).mount(Array.isArray(e)?e:[e])}}let Bt=new Map;class jt{constructor(t){let e=t.ownerDocument||t,i=e.defaultView;if(!t.head&&t.adoptedStyleSheets&&i.CSSStyleSheet){let n=Bt.get(e);if(n)return t.adoptedStyleSheets=[n.sheet,...t.adoptedStyleSheets],t[Lt]=n;this.sheet=new i.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets],Bt.set(e,this)}else{this.styleTag=e.createElement("style");let i=t.head||t;i.insertBefore(this.styleTag,i.firstChild)}this.modules=[],t[Lt]=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:'"'},Ft="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),Ht="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Jt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Kt=Ht||Ft&&+Ft[1]<57,te=0;te<10;te++)Nt[48+te]=Nt[96+te]=String(te);for(te=1;te<=24;te++)Nt[te+111]="F"+te;for(te=65;te<=90;te++)Nt[te]=String.fromCharCode(te+32),Gt[te]=String.fromCharCode(te);for(var ee in Nt)Gt.hasOwnProperty(ee)||(Gt[ee]=Nt[ee]);function ie(t){let e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection()}function ne(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function se(t,e){if(!e.anchorNode)return!1;try{return ne(t,e.anchorNode)}catch(t){return!1}}function re(t){return 3==t.nodeType?me(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function oe(t,e,i,n){return!!i&&(le(t,e,i,n,-1)||le(t,e,i,n,1))}function ae(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function le(t,e,i,n,s){for(;;){if(t==i&&e==n)return!0;if(e==(s<0?0:he(t))){if("DIV"==t.nodeName)return!1;let i=t.parentNode;if(!i||1!=i.nodeType)return!1;e=ae(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?he(t):0}}}function he(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}const ce={left:0,right:0,top:0,bottom:0};function ue(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function de(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}class fe{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){this.set(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset)}set(t,e,i,n){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=n}}let pe,Oe=null;function ge(t){if(t.setActive)return t.setActive();if(Oe)return t.focus(Oe);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==Oe?{get preventScroll(){return Oe={preventScroll:!0},!0}}:void 0),!Oe){Oe=!1;for(let t=0;te)return i.domBoundsAround(t,e,l);if(c>=t&&-1==n&&(n=a,s=l),l>e&&i.dom.parentNode==this.dom){r=a,o=h;break}h=c,l=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.dirty|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.dirty|=2),1&e.dirty)return;e.dirty|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,this.dirty&&this.markParentsDirty(!0))}setDOM(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=ye){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 Qe(t,e,i,n,s,r,o,a,l){let{children:h}=t,c=h.length?h[e]:null,u=r.length?r[r.length-1]:null,d=u?u.breakAfter:o;if(!(e==n&&c&&!o&&!d&&r.length<2&&c.merge(i,s,r.length?u:null,0==i,a,l))){if(n0&&(!o&&r.length&&c.merge(i,c.length,r[0],!1,a,0)?c.breakAfter=r.shift().breakAfter:(i2);var De={mac:Me||/Mac/.test(Pe.platform),windows:/Win/.test(Pe.platform),linux:/Linux|X11/.test(Pe.platform),ie:Ae,ie_version:Xe?Ce.documentMode||6:Ze?+Ze[1]:_e?+_e[1]:0,gecko:Te,gecko_version:Te?+(/Firefox\/(\d+)/.exec(Pe.userAgent)||[0,0])[1]:0,chrome:!!Re,chrome_version:Re?+Re[1]:0,ios:Me,android:/Android\b/.test(Pe.userAgent),webkit:Ee,safari:Ve,webkit_version:Ee?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Ce.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class We extends Se{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(!i||i instanceof We&&!(this.length-(e-t)+i.length>256))&&(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),!0)}split(t){let e=new We(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new ve(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 Ye(this.dom,t,e)}}class Ue extends Se{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(we(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}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.dirty|=6)}sync(t,e){this.dom?4&this.dirty&&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 Ue&&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 Ue(this.mark,e,r)}domAtPos(t){return Ge(this,t)}coordsAt(t,e){return He(this,t,e)}}function Ye(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?De.chrome||De.gecko||(e?(s--,o=1):r=0)?0:a.length-1];return De.safari&&!o&&0==l.width&&(l=Array.prototype.find.call(a,(t=>t.width))||l),o?ue(l,o<0):l||null}class qe extends Se{constructor(t,e,i){super(),this.widget=t,this.length=e,this.side=i,this.prevWidget=null}static create(t,e,i){return new(t.customView||qe)(t,e,i)}split(t){let e=qe.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 qe&&this.widget.compare(i.widget))||t>0&&s<=0||e0)?ve.before(this.dom):ve.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let i=this.dom.getClientRects(),n=null;if(!i.length)return ce;for(let e=t>0?i.length-1:0;n=i[e],!(t>0?0==e:e==i.length-1||n.top0?-1:1);return this.length?n:ue(n,this.side>0)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class Le extends qe{domAtPos(t){let{topView:e,text:i}=this.widget;return e?ze(t,0,e,i,this.length-e.length,((t,e)=>t.domAtPos(e)),((t,e)=>new ve(t,Math.min(e,t.nodeValue.length)))):new ve(i,Math.min(t,i.nodeValue.length))}sync(){this.setDOM(this.widget.toDOM())}localPosFromDOM(t,e){let{topView:i,text:n}=this.widget;return i?Be(t,e,i,n,this.length-i.length):Math.min(e,this.length)}ignoreMutation(){return!1}get overrideDOMText(){return null}coordsAt(t,e){let{topView:i,text:n}=this.widget;return i?ze(t,e,i,n,this.length-i.length,((t,e,i)=>t.coordsAt(e,i)),((t,e,i)=>Ye(t,e,i))):Ye(n,t,e)}destroy(){var t;super.destroy(),null===(t=this.widget.topView)||void 0===t||t.destroy()}get isEditable(){return!0}canReuseDOM(){return!0}}function ze(t,e,i,n,s,r,o){if(i instanceof Ue){for(let a=i.dom.firstChild;a;a=a.nextSibling){let i=Se.get(a);if(i){let l=ne(a,n),h=i.length+(l?s:0);if(t0?ve.before(this.dom):ve.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){let e=this.dom.getBoundingClientRect(),i=function(t,e){let i=t.parent,n=i?i.children.indexOf(t):-1;for(;i&&n>=0;)if(e<0?n>0:n0?-1:1);return i&&i.tope.top?{left:e.left,right:e.right,top:i.top,bottom:i.bottom}:e}get overrideDOMText(){return t.empty}get isHidden(){return!0}}function Ge(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 Ue&&s.length&&(n=s[s.length-1])instanceof Ue&&n.mark.eq(e.mark)?Fe(n,e.children[0],i-1):(s.push(e),e.setParent(t)),t.length+=e.length}function He(t,e,i){let n=null,s=-1,r=null,o=-1;!function t(e,a){for(let l=0,h=0;l=a&&(c.children.length?t(c,a-h):(!r||r instanceof Ne&&i>0)&&(u>a||h==u&&c.getSide()>0)?(r=c,o=a-h):(h0?3e8:-4e8:e>0?1e8:-1e8,new oi(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}=ai(t,n);e=(s?n?-3e8:-1:5e8)-1,i=1+(r?n?2e8:1:-6e8)}return new oi(t,e,i,n,t.widget||null,!0)}static line(t){return new ri(t)}static set(t,e=!1){return _t.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}ni.none=_t.empty;class si extends ni{constructor(t){let{start:e,end:i}=ai(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){return this==t||t instanceof si&&this.tagName==t.tagName&&this.class==t.class&&Ke(this.attrs,t.attrs)}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}si.prototype.point=!1;class ri extends ni{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof ri&&this.spec.class==t.spec.class&&Ke(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)}}ri.prototype.mapMode=S.TrackBefore,ri.prototype.point=!0;class oi extends ni{constructor(t,e,i,n,s,r){super(e,i,s,t),this.block=n,this.isReplace=r,this.mapMode=n?e<=0?S.TrackBefore:S.TrackAfter:S.TrackDel}get type(){return this.startSide=5}eq(t){return t instanceof oi&&(e=this.widget,i=t.widget,e==i||!!(e&&i&&e.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var e,i}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 ai(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 li(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)}oi.prototype.point=!0;class hi extends Se{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 hi))return!1;this.dom||i.transferDOM(this)}return n&&this.setDeco(i?i.attrs:null),$e(this,t,e,i?i.children:[],s,r),!0}split(t){let e=new hi;if(e.breakAfter=this.breakAfter,0==this.length)return e;let{i: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){Ke(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){Fe(this,t,e)}addLineDeco(t){let e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=Je(e,this.attrs||{})),i&&(this.attrs=Je({class:i},this.attrs||{}))}domAtPos(t){return Ge(this,t)}reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.dirty|=6)}sync(t,e){var i;this.dom?4&this.dirty&&(we(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&&(ti(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&&Se.get(n)instanceof Ue;)n=n.lastChild;if(!(n&&this.length&&("BR"==n.nodeName||0!=(null===(i=Se.get(n))||void 0===i?void 0:i.isEditable)||De.ios&&this.children.some((t=>t instanceof We))))){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 We)||/[^ -~]/.test(i.text))return null;let n=re(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=He(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 hi)return s;if(r>e)break}n=r+s.breakAfter}return null}}class ci extends Se{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 ci&&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(di(new We(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 oi){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let o=e-t;if(i instanceof oi)if(i.block){let{type:t}=i;t!=ii.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new ci(i.widget||new fi("div"),o,t))}else{let r=qe.create(i.widget||new fi("span"),o,o?0:i.startSide),a=this.atCursorPos&&!r.isEditable&&s<=n.length&&(t0),l=!r.isEditable&&(tn.length||i.startSide<=0),h=this.getLine();2!=this.pendingBuffer||a||r.isEditable||(this.pendingBuffer=0),this.flushBuffer(n),a&&(h.append(di(new Ne(1),n),s),s=n.length+Math.max(0,s-n.length)),h.append(di(r,n),s),this.atCursorPos=l,this.pendingBuffer=l?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 ui(t,e,i,s);return r.openEnd=_t.spans(n,e,i,r),r.openStart<0&&(r.openStart=r.openEnd),r.finish(r.openEnd),r}}function di(t,e){for(let i of e)t=new Ue(i,[t],t.length);return t}class fi extends ei{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 pi=E.define(),Oi=E.define(),gi=E.define(),mi=E.define(),bi=E.define(),wi=E.define(),vi=E.define(),yi=E.define({combine:t=>t.some((t=>t))}),Si=E.define({combine:t=>t.some((t=>t))});class xi{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 xi(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin)}}const ki=ut.define({map:(t,e)=>t.map(e)});function Qi(t,e,i){let n=t.facet(mi);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 $i=E.define({combine:t=>!t.length||t[0]});let Pi=0;const Ci=E.define();class _i{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 _i(Pi++,t,i,(t=>{let e=[Ci.of(t)];return s&&e.push(Ti.of((e=>{let i=e.plugin(t);return i?s(i):ni.none}))),n&&e.push(n(t)),e}))}static fromClass(t,e){return _i.define((e=>new t(e)),e)}}class Xi{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(Qi(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){Qi(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){Qi(t.state,e,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Zi=E.define(),Ai=E.define(),Ti=E.define(),Ri=E.define(),Ei=E.define(),Vi=E.define();class Mi{constructor(t,e,i,n){this.fromA=t,this.toA=e,this.fromB=i,this.toB=n}join(t){return new Mi(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(!a)return i;new Mi(a.fromA,a.toA,a.fromB,a.toB).addToSet(i),r=a.toA,o=a.toB}}}class Di{constructor(t,e,i){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=k.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 Mi(t,e,i,s)))),this.changedRanges=n}static create(t,e,i){return new Di(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 Wi=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Wi||(Wi={}));const Ui=Wi.LTR,Yi=Wi.RTL;function qi(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}}const Gi=[];function Fi(t){return[new Ni(0,t,0)]}let Hi="";function Ji(t,e,i,n,s){var r;let o=n.head-t.from,a=-1;if(0==o){if(!s||!t.length)return null;e[0].level!=i&&(o=e[0].side(!1,i),a=0)}else if(o==t.length){if(s)return null;let t=e[e.length-1];t.level!=i&&(o=t.side(!0,i),a=e.length-1)}a<0&&(a=Ni.find(e,o,null!==(r=n.bidiLevel)&&void 0!==r?r:-1,n.assoc));let l=e[a];o==l.side(s,i)&&(l=e[a+=s?1:-1],o=l.side(!s,i));let h=s==(l.dir==i),c=f(t.text,o,h);if(Hi=t.text.slice(Math.min(o,c),Math.max(o,c)),c!=l.side(s,i))return A.cursor(c+t.from,h?-1:1,l.level);let u=a==(s?e.length-1:0)?null:e[a+(s?1:-1)];return u||l.level==i?u&&u.level1)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=Se.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 en(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}class nn{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class sn extends Se{constructor(t){super(),this.view=t,this.compositionDeco=ni.none,this.decorations=[],this.dynamicDecorationMap=[],this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(t.contentDOM),this.children=[new hi],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Mi(0,0,0,t.state.doc.length)],0)}get length(){return this.view.state.doc.length}update(t){let e=t.changedRanges;this.minWidth>0&&e.length&&(e.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),this.view.inputState.composing<0?this.compositionDeco=ni.none:(t.transactions.length||this.dirty)&&(this.compositionDeco=function(t,e){let i=on(t);if(!i)return ni.none;let{from:n,to:s,node:r,text:o}=i,a=e.mapPos(n,1),l=Math.max(a,e.mapPos(s,-1)),{state:h}=t,c=3==r.nodeType?r.nodeValue:new tn([],h).readRange(r.firstChild,null).text;if(l-a{this.dom.style.height=this.view.viewState.contentHeight+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let t=De.chrome||De.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,t),this.dirty=0,t&&(t.written||i.selectionRange.focusNode!=t.node)&&(this.forceSelection=!0),this.dom.style.height=""}));let n=[];if(this.view.viewport.from||this.view.viewport.to=0?t[e]:null;if(!n)break;let{fromA:s,toA:r,fromB:o,toB:a}=n,{content:l,breakAtStart:h,openStart:c,openEnd:u}=ui.build(this.view.state.doc,o,a,this.decorations,this.dynamicDecorationMap),{i:d,off:f}=i.findPos(r,1),{i:p,off:O}=i.findPos(s,-1);Qe(this,p,O,d,f,l,h,c,u)}}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&&se(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,a=this.domAtPos(o.anchor),l=o.empty?a:this.domAtPos(o.head);if(De.gecko&&o.empty&&!this.compositionDeco.size&&(1==(h=a).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((()=>a.node.insertBefore(t,a.node.childNodes[a.offset]||null))),a=l=new ve(t,0),r=!0}var h;let c=this.view.observer.selectionRange;!r&&c.focusNode&&oe(a.node,a.offset,c.anchorNode,c.anchorOffset)&&oe(l.node,l.offset,c.focusNode,c.focusOffset)||(this.view.observer.ignore((()=>{De.android&&De.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=ie(this.view.root);if(t)if(o.empty){if(De.gecko){let t=(e=a.node,n=a.offset,1!=e.nodeType?0:(n&&"false"==e.childNodes[n-1].contentEditable?1:0)|(no.head&&([a,l]=[l,a]),e.setEnd(l.node,l.offset),e.setStart(a.node,a.offset),t.removeAllRanges(),t.addRange(e)}else;var e,n;s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())})),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new ve(c.anchorNode,c.anchorOffset),this.impreciseHead=l.precise?null:new ve(c.focusNode,c.focusOffset)}enforceCursorAssoc(){if(this.compositionDeco.size)return;let{view:t}=this,e=t.state.selection.main,i=ie(t.root),{anchorNode:n,anchorOffset:s}=t.observer.selectionRange;if(!(i&&e.empty&&e.assoc&&i.modify))return;let r=hi.find(this,e.head);if(!r)return;let o=r.posAtStart;if(e.head==o||e.head==o+r.length)return;let a=this.coordsAt(e.head,-1),l=this.coordsAt(e.head,1);if(!a||!l||a.bottom>l.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)}nearest(t){for(let e=t;e;){let t=Se.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!=ii.WidgetBefore&&s.type!=ii.WidgetAfter&&(!n||2==e||this.children[n-1].breakAfter||this.children[n-1].type==ii.WidgetBefore&&e>-2))return s.coordsAt(t-r,e);i=r}}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,a=this.view.textDirection==Wi.LTR;for(let t=0,l=0;ln)break;if(t>=i){let i=h.dom.getBoundingClientRect();if(e.push(i.height),r){let e=h.dom.lastChild,n=e?re(e):[];if(n.length){let e=n[n.length-1],r=a?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?Wi.RTL:Wi.LTR}measureTextSize(){for(let t of this.children)if(t instanceof hi){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.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(n);let s=re(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 ke(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;t.push(ni.replace({widget:new rn(n),block:!0,inclusive:!0,isBlockGap:!0}).range(i,r))}if(!s)break;i=s.to+1}return ni.set(t)}updateDeco(){let t=this.view.state.facet(Ti).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=0,r=0,o=0,a=0;for(let t of this.view.state.facet(Ei).map((t=>t(this.view))))if(t){let{left:e,right:i,top:n,bottom:l}=t;null!=e&&(s=Math.max(s,e)),null!=i&&(r=Math.max(r,i)),null!=n&&(o=Math.max(o,n)),null!=l&&(a=Math.max(a,l))}let l={left:n.left-s,top:n.top-o,right:n.right+r,bottom:n.bottom+a};!function(t,e,i,n,s,r,o,a){let l=t.ownerDocument,h=l.defaultView||window;for(let c=t;c;)if(1==c.nodeType){let t,u=c==l.body;if(u)t=de(h);else{if(c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let e=c.getBoundingClientRect();t={left:e.left,right:e.left+c.clientWidth,top:e.top,bottom:e.top+c.clientHeight}}let d=0,f=0;if("nearest"==s)e.top0&&e.bottom>t.bottom+f&&(f=e.bottom-t.bottom+f+o)):e.bottom>t.bottom&&(f=e.bottom-t.bottom+o,i<0&&e.top-f0&&e.right>t.right+d&&(d=e.right-t.right+d+r)):e.right>t.right&&(d=e.right-t.right+r,i<0&&e.left0))break;i=i.childNodes[n-1],n=he(i)}if(i>=0)for(let n=t,s=e;;){if(3==n.nodeType)return n;if(!(1==n.nodeType&&s=0))break;n=n.childNodes[s],s=0}return null}class hn{constructor(){this.changes=[]}compareRange(t,e){li(t,e,this.changes)}comparePoint(t,e){li(t,e,this.changes)}}function cn(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function un(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function dn(t,e){return t.tope.top+1}function fn(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,a,l,h,c,u=!1;for(let d=t.firstChild;d;d=d.nextSibling){let t=re(d);for(let f=0;fg||o==g&&r>O){n=d,s=p,r=O,o=g;let a=g?i0?f0)}0==O?i>p.bottom&&(!h||h.bottomp.top)&&(l=d,c=p):h&&dn(h,p)?h=pn(h,p.bottom):c&&dn(c,p)&&(c=fn(c,p.top))}}if(h&&h.bottom>=i?(n=a,s=h):c&&c.top<=i&&(n=l,s=c),!n)return{node:t,offset:0};let d=Math.max(s.left,Math.min(s.right,e));return 3==n.nodeType?gn(n,d,i):u&&"false"!=n.contentEditable?On(n,d,i):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,n)+(e>=(s.left+s.right)/2?1:0)}}function gn(t,e,i){let n=t.nodeValue.length,s=-1,r=1e9,o=0;for(let a=0;ai?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(De.chrome||De.gecko){me(t,a).getBoundingClientRect().left==h.right&&(n=!i)}if(c<=0)return{node:t,offset:a+(n?1:0)};s=a+(n?1:0),r=c}}}return{node:t,offset:s>-1?s:o>0?t.nodeValue.length:0}}function mn(t,e,i,n=-1){var s,r;let o,a=t.contentDOM.getBoundingClientRect(),l=a.top+t.viewState.paddingTop,{docHeight:h}=t.viewState,{x:c,y:u}=e,d=u-l;if(d<0)return 0;if(d>h)return t.state.doc.length;for(let e=t.defaultLineHeight/2,s=!1;o=t.elementAtHeight(d),o.type!=ii.Text;)for(;d=n>0?o.bottom+e:o.top-e,!(d>=0&&d<=h);){if(s)return i?null:0;s=!0,n=-n}u=l+d;let f=o.from;if(ft.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:bn(t,a,o,c,u);let p=t.dom.ownerDocument,O=t.root.elementFromPoint?t.root:p,g=O.elementFromPoint(c,u);g&&!t.contentDOM.contains(g)&&(g=null),g||(c=Math.max(a.left+1,Math.min(a.right-1,c)),g=O.elementFromPoint(c,u),g&&!t.contentDOM.contains(g)&&(g=null));let m,b=-1;if(g&&0!=(null===(s=t.docView.nearest(g))||void 0===s?void 0:s.isEditable))if(p.caretPositionFromPoint){let t=p.caretPositionFromPoint(c,u);t&&({offsetNode:m,offset:b}=t)}else if(p.caretRangeFromPoint){let e=p.caretRangeFromPoint(c,u);e&&(({startContainer:m,startOffset:b}=e),(!t.contentDOM.contains(m)||De.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 me(t,n-1,n).getBoundingClientRect().left>i}(m,b,c)||De.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}let n=1==t.nodeType?t.getBoundingClientRect():me(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return i-n.left>5}(m,b,c))&&(m=void 0))}if(!m||!t.docView.dom.contains(m)){let e=hi.find(t.docView,f);if(!e)return d>o.top+o.height/2?o.to:o.from;({node:m,offset:b}=On(e.dom,c,u))}let w=t.docView.nearest(m);if(!w)return null;if(w.isWidget&&1==(null===(r=w.dom)||void 0===r?void 0:r.nodeType)){let t=w.dom.getBoundingClientRect();return e.y1.5*t.defaultLineHeight){r+=Math.floor((s-i.top)/t.defaultLineHeight)*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=f(t,n)}return!0===n?-1:t.length}(o,r,t.state.tabSize)}function wn(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=t.bidiSpans(s),o=t.textDirectionAt(s.from);for(let a=e,l=null;;){let e=Ji(s,r,o,a,i),h=Hi;if(!e){if(s.number==(i?t.state.doc.lines:1))return a;h="\n",s=t.state.doc.line(s.number+(i?1:-1)),r=t.bidiSpans(s),e=A.cursor(i?s.from:s.to)}if(l){if(!l(h))return a}else{if(!n)return e;l=n(h)}a=e}}function vn(t,e,i,n){let s=t.state.facet(Ri).map((e=>e(t)));for(;;){let t=!1;for(let r of s)r.between(i.from-1,i.from+1,((s,r,o)=>{i.from>s&&i.fromi.from?A.cursor(s,1):A.cursor(r,-1),t=!0,o.widget.skipPosition&&(i=o.widget.skipPosition(i,e,n)))}));if(!t)return i}}class yn{constructor(t){this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null;let e=(e,i)=>{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 Cn){let n=Cn[i];t.contentDOM.addEventListener(i,(i=>{Pn(t,i)&&e(n,i)}),_n[i]),this.registeredEvents.push(i)}t.scrollDOM.addEventListener("mousedown",(i=>{if(i.target==t.scrollDOM&&i.clientY>t.contentDOM.getBoundingClientRect().bottom&&(e(Cn.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)}})),De.chrome&&102==De.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,De.safari&&t.contentDOM.addEventListener("input",(()=>null))}setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}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=>{Pn(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){Qi(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){Qi(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||xn.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,be(t.contentDOM,e.key,e.keyCode))}ignoreDuringComposition(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(De.safari&&!De.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 Sn=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],xn="dthko",kn=[16,17,18,20,91,92,224,225];function Qn(t){return.7*Math.max(0,t)+8}class $n{constructor(t,e,i,n){this.view=t,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);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(xt.allowMultipleSelections)&&function(t,e){let i=t.state.facet(pi);return i.length?i[0](e):(De.mac,e.altKey)}(t,e),this.dragMove=function(t,e){let i=t.state.facet(Oi);return i.length?i[0](e):De.mac?!e.altKey:!e.ctrlKey}(t,e),this.dragging=!(!function(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let n=ie(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!=Yn(e))&&null}start(t){!1===this.dragging&&(t.preventDefault(),this.select(t))}move(t){var e;if(0==t.buttons)return this.destroy();if(!1!==this.dragging)return;this.select(this.lastEvent=t);let i=0,n=0,s=(null===(e=this.scrollParent)||void 0===e?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight};t.clientX<=s.left+6?i=-Qn(s.left-t.clientX):t.clientX>=s.right-6&&(i=Qn(t.clientX-s.right)),t.clientY<=s.top+6?n=-Qn(s.top-t.clientY):t.clientY>=s.bottom-6&&(n=Qn(t.clientY-s.bottom)),this.setScrollSpeed(i,n)}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)}select(t){let e=this.style.get(t,this.extend,this.multiple);!this.mustSelect&&e.eq(this.view.state.selection)&&e.main.assoc==this.view.state.selection.main.assoc||this.view.dispatch({selection:e,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.docChanged&&this.dragging&&(this.dragging=this.dragging.map(t.changes)),this.style.update(t)&&setTimeout((()=>this.select(this.lastEvent)),20)}}function Pn(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=Se.get(n))&&i.ignoreEvent(e))return!1;return!0}const Cn=Object.create(null),_n=Object.create(null),Xn=De.ie&&De.ie_version<15||De.ios&&De.webkit_version<604;function Zn(t,e){let i,{state:n}=t,s=1,r=n.toText(e),o=r.lines==n.selection.ranges.length;if(null!=Ln&&n.selection.ranges.every((t=>t.empty))&&Ln==r.toString()){let t=-1;i=n.changeByRange((i=>{let a=n.doc.lineAt(i.from);if(a.from==t)return{range:i};t=a.from;let l=n.toText((o?r.line(s++).text:e)+n.lineBreak);return{changes:{from:a.from,insert:l},range:A.cursor(i.from+l.length)}}))}else i=o?n.changeByRange((t=>{let e=r.line(s++);return{changes:{from:t.from,to:t.to,insert:e.text},range:A.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 A.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 A.cursor(e);0==r?i=1:r==s.length&&(i=-1);let o=r,a=r;i<0?o=f(s.text,r,!1):a=f(s.text,r);let l=n(s.text.slice(o,a));for(;o>0;){let t=f(s.text,o,!1);if(n(s.text.slice(t,o))!=l)break;o=t}for(;a{t.inputState.setSelectionOrigin("select"),27==e.keyCode&&(t.inputState.lastEscPress=Date.now())},Cn.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},Cn.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},_n.touchstart=_n.touchmove={passive:!0},Cn.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return;let i=null;for(let n of t.state.facet(gi))if(i=n(t,e),i)break;if(i||0!=e.button||(i=function(t,e){let i=Vn(t,e),n=Yn(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 a,l=Vn(t,e),h=An(t,l.pos,l.bias,n);if(i.pos!=l.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&&(a=function(t,e){for(let i=0;i=e)return A.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,l.pos))?a:o?s.addRange(h):A.create([h])}}}(t,e)),i){let n=t.root.activeElement!=t.contentDOM;t.inputState.startMouseSelection(new $n(t,e,i,n)),n&&t.observer.ignore((()=>ge(t.contentDOM))),t.inputState.mouseSelection&&t.inputState.mouseSelection.start(e)}};let Tn=(t,e)=>t>=e.top&&t<=e.bottom,Rn=(t,e,i)=>Tn(e,i)&&t>=i.left&&t<=i.right;function En(t,e,i,n){let s=hi.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&&Rn(i,n,o))return-1;let a=s.coordsAt(r,1);return a&&Rn(i,n,a)?1:o&&Tn(n,o)?-1:1}function Vn(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:En(t,i,e.clientX,e.clientY)}}const Mn=De.ie&&De.ie_version<=11;let Dn=null,Wn=0,Un=0;function Yn(t){if(!Mn)return t.detail;let e=Dn,i=Un;return Dn=t,Un=Date.now(),Wn=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Wn+1)%3:1}function qn(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&&r.dragMove?{from:r.dragging.from,to:r.dragging.to}:null,a={from:s,insert:i},l=t.state.changes(o?[o,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(s,-1),head:l.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"})}Cn.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")},Cn.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&&qn(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 qn(t,e,e.dataTransfer.getData("Text"),!0)},Cn.paste=(t,e)=>{if(t.state.readOnly)return e.preventDefault();t.observer.flush();let i=Xn?null:e.clipboardData;i?(Zn(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(),Zn(t,i.value)}),50)}(t)};let Ln=null;Cn.copy=Cn.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;Ln=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 zn=lt.define();function In(t,e){let i=[];for(let n of t.facet(vi)){let s=n(t,e);s&&i.push(s)}return i?t.update({effects:i,annotations:zn.of(!0)}):null}function Bn(t){setTimeout((()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=In(t.state,e);i?t.dispatch(i):t.update([])}}),10)}Cn.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),Bn(t)},Cn.blur=t=>{t.observer.clearSelectionRange(),Bn(t)},Cn.compositionstart=Cn.compositionupdate=t=>{null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},Cn.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,De.chrome&&De.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then((()=>t.observer.flush())):setTimeout((()=>{t.inputState.composing<0&&t.docView.compositionDeco.size&&t.update([])}),50)},Cn.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},Cn.beforeinput=(t,e)=>{var i;let n;if(De.chrome&&De.android&&(n=Sn.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 jn=["pre-wrap","normal","pre-line","break-spaces"];class Nn{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){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return jn.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i-1,a=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,a){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)>Jn&&(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:a,toA:l,fromB:h,toB:c}=n[o],u=s.lineAt(a,Hn.ByPosNoHeight,i.setDoc(e),0,0),d=u.to>=l?u:s.lineAt(l,Hn.ByPosNoHeight,i,0,0);for(c+=d.to-l,l=d.to;o>0&&u.from<=n[o-1].toA;)a=n[o-1].fromA,h=n[o-1].fromB,o--,a2*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 es extends ts{constructor(t,e){super(t,e,ii.Text),this.collapsed=0,this.widgetHeight=0}replace(t,e,i){let n=i[0];return 1==i.length&&(n instanceof es||n instanceof is&&4&n.flags)&&Math.abs(this.length-n.length)<10?(n instanceof is?n=new es(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.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class is 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:a}=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),l=o+r.length*a,h=Math.max(i,t-l/2);return new Fn(r.from,r.length,h,l,ii.Text)}{let n=Math.max(0,Math.min(r-s,Math.floor((t-i)/o))),{from:a,length:l}=e.doc.line(s+n);return new Fn(a,l,i+o*n,o,ii.Text)}}lineAt(t,e,i,n,s){if(e==Hn.ByHeight)return this.blockAt(t,i,n,s);if(e==Hn.ByPosNoHeight){let{from:e,to:n}=i.doc.lineAt(t);return new Fn(e,n-e,0,0,ii.Text)}let{firstLine:r,perLine:o,perChar:a}=this.heightMetrics(i,s),l=i.doc.lineAt(t),h=o+l.length*a,c=l.number-r,u=n+o*c+a*(l.from-s-c);return new Fn(l.from,l.length,Math.max(n,Math.min(u,n+this.height-h)),h,ii.Text)}forEachLine(t,e,i,n,s,r){t=Math.max(t,s),e=Math.min(e,s+this.length);let{firstLine:o,perLine:a,perChar:l}=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+=a*i+l*(t-s-i)}let n=a+l*e.length;r(new Fn(e.from,e.length,c,n,ii.Text)),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 is?i[i.length-1]=new is(t.length+n):i.push(null,new is(n-1))}if(t>0){let e=i[0];e instanceof is?i[0]=new is(t+e.length):i.unshift(new is(t-1),null)}return Kn.of(i)}decomposeLeft(t,e){e.push(new is(t-1),null)}decomposeRight(t,e){e.push(null,new is(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 is(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)>=Jn&&(o=-2);let a=new es(e,s);a.outdated=!1,i.push(a),r+=e+1}r<=s&&i.push(null,new is(s-r).updateHeight(t,r));let a=Kn.of(i);return(o<0||Math.abs(a.height-this.height)>=Jn||Math.abs(o-this.heightMetrics(t,e).perLine)>=Jn)&&(t.heightChanged=!0),a}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class ns 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 l;let h=e==Hn.ByPosNoHeight?Hn.ByPosNoHeight:Hn.ByPos;return a?l.join(this.right.lineAt(o,h,i,r,o)):this.left.lineAt(o,h,i,n,s).join(l)}forEachLine(t,e,i,n,s,r){let o=n+this.left.height,a=s+this.left.length+this.break;if(this.break)t=a&&this.right.forEachLine(t,e,i,o,a,r);else{let l=this.lineAt(a,Hn.ByPos,i,n,s);t=t&&l.from<=e&&r(l),e>l.to&&this.right.forEachLine(l.to+1,e,i,o,a,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&&ss(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,a=null;return n&&n.from<=e+s.length&&n.more?a=s=s.updateHeight(t,e,i,n):s.updateHeight(t,e,i),n&&n.from<=o+r.length&&n.more?a=r=r.updateHeight(t,o,i,n):r.updateHeight(t,o,i),a?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 ss(t,e){let i,n;null==t[e]&&(i=t[e-1])instanceof is&&(n=t[e+1])instanceof is&&t.splice(e-1,3,new is(i.length+1+n.length))}class rs{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 es?i.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new es(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)}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 es(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let i=new is(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 es)return t;let e=new es(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine(),t.type!=ii.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,t.type!=ii.WidgetBefore&&(this.covering=t)}addLineDeco(t,e){let i=this.ensureLine();i.length+=e,i.collapsed+=e,i.widgetHeight=Math.max(i.widgetHeight,t),this.writtenTo=this.pos=this.pos+e}finish(t){let e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof es||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),a=Math.max(a,n.top),l=e==t.parentNode?n.bottom:Math.min(l,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:a-(i.top+e),bottom:Math.max(a,l)-(i.top+e)}}function ls(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class hs{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 Nn(i),this.stateDeco=e.facet(Ti).filter((t=>"function"!=typeof t)),this.heightMap=Kn.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle.setDoc(e.doc),[new Mi(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ni.set(this.lineGaps.map((t=>t.draw(!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 ds(e,i))}}this.viewports=t.sort(((t,e)=>t.from-e.from)),this.scaler=this.heightMap.height<=7e6?gs:new ms(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:bs(t,this.scaler))}))}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=this.state.facet(Ti).filter((t=>"function"!=typeof t));let n=t.changedRanges,s=Mi.extendWithRanges(n,function(t,e,i){let n=new os;return _t.compare(t,e,i,n,0),n.changes}(i,this.stateDeco,t?t.changes:k.empty(this.state.doc.length))),r=this.heightMap.height;this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),s),this.heightMap.height!=r&&(t.flags|=2);let o=s.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.heado.to)||!this.viewportIsAppropriate(o))&&(o=this.getViewport(0,e));let a=!t.changes.empty||2&t.flags||o.from!=this.viewport.from||o.to!=this.viewport.to;this.viewport=o,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(Si)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let i=e.contentDOM,n=window.getComputedStyle(i),s=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Wi.RTL:Wi.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),a=i.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let h=0,c=0,u=parseInt(n.paddingTop)||0,d=parseInt(n.paddingBottom)||0;this.paddingTop==u&&this.paddingBottom==d||(this.paddingTop=u,this.paddingBottom=d,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let f=(this.printing?ls:as)(i,this.paddingTop),p=f.top-this.pixelViewport.top,O=f.bottom-this.pixelViewport.bottom;this.pixelViewport=f;let g=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(g!=this.inView&&(this.inView=g,g&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let m=a.width;if(this.contentDOMWidth==m&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,h|=8),l){let i=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(i)&&(o=!0),o||s.lineWrapping&&Math.abs(m-this.contentDOMWidth)>s.charWidth){let{lineHeight:t,charWidth:n,textHeight:a}=e.docView.measureTextSize();o=t>0&&s.refresh(r,t,n,a,m/n,i),o&&(e.docView.minWidth=0,h|=8)}p>0&&O>0?c=Math.max(p,O):p<0&&O<0&&(c=Math.min(p,O)),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 Mi(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new Gn(n.from,r))}s.heightChanged&&(h|=2)}let b=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return b&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(2&h||b)&&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,a=new ds(n.lineAt(r-1e3*i,Hn.ByHeight,s,0,0).from,n.lineAt(o+1e3*(1-i),Hn.ByHeight,s,0,0).to);if(e){let{head:t}=e.range;if(ta.to){let i,r=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=n.lineAt(t,Hn.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!=Wi.LTR&&!i)return[];let o=[],a=(n,r,l,h)=>{if(r-nn&&tt.from>=l.from&&t.to<=l.to&&Math.abs(t.from-n)t.frome))));if(!d){if(rt.from<=r&&t.to>=r))){let t=e.moveToLineBoundary(A.cursor(r),!1,!0).head;t>n&&(r=t)}d=new hs(n,r,this.gapSize(l,n,r,h))}o.push(d)};for(let t of this.viewportLines){if(t.lengtht.from&&a(t.from,s,t,e),ot.draw(this.heightOracle.lineWrapping)))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];_t.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))||bs(this.heightMap.lineAt(t,Hn.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return bs(this.heightMap.lineAt(this.scaler.fromDOM(t),Hn.ByHeight,this.heightOracle,0,0),this.scaler)}elementAtHeight(t){return bs(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 ds{constructor(t,e){this.from=t,this.to=e}}function fs(t,e,i){let n=[],s=t,r=0;return _t.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 Os(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 gs={toDOM:t=>t,fromDOM:t=>t,scale:1};class ms{constructor(t,e,i){let n=0,s=0,r=0;this.viewports=i.map((({from:i,to:s})=>{let r=e.lineAt(i,Hn.ByPos,t,0,0).top,o=e.lineAt(s,Hn.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=ebs(t,e))):t.type)}const ws=E.define({combine:t=>t.join(" ")}),vs=E.define({combine:t=>t.indexOf(!0)>-1}),ys=It.newName(),Ss=It.newName(),xs=It.newName(),ks={"&light":"."+Ss,"&dark":"."+xs};function Qs(t,e,i){return new It(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 $s=Qs("."+ys,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",borderRadius:"4px",marginTop:"0.5rem",width:"30%",minWidth:"190px",marginLeft:"auto",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&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:"#333338",fontSize:"70%",padding:".2em 1em",borderRadius:"4px"},"&light .cm-button":{background:"#eee"},"&dark .cm-button":{background:"#eee"},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",borderRadius:"0.25rem",border:"1px solid silver",padding:".0em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},ks);class Ps{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;i&&(e.push(new nn(i,n)),s==i&&r==n||e.push(new nn(s,r)));return e}(t),i=new tn(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?A.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||!ne(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||!ne(t.contentDOM,e.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(e.anchorNode,e.anchorOffset);this.newSel=A.single(n,i)}}}function Cs(e,i){let n,{newSel:s}=i,r=e.state.selection.main;if(i.bounds){let{from:s,to:o}=i.bounds,a=r.from,l=null;(8===e.inputState.lastKeyCode&&e.inputState.lastKeyTime>Date.now()-100||De.android&&i.text.length0&&a>0&&t.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if("end"==n){i-=o+Math.max(0,r-Math.min(o,a))-r}if(o=o?r-i:0,a=r+(a-o),o=r}else if(a=a?r-i:0,o=r+(o-a),a=r}return{from:r,toA:o,toB:a}}(e.state.doc.sliceString(s,o,Ki),i.text,a-s,l);h&&(De.chrome&&13==e.inputState.lastKeyCode&&h.toB==h.from+2&&i.text.slice(h.from,h.toB)==Ki+Ki&&h.toB--,n={from:s+h.from,to:s+h.toA,insert:t.of(i.text.slice(h.from,h.toB).split(Ki))})}else s&&(!e.hasFocus&&e.state.facet($i)||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))}:(De.mac||De.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=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}):De.chrome&&n&&n.from==n.to&&n.from==r.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(s&&(s=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}),n){let t=e.state;if(De.ios&&e.inputState.flushIOSKey(e))return!0;if(De.android&&(n.from==r.from&&n.to==r.to&&1==n.insert.length&&2==n.insert.lines&&be(e.contentDOM,"Enter",13)||n.from==r.from-1&&n.to==r.to&&0==n.insert.length&&be(e.contentDOM,"Backspace",8)||n.from==r.from&&n.to==r.to+1&&0==n.insert.length&&be(e.contentDOM,"Delete",46)))return!0;let i,o=n.insert.toString();if(e.state.facet(wi).some((t=>t(e,n.from,n.to,o))))return!0;if(e.inputState.composing>=0&&e.inputState.composing++,n.from>=r.from&&n.to<=r.to&&n.to-n.from>=(r.to-r.from)/3&&(!s||s.main.empty&&s.main.from==n.from+n.insert.length)&&e.inputState.composing<0){let s=r.fromn.to?t.sliceDoc(n.to,r.to):"";i=t.replaceSelection(e.state.toText(s+n.insert.sliceString(0,void 0,e.state.lineBreak)+o))}else{let o=t.changes(n),a=s&&s.main.to<=o.newLength?s.main:void 0;if(t.selection.ranges.length>1&&e.inputState.composing>=0&&n.to<=r.to&&n.to>=r.to-10){let s=e.state.sliceDoc(n.from,n.to),l=on(e)||e.state.doc.lineAt(r.head),h=r.to-n.to,c=r.to-r.from;i=t.changeByRange((i=>{if(i.from==r.from&&i.to==r.to)return{changes:o,range:a||i.map(o)};let u=i.to-h,d=u-s.length;if(i.to-i.from!=c||e.state.sliceDoc(d,u)!=s||l&&i.to>=l.from&&i.from<=l.to)return{range:i};let f=t.changes({from:d,to:u,insert:n.insert}),p=i.to-r.to;return{changes:f,range:a?A.range(Math.max(0,a.anchor+p),Math.max(0,a.head+p)):i.map(f)}}))}else i={changes:o,selection:a&&t.selection.replaceRange(a)}}let a="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,a+=".compose",e.inputState.compositionFirstChange&&(a+=".start",e.inputState.compositionFirstChange=!1)),e.dispatch(i,{scrollIntoView:!0,userEvent:a}),!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 _s={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Xs=De.ie&&De.ie_version<=11;class Zs{constructor(t){this.view=t,this.active=!1,this.selectionRange=new fe,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);(De.ie&&De.ie_version<=11||De.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()})),Xs&&(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")))}),{}),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($i)?i.root.activeElement!=this.dom:!se(i.dom,n))return;let s=n.anchorNode&&i.docView.nearest(n.anchorNode);s&&s.ignoreEvent(t)?e||(this.selectionChanged=!1):(De.ie&&De.ie_version<=11||De.android&&De.chrome)&&!i.state.selection.main.empty&&n.focusNode&&oe(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=De.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,a=t.docView.domAtPos(t.state.selection.main.anchor);oe(a.node,a.offset,r,o)&&([n,s,r,o]=[r,o,n,s]);return{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:o}}(this.view)||ie(t.root);if(!e||this.selectionRange.eq(e))return!1;let i=se(this.dom,e);return i&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let t=this.delayedAndroidKey;t&&(this.clearDelayedAndroidKey(),!this.flush()&&t.force&&be(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&&se(this.dom,this.selectionRange);return t<0&&!n?null:(t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new Ps(this.view,t,e,i))}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=Cs(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.dirty|=4),"childList"==t.type){let i=As(e,t.previousSibling||t.target.previousSibling,-1),n=As(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 As(t,e,i){for(;e;){let n=Se.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 Ts{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),this._dispatch=t.dispatch||(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 us(t.state||xt.create(t)),this.plugins=this.state.facet(Ci).map((t=>new Xi(t)));for(let t of this.plugins)t.update(this);this.observer=new Zs(this),this.inputState=new yn(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new sn(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),t.parent&&t.parent.appendChild(this.dom)}get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}dispatch(...t){this._dispatch(1==t.length&&t[0]instanceof dt?t[0]:this.state.update(...t))}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,a=null;t.some((t=>t.annotation(zn)))?(this.inputState.notifiedFocused=r,o=1):r!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=r,a=In(s,r),a||(o=1));let l=this.observer.delayedAndroidKey,h=null;if(l?(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(xt.phrases)!=this.state.facet(xt.phrases))return this.setState(s);e=Di.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 xi(t.empty?t:A.cursor(t.head,t.head>t.anchor?-1:1))}for(let t of e.effects)t.is(ki)&&(c=t.value)}this.viewState.update(e,c),this.bidiCache=Vs.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),i=this.docView.update(e),this.state.facet(Vi)!=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(ws)!=e.state.facet(ws)&&(this.viewState.mustMeasureContent=!0),(i||n||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!e.empty)for(let t of this.state.facet(bi))t(e);(a||h)&&Promise.resolve().then((()=>{a&&this.state==a.startState&&this.dispatch(a),h&&!Cs(this,h)&&l.force&&be(this.contentDOM,l.key,l.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 us(t),this.plugins=t.facet(Ci).map((t=>new Xi(t))),this.pluginMap.clear();for(let t of this.plugins)t.update(this);this.docView=new sn(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(Ci),i=t.state.facet(Ci);if(e!=i){let n=[];for(let s of i){let i=e.indexOf(s);if(i<0)n.push(new Xi(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.measureScheduled=0,t&&this.observer.forceFlush();let e=null,{scrollHeight:i,scrollTop:n,clientHeight:s}=this.scrollDOM,r=n>i-s-4?i:n;try{for(let t=0;;t++){this.updateState=1;let i=this.viewport,n=this.viewState.lineBlockAtHeight(r),s=this.viewState.measure(this);if(!s&&!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 o=[];4&s||([this.measureRequests,o]=[o,this.measureRequests]);let a=o.map((t=>{try{return t.read(this)}catch(t){return Qi(this.state,t),Es}})),l=Di.create(this,this.state,[]),h=!1,c=!1;l.flags|=s,e?e.flags|=s:e=l,this.updateState=2,l.empty||(this.updatePlugins(l),this.inputState.update(l),this.updateAttrs(),h=this.docView.update(l));for(let t=0;t1||t<-1)&&(this.scrollDOM.scrollTop+=t,c=!0)}if(h&&this.docView.updateSelection(!0),this.viewport.from==i.from&&this.viewport.to==i.to&&!c&&0==this.measureRequests.length)break}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let t of this.state.facet(bi))t(e)}get themeClasses(){return ys+" "+(this.state.facet(vs)?xs:Ss)+" "+this.state.facet(ws)}updateAttrs(){let t=Ms(this,Zi,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet($i)?"true":"false",class:"cm-content",style:`${De.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Ms(this,Ai,e);let i=this.observer.ignore((()=>{let i=ti(this.contentDOM,this.contentAttrs,e),n=ti(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)if(t.is(Ts.announce)){e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(Vi),It.mount(this.root,this.styleModules.concat($s).reverse())}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}}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 vn(this,t,wn(this,t,e,i))}moveByCharSelected(t,e,i){return vn(this,t,wn(this,t,e,i),!0)}moveByGroup(t,e){return vn(this,t,wn(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==wt.Space&&(s=e),s==e}}(this,t.head,e))))}moveToLineBoundary(t,e,i=!0){return function(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=n&&t.lineWrapping?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==Wi.LTR)?e.right-1:e.left+1,y:(r.top+r.bottom)/2});if(null!=o)return A.cursor(o,i?-1:1)}let o=hi.find(t.docView,e.head),a=o?i?o.posAtEnd:o.posAtStart:i?s.to:s.from;return A.cursor(a,i?-1:1)}(this,t,e,i)}moveVertically(t,e,i){return vn(this,t,function(t,e,i,n){let s=e.head,r=i?1:-1;if(s==(i?t.state.doc.length:0))return A.cursor(s,e.assoc);let o,a=e.goalColumn,l=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s),c=t.documentTop;if(h)null==a&&(a=h.left-l.left),o=r<0?h.top:h.bottom;else{let e=t.viewState.lineBlockAt(s);null==a&&(a=Math.min(l.right-l.left,t.defaultCharacterWidth*(s-e.from))),o=(r<0?e.top:e.bottom)+c}let u=l.left+a,d=null!=n?n:t.defaultLineHeight>>1;for(let i=0;;i+=10){let n=o+(d+i)*r,h=mn(t,{x:u,y:n},!1,r);if(nl.bottom||(r<0?hs))return A.cursor(h,e.assoc,void 0,a)}}(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(),mn(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 ue(i,s[Ni.find(s,t-n.from,-1,e)].dir==Wi.LTR==e>0)}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(yi)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Rs)return Fi(t.length);let e=this.textDirectionAt(t.from);for(let i of this.bidiCache)if(i.from==t.from&&i.dir==e)return i.order;let i=function(t,e){let i=t.length,n=e==Ui?1:2,s=e==Ui?2:1;if(!t||1==n&&!ji.test(t))return Fi(i);for(let e=0,s=n,o=n;e=0;t-=3)if(Bi[t+1]==-r){let e=Bi[t+2],i=2&e?n:4&e?1&e?s:n:0;i&&(Gi[a]=Gi[Bi[t]]=i),l=t;break}}else{if(189==Bi.length)break;Bi[l++]=a,Bi[l++]=e,Bi[l++]=h}else if(2==(o=Gi[a])||1==o){let t=o==n;h=t?0:1;for(let e=l-3;e>=0;e-=3){let i=Bi[e+2];if(2&i)break;if(t)Bi[e+2]|=2;else{if(4&i)break;Bi[e+2]|=4}}}for(let t=0;te;){let t=i,n=2!=Gi[--i];for(;i>e&&n==(2!=Gi[i-1]);)i--;o.push(new Ni(i,t,n?2:1))}else o.push(new Ni(e,t,0))}else for(let t=0;tDate.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{ge(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 ki.of(new xi("number"==typeof t?A.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}static domEventHandlers(t){return _i.define((()=>({})),{eventHandlers:t})}static theme(t,e){let i=It.newName(),n=[ws.of(i),Vi.of(Qs(`.${i}`,t))];return e&&e.dark&&n.push(vs.of(!0)),n}static baseTheme(t){return N.lowest(Vi.of(Qs("."+ys,t,ks)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),n=i&&Se.get(i)||Se.get(t);return(null===(e=null==n?void 0:n.rootView)||void 0===e?void 0:e.view)||null}}Ts.styleModule=Vi,Ts.inputHandler=wi,Ts.focusChangeEffect=vi,Ts.perLineTextDirection=yi,Ts.exceptionSink=mi,Ts.updateListener=bi,Ts.editable=$i,Ts.mouseSelectionStyle=gi,Ts.dragMovesSelection=Oi,Ts.clickAddsSelectionRange=pi,Ts.decorations=Ti,Ts.atomicRanges=Ri,Ts.scrollMargins=Ei,Ts.darkTheme=vs,Ts.contentAttributes=Ai,Ts.editorAttributes=Zi,Ts.lineWrapping=Ts.contentAttributes.of({class:"cm-lineWrapping"}),Ts.announce=ut.define();const Rs=4096,Es={};class Vs{constructor(t,e,i,n){this.from=t,this.to=e,this.dir=i,this.order=n}static update(t,e){if(e.empty)return t;let i=[],n=t.length?t[t.length-1].dir:Wi.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&&Je(r,i)}return i}const Ds=De.mac?"mac":De.windows?"win":De.linux?"linux":"key";function Ws(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 Us=N.default(Ts.domEventHandlers({keydown:(t,e)=>Bs(Ls(e.state),t,e,"editor")})),Ys=E.define({enables:Us}),qs=new WeakMap;function Ls(t){let e=t.facet(Ys),i=qs.get(e);return i||qs.set(e,i=function(t,e=Ds){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)=>{var a,l;let h=i[t]||(i[t]=Object.create(null)),c=n.split(/ (?!$)/).map((t=>function(t,e){const i=t.split(/-(?!$)/);let n,s,r,o,a=i[i.length-1];"Space"==a&&(a=" ");for(let t=0;t{let n=zs={view:e,prefix:i,scope:t};return setTimeout((()=>{zs==n&&(zs=null)}),Is),!0}]})}let u=c.join(" ");s(u,!1);let d=h[u]||(h[u]={preventDefault:!1,run:(null===(l=null===(a=h._any)||void 0===a?void 0:a.run)||void 0===l?void 0:l.slice())||[]});r&&d.run.push(r),o&&(d.preventDefault=!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,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.shift&&r(e,"Shift-"+s,n.shift,n.preventDefault)}return i}(e.reduce(((t,e)=>t.concat(e)),[]))),i}let zs=null;const Is=4e3;function Bs(t,e,i,n){let s=function(t){var e=!(Kt&&(t.ctrlKey||t.altKey||t.metaKey)||Jt&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?Gt:Nt)[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=v(b(s,0))==s.length&&" "!=s,o="",a=!1;zs&&zs.view==i&&zs.scope==n&&(o=zs.prefix+" ",(a=kn.indexOf(e.keyCode)<0)&&(zs=null));let l,h,c=new Set,u=t=>{if(t){for(let n of t.run)if(!c.has(n)&&(c.add(n),n(i,e)))return!0;t.preventDefault&&(a=!0)}return!1},d=t[n];if(d){if(u(d[o+Ws(s,e,!r)]))return!0;if(r&&(e.altKey||e.metaKey||e.ctrlKey)&&!(De.windows&&e.ctrlKey&&e.altKey)&&(l=Nt[e.keyCode])&&l!=s){if(u(d[o+Ws(l,e,!0)]))return!0;if(e.shiftKey&&(h=Gt[e.keyCode])!=s&&h!=l&&u(d[o+Ws(h,e,!1)]))return!0}else if(r&&e.shiftKey&&u(d[o+Ws(s,e,!0)]))return!0;if(u(d._any))return!0}return a}class js{constructor(t,e,i,n,s){this.className=t,this.left=e,this.top=i,this.width=n,this.height=s}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className==this.className&&(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",null!=this.width&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,i){if(i.empty){let n=t.coordsAtPos(i.head,i.assoc||1);if(!n)return[];let s=Ns(t);return[new js(e,n.left-s.left,n.top-s.top,null,n.bottom-n.top)]}return function(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];let n=Math.max(i.from,t.viewport.from),s=Math.min(i.to,t.viewport.to),r=t.textDirection==Wi.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=Ns(t),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),u=a.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),d=a.right-(c?parseInt(c.paddingRight):0),f=Fs(t,n),p=Fs(t,s),O=f.type==ii.Text?f:null,g=p.type==ii.Text?p:null;t.lineWrapping&&(O&&(O=Gs(t,n,O)),g&&(g=Gs(t,s,g)));if(O&&g&&O.from==g.from)return b(w(i.from,i.to,O));{let e=O?w(i.from,null,O):v(f,!1),n=g?w(null,i.to,g):v(p,!0),s=[];return(O||f).to<(g||p).from-1?s.push(m(u,e.bottom,d,n.top)):e.bottomh&&n.from=r)break;a>s&&l(Math.max(t,s),null==e&&t<=h,Math.min(a,r),null==i&&a>=c,o.dir)}if(s=n.to+1,s>=r)break}return 0==a.length&&l(h,null==e,c,null==i,t.textDirection),{top:s,bottom:o,horizontal:a}}function v(t,e){let i=a.top+(e?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]}}}(t,e,i)}}function Ns(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Wi.LTR?e.left:e.right-t.scrollDOM.clientWidth)-t.scrollDOM.scrollLeft,top:e.top-t.scrollDOM.scrollTop}}function Gs(t,e,i){let n=A.cursor(e);return{from:Math.max(i.from,t.moveToLineBoundary(n,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(n,!0,!0).from),type:ii.Text}}function Fs(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==ii.Text))return t;return i}class Hs{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),e.above&&this.dom.classList.add("cm-layer-above"),e.class&&this.dom.classList.add(e.class),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(Js)!=t.state.facet(Js)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&t.view.requestMeasure(this.measureReq)}setOrder(t){let e=0,i=t.facet(Js);for(;e{return i=t,n=this.drawn[e],!(i.constructor==n.constructor&&i.eq(n));var i,n}))){let e=this.dom.firstChild,i=0;for(let n of t)n.update&&e&&n.constructor&&this.drawn[i].constructor&&n.update(e,this.drawn[i])?(e=e.nextSibling,i++):this.dom.insertBefore(n.draw(),e);for(;e;){let t=e.nextSibling;e.remove(),e=t}this.drawn=t}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Js=E.define();function Ks(t){return[_i.define((e=>new Hs(e,t))),Js.of(t)]}const tr=!De.ios,er=E.define({combine:t=>kt(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})});function ir(t={}){return[er.of(t),sr,or,lr,Si.of(!0)]}function nr(t){return t.startState.facet(er)!=t.state.facet(er)}const sr=Ks({above:!0,markers(t){let{state:e}=t,i=e.facet(er),n=[];for(let s of e.selection.ranges){let r=s==e.selection.main;if(s.empty?!r||tr:i.drawRangeCursor){let e=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",i=s.empty?s:A.cursor(s.head,s.head>s.anchor?-1:1);for(let s of js.forRange(t,e,i))n.push(s)}}return n},update(t,e){t.transactions.some((t=>t.selection))&&(e.style.animationName="cm-blink"==e.style.animationName?"cm-blink2":"cm-blink");let i=nr(t);return i&&rr(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){rr(e.state,t)},class:"cm-cursorLayer"});function rr(t,e){e.style.animationDuration=t.facet(er).cursorBlinkRate+"ms"}const or=Ks({above:!1,markers:t=>t.state.selection.ranges.map((e=>e.empty?[]:js.forRange(t,"cm-selectionBackground",e))).reduce(((t,e)=>t.concat(e))),update:(t,e)=>t.docChanged||t.selectionSet||t.viewportChanged||nr(t),class:"cm-selectionLayer"}),ar={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};tr&&(ar[".cm-line"].caretColor="transparent !important");const lr=N.highest(Ts.theme(ar)),hr=ut.define({map:(t,e)=>null==t?null:e.mapPos(t)}),cr=q.define({create:()=>null,update:(t,e)=>(null!=t&&(t=e.changes.mapPos(t)),e.effects.reduce(((t,e)=>e.is(hr)?e.value:t),t))}),ur=_i.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let i=t.state.field(cr);null==i?null!=this.cursor&&(null===(e=this.cursor)||void 0===e||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(cr)!=i||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let t=this.view.state.field(cr),e=null!=t&&this.view.coordsAtPos(t);if(!e)return null;let i=this.view.scrollDOM.getBoundingClientRect();return{left:e.left-i.left+this.view.scrollDOM.scrollLeft,top:e.top-i.top+this.view.scrollDOM.scrollTop,height:e.bottom-e.top}}drawCursor(t){this.cursor&&(t?(this.cursor.style.left=t.left+"px",this.cursor.style.top=t.top+"px",this.cursor.style.height=t.height+"px"):this.cursor.style.left="-100000px")}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(cr)!=t&&this.view.dispatch({effects:hr.of(t)})}},{eventHandlers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){t.target!=this.view.contentDOM&&this.view.contentDOM.contains(t.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function dr(){return[cr,ur]}function fr(t,e,i,n,s){e.lastIndex=0;for(let r,o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)if(!o.lineBreak)for(;r=e.exec(o.value);)s(a+r.index,r)}class pr{constructor(t){const{regexp:e,decoration:i,decorate:n,boundary:s,maxLength:r=1e3}=t;if(!e.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=e,n)this.addMatch=(t,e,i,s)=>n(s,i,i+t[0].length,t,e);else if("function"==typeof i)this.addMatch=(t,e,n,s)=>{let r=i(t,e,n);r&&s(n,n+t[0].length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(t,e,n,s)=>s(n,n+t[0].length,i)}this.boundary=s,this.maxLength=r}createDeco(t){let e=new Xt,i=e.add.bind(e);for(let{from:e,to:n}of function(t,e){let i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;let n=[];for(let{from:s,to:r}of i)s=Math.max(t.state.doc.lineAt(s).from,s-e),r=Math.min(t.state.doc.lineAt(r).to,r+e),n.length&&n[n.length-1].to>=s?n[n.length-1].to=r:n.push({from:s,to:r});return n}(t,this.maxLength))fr(t.state.doc,this.regexp,e,n,((e,n)=>this.addMatch(n,t,e,i)));return e.finish()}updateDeco(t,e){let i=1e9,n=-1;return t.docChanged&&t.changes.iterChanges(((e,s,r,o)=>{o>t.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e}updateRange(t,e,i,n){for(let s of t.visibleRanges){let r=Math.max(s.from,i),o=Math.min(s.to,n);if(o>r){let i=t.state.doc.lineAt(r),n=i.toi.from;r--)if(this.boundary.test(i.text[r-1-i.from])){a=r;break}for(;oc.push(i.range(t,e));if(i==n)for(this.regexp.lastIndex=a-i.from;(h=this.regexp.exec(i.text))&&h.indexthis.addMatch(i,t,e,u)));e=e.update({filterFrom:a,filterTo:l,filter:(t,e)=>tl,add:c})}}return e}}const Or=null!=/x/.unicode?"gu":"g",gr=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",Or),mr={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let br=null;const wr=E.define({combine(t){let e=kt(t,{render:null,specialChars:gr,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==br&&"undefined"!=typeof document&&document.body){let e=document.body.style;br=null!=(null!==(t=e.tabSize)&&void 0!==t?t:e.MozTabSize)}return br||!1}())&&(e.specialChars=new RegExp("\t|"+e.specialChars.source,Or)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Or)),e}});function vr(t={}){return[wr.of(t),yr||(yr=_i.fromClass(class{constructor(t){this.view=t,this.decorations=ni.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(wr)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new pr({regexp:t.specialChars,decoration:(e,i,n)=>{let{doc:s}=i.state,r=b(e[0],0);if(9==r){let t=s.lineAt(n),e=i.state.tabSize,r=Yt(t.text,e,n-t.from);return ni.replace({widget:new xr((e-r%e)*this.view.defaultCharacterWidth)})}return this.decorationCache[r]||(this.decorationCache[r]=ni.replace({widget:new Sr(t,r)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(wr);t.startState.facet(wr)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))]}let yr=null;class Sr extends ei{constructor(t,e){super(),this.options=t,this.code=e}eq(t){return t.code==this.code}toDOM(t){let e=function(t){return t>=32?"•":10==t?"␤":String.fromCharCode(9216+t)}(this.code),i=t.state.phrase("Control character")+" "+(mr[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,i,e);if(n)return n;let s=document.createElement("span");return s.textContent=e,s.title=i,s.setAttribute("aria-label",i),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class xr extends ei{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent="\t",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}class kr extends ei{constructor(t){super(),this.content=t}toDOM(){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):this.content),"string"==typeof this.content?t.setAttribute("aria-label","placeholder "+this.content):t.setAttribute("aria-hidden","true"),t}ignoreEvent(){return!1}}const Qr="-10000px";class $r{constructor(t,e,i){this.facet=e,this.createTooltipView=i,this.input=t.state.facet(e),this.tooltips=this.input.filter((t=>t)),this.tooltipViews=this.tooltips.map(i)}update(t){var e;let i=t.state.facet(this.facet),n=i.filter((t=>t));if(i===this.input){for(let e of this.tooltipViews)e.update&&e.update(t);return!1}let s=[];for(let e=0;e{var e,i,n;return{position:De.ios?"absolute":(null===(e=t.find((t=>t.position)))||void 0===e?void 0:e.position)||"fixed",parent:(null===(i=t.find((t=>t.parent)))||void 0===i?void 0:i.parent)||null,tooltipSpace:(null===(n=t.find((t=>t.tooltipSpace)))||void 0===n?void 0:n.tooltipSpace)||Pr}}}),_r=new WeakMap,Xr=_i.fromClass(class{constructor(t){this.view=t,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(Cr);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new $r(t,Tr,(t=>this.createTooltip(t))),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout((()=>{this.measureTimeout=-1,this.maybeMeasure()}),50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t);e&&this.observeIntersection();let i=e||t.geometryChanged,n=t.state.facet(Cr);if(n.position!=this.position){this.position=n.position;for(let t of this.manager.tooltipViews)t.dom.style.position=this.position;i=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let t of this.manager.tooltipViews)this.container.appendChild(t.dom);i=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure()}createTooltip(t){let e=t.create(this.view);if(e.dom.classList.add("cm-tooltip"),t.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",e.dom.appendChild(t)}return e.dom.style.position=this.position,e.dom.style.top=Qr,this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var t,e;this.view.win.removeEventListener("resize",this.measureSoon);for(let e of this.manager.tooltipViews)e.dom.remove(),null===(t=e.destroy)||void 0===t||t.call(e);null===(e=this.intersectionObserver)||void 0===e||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=this.view.dom.getBoundingClientRect();return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map(((t,e)=>{let i=this.manager.tooltipViews[e];return i.getCoords?i.getCoords(t.pos):this.view.coordsAtPos(t.pos)})),size:this.manager.tooltipViews.map((({dom:t})=>t.getBoundingClientRect())),space:this.view.state.facet(Cr).tooltipSpace(this.view)}}writeMeasure(t){var e;let{editor:i,space:n}=t,s=[];for(let r=0;r=Math.min(i.bottom,n.bottom)||h.rightMath.min(i.right,n.right)+.1){l.style.top=Qr;continue}let u=o.arrow?a.dom.querySelector(".cm-tooltip-arrow"):null,d=u?7:0,f=c.right-c.left,p=null!==(e=_r.get(a))&&void 0!==e?e:c.bottom-c.top,O=a.offset||Ar,g=this.view.textDirection==Wi.LTR,m=c.width>n.right-n.left?g?n.left:n.right-c.width:g?Math.min(h.left-(u?14:0)+O.x,n.right-f):Math.max(n.left,h.left-f+(u?14:0)-O.x),b=!!o.above;!o.strictSide&&(b?h.top-(c.bottom-c.top)-O.yn.bottom)&&b==n.bottom-h.bottom>h.top-n.top&&(b=!b);let w=(b?h.top-n.top:n.bottom-h.bottom)-d;if(wm&&t.topv&&(v=b?t.top-p-2-d:t.bottom+d+2);"absolute"==this.position?(l.style.top=v-t.parent.top+"px",l.style.left=m-t.parent.left+"px"):(l.style.top=v+"px",l.style.left=m+"px"),u&&(u.style.left=h.left+(g?O.x:-O.x)-(m+14-7)+"px"),!0!==a.overlap&&s.push({left:m,top:v,right:y,bottom:v+p}),l.classList.toggle("cm-tooltip-above",b),l.classList.toggle("cm-tooltip-below",!b),a.positioned&&a.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=Qr}},{eventHandlers:{scroll(){this.maybeMeasure()}}}),Zr=Ts.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Ar={x:0,y:0},Tr=E.define({enables:[Xr,Zr]});function Rr(t,e){let i=t.plugin(Xr);if(!i)return null;let n=i.manager.tooltips.indexOf(e);return n<0?null:i.manager.tooltipViews[n]}const Er=E.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 Vr(t,e){let i=t.plugin(Mr),n=i?i.specs.indexOf(e):-1;return n>-1?i.panels[n]:null}const Mr=_i.fromClass(class{constructor(t){this.input=t.state.facet(Ur),this.specs=this.input.filter((t=>t)),this.panels=this.specs.map((e=>e(t)));let e=t.state.facet(Er);this.top=new Dr(t,!0,e.topContainer),this.bottom=new Dr(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(Er);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Dr(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Dr(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(Ur);if(i!=this.input){let e=i.filter((t=>t)),n=[],s=[],r=[],o=[];for(let i of e){let e,a=this.specs.indexOf(i);a<0?(e=i(t.view),o.push(e)):(e=this.panels[a],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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}}))});class Dr{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=Wr(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=Wr(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 Wr(t){let e=t.nextSibling;return t.remove(),e}const Ur=E.define({enables:Mr});class Yr extends Qt{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Yr.prototype.elementClass="",Yr.prototype.toDOM=void 0,Yr.prototype.mapMode=S.TrackBefore,Yr.prototype.startSide=Yr.prototype.endSide=-1,Yr.prototype.point=!0;const qr=E.define(),Lr={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>_t.empty,lineMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},zr=E.define();function Ir(t){return[jr(),zr.of(Object.assign(Object.assign({},Lr),t))]}const Br=E.define({combine:t=>t.some((t=>t))});function jr(t){let e=[Nr];return t&&!1===t.fixed&&e.push(Br.of(!0)),e}const Nr=_i.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+"px",this.gutters=t.state.facet(zr).map((e=>new Jr(t,e)));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!t.state.facet(Br),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(Br)!=!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=_t.iter(this.view.state.facet(qr),this.view.viewport.from),n=[],s=this.gutters.map((t=>new Hr(t,this.view.viewport,-this.view.documentPadding.top)));for(let t of this.view.viewportLineBlocks){let e;if(Array.isArray(t.type)){for(let i of t.type)if(i.type==ii.Text){e=i;break}}else e=t.type==ii.Text?t:void 0;if(e){n.length&&(n=[]),Fr(i,n,t.from);for(let t of s)t.line(this.view,e,n)}}for(let t of s)t.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(zr),i=t.state.facet(zr),n=t.docChanged||t.heightChanged||t.viewportChanged||!_t.eq(t.startState.facet(qr),t.state.facet(qr),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 Jr(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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&0!=i.gutters.length&&i.fixed?e.textDirection==Wi.LTR?{left:i.dom.offsetWidth}:{right:i.dom.offsetWidth}:null}))});function Gr(t){return Array.isArray(t)?t:[t]}function Fr(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class Hr{constructor(t,e,i){this.gutter=t,this.height=i,this.i=0,this.cursor=_t.iter(t.markers,e.from)}line(t,e,i){let n=[];Fr(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;if(0==n.length&&!r.config.renderEmptyElements)return;let o=e.top-this.height;if(this.i==r.elements.length){let i=new Kr(t,e.height,o,n);r.elements.push(i),r.dom.appendChild(i.dom)}else r.elements[this.i].update(t,e.height,o,n);this.height=e.bottom,this.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 Jr{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=Gr(e.markers(t)),e.initialSpacer&&(this.spacer=new Kr(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=Gr(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!_t.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 Kr{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.dom.style.height=(this.height=e)+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),function(t,e){if(t.length!=e.length)return!1;for(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 io extends Yr{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function no(t,e){return t.state.facet(eo).formatNumber(e,t.state)}const so=zr.compute([eo],(t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:t=>t.state.facet(to),lineMarker:(t,e,i)=>i.some((t=>t.toDOM))?null:new io(no(t,t.state.doc.lineAt(e.from).number)),lineMarkerChange:t=>t.startState.facet(eo)!=t.state.facet(eo),initialSpacer:t=>new io(no(t,ro(t.state.doc.lines))),updateSpacer(t,e){let i=no(e.view,ro(e.view.state.doc.lines));return i==t.number?t:new io(i)},domEventHandlers:t.facet(eo).domEventHandlers})));function ro(t){let e=9;for(;e{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=fo.match(t)),e=>{let i=t(e);return void 0===i?null:[this,i]}}}ho.closedBy=new ho({deserialize:t=>t.split(" ")}),ho.openedBy=new ho({deserialize:t=>t.split(" ")}),ho.group=new ho({deserialize:t=>t.split(" ")}),ho.contextHash=new ho({perNode:!0}),ho.lookAhead=new ho({perNode:!0}),ho.mounted=new ho({perNode:!0});class co{constructor(t,e,i){this.tree=t,this.overlay=e,this.parser=i}}const uo=Object.create(null);class fo{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):uo,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),n=new fo(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(ho.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(ho.group),n=-1;n<(i?i.length:0);n++){let s=e[n<0?t.name:i[n]];if(s)return s}}}}fo.none=new fo("",Object.create(null),0,8);class po{constructor(t){this.types=t;for(let e=0;e=n&&(r.type.isAnonymous||!1!==e(r))){if(r.firstChild())continue;t=!0}for(;t&&i&&!r.type.isAnonymous&&i(r),!r.nextSibling();){if(!r.parent())return;t=!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:To(fo.none,this.children,this.positions,0,this.children.length,0,this.length,((t,e,i)=>new bo(this.type,t,e,i,this.propValues)),t.makeTree||((t,e,i)=>new bo(fo.none,t,e,i)))}static build(t){return function(t){var e;let{buffer:i,nodeSet:n,maxBufferLength:s=oo,reused:r=[],minRepeatType:o=n.types.length}=t,a=Array.isArray(i)?new wo(i,i.length):i,l=n.types,h=0,c=0;function u(t,e,i,m,b){let{id:w,start:v,end:y,size:S}=a,x=c;for(;S<0;){if(a.next(),-1==S){let e=r[w];return i.push(e),void m.push(v-t)}if(-3==S)return void(h=w);if(-4==S)return void(c=w);throw new RangeError(`Unrecognized record size: ${S}`)}let k,Q,$=l[w],P=v-t;if(y-v<=s&&(Q=O(a.pos-e,b))){let e=new Uint16Array(Q.size-Q.skip),i=a.pos-Q.size,s=e.length;for(;a.pos>i;)s=g(Q.start,e,s);k=new vo(e,y-Q.start,n),P=Q.start-t}else{let t=a.pos-S;a.next();let e=[],i=[],n=w>=o?w:-1,r=0,l=y;for(;a.pos>t;)n>=0&&a.id==n&&a.size>=0?(a.end<=l-s&&(f(e,i,v,r,a.end,l,n,x),r=e.length,l=a.end),a.next()):u(v,t,e,i,n);if(n>=0&&r>0&&r-1&&r>0){let t=d($);k=To($,e,i,0,e.length,0,y-v,t,t)}else k=p($,e,i,y-v,x-y)}i.push(k),m.push(P)}function d(t){return(e,i,n)=>{let s,r,o=0,a=e.length-1;if(a>=0&&(s=e[a])instanceof bo){if(!a&&s.type==t&&s.length==n)return s;(r=s.prop(ho.lookAhead))&&(o=i[a]+s.length+r)}return p(t,e,i,n,o)}}function f(t,e,i,s,r,o,a,l){let h=[],c=[];for(;t.length>s;)h.push(t.pop()),c.push(e.pop()+i-r);t.push(p(n.types[a],h,c,o-r,l-o)),e.push(r-i)}function p(t,e,i,n,s=0,r){if(h){let t=[ho.contextHash,h];r=r?[t].concat(r):[t]}if(s>25){let t=[ho.lookAhead,s];r=r?[t].concat(r):[t]}return new bo(t,e,i,n,r)}function O(t,e){let i=a.fork(),n=0,r=0,l=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=l,l+=4,n+=4,i.next();continue}let a=i.pos-t;if(t<0||a=o?4:0,d=i.start;for(i.next();i.pos>a;){if(i.size<0){if(-3!=i.size)break t;u+=4}else i.id>=o&&(u+=4);i.next()}r=d,n+=t,l+=u}return(e<0||n==t)&&(c.size=n,c.start=r,c.skip=l),c.size>4?c:void 0}function g(t,e,i){let{id:n,start:s,end:r,size:l}=a;if(a.next(),l>=0&&n4){let n=a.pos-(l-4);for(;a.pos>n;)i=g(t,e,i)}e[--i]=o,e[--i]=r-t,e[--i]=s-t,e[--i]=n}else-3==l?h=n:-4==l&&(c=n);return i}let m=[],b=[];for(;a.pos>0;)u(t.start||0,t.bufferStart||0,m,b,-1);let w=null!==(e=t.length)&&void 0!==e?e:m.length?b[0]+m[0].length:0;return new bo(l[t.topID],m.reverse(),b.reverse(),w)}(t)}}bo.empty=new bo(fo.none,[],[],0);class wo{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 wo(this.buffer,this.index)}}class vo{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return fo.none}toString(){let t=[];for(let e=0;e0));a=r[a+3]);return o}slice(t,e,i){let n=this.buffer,s=new Uint16Array(e-t),r=0;for(let o=t,a=0;o=e&&ie;case 1:return i<=e&&n>e;case 2:return n>e;case 4:return!0}}function So(t,e){let i=t.childBefore(e);for(;i;){let e=i.lastChild;if(!e||e.to!=i.to)break;e.type.isError&&e.from==e.to?(t=i,i=e.prevSibling):i=e}return t}function xo(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!=l;t+=e){let l=o[t],h=a[t]+r.from;if(yo(n,i,h,h+l.length))if(l instanceof vo){if(s&mo.ExcludeBuffers)continue;let o=l.findChild(0,l.buffer.length,e,i-h,n);if(o>-1)return new Co(new Po(r,l,t,h),null,o)}else if(s&mo.IncludeAnonymous||!l.type.isAnonymous||Xo(l)){let o;if(!(s&mo.IgnoreMounts)&&l.props&&(o=l.prop(ho.mounted))&&!o.overlay)return new ko(o.tree,h,t,r);let a=new ko(l,h,t,r);return s&mo.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(e<0?l.children.length-1:0,e,i,n)}}if(s&mo.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&mo.IgnoreOverlays)&&(n=this._tree.prop(ho.mounted))&&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 ko(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}cursor(t=0){return new _o(this,t)}get tree(){return this._tree}toTree(){return this._tree}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return So(this,t)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}toString(){return this._tree.toString()}get node(){return this}matchContext(t){return $o(this,t)}}function Qo(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 $o(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 Po{constructor(t,e,i,n){this.parent=t,this.buffer=e,this.index=i,this.start=n}}class Co{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){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 Co(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&mo.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 Co(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 Co(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 Co(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}cursor(t=0){return new _o(this,t)}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 bo(this.type,t,e,this.to-this.from)}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return So(this,t)}toString(){return this.context.buffer.childString(this.index)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}get node(){return this}matchContext(t){return $o(this,t)}}class _o{get name(){return this.type.name}constructor(t,e=0){if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof ko)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let e=t._parent;e;e=e._parent)this.stack.unshift(e.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return!!t&&(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0)}yieldBuf(t,e){this.index=t;let{start:i,buffer:n}=this.buffer;return this.type=e||n.set.types[n.buffer[t]],this.from=i+n.buffer[t+1],this.to=i+n.buffer[t+2],!0}yield(t){return!!t&&(t instanceof ko?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,i){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,i,this.mode));let{buffer:n}=this.buffer,s=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.buffer.start,i);return!(s<0)&&(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,i=this.mode){return this.buffer?!(i&mo.ExcludeBuffers)&&this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&mo.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&mo.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode));let{buffer:e}=this.buffer,i=this.stack.length-1;if(t<0){let t=i<0?0:this.stack[i]+4;if(this.index!=t)return this.yieldBuf(e.findChild(t,this.index,-1,0,4))}else{let t=e.buffer[this.index+3];if(t<(i<0?e.buffer.length:e.buffer[this.stack[i]+3]))return this.yieldBuf(t)}return i<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,i,{buffer:n}=this;if(n){if(t>0){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&mo.IncludeAnonymous||t instanceof vo||!t.type.isAnonymous||Xo(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 $o(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 Xo(t){return t.children.some((t=>t instanceof vo||!t.type.isAnonymous||Xo(t)))}const Zo=new WeakMap;function Ao(t,e){if(!t.isAnonymous||e instanceof vo||e.type!=t)return 1;let i=Zo.get(e);if(null==i){i=1;for(let n of e.children){if(n.type!=t||!(n instanceof bo)){i=1;break}i+=Ao(t,n)}Zo.set(e,i)}return i}function To(t,e,i,n,s,r,o,a,l){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]+a);continue}u.push(i[s])}else{let e=n[h-1]+i[h-1].length-f;u.push(To(t,i,n,s,h,f,e,null,l))}d.push(f+a-r)}}(e,i,n,s,0),(a||l)(u,d,o)}class Ro{constructor(){this.map=new WeakMap}setBuffer(t,e,i){let n=this.map.get(t);n||this.map.set(t,n=new Map),n.set(e,i)}getBuffer(t,e){let i=this.map.get(t);return i&&i.get(e)}set(t,e){t instanceof Co?this.setBuffer(t.context.buffer,t.index,e):t instanceof ko&&this.map.set(t.tree,e)}get(t){return t instanceof Co?this.getBuffer(t.context.buffer,t.index):t instanceof ko?this.map.get(t.tree):void 0}cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}}class Eo{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 Eo(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,a=0,l=0;;o++){let h=o=i)for(;r&&r.from=e.from||c<=e.to||l){let t=Math.max(e.from,a)-l,i=Math.min(e.to,c)-l;e=t>=i?null:new Eo(t,i,e.tree,e.offset+l,o>0,!!h)}if(e&&n.push(e),r.to>c)break;r=snew lo(t.from,t.to))):[new lo(0,0)]:[new lo(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 Mo{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)}}function Do(t){return(e,i,n,s)=>new qo(e,t,i,n,s)}class Wo{constructor(t,e,i,n,s){this.parser=t,this.parse=e,this.overlay=i,this.target=n,this.ranges=s}}class Uo{constructor(t,e,i,n,s,r,o){this.parser=t,this.predicate=e,this.mounts=i,this.index=n,this.start=s,this.target=r,this.prev=o,this.depth=0,this.ranges=[]}}const Yo=new ho({perNode:!0});class qo{constructor(t,e,i,n,s){this.nest=e,this.input=i,this.fragments=n,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=t}advance(){if(this.baseParse){let t=this.baseParse.advance();if(!t)return null;if(this.baseParse=null,this.baseTree=t,this.startInner(),null!=this.stoppedAt)for(let t of this.inner)t.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let t=this.baseTree;return null!=this.stoppedAt&&(t=new bo(t.type,t.children,t.positions,t.length,t.propValues.concat([[Yo,this.stoppedAt]]))),t}let t=this.inner[this.innerDone],e=t.parse.advance();if(e){this.innerDone++;let i=Object.assign(Object.create(null),t.target.props);i[ho.mounted.id]=new co(e,t.overlay,t.parser),t.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let t=this.input.length;for(let e=this.innerDone;et.frag.from<=n.from&&t.frag.to>=n.to&&t.mount.overlay));if(t)for(let i of t.mount.overlay){let s=i.from+t.pos,r=i.to+t.pos;s>=n.from&&r<=n.to&&!e.ranges.some((t=>t.froms))&&e.ranges.push({from:s,to:r})}}a=!1}else if(i&&(r=Lo(i.ranges,n.from,n.to)))a=2!=r;else if(!n.type.isAnonymous&&n.fromnew lo(t.from-n.from,t.to-n.from))):null,n.tree,t)),s.overlay?t.length&&(i={ranges:t,depth:0,prev:i}):a=!1}}else e&&(o=e.predicate(n))&&(!0===o&&(o=new lo(n.from,n.to)),o.fromnew lo(t.from-e.start,t.to-e.start))),e.target,t)),e=e.prev}i&&! --i.depth&&(i=i.prev)}}}}function Lo(t,e,i){for(let n of t){if(n.from>=i)break;if(n.to>e)return n.from<=e&&n.to>=i?2:1}return 0}function zo(t,e,i,n,s,r){if(e=e.to);n++);let o=s.children[n],a=o.buffer;s.children[n]=function t(i,n,s,l,h){let c=i;for(;a[c+2]+r<=e.from;)c=a[c+3];let u=[],d=[];zo(o,i,c,u,d,l);let f=a[c+1],p=a[c+2],O=f+r==e.from&&p+r==e.to&&a[c]==e.type.id;return u.push(O?e.toTree():t(c+4,a[c+3],o.set.types[a[c]],f,p-f)),d.push(f-l),zo(o,a[c+3],n,u,d,l),new bo(s,u,d,h)}(0,a.length,fo.none,0,o.length);for(let n=0;n<=i;n++)t.childAfter(e.from)}class Bo{constructor(t,e){this.offset=e,this.done=!1,this.cursor=t.cursor(mo.IncludeAnonymous|mo.IgnoreMounts)}moveTo(t){let{cursor:e}=this,i=t-this.offset;for(;!this.done&&e.from=t&&e.enter(i,1,mo.IgnoreOverlays|mo.ExcludeBuffers)||e.next(!1)||(this.done=!0)}hasNode(t){if(this.moveTo(t.from),!this.done&&this.cursor.from+this.offset==t.from&&this.cursor.tree)for(let e=this.cursor.tree;;){if(e==t.tree)return!0;if(!(e.children.length&&0==e.positions[0]&&e.children[0]instanceof bo))break;e=e.children[0]}return!1}}let jo=class{constructor(t){var e;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){let i=this.curFrag=t[0];this.curTo=null!==(e=i.tree.prop(Yo))&&void 0!==e?e:i.to,this.inner=new Bo(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t)}nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=null!==(t=e.tree.prop(Yo))&&void 0!==t?t:e.to,this.inner=new Bo(e.tree,-e.offset)}}findMounts(t,e){var i;let n=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let t=this.inner.cursor.node;t;t=t.parent){let s=null===(i=t.tree)||void 0===i?void 0:i.prop(ho.mounted);if(s&&s.parser==e)for(let e=this.fragI;e=t.to)break;i.tree==this.curFrag.tree&&n.push({frag:i,pos:t.from-i.offset,mount:s})}}}return n}};function No(t,e){let i=null,n=e;for(let s=1,r=0;s=a)break;t.to<=o||(i||(n=i=e.slice()),t.froma&&i.splice(r+1,0,new lo(a,t.to))):t.to>a?i[r--]=new lo(a,t.to):i.splice(r--,1))}}return n}function Go(t,e,i,n){let s=0,r=0,o=!1,a=!1,l=-1e9,h=[];for(;;){let c=s==t.length?1e9:o?t[s].to:t[s].from,u=r==e.length?1e9:a?e[r].to:e[r].from;if(o!=a){let t=Math.max(l,i),e=Math.min(c,u,n);tnew lo(t.from+n,t.to+n))),a,l);for(let e=0,n=a;;e++){let a=e==o.length,h=a?l:o[e].from;if(h>n&&i.push(new Eo(n,h,s.tree,-t,r.from>=n||r.openStart,r.to<=h||r.openEnd)),a)break;n=o[e].to}}else i.push(new Eo(a,l,s.tree,-t,r.from>=t||r.openStart,r.to<=o||r.openEnd))}return i}let Ho=0;class Jo{constructor(t,e,i){this.set=t,this.base=e,this.modified=i,this.id=Ho++}static define(t){if(null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let e=new Jo([],null,[]);if(e.set.push(e),t)for(let i of t.set)e.set.push(i);return e}static defineModifier(){let t=new ta;return e=>e.modified.indexOf(t)>-1?e:ta.get(e.base||e,e.modified.concat(t).sort(((t,e)=>t.id-e.id)))}}let Ko=0;class ta{constructor(){this.instances=[],this.id=Ko++}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 Jo(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(ta.get(e,t));return s}}function ea(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,a=i[o];if(!a)throw new RangeError("Invalid path: "+t);let l=new na(n,s,o>0?i.slice(0,o):null);e[a]=l.sort(e[a])}}return ia.add(e)}const ia=new ho;class na{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 ra(t,e,i,n=0,s=t.length){let r=new oa(n,Array.isArray(e)?e:[e],i);r.highlightRange(t.cursor(),n,s,"",r.highlighters),r.flush(s)}na.empty=new na([],2,null);class oa{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:a}=t;if(o>=i||a<=e)return;r.isTop&&(s=this.highlighters.filter((t=>!t.scope||t.scope(r))));let l=n,h=function(t){let e=t.type.prop(ia);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}(t)||na.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&&(l&&(l+=" "),l+=c,1==h.mode&&(n+=(n?" ":"")+c)),this.startSpan(t.from,l),h.opaque)return;let u=t.tree&&t.tree.prop(ho.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 d=0,f=o;;d++){let p=d=O)&&t.nextSibling()););if(!p||O>i)break;f=p.to+o,f>e&&(this.highlightRange(r.cursor(),Math.max(e,p.from+o),Math.min(i,f),n,h),this.startSpan(f,l))}c&&t.parent()}else if(t.firstChild()){do{if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,n,s),this.startSpan(Math.min(i,t.to),l)}}while(t.nextSibling());t.parent()}}}const aa=Jo.define,la=aa(),ha=aa(),ca=aa(ha),ua=aa(ha),da=aa(),fa=aa(da),pa=aa(da),Oa=aa(),ga=aa(Oa),ma=aa(),ba=aa(),wa=aa(),va=aa(wa),ya=aa(),Sa={comment:la,lineComment:aa(la),blockComment:aa(la),docComment:aa(la),name:ha,variableName:aa(ha),typeName:ca,tagName:aa(ca),propertyName:ua,attributeName:aa(ua),className:aa(ha),labelName:aa(ha),namespace:aa(ha),macroName:aa(ha),literal:da,string:fa,docString:aa(fa),character:aa(fa),attributeValue:aa(fa),number:pa,integer:aa(pa),float:aa(pa),bool:aa(da),regexp:aa(da),escape:aa(da),color:aa(da),url:aa(da),keyword:ma,self:aa(ma),null:aa(ma),atom:aa(ma),unit:aa(ma),modifier:aa(ma),operatorKeyword:aa(ma),controlKeyword:aa(ma),definitionKeyword:aa(ma),moduleKeyword:aa(ma),operator:ba,derefOperator:aa(ba),arithmeticOperator:aa(ba),logicOperator:aa(ba),bitwiseOperator:aa(ba),compareOperator:aa(ba),updateOperator:aa(ba),definitionOperator:aa(ba),typeOperator:aa(ba),controlOperator:aa(ba),punctuation:wa,separator:aa(wa),bracket:va,angleBracket:aa(va),squareBracket:aa(va),paren:aa(va),brace:aa(va),content:Oa,heading:ga,heading1:aa(ga),heading2:aa(ga),heading3:aa(ga),heading4:aa(ga),heading5:aa(ga),heading6:aa(ga),contentSeparator:aa(Oa),list:aa(Oa),quote:aa(Oa),emphasis:aa(Oa),strong:aa(Oa),link:aa(Oa),monospace:aa(Oa),strikethrough:aa(Oa),inserted:aa(),deleted:aa(),changed:aa(),invalid:aa(),meta:ya,documentMeta:aa(ya),annotation:aa(ya),processingInstruction:aa(ya),definition:Jo.defineModifier(),constant:Jo.defineModifier(),function:Jo.defineModifier(),standard:Jo.defineModifier(),local:Jo.defineModifier(),special:Jo.defineModifier()};var xa;sa([{tag:Sa.link,class:"tok-link"},{tag:Sa.heading,class:"tok-heading"},{tag:Sa.emphasis,class:"tok-emphasis"},{tag:Sa.strong,class:"tok-strong"},{tag:Sa.keyword,class:"tok-keyword"},{tag:Sa.atom,class:"tok-atom"},{tag:Sa.bool,class:"tok-bool"},{tag:Sa.url,class:"tok-url"},{tag:Sa.labelName,class:"tok-labelName"},{tag:Sa.inserted,class:"tok-inserted"},{tag:Sa.deleted,class:"tok-deleted"},{tag:Sa.literal,class:"tok-literal"},{tag:Sa.string,class:"tok-string"},{tag:Sa.number,class:"tok-number"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],class:"tok-string2"},{tag:Sa.variableName,class:"tok-variableName"},{tag:Sa.local(Sa.variableName),class:"tok-variableName tok-local"},{tag:Sa.definition(Sa.variableName),class:"tok-variableName tok-definition"},{tag:Sa.special(Sa.variableName),class:"tok-variableName2"},{tag:Sa.definition(Sa.propertyName),class:"tok-propertyName tok-definition"},{tag:Sa.typeName,class:"tok-typeName"},{tag:Sa.namespace,class:"tok-namespace"},{tag:Sa.className,class:"tok-className"},{tag:Sa.macroName,class:"tok-macroName"},{tag:Sa.propertyName,class:"tok-propertyName"},{tag:Sa.operator,class:"tok-operator"},{tag:Sa.comment,class:"tok-comment"},{tag:Sa.meta,class:"tok-meta"},{tag:Sa.invalid,class:"tok-invalid"},{tag:Sa.punctuation,class:"tok-punctuation"}]);const ka=new ho;function Qa(t){return E.define({combine:t?e=>e.concat(t):void 0})}const $a=new ho;class Pa{constructor(t,e,i=[],n=""){this.data=t,this.name=n,xt.prototype.hasOwnProperty("tree")||Object.defineProperty(xt.prototype,"tree",{get(){return Xa(this)}}),this.parser=e,this.extension=[Wa.of(this),xt.languageData.of(((t,e,i)=>{let n=Ca(t,e,i),s=n.type.prop(ka);if(!s)return[];let r=t.facet(s),o=n.type.prop($a);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 Ca(t,e,i).type.prop(ka)==this.data}findRegions(t){let e=t.facet(Wa);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(ka)==this.data)return void i.push({from:e,to:e+t.length});let s=t.prop(ho.mounted);if(s){if(s.tree.prop(ka)==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;it.isTop?e:void 0))]}),t.name)}configure(t,e){return new _a(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Xa(t){let e=t.field(Pa.state,!1);return e?e.tree:bo.empty}class Za{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let i=this.cursorPos-this.string.length;return t=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i)}}let Aa=null;class Ta{constructor(t,e,i=[],n,s,r,o,a){this.parser=t,this.state=e,this.fragments=i,this.tree=n,this.treeLen=s,this.viewport=r,this.skipped=o,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(t,e,i){return new Ta(t,e,[],bo.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Za(this.state.doc),this.fragments)}work(t,e){return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=bo.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(Eo.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Aa;Aa=this;try{return t()}finally{Aa=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=Ra(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=Eo.applyChanges(i,e),n=bo.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=Ra(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 Vo{createParse(e,i,n){let s=n[0].from,r=n[n.length-1].to;return{parsedPos:s,advance(){let e=Aa;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 bo(fo.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 Aa}}function Ra(t,e,i){return Eo.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class Ea{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 Ea(e)}static init(t){let e=Math.min(3e3,t.doc.length),i=Ta.create(t.facet(Wa).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new Ea(i)}}Pa.state=q.define({create:Ea.init,update(t,e){for(let t of e.effects)if(t.is(Pa.setState))return t.value;return e.startState.facet(Wa)!=e.state.facet(Wa)?Ea.init(e.state):t.apply(e)}});let Va=t=>{let e=setTimeout((()=>t()),500);return()=>clearTimeout(e)};"undefined"!=typeof requestIdleCallback&&(Va=t=>{let e=-1,i=setTimeout((()=>{e=requestIdleCallback(t,{timeout:400})}),100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const Ma="undefined"!=typeof navigator&&(null===(xa=navigator.scheduling)||void 0===xa?void 0:xa.isInputPending)?()=>navigator.scheduling.isInputPending():null,Da=_i.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(Pa.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),t.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(Pa.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=Va(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEndn+1e3,a=s.context.work((()=>Ma&&Ma()||Date.now()>r),n+(o?0:1e5));this.chunkBudget-=Date.now()-e,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Pa.setState.of(new Ea(s.context))})),this.chunkBudget>0&&(!a||o)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then((()=>this.scheduleWork())).catch((t=>Qi(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()}}}),Wa=E.define({combine:t=>t.length?t[0]:null,enables:t=>[Pa.state,Da,Ts.contentAttributes.compute([t],(e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}}))]});class Ua{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}class Ya{constructor(t,e,i,n,s,r=void 0){this.name=t,this.alias=e,this.extensions=i,this.filename=n,this.loadFunc=s,this.support=r,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then((t=>this.support=t),(t=>{throw this.loading=null,t})))}static of(t){let{load:e,support:i}=t;if(!e){if(!i)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");e=()=>Promise.resolve(i)}return new Ya(t.name,(t.alias||[]).concat(t.name).map((t=>t.toLowerCase())),t.extensions||[],t.filename,e,i)}static matchFilename(t,e){for(let i of t)if(i.filename&&i.filename.test(e))return i;let i=/\.([^.]+)$/.exec(e);if(i)for(let e of t)if(e.extensions.indexOf(i[1])>-1)return e;return null}static matchLanguageName(t,e,i=!0){e=e.toLowerCase();for(let i of t)if(i.alias.some((t=>t==e)))return i;if(i)for(let i of t)for(let t of i.alias){let n=e.indexOf(t);if(n>-1&&(t.length>2||!/\w/.test(e[n-1])&&!/\w/.test(e[n+t.length])))return i}return null}}const qa=E.define(),La=E.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 za(t){let e=t.facet(La);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function Ia(t,e){let i="",n=t.tabSize,s=t.facet(La)[0];if("\t"==s){for(;e>=n;)i+="\t",e-=n;s=" "}for(let t=0;t=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 Yt(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 Na=new ho;function Ga(t){let e=t.type.prop(Na);if(e)return e;let i,n=t.firstChild;if(n&&(i=n.type.prop(ho.closedBy))){let e=t.lastChild,n=e&&i.indexOf(e.name)>-1;return t=>el(t,!0,1,void 0,n&&!function(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}(t)?e.from:void 0)}return null==t.parent?Ha:null}function Fa(t,e,i){for(;t;t=t.parent){let n=Ga(t);if(n)return n(Ja.create(i,e,t))}return null}function Ha(){return 0}class Ja extends ja{constructor(t,e,i){super(t.state,t.options),this.base=t,this.pos=e,this.node=i}static create(t,e,i){return new Ja(t,e,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){let t=this.state.doc.lineAt(this.node.from);for(;;){let e=this.node.resolve(t.from);for(;e.parent&&e.parent.from==e.from;)e=e.parent;if(Ka(e,this.node))break;t=this.state.doc.lineAt(e.from)}return this.lineIndent(t.from)}continue(){let t=this.node.parent;return t?Fa(t,this.pos,this.base):0}}function Ka(t,e){for(let i=e;i;i=i.parent)if(t==i)return!0;return!1}function tl({closing:t,align:e=!0,units:i=1}){return n=>el(n,e,i,t)}function el(t,e,i,n,s){let r=t.textAfter,o=r.match(/^\s*/)[0].length,a=n&&r.slice(o,o+n.length)==n||s==t.pos+o,l=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.from{let n=t&&t.test(i.textAfter);return i.baseIndent+(n?0:e*i.unit)}}function nl(){return xt.transactionFilter.of((t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let i=t.newDoc,{head:n}=t.newSelection.main,s=i.lineAt(n);if(n>s.from+200)return t;let r=i.sliceString(s.from,n);if(!e.some((t=>t.test(r))))return t;let{state:o}=t,a=-1,l=[];for(let{head:t}of o.selection.ranges){let e=o.doc.lineAt(t);if(e.from==a)continue;a=e.from;let i=Ba(o,e.from);if(null==i)continue;let n=/^\s*/.exec(e.text)[0],s=Ia(o,i);n!=s&&l.push({from:e.from,to:e.from+n.length,insert:s})}return l.length?[t,{changes:l,sequential:!0}]:t}))}const sl=E.define(),rl=new ho;function ol(t){let e=t.firstChild,i=t.lastChild;return e&&e.toi)continue;if(s&&r.from=e&&n.to>i&&(s=n)}}return s}(t,e,i)}function hl(t,e){let i=e.mapPos(t.from,1),n=e.mapPos(t.to,-1);return i>=n?void 0:{from:i,to:n}}const cl=ut.define({map:hl}),ul=ut.define({map:hl}),dl=q.define({create:()=>ni.none,update(t,e){t=t.map(e.changes);for(let i of e.effects)i.is(cl)&&!pl(t,i.value.from,i.value.to)?t=t.update({add:[bl.range(i.value.from,i.value.to)]}):i.is(ul)&&(t=t.update({filter:(t,e)=>i.value.from!=t||i.value.to!=e,filterFrom:i.value.from,filterTo:i.value.to}));if(e.selection){let i=!1,{head:n}=e.selection.main;t.between(n,n,((t,e)=>{tn&&(i=!0)})),i&&(t=t.update({filterFrom:n,filterTo:n,filter:(t,e)=>e<=n||t>=n}))}return t},provide:t=>Ts.decorations.from(t),toJSON(t,e){let i=[];return t.between(0,e.doc.length,((t,e)=>{i.push(t,e)})),i},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let i=0;i{(!s||s.from>t)&&(s={from:t,to:e})})),s}function pl(t,e,i){let n=!1;return t.between(e,e,((t,s)=>{t==e&&s==i&&(n=!0)})),n}const Ol={placeholderDOM:null,placeholderText:"…"},gl=E.define({combine:t=>kt(t,Ol)});function ml(t){let e=[dl,yl];return t&&e.push(gl.of(t)),e}const bl=ni.replace({widget:new class extends ei{toDOM(t){let{state:e}=t,i=e.facet(gl),n=e=>{let i=t.lineBlockAt(t.posAtDOM(e.target)),n=fl(t.state,i.from,i.to);n&&t.dispatch({effects:ul.of(n)}),e.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(t,n);let s=document.createElement("span");return s.textContent=i.placeholderText,s.setAttribute("aria-label",e.phrase("folded code")),s.title=e.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=n,s}}}),wl={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class vl extends Yr{constructor(t,e){super(),this.config=t,this.open=e}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let e=document.createElement("span");return e.textContent=this.open?this.config.openText:this.config.closedText,e.title=t.state.phrase(this.open?"Fold line":"Unfold line"),e}}const yl=Ts.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Sl{constructor(t,e){let i;function n(t){let e=It.newName();return(i||(i=Object.create(null)))["."+e]=t,e}this.specs=t;const s="string"==typeof e.all?e.all:e.all?n(e.all):void 0,r=e.scope;this.scope=r instanceof Pa?t=>t.prop(ka)==r.data:r?t=>t==r:void 0,this.style=sa(t.map((t=>({tag:t.tag,class:t.class||n(Object.assign({},t,{tag:null}))}))),{all:s}).style,this.module=i?new It(i):null,this.themeType=e.themeType}static define(t,e){return new Sl(t,e||{})}}const xl=E.define(),kl=E.define({combine:t=>t.length?[t[0]]:null});function Ql(t){let e=t.facet(xl);return e.length?e:t.facet(kl)}function $l(t,e){let i,n=[Cl];return t instanceof Sl&&(t.module&&n.push(Ts.styleModule.of(t.module)),i=t.themeType),(null==e?void 0:e.fallback)?n.push(kl.of(t)):i?n.push(xl.computeN([Ts.darkTheme],(e=>e.facet(Ts.darkTheme)==("dark"==i)?[t]:[]))):n.push(xl.of(t)),n}class Pl{constructor(t){this.markCache=Object.create(null),this.tree=Xa(t.state),this.decorations=this.buildDeco(t,Ql(t.state))}update(t){let e=Xa(t.state),i=Ql(t.state),n=i!=Ql(t.startState);e.length{i.add(t,e,this.markCache[n]||(this.markCache[n]=ni.mark({class:n})))}),n,s);return i.finish()}}const Cl=N.high(_i.fromClass(Pl,{decorations:t=>t.decorations})),_l=Sl.define([{tag:Sa.meta,color:"#404740"},{tag:Sa.link,textDecoration:"underline"},{tag:Sa.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Sa.emphasis,fontStyle:"italic"},{tag:Sa.strong,fontWeight:"bold"},{tag:Sa.strikethrough,textDecoration:"line-through"},{tag:Sa.keyword,color:"#708"},{tag:[Sa.atom,Sa.bool,Sa.url,Sa.contentSeparator,Sa.labelName],color:"#219"},{tag:[Sa.literal,Sa.inserted],color:"#164"},{tag:[Sa.string,Sa.deleted],color:"#a11"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],color:"#e40"},{tag:Sa.definition(Sa.variableName),color:"#00f"},{tag:Sa.local(Sa.variableName),color:"#30a"},{tag:[Sa.typeName,Sa.namespace],color:"#085"},{tag:Sa.className,color:"#167"},{tag:[Sa.special(Sa.variableName),Sa.macroName],color:"#256"},{tag:Sa.definition(Sa.propertyName),color:"#00c"},{tag:Sa.comment,color:"#940"},{tag:Sa.invalid,color:"#f00"}]),Xl=Ts.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Zl=1e4,Al="()[]{}",Tl=E.define({combine:t=>kt(t,{afterCursor:!0,brackets:Al,maxScanDistance:Zl,renderMatch:Vl})}),Rl=ni.mark({class:"cm-matchingBracket"}),El=ni.mark({class:"cm-nonmatchingBracket"});function Vl(t){let e=[],i=t.matched?Rl:El;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 Ml=q.define({create:()=>ni.none,update(t,e){if(!e.docChanged&&!e.selection)return t;let i=[],n=e.state.facet(Tl);for(let t of e.state.selection.ranges){if(!t.empty)continue;let s=Ll(e.state,t.head,-1,n)||t.head>0&&Ll(e.state,t.head-1,1,n)||n.afterCursor&&(Ll(e.state,t.head,1,n)||t.headTs.decorations.from(t)}),Dl=[Ml,Xl];function Wl(t={}){return[Tl.of(t),Dl]}const Ul=new ho;function Yl(t,e,i){let n=t.prop(e<0?ho.openedBy:ho.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 ql(t){let e=t.type.prop(Ul);return e?e(t.node):t}function Ll(t,e,i,n={}){let s=n.maxScanDistance||Zl,r=n.brackets||Al,o=Xa(t),a=o.resolveInner(e,i);for(let n=a;n;n=n.parent){let s=Yl(n.type,i,r);if(s&&n.from0?e>=o.from&&eo.from&&e<=o.to))return zl(t,e,i,n,o,s,r)}}return function(t,e,i,n,s,r,o){let a=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%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 a=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(a+t,1).type!=s))if(e%2==0==i>0)u++;else{if(1==u)return{start:h,end:{from:a+t,to:a+t+1},matched:e>>1==l>>1};u--}}i>0&&(t+=r.length)}return c.done?{start:h,matched:!1}:null}(t,e,i,o,a.type,s,r)}function zl(t,e,i,n,s,r,o){let a=n.parent,l={from:s.from,to:s.to},h=0,c=null==a?void 0:a.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 jl(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 Nl=new WeakMap;class Gl extends Pa{constructor(t){let e,i=Qa(t.languageData),n={name:(s=t).name||"",token:s.token,blankLine:s.blankLine||(()=>{}),startState:s.startState||(()=>!0),copyState:s.copyState||jl,indent:s.indent||(()=>null),languageData:s.languageData||{},tokenTable:s.tokenTable||th};var s;super(i,new class extends Vo{createParse(t,i,n){return new Jl(e,t,i,n)}},[qa.of(((t,e)=>this.getIndent(t,e)))],t.name),this.topNode=function(t){let e=fo.define({id:eh.length,name:"Document",props:[ka.add((()=>t))]});return eh.push(e),e}(i),e=this,this.streamParser=n,this.stateAfter=new ho({perNode:!0}),this.tokenTable=t.tokenTable?new rh(n.tokenTable):oh}static define(t){return new Gl(t)}getIndent(t,e){let i,n=Xa(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=Nl.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],a=i+e.positions[r],l=o instanceof bo&&a=e.length)return e;s||e.type!=t.topNode||(s=!0);for(let r=e.children.length-1;r>=0;r--){let o,a=e.positions[r],l=e.children[r];if(ai&&Fl(t,n.tree,0-n.offset,i,r);if(o&&(e=Hl(t,n.tree,i+n.offset,o.pos+n.offset,!1)))return{state:o.state,tree:e}}return{state:t.streamParser.startState(n?za(n):4),tree:bo.empty}}(t,i,r,null==s?void 0:s.state);this.state=o,this.parsedPos=this.chunkStart=r+a.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 Bl(e,t?t.state.tabSize:4,t?za(t.state):2);if(r.eol())s.blankLine(this.state,r.indentUnit);else for(;!r.eol();){let t=Kl(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 th=Object.create(null),eh=[fo.none],ih=new po(eh),nh=[],sh=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"]])sh[t]=lh(th,e);class rh{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),sh)}resolve(t){return t?this.table[t]||(this.table[t]=lh(this.extra,t)):0}}const oh=new rh(th);function ah(t,e){nh.indexOf(t)>-1||(nh.push(t),console.warn(e))}function lh(t,e){let i=null;for(let n of e.split(".")){let e=t[n]||Sa[n];e?"function"==typeof e?i?i=e(i):ah(n,`Modifier ${n} used at start of tag`):i?ah(n,`Tag ${n} used as modifier`):i=e:ah(n,`Unknown highlighting tag ${n}`)}if(!i)return 0;let n=e.replace(/ /g,"_"),s=fo.define({id:eh.length,name:n,props:[ea({[n]:i})]});return eh.push(s),s.id}function hh(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 ch=hh(gh,0),uh=hh(Oh,0),dh=hh(((t,e)=>Oh(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 fh(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}const ph=50;function Oh(t,e,i=e.selection.ranges){let n=i.map((t=>fh(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,a=t.sliceDoc(n-ph,n),l=t.sliceDoc(s,s+ph),h=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(l)[0].length,u=a.length-h;if(a.slice(u-e.length,u)==e&&l.slice(c,c+i.length)==i)return{open:{pos:n-h,margin:h&&1},close:{pos:s+c,margin:c&&1}};s-n<=2*ph?r=o=t.sliceDoc(n,s):(r=t.sliceDoc(n,n+ph),o=t.sliceDoc(s-ph,s));let d=/^\s*/.exec(r)[0].length,f=/\s*$/.exec(o)[0].length,p=o.length-f-i.length;return r.slice(d,d+e.length)==e&&o.slice(p,p+i.length)==i?{open:{pos:n+d+e.length,margin:/\s/.test(r.charAt(d+e.length))?1:0},close:{pos:s-f-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>l.from)){s=l.from;let t=/^\s*/.exec(l.text)[0].length,e=t==l.length,i=l.text.slice(t,t+a.length)==a?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 mh=lt.define(),bh=lt.define(),wh=E.define(),vh=E.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)})});const yh=q.define({create:()=>Dh.empty,update(t,e){let i=e.state.facet(vh),n=e.annotation(mh);if(n){let s=e.docChanged?A.single(function(t){let e=0;return t.iterChangedRanges(((t,i)=>e=i)),e}(e.changes)):void 0,r=Ch.fromTransaction(e,s),o=n.side,a=0==o?t.undone:t.done;return a=r?_h(a,a.length,i.minDepth,r):Th(a,e.startState.selection),new Dh(0==o?n.rest:a,0==o?a:n.rest)}let s=e.annotation(bh);if("full"!=s&&"before"!=s||(t=t.isolate()),!1===e.annotation(dt.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);let r=Ch.fromTransaction(e),o=e.annotation(dt.time),a=e.annotation(dt.userEvent);return r?t=t.addChanges(r,o,a,i,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,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 Dh(t.done.map(Ch.fromJSON),t.undone.map(Ch.fromJSON))});function Sh(t={}){return[yh,vh.of(t),Ts.domEventHandlers({beforeinput(t,e){let i="historyUndo"==t.inputType?kh:"historyRedo"==t.inputType?Qh:null;return!!i&&(t.preventDefault(),i(e))}})]}function xh(t,e){return function({state:i,dispatch:n}){if(!e&&i.readOnly)return!1;let s=i.field(yh,!1);if(!s)return!1;let r=s.pop(t,i,e);return!!r&&(n(r),!0)}}const kh=xh(0,!1),Qh=xh(1,!1),$h=xh(0,!0),Ph=xh(1,!0);class Ch{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 Ch(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 Ch(t.changes&&k.fromJSON(t.changes),[],t.mapped&&x.fromJSON(t.mapped),t.startSelection&&A.fromJSON(t.startSelection),t.selectionsAfter.map(A.fromJSON))}static fromTransaction(t,e){let i=Zh;for(let e of t.startState.facet(wh)){let n=e(t);n.length&&(i=i.concat(n))}return!i.length&&t.changes.empty?null:new Ch(t.changes.invert(t.startState.doc),i,void 0,e||t.startState.selection,Zh)}static selection(t){return new Ch(void 0,Zh,void 0,void 0,t)}}function _h(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 Xh(t,e){return t.length?e.length?t.concat(e):t:e}const Zh=[],Ah=200;function Th(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-Ah));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),_h(t,t.length-1,1e9,i.setSelAfter(n)))}return[Ch.selection([e])]}function Rh(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 Eh(t,e){if(!t.length)return t;let i=t.length,n=Zh;for(;i;){let s=Vh(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?[Ch.selection(n)]:Zh}function Vh(t,e,i){let n=Xh(t.selectionsAfter.length?t.selectionsAfter.map((t=>t.map(e))):Zh,i);if(!t.changes)return Ch.selection(n);let s=t.changes.map(e),r=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(r):r;return new Ch(s,ut.mapEffects(t.effects,e),o,t.startSelection.map(r),n)}const Mh=/^(input\.type|delete)($|\.)/;class Dh{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 Dh(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||Mh.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)?_h(r,r.length-1,n.minDepth,new Ch(t.changes.compose(o.changes),Xh(t.effects,o.effects),o.mapped,o.startSelection,Zh)):_h(r,r.length,n.minDepth,t),new Dh(r,Zh,e,i)}addSelection(t,e,i,n){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Zh;return s.length>0&&e-this.prevTimet.empty!=o.ranges[e].empty)).length)?this:new Dh(Th(this.done,t),this.undone,e,i);var r,o}addMapping(t){return new Dh(Eh(this.done,t),Eh(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:mh.of({side:t,rest:Rh(n)}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let i=1==n.length?Zh:n.slice(0,n.length-1);return s.mapped&&(i=Eh(i,s.mapped)),e.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:mh.of({side:t,rest:i}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}}Dh.empty=new Dh(Zh,Zh);const Wh=[{key:"Mod-z",run:kh,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Qh,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Qh,preventDefault:!0},{key:"Mod-u",run:$h,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Ph,preventDefault:!0}];function Uh(t,e){return A.create(t.ranges.map(e),t.mainIndex)}function Yh(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function qh({state:t,dispatch:e},i){let n=Uh(t.selection,i);return!n.eq(t.selection)&&(e(Yh(t,n)),!0)}function Lh(t,e){return A.cursor(e?t.to:t.from)}function zh(t,e){return qh(t,(i=>i.empty?t.moveByChar(i,e):Lh(i,e)))}function Ih(t){return t.textDirectionAt(t.state.selection.main.head)==Wi.LTR}const Bh=t=>zh(t,!Ih(t)),jh=t=>zh(t,Ih(t));function Nh(t,e){return qh(t,(i=>i.empty?t.moveByGroup(i,e):Lh(i,e)))}function Gh(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 Fh(t,e,i){let n,s,r=Xa(t).resolveInner(e.head),o=i?ho.closedBy:ho.openedBy;for(let n=e.head;;){let e=i?r.childAfter(n):r.childBefore(n);if(!e)break;Gh(t,e,o)?r=e:n=i?e.to:e.from}return s=r.type.prop(o)&&(n=i?Ll(t,r.from,1):Ll(t,r.to,-1))&&n.matched?i?n.end.to:n.end.from:i?r.to:r.from,A.cursor(s,i?-1:1)}function Hh(t,e){return qh(t,(i=>{if(!i.empty)return Lh(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)}))}const Jh=t=>Hh(t,!1),Kh=t=>Hh(t,!0);function tc(t){let e,i=t.scrollDOM.clientHeighti.empty?t.moveVertically(i,e,n.height):Lh(i,e)));if(r.eq(s.selection))return!1;if(n.selfScroll){let e=t.coordsAtPos(s.selection.main.head),o=t.scrollDOM.getBoundingClientRect(),a=o.top+n.marginTop,l=o.bottom-n.marginBottom;e&&e.top>a&&e.bottomec(t,!1),nc=t=>ec(t,!0);function sc(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=A.cursor(n.from+i))}return s}function rc(t,e){let i=Uh(t.state.selection,(t=>{let i=e(t);return A.range(t.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)}));return!i.eq(t.state.selection)&&(t.dispatch(Yh(t.state,i)),!0)}function oc(t,e){return console.log("Select!"),rc(t,(i=>t.moveByCharSelected(i,e)))}const ac=t=>oc(t,!Ih(t)),lc=t=>oc(t,Ih(t));function hc(t,e){return rc(t,(i=>t.moveByGroup(i,e)))}function cc(t,e){return rc(t,(i=>t.moveVertically(i,e)))}const uc=t=>cc(t,!1),dc=t=>cc(t,!0);function fc(t,e){return rc(t,(i=>t.moveVertically(i,e,tc(t).height)))}const pc=t=>fc(t,!1),Oc=t=>fc(t,!0),gc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:0})),!0),mc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.doc.length})),!0),bc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:0})),!0),wc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0);function vc(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=yc(t,n,!0)),s=Math.min(s,n),r=Math.max(r,n)}else s=yc(t,s,!1),r=yc(t,r,!0);return s==r?{range:n}:{changes:{from:s,to:r},range:A.cursor(s)}}));return!s.changes.empty&&(t.dispatch(n.update(s,{scrollIntoView:!0,userEvent:i,effects:"delete.selection"==i?Ts.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function yc(t,e,i){if(t instanceof Ts)for(let n of t.state.facet(Ts.atomicRanges).map((e=>e(t))))n.between(e,e,((t,n)=>{te&&(e=i?n:t)}));return e}const Sc=(t,e)=>vc(t,(i=>{let n,s,{state:r}=t,o=r.doc.lineAt(i);if(!e&&i>o.from&&iSc(t,!1),kc=t=>Sc(t,!0),Qc=(t,e)=>vc(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 a=f(r.text,n-r.from,e)+r.from,l=r.text.slice(Math.min(n,a)-r.from,Math.max(n,a)-r.from),h=o(l);if(null!=t&&h!=t)break;" "==l&&n==i||(t=h),n=a}return n})),$c=t=>Qc(t,!1),Pc=t=>vc(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 _c(t,e,i){if(t.readOnly)return!1;let n=[],s=[];for(let e of Cc(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(A.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(A.range(t.anchor-o,t.head-o))}}return!!n.length&&(e(t.update({changes:n,scrollIntoView:!0,selection:A.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0)}function Xc(t,e,i){if(t.readOnly)return!1;let n=[];for(let e of Cc(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 Zc=Ac(!1);function Ac(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),a=!e&&s==r&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i,n=Xa(t).resolveInner(e),s=n.childBefore(e),r=n.childAfter(e);return s&&r&&s.to<=e&&r.from>=e&&(i=s.type.prop(ho.closedBy))&&i.indexOf(r.name)>-1&&t.doc.lineAt(s.to).from==t.doc.lineAt(r.from).from?{from:s.to,to:r.from}:null}(i,s);e&&(s=r=(r<=o.to?o:i.doc.lineAt(r)).to);let l=new ja(i,{simulateBreak:s,simulateDoubleBreak:!!a}),h=Ba(l,s);for(null==h&&(h=/^\s*/.exec(i.doc.lineAt(s).text)[0].length);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:A.range(r.mapPos(n.anchor,1),r.mapPos(n.head,1))}}))}const Rc=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{i.push({from:e.from,insert:t.facet(La)})})),{userEvent:"input.indent"})),!0),Ec=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{let n=/^\s*/.exec(e.text)[0];if(!n)return;let s=Yt(n,t.tabSize),r=0,o=Ia(t,Math.max(0,s-za(t)));for(;rqh(t,(e=>Fh(t.state,e,!Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,!Ih(t))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:t=>qh(t,(e=>Fh(t.state,e,Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,Ih(t))))},{key:"Alt-ArrowUp",run:({state:t,dispatch:e})=>_c(t,e,!1)},{key:"Shift-Alt-ArrowUp",run:({state:t,dispatch:e})=>Xc(t,e,!1)},{key:"Alt-ArrowDown",run:({state:t,dispatch:e})=>_c(t,e,!0)},{key:"Shift-Alt-ArrowDown",run:({state:t,dispatch:e})=>Xc(t,e,!0)},{key:"Escape",run:({state:t,dispatch:e})=>{let i=t.selection,n=null;return i.ranges.length>1?n=A.create([i.main]):i.main.empty||(n=A.create([A.cursor(i.main.head)])),!!n&&(e(Yh(t,n)),!0)}},{key:"Mod-Enter",run:Ac(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:t,dispatch:e})=>{let i=Cc(t).map((({from:e,to:i})=>A.range(e,Math.min(i+1,t.doc.length))));return e(t.update({selection:A.create(i),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:t,dispatch:e})=>{let i=Uh(t.selection,(e=>{var i;let n=Xa(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 A.range(n.to,n.from)}));return e(Yh(t,i)),!0},preventDefault:!0},{key:"Mod-[",run:Ec},{key:"Mod-]",run:Rc},{key:"Mod-Alt-\\",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new ja(t,{overrideIndentation:t=>{let e=i[t];return null==e?-1:e}}),s=Tc(t,((e,s,r)=>{let o=Ba(n,e.from);if(null==o)return;/\S/.test(e.text)||(o=0);let a=/^\s*/.exec(e.text)[0],l=Ia(t,o);(a!=l||r.from{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(Cc(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=Uh(t.selection,(e=>{let s=Ll(t,e.head,-1)||Ll(t,e.head,1)||e.head>0&&Ll(t,e.head-1,1)||e.head{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=fh(t.state,i.from);return n.line?ch(t):!!n.block&&dh(t)}},{key:"Alt-A",run:uh}].concat([{key:"ArrowLeft",run:Bh,shift:ac,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:t=>Nh(t,!Ih(t)),shift:t=>hc(t,!Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:t=>qh(t,(e=>sc(t,e,!Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,!Ih(t)))),preventDefault:!0},{key:"ArrowRight",run:jh,shift:lc,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:t=>Nh(t,Ih(t)),shift:t=>hc(t,Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:t=>qh(t,(e=>sc(t,e,Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,Ih(t)))),preventDefault:!0},{key:"ArrowUp",run:Jh,shift:uc,preventDefault:!0},{mac:"Cmd-ArrowUp",run:gc,shift:bc},{mac:"Ctrl-ArrowUp",run:ic,shift:pc},{key:"ArrowDown",run:Kh,shift:dc,preventDefault:!0},{mac:"Cmd-ArrowDown",run:mc,shift:wc},{mac:"Ctrl-ArrowDown",run:nc,shift:Oc},{key:"PageUp",run:ic,shift:pc},{key:"PageDown",run:nc,shift:Oc},{key:"Home",run:t=>qh(t,(e=>sc(t,e,!1))),shift:t=>rc(t,(e=>sc(t,e,!1))),preventDefault:!0},{key:"Mod-Home",run:gc,shift:bc},{key:"End",run:t=>qh(t,(e=>sc(t,e,!0))),shift:t=>rc(t,(e=>sc(t,e,!0))),preventDefault:!0},{key:"Mod-End",run:mc,shift:wc},{key:"Enter",run:Zc},{key:"Mod-a",run:({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:xc,shift:xc},{key:"Delete",run:kc},{key:"Mod-Backspace",mac:"Alt-Backspace",run:$c},{key:"Mod-Delete",mac:"Alt-Delete",run:t=>Qc(t,!0)},{mac:"Mod-Backspace",run:t=>vc(t,(e=>{let i=t.lineBlockAt(e).from;return e>i?i:Math.max(0,e-1)}))},{mac:"Mod-Delete",run:Pc}].concat([{key:"Ctrl-b",run:Bh,shift:ac,preventDefault:!0},{key:"Ctrl-f",run:jh,shift:lc},{key:"Ctrl-p",run:Jh,shift:uc},{key:"Ctrl-n",run:Kh,shift:dc},{key:"Ctrl-a",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).from,1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).from)))},{key:"Ctrl-e",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).to,-1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).to)))},{key:"Ctrl-d",run:kc},{key:"Ctrl-h",run:xc},{key:"Ctrl-k",run:Pc},{key:"Ctrl-Alt-h",run:$c},{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:A.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:f(n.text,i-n.from,!1)+n.from,r=i==n.to?i+1:f(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:A.cursor(r)}}));return!i.changes.empty&&(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:nc}].map((t=>({mac:t.key,run:t.run,shift:t.shift})))));function Mc(){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 Uc{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(Wc(t)):Wc,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 b(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=w(t),i=this.bufferStart+this.bufferPos;this.bufferPos+=v(t);let n=this.normalize(e);for(let t=0,s=i;;t++){let r=n.charCodeAt(t),o=this.match(r,s);if(o)return this.value=o,this;if(t==n.length-1)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=jc(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 Ic(e,t.sliceString(e,i));return zc.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=jc(this.text,i+(t==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ic.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function jc(t,e){if(e>=t.length)return e;let i,n=t.lineAt(e);for(;e=56320&&i<57344;)e++;return e}function Nc(t){let e=Mc("input",{class:"cm-textfield",name:"line"});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,a,l]=i,h=a?+a.slice(1):0,c=o?+o:s.number;if(o&&l){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)));t.dispatch({effects:Gc.of(!1),selection:A.cursor(u.from+Math.max(0,Math.min(h,u.length))),scrollIntoView:!0}),t.focus()}return{dom:Mc("form",{class:"cm-gotoLine",onkeydown:e=>{27==e.keyCode?(e.preventDefault(),t.dispatch({effects:Gc.of(!1)}),t.focus()):13==e.keyCode&&(e.preventDefault(),i())},onsubmit:t=>{t.preventDefault(),i()}},Mc("label",t.state.phrase("Go to line"),": ",e)," ",Mc("button",{class:"cm-button",type:"submit"},t.state.phrase("go")))}}"undefined"!=typeof Symbol&&(Lc.prototype[Symbol.iterator]=Bc.prototype[Symbol.iterator]=function(){return this});const Gc=ut.define(),Fc=q.define({create:()=>!0,update(t,e){for(let i of e.effects)i.is(Gc)&&(t=i.value);return t},provide:t=>Ur.from(t,(t=>t?Nc:null))}),Hc=Ts.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),Jc={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Kc=E.define({combine:t=>kt(t,Jc,{highlightWordAroundCursor:(t,e)=>t||e,minSelectionLength:Math.min,maxMatches:Math.min})});function tu(t){let e=[ru,su];return t&&e.push(Kc.of(t)),e}const eu=ni.mark({class:"cm-selectionMatch"}),iu=ni.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function nu(t,e,i,n){return!(0!=i&&t(e.sliceDoc(i-1,i))==wt.Word||n!=e.doc.length&&t(e.sliceDoc(n,n+1))==wt.Word)}const su=_i.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(Kc),{state:i}=t,n=i.selection;if(n.ranges.length>1)return ni.none;let s,r=n.main,o=null;if(r.empty){if(!e.highlightWordAroundCursor)return ni.none;let t=i.wordAt(r.head);if(!t)return ni.none;o=i.charCategorizer(r.head),s=i.sliceDoc(t.from,t.to)}else{let t=r.to-r.from;if(t200)return ni.none;if(e.wholeWords){if(s=i.sliceDoc(r.from,r.to),o=i.charCategorizer(r.head),!nu(o,i,r.from,r.to)||!function(t,e,i,n){return t(e.sliceDoc(i,i+1))==wt.Word&&t(e.sliceDoc(n-1,n))==wt.Word}(o,i,r.from,r.to))return ni.none}else if(s=i.sliceDoc(r.from,r.to).trim(),!s)return ni.none}let a=[];for(let n of t.visibleRanges){let t=new Uc(i.doc,s,n.from,n.to);for(;!t.next().done;){let{from:n,to:s}=t.value;if((!o||nu(o,i,n,s))&&(r.empty&&n<=r.from&&s>=r.to?a.push(iu.range(n,s)):(n>=r.to||s<=r.from)&&a.push(eu.range(n,s)),a.length>e.maxMatches))return ni.none}}return ni.set(a)}},{decorations:t=>t.decorations}),ru=Ts.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});const ou=E.define({combine:t=>kt(t,{top:!1,caseSensitive:!1,literal:!1,wholeWord:!1,createPanel:t=>new Eu(t),scrollToMatch:t=>Ts.scrollIntoView(t)})});class au{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,qc),!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 pu(this):new cu(this)}getCursor(t,e=0,i){let n=t.doc?t:xt.create({doc:t});return null==i&&(i=n.doc.length),this.regexp?uu(this,n,e,i):hu(this,n,e,i)}}class lu{constructor(t){this.spec=t}}function hu(t,e,i,n){return new Uc(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=hu(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 uu(t,e,i,n){return new Lc(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?(s=e.charCategorizer(e.selection.main.head),(t,e,i)=>!i[0].length||(s(du(i.input,i.index))!=wt.Word||s(fu(i.input,i.index))!=wt.Word)&&(s(fu(i.input,i.index+i[0].length))!=wt.Word||s(du(i.input,i.index+i[0].length))!=wt.Word)):void 0},i,n);var s}function du(t,e){return t.slice(f(t,e,!1),e)}function fu(t,e){return t.slice(e,f(t,e))}class pu extends lu{nextMatch(t,e,i){let n=uu(this.spec,t,i,t.doc.length).next();return n.done&&(n=uu(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=uu(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=uu(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 Ou=ut.define(),gu=ut.define(),mu=q.define({create:t=>new bu(_u(t).create(),null),update(t,e){for(let i of e.effects)i.is(Ou)?t=new bu(i.value.create(),t.panel):i.is(gu)&&(t=new bu(t.query,i.value?Cu:null));return t},provide:t=>Ur.from(t,(t=>t.panel))});class bu{constructor(t,e){this.query=t,this.panel=e}}const wu=ni.mark({class:"cm-searchMatch"}),vu=ni.mark({class:"cm-searchMatch cm-searchMatch-selected"}),yu=_i.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(mu))}update(t){let e=t.state.field(mu);(e!=t.startState.field(mu)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ni.none;let{view:i}=this,n=new Xt;for(let e=0,s=i.visibleRanges,r=s.length;es[e+1].from-500;)a=s[++e].to;t.highlight(i.state,o,a,((t,e)=>{let s=i.state.selection.ranges.some((i=>i.from==t&&i.to==e));n.add(t,e,s?vu:wu)}))}return n.finish()}},{decorations:t=>t.decorations});function Su(t){return e=>{let i=e.state.field(mu,!1);return i&&i.query.spec.valid?t(e,i):Au(e)}}const xu=Su(((t,{query:e})=>{let{to:i}=t.state.selection.main,n=e.nextMatch(t.state,i,i);if(!n)return!1;let s=A.single(n.from,n.to),r=t.state.facet(ou);return t.dispatch({selection:s,effects:[Wu(t,n),r.scrollToMatch(s.main,t)],userEvent:"select.search"}),Zu(t),!0})),ku=Su(((t,{query:e})=>{let{state:i}=t,{from:n}=i.selection.main,s=e.prevMatch(i,n,n);if(!s)return!1;let r=A.single(s.from,s.to),o=t.state.facet(ou);return t.dispatch({selection:r,effects:[Wu(t,s),o.scrollToMatch(r.main,t)],userEvent:"select.search"}),Zu(t),!0})),Qu=Su(((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!(!i||!i.length)&&(t.dispatch({selection:A.create(i.map((t=>A.range(t.from,t.to)))),userEvent:"select.search.matches"}),!0)})),$u=Su(((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,a,l=[],h=[];if(r.from==n&&r.to==s&&(a=i.toText(e.getReplacement(r)),l.push({from:r.from,to:r.to,insert:a}),r=e.nextMatch(i,r.from,r.to),h.push(Ts.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(n).number)+"."))),r){let e=0==l.length||l[0].from>=r.to?0:r.to-r.from-a.length;o=A.single(r.from-e,r.to-e),h.push(Wu(t,r)),h.push(i.facet(ou).scrollToMatch(o.main,t))}return t.dispatch({changes:l,selection:o,effects:h,userEvent:"input.replace"}),!0})),Pu=Su(((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:Ts.announce.of(n),userEvent:"input.replace.all"}),!0}));function Cu(t){return t.state.facet(ou).createPanel(t)}function _u(t,e){var i,n,s,r;let o=t.selection.main,a=o.empty||o.to>o.from+100?"":t.sliceDoc(o.from,o.to);if(e&&!a)return e;let l=t.facet(ou);return new au({search:(null!==(i=null==e?void 0:e.literal)&&void 0!==i?i:l.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:null!==(n=null==e?void 0:e.caseSensitive)&&void 0!==n?n:l.caseSensitive,literal:null!==(s=null==e?void 0:e.literal)&&void 0!==s?s:l.literal,wholeWord:null!==(r=null==e?void 0:e.wholeWord)&&void 0!==r?r:l.wholeWord})}function Xu(t){let e=Vr(t,Cu);return e&&e.dom.querySelector("[main-field]")}function Zu(t){let e=Xu(t);e&&e==t.root.activeElement&&e.select()}const Au=t=>{let e=t.state.field(mu,!1);if(e&&e.panel){let i=Xu(t);if(i&&i!=t.root.activeElement){let n=_u(t.state,e.query.spec);n.valid&&t.dispatch({effects:Ou.of(n)}),i.focus(),i.select()}}else t.dispatch({effects:[gu.of(!0),e?Ou.of(_u(t.state,e.query.spec)):ut.appendConfig.of(Yu)]});return!0},Tu=t=>{let e=t.state.field(mu,!1);if(!e||!e.panel)return!1;let i=Vr(t,Cu);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:gu.of(!1)}),!0},Ru=[{key:"Mod-f",run:Au,scope:"editor search-panel"},{key:"F3",run:xu,shift:ku,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:xu,shift:ku,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Tu,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 Uc(t.doc,t.sliceDoc(n,s));!e.next().done;){if(r.length>1e3)return!1;e.value.from==n&&(o=r.length),r.push(A.range(e.value.from,e.value.to))}return e(t.update({selection:A.create(r,o),userEvent:"select.search.matches"})),!0}},{key:"Alt-g",run:t=>{let e=Vr(t,Nc);if(!e){let i=[Gc.of(!0)];null==t.state.field(Fc,!1)&&i.push(ut.appendConfig.of([Fc,Hc])),t.dispatch({effects:i}),e=Vr(t,Nc)}return e&&e.dom.querySelector("input").focus(),!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=A.create(i.ranges.map((e=>t.wordAt(e.head)||A.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 Uc(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 Uc(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(A.range(s.from,s.to),!1),effects:Ts.scrollIntoView(s.to)})),!0)},preventDefault:!0}];class Eu{constructor(t){this.view=t;let e=this.query=t.state.field(mu).query.spec;function i(t,e,i){return Mc("button",{class:"cm-button",name:t,onclick:e,type:"button"},i)}this.commit=this.commit.bind(this),this.searchField=Mc("input",{value:e.search,placeholder:Vu(t,"Find"),"aria-label":Vu(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Mc("input",{value:e.replace,placeholder:Vu(t,"Replace"),"aria-label":Vu(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Mc("input",{type:"checkbox",name:"case",form:"",checked:e.caseSensitive,onchange:this.commit}),this.reField=Mc("input",{type:"checkbox",name:"re",form:"",checked:e.regexp,onchange:this.commit}),this.wordField=Mc("input",{type:"checkbox",name:"word",form:"",checked:e.wholeWord,onchange:this.commit}),this.dom=Mc("div",{onkeydown:t=>this.keydown(t),class:"cm-search"},[this.searchField,i("next",(()=>xu(t)),[Vu(t,"next")]),i("prev",(()=>ku(t)),[Vu(t,"previous")]),i("select",(()=>Qu(t)),[Vu(t,"all")]),...t.state.readOnly?[]:[Mc("br"),this.replaceField,i("replace",(()=>$u(t)),[Vu(t,"replace")]),i("replaceAll",(()=>Pu(t)),[Vu(t,"replace all")])],Mc("button",{name:"close",onclick:()=>Tu(t),"aria-label":Vu(t,"close"),type:"button"},["×"])])}commit(){let t=new au({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:Ou.of(t)}))}keydown(t){var e,i,n;e=this.view,i=t,n="search-panel",Bs(Ls(e.state),i,e,n)?t.preventDefault():13==t.keyCode&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?ku:xu)(this.view)):13==t.keyCode&&t.target==this.replaceField&&(t.preventDefault(),$u(this.view))}update(t){for(let e of t.transactions)for(let t of e.effects)t.is(Ou)&&!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(ou).top}}function Vu(t,e){return t.state.phrase(e)}const Mu=30,Du=/[\s\.,:;?!]/;function Wu(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-Mu),o=Math.min(s,i+Mu),a=t.state.sliceDoc(r,o);if(r!=n.from)for(let t=0;ta.length-Mu;t--)if(!Du.test(a[t-1])&&Du.test(a[t])){a=a.slice(0,t);break}return Ts.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${n.number}.`)}const Uu=Ts.baseTheme({".cm-panel.cm-search":{padding:"0.25rem 0.5rem 0.25rem 0.5rem",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"0.5rem",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"}}),Yu=[mu,N.lowest(yu),Uu];class qu{constructor(t,e,i){this.state=t,this.pos=e,this.explicit=i,this.abortListeners=[]}tokenBefore(t){let e=Xa(this.state).resolveInner(this.pos,-1);for(;e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null}matchBefore(t){let e=this.state.doc.lineAt(this.pos),i=Math.max(e.from,this.pos-250),n=e.text.slice(i-e.from,this.pos-e.from),s=n.search(ju(t,!1));return s<0?null:{from:i+s,to:this.pos,text:n.slice(s)}}get aborted(){return null==this.abortListeners}addEventListener(t,e){"abort"==t&&this.abortListeners&&this.abortListeners.push(e)}}function Lu(t){let e=Object.keys(t).join(""),i=/\w/.test(e);return i&&(e=e.replace(/\w/g,"")),`[${i?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function zu(t){let e=t.map((t=>"string"==typeof t?{label:t}:t)),[i,n]=e.every((t=>/^\w+$/.test(t.label)))?[/\w*$/,/\w+$/]:function(t){let e=Object.create(null),i=Object.create(null);for(let{label:n}of t){e[n[0]]=!0;for(let t=1;t{let s=t.matchBefore(n);return s||t.explicit?{from:s?s.from:t.pos,options:e,validFor:i}:null}}class Iu{constructor(t,e,i,n){this.completion=t,this.source=e,this.match=i,this.score=n}}function Bu(t){return t.selection.main.from}function ju(t,e){var i;let{source:n}=t,s=e&&"^"!=n[0],r="$"!=n[n.length-1];return s||r?new RegExp(`${s?"^":""}(?:${n})${r?"$":""}`,null!==(i=t.flags)&&void 0!==i?i:t.ignoreCase?"i":""):t}const Nu=lt.define();const Gu=new WeakMap;function Fu(t){if(!Array.isArray(t))return t;let e=Gu.get(t);return e||Gu.set(t,e=zu(t)),e}const Hu=ut.define(),Ju=ut.define();class Ku{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[];for(let e=0;e=48&&l<=57||l>=97&&l<=122?2:l>=65&&l<=90?1:0:(y=w(l))!=y.toLowerCase()?1:y!=y.toUpperCase()?2:0;(!n||1==S&&O||0==m&&0!=S)&&(e[c]==l||i[c]==l&&(u=!0)?r[c++]=n:r.length&&(g=!1)),m=S,n+=v(l)}return c==a&&0==r[0]&&g?this.result((u?-200:0)-100,r,t):d==a&&0==f?[-200-t.length+(p==t.length?0:-100),0,p]:o>-1?[-700-t.length,o,o+this.pattern.length]:d==a?[-900-t.length,f,p]:c==a?this.result((u?-200:0)-100-700+(g?0:-1100),r,t):2==e.length?null:this.result((n[0]?-700:0)-200-1100,n,t)}result(t,e,i){let n=[t-i.length],s=1;for(let t of e){let e=t+(this.astral?v(b(i,t)):1);s>1&&n[s-1]==t?n[s-1]=e:(n[s++]=t,n[s++]=e)}return n}}const td=E.define({combine:t=>kt(t,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:id,compareCompletions:(t,e)=>t.label.localeCompare(e.label),interactionDelay:75},{defaultKeymap:(t,e)=>t&&e,closeOnBlur:(t,e)=>t&&e,icons:(t,e)=>t&&e,tooltipClass:(t,e)=>i=>ed(t(i),e(i)),optionClass:(t,e)=>i=>ed(t(i),e(i)),addToOptions:(t,e)=>t.concat(e)})});function ed(t,e){return t?e?t+" "+e:t:e}function id(t,e,i,n,s){let r,o,a=t.textDirection==Wi.RTL,l=a,h=!1,c="top",u=e.left-s.left,d=s.right-e.right,f=n.right-n.left,p=n.bottom-n.top;if(l&&u=p||t>e.top?r=i.bottom-e.top:(c="bottom",r=e.bottom-i.top)}return{style:`${c}: ${r}px; max-width: ${o}px`,class:"cm-completionInfo-"+(h?a?"left-narrow":"right-narrow":l?"left":"right")}}function nd(t,e="option"){return i=>{let n=i.state.field(yd,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp-1?n.open.selected+r*(t?1:-1):t?0:o-1;return a<0?a="page"==e?0:o-1:a>=o&&(a="page"==e?o-1:0),i.dispatch({effects:vd.of(a)}),!0}}const sd=t=>{let e=t.state.field(yd,!1);return!(t.state.readOnly||!e||!e.open||e.open.selected<0||Date.now()-e.open.timestamp(t.selection||t.docChanged)&&!gd(t)));for(let e=0;e50&&Date.now()-n.time>1e3){for(let t of n.context.abortListeners)try{t()}catch(t){Qi(this.view.state,t)}n.context.abortListeners=null,this.running.splice(e--,1)}else n.updates.push(...t.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some((t=>1==t.state&&!this.running.some((e=>e.active.source==t.source))))?setTimeout((()=>this.startUpdate()),50):-1,0!=this.composing)for(let e of t.transactions)"input"==gd(e)?this.composing=2:2==this.composing&&e.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:t}=this.view,e=t.field(yd);for(let t of e.active)1!=t.state||this.running.some((e=>e.active.source==t.source))||this.startQuery(t)}startQuery(t){let{state:e}=this.view,i=Bu(e),n=new qu(e,i,t.explicitPos==i),s=new rd(t,n);this.running.push(s),Promise.resolve(t.source(n)).then((t=>{s.context.aborted||(s.done=t||null,this.scheduleAccept())}),(t=>{this.view.dispatch({effects:Ju.of(null)}),Qi(this.view.state,t)}))}scheduleAccept(){this.running.every((t=>void 0!==t.done))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((()=>this.accept()),50))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],i=this.view.state.facet(td);for(let n=0;nt.source==s.active.source));if(r&&1==r.state)if(null==s.done){let t=new md(s.active.source,0);for(let e of s.updates)t=t.update(e,i);1!=t.state&&e.push(t)}else this.startQuery(r)}e.length&&this.view.dispatch({effects:wd.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(yd,!1);if(e&&e.tooltip&&this.view.state.facet(td).closeOnBlur){let i=e.open&&Rr(this.view,e.open.tooltip);i&&i.dom.contains(t.relatedTarget)||this.view.dispatch({effects:Ju.of(null)})}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout((()=>this.view.dispatch({effects:Hu.of(!1)})),20),this.composing=0}}});function ad(t,e){const i=e.completion.apply||e.completion.label;let n=t.state.field(yd).active.find((t=>t.source==e.source));return n instanceof bd&&("string"==typeof i?t.dispatch(Object.assign(Object.assign({},function(t,e,i,n){let{main:s}=t.selection,r=i-s.from,o=n-s.from;return Object.assign(Object.assign({},t.changeByRange((a=>a!=s&&i!=n&&t.sliceDoc(a.from+r,a.from+o)!=t.sliceDoc(i,n)?{range:a}:{changes:{from:a.from+r,to:n==s.from?a.to:a.from+o,insert:e},range:A.cursor(a.from+r+e.length)}))),{userEvent:"input.complete"})}(t.state,i,n.from,n.to)),{annotations:Nu.of(e.completion)})):i(t,e.completion,n.from,n.to),!0)}function ld(t,e,i){if(t<=i)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let t=Math.floor(e/i);return{from:t*i,to:(t+1)*i}}let n=Math.floor((t-e)/i);return{from:t-(n+1)*i,to:t-n*i}}class hd{constructor(t,e){this.view=t,this.stateField=e,this.info=null,this.placeInfoReq={read:()=>this.measureInfo(),write:t=>this.placeInfo(t),key:this},this.space=null,this.currentClass="";let i=t.state.field(e),{options:n,selected:s}=i.open,r=t.state.facet(td);this.optionContent=function(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(t){let e=document.createElement("div");return e.classList.add("cm-completionIcon"),t.type&&e.classList.add(...t.type.split(/\s+/g).map((t=>"cm-completionIcon-"+t))),e.setAttribute("aria-hidden","true"),e},position:20}),e.push({render(t,e,i){let n=document.createElement("span");n.className="cm-completionLabel";let{label:s}=t,r=0;for(let t=1;tr&&n.appendChild(document.createTextNode(s.slice(r,e)));let a=n.appendChild(document.createElement("span"));a.appendChild(document.createTextNode(s.slice(e,o))),a.className="cm-completionMatchedText",r=o}return rt.position-e.position)).map((t=>t.render))}(r),this.optionClass=r.optionClass,this.tooltipClass=r.tooltipClass,this.range=ld(n.length,s,r.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",(e=>{for(let i,s=e.target;s&&s!=this.dom;s=s.parentNode)if("LI"==s.nodeName&&(i=/-(\d+)$/.exec(s.id))&&+i[1]{let i=t.state.field(this.stateField,!1);i&&i.tooltip&&t.state.facet(td).closeOnBlur&&e.relatedTarget!=t.contentDOM&&t.dispatch({effects:Ju.of(null)})})),this.list=this.dom.appendChild(this.createListBox(n,i.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))}mount(){this.updateSel()}update(t){var e,i,n;let s=t.state.field(this.stateField),r=t.startState.field(this.stateField);this.updateTooltipClass(t.state),s!=r&&(this.updateSel(),(null===(e=s.open)||void 0===e?void 0:e.disabled)!=(null===(i=r.open)||void 0===i?void 0:i.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!(null===(n=s.open)||void 0===n?void 0:n.disabled)))}updateTooltipClass(t){let e=this.tooltipClass(t);if(e!=this.currentClass){for(let t of this.currentClass.split(" "))t&&this.dom.classList.remove(t);for(let t of e.split(" "))t&&this.dom.classList.add(t);this.currentClass=e}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),e=t.open;if((e.selected>-1&&e.selected=this.range.to)&&(this.range=ld(e.options.length,e.selected,this.view.state.facet(td).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e.options,t.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))),this.updateSelectedOption(e.selected)){this.info&&(this.info.remove(),this.info=null);let{completion:i}=e.options[e.selected],{info:n,label:s,c:r}=i;if(!n)return;let o="string"==typeof n?document.createTextNode(n+" "):n(i);if(!o)return;if(!r){const t=document.createElement("span");t.appendChild(o),o=t;const e=document.createElement("a");e.innerText="🔎",e.href="/docFind/"+s,e.target="blank",o.appendChild(e)}if(!o)return;"then"in o?o.then((e=>{e&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(e)})).catch((t=>Qi(this.view.state,t,"completion info"))):this.addInfoPane(o)}}addInfoPane(t){let e=this.info=document.createElement("div");e.className="cm-tooltip cm-completionInfo",e.appendChild(t),this.dom.appendChild(e),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let e=null;for(let i=this.list.firstChild,n=this.range.from;i;i=i.nextSibling,n++)"LI"==i.nodeName&&i.id?n==t?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),e=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected"):n--;return e&&function(t,e){let i=t.getBoundingClientRect(),n=e.getBoundingClientRect();n.topi.bottom&&(t.scrollTop+=n.bottom-i.bottom)}(this.list,e),e}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let e=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),n=t.getBoundingClientRect(),s=this.space;if(!s){let t=this.dom.ownerDocument.defaultView||window;s={left:0,top:0,right:t.innerWidth,bottom:t.innerHeight}}return n.top>Math.min(s.bottom,e.bottom)-10||n.bottomi.from||0==i.from))if(s=t,"string"!=typeof l&&l.header)n.appendChild(l.header(l));else{n.appendChild(document.createElement("completion-section")).textContent=t}}const h=n.appendChild(document.createElement("li"));h.id=e+"-"+r,h.setAttribute("role","option");let c=this.optionClass(o);c&&(h.className=c);for(let t of this.optionContent){let e=t(o,this.view.state,a);e&&h.appendChild(e)}}return i.from&&n.classList.add("cm-completionListIncompleteTop"),i.to=this.options.length?this:new ud(this.options,pd(e,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,e,i,n,s){let r=function(t,e){let i=[],n=null,s=t=>{i.push(t);let{section:e}=t.completion;if(e){n||(n=[]);let t="string"==typeof e?e:e.name;n.some((e=>e.name==t))||n.push("string"==typeof e?{name:t}:e)}};for(let n of t)if(n.hasResult())if(!1===n.result.filter){let t=n.result.getMatch;for(let e of n.result.options){let r=[1e9-i.length];if(t)for(let i of t(e))r.push(i);s(new Iu(e,n.source,r,r[0]))}}else{let t,i=new Ku(e.sliceDoc(n.from,n.to));for(let e of n.result.options)(t=i.match(e.label))&&s(new Iu(e,n.source,t,t[0]+(e.boost||0)))}if(n){let t=Object.create(null),e=0,s=(t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:1e9)-(null!==(n=e.rank)&&void 0!==n?n:1e9)||(t.namee.score-t.score||a(t.completion,e.completion))))!o||o.label!=t.completion.label||o.detail!=t.completion.detail||null!=o.type&&null!=t.completion.type&&o.type!=t.completion.type||o.apply!=t.completion.apply?r.push(t):cd(t.completion)>cd(o)&&(r[r.length-1]=t),o=t.completion;return r}(t,e);if(!r.length)return n&&t.some((t=>1==t.state))?new ud(n.options,n.attrs,n.tooltip,n.timestamp,n.selected,!0):null;let o=e.facet(td).selectOnOpen?0:-1;if(n&&n.selected!=o&&-1!=n.selected){let t=n.options[n.selected].completion;for(let e=0;ee.hasResult()?Math.min(t,e.from):t),1e8),create:(a=yd,t=>new hd(t,a)),above:s.aboveCursor},n?n.timestamp:Date.now(),o,!1);var a}map(t){return new ud(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class dd{constructor(t,e,i){this.active=t,this.id=e,this.open=i}static start(){return new dd(Od,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(t){let{state:e}=t,i=e.facet(td),n=(i.override||e.languageDataAt("autocomplete",Bu(e)).map(Fu)).map((e=>(this.active.find((t=>t.source==e))||new md(e,this.active.some((t=>0!=t.state))?1:0)).update(t,i)));n.length==this.active.length&&n.every(((t,e)=>t==this.active[e]))&&(n=this.active);let s=this.open;s&&t.docChanged&&(s=s.map(t.changes)),t.selection||n.some((e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to)))||!function(t,e){if(t==e)return!0;for(let i=0,n=0;;){for(;i1==t.state))&&(s=null),!s&&n.every((t=>1!=t.state))&&n.some((t=>t.hasResult()))&&(n=n.map((t=>t.hasResult()?new md(t.source,0):t)));for(let e of t.effects)e.is(vd)&&(s=s&&s.setSelected(e.value,this.id));return n==this.active&&s==this.open?this:new dd(n,this.id,s)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:fd}}const fd={"aria-autocomplete":"list"};function pd(t,e){let i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(i["aria-activedescendant"]=t+"-"+e),i}const Od=[];function gd(t){return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null}class md{constructor(t,e,i=-1){this.source=t,this.state=e,this.explicitPos=i}hasResult(){return!1}update(t,e){let i=gd(t),n=this;i?n=n.handleUserEvent(t,i,e):t.docChanged?n=n.handleChange(t):t.selection&&0!=n.state&&(n=new md(n.source,0));for(let e of t.effects)if(e.is(Hu))n=new md(n.source,1,e.value?Bu(t.state):-1);else if(e.is(Ju))n=new md(n.source,0);else if(e.is(wd))for(let t of e.value)t.source==n.source&&(n=t);return n}handleUserEvent(t,e,i){return"delete"!=e&&i.activateOnTyping?new md(this.source,1):this.map(t.changes)}handleChange(t){return t.changes.touchesRange(Bu(t.startState))?new md(this.source,0):this.map(t.changes)}map(t){return t.empty||this.explicitPos<0?this:new md(this.source,this.state,t.mapPos(this.explicitPos))}}class bd extends md{constructor(t,e,i,n,s){super(t,2,e),this.result=i,this.from=n,this.to=s}hasResult(){return!0}handleUserEvent(t,e,i){var n;let s=t.changes.mapPos(this.from),r=t.changes.mapPos(this.to,1),o=Bu(t.state);if((this.explicitPos<0?o<=s:or||"delete"==e&&Bu(t.startState)==this.from)return new md(this.source,"input"==e&&i.activateOnTyping?1:0);let a,l=this.explicitPos<0?-1:t.changes.mapPos(this.explicitPos);return function(t,e,i,n){if(!t)return!1;let s=e.sliceDoc(i,n);return"function"==typeof t?t(s,i,n,e):ju(t,!0).test(s)}(this.result.validFor,t.state,s,r)?new bd(this.source,l,this.result,s,r):this.result.update&&(a=this.result.update(this.result,s,r,new qu(t.state,o,l>=0)))?new bd(this.source,l,a,a.from,null!==(n=a.to)&&void 0!==n?n:Bu(t.state)):new md(this.source,1,l)}handleChange(t){return t.changes.touchesRange(this.from,this.to)?new md(this.source,0):this.map(t.changes)}map(t){return t.empty?this:new bd(this.source,this.explicitPos<0?-1:t.mapPos(this.explicitPos),this.result,t.mapPos(this.from),t.mapPos(this.to,1))}}const wd=ut.define({map:(t,e)=>t.map((t=>t.map(e)))}),vd=ut.define(),yd=q.define({create:()=>dd.start(),update:(t,e)=>t.update(e),provide:t=>[Tr.from(t,(t=>t.tooltip)),Ts.contentAttributes.from(t,(t=>t.attrs))]}),Sd=Ts.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class xd{constructor(t,e,i,n){this.field=t,this.line=e,this.from=i,this.to=n}}class kd{constructor(t,e,i){this.field=t,this.from=e,this.to=i}map(t){let e=t.mapPos(this.from,-1,S.TrackDel),i=t.mapPos(this.to,1,S.TrackDel);return null==e||null==i?null:new kd(this.field,e,i)}}class Qd{constructor(t,e){this.lines=t,this.fieldPositions=e}instantiate(t,e){let i=[],n=[e],s=t.doc.lineAt(e),r=/^\s*/.exec(s.text)[0];for(let s of this.lines){if(i.length){let i=r,o=/^\t*/.exec(s)[0].length;for(let e=0;enew kd(t.field,n[t.line]+t.from,n[t.line]+t.to)));return{text:i,ranges:o}}static parse(t){let e,i=[],n=[],s=[];for(let r of t.split(/\r\n?|\n/)){for(;e=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(r);){let t=e[1]?+e[1]:null,o=e[2]||e[3]||"",a=-1;for(let e=0;e=a&&t.field++}s.push(new xd(a,n.length,e.index,e.index+o.length)),r=r.slice(0,e.index)+o+r.slice(e.index+e[0].length)}for(let t;t=/\\([{}])/.exec(r);){r=r.slice(0,t.index)+t[1]+r.slice(t.index+t[0].length);for(let e of s)e.line==n.length&&e.from>t.index&&(e.from--,e.to--)}n.push(r)}return new Qd(n,s)}}let $d=ni.widget({widget:new class extends ei{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),Pd=ni.mark({class:"cm-snippetField"});class Cd{constructor(t,e){this.ranges=t,this.active=e,this.deco=ni.set(t.map((t=>(t.from==t.to?$d:Pd).range(t.from,t.to))))}map(t){let e=[];for(let i of this.ranges){let n=i.map(t);if(!n)return null;e.push(n)}return new Cd(e,this.active)}selectionInsideField(t){return t.ranges.every((t=>this.ranges.some((e=>e.field==this.active&&e.from<=t.from&&e.to>=t.to))))}}const _d=ut.define({map:(t,e)=>t&&t.map(e)}),Xd=ut.define(),Zd=q.define({create:()=>null,update(t,e){for(let i of e.effects){if(i.is(_d))return i.value;if(i.is(Xd)&&t)return new Cd(t.ranges,i.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>Ts.decorations.from(t,(t=>t?t.deco:ni.none))});function Ad(t,e){return A.create(t.filter((t=>t.field==e)).map((t=>A.range(t.from,t.to))))}function Td(e){let i=Qd.parse(e);return(e,n,s,r)=>{let{text:o,ranges:a}=i.instantiate(e.state,s),l={changes:{from:s,to:r,insert:t.of(o)},scrollIntoView:!0,annotations:n?Nu.of(n):void 0};if(a.length&&(l.selection=Ad(a,0)),a.length>1){let t=new Cd(a,0),i=l.effects=[_d.of(t)];void 0===e.state.field(Zd,!1)&&i.push(ut.appendConfig.of([Zd,Md,Wd,Sd]))}e.dispatch(e.state.update(l))}}function Rd(t){return({state:e,dispatch:i})=>{let n=e.field(Zd,!1);if(!n||t<0&&0==n.active)return!1;let s=n.active+t,r=t>0&&!n.ranges.some((e=>e.field==s+t));return i(e.update({selection:Ad(n.ranges,s),effects:_d.of(r?null:new Cd(n.ranges,s))})),!0}}const Ed=[{key:"Tab",run:Rd(1),shift:Rd(-1)},{key:"Escape",run:({state:t,dispatch:e})=>!!t.field(Zd,!1)&&(e(t.update({effects:_d.of(null)})),!0)}],Vd=E.define({combine:t=>t.length?t[0]:Ed}),Md=N.highest(Ys.compute([Vd],(t=>t.facet(Vd))));function Dd(t,e){return Object.assign(Object.assign({},e),{apply:Td(t)})}const Wd=Ts.domEventHandlers({mousedown(t,e){let i,n=e.state.field(Zd,!1);if(!n||null==(i=e.posAtCoords({x:t.clientX,y:t.clientY})))return!1;let s=n.ranges.find((t=>t.from<=i&&t.to>=i));return!(!s||s.field==n.active)&&(e.dispatch({selection:Ad(n.ranges,s.field),effects:_d.of(n.ranges.some((t=>t.field>s.field))?new Cd(n.ranges,s.field):null)}),!0)}}),Ud=new class extends Qt{};function Yd(t={}){return[yd,td.of(t),od,Ld,Sd]}Ud.startSide=1,Ud.endSide=-1;const qd=[{key:"Ctrl-Space",run:t=>!!t.state.field(yd,!1)&&(t.dispatch({effects:Hu.of(!0)}),!0)},{key:"Escape",run:t=>{let e=t.state.field(yd,!1);return!(!e||!e.active.some((t=>0!=t.state)))&&(t.dispatch({effects:Ju.of(null)}),!0)}},{key:"ArrowDown",run:nd(!0)},{key:"ArrowUp",run:nd(!1)},{key:"PageDown",run:nd(!0,"page")},{key:"PageUp",run:nd(!1,"page")},{key:"Enter",run:sd}],Ld=N.highest(Ys.computeN([td],(t=>t.facet(td).defaultKeymap?[qd]:[]))),zd=(()=>[vr(),Sh(),ir(),$l(_l,{fallback:!0}),Ys.of([...Vc,...Wh])])();class Id{constructor(t,e,i,n,s,r,o,a,l,h=0,c){this.p=t,this.stack=e,this.state=i,this.reducePos=n,this.pos=s,this.score=r,this.buffer=o,this.bufferBase=a,this.curContext=l,this.lookAhead=h,this.parent=c}toString(){return`[${this.stack.filter(((t,e)=>e%3==0)).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,i=0){let n=t.parser.context;return new Id(t,[],e,i,i,0,[],0,n?new Bd(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let i=t>>19,n=65535&t,{parser:s}=this.p,r=s.dynamicPrecedence(n);if(r&&(this.score+=r),0==i)return this.pushState(s.getGoto(this.state,n,!0),this.reducePos),n=2e3&&!(null===(e=this.p.parser.nodeSet.types[n])||void 0===e?void 0:e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=l):this.p.lastBigReductionSizeo;)this.stack.pop();this.reduceContext(n,a)}storeNode(t,e,i,n=4,s=!1){if(0==t&&(!this.stack.length||this.stack[this.stack.length-1]0&&0==t.buffer[n-4]&&t.buffer[n-1]>-1){if(e==i)return;if(t.buffer[n-2]>=e)return void(t.buffer[n-2]=i)}}if(s&&this.pos!=i){let s=this.buffer.length;if(s>0&&0!=this.buffer[s-4])for(;s>0&&this.buffer[s-2]>i;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,n>4&&(n-=4);this.buffer[s]=t,this.buffer[s+1]=e,this.buffer[s+2]=i,this.buffer[s+3]=n}else this.buffer.push(t,e,i,n)}shift(t,e,i){let n=this.pos;if(131072&t)this.pushState(65535&t,this.pos);else if(0==(262144&t)){let s=t,{parser:r}=this.p;(i>this.pos||e<=r.maxNode)&&(this.pos=i,r.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,n),this.shiftContext(e,n),e<=r.maxNode&&this.buffer.push(e,n,i,4)}else this.pos=i,this.shiftContext(e,n),e<=this.p.parser.maxNode&&this.buffer.push(e,n,i,4)}apply(t,e,i){65536&t?this.reduce(t):this.shift(t,e,i)}useNode(t,e){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=t)&&(this.p.reused.push(t),i++);let n=this.pos;this.reducePos=this.pos=n+t.length,this.pushState(e,n),this.buffer.push(i,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let i=t.buffer.slice(e),n=t.bufferBase+e;for(;t&&n==t.bufferBase;)t=t.parent;return new Id(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,n,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let i=t<=this.p.parser.maxNode;i&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,i?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new Nd(this);;){let i=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(0==i)return!1;if(0==(65536&i))return!0;e.reduce(i)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let n,s=0;s1&e&&t==n))||i.push(e[t],n)}e=i}let i=[];for(let t=0;t>19,n=65535&t,s=this.stack.length-3*i;if(s<0||e.getGoto(this.stack[s],n,!1)<0)return!1;this.storeNode(0,this.reducePos,this.reducePos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:t}=this.p;return 65535==t.data[t.stateSlot(this.state,1)]&&!t.stateSlot(this.state,4)}restart(){this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;ethis.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Bd{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}var jd;!function(t){t[t.Insert=200]="Insert",t[t.Delete=190]="Delete",t[t.Reduce=100]="Reduce",t[t.MaxNext=4]="MaxNext",t[t.MaxInsertStackDepth=300]="MaxInsertStackDepth",t[t.DampenInsertStackDepth=120]="DampenInsertStackDepth",t[t.MinBigReduction=2e3]="MinBigReduction"}(jd||(jd={}));class Nd{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=65535&t,i=t>>19;0==i?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(i-1);let n=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=n}}class Gd{constructor(t,e,i){this.stack=t,this.pos=e,this.index=i,this.buffer=t.buffer,0==this.index&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new Gd(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;null!=t&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new Gd(this.stack,this.pos,this.index)}}function Fd(t,e=Uint16Array){if("string"!=typeof t)return t;let i=null;for(let n=0,s=0;n=92&&e--,e>=34&&e--;let s=e-32;if(s>=46&&(s-=46,i=!0),r+=s,i)break;r*=46}i?i[s++]=r:i=new e(r)}return i}class Hd{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Jd=new Hd;class Kd{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Jd,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let i=this.range,n=this.rangeIndex,s=this.pos+t;for(;si.to:s>=i.to;){if(n==this.ranges.length-1)return null;let t=this.ranges[++n];s+=t.from-i.to,i=t}return s}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,e.from);return this.end}peek(t){let e,i,n=this.chunkOff+t;if(n>=0&&n=this.chunk2Pos&&en.to&&(this.chunk2=this.chunk2.slice(0,n.to-e)),i=this.chunk2.charCodeAt(0)}}return e>=this.token.lookAhead&&(this.token.lookAhead=e+1),i}acceptToken(t,e=0){let i=e?this.resolveOffset(e,-1):this.pos;if(null==i||i=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=Jd,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let i="";for(let n of this.ranges){if(n.from>=e)break;n.to>t&&(i+=this.input.read(Math.max(n.from,t),Math.min(n.to,e)))}return i}}class tf{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:i}=e.p;sf(this.data,t,e,this.id,i.data,i.tokenPrecTable)}}tf.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class ef{constructor(t,e,i){this.precTable=e,this.elseToken=i,this.data="string"==typeof t?Fd(t):t}token(t,e){let i=t.pos,n=0;for(;sf(this.data,t,e,0,this.data,this.precTable),!(t.token.value>-1);){if(null==this.elseToken)return;if(t.next<0)break;t.advance(),t.reset(t.pos,t.token),n++}n&&(t.reset(i,t.token),t.acceptToken(this.elseToken,n))}}ef.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class nf{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function sf(t,e,i,n,s,r){let o=0,a=1<0){let i=t[n];if(l.allows(i)&&(-1==e.token.value||e.token.value==i||of(i,e.token.value,s,r))){e.acceptToken(i);break}}let n=e.next,h=0,c=t[o+2];if(!(e.next<0&&c>h&&65535==t[i+3*c-3]&&65535==t[i+3*c-3])){for(;h>1,r=i+s+(s<<1),a=t[r],l=t[r+1]||65536;if(n=l)){o=t[r+2],e.advance();continue t}h=s+1}}break}o=t[i+3*c-1]}}function rf(t,e,i){for(let n,s=e;65535!=(n=t[s]);s++)if(n==i)return s-e;return-1}function of(t,e,i,n){let s=rf(i,n,e);return s<0||rf(i,n,t)e)&&!n.type.isError)return i<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(t.length,Math.max(n.from+1,e+25));if(i<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return i<0?0:t.length}}!function(t){t[t.Margin=25]="Margin"}(hf||(hf={}));let uf=class{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?cf(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?cf(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=r,null;if(s instanceof bo){if(r==t){if(r=Math.max(this.safeFrom,t)&&(this.trees.push(s),this.start.push(r),this.index.push(0))}else this.index[e]++,this.nextStart=r+s.length}}};class df{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map((t=>new Hd))}getActions(t){let e=0,i=null,{parser:n}=t.p,{tokenizers:s}=n,r=n.stateSlot(t.state,3),o=t.curContext?t.curContext.hash:0,a=0;for(let n=0;nh.end+25&&(a=Math.max(h.lookAhead,a)),0!=h.value)){let n=e;if(h.extended>-1&&(e=this.addActions(t,h.extended,h.end,e)),e=this.addActions(t,h.value,h.end,e),!l.extend&&(i=h,e>n))break}}for(;this.actions.length>e;)this.actions.pop();return a&&t.setLookAhead(a),i||t.pos!=this.stream.end||(i=new Hd,i.value=t.p.parser.eofTerm,i.start=i.end=t.pos,e=this.addActions(t,i.value,i.end,e)),this.mainToken=i,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new Hd,{pos:i,p:n}=t;return e.start=i,e.end=Math.min(i+1,n.stream.end),e.value=i==n.stream.end?n.parser.eofTerm:0,e}updateCachedToken(t,e,i){let n=this.stream.clipPos(i.pos);if(e.token(this.stream.reset(n,t),i),t.value>-1){let{parser:e}=i.p;for(let n=0;n=0&&i.p.parser.dialect.allows(s>>1)){0==(1&s)?t.value=s>>1:t.extended=s>>1;break}}}else t.value=0,t.end=this.stream.clipPos(n+1)}putAction(t,e,i,n){for(let e=0;e4*t.bufferLength?new uf(i,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t,e,i=this.stacks,n=this.minStackPos,s=this.stacks=[];if(this.bigReductionCount>300&&1==i.length){let[t]=i;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;rn)s.push(o);else{if(this.advanceStack(o,s,i))continue;{t||(t=[],e=[]),t.push(o);let i=this.tokens.getMainToken(o);e.push(i.value,i.end)}}break}}if(!s.length){let e=t&&function(t){let e=null;for(let i of t){let t=i.p.stoppedAt;(i.pos==i.p.stream.end||null!=t&&i.pos>t)&&i.p.parser.stateFlag(i.state,2)&&(!e||e.scorethis.stoppedAt?t[0]:this.runRecovery(t,e,s);if(i)return this.stackToTree(i.forceAll())}if(this.recovering){let t=1==this.recovering?1:3*this.recovering;if(s.length>t)for(s.sort(((t,e)=>e.score-t.score));s.length>t;)s.pop();s.some((t=>t.reducePos>n))&&this.recovering--}else if(s.length>1){t:for(let t=0;t500&&n.buffer.length>500){if(!((e.score-n.score||e.buffer.length-n.buffer.length)>0)){s.splice(t--,1);continue t}s.splice(i--,1)}}}s.length>12&&s.splice(12,s.length-12)}this.minStackPos=s[0].pos;for(let t=1;t ":"";if(null!=this.stoppedAt&&n>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let e=t.curContext&&t.curContext.tracker.strict,i=e?t.curContext.hash:0;for(let o=this.fragments.nodeAt(n);o;){let n=this.parser.nodeSet.types[o.type.id]==o.type?s.getGoto(t.state,o.type.id):-1;if(n>-1&&o.length&&(!e||(o.prop(ho.contextHash)||0)==i))return t.useNode(o,n),af&&console.log(r+this.stackID(t)+` (via reuse of ${s.getName(o.type.id)})`),!0;if(!(o instanceof bo)||0==o.children.length||o.positions[0]>0)break;let a=o.children[0];if(!(a instanceof bo&&0==o.positions[0]))break;o=a}}let o=s.stateSlot(t.state,4);if(o>0)return t.reduce(o),af&&console.log(r+this.stackID(t)+` (via always-reduce ${s.getName(65535&o)})`),!0;if(t.stack.length>=15e3)for(;t.stack.length>9e3&&t.forceReduce(););let a=this.tokens.getActions(t);for(let o=0;on?e.push(d):i.push(d)}return!1}advanceFully(t,e){let i=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>i)return Of(t,e),!0}}runRecovery(t,e,i){let n=null,s=!1;for(let r=0;r ":"";if(o.deadEnd){if(s)continue;if(s=!0,o.restart(),af&&console.log(h+this.stackID(o)+" (restarted)"),this.advanceFully(o,i))continue}let c=o.split(),u=h;for(let t=0;c.forceReduce()&&t<10;t++){if(af&&console.log(u+this.stackID(c)+" (via force-reduce)"),this.advanceFully(c,i))break;af&&(u=this.stackID(c)+" -> ")}for(let t of o.recoverByInsert(a))af&&console.log(h+this.stackID(t)+" (via recover-insert)"),this.advanceFully(t,i);this.stream.end>o.pos?(l==o.pos&&(l++,a=0),o.recoverByDelete(a,l),af&&console.log(h+this.stackID(o)+` (via recover-delete ${this.parser.getName(a)})`),Of(o,i)):(!n||n.scoret;class bf{constructor(t){this.start=t.start,this.shift=t.shift||mf,this.reduce=t.reduce||mf,this.reuse=t.reuse||mf,this.hash=t.hash||(()=>0),this.strict=!1!==t.strict}}class wf extends Vo{constructor(t){if(super(),this.wrappers=[],14!=t.version)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let i=0;it.topRules[e][1])),n=[];for(let t=0;t=0)s(n,t,e[i++]);else{let r=e[i+-n];for(let o=-n;o>0;o--)s(e[i++],t,r);i++}}}this.nodeSet=new po(e.map(((e,s)=>fo.define({name:s>=this.minRepeatTerm?void 0:e,id:s,props:n[s],top:i.indexOf(s)>-1,error:0==s,skipped:t.skippedNodes&&t.skippedNodes.indexOf(s)>-1})))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=oo;let r=Fd(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let t=0;t"number"==typeof t?new tf(r,t):t)),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,i){let n=new pf(this,t,e,i);for(let s of this.wrappers)n=s(n,t,e,i);return n}getGoto(t,e,i=!1){let n=this.goto;if(e>=n[0])return-1;for(let s=n[e+1];;){let e=n[s++],r=1&e,o=n[s++];if(r&&i)return o;for(let i=s+(e>>1);s0}validAction(t,e){if(e==this.stateSlot(t,4))return!0;for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])return!1;i=vf(this.data,i+2)}if(e==vf(this.data,i+1))return!0}}nextStates(t){let e=[];for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])break;i=vf(this.data,i+2)}if(0==(1&this.data[i+2])){let t=this.data[i+1];e.some(((e,i)=>1&i&&e==t))||e.push(this.data[i],t)}}return e}configure(t){let e=Object.assign(Object.create(wf.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let i=this.topRules[t.top];if(!i)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=i}return t.tokenizers&&(e.tokenizers=this.tokenizers.map((e=>{let i=t.tokenizers.find((t=>t.from==e));return i?i.to:e}))),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map(((i,n)=>{let s=t.specializers.find((t=>t.from==i.external));if(!s)return i;let r=Object.assign(Object.assign({},i),{external:s.to});return e.specializers[n]=yf(r),r}))),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),null!=t.strict&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),null!=t.bufferLength&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return null==e?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),i=e.map((()=>!1));if(t)for(let n of t.split(" ")){let t=e.indexOf(n);t>=0&&(i[t]=!0)}let n=null;for(let t=0;tt.external(i,n)<<1|e}return t.get}const Sf=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],xf=new bf({start:!1,shift:(t,e)=>3==e||4==e||305==e?t:306==e,strict:!1}),kf=new nf(((t,e)=>{let{next:i}=t;(125==i||-1==i||e.context)&&e.canShift(303)&&t.acceptToken(303)}),{contextual:!0,fallback:!0}),Qf=new nf(((t,e)=>{let i,{next:n}=t;Sf.indexOf(n)>-1||(47!=n||47!=(i=t.peek(1))&&42!=i)&&125!=n&&59!=n&&-1!=n&&!e.context&&e.canShift(302)&&t.acceptToken(302)}),{contextual:!0}),$f=new nf(((t,e)=>{let{next:i}=t;if((43==i||45==i)&&(t.advance(),i==t.next)){t.advance();let i=!e.context&&e.canShift(1);t.acceptToken(i?1:2)}}),{contextual:!0}),Pf=ea({"get set async static":Sa.modifier,"for while do if else switch try catch finally return throw break continue default case":Sa.controlKeyword,"in of await yield void typeof delete instanceof":Sa.operatorKeyword,"let var const function class extends":Sa.definitionKeyword,"import export from":Sa.moduleKeyword,"with debugger as new":Sa.keyword,TemplateString:Sa.special(Sa.string),super:Sa.atom,BooleanLiteral:Sa.bool,this:Sa.self,null:Sa.null,Star:Sa.modifier,VariableName:Sa.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":Sa.function(Sa.variableName),VariableDefinition:Sa.definition(Sa.variableName),Label:Sa.labelName,PropertyName:Sa.propertyName,PrivatePropertyName:Sa.special(Sa.propertyName),"CallExpression/MemberExpression/PropertyName":Sa.function(Sa.propertyName),"FunctionDeclaration/VariableDefinition":Sa.function(Sa.definition(Sa.variableName)),"ClassDeclaration/VariableDefinition":Sa.definition(Sa.className),PropertyDefinition:Sa.definition(Sa.propertyName),PrivatePropertyDefinition:Sa.definition(Sa.special(Sa.propertyName)),UpdateOp:Sa.updateOperator,LineComment:Sa.lineComment,BlockComment:Sa.blockComment,Number:Sa.number,String:Sa.string,Escape:Sa.escape,ArithOp:Sa.arithmeticOperator,LogicOp:Sa.logicOperator,BitOp:Sa.bitwiseOperator,CompareOp:Sa.compareOperator,RegExp:Sa.regexp,Equals:Sa.definitionOperator,Arrow:Sa.function(Sa.punctuation),": Spread":Sa.punctuation,"( )":Sa.paren,"[ ]":Sa.squareBracket,"{ }":Sa.brace,"InterpolationStart InterpolationEnd":Sa.special(Sa.brace),".":Sa.derefOperator,", ;":Sa.separator,"@":Sa.meta,TypeName:Sa.typeName,TypeDefinition:Sa.definition(Sa.typeName),"type enum interface implements namespace module declare":Sa.definitionKeyword,"abstract global Privacy readonly override":Sa.modifier,"is keyof unique infer":Sa.operatorKeyword,JSXAttributeValue:Sa.attributeValue,JSXText:Sa.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":Sa.angleBracket,"JSXIdentifier JSXNameSpacedName":Sa.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":Sa.attributeName,"JSXBuiltin/JSXIdentifier":Sa.standard(Sa.tagName)}),Cf={__proto__:null,export:14,as:19,from:27,default:30,async:35,function:36,extends:46,this:50,true:58,false:58,null:70,void:74,typeof:78,super:96,new:130,delete:146,yield:155,await:159,class:164,public:221,private:221,protected:221,readonly:223,instanceof:242,satisfies:245,in:246,const:248,import:280,keyof:335,unique:339,infer:345,is:381,abstract:401,implements:403,type:405,let:408,var:410,interface:417,enum:421,namespace:427,module:429,declare:433,global:437,for:456,of:465,while:468,with:472,do:476,if:480,else:482,switch:486,case:492,try:498,catch:502,finally:506,return:510,throw:514,break:518,continue:522,debugger:526},_f={__proto__:null,async:117,get:119,set:121,declare:181,public:183,private:183,protected:183,static:185,abstract:187,override:189,readonly:195,accessor:197,new:385},Xf={__proto__:null,"<":137},Zf=wf.deserialize({version:14,states:"$6[O`QUOOO%QQUOOO'TQWOOP(bOSOOO*pQ(CjO'#CfO*wOpO'#CgO+VO!bO'#CgO+eO07`O'#DZO-vQUO'#DaO.WQUO'#DlO%QQUO'#DvO0[QUO'#EOOOQ(CY'#EW'#EWO0uQSO'#ETOOQO'#Ei'#EiOOQO'#Ib'#IbO0}QSO'#GkO1YQSO'#EhO1_QSO'#EhO3aQ(CjO'#JcO6QQ(CjO'#JdO6nQSO'#FWO6sQ#tO'#FoOOQ(CY'#F`'#F`O7OO&jO'#F`O7^Q,UO'#FvO8tQSO'#FuOOQ(CY'#Jd'#JdOOQ(CW'#Jc'#JcOOQQ'#KO'#KOO8yQSO'#IOO9OQ(C[O'#IPOOQQ'#JP'#JPOOQQ'#IT'#ITQ`QUOOO%QQUO'#DnO9WQUO'#DzO%QQUO'#D|O9_QSO'#GkO9dQ,UO'#ClO9rQSO'#EgO9}QSO'#ErO:SQ,UO'#F_O:qQSO'#GkO:vQSO'#GoO;RQSO'#GoO;aQSO'#GrO;aQSO'#GsO;aQSO'#GuO9_QSO'#GxOQQSO'#HnO>VQ(C]O'#HtO%QQUO'#HvO>bQ(C]O'#HxO>mQ(C]O'#HzO9OQ(C[O'#H|O>xQ(CjO'#CfO?zQWO'#DfQOQSOOO@bQSO'#EPO9dQ,UO'#EgO@mQSO'#EgO@xQ`O'#F_OOQQ'#Cd'#CdOOQ(CW'#Dk'#DkOOQ(CW'#Jg'#JgO%QQUO'#JgOOQO'#Jk'#JkOOQO'#I_'#I_OAxQWO'#E`OOQ(CW'#E_'#E_OBtQ(C`O'#E`OCOQWO'#ESOOQO'#Jj'#J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_Q-`'`Q1{,{R2Z-_R(k#tR(n#uQ!dQT,|'Q,}]!nQ!o'Q,}0u4pQ#l]R'Z9mT#gZ%ZS#fZ%ZU%y|},ZU(W#d#e#hS-r(X(YQ-v(ZQ0h+hQ2`-sU2a-t-u-wS5v2b2cR7u5w`#YW#S#V%v't'}+e-mt#cZ|}#d#e#h%Z(X(Y(Z+h-s-t-u-w2b2c5wQ1_,ZQ1r,oQ5e1jQ7m5fT:x&y+fT#]W%vS#[W%vS'u#S'}S'z#V+eS,t&y+fT-h't-mT'O!c%wQ$hfR)j$mT)_$h)`R3Z.kT*O$u*QR*W$xQ/}*zQ2e.OQ4s0wQ5{2iQ7X4vQ7x5zQ8e7WQ8w7wQ9W8gQ9`8yQ9e9XR9h9alpOXr!X#`%]&d&f&g&i,],b1b1eQ&^!TR,Q&ZV%z|},ZR0q+qR,P&XQ%szR+c%tR+X%nT&b!U&eT&c!U&eT1d,b1e",nodeNames:"⚠ ArithOp ArithOp LineComment BlockComment Script ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXStartTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:364,context:xf,nodeProps:[["group",-26,6,14,16,62,199,203,206,207,209,212,215,225,227,233,235,237,239,242,248,254,256,258,260,262,264,265,"Statement",-32,10,11,25,28,29,35,45,48,49,51,56,64,72,76,78,80,81,103,104,113,114,131,134,136,137,138,139,141,142,162,163,165,"Expression",-23,24,26,30,34,36,38,166,168,170,171,173,174,175,177,178,179,181,182,183,193,195,197,198,"Type",-3,84,96,102,"ClassItem"],["openedBy",31,"InterpolationStart",50,"[",54,"{",69,"(",143,"JSXStartTag",155,"JSXStartTag JSXStartCloseTag"],["closedBy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#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(T~~",141,326),new ef("j~RQYZXz{^~^O'q~~aP!P!Qd~iO'r~~",25,308)],topRules:{Script:[0,5],SingleExpression:[1,266],SingleClassItem:[2,267]},dialects:{jsx:12686,ts:12688},dynamicPrecedences:{76:1,78:1,163:1,191:1},specialized:[{term:312,get:t=>Cf[t]||-1},{term:328,get:t=>_f[t]||-1},{term:67,get:t=>Xf[t]||-1}],tokenPrec:12712}),Af=[Dd("function ${name}(${params}) {\n\t${}\n}",{label:"function",detail:"definition",type:"keyword"}),Dd("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n\t${}\n}",{label:"for",detail:"loop",type:"keyword"}),Dd("for (let ${name} of ${collection}) {\n\t${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Dd("do {\n\t${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),Dd("while (${}) {\n\t${}\n}",{label:"while",detail:"loop",type:"keyword"}),Dd("try {\n\t${}\n} catch (${error}) {\n\t${}\n}",{label:"try",detail:"/ catch block",type:"keyword"}),Dd("if (${}) {\n\t${}\n}",{label:"if",detail:"block",type:"keyword"}),Dd("if (${}) {\n\t${}\n} else {\n\t${}\n}",{label:"if",detail:"/ else block",type:"keyword"}),Dd("class ${name} {\n\tconstructor(${params}) {\n\t\t${}\n\t}\n}",{label:"class",detail:"definition",type:"keyword"}),Dd('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Dd('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Tf=new Ro,Rf=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Ef(t){return(e,i)=>{let n=e.node.getChild("VariableDefinition");return n&&i(n,t),!0}}const Vf=["FunctionDeclaration"],Mf={FunctionDeclaration:Ef("function"),ClassDeclaration:Ef("class"),ClassExpression:()=>!0,EnumDeclaration:Ef("constant"),TypeAliasDeclaration:Ef("type"),NamespaceDeclaration:Ef("namespace"),VariableDefinition(t,e){t.matchContext(Vf)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function Df(t,e){let i=Tf.get(e);if(i)return i;let n=[],s=!0;function r(e,i){let s=t.sliceString(e.from,e.to);n.push({label:s,type:i})}return e.cursor(mo.IncludeAnonymous).iterate((e=>{if(s)s=!1;else if(e.name){let t=Mf[e.name];if(t&&t(e,r)||Rf.has(e.name))return!1}else if(e.to-e.from>8192){for(let i of Df(t,e.node))n.push(i);return!1}})),Tf.set(e,n),n}const Wf=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Uf=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName"];function Yf(t){let e=Xa(t.state).resolveInner(t.pos,-1);if(Uf.indexOf(e.name)>-1)return null;let i="VariableName"==e.name||e.to-e.from<20&&Wf.test(t.state.sliceDoc(e.from,e.to));if(!i&&!t.explicit)return null;let n=[];for(let i=e;i;i=i.parent)Rf.has(i.name)&&(n=n.concat(Df(t.state.doc,i)));return{options:n,from:i?e.from:t.pos,validFor:Wf}}const qf=_a.define({name:"javascript",parser:Zf.configure({props:[Na.add({IfStatement:il({except:/^\s*({|else\b)/}),TryStatement:il({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:t=>t.baseIndent,SwitchBody:t=>{let e=t.textAfter,i=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return t.baseIndent+(i?0:n?1:2)*t.unit},Block:tl({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":il({except:/^{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag":t=>t.column(t.node.from)+t.unit}),rl.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression":ol,BlockComment:t=>({from:t.from+2,to:t.to-2})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Lf={test:t=>/^JSX/.test(t.name),facet:Qa({commentTokens:{block:{open:"{/*",close:"*/}"}}})},zf=qf.configure({dialect:"ts"},"typescript"),If=qf.configure({dialect:"jsx",props:[$a.add((t=>t.isTop?[Lf]:void 0))]}),Bf=qf.configure({dialect:"jsx ts",props:[$a.add((t=>t.isTop?[Lf]:void 0))]},"typescript"),jf="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map((t=>({label:t,type:"keyword"})));function Nf(t={}){let e=t.jsx?t.typescript?Bf:If:t.typescript?zf:qf;return new Ua(e,[qf.data.of({autocomplete:(i=Uf,n=zu(Af.concat(jf)),t=>{for(let e=Xa(t.state).resolveInner(t.pos,-1);e;e=e.parent){if(i.indexOf(e.name)>-1)return null;if(e.type.isTop)break}return n(t)})}),qf.data.of({autocomplete:Yf}),t.jsx?Hf:[]]);var i,n}function Gf(t,e,i=t.length){for(let n=null==e?void 0:e.firstChild;n;n=n.nextSibling)if("JSXIdentifier"==n.name||"JSXBuiltin"==n.name||"JSXNamespacedName"==n.name||"JSXMemberExpression"==n.name)return t.sliceString(n.from,Math.min(n.to,i));return""}const Ff="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),Hf=Ts.inputHandler.of(((t,e,i,n)=>{if((Ff?t.composing:t.compositionStarted)||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!qf.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((t=>{var e,i;let r,{head:o}=t,a=Xa(s).resolveInner(o,-1);if("JSXStartTag"==a.name&&(a=a.parent),">"==n&&"JSXFragmentTag"==a.name)return{range:A.cursor(o+1),changes:{from:o,insert:">"}};if("/"==n&&"JSXFragmentTag"==a.name){let t=a.parent,i=null==t?void 0:t.parent;if(t.from==o-1&&"JSXEndTag"!=(null===(e=i.lastChild)||void 0===e?void 0:e.name)&&(r=Gf(s.doc,null==i?void 0:i.firstChild,o))){let t=`/${r}>`;return{range:A.cursor(o+t.length),changes:{from:o,insert:t}}}}else if(">"==n){let t=function(t){for(;;){if("JSXOpenTag"==t.name||"JSXSelfClosingTag"==t.name||"JSXFragmentTag"==t.name)return t;if(!t.parent)return null;t=t.parent}}(a);if(t&&"JSXEndTag"!=(null===(i=t.lastChild)||void 0===i?void 0:i.name)&&"`}}}return{range:t}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)}));class Jf{constructor(t,e,i,n,s,r,o){this.type=t,this.value=e,this.from=i,this.hash=n,this.end=s,this.children=r,this.positions=o,this.hashProp=[[ho.contextHash,n]]}static create(t,e,i,n,s){return new Jf(t,e,i,n+(n<<8)+t+(e<<4)|0,s,[],[])}addChild(t,e){t.prop(ho.contextHash)!=this.hash&&(t=new bo(t.type,t.children,t.positions,t.length,this.hashProp)),this.children.push(t),this.positions.push(e)}toTree(t,e=this.end){let i=this.children.length-1;return i>=0&&(e=Math.max(e,this.positions[i]+this.children[i].length+this.from)),new bo(t.types[this.type],this.children,this.positions,e-this.from).balance({makeTree:(t,e,i)=>new bo(fo.none,t,e,i,this.hashProp)})}}var Kf;!function(t){t[t.Document=1]="Document",t[t.CodeBlock=2]="CodeBlock",t[t.FencedCode=3]="FencedCode",t[t.Blockquote=4]="Blockquote",t[t.HorizontalRule=5]="HorizontalRule",t[t.BulletList=6]="BulletList",t[t.OrderedList=7]="OrderedList",t[t.ListItem=8]="ListItem",t[t.ATXHeading1=9]="ATXHeading1",t[t.ATXHeading2=10]="ATXHeading2",t[t.ATXHeading3=11]="ATXHeading3",t[t.ATXHeading4=12]="ATXHeading4",t[t.ATXHeading5=13]="ATXHeading5",t[t.ATXHeading6=14]="ATXHeading6",t[t.SetextHeading1=15]="SetextHeading1",t[t.SetextHeading2=16]="SetextHeading2",t[t.HTMLBlock=17]="HTMLBlock",t[t.LinkReference=18]="LinkReference",t[t.Paragraph=19]="Paragraph",t[t.CommentBlock=20]="CommentBlock",t[t.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",t[t.Escape=22]="Escape",t[t.Entity=23]="Entity",t[t.HardBreak=24]="HardBreak",t[t.Emphasis=25]="Emphasis",t[t.StrongEmphasis=26]="StrongEmphasis",t[t.Link=27]="Link",t[t.Image=28]="Image",t[t.InlineCode=29]="InlineCode",t[t.HTMLTag=30]="HTMLTag",t[t.Comment=31]="Comment",t[t.ProcessingInstruction=32]="ProcessingInstruction",t[t.URL=33]="URL",t[t.HeaderMark=34]="HeaderMark",t[t.QuoteMark=35]="QuoteMark",t[t.ListMark=36]="ListMark",t[t.LinkMark=37]="LinkMark",t[t.EmphasisMark=38]="EmphasisMark",t[t.CodeMark=39]="CodeMark",t[t.CodeText=40]="CodeText",t[t.CodeInfo=41]="CodeInfo",t[t.LinkTitle=42]="LinkTitle",t[t.LinkLabel=43]="LinkLabel"}(Kf||(Kf={}));class tp{constructor(t,e){this.start=t,this.content=e,this.marks=[],this.parsers=[]}}class ep{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let t=this.skipSpace(this.basePos);this.indent=this.countIndent(t,this.pos,this.indent),this.pos=t,this.next=t==this.text.length?-1:this.text.charCodeAt(t)}skipSpace(t){return rp(this.text,t)}reset(t){for(this.text=t,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(t){this.basePos=t,this.baseIndent=this.countIndent(t,this.pos,this.indent)}moveBaseColumn(t){this.baseIndent=t,this.basePos=this.findColumn(t)}addMarker(t){this.markers.push(t)}countIndent(t,e=0,i=0){for(let n=e;n=e.stack[i.depth+1].value+i.baseIndent)return!0;if(i.indent>=i.baseIndent+4)return!1;let n=(t.type==Kf.OrderedList?dp:up)(i,e,!1);return n>0&&(t.type!=Kf.BulletList||hp(i,e,!1)<0)&&i.text.charCodeAt(i.pos+n-1)==t.value}const np={[Kf.Blockquote]:(t,e,i)=>62==i.next&&(i.markers.push(Up(Kf.QuoteMark,e.lineStart+i.pos,e.lineStart+i.pos+1)),i.moveBase(i.pos+(sp(i.text.charCodeAt(i.pos+1))?2:1)),t.end=e.lineStart+i.text.length,!0),[Kf.ListItem]:(t,e,i)=>!(i.indent-1)&&(i.moveBaseColumn(i.baseIndent+t.value),!0),[Kf.OrderedList]:ip,[Kf.BulletList]:ip,[Kf.Document]:()=>!0};function sp(t){return 32==t||9==t||10==t||13==t}function rp(t,e=0){for(;ei&&sp(t.charCodeAt(e-1));)e--;return e}function ap(t){if(96!=t.next&&126!=t.next)return-1;let e=t.pos+1;for(;e-1&&t.depth==e.stack.length||n<3?-1:1}function cp(t,e){for(let i=t.stack.length-1;i>=0;i--)if(t.stack[i].type==e)return!0;return!1}function up(t,e,i){return 45!=t.next&&43!=t.next&&42!=t.next||t.pos!=t.text.length-1&&!sp(t.text.charCodeAt(t.pos+1))||!(!i||cp(e,Kf.BulletList)||t.skipSpace(t.pos+2)=48&&s<=57;){if(n++,n==t.text.length)return-1;s=t.text.charCodeAt(n)}return n==t.pos||n>t.pos+9||46!=s&&41!=s||nt.pos+1||49!=t.next)?-1:n+1-t.pos}function fp(t){if(35!=t.next)return-1;let e=t.pos+1;for(;e6?-1:i}function pp(t){if(45!=t.next&&61!=t.next||t.indent>=t.baseIndent+4)return-1;let e=t.pos+1;for(;e/,mp=/\?>/,bp=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*/i.exec(n);if(r)return t.append(Up(Kf.Comment,i,i+1+r[0].length));let o=/^\?[^]*?\?>/.exec(n);if(o)return t.append(Up(Kf.ProcessingInstruction,i,i+1+o[0].length));let a=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(n);return a?t.append(Up(Kf.HTMLTag,i,i+1+a[0].length)):-1},Emphasis(t,e,i){if(95!=e&&42!=e)return-1;let n=i+1;for(;t.char(n)==e;)n++;let s=t.slice(i-1,i),r=t.slice(n,n+1),o=jp.test(s),a=jp.test(r),l=/\s|^$/.test(s),h=/\s|^$/.test(r),c=!h&&(!a||l||o),u=!l&&(!o||h||a),d=c&&(42==e||!u||o),f=u&&(42==e||!c||a);return t.append(new Ip(95==e?Yp:qp,i,n,(d?1:0)|(f?2:0)))},HardBreak(t,e,i){if(92==e&&10==t.char(i+1))return t.append(Up(Kf.HardBreak,i,i+2));if(32==e){let e=i+1;for(;32==t.char(e);)e++;if(10==t.char(e)&&e>=i+2)return t.append(Up(Kf.HardBreak,i,e+1))}return-1},Link:(t,e,i)=>91==e?t.append(new Ip(Lp,i,i+1,1)):-1,Image:(t,e,i)=>33==e&&91==t.char(i+1)?t.append(new Ip(zp,i,i+2,1)):-1,LinkEnd(t,e,i){if(93!=e)return-1;for(let e=t.parts.length-1;e>=0;e--){let n=t.parts[e];if(n instanceof Ip&&(n.type==Lp||n.type==zp)){if(!n.side||t.skipSpace(n.to)==i&&!/[(\[]/.test(t.slice(i+1,i+2)))return t.parts[e]=null,-1;let s=t.takeContent(e),r=t.parts[e]=Gp(t,s,n.type==Lp?Kf.Link:Kf.Image,n.from,i+1);if(n.type==Lp)for(let i=0;ie?Up(Kf.URL,e+i,s+i):s==t.length&&null}}function Hp(t,e,i){let n=t.charCodeAt(e);if(39!=n&&34!=n&&40!=n)return!1;let s=40==n?41:n;for(let n=e+1,r=!1;n=this.end?-1:this.text.charCodeAt(t-this.offset)}get end(){return this.offset+this.text.length}slice(t,e){return this.text.slice(t-this.offset,e-this.offset)}append(t){return this.parts.push(t),t.to}addDelimiter(t,e,i,n,s){return this.append(new Ip(t,e,i,(n?1:0)|(s?2:0)))}addElement(t){return this.append(t)}resolveMarkers(t){for(let e=t;e=t;o--){let t=this.parts[o];if(t instanceof Ip&&1&t.side&&t.type==i.type&&!(s&&(1&i.side||2&t.side)&&(t.to-t.from+r)%3==0&&((t.to-t.from)%3||r%3))){n=t;break}}if(!n)continue;let a=i.type.resolve,l=[],h=n.from,c=i.to;if(s){let t=Math.min(2,n.to-n.from,r);h=n.to-t,c=i.from+t,a=1==t?"Emphasis":"StrongEmphasis"}n.type.mark&&l.push(this.elt(n.type.mark,h,n.to));for(let t=o+1;t=0;e--){let i=this.parts[e];if(i instanceof Ip&&i.type==t)return e}return null}takeContent(t){let e=this.resolveMarkers(t);return this.parts.length=t,e}skipSpace(t){return rp(this.text,t-this.offset)+this.offset}elt(t,e,i,n){return"string"==typeof t?Up(this.parser.getNodeType(t),e,i,n):new Wp(t,e)}}function tO(t,e){if(!e.length)return t;if(!t.length)return e;let i=t.slice(),n=0;for(let t of e){for(;n(t?t-1:0))return!1;if(this.fragmentEnd<0){let t=this.fragment.to;for(;t>0&&"\n"!=this.input.read(t-1,t);)t--;this.fragmentEnd=t?t-1:0}let i=this.cursor;i||(i=this.cursor=this.fragment.tree.cursor(),i.firstChild());let n=t+this.fragment.offset;for(;i.to<=n;)if(!i.parent())return!1;for(;;){if(i.from>=n)return this.fragment.from<=e;if(!i.childAfter(n))return!1}}matches(t){let e=this.cursor.tree;return e&&e.prop(ho.contextHash)==t}takeNodes(t){let e=this.cursor,i=this.fragment.offset,n=this.fragmentEnd-(this.fragment.openEnd?1:0),s=t.absoluteLineStart,r=s,o=t.block.children.length,a=r,l=o;for(;;){if(e.to-i>n){if(e.type.isAnonymous&&e.firstChild())continue;break}if(t.dontInject.add(e.tree),t.addNode(e.tree,e.from-i),e.type.is("Block")&&(eO.indexOf(e.type.id)<0?(r=e.to-i,o=t.block.children.length):(r=a,o=l,a=e.to-i,l=t.block.children.length)),!e.nextSibling())break}for(;t.block.children.length>o;)t.block.children.pop(),t.block.positions.pop();return r-s}}const nO=ea({"Blockquote/...":Sa.quote,HorizontalRule:Sa.contentSeparator,"ATXHeading1/... SetextHeading1/...":Sa.heading1,"ATXHeading2/... SetextHeading2/...":Sa.heading2,"ATXHeading3/...":Sa.heading3,"ATXHeading4/...":Sa.heading4,"ATXHeading5/...":Sa.heading5,"ATXHeading6/...":Sa.heading6,"Comment CommentBlock":Sa.comment,Escape:Sa.escape,Entity:Sa.character,"Emphasis/...":Sa.emphasis,"StrongEmphasis/...":Sa.strong,"Link/... Image/...":Sa.link,"OrderedList/... BulletList/...":Sa.list,"BlockQuote/...":Sa.quote,"InlineCode CodeText":Sa.monospace,URL:Sa.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":Sa.processingInstruction,"CodeInfo LinkLabel":Sa.labelName,LinkTitle:Sa.string,Paragraph:Sa.content}),sO=new Zp(new po(Ep).extend(nO),Object.keys(Sp).map((t=>Sp[t])),Object.keys(Sp).map((t=>$p[t])),Object.keys(Sp),Pp,np,Object.keys(Np).map((t=>Np[t])),Object.keys(Np),[]);function rO(t,e,i){let n=[];for(let s=t.firstChild,r=e;;s=s.nextSibling){let t=s?s.from:i;if(t>r&&n.push({from:r,to:t}),!s)break;r=s.to}return n}const oO={resolve:"Strikethrough",mark:"StrikethroughMark"},aO={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":Sa.strikethrough}},{name:"StrikethroughMark",style:Sa.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,i){if(126!=e||126!=t.char(i+1)||126==t.char(i+2))return-1;let n=t.slice(i-1,i),s=t.slice(i+2,i+3),r=/\s|^$/.test(n),o=/\s|^$/.test(s),a=jp.test(n),l=jp.test(s);return t.addDelimiter(oO,i,i+2,!o&&(!l||r||a),!r&&(!a||o||l))},after:"Emphasis"}]};function lO(t,e,i=0,n,s=0){let r=0,o=!0,a=-1,l=-1,h=!1,c=()=>{n.push(t.elt("TableCell",s+a,s+l,t.parser.parseInline(e.slice(a,l),s+a)))};for(let u=i;u-1)&&r++,o=!1,n&&(a>-1&&c(),n.push(t.elt("TableDelimiter",u+s,u+s+1))),a=l=-1),h=!h&&92==i}return a>-1&&(r++,n&&c()),r}function hO(t,e){for(let i=e;ihO(e.content,0)?new uO:null,endLeaf(t,e,i){if(i.parsers.some((t=>t instanceof uO))||!hO(e.text,e.basePos))return!1;let n=t.scanLine(t.absoluteLineEnd+1).text;return cO.test(n)&&lO(t,e.text,e.basePos)==lO(t,n,e.basePos)},before:"SetextHeading"}]};class fO{nextLine(){return!1}finish(t,e){return t.addLeafElement(e,t.elt("Task",e.start,e.start+e.content.length,[t.elt("TaskMarker",e.start,e.start+3),...t.parser.parseInline(e.content.slice(3),e.start+3)])),!0}}const pO=[dO,{defineNodes:[{name:"Task",block:!0,style:Sa.list},{name:"TaskMarker",style:Sa.atom}],parseBlock:[{name:"TaskList",leaf:(t,e)=>/^\[[ xX]\]/.test(e.content)&&"ListItem"==t.parentType().name?new fO:null,after:"SetextHeading"}]},aO];function OO(t,e,i){return(n,s,r)=>{if(s!=t||n.char(r+1)==t)return-1;let o=[n.elt(i,r,r+1)];for(let s=r+1;s=65&&r<=90||95==r||r>=97&&r<=122||r>=161;)s+=String.fromCharCode(n),n=t.peek(++e);var r;return RO=t,EO=i,TO=s?s.toLowerCase():n==MO||n==DO?void 0:null}const MO=63,DO=33;function WO(t,e){this.name=t,this.parent=e,this.hash=e?e.hash:0;for(let e=0;eUO.indexOf(e)>-1?new WO(VO(n,1)||"",t):t,reduce:(t,e)=>e==wO&&t?t.parent:t,reuse(t,e,i,n){let s=e.type.id;return 6==s||36==s?new WO(VO(n,1)||"",t):t},hash:t=>t?t.hash:0,strict:!1}),qO=new nf(((t,e)=>{if(60!=t.next)return void(t.next<0&&e.context&&t.acceptToken(57));t.advance();let i=47==t.next;i&&t.advance();let n=VO(t,0);if(void 0===n)return;if(!n)return t.acceptToken(i?14:6);let s=e.context?e.context.name:null;if(i){if(n==s)return t.acceptToken(11);if(s&&XO[s])return t.acceptToken(57,-2);if(e.dialectEnabled(0))return t.acceptToken(12);for(let t=e.context;t;t=t.parent)if(t.name==n)return;t.acceptToken(13)}else{if("script"==n)return t.acceptToken(7);if("style"==n)return t.acceptToken(8);if("textarea"==n)return t.acceptToken(9);if(_O.hasOwnProperty(n))return t.acceptToken(10);s&&ZO[s]&&ZO[s][n]?t.acceptToken(57,-1):t.acceptToken(6)}}),{contextual:!0}),LO=new nf((t=>{for(let e=0,i=0;;i++){if(t.next<0){i&&t.acceptToken(58);break}if(45==t.next)e++;else{if(62==t.next&&e>=2){i>3&&t.acceptToken(58,-2);break}e=0}t.advance()}}));const zO=new nf(((t,e)=>{if(47==t.next&&62==t.peek(1)){let i=e.dialectEnabled(1)||function(t){for(;t;t=t.parent)if("svg"==t.name||"math"==t.name)return!0;return!1}(e.context);t.acceptToken(i?5:4,2)}else 62==t.next&&t.acceptToken(4,1)}));function IO(t,e,i){let n=2+t.length;return new nf((s=>{for(let r=0,o=0,a=0;;a++){if(s.next<0){a&&s.acceptToken(e);break}if(0==r&&60==s.next||1==r&&47==s.next||r>=2&&ro?s.acceptToken(e,-o):s.acceptToken(i,-(o-2));break}if((10==s.next||13==s.next)&&a){s.acceptToken(e,1);break}r=o=0}else o++;s.advance()}}))}const BO=IO("script",54,1),jO=IO("style",55,2),NO=IO("textarea",56,3),GO=ea({"Text RawText":Sa.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":Sa.angleBracket,TagName:Sa.tagName,"MismatchedCloseTag/TagName":[Sa.tagName,Sa.invalid],AttributeName:Sa.attributeName,"AttributeValue UnquotedAttributeValue":Sa.attributeValue,Is:Sa.definitionOperator,"EntityReference CharacterReference":Sa.character,Comment:Sa.blockComment,ProcessingInst:Sa.processingInstruction,DoctypeDecl:Sa.documentMeta}),FO=wf.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Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:67,context:YO,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,21,30,33,36,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,29,32,35,37,"OpenTag"],["group",-9,14,17,18,19,20,39,40,41,42,"Entity",16,"Entity TextContent",-3,28,31,34,"TextContent Entity"]],propSources:[GO],skippedNodes:[0],repeatNodeCount:9,tokenData:"#%g!aR!YOX$qXY,QYZ,QZ[$q[]&X]^,Q^p$qpq,Qqr-_rs4ysv-_vw5iwxJ^x}-_}!OKP!O!P-_!P!Q$q!Q![-_![!]!!O!]!^-_!^!_!&W!_!`#$o!`!a&X!a!c-_!c!}!!O!}#R-_#R#S!!O#S#T3V#T#o!!O#o#s-_#s$f$q$f%W-_%W%o!!O%o%p-_%p&a!!O&a&b-_&b1p!!O1p4U-_4U4d!!O4d4e-_4e$IS!!O$IS$I`-_$I`$Ib!!O$Ib$Kh-_$Kh%#t!!O%#t&/x-_&/x&Et!!O&Et&FV-_&FV;'S!!O;'S;:j!&Q;:j;=`4s<%l?&r-_?&r?Ah!!O?Ah?BY$q?BY?Mn!!O?MnO$q!Z$|c`PkW!a`!cpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr$qrs&}sv$qvw+Pwx(tx!^$q!^!_*V!_!a&X!a#S$q#S#T&X#T;'S$q;'S;=`+z<%lO$q!R&bX`P!a`!cpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&Xq'UV`P!cpOv&}wx'kx!^&}!^!_(V!_;'S&};'S;=`(n<%lO&}P'pT`POv'kw!^'k!_;'S'k;'S;=`(P<%lO'kP(SP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}return i}function JO(t,e){let i=t.getChild(vO);return i?e.read(i.from,i.to):" "}function KO(t,e,i){let n;for(let s of i)if(!s.attrs||s.attrs(n||(n=HO(t.node.parent.firstChild,e))))return{parser:s.parser};return null}function tg(t=[],e=[]){let i=[],n=[],s=[],r=[];for(let e of t){("script"==e.tag?i:"style"==e.tag?n:"textarea"==e.tag?s:r).push(e)}let o=e.length?Object.create(null):null;for(let t of e)(o[t.name]||(o[t.name]=[])).push(t);return Do(((t,e)=>{let a=t.type.id;if(a==QO)return KO(t,e,i);if(a==$O)return KO(t,e,n);if(a==PO)return KO(t,e,s);if(a==wO&&r.length){let i,n=t.node,s=n.firstChild,o=s&&JO(s,e);if(o)for(let t of r)if(t.tag==o&&(!t.attrs||t.attrs(i||(i=HO(n,e))))){let e=n.lastChild;return{parser:t.parser,overlay:[{from:s.to,to:e.type.id==CO?e.from:n.to}]}}}if(o&&a==yO){let i,n=t.node;if(i=n.firstChild){let t=o[e.read(i.from,i.to)];if(t)for(let i of t){if(i.tagName&&i.tagName!=JO(n.parent,e))continue;let t=n.lastChild;if(t.type.id==xO){let e=t.from+1,n=t.lastChild,s=t.to-(n&&n.isError?0:1);if(s>e)return{parser:i.parser,overlay:[{from:e,to:s}]}}else if(t.type.id==kO)return{parser:i.parser,overlay:[{from:t.from,to:t.to}]}}}}return null}))}const eg=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288];function ig(t){return t>=65&&t<=90||t>=97&&t<=122||t>=161}const ng=new nf(((t,e)=>{for(let n=!1,s=0,r=0;;r++){let{next:o}=t;if(!(ig(o)||45==o||95==o||n&&(i=o,i>=48&&i<=57))){n&&t.acceptToken(40==o?95:2==s&&e.canShift(2)?2:96);break}!n&&(45!=o||r>0)&&(n=!0),s===r&&45==o&&s++,t.advance()}var i})),sg=new nf((t=>{if(eg.includes(t.peek(-1))){let{next:e}=t;(ig(e)||95==e||35==e||46==e||91==e||58==e||45==e)&&t.acceptToken(94)}})),rg=new nf((t=>{if(!eg.includes(t.peek(-1))){let{next:e}=t;if(37==e&&(t.advance(),t.acceptToken(1)),ig(e)){do{t.advance()}while(ig(t.next));t.acceptToken(1)}}})),og=ea({"AtKeyword import charset namespace keyframes media supports":Sa.definitionKeyword,"from to selector":Sa.keyword,NamespaceName:Sa.namespace,KeyframeName:Sa.labelName,TagName:Sa.tagName,ClassName:Sa.className,PseudoClassName:Sa.constant(Sa.className),IdName:Sa.labelName,"FeatureName PropertyName":Sa.propertyName,AttributeName:Sa.attributeName,NumberLiteral:Sa.number,KeywordQuery:Sa.keyword,UnaryQueryOp:Sa.operatorKeyword,"CallTag ValueName":Sa.atom,VariableName:Sa.variableName,Callee:Sa.operatorKeyword,Unit:Sa.unit,"UniversalSelector NestingSelector":Sa.definitionOperator,MatchOp:Sa.compareOperator,"ChildOp SiblingOp, LogicOp":Sa.logicOperator,BinOp:Sa.arithmeticOperator,Important:Sa.modifier,Comment:Sa.blockComment,ParenthesizedContent:Sa.special(Sa.name),ColorLiteral:Sa.color,StringLiteral:Sa.string,":":Sa.punctuation,"PseudoOp #":Sa.derefOperator,"; ,":Sa.separator,"( )":Sa.paren,"[ ]":Sa.squareBracket,"{ }":Sa.brace}),ag={__proto__:null,lang:32,"nth-child":32,"nth-last-child":32,"nth-of-type":32,"nth-last-of-type":32,dir:32,"host-context":32,url:60,"url-prefix":60,domain:60,regexp:60,selector:134},lg={__proto__:null,"@import":114,"@media":138,"@charset":142,"@namespace":146,"@keyframes":152,"@supports":164},hg={__proto__:null,not:128,only:128,from:158,to:160},cg=wf.deserialize({version:14,states:"7WQYQ[OOO#_Q[OOOOQP'#Cd'#CdOOQP'#Cc'#CcO#fQ[O'#CfO$YQXO'#CaO$aQ[O'#ChO$lQ[O'#DPO$qQ[O'#DTOOQP'#Ed'#EdO$vQdO'#DeO%bQ[O'#DrO$vQdO'#DtO%sQ[O'#DvO&OQ[O'#DyO&TQ[O'#EPO&cQ[O'#EROOQS'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O!P;g!P!Q%^!Q![>T![!g%^!g!h<^!h#X%^#X#Y<^#Y;'S%^;'S;=`%o<%lO%^XDuU]POy%^z![%^![!]EX!];'S%^;'S;=`%o<%lO%^XE`S^PoWOy%^z;'S%^;'S;=`%o<%lO%^_EqS!WVOy%^z;'S%^;'S;=`%o<%lO%^YFSSzQOy%^z;'S%^;'S;=`%o<%lO%^XFeU|POy%^z!`%^!`!aFw!a;'S%^;'S;=`%o<%lO%^XGOS|PoWOy%^z;'S%^;'S;=`%o<%lO%^XG_WOy%^z!c%^!c!}Gw!}#T%^#T#oGw#o;'S%^;'S;=`%o<%lO%^XHO[!YPoWOy%^z}%^}!OGw!O!Q%^!Q![Gw![!c%^!c!}Gw!}#T%^#T#oGw#o;'S%^;'S;=`%o<%lO%^XHySxPOy%^z;'S%^;'S;=`%o<%lO%^^I[SvUOy%^z;'S%^;'S;=`%o<%lO%^XIkUOy%^z#b%^#b#cI}#c;'S%^;'S;=`%o<%lO%^XJSUoWOy%^z#W%^#W#XJf#X;'S%^;'S;=`%o<%lO%^XJmS!`PoWOy%^z;'S%^;'S;=`%o<%lO%^XJ|UOy%^z#f%^#f#gJf#g;'S%^;'S;=`%o<%lO%^XKeS!RPOy%^z;'S%^;'S;=`%o<%lO%^_KvS!QVOy%^z;'S%^;'S;=`%o<%lO%^ZLXU!PPOy%^z!_%^!_!`6y!`;'S%^;'S;=`%o<%lO%^WLnP;=`<%l$}",tokenizers:[sg,rg,ng,0,1,2,3],topRules:{StyleSheet:[0,4],Styles:[1,84]},specialized:[{term:95,get:t=>ag[t]||-1},{term:56,get:t=>lg[t]||-1},{term:96,get:t=>hg[t]||-1}],tokenPrec:1123});let ug=null;function dg(){if(!ug&&"object"==typeof document&&document.body){let{style:t}=document.body,e=[],i=new Set;for(let n in t)"cssText"!=n&&"cssFloat"!=n&&"string"==typeof t[n]&&(/[A-Z]/.test(n)&&(n=n.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))),i.has(n)||(e.push(n),i.add(n)));ug=e.sort().map((t=>({type:"property",label:t})))}return ug||[]}const fg=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map((t=>({type:"class",label:t}))),pg=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map((t=>({type:"keyword",label:t}))).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map((t=>({type:"constant",label:t})))),Og=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map((t=>({type:"type",label:t}))),gg=/^(\w[\w-]*|-\w[\w-]*|)$/,mg=/^-(-[\w-]*)?$/;const bg=new Ro,wg=["Declaration"];function vg(t){for(let e=t;;){if(e.type.isTop)return e;if(!(e=e.parent))return t}}function yg(t,e,i){if(e.to-e.from>4096){let n=bg.get(e);if(n)return n;let s=[],r=new Set,o=e.cursor(mo.IncludeAnonymous);if(o.firstChild())do{for(let e of yg(t,o.node,i))r.has(e.label)||(r.add(e.label),s.push(e))}while(o.nextSibling());return bg.set(e,s),s}{let n=[],s=new Set;return e.cursor().iterate((e=>{var r;if(i(e)&&e.matchContext(wg)&&":"==(null===(r=e.node.nextSibling)||void 0===r?void 0:r.name)){let i=t.sliceString(e.from,e.to);s.has(i)||(s.add(i),n.push({label:i,type:"variable"}))}})),n}}const Sg=t=>e=>{let{state:i,pos:n}=e,s=Xa(i).resolveInner(n,-1),r=s.type.isError&&s.from==s.to-1&&"-"==i.doc.sliceString(s.from,s.to);if("PropertyName"==s.name||(r||"TagName"==s.name)&&/^(Block|Styles)$/.test(s.resolve(s.to).name))return{from:s.from,options:dg(),validFor:gg};if("ValueName"==s.name)return{from:s.from,options:pg,validFor:gg};if("PseudoClassName"==s.name)return{from:s.from,options:fg,validFor:gg};if(t(s)||(e.explicit||r)&&function(t,e){var i;if(("("==t.name||t.type.isError)&&(t=t.parent||t),"ArgList"!=t.name)return!1;let n=null===(i=t.parent)||void 0===i?void 0:i.firstChild;return"Callee"==(null==n?void 0:n.name)&&"var"==e.sliceString(n.from,n.to)}(s,i.doc))return{from:t(s)||r?s.from:n,options:yg(i.doc,vg(s),t),validFor:mg};if("TagName"==s.name){for(let{parent:t}=s;t;t=t.parent)if("Block"==t.name)return{from:s.from,options:dg(),validFor:gg};return{from:s.from,options:Og,validFor:gg}}if(!e.explicit)return null;let o=s.resolve(n),a=o.childBefore(n);return a&&":"==a.name&&"PseudoClassSelector"==o.name?{from:n,options:fg,validFor:gg}:a&&":"==a.name&&"Declaration"==o.name||"ArgList"==o.name?{from:n,options:pg,validFor:gg}:"Block"==o.name||"Styles"==o.name?{from:n,options:dg(),validFor:gg}:null},xg=Sg((t=>"VariableName"==t.name)),kg=_a.define({name:"css",parser:cg.configure({props:[Na.add({Declaration:il()}),rl.add({"Block KeyframeList":ol})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function Qg(){return new Ua(kg,kg.data.of({autocomplete:xg}))}const $g=["_blank","_self","_top","_parent"],Pg=["ascii","utf-8","utf-16","latin1","latin1"],Cg=["get","post","put","delete"],_g=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Xg=["true","false"],Zg={},Ag={a:{attrs:{href:null,ping:null,type:null,media:null,target:$g,hreflang:null}},abbr:Zg,address:Zg,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Zg,aside:Zg,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Zg,base:{attrs:{href:null,target:$g}},bdi:Zg,bdo:Zg,blockquote:{attrs:{cite:null}},body:Zg,br:Zg,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Zg,center:Zg,cite:Zg,code:Zg,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:Zg,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Zg,div:Zg,dl:Zg,dt:Zg,em:Zg,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Zg,figure:Zg,footer:Zg,form:{attrs:{action:null,name:null,"accept-charset":Pg,autocomplete:["on","off"],enctype:_g,method:Cg,novalidate:["novalidate"],target:$g}},h1:Zg,h2:Zg,h3:Zg,h4:Zg,h5:Zg,h6:Zg,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Zg,hgroup:Zg,hr:Zg,html:{attrs:{manifest:null}},i:Zg,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:Zg,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Zg,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:Zg,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Pg,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:Zg,noscript:Zg,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:Zg,param:{attrs:{name:null,value:null}},pre:Zg,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Zg,rt:Zg,ruby:Zg,samp:Zg,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Pg}},section:Zg,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Zg,source:{attrs:{src:null,type:null,media:null}},span:Zg,strong:Zg,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Zg,summary:Zg,sup:Zg,table:Zg,tbody:Zg,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Zg,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:Zg,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Zg,time:{attrs:{datetime:null}},title:Zg,tr:Zg,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Zg,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:Zg},Tg={accesskey:null,class:null,contenteditable:Xg,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Xg,autocorrect:Xg,autocapitalize:Xg,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Xg,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Xg,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Xg,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Xg,"aria-hidden":Xg,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Xg,"aria-multiselectable":Xg,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Xg,"aria-relevant":null,"aria-required":Xg,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},Rg="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map((t=>"on"+t));for(let t of Rg)Tg[t]=null;class Eg{constructor(t,e){this.tags=Object.assign(Object.assign({},Ag),t),this.globalAttrs=Object.assign(Object.assign({},Tg),e),this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}function Vg(t,e,i=t.length){if(!e)return"";let n=e.firstChild,s=n&&n.getChild("TagName");return s?t.sliceString(s.from,Math.min(s.to,i)):""}function Mg(t,e=!1){for(let i=t.parent;i;i=i.parent)if("Element"==i.name){if(!e)return i;e=!1}return null}function Dg(t,e,i){let n=i.tags[Vg(t,Mg(e,!0))];return(null==n?void 0:n.children)||i.allTags}function Wg(t,e){let i=[];for(let n=e;n=Mg(n);){let s=Vg(t,n);if(s&&"CloseTag"==n.lastChild.name)break;s&&i.indexOf(s)<0&&("EndTag"==e.name||e.from>=n.firstChild.to)&&i.push(s)}return i}Eg.default=new Eg;const Ug=/^[:\-\.\w\u00b7-\uffff]*$/;function Yg(t,e,i,n,s){let r=/\s*>/.test(t.sliceDoc(s,s+5))?"":">";return{from:n,to:s,options:Dg(t.doc,i,e).map((t=>({label:t,type:"type"}))).concat(Wg(t.doc,i).map(((t,e)=>({label:"/"+t,apply:"/"+t+r,type:"type",boost:99-e})))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function qg(t,e,i,n){let s=/\s*>/.test(t.sliceDoc(n,n+5))?"":">";return{from:i,to:n,options:Wg(t.doc,e).map(((t,e)=>({label:t,apply:t+s,type:"type",boost:99-e}))),validFor:Ug}}function Lg(t,e){let{state:i,pos:n}=e,s=Xa(i).resolveInner(n),r=s.resolve(n,-1);for(let t,e=n;s==r&&(t=r.childBefore(e));){let i=t.lastChild;if(!i||!i.type.isError||i.from({label:t,type:"property"}))),validFor:Ug}}(i,t,r,"AttributeName"==r.name?r.from:n,n):"Is"==r.name||"AttributeValue"==r.name||"UnquotedAttributeValue"==r.name?function(t,e,i,n,s){var r;let o,a=null===(r=i.parent)||void 0===r?void 0:r.getChild("AttributeName"),l=[];if(a){let r=t.sliceDoc(a.from,a.to),h=e.globalAttrs[r];if(!h){let n=Mg(i),s=n?e.tags[Vg(t.doc,n)]:null;h=(null==s?void 0:s.attrs)&&s.attrs[r]}if(h){let e=t.sliceDoc(n,s).toLowerCase(),i='"',r='"';/^['"]/.test(e)?(o='"'==e[0]?/^[^"]*$/:/^[^']*$/,i="",r=t.sliceDoc(s,s+1)==e[0]?"":e[0],e=e.slice(1),n++):o=/^[^\s<>='"]*$/;for(let t of h)l.push({label:t,apply:i+t+r,type:"constant"})}}return{from:n,to:s,options:l,validFor:o}}(i,t,r,"Is"==r.name?n:r.from,n):!e.explicit||"Element"!=s.name&&"Text"!=s.name&&"Document"!=s.name?null:function(t,e,i,n){let s=[],r=0;for(let n of Dg(t.doc,i,e))s.push({label:"<"+n,type:"type"});for(let e of Wg(t.doc,i))s.push({label:"",type:"type",boost:99-r++});return{from:n,to:n,options:s,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}(i,t,r,n)}function zg(t){let{extraTags:e,extraGlobalAttributes:i}=t,n=i||e?new Eg(e,i):Eg.default;return t=>Lg(n,t)}const Ig=[{tag:"script",attrs:t=>"text/typescript"==t.type||"ts"==t.lang,parser:zf.parser},{tag:"script",attrs:t=>"text/babel"==t.type||"text/jsx"==t.type,parser:If.parser},{tag:"script",attrs:t=>"text/typescript-jsx"==t.type,parser:Bf.parser},{tag:"script",attrs:t=>!t.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(t.type),parser:qf.parser},{tag:"style",attrs:t=>(!t.lang||"css"==t.lang)&&(!t.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(t.type)),parser:kg.parser}],Bg=[{name:"style",parser:kg.parser.configure({top:"Styles"})}].concat(Rg.map((t=>({name:t,parser:qf.parser})))),jg=_a.define({name:"html",parser:FO.configure({props:[Na.add({Element(t){let e=/^(\s*)(<\/)?/.exec(t.textAfter);return t.node.to<=t.pos+e[0].length?t.continue():t.lineIndent(t.node.from)+(e[2]?0:t.unit)},"OpenTag CloseTag SelfClosingTag":t=>t.column(t.node.from)+t.unit,Document(t){if(t.pos+/\s*/.exec(t.textAfter)[0].lengtht.getChild("TagName")})],wrap:tg(Ig,Bg)}),languageData:{commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-._"}});function Ng(t={}){let e,i="";!1===t.matchClosingTags&&(i="noMatch"),!0===t.selfClosingTags&&(i=(i?i+" ":"")+"selfClosing"),(t.nestedLanguages&&t.nestedLanguages.length||t.nestedAttributes&&t.nestedAttributes.length)&&(e=tg((t.nestedLanguages||[]).concat(Ig),(t.nestedAttributes||[]).concat(Bg)));let n=e||i?jg.configure({dialect:i,wrap:e}):jg;return new Ua(n,[jg.data.of({autocomplete:zg(t)}),!1!==t.autoCloseTags?Fg:[],Nf().support,Qg().support])}const Gg=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),Fg=Ts.inputHandler.of(((t,e,i,n)=>{if(t.composing||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!jg.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((e=>{var i,r,o;let a,{head:l}=e,h=Xa(s).resolveInner(l,-1);if("TagName"!=h.name&&"StartTag"!=h.name||(h=h.parent),">"==n&&"OpenTag"==h.name){if("CloseTag"!=(null===(r=null===(i=h.parent)||void 0===i?void 0:i.lastChild)||void 0===r?void 0:r.name)&&(a=Vg(s.doc,h.parent,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`${e?"":">"}`;return{range:A.cursor(l+1),changes:{from:l+(e?1:0),insert:i}}}}else if("/"==n&&"OpenTag"==h.name){let e=h.parent,i=null==e?void 0:e.parent;if(e.from==l-1&&"CloseTag"!=(null===(o=i.lastChild)||void 0===o?void 0:o.name)&&(a=Vg(s.doc,i,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`/${a}${e?"":">"}`,n=l+i.length+(e?1:0);return{range:A.cursor(n),changes:{from:l,insert:i}}}}return{range:e}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)})),Hg=Qa({commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}}}),Jg=new ho,Kg=sO.configure({props:[rl.add((t=>!t.is("Block")||t.is("Document")||null!=tm(t)?void 0:(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to}))),Jg.add(tm),Na.add({Document:()=>null}),ka.add({Document:Hg})]});function tm(t){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(t.name);return e?+e[1]:void 0}function em(t,e){let i=t;for(;;){let t,n=i.nextSibling;if(!n||null!=(t=tm(n.type))&&t<=e)break;i=n}return i.to}const im=sl.of(((t,e,i)=>{for(let n=Xa(t).resolveInner(i,-1);n&&!(n.fromi)return{from:i,to:e}}return null}));function nm(t){return new Pa(Hg,t,[im],"markdown")}const sm=nm(Kg),rm=nm(Kg.configure([pO,mO,gO,bO]));class om{constructor(t,e,i,n,s,r,o){this.node=t,this.from=e,this.to=i,this.spaceBefore=n,this.spaceAfter=s,this.type=r,this.item=o}blank(t,e=!0){let i=this.spaceBefore+("Blockquote"==this.node.name?">":"");if(null!=t){for(;i.length0;t--)i+=" ";return i+(e?this.spaceAfter:"")}marker(t,e){let i="OrderedList"==this.node.name?String(+lm(this.item,t)[2]+e):"";return this.spaceBefore+i+this.type+this.spaceAfter}}function am(t,e){let i=[];for(let e=t;e&&"Document"!=e.name;e=e.parent)"ListItem"!=e.name&&"Blockquote"!=e.name&&"FencedCode"!=e.name||i.push(e);let n=[];for(let t=i.length-1;t>=0;t--){let s,r=i[t],o=e.lineAt(r.from),a=r.from-o.from;if("FencedCode"==r.name)n.push(new om(r,a,a,"","","",null));else if("Blockquote"==r.name&&(s=/^[ \t]*>( ?)/.exec(o.text.slice(a))))n.push(new om(r,a,a+s[0].length,"",s[1],">",null));else if("ListItem"==r.name&&"OrderedList"==r.parent.name&&(s=/^([ \t]*)\d+([.)])([ \t]*)/.exec(o.text.slice(a)))){let t=s[3],e=s[0].length;t.length>=4&&(t=t.slice(0,t.length-4),e-=4),n.push(new om(r.parent,a,a+e,s[1],t,s[2],r))}else if("ListItem"==r.name&&"BulletList"==r.parent.name&&(s=/^([ \t]*)([-+*])([ \t]{1,4}\[[ xX]\])?([ \t]+)/.exec(o.text.slice(a)))){let t=s[4],e=s[0].length;t.length>4&&(t=t.slice(0,t.length-4),e-=4);let i=s[2];s[3]&&(i+=s[3].replace(/[xX]/," ")),n.push(new om(r.parent,a,a+e,s[1],t,i,r))}}return n}function lm(t,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(t.from,t.from+10))}function hm(t,e,i,n=0){for(let s=-1,r=t;;){if("ListItem"==r.name){let t=lm(r,e),o=+t[2];if(s>=0){if(o!=s+1)return;i.push({from:r.from+t[1].length,to:r.from+t[0].length,insert:String(s+2+n)})}s=o}let t=r.nextSibling;if(!t)break;r=t}}function cm(t){return"QuoteMark"==t.name||"ListMark"==t.name}const um=[{key:"Enter",run:({state:t,dispatch:e})=>{let i=Xa(t),{doc:n}=t,s=null,r=t.changeByRange((e=>{if(!e.empty||!rm.isActiveAt(t,e.from))return s={range:e};let r=e.from,o=n.lineAt(r),a=am(i.resolveInner(r,-1),n);for(;a.length&&a[a.length-1].from>r-o.from;)a.pop();if(!a.length)return s={range:e};let l=a[a.length-1];if(l.to-l.spaceAfter.length>r-o.from)return s={range:e};let h=r>=l.to-l.spaceAfter.length&&!/\S/.test(o.text.slice(l.to));if(l.item&&h){if(l.node.firstChild.to>=r||o.from>0&&!/[^\s>]/.test(n.lineAt(o.from-1).text)){let t,e=a.length>1?a[a.length-2]:null,i="";e&&e.item?(t=o.from+e.from,i=e.marker(n,1)):t=o.from+(e?e.to:0);let s=[{from:t,to:r,insert:i}];return"OrderedList"==l.node.name&&hm(l.item,n,s,-2),e&&"OrderedList"==e.node.name&&hm(e.item,n,s),{range:A.cursor(t+i.length),changes:s}}{let e="";for(let t=0,i=a.length-2;t<=i;t++)e+=a[t].blank(t\s*$/.exec(i.text);if(s&&s.index==l.from){let n=t.changes([{from:i.from+s.index,to:i.to},{from:o.from+l.from,to:o.to}]);return{range:e.map(n),changes:n}}}let c=[];"OrderedList"==l.node.name&&hm(l.item,n,c);let u=l.item&&l.item.from]*/.exec(o.text)[0].length>=l.to)for(let t=0,e=a.length-1;t<=e;t++)d+=t!=e||u?a[t].blank(to.from&&/\s/.test(o.text.charAt(f-o.from-1));)f--;return d=t.lineBreak+d,c.push({from:f,to:r,insert:d}),{range:A.cursor(f+d.length),changes:c}}));return!s&&(e(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0)}},{key:"Backspace",run:({state:t,dispatch:e})=>{let i=Xa(t),n=null,s=t.changeByRange((e=>{let s=e.from,{doc:r}=t;if(e.empty&&rm.isActiveAt(t,e.from)){let t=r.lineAt(s),n=am(function(t,e){let i=t.resolveInner(e,-1),n=e;cm(i)&&(n=i.from,i=i.parent);for(let t;t=i.childBefore(n);)if(cm(t))n=t.from;else{if("OrderedList"!=t.name&&"BulletList"!=t.name)break;i=t.lastChild,n=i.to}return i}(i,s),r);if(n.length){let i=n[n.length-1],r=i.to-i.spaceAfter.length+(i.spaceAfter?1:0);if(s-t.from>r&&!/\S/.test(t.text.slice(r,s-t.from)))return{range:A.cursor(t.from+r),changes:{from:t.from+r,to:s}};if(s-t.from==r&&(!i.item||t.from<=i.item.from||!/\S/.test(t.text.slice(0,i.to)))){let n=t.from+i.from;if(i.item&&i.node.fromt.from-e.from||t.startSide-e.startSide)),ni.set(i)}getMatchingBracket(t){switch(t){case")":return"(";case"]":return"[";case"}":return"{";default:return null}}},{decorations:t=>t.decorations});var fm="[a-zA-Z\\$][a-zA-Z0-9\\$]*",pm="(?:\\.\\d+|\\d+\\.\\d*|\\d+)",Om="(?:`(?:`?"+pm+")?)",gm=new RegExp("(?:(?:\\d+)(?:\\^\\^(?:\\.\\w+|\\w+\\.\\w*|\\w+)"+Om+"?(?:\\*\\^[+-]?\\d+)?))"),mm=new RegExp("(?:"+pm+Om+"?(?:\\*\\^[+-]?\\d+)?)"),bm=new RegExp("(?:`?)(?:"+fm+")(?:`(?:"+fm+"))*(?:`?)");let wm=[];const vm=["True","False","All","None","Null","Full","$Failed","$Aborted"];function ym(t,e){var i;return'"'===(i=t.next())?(e.tokenize=Sm,e.tokenize(t,e)):"("===i&&t.eat("*")?(e.commentLevel++,e.tokenize=xm,e.tokenize(t,e)):(t.backUp(1),t.match(gm,!0,!1)||t.match(mm,!0,!1)?"number":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::usage)/,!0,!1)?"meta":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::[a-zA-Z\$][a-zA-Z0-9\$]*):?/,!0,!1)?"string.special":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*\s*:)(?:(?:[a-zA-Z\$][a-zA-Z0-9\$]*)|(?:[^:=>~@\^\&\*\)\[\]'\?,\|])).*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+/,!0,!1)||t.match(/_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)?"variableName.special":t.match(/\\\[[a-zA-Z\$][a-zA-Z0-9\$]*\]/,!0,!1)?"character":t.match(/(?:\[|\]|{|}|\(|\))/,!0,!1)?"bracket":t.match(/(?:#[a-zA-Z\$][a-zA-Z0-9\$]*|#+[0-9]?)/,!0,!1)?"variableName.constant":t.match(bm,!0,!1)?vm.indexOf(t.current())>-1?"number":wm.indexOf(t.current())>-1||0==wm.length?"keyword":t.current()in e.localVars?"atom":(e.localVars[t.current()]=!0,"function"):t.match(/(?:\\|\+|\-|\*|\/|,|;|\.|:|@|~|=|>|<|&|\||_|`|'|\^|\?|!|%)/,!0,!1)?"operator":(t.next(),"error"))}function Sm(t,e){for(var i,n=!1,s=!1;null!=(i=t.next());){if('"'===i&&!s){n=!0;break}s=!s&&"\\"===i}return n&&!s&&(e.tokenize=ym),"string"}function xm(t,e){for(var i,n;e.commentLevel>0&&null!=(n=t.next());)"("===i&&"*"===n&&e.commentLevel++,"*"===i&&")"===n&&e.commentLevel--,i=n;return e.commentLevel<=0&&(e.tokenize=ym),"comment"}const km={name:"mathematica",extendVariables:function(t){},startState:function(){return{tokenize:ym,commentLevel:0,localVars:{}}},token:function(t,e){return t.eatSpace()?null:e.tokenize(t,e)},languageData:{commentTokens:{block:{open:"(*",close:"*)"}}}};let Qm={of:t=>[Gl.define(km),Yd({override:[async e=>function(t,e){let i=t.matchBefore(/\w*/);return i.from!==i.to||t.explicit?{from:i.from,options:e.data}:null}(e,t)]}),Ys.of([{key:"Escape",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((t=>{let{from:e,to:i}=t;return{changes:{from:e,to:i,insert:"EC"},range:A.cursor(e+2)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])],reBuild:t=>{wm=t.map((t=>t.label))}};const $m=(t,e,i,n)=>{if(0==t.length)return;const s=(new Date).valueOf();let r=0;i.dom.loadingMark=!0;const o=i.dom.style.background;let a=0;console.log("Start animation");const l=setInterval((()=>{i.dom.style.setProperty("background","hsl("+a+"deg 100% 97%)","important"),a+=2,a>360&&(a=0)}),30);n.transaction(e,i,s,t.length);for(const a of t)Pm(a,((a,h)=>{n.file(e,i,s,a,h),r++,r>=t.length&&i.dom&&i.dom.loadingMark&&(i.dom.loadingMark=!1,setTimeout((()=>{i.dom.style.background=o,clearInterval(l),console.log("Stop animation")}),2e3))}),(()=>{console.warn("Fauilure");const t=i.dom.style.background;i.dom.style.background="rgb(255 189 189 / 97%)";let e=97;const n=setInterval((()=>{i.dom.style.background="rgb(255 189 189 / "+Math.round(e)+"%)",e*=.95}),30);clearInterval(l),setTimeout((()=>{clearInterval(n),i.dom.style.background=t}),3e3)}))};function Pm(t,e,i){const n=new FileReader;n.addEventListener("load",(n=>{const s=n.target.result;if(s.byteLength/1024/1024>100)return alert("Files > 100Mb are not supported for drag and drop"),void i();let r=base64ArrayBuffer(s);e(t.name,r)})),n.addEventListener("progress",(t=>{if(t.loaded&&t.total){const e=t.loaded/t.total*100;console.log(e)}})),n.readAsArrayBuffer(t)}const Cm=(t,e)=>Ts.domEventHandlers({drop(e,i){e.preventDefault();const n=[];e.dataTransfer.items?[...e.dataTransfer.items].forEach(((t,e)=>{if("file"===t.kind){const i=t.getAsFile();console.log(`… file[${e}].name = ${i.name}`),n.push(i)}})):[...e.dataTransfer.files].forEach(((t,e)=>{console.log(`… file[${e}].name = ${t.name}`),n.push(t)})),$m(n,e,i,t)},paste(t,i){let n=t.clipboardData||window.clipboardData;for(const s of n.items)if("string"===s.kind)switch(s.type){case"text/plain":break;case"image/png":t.preventDefault(),$m([s.getAsFile()],t,i,e)}else t.preventDefault(),$m([s.getAsFile()],t,i,e)}}),_m=new pr({regexp:/\\\[(\w+)\]/g,decoration:t=>ni.replace({widget:new Zm(t[1])})}),Xm=_i.fromClass(class{constructor(t){this.Greekholder=_m.createDeco(t)}update(t){this.Greekholder=_m.updateDeco(t,this.Greekholder)}},{decorations:t=>t.Greekholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Greekholder||ni.none))});class Zm extends ei{constructor(t){super(),this.name=t}eq(t){return this.name===t.name}toDOM(){let t=document.createElement("span");return t.innerHTML="&"+this.name.toLowerCase().replace("sqrt","radic").replace("undirectededge","harr").replace("directededge","rarr").replace(/capital(.*)/,((t,e)=>e.charAt(0).toUpperCase()+e.slice(1))).replace(/curly(.*)/,((t,e)=>e)).replace(/script(.*)/,((t,e)=>"el"+e.toLowerCase())).replace("transpose","#7488").replace("degree","deg")+";",t}ignoreEvent(){return!1}}const Am=new pr({regexp:/(->|<-)/g,decoration:t=>ni.replace({widget:new Tm(t[1])})});_i.fromClass(class{constructor(t){this.Arrowholder=Am.createDeco(t)}update(t){this.Arrowholder=Am.updateDeco(t,this.Arrowholder)}},{decorations:t=>t.Arrowholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Arrowholder||ni.none))});class Tm extends ei{constructor(t){super(),this.dir=t}eq(t){return this.dir===t.dir}toDOM(){let t=document.createElement("span");return"->"===this.dir?t.innerText="→":t.innerText="←",t}ignoreEvent(){return!1}}function Rm(t){if(!(t=t||{}).open)throw new Error('Balanced: please provide a "open" property');if(!t.close)throw new Error('Balanced: please provide a "close" property');if(this.balance=t.balance||!1,this.exceptions=t.exceptions||!1,this.caseInsensitive=t.caseInsensitive,this.head=t.head||t.open,this.head=Array.isArray(this.head)?this.head:[this.head],this.open=Array.isArray(t.open)?t.open:[t.open],this.close=Array.isArray(t.close)?t.close:[t.close],!Array.isArray(this.head)||!Array.isArray(this.open)||!Array.isArray(this.close)||this.head.length!==this.open.length||this.open.length!==this.close.length)throw new Error('Balanced: if you use arrays for a "head,open,close" you must use matching arrays for all options');var e=Dm(this.head.map(this.regExpFromArrayGroupedMap,this)),i=Dm(this.open.map(this.regExpFromArrayGroupedMap,this)),n=Dm(this.close.map(this.regExpFromArrayGroupedMap,this));this.regExp=Dm([e,i,n],"g"+(this.caseInsensitive?"i":"")),this.regExpGroupLength=this.head.length}function Em(t,e,i){for(var n=Mm(e.substr(0,i+1),/^.*\n?$/gim),s=Mm(e,/^.*\n?$/gim),r=n.length-1,o=i+1-(n.length?n[n.length-1].index:0),a="",l=2;l>=0;l--)r-l>=0&&s[r-l]&&(a+=e.substr(s[r-l].index,s[r-l].length)+"\n");for(l=0;l=0&&s[r+l]&&(a+=e.substr(s[r+l].index,s[r+l].length)+"\n");a=a.replace(/\t/g," ").replace(/\n$/,"");var h=new Error(t+" at "+(r+1)+":"+o+"\n\n"+a);return h.line=r+1,h.column=o,h.index=i,h}function Vm(t,e){return t>=e.index&&t<=e.index+e.length-1}function Mm(t,e){var i,n=new RegExp(e),s=[];if(t)for(;i=n.exec(t);)s.push({index:i.index,length:i[0].length,match:i[0]}),i[0].length||n.lastIndex++;return s}function Dm(t,e,i){var n=t.map((function(t){return t instanceof RegExp?t.source:function(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}(t)}),this).join("|");return n=i?"("+n+")":"(?:"+n+")",new RegExp(n,e||void 0)}Rm.prototype={regExpFromArrayGroupedMap:function(t){return Dm([t],null,!0)},matchContentsInBetweenBrackets:function(t,e){for(var i,n=new RegExp(this.regExp),s=[],r=[],o=null,a=!0;i=n.exec(t);){if(e){for(var l=!1,h=0;h{const i=((t,e,i)=>{var n,s=new RegExp(t),r=[];if(e)for(;n=s.exec(e);){if(i){for(var o=!1,a=0;a{new qm({open:"(*"+t+"[*)",close:"(*]"+t+"*)",balance:!1}).matchContentsInBetweenBrackets(e.value,[]).forEach((function(t){const s=e.value.slice(t.index+t.head.length,t.index+t.length-t.tail.length);n(i+t.index,{length:t.length,pos:i+t.index,argsPos:i+t.index+t.head.length,str:s})}))})(e,t,i,s)},o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)r(o,a)}var Im,Bm=function(){function t(t){var e=t.tag,i=t.decoration,n=t.decorate,s=t.boundary,r=t.maxLength,o=void 0===r?1e3:r;if(this.tag=e,n)this.addMatch=function(t,e,i,s){return n(s,i,i+t.length,t,e)};else if("function"==typeof i)this.addMatch=function(t,e,n,s){var r=i(t,e,n);r&&s(n,n+t.length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=function(t,e,n,s){return s(n,n+t.length,i)}}this.boundary=s,this.maxLength=o}return t.prototype.createDeco=function(t){for(var e=this,i=new Xt,n=i.add.bind(i),s=0,r=function(t,e){var i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;for(var n=[],s=0,r=i;s=a?n[n.length-1].to=l:n.push({from:a,to:l})}return n}(t,this.maxLength);st.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e},t.prototype.updateRange=function(t,e,i,n){for(var s=this,r=function(r){var a=Math.max(r.from,i),l=Math.min(r.to,n);if(l>a){var h=t.state.doc.lineAt(a),c=h.toh.from;a--)if(o.boundary.test(h.text[a-1-h.from])){u=a;break}for(;ld},add:f})}},o=this,a=0,l=t.visibleRanges;a{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*FB[*)((_)(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*FB[*)(("+s+")(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let Nm=class{constructor(t,e,i,n,s,r){this.view=e,this.visibleValue=t,this.placeholder=r,console.log(r),this.args=Lm(t.str,/\(\*,\*\)/gm);const o=this;let a,l;console.log("creating InstanceWidget"),a=Im({doc:o.args[0].body.slice(2,-1),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(o.visibleValue.pos),e.dispatch({selection:{anchor:o.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return l.dispatch({selection:{anchor:0}}),l.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){l.focus(),t.editorLastCursor=void 0}}])]}),l=Im({doc:o.args[2].body.slice(1,-2),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:a.state.doc.length}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:o.visibleValue.pos+o.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus(),t.editorLastCursor=void 0}}])]}),o.args[0].length=o.args[0].body.length,o.args[2].length=o.args[2].body.length,delete o.args[2].body,delete o.args[1].body,delete o.args[0].body,this.topEditor=a,this.bottomEditor=l}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="(("+t+")",s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length));const r=e.length-i[0].length;i[0].to=i[0].to+r,i[2].from=i[2].from+r,i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e="("+t+"))",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length));const r=e.length-i[2].length;i[2].to=i[2].to+r,i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t,e){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm),console.log("recreating InstanceWidget"),n=Im.state({doc:e.args[0].body.slice(2,-1),update:t=>e.applyChanges(t,0),eval:()=>{i.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(e.visibleValue.pos),i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus(),t.editorLastCursor=void 0}}])]}),s=Im.state({doc:e.args[2].body.slice(1,-2),update:t=>e.applyChanges(t,2),eval:()=>{e.view.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus(),t.editorLastCursor=void 0}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),console.log(e),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.placeholder=e,this.visibleValue.argsPos=t.argsPos}destroy(){this.topEditor.destroy(),this.bottomEditor.destroy()}},Gm=class extends ei{constructor(t,e,i,n){super(),this.view=i,this.visibleValue=t,this.reference=e,this.placeholder=n}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue,this),!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("fraction");const i=document.createElement("table");i.classList.add("container"),e.appendChild(i);const n=document.createElement("tbody");i.appendChild(n);const s=document.createElement("tr"),r=document.createElement("tr");n.appendChild(s),n.appendChild(r);const o=document.createElement("td");o.classList.add("enumenator"),s.appendChild(o);const a=document.createElement("td");r.appendChild(a);const l=this;return e.EditorWidget=new Nm(this.visibleValue,t,o,a,[],this),this.DOMElement=e,this.reference.push({destroy:()=>{l.destroy(e)}}),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const Fm=(t,e,i)=>new Bm({tag:"FB",decoration:n=>ni.replace({widget:new Gm(n,t,e,i)})}),Hm=t=>_i.fromClass(class{constructor(e){this.disposable=[],this.placeholder=Fm(this.disposable,e,this).createDeco(e),t.placeholder=this}update(t){this.placeholder=Fm(this.disposable,t,this).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var Jm;function Km(t){return Jm=t,[nb,Ys.of([{key:"Ctrl-2",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt[_](*]SqB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt["+s+"](*]SqB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let tb=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;this.sliceRanges=n,this.length=t.str.length,console.log("creating InstanceWidget"),this.editor=Jm({doc:t.str.slice(...n),parent:i,update:t=>r.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]})}applyChanges(t){const e=t,i={from:this.visibleValue.argsPos+5,to:this.visibleValue.argsPos+this.length-1,insert:e};console.log(this.visibleValue);const n=e.length+6-this.length;this.length=this.length+n,this.visibleValue.length=this.visibleValue.length+n,this.visibleValue.str="Sqrt["+e+"]",this.view.dispatch({changes:i})}update(t){if(this.visibleValue.str==t.str)this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos;else{console.warn("Out of sync"),this.visibleValue=t;const e=this.sliceRanges,i=this.editor,n=this,s=this.view;this.length=t.str.length;const r=Jm.state({doc:t.str.slice(...e),update:t=>n.applyChanges(t),eval:()=>{s.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos+n.visibleValue.length}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]});i.setState(r)}}destroy(){console.warn("destroy Instance of Widget!"),this.editor.destroy()}},eb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("sqroot");const i=this,n=document.createElement("span");return n.classList.add("radicand"),e.EditorWidget=new tb(this.visibleValue,t,n,[5,-1],[]),e.appendChild(n),this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const ib=(t,e)=>new Bm({tag:"SqB",decoration:i=>ni.replace({widget:new eb(i,t,e)})}),nb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=ib(this.disposable,t).createDeco(t)}update(t){this.placeholder=ib(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var sb;function rb(t){return sb=t,[hb,Ys.of([{key:"Ctrl--",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SbB[*)Subscript[_(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SbB[*)Subscript["+s+"(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let ob=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),console.log(r.visibleValue),o=sb({doc:r.args[0].body.slice(10),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){a.focus()}}])]}),a=sb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Subscript["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),console.log(e.visibleValue),n=sb.state({doc:e.args[0].body.slice(10),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus()}}])]}),s=sb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},ab=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sub");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new ob(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const lb=(t,e)=>new Bm({tag:"SbB",decoration:i=>ni.replace({widget:new ab(i,t,e)})}),hb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=lb(this.disposable,t).createDeco(t)}update(t){this.placeholder=lb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var cb;function ub(t){return cb=t,[Ob,Ys.of([{key:"Ctrl-6",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SpB[*)Power[_(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SpB[*)Power["+s+"(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let db=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),o=cb({doc:r.args[0].body.slice(6),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus()}}])]}),a=cb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Power["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),n=cb.state({doc:e.args[0].body.slice(6),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.bottomEditor.focus()}}])]}),s=cb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},fb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sup");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new db(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}destroy(t){t.EditorWidget.destroy()}};const pb=(t,e)=>new Bm({tag:"SpB",decoration:i=>ni.replace({widget:new fb(i,t,e)})}),Ob=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=pb(this.disposable,t).createDeco(t)}update(t){this.placeholder=pb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var gb={},mb={},bb={},wb={};function vb(t){let e=t.length;for(;--e>=0;)t[e]=0}const yb=256,Sb=286,xb=30,kb=15,Qb=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),$b=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Pb=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Cb=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_b=new Array(576);vb(_b);const Xb=new Array(60);vb(Xb);const Zb=new Array(512);vb(Zb);const Ab=new Array(256);vb(Ab);const Tb=new Array(29);vb(Tb);const Rb=new Array(xb);function Eb(t,e,i,n,s){this.static_tree=t,this.extra_bits=e,this.extra_base=i,this.elems=n,this.max_length=s,this.has_stree=t&&t.length}let Vb,Mb,Db;function Wb(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}vb(Rb);const Ub=t=>t<256?Zb[t]:Zb[256+(t>>>7)],Yb=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},qb=(t,e,i)=>{t.bi_valid>16-i?(t.bi_buf|=e<>16-t.bi_valid,t.bi_valid+=i-16):(t.bi_buf|=e<{qb(t,i[2*e],i[2*e+1])},zb=(t,e)=>{let i=0;do{i|=1&t,t>>>=1,i<<=1}while(--e>0);return i>>>1},Ib=(t,e,i)=>{const n=new Array(16);let s,r,o=0;for(s=1;s<=kb;s++)o=o+i[s-1]<<1,n[s]=o;for(r=0;r<=e;r++){let e=t[2*r+1];0!==e&&(t[2*r]=zb(n[e]++,e))}},Bb=t=>{let e;for(e=0;e{t.bi_valid>8?Yb(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},Nb=(t,e,i,n)=>{const s=2*e,r=2*i;return t[s]{const n=t.heap[i];let s=i<<1;for(;s<=t.heap_len&&(s{let n,s,r,o,a=0;if(0!==t.sym_next)do{n=255&t.pending_buf[t.sym_buf+a++],n+=(255&t.pending_buf[t.sym_buf+a++])<<8,s=t.pending_buf[t.sym_buf+a++],0===n?Lb(t,s,e):(r=Ab[s],Lb(t,r+yb+1,e),o=Qb[r],0!==o&&(s-=Tb[r],qb(t,s,o)),n--,r=Ub(n),Lb(t,r,i),o=$b[r],0!==o&&(n-=Rb[r],qb(t,n,o)))}while(a{const i=e.dyn_tree,n=e.stat_desc.static_tree,s=e.stat_desc.has_stree,r=e.stat_desc.elems;let o,a,l,h=-1;for(t.heap_len=0,t.heap_max=573,o=0;o>1;o>=1;o--)Gb(t,i,o);l=r;do{o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Gb(t,i,1),a=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=a,i[2*l]=i[2*o]+i[2*a],t.depth[l]=(t.depth[o]>=t.depth[a]?t.depth[o]:t.depth[a])+1,i[2*o+1]=i[2*a+1]=l,t.heap[1]=l++,Gb(t,i,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const i=e.dyn_tree,n=e.max_code,s=e.stat_desc.static_tree,r=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,l=e.stat_desc.max_length;let h,c,u,d,f,p,O=0;for(d=0;d<=kb;d++)t.bl_count[d]=0;for(i[2*t.heap[t.heap_max]+1]=0,h=t.heap_max+1;h<573;h++)c=t.heap[h],d=i[2*i[2*c+1]+1]+1,d>l&&(d=l,O++),i[2*c+1]=d,c>n||(t.bl_count[d]++,f=0,c>=a&&(f=o[c-a]),p=i[2*c],t.opt_len+=p*(d+f),r&&(t.static_len+=p*(s[2*c+1]+f)));if(0!==O){do{for(d=l-1;0===t.bl_count[d];)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[l]--,O-=2}while(O>0);for(d=l;0!==d;d--)for(c=t.bl_count[d];0!==c;)u=t.heap[--h],u>n||(i[2*u+1]!==d&&(t.opt_len+=(d-i[2*u+1])*i[2*u],i[2*u+1]=d),c--)}})(t,e),Ib(i,h,t.bl_count)},Jb=(t,e,i)=>{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),e[2*(i+1)+1]=65535,n=0;n<=i;n++)s=o,o=e[2*(n+1)+1],++a{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),n=0;n<=i;n++)if(s=o,o=e[2*(n+1)+1],!(++a{qb(t,0+(n?1:0),3),jb(t),Yb(t,i),Yb(t,~i),i&&t.pending_buf.set(t.window.subarray(e,e+i),t.pending),t.pending+=i};wb._tr_init=t=>{tw||((()=>{let t,e,i,n,s;const r=new Array(16);for(i=0,n=0;n<28;n++)for(Tb[n]=i,t=0;t<1<>=7;n{let s,r,o=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e{let e;for(Jb(t,t.dyn_ltree,t.l_desc.max_code),Jb(t,t.dyn_dtree,t.d_desc.max_code),Hb(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*Cb[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=i+5,i+4<=s&&-1!==e?ew(t,e,i,n):4===t.strategy||r===s?(qb(t,2+(n?1:0),3),Fb(t,_b,Xb)):(qb(t,4+(n?1:0),3),((t,e,i,n)=>{let s;for(qb(t,e-257,5),qb(t,i-1,5),qb(t,n-4,4),s=0;s(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=i,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(Ab[i]+yb+1)]++,t.dyn_dtree[2*Ub(e)]++),t.sym_next===t.sym_end),wb._tr_align=t=>{qb(t,2,3),Lb(t,256,_b),(t=>{16===t.bi_valid?(Yb(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)};var iw=(t,e,i,n)=>{let s=65535&t|0,r=t>>>16&65535|0,o=0;for(;0!==i;){o=i>2e3?2e3:i,i-=o;do{s=s+e[n++]|0,r=r+s|0}while(--o);s%=65521,r%=65521}return s|r<<16|0};const nw=new Uint32Array((()=>{let t,e=[];for(var i=0;i<256;i++){t=i;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e})());var sw=(t,e,i,n)=>{const s=nw,r=n+i;t^=-1;for(let i=n;i>>8^s[255&(t^e[i])];return-1^t},rw={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},ow={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:aw,_tr_stored_block:lw,_tr_flush_block:hw,_tr_tally:cw,_tr_align:uw}=wb,dw=iw,fw=sw,pw=rw,{Z_NO_FLUSH:Ow,Z_PARTIAL_FLUSH:gw,Z_FULL_FLUSH:mw,Z_FINISH:bw,Z_BLOCK:ww,Z_OK:vw,Z_STREAM_END:yw,Z_STREAM_ERROR:Sw,Z_DATA_ERROR:xw,Z_BUF_ERROR:kw,Z_DEFAULT_COMPRESSION:Qw,Z_FILTERED:$w,Z_HUFFMAN_ONLY:Pw,Z_RLE:Cw,Z_FIXED:_w,Z_DEFAULT_STRATEGY:Xw,Z_UNKNOWN:Zw,Z_DEFLATED:Aw}=ow,Tw=258,Rw=262,Ew=42,Vw=113,Mw=666,Dw=(t,e)=>(t.msg=pw[e],e),Ww=t=>2*t-(t>4?9:0),Uw=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Yw=t=>{let e,i,n,s=t.w_size;e=t.hash_size,n=e;do{i=t.head[--n],t.head[n]=i>=s?i-s:0}while(--e);e=s,n=e;do{i=t.prev[--n],t.prev[n]=i>=s?i-s:0}while(--e)};let qw=(t,e,i)=>(e<{const e=t.state;let i=e.pending;i>t.avail_out&&(i=t.avail_out),0!==i&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+i),t.next_out),t.next_out+=i,e.pending_out+=i,t.total_out+=i,t.avail_out-=i,e.pending-=i,0===e.pending&&(e.pending_out=0))},zw=(t,e)=>{hw(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Lw(t.strm)},Iw=(t,e)=>{t.pending_buf[t.pending++]=e},Bw=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},jw=(t,e,i,n)=>{let s=t.avail_in;return s>n&&(s=n),0===s?0:(t.avail_in-=s,e.set(t.input.subarray(t.next_in,t.next_in+s),i),1===t.state.wrap?t.adler=dw(t.adler,e,s,i):2===t.state.wrap&&(t.adler=fw(t.adler,e,s,i)),t.next_in+=s,t.total_in+=s,s)},Nw=(t,e)=>{let i,n,s=t.max_chain_length,r=t.strstart,o=t.prev_length,a=t.nice_match;const l=t.strstart>t.w_size-Rw?t.strstart-(t.w_size-Rw):0,h=t.window,c=t.w_mask,u=t.prev,d=t.strstart+Tw;let f=h[r+o-1],p=h[r+o];t.prev_length>=t.good_match&&(s>>=2),a>t.lookahead&&(a=t.lookahead);do{if(i=e,h[i+o]===p&&h[i+o-1]===f&&h[i]===h[r]&&h[++i]===h[r+1]){r+=2,i++;do{}while(h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&ro){if(t.match_start=e,o=n,n>=a)break;f=h[r+o-1],p=h[r+o]}}}while((e=u[e&c])>l&&0!=--s);return o<=t.lookahead?o:t.lookahead},Gw=t=>{const e=t.w_size;let i,n,s;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Rw)&&(t.window.set(t.window.subarray(e,e+e-n),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Yw(t),n+=e),0===t.strm.avail_in)break;if(i=jw(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=i,t.lookahead+t.insert>=3)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=qw(t,t.ins_h,t.window[s+1]);t.insert&&(t.ins_h=qw(t,t.ins_h,t.window[s+3-1]),t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead{let i,n,s,r=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,o=0,a=t.strm.avail_in;do{if(i=65535,s=t.bi_valid+42>>3,t.strm.avail_outn+t.strm.avail_in&&(i=n+t.strm.avail_in),i>s&&(i=s),i>8,t.pending_buf[t.pending-2]=~i,t.pending_buf[t.pending-1]=~i>>8,Lw(t.strm),n&&(n>i&&(n=i),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+n),t.strm.next_out),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n,t.block_start+=n,i-=n),i&&(jw(t.strm,t.strm.output,t.strm.next_out,i),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i)}while(0===o);return a-=t.strm.avail_in,a&&(a>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=a&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-a,t.strm.next_in),t.strstart),t.strstart+=a,t.insert+=a>t.w_size-t.insert?t.w_size-t.insert:a),t.block_start=t.strstart),t.high_waters&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,s+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),s>t.strm.avail_in&&(s=t.strm.avail_in),s&&(jw(t.strm,t.window,t.strstart,s),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.high_water>3,s=t.pending_buf_size-s>65535?65535:t.pending_buf_size-s,r=s>t.w_size?t.w_size:s,n=t.strstart-t.block_start,(n>=r||(n||e===bw)&&e!==Ow&&0===t.strm.avail_in&&n<=s)&&(i=n>s?s:n,o=e===bw&&0===t.strm.avail_in&&i===n?1:0,lw(t,t.block_start,i,o),t.block_start+=i,Lw(t.strm)),o?3:1)},Hw=(t,e)=>{let i,n;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==i&&t.strstart-i<=t.w_size-Rw&&(t.match_length=Nw(t,i)),t.match_length>=3)if(n=cw(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=qw(t,t.ins_h,t.window[t.strstart+1]);else n=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2},Jw=(t,e)=>{let i,n,s;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==i&&t.prev_length4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){s=t.strstart+t.lookahead-3,n=cw(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=s&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(zw(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(n=cw(t,0,t.window[t.strstart-1]),n&&zw(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=cw(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2};function Kw(t,e,i,n,s){this.good_length=t,this.max_lazy=e,this.nice_length=i,this.max_chain=n,this.func=s}const tv=[new Kw(0,0,0,0,Fw),new Kw(4,4,8,4,Hw),new Kw(4,5,16,8,Hw),new Kw(4,6,32,32,Hw),new Kw(4,4,16,16,Jw),new Kw(8,16,32,32,Jw),new Kw(8,16,128,128,Jw),new Kw(8,32,128,256,Jw),new Kw(32,128,258,1024,Jw),new Kw(32,258,258,4096,Jw)];function ev(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Aw,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Uw(this.dyn_ltree),Uw(this.dyn_dtree),Uw(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Uw(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Uw(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const iv=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==Ew&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==Vw&&e.status!==Mw?1:0},nv=t=>{if(iv(t))return Dw(t,Sw);t.total_in=t.total_out=0,t.data_type=Zw;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?Ew:Vw,t.adler=2===e.wrap?0:1,e.last_flush=-2,aw(e),vw},sv=t=>{const e=nv(t);var i;return e===vw&&((i=t.state).window_size=2*i.w_size,Uw(i.head),i.max_lazy_match=tv[i.level].max_lazy,i.good_match=tv[i.level].good_length,i.nice_match=tv[i.level].nice_length,i.max_chain_length=tv[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=2,i.match_available=0,i.ins_h=0),e},rv=(t,e,i,n,s,r)=>{if(!t)return Sw;let o=1;if(e===Qw&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),s<1||s>9||i!==Aw||n<8||n>15||e<0||e>9||r<0||r>_w||8===n&&1!==o)return Dw(t,Sw);8===n&&(n=9);const a=new ev;return t.state=a,a.strm=t,a.status=Ew,a.wrap=o,a.gzhead=null,a.w_bits=n,a.w_size=1<rv(t,e,Aw,15,8,Xw),bb.deflateInit2=rv,bb.deflateReset=sv,bb.deflateResetKeep=nv,bb.deflateSetHeader=(t,e)=>iv(t)||2!==t.state.wrap?Sw:(t.state.gzhead=e,vw),bb.deflate=(t,e)=>{if(iv(t)||e>ww||e<0)return t?Dw(t,Sw):Sw;const i=t.state;if(!t.output||0!==t.avail_in&&!t.input||i.status===Mw&&e!==bw)return Dw(t,0===t.avail_out?kw:Sw);const n=i.last_flush;if(i.last_flush=e,0!==i.pending){if(Lw(t),0===t.avail_out)return i.last_flush=-1,vw}else if(0===t.avail_in&&Ww(e)<=Ww(n)&&e!==bw)return Dw(t,kw);if(i.status===Mw&&0!==t.avail_in)return Dw(t,kw);if(i.status===Ew&&0===i.wrap&&(i.status=Vw),i.status===Ew){let e=Aw+(i.w_bits-8<<4)<<8,n=-1;if(n=i.strategy>=Pw||i.level<2?0:i.level<6?1:6===i.level?2:3,e|=n<<6,0!==i.strstart&&(e|=32),e+=31-e%31,Bw(i,e),0!==i.strstart&&(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),t.adler=1,i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(57===i.status)if(t.adler=0,Iw(i,31),Iw(i,139),Iw(i,8),i.gzhead)Iw(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),Iw(i,255&i.gzhead.time),Iw(i,i.gzhead.time>>8&255),Iw(i,i.gzhead.time>>16&255),Iw(i,i.gzhead.time>>24&255),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(Iw(i,255&i.gzhead.extra.length),Iw(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=fw(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if(Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,3),i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw;if(69===i.status){if(i.gzhead.extra){let e=i.pending,n=(65535&i.gzhead.extra.length)-i.gzindex;for(;i.pending+n>i.pending_buf_size;){let s=i.pending_buf_size-i.pending;if(i.pending_buf.set(i.gzhead.extra.subarray(i.gzindex,i.gzindex+s),i.pending),i.pending=i.pending_buf_size,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex+=s,Lw(t),0!==i.pending)return i.last_flush=-1,vw;e=0,n-=s}let s=new Uint8Array(i.gzhead.extra);i.pending_buf.set(s.subarray(i.gzindex,i.gzindex+n),i.pending),i.pending+=n,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex=0}i.status=73}if(73===i.status){if(i.gzhead.name){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),i.gzindex=0}i.status=91}if(91===i.status){if(i.gzhead.comment){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n))}i.status=103}if(103===i.status){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size&&(Lw(t),0!==i.pending))return i.last_flush=-1,vw;Iw(i,255&t.adler),Iw(i,t.adler>>8&255),t.adler=0}if(i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(0!==t.avail_in||0!==i.lookahead||e!==Ow&&i.status!==Mw){let n=0===i.level?Fw(i,e):i.strategy===Pw?((t,e)=>{let i;for(;;){if(0===t.lookahead&&(Gw(t),0===t.lookahead)){if(e===Ow)return 1;break}if(t.match_length=0,i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):i.strategy===Cw?((t,e)=>{let i,n,s,r;const o=t.window;for(;;){if(t.lookahead<=Tw){if(Gw(t),t.lookahead<=Tw&&e===Ow)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(s=t.strstart-1,n=o[s],n===o[++s]&&n===o[++s]&&n===o[++s])){r=t.strstart+Tw;do{}while(n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&st.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(i=cw(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):tv[i.level].func(i,e);if(3!==n&&4!==n||(i.status=Mw),1===n||3===n)return 0===t.avail_out&&(i.last_flush=-1),vw;if(2===n&&(e===gw?uw(i):e!==ww&&(lw(i,0,0,!1),e===mw&&(Uw(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),Lw(t),0===t.avail_out))return i.last_flush=-1,vw}return e!==bw?vw:i.wrap<=0?yw:(2===i.wrap?(Iw(i,255&t.adler),Iw(i,t.adler>>8&255),Iw(i,t.adler>>16&255),Iw(i,t.adler>>24&255),Iw(i,255&t.total_in),Iw(i,t.total_in>>8&255),Iw(i,t.total_in>>16&255),Iw(i,t.total_in>>24&255)):(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),Lw(t),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?vw:yw)},bb.deflateEnd=t=>{if(iv(t))return Sw;const e=t.state.status;return t.state=null,e===Vw?Dw(t,xw):vw},bb.deflateSetDictionary=(t,e)=>{let i=e.length;if(iv(t))return Sw;const n=t.state,s=n.wrap;if(2===s||1===s&&n.status!==Ew||n.lookahead)return Sw;if(1===s&&(t.adler=dw(t.adler,e,i,0)),n.wrap=0,i>=n.w_size){0===s&&(Uw(n.head),n.strstart=0,n.block_start=0,n.insert=0);let t=new Uint8Array(n.w_size);t.set(e.subarray(i-n.w_size,i),0),e=t,i=n.w_size}const r=t.avail_in,o=t.next_in,a=t.input;for(t.avail_in=i,t.next_in=0,t.input=e,Gw(n);n.lookahead>=3;){let t=n.strstart,e=n.lookahead-2;do{n.ins_h=qw(n,n.ins_h,n.window[t+3-1]),n.prev[t&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=t,t++}while(--e);n.strstart=t,n.lookahead=2,Gw(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,t.next_in=o,t.input=a,t.avail_in=r,n.wrap=s,vw},bb.deflateInfo="pako deflate (from Nodeca project)";var ov={};const av=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);ov.assign=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const e in i)av(i,e)&&(t[e]=i[e])}}return t},ov.flattenChunks=t=>{let e=0;for(let i=0,n=t.length;i=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;cv[254]=cv[254]=1,lv.string2buf=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,i,n,s,r,o=t.length,a=0;for(s=0;s>>6,e[r++]=128|63&i):i<65536?(e[r++]=224|i>>>12,e[r++]=128|i>>>6&63,e[r++]=128|63&i):(e[r++]=240|i>>>18,e[r++]=128|i>>>12&63,e[r++]=128|i>>>6&63,e[r++]=128|63&i);return e};lv.buf2string=(t,e)=>{const i=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let n,s;const r=new Array(2*i);for(s=0,n=0;n4)r[s++]=65533,n+=o-1;else{for(e&=2===o?31:3===o?15:7;o>1&&n1?r[s++]=65533:e<65536?r[s++]=e:(e-=65536,r[s++]=55296|e>>10&1023,r[s++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&hv)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let i="";for(let n=0;n{(e=e||t.length)>t.length&&(e=t.length);let i=e-1;for(;i>=0&&128==(192&t[i]);)i--;return i<0||0===i?e:i+cv[t[i]]>e?i:e};var uv=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const dv=bb,fv=ov,pv=lv,Ov=rw,gv=uv,mv=Object.prototype.toString,{Z_NO_FLUSH:bv,Z_SYNC_FLUSH:wv,Z_FULL_FLUSH:vv,Z_FINISH:yv,Z_OK:Sv,Z_STREAM_END:xv,Z_DEFAULT_COMPRESSION:kv,Z_DEFAULT_STRATEGY:Qv,Z_DEFLATED:$v}=ow;function Pv(t){this.options=fv.assign({level:kv,method:$v,chunkSize:16384,windowBits:15,memLevel:8,strategy:Qv},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new gv,this.strm.avail_out=0;let i=dv.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(i!==Sv)throw new Error(Ov[i]);if(e.header&&dv.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?pv.string2buf(e.dictionary):"[object ArrayBuffer]"===mv.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,i=dv.deflateSetDictionary(this.strm,t),i!==Sv)throw new Error(Ov[i]);this._dict_set=!0}}function Cv(t,e){const i=new Pv(e);if(i.push(t,!0),i.err)throw i.msg||Ov[i.err];return i.result}Pv.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize;let s,r;if(this.ended)return!1;for(r=e===~~e?e:!0===e?yv:bv,"string"==typeof t?i.input=pv.string2buf(t):"[object ArrayBuffer]"===mv.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),(r===wv||r===vv)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(s=dv.deflate(i,r),s===xv)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),s=dv.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===Sv;if(0!==i.avail_out){if(r>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},Pv.prototype.onData=function(t){this.chunks.push(t)},Pv.prototype.onEnd=function(t){t===Sv&&(this.result=fv.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},mb.Deflate=Pv,mb.deflate=Cv,mb.deflateRaw=function(t,e){return(e=e||{}).raw=!0,Cv(t,e)},mb.gzip=function(t,e){return(e=e||{}).gzip=!0,Cv(t,e)},mb.constants=ow;var _v={},Xv={};const Zv=16209;const Av=15,Tv=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Rv=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Ev=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Vv=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Mv=(t,e,i,n,s,r,o,a)=>{const l=a.bits;let h,c,u,d,f,p,O=0,g=0,m=0,b=0,w=0,v=0,y=0,S=0,x=0,k=0,Q=null;const $=new Uint16Array(16),P=new Uint16Array(16);let C,_,X,Z=null;for(O=0;O<=Av;O++)$[O]=0;for(g=0;g=1&&0===$[b];b--);if(w>b&&(w=b),0===b)return s[r++]=20971520,s[r++]=20971520,a.bits=1,0;for(m=1;m0&&(0===t||1!==b))return-1;for(P[1]=0,O=1;O852||2===t&&x>592)return 1;for(;;){C=O-y,o[g]+1=p?(_=Z[o[g]-p],X=Q[o[g]-p]):(_=96,X=0),h=1<>y)+c]=C<<24|_<<16|X|0}while(0!==c);for(h=1<>=1;if(0!==h?(k&=h-1,k+=h):k=0,g++,0==--$[O]){if(O===b)break;O=e[i+o[g]]}if(O>w&&(k&d)!==u){for(0===y&&(y=w),f+=m,v=O-y,S=1<852||2===t&&x>592)return 1;u=k&d,s[u]=w<<24|v<<16|f-r|0}}return 0!==k&&(s[f+k]=O-y<<24|64<<16|0),a.bits=w,0};const Dv=iw,Wv=sw,Uv=function(t,e){let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,y,S,x,k,Q;const $=t.state;i=t.next_in,k=t.input,n=i+(t.avail_in-5),s=t.next_out,Q=t.output,r=s-(e-t.avail_out),o=s+(t.avail_out-257),a=$.dmax,l=$.wsize,h=$.whave,c=$.wnext,u=$.window,d=$.hold,f=$.bits,p=$.lencode,O=$.distcode,g=(1<<$.lenbits)-1,m=(1<<$.distbits)-1;t:do{f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,0===w)Q[s++]=65535&b;else{if(!(16&w)){if(0==(64&w)){b=p[(65535&b)+(d&(1<>>=w,f-=w),f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,!(16&w)){if(0==(64&w)){b=O[(65535&b)+(d&(1<a){t.msg="invalid distance too far back",$.mode=Zv;break t}if(d>>>=w,f-=w,w=s-r,y>w){if(w=y-w,w>h&&$.sane){t.msg="invalid distance too far back",$.mode=Zv;break t}if(S=0,x=u,0===c){if(S+=l-w,w2;)Q[s++]=x[S++],Q[s++]=x[S++],Q[s++]=x[S++],v-=3;v&&(Q[s++]=x[S++],v>1&&(Q[s++]=x[S++]))}else{S=s-y;do{Q[s++]=Q[S++],Q[s++]=Q[S++],Q[s++]=Q[S++],v-=3}while(v>2);v&&(Q[s++]=Q[S++],v>1&&(Q[s++]=Q[S++]))}break}}break}}while(i>3,i-=v,f-=v<<3,d&=(1<(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function hy(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const cy=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode16211?1:0},uy=t=>{if(cy(t))return Nv;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Kv,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,Iv},dy=t=>{if(cy(t))return Nv;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,uy(t)},fy=(t,e)=>{let i;if(cy(t))return Nv;const n=t.state;return e<0?(i=0,e=-e):(i=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?Nv:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=i,n.wbits=e,dy(t))},py=(t,e)=>{if(!t)return Nv;const i=new hy;t.state=i,i.strm=t,i.window=null,i.mode=Kv;const n=fy(t,e);return n!==Iv&&(t.state=null),n};let Oy,gy,my=!0;const by=t=>{if(my){Oy=new Int32Array(512),gy=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Yv(1,t.lens,0,288,Oy,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Yv(2,t.lens,0,32,gy,0,t.work,{bits:5}),my=!1}t.lencode=Oy,t.lenbits=9,t.distcode=gy,t.distbits=5},wy=(t,e,i,n)=>{let s;const r=t.state;return null===r.window&&(r.wsize=1<=r.wsize?(r.window.set(e.subarray(i-r.wsize,i),0),r.wnext=0,r.whave=r.wsize):(s=r.wsize-r.wnext,s>n&&(s=n),r.window.set(e.subarray(i-n,i-n+s),r.wnext),(n-=s)?(r.window.set(e.subarray(i-n,i),0),r.wnext=n,r.whave=r.wsize):(r.wnext+=s,r.wnext===r.wsize&&(r.wnext=0),r.whavepy(t,15),Xv.inflateInit2=py,Xv.inflate=(t,e)=>{let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,y,S,x,k=0;const Q=new Uint8Array(4);let $,P;const C=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(cy(t)||!t.output||!t.input&&0!==t.avail_in)return Nv;i=t.state,i.mode===ey&&(i.mode=iy),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,u=a,d=l,x=Iv;t:for(;;)switch(i.mode){case Kv:if(0===i.wrap){i.mode=iy;break}for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0),h=0,c=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",i.mode=ay;break}if((15&h)!==Jv){t.msg="unknown compression method",i.mode=ay;break}if(h>>>=4,c-=4,S=8+(15&h),0===i.wbits&&(i.wbits=S),S>15||S>i.wbits){t.msg="invalid window size",i.mode=ay;break}i.dmax=1<>8&1),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16182;case 16182:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>8&255,Q[2]=h>>>16&255,Q[3]=h>>>24&255,i.check=Wv(i.check,Q,4,0)),h=0,c=0,i.mode=16183;case 16183:for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>8),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16184;case 16184:if(1024&i.flags){for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(f=i.length,f>a&&(f=a),f&&(i.head&&(S=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(n.subarray(r,r+f),S)),512&i.flags&&4&i.wrap&&(i.check=Wv(i.check,n,f,r)),a-=f,r+=f,i.length-=f),i.length))break t;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===a)break t;f=0;do{S=n[r+f++],i.head&&S&&i.length<65536&&(i.head.name+=String.fromCharCode(S))}while(S&&f>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=ey;break;case 16189:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>=7&c,c-=7&c,i.mode=oy;break}for(;c<3;){if(0===a)break t;a--,h+=n[r++]<>>=1,c-=1,3&h){case 0:i.mode=16193;break;case 1:if(by(i),i.mode=sy,e===zv){h>>>=2,c-=2;break t}break;case 2:i.mode=16196;break;case 3:t.msg="invalid block type",i.mode=ay}h>>>=2,c-=2;break;case 16193:for(h>>>=7&c,c-=7&c;c<32;){if(0===a)break t;a--,h+=n[r++]<>>16^65535)){t.msg="invalid stored block lengths",i.mode=ay;break}if(i.length=65535&h,h=0,c=0,i.mode=ny,e===zv)break t;case ny:i.mode=16195;case 16195:if(f=i.length,f){if(f>a&&(f=a),f>l&&(f=l),0===f)break t;s.set(n.subarray(r,r+f),o),a-=f,r+=f,l-=f,o+=f,i.length-=f;break}i.mode=ey;break;case 16196:for(;c<14;){if(0===a)break t;a--,h+=n[r++]<>>=5,c-=5,i.ndist=1+(31&h),h>>>=5,c-=5,i.ncode=4+(15&h),h>>>=4,c-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=ay;break}i.have=0,i.mode=16197;case 16197:for(;i.have>>=3,c-=3}for(;i.have<19;)i.lens[C[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,$={bits:i.lenbits},x=Yv(0,i.lens,0,19,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid code lengths set",i.mode=ay;break}i.have=0,i.mode=16198;case 16198:for(;i.have>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=g,c-=g,i.lens[i.have++]=b;else{if(16===b){for(P=g+2;c>>=g,c-=g,0===i.have){t.msg="invalid bit length repeat",i.mode=ay;break}S=i.lens[i.have-1],f=3+(3&h),h>>>=2,c-=2}else if(17===b){for(P=g+3;c>>=g,c-=g,S=0,f=3+(7&h),h>>>=3,c-=3}else{for(P=g+7;c>>=g,c-=g,S=0,f=11+(127&h),h>>>=7,c-=7}if(i.have+f>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=ay;break}for(;f--;)i.lens[i.have++]=S}}if(i.mode===ay)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=ay;break}if(i.lenbits=9,$={bits:i.lenbits},x=Yv(1,i.lens,0,i.nlen,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid literal/lengths set",i.mode=ay;break}if(i.distbits=6,i.distcode=i.distdyn,$={bits:i.distbits},x=Yv(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,$),i.distbits=$.bits,x){t.msg="invalid distances set",i.mode=ay;break}if(i.mode=sy,e===zv)break t;case sy:i.mode=ry;case ry:if(a>=6&&l>=258){t.next_out=o,t.avail_out=l,t.next_in=r,t.avail_in=a,i.hold=h,i.bits=c,Uv(t,d),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,i.mode===ey&&(i.back=-1);break}for(i.back=0;k=i.lencode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,i.length=b,0===m){i.mode=16205;break}if(32&m){i.back=-1,i.mode=ey;break}if(64&m){t.msg="invalid literal/length code",i.mode=ay;break}i.extra=15&m,i.mode=16201;case 16201:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;k=i.distcode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,64&m){t.msg="invalid distance code",i.mode=ay;break}i.offset=b,i.extra=15&m,i.mode=16203;case 16203:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=ay;break}i.mode=16204;case 16204:if(0===l)break t;if(f=d-l,i.offset>f){if(f=i.offset-f,f>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=ay;break}f>i.wnext?(f-=i.wnext,p=i.wsize-f):p=i.wnext-f,f>i.length&&(f=i.length),O=i.window}else O=s,p=o-i.offset,f=i.length;f>l&&(f=l),l-=f,i.length-=f;do{s[o++]=O[p++]}while(--f);0===i.length&&(i.mode=ry);break;case 16205:if(0===l)break t;s[o++]=i.length,l--,i.mode=ry;break;case oy:if(i.wrap){for(;c<32;){if(0===a)break t;a--,h|=n[r++]<{if(cy(t))return Nv;let e=t.state;return e.window&&(e.window=null),t.state=null,Iv},Xv.inflateGetHeader=(t,e)=>{if(cy(t))return Nv;const i=t.state;return 0==(2&i.wrap)?Nv:(i.head=e,e.done=!1,Iv)},Xv.inflateSetDictionary=(t,e)=>{const i=e.length;let n,s,r;return cy(t)?Nv:(n=t.state,0!==n.wrap&&n.mode!==ty?Nv:n.mode===ty&&(s=1,s=Dv(s,e,i,0),s!==n.check)?Gv:(r=wy(t,e,i,i),r?(n.mode=16210,Fv):(n.havedict=1,Iv)))},Xv.inflateInfo="pako inflate (from Nodeca project)";const vy=Xv,yy=ov,Sy=lv,xy=rw,ky=uv,Qy=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},$y=Object.prototype.toString,{Z_NO_FLUSH:Py,Z_FINISH:Cy,Z_OK:_y,Z_STREAM_END:Xy,Z_NEED_DICT:Zy,Z_STREAM_ERROR:Ay,Z_DATA_ERROR:Ty,Z_MEM_ERROR:Ry}=ow;function Ey(t){this.options=yy.assign({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ky,this.strm.avail_out=0;let i=vy.inflateInit2(this.strm,e.windowBits);if(i!==_y)throw new Error(xy[i]);if(this.header=new Qy,vy.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=Sy.string2buf(e.dictionary):"[object ArrayBuffer]"===$y.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(i=vy.inflateSetDictionary(this.strm,e.dictionary),i!==_y)))throw new Error(xy[i])}function Vy(t,e){const i=new Ey(e);if(i.push(t),i.err)throw i.msg||xy[i.err];return i.result}Ey.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize,s=this.options.dictionary;let r,o,a;if(this.ended)return!1;for(o=e===~~e?e:!0===e?Cy:Py,"[object ArrayBuffer]"===$y.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),r=vy.inflate(i,o),r===Zy&&s&&(r=vy.inflateSetDictionary(i,s),r===_y?r=vy.inflate(i,o):r===Ty&&(r=Zy));i.avail_in>0&&r===Xy&&i.state.wrap>0&&0!==t[i.next_in];)vy.inflateReset(i),r=vy.inflate(i,o);switch(r){case Ay:case Ty:case Zy:case Ry:return this.onEnd(r),this.ended=!0,!1}if(a=i.avail_out,i.next_out&&(0===i.avail_out||r===Xy))if("string"===this.options.to){let t=Sy.utf8border(i.output,i.next_out),e=i.next_out-t,s=Sy.buf2string(i.output,t);i.next_out=e,i.avail_out=n-e,e&&i.output.set(i.output.subarray(t,t+e),0),this.onData(s)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(r!==_y||0!==a){if(r===Xy)return r=vy.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},Ey.prototype.onData=function(t){this.chunks.push(t)},Ey.prototype.onEnd=function(t){t===_y&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=yy.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},_v.Inflate=Ey,_v.inflate=Vy,_v.inflateRaw=function(t,e){return(e=e||{}).raw=!0,Vy(t,e)},_v.ungzip=Vy,_v.constants=ow;const{Deflate:My,deflate:Dy,deflateRaw:Wy,gzip:Uy}=mb,{Inflate:Yy,inflate:qy,inflateRaw:Ly,ungzip:zy}=_v,Iy=ow;gb.Deflate=My,gb.deflate=Dy,gb.deflateRaw=Wy,gb.gzip=Uy,gb.Inflate=Yy,gb.inflate=qy,gb.inflateRaw=Ly,gb.ungzip=zy,gb.constants=Iy;const By=gb;let jy={};var Ny;function Gy(t){return Ny=t,[tS]}jy.Util={},jy.Decode={},jy.Messages=[],jy.Log=function(t){jy.Messages.push(["I",t]),console.log("Mma.js INFO: ",t)},jy.Warn=function(t){jy.Messages.push(["W",t]),console.log("Mma.js WARNING: ",t)},jy.Fail=function(t){throw jy.Messages.push(["E",t]),"Mma.js ERROR: "+t},jy.Util.Base64Decode=function(t){for(var e=atob(t),i=e.length>>>0,n=new Uint8Array(i),s=0;s1&&0===t[0]&&jy.Fail("IntegerAP: input starts with 0: "+String(t)),this.nstring=t}else void 0===t?this.nstring=void 0:jy.Fail("Integer: invalid input: "+String(t))},jy.RealMP=function(t){"number"==typeof t?this.n=t:void 0===t?this.n=void 0:jy.Fail("RealMP: invalid input")},jy.RealAP=function(t){"string"==typeof t?(t.length>1&&0===t[0]&&jy.Fail("RealAP: input starts with 0: "+String(t)),this.nstring=t):void 0===t?this.nstring=void 0:jy.Fail("RealAP: invalid input: "+String(t))},jy.Symbol=function(t){"string"==typeof t?this.name=t:void 0===t?this.name=void 0:jy.Fail("Symbol: invalid input: "+String(t))},jy.String=function(t){"string"==typeof t?this.str=t:void 0===t?this.str=void 0:jy.Fail("String: invalid input: "+String(t))},jy.Expression=function(t,e){t instanceof jy.Symbol||jy.Fail("Expression: head must be an Mma.Symbol"),e instanceof Array||jy.Fail("Expression: parts must be an Array"),this.head=t,this.parts=e},jy.Decode.Int32=function(t,e){try{return new DataView(t.buffer).getInt32(e,!0)}catch(t){return 0}},jy.Decode.Float64=function(t,e){try{return new DataView(t.buffer).getFloat64(e,!0)}catch(t){return 0}},jy.Decode.String=function(t,e,i){return void 0===e&&(e=0),void 0===i&&(i=t.length),jy.Util.U8ArrayToString(t.slice(e,e+i))},jy.Decode.StringEntry=function(t,e){void 0===e&&(e=0);var i=jy.Decode.Int32(t,e);return{length:i,string:jy.Decode.String(t,e+4,i),bytesRead:i+4}},jy.Decode.Any=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=1/0);var n=e;for(var s=0,r=[];ee%2!=0?t:{...t,body:Lm(t.body,/\(\*\|\*\)/gm)})),Array.isArray(this.args[this.args.length-1].body)||(this.decorator=this.args.pop());const r=this.args;console.log("creating InstanceWidget");for(let t=0;t{e.viewState.state.config.eval()},update:e=>this.applyChanges(e,t,i),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to&&!t.stringOnly)return i-2>=0?(o[i-2].editor.dispatch({selection:{anchor:o[i-2].editor.state.doc.length}}),o[i-2].editor.focus(),void(t.editorLastCursor=void 0)):(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0));t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to&&!t.stringOnly)return i+2=0)return r[t-2].body[i].editor.focus(),void(e.editorLastCursor=void 0)}},{key:"ArrowDown",run:function(e,n){if(t+2{},focus:()=>{},dispatch:()=>{},stringOnly:!0};const t=l.match(Fy);if(t){a.innerHTML=t[1];const e=jy.DecompressDecode(t[2]),i=jy.toArray(e.parts[0]),n=uuidv4();interpretate(i,{global:{call:n},element:a})}else a.innerHTML=l.slice(1,-1)}delete o[i].body,n.appendChild(a)}i.appendChild(n)}if(this.decorator){const t=jy.DecompressDecode(this.decorator.body.slice(2,-2)),e=jy.toArray(t.parts[0]);let n={global:{call:uuidv4(),EditorWidget:s},element:i};this.interpretated=interpretate(e,n)}}applyChanges(t,e,i){const n=this.args,s=this.args[e].body,r=this.visibleValue.argsPos,o=this.args[e].from;let a=t;0==i&&0==e&&(a="{{"+a),0==i&&0!=e&&(a="{"+a),i==s.length-1&&e==n.length-1&&(a+="}}"),i==s.length-1&&e!=n.length-1&&(a+="}");const l=s[i].length,h={from:r+o+s[i].from,to:r+o+s[i].from+l,insert:a},c=a.length-l;for(let t=i+1;t{s.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.args[0].body[0].editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.args[0].body[0].editor.focus();else{const t=this.DOMElement.EditorWidget.args,e=t[t.length-1].body[t[t.length-1].body.length-1].editor;e.dispatch({selection:{anchor:e.state.doc.length}}),e.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const Ky=(t,e)=>new Bm({tag:"GB",decoration:i=>ni.replace({widget:new Jy(i,t,e)})}),tS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=Ky(this.disposable,t).createDeco(t)}update(t){this.placeholder=Ky(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});function eS(t){return[rS]}let iS=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.span=i,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this,r=this.args[1].body.slice(3,-3),o=jy.DecompressDecode(r),a=jy.toArray(o.parts[0]);this.data=a;const l="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}));this.cuid=l;let h={call:l,EditorWidget:s},c={global:h,element:i};this.expression=a,this.env=c,this.interpretated=interpretate(a,c),this.interpretated.then((()=>{if(c.options?.Event){console.warn("Event listeners are enabled!"),s.events=c.options.Event;let t=c;if(h.stack){const e=Object.values(h.stack);e.length>0&&(console.log("Attaching first found instance..."),t=e[0].env)}interpretate(["MetaMarker","'"+l+"'"],t).then((()=>{server.kernel.emitt(s.events,'"'+l+'"',"Mounted")}))}}))}getDoc(){return this.args[0].body.slice(1,-1)}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+t+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].length=s.length,this.view.dispatch({changes:r})}applyOuterChanges(t){const e=this.visibleValue,i=t,n={from:e.pos,to:e.pos+e.length,insert:i};this.view.dispatch({changes:n})}update(t){if(!this.deactivated){if(t.str!=this.visibleValue.str){console.warn("Out of sync"),console.log("recreate..."),this.destroy();const e=this.span;return e.replaceChildren(),void this._construct(t,this.view,e)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}}destroy(t){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.events&&server.kernel.emitt(this.events,'"'+this.cuid+'"',"Destroy"),delete this.data}},nS=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=this;let i=document.createElement("span");return i.classList.add("frontend-view"),i.EditorWidget=new iS(this.visibleValue,t,i),this.reference.push({destroy:()=>{e.destroy(i)}}),i}ignoreEvent(){return!0}destroy(t){console.log("destroy in general*"),t.EditorWidget.destroy()}};const sS=(t,e)=>new Bm({tag:"VB",decoration:i=>ni.replace({widget:new nS(i,t,e)})}),rS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=sS(this.disposable,t).createDeco(t)}update(t){this.placeholder=sS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var oS;function aS(t){return oS=t,[uS]}let lS=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.span=i,this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this;this.epilog={offset:0,string:""},this.prolog={offset:0,string:""};const r=this.args[1].body.slice(3,-3),o=jy.DecompressDecode(r),a=jy.toArray(o.parts[0]);this.data=a;let l={global:{call:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)})),element:i,origin:s},element:i};this.env=l,interpretate(a,l).then((()=>{if(l.options?.Head&&(s.prolog.offset=l.options.Head.length+1,s.prolog.string=l.options.Head+"[",s.epilog.offset=1,s.epilog.string="]"),l.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=l.options.Event),l.options?.String){s.prolog.offset=1,s.prolog.string='"',s.epilog.offset=1,s.epilog.string='"',l.options?.HeadString&&(s.prolog.string=l.options.HeadString,s.prolog.offset=s.prolog.string.length),l.options?.TailString&&(s.epilog.string=l.options.TailString,s.epilog.offset=s.epilog.string.length),s.editor={destroy:()=>{console.log("Nothing to destroy, this is just a text field.")}};const t=document.createElement("span");return this.aa,t.onkeydown=function(t){13===t.keyCode&&t.preventDefault()},t.contentEditable="plaintext-only",t.innerText=s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),t.addEventListener("input",console.log),t.addEventListener("input",(()=>{console.log("Update"),console.log(t.innerText),this.applyChanges(t.innerText)})),l.global.element.appendChild(t),void(s.events&&server.kernel.emitt(s.events,"Null","Mounted"))}s.editor=oS({doc:s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),parent:l.global.element,update:t=>this.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos+s.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]}),s.events&&server.kernel.emitt(s.events,"Null","Mounted")}))}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+this.prolog.string+t+this.epilog.string+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length));const o=s.length-i[0].length;i[0].length=s.length,this.visibleValue.length=this.visibleValue.length+o,this.view.dispatch({changes:r})}update(t){if(this.visibleValue.str!=t.str)return console.warn("Out of sync"),console.log("recreating InstanceWidget"),this.destroy(),this.span.replaceChildren(),void this._construct(t,this.view,this.span);this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.editor.destroy(),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}},hS=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("subscript-tail"),e.EditorWidget=new lS(this.visibleValue,t,e,[]);const i=this;return this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const cS=(t,e)=>new Bm({tag:"BB",decoration:i=>ni.replace({widget:new hS(i,t,e)})}),uS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=cS(this.disposable,t).createDeco(t)}update(t){this.placeholder=cS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var dS;function fS(t){return dS=t,[mS]}class pS{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm);const s=this,r=Array.from({length:Math.ceil((s.args.length-3)/2)},((t,e)=>2*e+1));s.indexes=r;const o=[];this.span=i,this.spans=o;for(let t=0;t{c.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=c.options.Event),s.editors=r.map(((t,i)=>dS({doc:s.args[t].body,parent:o[i],update:e=>this.applyChanges(e,t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i>0?s.editors[i-1].focus():(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus()),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return it.destroy())),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}}class OS extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("inline-flex"),e.EditorWidget=new pS(this.visibleValue,t,e,[]);const i=this;return this.DOMElement=e,this.reference.push({destroy:()=>{i.destroy(e)}}),e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;const n=this.DOMElement.EditorWidget.editors;return t.from-e.from<0?(n[n.length-1].dispatch({selection:{anchor:n[n.length-1].state.doc.length}}),n[n.length-1].focus()):(n[0].dispatch({selection:{anchor:0}}),n[0].focus()),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}}const gS=(t,e)=>new Bm({tag:"TB",decoration:i=>ni.replace({widget:new OS(i,t,e)})}),mS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=gS(this.disposable,t).createDeco(t)}update(t){this.placeholder=gS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});const bS=_i.fromClass(class{decorations=ni.none;constructor(t){this.view=t,this.recompute()}recompute(t){let e,i,n=[];for(let{from:t,to:e}of this.view.visibleRanges)this.getDecorationsFor(t,e,n);this.decorations=ni.set(n,!0),this.decorations=this.decorations.update({filter:(n,s)=>!(n>e&&s=e&&s.selection.main.head<=i)return!0;if(!n&&s.selection.main.head>e&&s.selection.main.headt.decorations});class wS extends ei{constructor(t,e){super(),this.rawValue=t,this.visibleValue=e}eq(t){return this.rawValue===t.rawValue}toDOM(){let t=document.createElement("div");t.classList.add("cell-type-widget");const e=this.rawValue.split(" "),i=e[0].split(".");if(console.log(i),t.classList.add("cell-type-"+i[1].trim()),t.innerText=e[0].trim(),e.length>1){const n=e.slice(1),s=document.createElement("span");return s.appendChild(t),n.forEach((t=>{const e=document.createElement("span");e.innerText=t,e.classList.add("cell-type-"+i[1].trim()+"-"+t.split("=")[0]),s.appendChild(e)})),s}return t}ignoreEvent(){return!1}}const vS=new F,yS=new F,SS=[],xS=Sl.define([{tag:Sa.meta,color:"var(--editor-key-meta)"},{tag:Sa.link,textDecoration:"underline"},{tag:Sa.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Sa.emphasis,fontStyle:"italic"},{tag:Sa.strong,fontWeight:"bold"},{tag:Sa.strikethrough,textDecoration:"line-through"},{tag:Sa.keyword,color:"var(--editor-key-keyword)"},{tag:[Sa.atom,Sa.bool,Sa.url,Sa.contentSeparator,Sa.labelName],color:"var(--editor-key-atom)"},{tag:[Sa.literal,Sa.inserted],color:"var(--editor-key-literal)"},{tag:[Sa.string,Sa.deleted],color:"var(--editor-key-string)"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],color:"var(--editor-key-escape)"},{tag:Sa.definition(Sa.variableName),color:"var(--editor-key-variable)"},{tag:Sa.local(Sa.variableName),color:"var(--editor-local-variable)"},{tag:[Sa.typeName,Sa.namespace],color:"var(--editor-key-type)"},{tag:Sa.className,color:"var(--editor-key-class)"},{tag:[Sa.special(Sa.variableName),Sa.macroName],color:"var(--editor-special-variable)"},{tag:Sa.definition(Sa.propertyName),color:"var(--editor-key-property)"},{tag:Sa.comment,color:"var(--editor-key-comment)"},{tag:Sa.invalid,color:"var(--editor-key-invalid)"}]),kS={data:[],extend:t=>{kS.data.push(...t),Qm.reBuild(kS.data)},replaceAll:t=>{kS.data=t,Qm.reBuild(kS.data)}},QS=Gl.define({name:"spreadsheet",startState:function(){return{stringType:null,stack:[]}},token:function(t,e){if(t){switch(0===e.stack.length&&('"'!=t.peek()&&"'"!=t.peek()||(e.stringType=t.peek(),t.next(),e.stack.unshift("string"))),e.stack[0]){case"string":for(;"string"===e.stack[0]&&!t.eol();)t.peek()===e.stringType?(t.next(),e.stack.shift()):"\\"===t.peek()?(t.next(),t.next()):t.match(/^.[^\\\"\']*/);return"string";case"characterClass":for(;"characterClass"===e.stack[0]&&!t.eol();)t.match(/^[^\]\\]+/)||t.match(/^\\./)||e.stack.shift();return"operator"}var i=t.peek();switch(i){case"[":return t.next(),e.stack.unshift("characterClass"),"bracket";case":":return t.next(),"operator";case"\\":return t.match(/\\[a-z]+/)?"string.special":(t.next(),"atom");case".":case",":case";":case"*":case"-":case"+":case"^":case"<":case"/":case"=":return t.next(),"atom";case"$":return t.next(),"builtin"}return t.match(/\d+/)?t.match(/^\w+/)?"error":"number":t.match(/^[a-zA-Z_]\w*/)?t.match(/(?=[\(.])/,!1)?"keyword":"variable":-1!=["[","]","(",")","{","}"].indexOf(i)?(t.next(),"bracket"):(t.eatSpace()||t.next(),null)}}}),$S=new RegExp(/^[\w]*\.[\w]+/);function PS(t){const e=$S.exec(t),i=Object.values(window.SupportedLanguages);for(let t=0;t{if(!t.docChanged)return null;let e=PS(t.newDoc.line(1).text);if(e.legacy){const i=t.startState.facet(Wa);if(i){if(i.name==e.name)return null}else if(t.startState.facet(CS)==e.name)return null;return console.log("switching... to "+e.name),{effects:vS.reconfigure(e.plugins)}}return e.name===t.startState.facet(Wa).name?null:(console.log("switching... to "+e.name),{effects:vS.reconfigure(e.plugins)})}));let XS,ZS=null;const AS=t=>{const e=t||XS;return e&&e.viewState?(console.log(),PS(e.state.doc.line(1).text).name):""},TS=t=>{const e=t||XS;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return!1;const n=i[0];return[n.from,n.to]},RS=t=>{const e=t||XS;return e&&e.viewState?e.state.doc.toString():""},ES=t=>{const e=t||XS;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return"";const n=i[0];return console.log("yoko"),console.log(n),console.log(e.state.doc.toString().slice(n.from,n.to)),console.log("processing"),e.state.doc.toString().slice(n.from,n.to)},VS=(t,e)=>{const i=e||XS;if(!i)return;if(!i.viewState)return;const n=i.viewState.state.selection.ranges;if(!n.length)return;const s=n[0];console.log("result"),console.log(t),i.dispatch({changes:{...s,insert:t}})},MS=()=>XS,DS=(t,e)=>{const i=e||XS;i&&i.viewState&&(console.log("result"),console.log(t),i.dispatch({changes:{from:0,to:i.viewState.state.doc.length,insert:t}}))};ZS=t=>{let e=new Ts({doc:t.doc,extensions:[Ys.of([{key:"Tab",run:function(t,e){return sd(t)}},{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,zS,Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(XS=e.view)}))],parent:t.parent});return e.viewState.state.config.eval=t.eval,e},ZS.state=t=>{let e=xt.create({doc:t.doc,extensions:[Ys.of([{key:"Tab",run:function(t,e){return sd(t)}},{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,zS,Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(XS=e.view)}))]});return e.config.eval=t.eval,e};const WS=(t,e)=>{if(!t||e<=0)return[];const i=[];for(let n=0;n{if(console.log(e.dom.ocellref),e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:DropEvent"]')}},file:(t,e,i,n,s)=>{if(e.dom.ocellref)if(s.length>5242880){const t=WS(s,5242880);t.forEach(((e,s)=>{server.emitt(i,`<|"Data"->"${e}", "Name"->"${n}", "Chunk"->${s+1}, "Chunks"->${t.length}|>`,"Chunk")}))}else server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},YS={transaction:(t,e,i,n)=>{if(console.log(e.dom.ocellref),e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:PasteEvent"]')}},file:(t,e,i,n,s)=>{if(console.log(e.dom.ocellref),e.dom.ocellref)if(s.length>5242880){const t=WS(s,5242880);t.forEach(((e,s)=>{server.emitt(i,`<|"Data"->"${e}", "Name"->"${n}", "Chunk"->${s+1}, "Chunks"->${t.length}|>`,"Chunk")}))}else server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},qS=[Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Cm(US,YS)];let LS=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"}}),zS=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"},".cm-scroller":{"line-height":"inherit","overflow-x":"overlay","overflow-y":"overlay","align-items":"initial"},".cm-content":{padding:"0px 0"},".rainbow-bracket-red":{color:"var(--editor-bracket-1)"},".rainbow-bracket-orange":{color:"var(--editor-bracket-2)"},".rainbow-bracket-yellow":{color:"var(--editor-bracket-3)"},".rainbow-bracket-green":{color:"var(--editor-bracket-4)"},".rainbow-bracket-blue":{color:"var(--editor-bracket-5)"},".rainbow-bracket-indigo":{color:"var(--editor-bracket-6)"},".rainbow-bracket-violet":{color:"var(--editor-bracket-7)"},".rainbow-bracket-red > span":{color:"var(--editor-bracket-1-a)"},".rainbow-bracket-orange > span":{color:"var(--editor-bracket-2-a)"},".rainbow-bracket-yellow > span":{color:"var(--editor-bracket-3-a)"},".rainbow-bracket-green > span":{color:"var(--editor-bracket-4-a)"},".rainbow-bracket-blue > span":{color:"var(--editor-bracket-5-a)"},".rainbow-bracket-indigo > span":{color:"var(--editor-bracket-6-a)"},".rainbow-bracket-violet > span":{color:"var(--editor-bracket-7-a)"}}),IS=!1;const BS=[()=>vr(),()=>Sh(),()=>ir(),()=>dr(),()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xS,{fallback:!1}),()=>tu()],jS={},NS=[()=>vr(),()=>Sh(),()=>ir(),()=>dr(),t=>GS.of(t),()=>jS.gutter?function(t={}){return[eo.of(t),jr(),so]}():[],()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xS,{fallback:!1}),()=>tu(),()=>bS,()=>function(t){return _i.fromClass(class{constructor(e){this.view=e,this.placeholder=ni.set([ni.widget({widget:new kr(t),side:1}).range(0)])}get decorations(){return this.view.state.doc.length?ni.none:this.placeholder}},{decorations:t=>t.decorations})}("Type WL Expression / .md / .js"),()=>xt.allowMultipleSelections.of(!0),(t,e)=>vS.of(e),()=>yS.of(xt.readOnly.of(!1)),()=>_S,()=>{return t?[ou.of(t),Yu]:Yu;var t},(t,e)=>Ys.of([{key:"Tab",run:function(t,e){const i=sd(t);return i||Rc(t)},shift:Ec},{key:"Backspace",run:function(e,i){if(0===e.state.doc.length)return t.origin.remove(),!0}},{key:"ArrowLeft",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus prev"),t.origin.focusPrev(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus next"),t.origin.focusNext(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"Shift-Enter",preventDefault:!0,run:function(e,i){console.log(e.state.doc.toString()),t.origin.eval(e.state.doc.toString())}},...Vc,...Wh,...Ru]),(t,e)=>Ts.updateListener.of((e=>{e.docChanged&&t.origin.save(encodeURIComponent(e.state.doc.toString())),e.selectionSet&&(XS=e.view)})),()=>LS];const GS=E.define();function FS(t){return t.replace(/\\\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\\\:/g,""),16))})).replaceAll("\\:F74E","I").replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))}function HS(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(t=>(+t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+t/4).toString(16)))}core.ReadOnly=()=>"ReadOnly",core.EditorView=async(t,e)=>{let i=await interpretate(t[0],e);i=FS(i),console.log("UNICODE Disaster");const n=await core._getRules(t,e);let s=()=>{},r=()=>{},o=i;const a=[];n.ReadOnly&&a.push(xt.readOnly.of(!0)),n.ForceUpdate&&(e.local.forceUpdate=n.ForceUpdate),n.Event&&(r=t=>{o=t,console.log("editor view emitt data: "+t),server.kernel.emitt(n.Event,'"'+t.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Input")},s=()=>{server.kernel.emitt(n.Event,'"'+o.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Evaluate")}),e.local?e.local.editor=ZS({doc:i,parent:e.element,eval:s,update:r,extensions:a}):ZS({doc:i,parent:e.element,eval:s,update:r,extensions:a}),e.element.style.verticalAlign="inherit"},core.StripOnInput=async()=>{},core.EditorView.update=async(t,e)=>{if(!e.local.editor)return;const i=FS(await interpretate(t[0],e));console.log("editor view: dispatch"),e.local.forceUpdate,e.local.editor.dispatch({changes:{from:0,to:e.local.editor.state.doc.length,insert:i}})},core.EditorView.destroy=async(t,e)=>{await interpretate(t[0],e),e.local&&e.local.editor&&e.local.editor.destroy()},core.EditorView.virtual=!0,core.PreviewCell=(t,e)=>{},window.SupportedLanguages.push({check:t=>null===t,legacy:!0,plugins:qS,name:"mathematica"}),window.SupportedLanguages.push({check:t=>null!=t[0].match(/\w+\.(wl|wls)$/),plugins:qS,legacy:!0,name:"mathematica"}),window.SupportedCells.codemirror={view:class{origin={};editor={};trash=[];forceFocusNext(){IS=!0}focus(t){t>0?this.editor.dispatch({selection:{anchor:0}}):t<0&&this.editor.dispatch({selection:{anchor:this.editor.state.doc.length}}),this.editor.focus()}setContent(t){if(console.warn("content mutation!"),!this.editor.viewState)return;const e=this.editor;console.log("result"),console.log(t),this.editor.dispatch({changes:{from:0,to:e.viewState.state.doc.length,insert:t}})}addDisposable(t){this.trash.push(t)}dispose(){this.editor.destroy()}readOnly(t){this.editor.dispatch({effects:yS.reconfigure(xt.readOnly.of(t))})}constructor(t,e){this.origin=t;const i=this.origin,n=PS(e).plugins,s=this;this.origin.element.ocellref=s;const r=new Ts({doc:(o=e,o.replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))),extensions:NS.map((t=>t(s,n))),parent:this.origin.element});var o;return this.editor=r,this.editor.dom.ocellref=s,this.editor.viewState.state.config.eval=()=>{i.eval(this.editor.state.doc.toString())},IS&&r.focus(),IS=!1,this}},context:{EditorAutocomplete:kS,javascriptLanguage:qf,javascript:Nf,markdownLanguage:rm,markdown:function(t={}){let{codeLanguages:e,defaultCodeLanguage:i,addKeymap:n=!0,base:{parser:s}=sm}=t;if(!(s instanceof Zp))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let r,o=t.extensions?[t.extensions]:[],a=[dm.support];i instanceof Ua?(a.push(i.support),r=i.language):i&&(r=i);let l=e||r?(h=e,c=r,t=>{if(t&&h){let e=null;if(t=/\S*/.exec(t)[0],e="function"==typeof h?h(t):Ya.matchLanguageName(h,t,!0),e instanceof Ya)return e.support?e.support.language.parser:Ta.getSkippingParser(e.load());if(e)return e.parser}return c?c.parser:null}):void 0;var h,c;return o.push(function(t){let{codeParser:e,htmlParser:i}=t,n=Do(((t,n)=>{let s=t.type.id;if(!e||s!=Kf.CodeBlock&&s!=Kf.FencedCode){if(i&&(s==Kf.HTMLBlock||s==Kf.HTMLTag))return{parser:i,overlay:rO(t.node,t.from,t.to)}}else{let i="";if(s==Kf.FencedCode){let e=t.node.getChild(Kf.CodeInfo);e&&(i=n.read(e.from,e.to))}let r=e(i);if(r)return{parser:r,overlay:t=>t.type.id==Kf.CodeText}}return null}));return{wrap:n}}({codeParser:l,htmlParser:dm.language.parser})),n&&a.push(N.high(Ys.of(um))),new Ua(nm(s.configure(o)),a)},htmlLanguage:jg,html:Ng,cssLanguage:kg,css:Qg,EditorView:Ts,EditorState:xt,highlightSpecialChars:vr,syntaxHighlighting:$l,defaultHighlightStyle:xS,editorCustomTheme:LS,foldGutter:function(t={}){let e=Object.assign(Object.assign({},wl),t),i=new vl(e,!0),n=new vl(e,!1),s=_i.fromClass(class{constructor(t){this.from=t.viewport.from,this.markers=this.buildMarkers(t)}update(t){(t.docChanged||t.viewportChanged||t.startState.facet(Wa)!=t.state.facet(Wa)||t.startState.field(dl,!1)!=t.state.field(dl,!1)||Xa(t.startState)!=Xa(t.state)||e.foldingChanged(t))&&(this.markers=this.buildMarkers(t.view))}buildMarkers(t){let e=new Xt;for(let s of t.viewportLineBlocks){let r=fl(t.state,s.from,s.to)?n:ll(t.state,s.from,s.to)?i:null;r&&e.add(s.from,s.from,r)}return e.finish()}}),{domEventHandlers:r}=e;return[s,Ir({class:"cm-foldGutter",markers(t){var e;return(null===(e=t.plugin(s))||void 0===e?void 0:e.markers)||_t.empty},initialSpacer:()=>new vl(e,!1),domEventHandlers:Object.assign(Object.assign({},r),{click:(t,e,i)=>{if(r.click&&r.click(t,e,i))return!0;let n=fl(t.state,e.from,e.to);if(n)return t.dispatch({effects:ul.of(n)}),!0;let s=ll(t.state,e.from,e.to);return!!s&&(t.dispatch({effects:cl.of(s)}),!0)}})}),ml()]},Facet:E,Compartment:F,mathematicaPlugins:qS,legacyLangNameFacet:CS,DropPasteHandlers:Cm,EditorExtensionsMinimal:BS,EditorParameters:jS,EditorExtensions:NS,StateField:q,Decoration:ni,ViewPlugin:_i,WidgetType:ei,originFacet:GS,MatchDecorator:pr}},window.OfflineMode&&SS.push(xt.readOnly.of(!0)),core.CellView=async(t,e)=>{const i=await core._getRules(t,e);i.Display||(i.Display="codemirror");const n=await interpretate(t[0],e),s={element:e.element,uid:HS()};i.Style&&(e.element.style=i.Style),i.Class&&e.element.classList.add(...i.Class.split(" ")),i.ImageSize&&(Array.isArray(i.ImageSize)?(e.element.style.width=i.ImageSize[0]+"px",e.element.style.height=i.ImageSize[1]+"px"):e.element.style.width=i.ImageSize+"px"),new window.SupportedCells[i.Display].view(s,n)};const JS={};core.FrontEditorSelected=async(t,e)=>{console.log("check");const i=await interpretate(t[0],e),n=await core._getRules(t,e);let s;switch(n.Editor&&(s=JS[n.Editor],console.log("Editor"),console.log(n.Editor),console.log(s)),i){case"Get":return ES(s);case"Set":let i=await interpretate(t[1],e);VS(i,s);break;case"GetDoc":return RS(s);case"SetDoc":let n=await interpretate(t[1],e);DS(n,s);break;case"Cursor":return TS(s);case"Type":return AS(s);case"Editor":const r=HS();return JS[r]=MS(),r}};window.SupportedCells.shell={view:class{dispose(){}constructor(t,e){this.origin=t;const i=document.createElement("div");return i.classList.add(..."flex sc-b max-h-60 text-sm overflow-y-scroll".split(" ")),i.style.overflowAnchor="auto",i.style.flexDirection="column-reverse",i.innerText=e,this.origin.element.appendChild(i),this}}}; diff --git a/libs/priceless-mathematica/src/mathematica/dropevents.js b/libs/priceless-mathematica/src/mathematica/dropevents.js index 47b8e8d..3e773ac 100644 --- a/libs/priceless-mathematica/src/mathematica/dropevents.js +++ b/libs/priceless-mathematica/src/mathematica/dropevents.js @@ -74,8 +74,8 @@ function readFile(file, cbk, fail) { reader.addEventListener('load', (event) => { const payload = event.target.result; - if (payload.byteLength / 1024 / 1024 > 15) { - alert('Files > 15Mb are not supported for drag and drop'); + if (payload.byteLength / 1024 / 1024 > 100) { + alert('Files > 100Mb are not supported for drag and drop'); fail(); return; //throw 'Files > 15Mb are not supported for drag and drop'; diff --git a/src/FileUpload.wl b/src/FileUpload.wl index a2b4e5c..7db4123 100644 --- a/src/FileUpload.wl +++ b/src/FileUpload.wl @@ -9,21 +9,54 @@ BeginPackage["Notebook`EditorFileUploader`", { Begin["`Private`"] +chunks = <||>; + processRequest[cli_, controls_, data_, __] := With[{channel = data["Channel"]}, Echo["Drop request >> "]; Module[{count = data["Length"], files = <||>, finished}, EventHandler[channel, { + "Chunk" -> Function[payload, + + With[{name = payload["Name"]}, + If[!KeyExistsQ[chunks, name], chunks[name] = <||>]; + + chunks[name] = Join[chunks[name], <|payload["Chunk"] -> payload["Data"] |> ]; + Echo[StringTemplate[ "Received chunk: `` out of ``"] @@ {payload["Chunk"], payload["Chunks"]} ]; + + If[Length[Keys[chunks[name] ] ] === payload["Chunks"], + With[{merged = StringJoin @@ (KeySort[chunks[name] ] // Values)}, + chunks[name] = .; + With[{safeName = FileBaseName[name]<>"-"<>StringTake[CreateUUID[], 3]<>"."<>FileExtension[name]}, + files[safeName] = merged // BaseDecode; + ]; + count--; + If[count === 0, + finished; + EventRemove[channel]; + ] + ] + , + Echo[StringTemplate[ "Waiting for chunks: `` out of ``"] @@ {Length[Keys[chunks[name] ] ], payload["Chunks"]} ]; + ]; + ]; + + ], + + "File" -> Function[payload, - With[{name = payload["Name"]}, - With[{safeName = FileBaseName[name]<>"-"<>StringTake[CreateUUID[], 3]<>"."<>FileExtension[name]}, - files[safeName] = payload["Data"] // BaseDecode; + + + With[{name = payload["Name"]}, + With[{safeName = FileBaseName[name]<>"-"<>StringTake[CreateUUID[], 3]<>"."<>FileExtension[name]}, + files[safeName] = payload["Data"] // BaseDecode; + ] + ]; + + count--; + If[count === 0, + finished; + EventRemove[channel]; ] - ]; - count--; - If[count === 0, - finished; - EventRemove[channel]; - ] ] }]; diff --git a/src/kernel.js b/src/kernel.js index 518cc14..961dc24 100644 --- a/src/kernel.js +++ b/src/kernel.js @@ -418,6 +418,16 @@ compactWLEditor.state = (args) => { return state; } +const splitStringIntoChunks = (str, chunkSize) => { + if (!str || chunkSize <= 0) return []; + + const chunks = []; + for (let i = 0; i < str.length; i += chunkSize) { + chunks.push(str.slice(i, Math.min(i + chunkSize, str.length))); + } + return chunks; +} + const wlDrop = { transaction: (ev, view, id, length) => { console.log(view.dom.ocellref); @@ -428,9 +438,18 @@ const wlDrop = { }, file: (ev, view, id, name, result) => { - console.log(view.dom.ocellref); + //console.log(view.dom.ocellref); + //console.log(result); if (view.dom.ocellref) { - server.emitt(id, `<|"Data"->"${result}", "Name"->"${name}"|>`, 'File'); + //throw result.length; + if (result.length > 5 * 1024 * 1024) { + const chunks = splitStringIntoChunks(result, 5 * 1024 * 1024); + chunks.forEach((chunk, index) => { + server.emitt(id, `<|"Data"->"${chunk}", "Name"->"${name}", "Chunk"->${index+1}, "Chunks"->${chunks.length}|>`, 'Chunk'); + }); + } else { + server.emitt(id, `<|"Data"->"${result}", "Name"->"${name}"|>`, 'File'); + } } } } @@ -447,7 +466,14 @@ const wlPaste = { file: (ev, view, id, name, result) => { console.log(view.dom.ocellref); if (view.dom.ocellref) { - server.emitt(id, `<|"Data"->"${result}", "Name"->"${name}"|>`, 'File'); + if (result.length > 5 * 1024 * 1024) { + const chunks = splitStringIntoChunks(result, 5 * 1024 * 1024); + chunks.forEach((chunk, index) => { + server.emitt(id, `<|"Data"->"${chunk}", "Name"->"${name}", "Chunk"->${index+1}, "Chunks"->${chunks.length}|>`, 'Chunk'); + }); + } else { + server.emitt(id, `<|"Data"->"${result}", "Name"->"${name}"|>`, 'File'); + } } } } From 41964fa78f39f84ab18e1334c1f3d2b3b4795200 Mon Sep 17 00:00:00 2001 From: Kirill Vasin Date: Fri, 22 Nov 2024 21:13:44 +0100 Subject: [PATCH 18/26] comments --- src/AutocompleteKernel.wl | 2 +- src/autocomplete.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/AutocompleteKernel.wl b/src/AutocompleteKernel.wl index 5684a17..aaee583 100644 --- a/src/AutocompleteKernel.wl +++ b/src/AutocompleteKernel.wl @@ -46,7 +46,7 @@ BuildVocabular := With[{}, If[Internal`Kernel`Type =!= "LocalKernel", Echo["Error. Autocomplete package can only for on LocalKernel. MasterKernel is not allowed!"]; Return[$Failed]; ]; - (*Echo["Buildind vocabular..."];*) + Echo["Buildind vocabular for autocomplete..."]; With[{r = Flatten[( ((*Echo[#]; *){#, Information[#, "Usage"]}) &/@ Names[#<>"*"] ) &/@ Complement[$ContextPath, blacklist], 1]}, definitions = Join[definitions, r] // DeleteDuplicates; ]; diff --git a/src/autocomplete.js b/src/autocomplete.js index d3573d1..70e58dc 100644 --- a/src/autocomplete.js +++ b/src/autocomplete.js @@ -23,8 +23,8 @@ core.UIAutocompleteConnect = async (args, env) => { core.UIAutocompleteExtend = async (args, env) => { const data = await interpretate(args[0], env); - console.log('Autocomplete populate'); - //console.log(data); + console.log('Autocomplete populate with ' + data.length + ' symbols'); + data.forEach((element)=>{ const name = element[0]; From 9178f0663ada192e948506ccbc0c6e2b291406e6 Mon Sep 17 00:00:00 2001 From: Kirill Vasin Date: Fri, 22 Nov 2024 21:22:33 +0100 Subject: [PATCH 19/26] fix bug with dropping --- dist/kernel.js | 1 + dist/kernel.min.js | 2 +- src/kernel.js | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dist/kernel.js b/dist/kernel.js index 89013bc..5be5ea7 100644 --- a/dist/kernel.js +++ b/dist/kernel.js @@ -40245,6 +40245,7 @@ const splitStringIntoChunks = (str, chunkSize) => { const wlDrop = { transaction: (ev, view, id, length) => { console.log(view.dom.ocellref); + selectedEditor = view; if (view.dom.ocellref) { const channel = view.dom.ocellref.origin.channel; server._emitt(channel, `<|"Channel"->"${id}", "Length"->${length}, "CellType"->"wl"|>`, 'Forwarded["CM:DropEvent"]'); diff --git a/dist/kernel.min.js b/dist/kernel.min.js index 8ad2e98..e599539 100644 --- a/dist/kernel.min.js +++ b/dist/kernel.min.js @@ -1 +1 @@ -class t{constructor(){}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 a(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}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 l(n,o,i,r);n=o+1,i++}}decompose(t,i,r,o){let a=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(a.text,t.text.slice(),0,a.length);if(i.length<=32)r.push(new e(i,t.length+a.length));else{let t=i.length>>1;r.push(new e(i.slice(0,t)),new e(i.slice(t)))}}else r.push(a)}replace(t,r,o){if(!(o instanceof e))return super.replace(t,r,o);let a=n(this.text,n(o.text,s(this.text,0,t)),r),l=this.length+o.length-(r-t);return a.length<=32?new e(a,l):i.from(e.split(a,[]),l)}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=a+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,a=i+r.lines-1;if((e?a:o)>=t)return r.lineInner(t,e,i,n);n=o+1,i=a+1}}decompose(t,e,i,n){for(let s=0,r=0;r<=e&&s=r){let s=n&((r<=t?1:0)|(a>=e?2:0));r>=t&&a<=e&&!s?i.push(o):o.decompose(t-r,e-r,i,s)}r=a+1}}replace(t,e,n){if(n.lines=r&&e<=a){let l=o.replace(t-r,e-r,n),h=this.lines-o.lines+l.lines;if(l.lines>4&&l.lines>h>>6){let r=this.children.slice();return r[s]=l,new i(r,this.length-(e-t)+n.length)}return super.replace(r,a,l)}r=a+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=a+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,a]=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==a)return n;let i=this.children[s],l=t.children[r];if(i!=l)return n+i.scanIdentical(l,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,a=r>>1,l=[],h=0,c=-1,u=[];function d(t){let n;if(t.lines>o&&t instanceof i)for(let e of t.children)d(e);else t.lines>a&&(h>a||!h)?(f(),l.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&&f(),h+=t.lines,c+=t.length+1,u.push(t))}function f(){0!=h&&(l.push(1==u.length?u[0]:i.from(u,c)),c=-1,h=u.length=0)}for(let e of t)d(e);return f(),1==l.length?l[0]:new i(l,n)}}function n(t,e,i=0,n=1e9){for(let s=0,r=0,o=!0;r=i&&(l>n&&(a=a.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,a=s instanceof e?s.text.length:s.children.length;if(o==(i>0?a: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 a{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]=a.prototype[Symbol.iterator]=function(){return this});let l=class{constructor(t,e,i,n){this.from=t,this.to=e,this.number=i,this.text=n}get length(){return this.to-this.from}},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,,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const d=8205;function f(t,e,i=!0,n=!0){return(i?p:O)(t,e,n)}function p(t,e,i){if(e==t.length)return e;e&&g(t.charCodeAt(e))&&m(t.charCodeAt(e-1))&&e--;let n=b(t,e);for(e+=v(n);e=0&&u(b(t,n));)i++,n-=2;if(i%2==0)break;e+=2}}}return e}function O(t,e,i){for(;e>0;){let n=p(t,e-2,i);if(n=56320&&t<57344}function m(t){return t>=55296&&t<56320}function b(t,e){let i=t.charCodeAt(e);if(!m(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return g(n)?n-56320+(i-55296<<10)+65536:i}function w(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function v(t){return t<65536?1:2}const y=/\r\n?|\n/;var S=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(S||(S={}));class x{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;et)return s+(t-n);s+=o}else{if(i!=S.Simple&&l>=t&&(i==S.TrackDel&&nt||i==S.TrackBefore&&nt))return null;if(l>t||l==t&&e<0&&!o)return t==n||e<0?s:s+a;s+=a}n=l}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 x(t)}static create(t){return new x(t)}}class k extends x{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 P(this,((e,i,n,s,r)=>t=t.replace(n,n+(i-e),r)),!1),t}mapDesc(t,e=!1){return C(this,t,e,!0)}invert(e){let i=this.sections.slice(),n=[];for(let s=0,r=0;s=0){i[s]=a,i[s+1]=o;let l=s>>1;for(;n.length0&&$(i,e,s.text),s.forward(t),o+=t}let l=t[r++];for(;o>1].toJSON()))}return t}static of(e,i,n){let s=[],r=[],o=0,a=null;function l(t=!1){if(!t&&!s.length)return;oa||e<0||a>i)throw new RangeError(`Invalid change range ${e} to ${a} (in doc of length ${i})`);let u=c?"string"==typeof c?t.of(c.split(n||y)):c:t.empty,d=u.length;if(e==a&&0==d)return;eo&&Q(s,e-o,-1),Q(s,a-e,d),$(r,s,u),o=a}}(e),l(!a),a}static empty(t){return new k(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 $(e,i,n){if(0==n.length)return;let s=i.length-2>>1;if(s>1])),!(n||a==e.sections.length||e.sections[a+1]<0);)l=e.sections[a++],h=e.sections[a++];i(r,c,o,u,d),r=c,o=u}}}function C(t,e,i,n=!1){let s=[],r=n?[]:null,o=new X(t),a=new X(e);for(let t=-1;;)if(-1==o.ins&&-1==a.ins){let t=Math.min(o.len,a.len);Q(s,t,-1),o.forward(t),a.forward(t)}else if(a.ins>=0&&(o.ins<0||t==o.i||0==o.off&&(a.len=0&&t=0)){if(o.done&&a.done)return r?k.createSet(s,r):x.create(s);throw new Error("Mismatched change set lengths")}{let e=0,i=o.len;for(;i;)if(-1==a.ins){let t=Math.min(i,a.len);e+=t,i-=t,a.forward(t)}else{if(!(0==a.ins&&a.lene||o.ins>=0&&o.len>e)&&(t||n.length>i),r.forward2(e),o.forward(e)}}else Q(n,0,o.ins,t),s&&$(s,n,o.text),o.next()}}class X{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 Z{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 Z(i,n,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return A.range(t,e);let i=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return A.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 A.range(t.anchor,t.head)}static create(t,e,i){return new Z(t,e,i)}}class A{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:A.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 A(t.ranges.map((t=>Z.fromJSON(t))),t.main)}static single(t,e=t){return new A([A.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?A.range(o,r):A.range(r,o))}}return new A(t,e)}}function T(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let R=0;class E{constructor(t,e,i,n,s){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=n,this.id=R++,this.default=t([]),this.extensions="function"==typeof s?s(this):s}static define(t={}){return new E(t.combine||(t=>t),t.compareInput||((t,e)=>t===e),t.compare||(t.combine?(t,e)=>t===e:V),!!t.static,t.enables)}of(t){return new M([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,2,e)}from(t,e){return e||(e=t=>t),this.compute([t],(i=>e(i.field(t))))}}function V(t,e){return t==e||t.length==e.length&&t.every(((t,i)=>t===e[i]))}class M{constructor(t,e,i,n){this.dependencies=t,this.facet=e,this.type=i,this.value=n,this.id=R++}dynamicSlot(t){var e;let i=this.value,n=this.facet.compareInput,s=this.id,r=t[s]>>1,o=2==this.type,a=!1,l=!1,h=[];for(let i of this.dependencies)"doc"==i?a=!0:"selection"==i?l=!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(a&&e.docChanged||l&&(e.docChanged||e.selection)||W(t,h)){let e=i(t);if(o?!D(e,t.values[r],n):!n(e,t.values[r]))return t.values[r]=e,1}return 0},reconfigure:(t,e)=>{let a,l=e.config.address[s];if(null!=l){let s=tt(e,l);if(this.dependencies.every((i=>i instanceof E?e.facet(i)===t.facet(i):!(i instanceof q)||e.field(i,!1)==t.field(i,!1)))||(o?D(a=i(t),s,n):n(a=i(t),s)))return t.values[r]=s,0}else a=i(t);return t.values[r]=a,1}}}}function D(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 a(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(Y).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,Y.of({field:this,create:t})]}get extension(){return this}}const L=4,z=3,I=2,B=1;function j(t){return e=>new G(e,t)}const N={highest:j(0),high:j(B),default:j(I),low:j(z),lowest:j(L)};class G{constructor(t,e){this.inner=t,this.prec=e}}class F{of(t){return new H(this,t)}reconfigure(t){return F.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class H{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;function r(t,o){let a=s.get(t);if(null!=a){if(a<=o)return;let e=n[a].indexOf(t);e>-1&&n[a].splice(e,1),t instanceof H&&i.delete(t.compartment)}if(s.set(t,o),Array.isArray(t))for(let e of t)r(e,o);else if(t instanceof H){if(i.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");let n=e.get(t.compartment)||t.inner;i.set(t.compartment,n),r(n,o)}else if(t instanceof G)r(t.inner,t.prec);else if(t instanceof q)n[o].push(t),t.provides&&r(t.provides,o);else if(t instanceof M)n[o].push(t),t.facet.extensions&&r(t.facet.extensions,I);else{let e=t.extension;if(!e)throw new Error(`Unrecognized extension value in extension set (${t}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(e,o)}}return r(t,I),n.reduce(((t,e)=>t.concat(e)))}(t,e,r))i instanceof q?n.push(i):(s[i.facet.id]||(s[i.facet.id]=[])).push(i);let o=Object.create(null),a=[],l=[];for(let t of n)o[t.id]=l.length<<1,l.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]=a.length<<1|1,V(r,e))a.push(i.facet(n));else{let t=n.combine(e.map((t=>t.value)));a.push(i&&n.compare(t,i.facet(n))?i.facet(n):t)}else{for(let t of e)0==t.type?(o[t.id]=a.length<<1|1,a.push(t.value)):(o[t.id]=l.length<<1,l.push((e=>t.dynamicSlot(e))));o[n.id]=l.length<<1,l.push((t=>U(t,n,e)))}}let c=l.map((t=>t(o)));return new J(t,r,c,o,a,s)}}function K(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 tt(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}const et=E.define(),it=E.define({combine:t=>t.some((t=>t)),static:!0}),nt=E.define({combine:t=>t.length?t[0]:void 0,static:!0}),st=E.define(),rt=E.define(),ot=E.define(),at=E.define({combine:t=>!!t.length&&t[0]});class lt{constructor(t,e){this.type=t,this.value=e}static define(){return new ht}}class ht{of(t){return new lt(this,t)}}class ct{constructor(t){this.map=t}of(t){return new ut(this,t)}}class ut{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 ut(this.type,e)}is(t){return this.type==t}static define(t={}){return new ct(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}}ut.reconfigure=ut.define(),ut.appendConfig=ut.define();class dt{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&&T(i,e.newLength),s.some((t=>t.type==dt.time))||(this.annotations=s.concat(dt.time.of(Date.now())))}static create(t,e,i,n,s,r){return new dt(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(dt.userEvent);return!(!e||!(e==t||e.length>t.length&&e.slice(0,t.length)==t&&"."==e[t.length]))}}function ft(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=pt(n,Ot(e,r,t.changes.newLength),!0))}return n==t?t:dt.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(st)){let e=n(t);if(!1===e){i=!1;break}Array.isArray(e)&&(i=!0===i?e:ft(i,e))}if(!0!==i){let n,s;if(!1===i)s=t.changes.invertedDesc,n=k.empty(e.doc.length);else{let e=t.changes.filter(i);n=e.changes,s=e.filtered.mapDesc(e.changes).invertedDesc}t=dt.create(e,n,t.selection&&t.selection.map(s),ut.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let n=e.facet(rt);for(let i=n.length-1;i>=0;i--){let s=n[i](t);t=s instanceof dt?s:Array.isArray(s)&&1==s.length&&s[0]instanceof dt?s[0]:gt(e,bt(s),!1)}return t}(s):s)}dt.time=lt.define(),dt.userEvent=lt.define(),dt.addToHistory=lt.define(),dt.remote=lt.define();const mt=[];function bt(t){return null==t?mt:Array.isArray(t)?t:[t]}var wt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(wt||(wt={}));const vt=/[\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){}function St(t){return e=>{if(!/\S/.test(e))return wt.Space;if(function(t){if(yt)return yt.test(t);for(let e=0;e"€"&&(i.toUpperCase()!=i.toLowerCase()||vt.test(i)))return!0}return!1}(e))return wt.Word;for(let i=0;i-1)return wt.Word;return wt.Other}}class xt{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(ut.reconfigure)?(i=null,n=e.value):e.is(ut.appendConfig)&&(i=null,n=bt(n).concat(e.value));if(i)e=t.startState.values.slice();else{i=J.resolve(n,s,this),e=new xt(i,this.doc,this.selection,i.dynamicSlots.map((()=>null)),((t,e)=>e.reconfigure(t,this)),null).values}new xt(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:A.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=bt(i.effects);for(let i=1;is.spec.fromJSON(r,t))))}return xt.create({doc:t.doc,selection:A.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(xt.lineSeparator)||y)),s=e.selection?e.selection instanceof A?e.selection:A.single(e.selection.anchor,e.selection.head):A.single(0);return T(s,n.length),i.staticFacet(it)||(s=s.asSingle()),new xt(i,n,s,i.dynamicSlots.map((()=>null)),((t,e)=>e.create(t)),null)}get tabSize(){return this.facet(xt.tabSize)}get lineBreak(){return this.facet(xt.lineSeparator)||"\n"}get readOnly(){return this.facet(at)}phrase(t,...e){for(let e of this.facet(xt.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(et))for(let r of s(this,e,i))Object.prototype.hasOwnProperty.call(r,t)&&n.push(r[t]);return n}charCategorizer(t){return St(this.languageDataAt("wordChars",t).join(""))}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=f(e,r,!1);if(s(e.slice(t,r))!=wt.Word)break;r=t}for(;ot.length?t[0]:4}),xt.lineSeparator=nt,xt.readOnly=at,xt.phrases=E.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]))}}),xt.languageData=et,xt.changeFilter=st,xt.transactionFilter=rt,xt.transactionExtender=ot,F.reconfigure=ut.define();class Qt{eq(t){return this==t}range(t,e=t){return $t.create(t,e,this)}}Qt.prototype.startSide=Qt.prototype.endSide=0,Qt.prototype.point=!1,Qt.prototype.mapMode=S.TrackDel;let $t=class t{constructor(t,e,i){this.from=t,this.to=e,this.value=i}static create(e,i,n){return new t(e,i,n)}};function Pt(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Ct{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,a=s[n]-t||(i?this.value[n].endSide:this.value[n].startSide)-e;if(n==r)return a>=0?r:o;a>=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||l==h&&c.startSide>0&&c.endSide<=0)continue;(h-l||c.endSide-c.startSide)<0||(r<0&&(r=l),c.point&&(o=Math.max(o,h-l)),i.push(c),n.push(l-r),s.push(h-r))}return{mapped:i.length?new Ct(n,s,i,o):null,pos:r}}}class _t{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 _t(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(Pt)),this.isEmpty)return e.length?_t.of(e):this;let o=new At(this,null,-1).goto(0),a=0,l=[],h=new Xt;for(;o.value||a=0){let t=e[a++];h.addInner(t.from,t.to,t.value)||l.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 Tt.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return Tt.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)),a=Zt(r,o,i),l=new Et(r,a,s),h=new Et(o,a,s);i.iterGaps(((t,e,i)=>Vt(l,t,h,e,i,n))),i.empty&&0==i.length&&Vt(l,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=Zt(s,r),a=new Et(s,o,0).goto(i),l=new Et(r,o,0).goto(i);for(;;){if(a.to!=l.to||!Mt(a.active,l.active)||a.point&&(!l.point||!a.point.eq(l.point)))return!1;if(a.to>n)return!0;a.next(),l.next()}}static spans(t,e,i,n,s=-1){let r=new Et(t,null,s).goto(e),o=e,a=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,a),a=r.openEnd(t));if(r.to>i)return a+(r.point&&r.to>i?1:0);o=r.to,r.next()}}static of(t,e=!1){let i=new Xt;for(let n of t instanceof $t?[t]:e?function(t){if(t.length>1)for(let e=t[0],i=1;i0)return t.slice().sort(Pt);e=n}return t}(t):t)i.add(n.from,n.to,n.value);return i.finish()}}_t.empty=new _t([],[],null,-1),_t.empty.nextLayer=_t.empty;class Xt{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}finishChunk(t){this.chunks.push(new Ct(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=[])}add(t,e,i){this.addInner(t,e,i)||(this.nextLayer||(this.nextLayer=new Xt)).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(_t.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;let e=_t.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function Zt(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 At(r,e,i,s));return 1==n.length?n[0]:new Tt(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--)Rt(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--)Rt(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(),Rt(this.heap,0)}}}function Rt(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 Et{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=Tt.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){Dt(this.active,t),Dt(this.activeTo,t),Dt(this.activeRank,t),this.minActive=Ut(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&&Dt(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 Vt(t,e,i,n,s,r){t.goto(e),i.goto(n);let o=n+s,a=n,l=n-e;for(;;){let e=t.to+l-i.to||t.endSide-i.endSide,n=e<0?t.to+l: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))&&Mt(t.activeForPoint(t.to+l),i.activeForPoint(i.to))||r.comparePoint(a,s,t.point,i.point):s>a&&!Mt(t.active,i.active)&&r.compareRange(a,s,t.active,i.active),n>o)break;a=n,e<=0&&t.next(),e>=0&&i.next()}}function Mt(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 Ut(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(!l)throw new RangeError("The value of a property ("+i+") should be a primitive value.");s(n(i),o,a,h)}else null!=o&&a.push(i.replace(/_.*/,"").replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))+": "+o+";")}(a.length||h)&&r.push((!i||l||o?t:t.map(i)).join(", ")+" {"+a.join(" ")+"}")}for(let e in t)s(n(e),t[e],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let t=zt[qt]||1;return zt[qt]=t+1,"ͼ"+t.toString(36)}static mount(t,e){(t[Lt]||new jt(t)).mount(Array.isArray(e)?e:[e])}}let Bt=new Map;class jt{constructor(t){let e=t.ownerDocument||t,i=e.defaultView;if(!t.head&&t.adoptedStyleSheets&&i.CSSStyleSheet){let n=Bt.get(e);if(n)return t.adoptedStyleSheets=[n.sheet,...t.adoptedStyleSheets],t[Lt]=n;this.sheet=new i.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets],Bt.set(e,this)}else{this.styleTag=e.createElement("style");let i=t.head||t;i.insertBefore(this.styleTag,i.firstChild)}this.modules=[],t[Lt]=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:'"'},Ft="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),Ht="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Jt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Kt=Ht||Ft&&+Ft[1]<57,te=0;te<10;te++)Nt[48+te]=Nt[96+te]=String(te);for(te=1;te<=24;te++)Nt[te+111]="F"+te;for(te=65;te<=90;te++)Nt[te]=String.fromCharCode(te+32),Gt[te]=String.fromCharCode(te);for(var ee in Nt)Gt.hasOwnProperty(ee)||(Gt[ee]=Nt[ee]);function ie(t){let e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection()}function ne(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function se(t,e){if(!e.anchorNode)return!1;try{return ne(t,e.anchorNode)}catch(t){return!1}}function re(t){return 3==t.nodeType?me(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function oe(t,e,i,n){return!!i&&(le(t,e,i,n,-1)||le(t,e,i,n,1))}function ae(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function le(t,e,i,n,s){for(;;){if(t==i&&e==n)return!0;if(e==(s<0?0:he(t))){if("DIV"==t.nodeName)return!1;let i=t.parentNode;if(!i||1!=i.nodeType)return!1;e=ae(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?he(t):0}}}function he(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}const ce={left:0,right:0,top:0,bottom:0};function ue(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function de(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}class fe{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){this.set(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset)}set(t,e,i,n){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=n}}let pe,Oe=null;function ge(t){if(t.setActive)return t.setActive();if(Oe)return t.focus(Oe);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==Oe?{get preventScroll(){return Oe={preventScroll:!0},!0}}:void 0),!Oe){Oe=!1;for(let t=0;te)return i.domBoundsAround(t,e,l);if(c>=t&&-1==n&&(n=a,s=l),l>e&&i.dom.parentNode==this.dom){r=a,o=h;break}h=c,l=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.dirty|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.dirty|=2),1&e.dirty)return;e.dirty|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,this.dirty&&this.markParentsDirty(!0))}setDOM(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=ye){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 Qe(t,e,i,n,s,r,o,a,l){let{children:h}=t,c=h.length?h[e]:null,u=r.length?r[r.length-1]:null,d=u?u.breakAfter:o;if(!(e==n&&c&&!o&&!d&&r.length<2&&c.merge(i,s,r.length?u:null,0==i,a,l))){if(n0&&(!o&&r.length&&c.merge(i,c.length,r[0],!1,a,0)?c.breakAfter=r.shift().breakAfter:(i2);var De={mac:Me||/Mac/.test(Pe.platform),windows:/Win/.test(Pe.platform),linux:/Linux|X11/.test(Pe.platform),ie:Ae,ie_version:Xe?Ce.documentMode||6:Ze?+Ze[1]:_e?+_e[1]:0,gecko:Te,gecko_version:Te?+(/Firefox\/(\d+)/.exec(Pe.userAgent)||[0,0])[1]:0,chrome:!!Re,chrome_version:Re?+Re[1]:0,ios:Me,android:/Android\b/.test(Pe.userAgent),webkit:Ee,safari:Ve,webkit_version:Ee?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Ce.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class We extends Se{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(!i||i instanceof We&&!(this.length-(e-t)+i.length>256))&&(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),!0)}split(t){let e=new We(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new ve(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 Ye(this.dom,t,e)}}class Ue extends Se{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(we(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}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.dirty|=6)}sync(t,e){this.dom?4&this.dirty&&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 Ue&&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 Ue(this.mark,e,r)}domAtPos(t){return Ge(this,t)}coordsAt(t,e){return He(this,t,e)}}function Ye(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?De.chrome||De.gecko||(e?(s--,o=1):r=0)?0:a.length-1];return De.safari&&!o&&0==l.width&&(l=Array.prototype.find.call(a,(t=>t.width))||l),o?ue(l,o<0):l||null}class qe extends Se{constructor(t,e,i){super(),this.widget=t,this.length=e,this.side=i,this.prevWidget=null}static create(t,e,i){return new(t.customView||qe)(t,e,i)}split(t){let e=qe.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 qe&&this.widget.compare(i.widget))||t>0&&s<=0||e0)?ve.before(this.dom):ve.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let i=this.dom.getClientRects(),n=null;if(!i.length)return ce;for(let e=t>0?i.length-1:0;n=i[e],!(t>0?0==e:e==i.length-1||n.top0?-1:1);return this.length?n:ue(n,this.side>0)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class Le extends qe{domAtPos(t){let{topView:e,text:i}=this.widget;return e?ze(t,0,e,i,this.length-e.length,((t,e)=>t.domAtPos(e)),((t,e)=>new ve(t,Math.min(e,t.nodeValue.length)))):new ve(i,Math.min(t,i.nodeValue.length))}sync(){this.setDOM(this.widget.toDOM())}localPosFromDOM(t,e){let{topView:i,text:n}=this.widget;return i?Be(t,e,i,n,this.length-i.length):Math.min(e,this.length)}ignoreMutation(){return!1}get overrideDOMText(){return null}coordsAt(t,e){let{topView:i,text:n}=this.widget;return i?ze(t,e,i,n,this.length-i.length,((t,e,i)=>t.coordsAt(e,i)),((t,e,i)=>Ye(t,e,i))):Ye(n,t,e)}destroy(){var t;super.destroy(),null===(t=this.widget.topView)||void 0===t||t.destroy()}get isEditable(){return!0}canReuseDOM(){return!0}}function ze(t,e,i,n,s,r,o){if(i instanceof Ue){for(let a=i.dom.firstChild;a;a=a.nextSibling){let i=Se.get(a);if(i){let l=ne(a,n),h=i.length+(l?s:0);if(t0?ve.before(this.dom):ve.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){let e=this.dom.getBoundingClientRect(),i=function(t,e){let i=t.parent,n=i?i.children.indexOf(t):-1;for(;i&&n>=0;)if(e<0?n>0:n0?-1:1);return i&&i.tope.top?{left:e.left,right:e.right,top:i.top,bottom:i.bottom}:e}get overrideDOMText(){return t.empty}get isHidden(){return!0}}function Ge(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 Ue&&s.length&&(n=s[s.length-1])instanceof Ue&&n.mark.eq(e.mark)?Fe(n,e.children[0],i-1):(s.push(e),e.setParent(t)),t.length+=e.length}function He(t,e,i){let n=null,s=-1,r=null,o=-1;!function t(e,a){for(let l=0,h=0;l=a&&(c.children.length?t(c,a-h):(!r||r instanceof Ne&&i>0)&&(u>a||h==u&&c.getSide()>0)?(r=c,o=a-h):(h0?3e8:-4e8:e>0?1e8:-1e8,new oi(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}=ai(t,n);e=(s?n?-3e8:-1:5e8)-1,i=1+(r?n?2e8:1:-6e8)}return new oi(t,e,i,n,t.widget||null,!0)}static line(t){return new ri(t)}static set(t,e=!1){return _t.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}ni.none=_t.empty;class si extends ni{constructor(t){let{start:e,end:i}=ai(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){return this==t||t instanceof si&&this.tagName==t.tagName&&this.class==t.class&&Ke(this.attrs,t.attrs)}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}si.prototype.point=!1;class ri extends ni{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof ri&&this.spec.class==t.spec.class&&Ke(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)}}ri.prototype.mapMode=S.TrackBefore,ri.prototype.point=!0;class oi extends ni{constructor(t,e,i,n,s,r){super(e,i,s,t),this.block=n,this.isReplace=r,this.mapMode=n?e<=0?S.TrackBefore:S.TrackAfter:S.TrackDel}get type(){return this.startSide=5}eq(t){return t instanceof oi&&(e=this.widget,i=t.widget,e==i||!!(e&&i&&e.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var e,i}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 ai(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 li(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)}oi.prototype.point=!0;class hi extends Se{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 hi))return!1;this.dom||i.transferDOM(this)}return n&&this.setDeco(i?i.attrs:null),$e(this,t,e,i?i.children:[],s,r),!0}split(t){let e=new hi;if(e.breakAfter=this.breakAfter,0==this.length)return e;let{i: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){Ke(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){Fe(this,t,e)}addLineDeco(t){let e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=Je(e,this.attrs||{})),i&&(this.attrs=Je({class:i},this.attrs||{}))}domAtPos(t){return Ge(this,t)}reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.dirty|=6)}sync(t,e){var i;this.dom?4&this.dirty&&(we(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&&(ti(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&&Se.get(n)instanceof Ue;)n=n.lastChild;if(!(n&&this.length&&("BR"==n.nodeName||0!=(null===(i=Se.get(n))||void 0===i?void 0:i.isEditable)||De.ios&&this.children.some((t=>t instanceof We))))){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 We)||/[^ -~]/.test(i.text))return null;let n=re(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=He(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 hi)return s;if(r>e)break}n=r+s.breakAfter}return null}}class ci extends Se{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 ci&&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(di(new We(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 oi){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let o=e-t;if(i instanceof oi)if(i.block){let{type:t}=i;t!=ii.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new ci(i.widget||new fi("div"),o,t))}else{let r=qe.create(i.widget||new fi("span"),o,o?0:i.startSide),a=this.atCursorPos&&!r.isEditable&&s<=n.length&&(t0),l=!r.isEditable&&(tn.length||i.startSide<=0),h=this.getLine();2!=this.pendingBuffer||a||r.isEditable||(this.pendingBuffer=0),this.flushBuffer(n),a&&(h.append(di(new Ne(1),n),s),s=n.length+Math.max(0,s-n.length)),h.append(di(r,n),s),this.atCursorPos=l,this.pendingBuffer=l?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 ui(t,e,i,s);return r.openEnd=_t.spans(n,e,i,r),r.openStart<0&&(r.openStart=r.openEnd),r.finish(r.openEnd),r}}function di(t,e){for(let i of e)t=new Ue(i,[t],t.length);return t}class fi extends ei{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 pi=E.define(),Oi=E.define(),gi=E.define(),mi=E.define(),bi=E.define(),wi=E.define(),vi=E.define(),yi=E.define({combine:t=>t.some((t=>t))}),Si=E.define({combine:t=>t.some((t=>t))});class xi{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 xi(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin)}}const ki=ut.define({map:(t,e)=>t.map(e)});function Qi(t,e,i){let n=t.facet(mi);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 $i=E.define({combine:t=>!t.length||t[0]});let Pi=0;const Ci=E.define();class _i{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 _i(Pi++,t,i,(t=>{let e=[Ci.of(t)];return s&&e.push(Ti.of((e=>{let i=e.plugin(t);return i?s(i):ni.none}))),n&&e.push(n(t)),e}))}static fromClass(t,e){return _i.define((e=>new t(e)),e)}}class Xi{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(Qi(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){Qi(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){Qi(t.state,e,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Zi=E.define(),Ai=E.define(),Ti=E.define(),Ri=E.define(),Ei=E.define(),Vi=E.define();class Mi{constructor(t,e,i,n){this.fromA=t,this.toA=e,this.fromB=i,this.toB=n}join(t){return new Mi(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(!a)return i;new Mi(a.fromA,a.toA,a.fromB,a.toB).addToSet(i),r=a.toA,o=a.toB}}}class Di{constructor(t,e,i){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=k.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 Mi(t,e,i,s)))),this.changedRanges=n}static create(t,e,i){return new Di(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 Wi=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Wi||(Wi={}));const Ui=Wi.LTR,Yi=Wi.RTL;function qi(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}}const Gi=[];function Fi(t){return[new Ni(0,t,0)]}let Hi="";function Ji(t,e,i,n,s){var r;let o=n.head-t.from,a=-1;if(0==o){if(!s||!t.length)return null;e[0].level!=i&&(o=e[0].side(!1,i),a=0)}else if(o==t.length){if(s)return null;let t=e[e.length-1];t.level!=i&&(o=t.side(!0,i),a=e.length-1)}a<0&&(a=Ni.find(e,o,null!==(r=n.bidiLevel)&&void 0!==r?r:-1,n.assoc));let l=e[a];o==l.side(s,i)&&(l=e[a+=s?1:-1],o=l.side(!s,i));let h=s==(l.dir==i),c=f(t.text,o,h);if(Hi=t.text.slice(Math.min(o,c),Math.max(o,c)),c!=l.side(s,i))return A.cursor(c+t.from,h?-1:1,l.level);let u=a==(s?e.length-1:0)?null:e[a+(s?1:-1)];return u||l.level==i?u&&u.level1)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=Se.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 en(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}class nn{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class sn extends Se{constructor(t){super(),this.view=t,this.compositionDeco=ni.none,this.decorations=[],this.dynamicDecorationMap=[],this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(t.contentDOM),this.children=[new hi],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Mi(0,0,0,t.state.doc.length)],0)}get length(){return this.view.state.doc.length}update(t){let e=t.changedRanges;this.minWidth>0&&e.length&&(e.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),this.view.inputState.composing<0?this.compositionDeco=ni.none:(t.transactions.length||this.dirty)&&(this.compositionDeco=function(t,e){let i=on(t);if(!i)return ni.none;let{from:n,to:s,node:r,text:o}=i,a=e.mapPos(n,1),l=Math.max(a,e.mapPos(s,-1)),{state:h}=t,c=3==r.nodeType?r.nodeValue:new tn([],h).readRange(r.firstChild,null).text;if(l-a{this.dom.style.height=this.view.viewState.contentHeight+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let t=De.chrome||De.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,t),this.dirty=0,t&&(t.written||i.selectionRange.focusNode!=t.node)&&(this.forceSelection=!0),this.dom.style.height=""}));let n=[];if(this.view.viewport.from||this.view.viewport.to=0?t[e]:null;if(!n)break;let{fromA:s,toA:r,fromB:o,toB:a}=n,{content:l,breakAtStart:h,openStart:c,openEnd:u}=ui.build(this.view.state.doc,o,a,this.decorations,this.dynamicDecorationMap),{i:d,off:f}=i.findPos(r,1),{i:p,off:O}=i.findPos(s,-1);Qe(this,p,O,d,f,l,h,c,u)}}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&&se(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,a=this.domAtPos(o.anchor),l=o.empty?a:this.domAtPos(o.head);if(De.gecko&&o.empty&&!this.compositionDeco.size&&(1==(h=a).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((()=>a.node.insertBefore(t,a.node.childNodes[a.offset]||null))),a=l=new ve(t,0),r=!0}var h;let c=this.view.observer.selectionRange;!r&&c.focusNode&&oe(a.node,a.offset,c.anchorNode,c.anchorOffset)&&oe(l.node,l.offset,c.focusNode,c.focusOffset)||(this.view.observer.ignore((()=>{De.android&&De.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=ie(this.view.root);if(t)if(o.empty){if(De.gecko){let t=(e=a.node,n=a.offset,1!=e.nodeType?0:(n&&"false"==e.childNodes[n-1].contentEditable?1:0)|(no.head&&([a,l]=[l,a]),e.setEnd(l.node,l.offset),e.setStart(a.node,a.offset),t.removeAllRanges(),t.addRange(e)}else;var e,n;s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())})),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new ve(c.anchorNode,c.anchorOffset),this.impreciseHead=l.precise?null:new ve(c.focusNode,c.focusOffset)}enforceCursorAssoc(){if(this.compositionDeco.size)return;let{view:t}=this,e=t.state.selection.main,i=ie(t.root),{anchorNode:n,anchorOffset:s}=t.observer.selectionRange;if(!(i&&e.empty&&e.assoc&&i.modify))return;let r=hi.find(this,e.head);if(!r)return;let o=r.posAtStart;if(e.head==o||e.head==o+r.length)return;let a=this.coordsAt(e.head,-1),l=this.coordsAt(e.head,1);if(!a||!l||a.bottom>l.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)}nearest(t){for(let e=t;e;){let t=Se.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!=ii.WidgetBefore&&s.type!=ii.WidgetAfter&&(!n||2==e||this.children[n-1].breakAfter||this.children[n-1].type==ii.WidgetBefore&&e>-2))return s.coordsAt(t-r,e);i=r}}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,a=this.view.textDirection==Wi.LTR;for(let t=0,l=0;ln)break;if(t>=i){let i=h.dom.getBoundingClientRect();if(e.push(i.height),r){let e=h.dom.lastChild,n=e?re(e):[];if(n.length){let e=n[n.length-1],r=a?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?Wi.RTL:Wi.LTR}measureTextSize(){for(let t of this.children)if(t instanceof hi){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.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(n);let s=re(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 ke(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;t.push(ni.replace({widget:new rn(n),block:!0,inclusive:!0,isBlockGap:!0}).range(i,r))}if(!s)break;i=s.to+1}return ni.set(t)}updateDeco(){let t=this.view.state.facet(Ti).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=0,r=0,o=0,a=0;for(let t of this.view.state.facet(Ei).map((t=>t(this.view))))if(t){let{left:e,right:i,top:n,bottom:l}=t;null!=e&&(s=Math.max(s,e)),null!=i&&(r=Math.max(r,i)),null!=n&&(o=Math.max(o,n)),null!=l&&(a=Math.max(a,l))}let l={left:n.left-s,top:n.top-o,right:n.right+r,bottom:n.bottom+a};!function(t,e,i,n,s,r,o,a){let l=t.ownerDocument,h=l.defaultView||window;for(let c=t;c;)if(1==c.nodeType){let t,u=c==l.body;if(u)t=de(h);else{if(c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let e=c.getBoundingClientRect();t={left:e.left,right:e.left+c.clientWidth,top:e.top,bottom:e.top+c.clientHeight}}let d=0,f=0;if("nearest"==s)e.top0&&e.bottom>t.bottom+f&&(f=e.bottom-t.bottom+f+o)):e.bottom>t.bottom&&(f=e.bottom-t.bottom+o,i<0&&e.top-f0&&e.right>t.right+d&&(d=e.right-t.right+d+r)):e.right>t.right&&(d=e.right-t.right+r,i<0&&e.left0))break;i=i.childNodes[n-1],n=he(i)}if(i>=0)for(let n=t,s=e;;){if(3==n.nodeType)return n;if(!(1==n.nodeType&&s=0))break;n=n.childNodes[s],s=0}return null}class hn{constructor(){this.changes=[]}compareRange(t,e){li(t,e,this.changes)}comparePoint(t,e){li(t,e,this.changes)}}function cn(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function un(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function dn(t,e){return t.tope.top+1}function fn(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,a,l,h,c,u=!1;for(let d=t.firstChild;d;d=d.nextSibling){let t=re(d);for(let f=0;fg||o==g&&r>O){n=d,s=p,r=O,o=g;let a=g?i0?f0)}0==O?i>p.bottom&&(!h||h.bottomp.top)&&(l=d,c=p):h&&dn(h,p)?h=pn(h,p.bottom):c&&dn(c,p)&&(c=fn(c,p.top))}}if(h&&h.bottom>=i?(n=a,s=h):c&&c.top<=i&&(n=l,s=c),!n)return{node:t,offset:0};let d=Math.max(s.left,Math.min(s.right,e));return 3==n.nodeType?gn(n,d,i):u&&"false"!=n.contentEditable?On(n,d,i):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,n)+(e>=(s.left+s.right)/2?1:0)}}function gn(t,e,i){let n=t.nodeValue.length,s=-1,r=1e9,o=0;for(let a=0;ai?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(De.chrome||De.gecko){me(t,a).getBoundingClientRect().left==h.right&&(n=!i)}if(c<=0)return{node:t,offset:a+(n?1:0)};s=a+(n?1:0),r=c}}}return{node:t,offset:s>-1?s:o>0?t.nodeValue.length:0}}function mn(t,e,i,n=-1){var s,r;let o,a=t.contentDOM.getBoundingClientRect(),l=a.top+t.viewState.paddingTop,{docHeight:h}=t.viewState,{x:c,y:u}=e,d=u-l;if(d<0)return 0;if(d>h)return t.state.doc.length;for(let e=t.defaultLineHeight/2,s=!1;o=t.elementAtHeight(d),o.type!=ii.Text;)for(;d=n>0?o.bottom+e:o.top-e,!(d>=0&&d<=h);){if(s)return i?null:0;s=!0,n=-n}u=l+d;let f=o.from;if(ft.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:bn(t,a,o,c,u);let p=t.dom.ownerDocument,O=t.root.elementFromPoint?t.root:p,g=O.elementFromPoint(c,u);g&&!t.contentDOM.contains(g)&&(g=null),g||(c=Math.max(a.left+1,Math.min(a.right-1,c)),g=O.elementFromPoint(c,u),g&&!t.contentDOM.contains(g)&&(g=null));let m,b=-1;if(g&&0!=(null===(s=t.docView.nearest(g))||void 0===s?void 0:s.isEditable))if(p.caretPositionFromPoint){let t=p.caretPositionFromPoint(c,u);t&&({offsetNode:m,offset:b}=t)}else if(p.caretRangeFromPoint){let e=p.caretRangeFromPoint(c,u);e&&(({startContainer:m,startOffset:b}=e),(!t.contentDOM.contains(m)||De.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 me(t,n-1,n).getBoundingClientRect().left>i}(m,b,c)||De.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}let n=1==t.nodeType?t.getBoundingClientRect():me(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return i-n.left>5}(m,b,c))&&(m=void 0))}if(!m||!t.docView.dom.contains(m)){let e=hi.find(t.docView,f);if(!e)return d>o.top+o.height/2?o.to:o.from;({node:m,offset:b}=On(e.dom,c,u))}let w=t.docView.nearest(m);if(!w)return null;if(w.isWidget&&1==(null===(r=w.dom)||void 0===r?void 0:r.nodeType)){let t=w.dom.getBoundingClientRect();return e.y1.5*t.defaultLineHeight){r+=Math.floor((s-i.top)/t.defaultLineHeight)*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=f(t,n)}return!0===n?-1:t.length}(o,r,t.state.tabSize)}function wn(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=t.bidiSpans(s),o=t.textDirectionAt(s.from);for(let a=e,l=null;;){let e=Ji(s,r,o,a,i),h=Hi;if(!e){if(s.number==(i?t.state.doc.lines:1))return a;h="\n",s=t.state.doc.line(s.number+(i?1:-1)),r=t.bidiSpans(s),e=A.cursor(i?s.from:s.to)}if(l){if(!l(h))return a}else{if(!n)return e;l=n(h)}a=e}}function vn(t,e,i,n){let s=t.state.facet(Ri).map((e=>e(t)));for(;;){let t=!1;for(let r of s)r.between(i.from-1,i.from+1,((s,r,o)=>{i.from>s&&i.fromi.from?A.cursor(s,1):A.cursor(r,-1),t=!0,o.widget.skipPosition&&(i=o.widget.skipPosition(i,e,n)))}));if(!t)return i}}class yn{constructor(t){this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null;let e=(e,i)=>{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 Cn){let n=Cn[i];t.contentDOM.addEventListener(i,(i=>{Pn(t,i)&&e(n,i)}),_n[i]),this.registeredEvents.push(i)}t.scrollDOM.addEventListener("mousedown",(i=>{if(i.target==t.scrollDOM&&i.clientY>t.contentDOM.getBoundingClientRect().bottom&&(e(Cn.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)}})),De.chrome&&102==De.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,De.safari&&t.contentDOM.addEventListener("input",(()=>null))}setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}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=>{Pn(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){Qi(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){Qi(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||xn.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,be(t.contentDOM,e.key,e.keyCode))}ignoreDuringComposition(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(De.safari&&!De.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 Sn=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],xn="dthko",kn=[16,17,18,20,91,92,224,225];function Qn(t){return.7*Math.max(0,t)+8}class $n{constructor(t,e,i,n){this.view=t,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);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(xt.allowMultipleSelections)&&function(t,e){let i=t.state.facet(pi);return i.length?i[0](e):(De.mac,e.altKey)}(t,e),this.dragMove=function(t,e){let i=t.state.facet(Oi);return i.length?i[0](e):De.mac?!e.altKey:!e.ctrlKey}(t,e),this.dragging=!(!function(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let n=ie(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!=Yn(e))&&null}start(t){!1===this.dragging&&(t.preventDefault(),this.select(t))}move(t){var e;if(0==t.buttons)return this.destroy();if(!1!==this.dragging)return;this.select(this.lastEvent=t);let i=0,n=0,s=(null===(e=this.scrollParent)||void 0===e?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight};t.clientX<=s.left+6?i=-Qn(s.left-t.clientX):t.clientX>=s.right-6&&(i=Qn(t.clientX-s.right)),t.clientY<=s.top+6?n=-Qn(s.top-t.clientY):t.clientY>=s.bottom-6&&(n=Qn(t.clientY-s.bottom)),this.setScrollSpeed(i,n)}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)}select(t){let e=this.style.get(t,this.extend,this.multiple);!this.mustSelect&&e.eq(this.view.state.selection)&&e.main.assoc==this.view.state.selection.main.assoc||this.view.dispatch({selection:e,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.docChanged&&this.dragging&&(this.dragging=this.dragging.map(t.changes)),this.style.update(t)&&setTimeout((()=>this.select(this.lastEvent)),20)}}function Pn(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=Se.get(n))&&i.ignoreEvent(e))return!1;return!0}const Cn=Object.create(null),_n=Object.create(null),Xn=De.ie&&De.ie_version<15||De.ios&&De.webkit_version<604;function Zn(t,e){let i,{state:n}=t,s=1,r=n.toText(e),o=r.lines==n.selection.ranges.length;if(null!=Ln&&n.selection.ranges.every((t=>t.empty))&&Ln==r.toString()){let t=-1;i=n.changeByRange((i=>{let a=n.doc.lineAt(i.from);if(a.from==t)return{range:i};t=a.from;let l=n.toText((o?r.line(s++).text:e)+n.lineBreak);return{changes:{from:a.from,insert:l},range:A.cursor(i.from+l.length)}}))}else i=o?n.changeByRange((t=>{let e=r.line(s++);return{changes:{from:t.from,to:t.to,insert:e.text},range:A.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 A.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 A.cursor(e);0==r?i=1:r==s.length&&(i=-1);let o=r,a=r;i<0?o=f(s.text,r,!1):a=f(s.text,r);let l=n(s.text.slice(o,a));for(;o>0;){let t=f(s.text,o,!1);if(n(s.text.slice(t,o))!=l)break;o=t}for(;a{t.inputState.setSelectionOrigin("select"),27==e.keyCode&&(t.inputState.lastEscPress=Date.now())},Cn.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},Cn.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},_n.touchstart=_n.touchmove={passive:!0},Cn.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return;let i=null;for(let n of t.state.facet(gi))if(i=n(t,e),i)break;if(i||0!=e.button||(i=function(t,e){let i=Vn(t,e),n=Yn(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 a,l=Vn(t,e),h=An(t,l.pos,l.bias,n);if(i.pos!=l.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&&(a=function(t,e){for(let i=0;i=e)return A.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,l.pos))?a:o?s.addRange(h):A.create([h])}}}(t,e)),i){let n=t.root.activeElement!=t.contentDOM;t.inputState.startMouseSelection(new $n(t,e,i,n)),n&&t.observer.ignore((()=>ge(t.contentDOM))),t.inputState.mouseSelection&&t.inputState.mouseSelection.start(e)}};let Tn=(t,e)=>t>=e.top&&t<=e.bottom,Rn=(t,e,i)=>Tn(e,i)&&t>=i.left&&t<=i.right;function En(t,e,i,n){let s=hi.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&&Rn(i,n,o))return-1;let a=s.coordsAt(r,1);return a&&Rn(i,n,a)?1:o&&Tn(n,o)?-1:1}function Vn(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:En(t,i,e.clientX,e.clientY)}}const Mn=De.ie&&De.ie_version<=11;let Dn=null,Wn=0,Un=0;function Yn(t){if(!Mn)return t.detail;let e=Dn,i=Un;return Dn=t,Un=Date.now(),Wn=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Wn+1)%3:1}function qn(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&&r.dragMove?{from:r.dragging.from,to:r.dragging.to}:null,a={from:s,insert:i},l=t.state.changes(o?[o,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(s,-1),head:l.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"})}Cn.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")},Cn.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&&qn(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 qn(t,e,e.dataTransfer.getData("Text"),!0)},Cn.paste=(t,e)=>{if(t.state.readOnly)return e.preventDefault();t.observer.flush();let i=Xn?null:e.clipboardData;i?(Zn(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(),Zn(t,i.value)}),50)}(t)};let Ln=null;Cn.copy=Cn.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;Ln=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 zn=lt.define();function In(t,e){let i=[];for(let n of t.facet(vi)){let s=n(t,e);s&&i.push(s)}return i?t.update({effects:i,annotations:zn.of(!0)}):null}function Bn(t){setTimeout((()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=In(t.state,e);i?t.dispatch(i):t.update([])}}),10)}Cn.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),Bn(t)},Cn.blur=t=>{t.observer.clearSelectionRange(),Bn(t)},Cn.compositionstart=Cn.compositionupdate=t=>{null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},Cn.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,De.chrome&&De.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then((()=>t.observer.flush())):setTimeout((()=>{t.inputState.composing<0&&t.docView.compositionDeco.size&&t.update([])}),50)},Cn.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},Cn.beforeinput=(t,e)=>{var i;let n;if(De.chrome&&De.android&&(n=Sn.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 jn=["pre-wrap","normal","pre-line","break-spaces"];class Nn{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){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return jn.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i-1,a=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,a){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)>Jn&&(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:a,toA:l,fromB:h,toB:c}=n[o],u=s.lineAt(a,Hn.ByPosNoHeight,i.setDoc(e),0,0),d=u.to>=l?u:s.lineAt(l,Hn.ByPosNoHeight,i,0,0);for(c+=d.to-l,l=d.to;o>0&&u.from<=n[o-1].toA;)a=n[o-1].fromA,h=n[o-1].fromB,o--,a2*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 es extends ts{constructor(t,e){super(t,e,ii.Text),this.collapsed=0,this.widgetHeight=0}replace(t,e,i){let n=i[0];return 1==i.length&&(n instanceof es||n instanceof is&&4&n.flags)&&Math.abs(this.length-n.length)<10?(n instanceof is?n=new es(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.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class is 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:a}=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),l=o+r.length*a,h=Math.max(i,t-l/2);return new Fn(r.from,r.length,h,l,ii.Text)}{let n=Math.max(0,Math.min(r-s,Math.floor((t-i)/o))),{from:a,length:l}=e.doc.line(s+n);return new Fn(a,l,i+o*n,o,ii.Text)}}lineAt(t,e,i,n,s){if(e==Hn.ByHeight)return this.blockAt(t,i,n,s);if(e==Hn.ByPosNoHeight){let{from:e,to:n}=i.doc.lineAt(t);return new Fn(e,n-e,0,0,ii.Text)}let{firstLine:r,perLine:o,perChar:a}=this.heightMetrics(i,s),l=i.doc.lineAt(t),h=o+l.length*a,c=l.number-r,u=n+o*c+a*(l.from-s-c);return new Fn(l.from,l.length,Math.max(n,Math.min(u,n+this.height-h)),h,ii.Text)}forEachLine(t,e,i,n,s,r){t=Math.max(t,s),e=Math.min(e,s+this.length);let{firstLine:o,perLine:a,perChar:l}=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+=a*i+l*(t-s-i)}let n=a+l*e.length;r(new Fn(e.from,e.length,c,n,ii.Text)),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 is?i[i.length-1]=new is(t.length+n):i.push(null,new is(n-1))}if(t>0){let e=i[0];e instanceof is?i[0]=new is(t+e.length):i.unshift(new is(t-1),null)}return Kn.of(i)}decomposeLeft(t,e){e.push(new is(t-1),null)}decomposeRight(t,e){e.push(null,new is(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 is(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)>=Jn&&(o=-2);let a=new es(e,s);a.outdated=!1,i.push(a),r+=e+1}r<=s&&i.push(null,new is(s-r).updateHeight(t,r));let a=Kn.of(i);return(o<0||Math.abs(a.height-this.height)>=Jn||Math.abs(o-this.heightMetrics(t,e).perLine)>=Jn)&&(t.heightChanged=!0),a}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class ns 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 l;let h=e==Hn.ByPosNoHeight?Hn.ByPosNoHeight:Hn.ByPos;return a?l.join(this.right.lineAt(o,h,i,r,o)):this.left.lineAt(o,h,i,n,s).join(l)}forEachLine(t,e,i,n,s,r){let o=n+this.left.height,a=s+this.left.length+this.break;if(this.break)t=a&&this.right.forEachLine(t,e,i,o,a,r);else{let l=this.lineAt(a,Hn.ByPos,i,n,s);t=t&&l.from<=e&&r(l),e>l.to&&this.right.forEachLine(l.to+1,e,i,o,a,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&&ss(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,a=null;return n&&n.from<=e+s.length&&n.more?a=s=s.updateHeight(t,e,i,n):s.updateHeight(t,e,i),n&&n.from<=o+r.length&&n.more?a=r=r.updateHeight(t,o,i,n):r.updateHeight(t,o,i),a?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 ss(t,e){let i,n;null==t[e]&&(i=t[e-1])instanceof is&&(n=t[e+1])instanceof is&&t.splice(e-1,3,new is(i.length+1+n.length))}class rs{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 es?i.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new es(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)}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 es(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let i=new is(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 es)return t;let e=new es(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine(),t.type!=ii.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,t.type!=ii.WidgetBefore&&(this.covering=t)}addLineDeco(t,e){let i=this.ensureLine();i.length+=e,i.collapsed+=e,i.widgetHeight=Math.max(i.widgetHeight,t),this.writtenTo=this.pos=this.pos+e}finish(t){let e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof es||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),a=Math.max(a,n.top),l=e==t.parentNode?n.bottom:Math.min(l,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:a-(i.top+e),bottom:Math.max(a,l)-(i.top+e)}}function ls(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class hs{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 Nn(i),this.stateDeco=e.facet(Ti).filter((t=>"function"!=typeof t)),this.heightMap=Kn.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle.setDoc(e.doc),[new Mi(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ni.set(this.lineGaps.map((t=>t.draw(!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 ds(e,i))}}this.viewports=t.sort(((t,e)=>t.from-e.from)),this.scaler=this.heightMap.height<=7e6?gs:new ms(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:bs(t,this.scaler))}))}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=this.state.facet(Ti).filter((t=>"function"!=typeof t));let n=t.changedRanges,s=Mi.extendWithRanges(n,function(t,e,i){let n=new os;return _t.compare(t,e,i,n,0),n.changes}(i,this.stateDeco,t?t.changes:k.empty(this.state.doc.length))),r=this.heightMap.height;this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),s),this.heightMap.height!=r&&(t.flags|=2);let o=s.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.heado.to)||!this.viewportIsAppropriate(o))&&(o=this.getViewport(0,e));let a=!t.changes.empty||2&t.flags||o.from!=this.viewport.from||o.to!=this.viewport.to;this.viewport=o,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(Si)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let i=e.contentDOM,n=window.getComputedStyle(i),s=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Wi.RTL:Wi.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),a=i.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let h=0,c=0,u=parseInt(n.paddingTop)||0,d=parseInt(n.paddingBottom)||0;this.paddingTop==u&&this.paddingBottom==d||(this.paddingTop=u,this.paddingBottom=d,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let f=(this.printing?ls:as)(i,this.paddingTop),p=f.top-this.pixelViewport.top,O=f.bottom-this.pixelViewport.bottom;this.pixelViewport=f;let g=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(g!=this.inView&&(this.inView=g,g&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let m=a.width;if(this.contentDOMWidth==m&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,h|=8),l){let i=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(i)&&(o=!0),o||s.lineWrapping&&Math.abs(m-this.contentDOMWidth)>s.charWidth){let{lineHeight:t,charWidth:n,textHeight:a}=e.docView.measureTextSize();o=t>0&&s.refresh(r,t,n,a,m/n,i),o&&(e.docView.minWidth=0,h|=8)}p>0&&O>0?c=Math.max(p,O):p<0&&O<0&&(c=Math.min(p,O)),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 Mi(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new Gn(n.from,r))}s.heightChanged&&(h|=2)}let b=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return b&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(2&h||b)&&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,a=new ds(n.lineAt(r-1e3*i,Hn.ByHeight,s,0,0).from,n.lineAt(o+1e3*(1-i),Hn.ByHeight,s,0,0).to);if(e){let{head:t}=e.range;if(ta.to){let i,r=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=n.lineAt(t,Hn.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!=Wi.LTR&&!i)return[];let o=[],a=(n,r,l,h)=>{if(r-nn&&tt.from>=l.from&&t.to<=l.to&&Math.abs(t.from-n)t.frome))));if(!d){if(rt.from<=r&&t.to>=r))){let t=e.moveToLineBoundary(A.cursor(r),!1,!0).head;t>n&&(r=t)}d=new hs(n,r,this.gapSize(l,n,r,h))}o.push(d)};for(let t of this.viewportLines){if(t.lengtht.from&&a(t.from,s,t,e),ot.draw(this.heightOracle.lineWrapping)))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];_t.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))||bs(this.heightMap.lineAt(t,Hn.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return bs(this.heightMap.lineAt(this.scaler.fromDOM(t),Hn.ByHeight,this.heightOracle,0,0),this.scaler)}elementAtHeight(t){return bs(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 ds{constructor(t,e){this.from=t,this.to=e}}function fs(t,e,i){let n=[],s=t,r=0;return _t.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 Os(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 gs={toDOM:t=>t,fromDOM:t=>t,scale:1};class ms{constructor(t,e,i){let n=0,s=0,r=0;this.viewports=i.map((({from:i,to:s})=>{let r=e.lineAt(i,Hn.ByPos,t,0,0).top,o=e.lineAt(s,Hn.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=ebs(t,e))):t.type)}const ws=E.define({combine:t=>t.join(" ")}),vs=E.define({combine:t=>t.indexOf(!0)>-1}),ys=It.newName(),Ss=It.newName(),xs=It.newName(),ks={"&light":"."+Ss,"&dark":"."+xs};function Qs(t,e,i){return new It(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 $s=Qs("."+ys,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",borderRadius:"4px",marginTop:"0.5rem",width:"30%",minWidth:"190px",marginLeft:"auto",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&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:"#333338",fontSize:"70%",padding:".2em 1em",borderRadius:"4px"},"&light .cm-button":{background:"#eee"},"&dark .cm-button":{background:"#eee"},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",borderRadius:"0.25rem",border:"1px solid silver",padding:".0em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},ks);class Ps{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;i&&(e.push(new nn(i,n)),s==i&&r==n||e.push(new nn(s,r)));return e}(t),i=new tn(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?A.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||!ne(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||!ne(t.contentDOM,e.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(e.anchorNode,e.anchorOffset);this.newSel=A.single(n,i)}}}function Cs(e,i){let n,{newSel:s}=i,r=e.state.selection.main;if(i.bounds){let{from:s,to:o}=i.bounds,a=r.from,l=null;(8===e.inputState.lastKeyCode&&e.inputState.lastKeyTime>Date.now()-100||De.android&&i.text.length0&&a>0&&t.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if("end"==n){i-=o+Math.max(0,r-Math.min(o,a))-r}if(o=o?r-i:0,a=r+(a-o),o=r}else if(a=a?r-i:0,o=r+(o-a),a=r}return{from:r,toA:o,toB:a}}(e.state.doc.sliceString(s,o,Ki),i.text,a-s,l);h&&(De.chrome&&13==e.inputState.lastKeyCode&&h.toB==h.from+2&&i.text.slice(h.from,h.toB)==Ki+Ki&&h.toB--,n={from:s+h.from,to:s+h.toA,insert:t.of(i.text.slice(h.from,h.toB).split(Ki))})}else s&&(!e.hasFocus&&e.state.facet($i)||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))}:(De.mac||De.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=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}):De.chrome&&n&&n.from==n.to&&n.from==r.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(s&&(s=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}),n){let t=e.state;if(De.ios&&e.inputState.flushIOSKey(e))return!0;if(De.android&&(n.from==r.from&&n.to==r.to&&1==n.insert.length&&2==n.insert.lines&&be(e.contentDOM,"Enter",13)||n.from==r.from-1&&n.to==r.to&&0==n.insert.length&&be(e.contentDOM,"Backspace",8)||n.from==r.from&&n.to==r.to+1&&0==n.insert.length&&be(e.contentDOM,"Delete",46)))return!0;let i,o=n.insert.toString();if(e.state.facet(wi).some((t=>t(e,n.from,n.to,o))))return!0;if(e.inputState.composing>=0&&e.inputState.composing++,n.from>=r.from&&n.to<=r.to&&n.to-n.from>=(r.to-r.from)/3&&(!s||s.main.empty&&s.main.from==n.from+n.insert.length)&&e.inputState.composing<0){let s=r.fromn.to?t.sliceDoc(n.to,r.to):"";i=t.replaceSelection(e.state.toText(s+n.insert.sliceString(0,void 0,e.state.lineBreak)+o))}else{let o=t.changes(n),a=s&&s.main.to<=o.newLength?s.main:void 0;if(t.selection.ranges.length>1&&e.inputState.composing>=0&&n.to<=r.to&&n.to>=r.to-10){let s=e.state.sliceDoc(n.from,n.to),l=on(e)||e.state.doc.lineAt(r.head),h=r.to-n.to,c=r.to-r.from;i=t.changeByRange((i=>{if(i.from==r.from&&i.to==r.to)return{changes:o,range:a||i.map(o)};let u=i.to-h,d=u-s.length;if(i.to-i.from!=c||e.state.sliceDoc(d,u)!=s||l&&i.to>=l.from&&i.from<=l.to)return{range:i};let f=t.changes({from:d,to:u,insert:n.insert}),p=i.to-r.to;return{changes:f,range:a?A.range(Math.max(0,a.anchor+p),Math.max(0,a.head+p)):i.map(f)}}))}else i={changes:o,selection:a&&t.selection.replaceRange(a)}}let a="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,a+=".compose",e.inputState.compositionFirstChange&&(a+=".start",e.inputState.compositionFirstChange=!1)),e.dispatch(i,{scrollIntoView:!0,userEvent:a}),!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 _s={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Xs=De.ie&&De.ie_version<=11;class Zs{constructor(t){this.view=t,this.active=!1,this.selectionRange=new fe,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);(De.ie&&De.ie_version<=11||De.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()})),Xs&&(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")))}),{}),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($i)?i.root.activeElement!=this.dom:!se(i.dom,n))return;let s=n.anchorNode&&i.docView.nearest(n.anchorNode);s&&s.ignoreEvent(t)?e||(this.selectionChanged=!1):(De.ie&&De.ie_version<=11||De.android&&De.chrome)&&!i.state.selection.main.empty&&n.focusNode&&oe(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=De.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,a=t.docView.domAtPos(t.state.selection.main.anchor);oe(a.node,a.offset,r,o)&&([n,s,r,o]=[r,o,n,s]);return{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:o}}(this.view)||ie(t.root);if(!e||this.selectionRange.eq(e))return!1;let i=se(this.dom,e);return i&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let t=this.delayedAndroidKey;t&&(this.clearDelayedAndroidKey(),!this.flush()&&t.force&&be(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&&se(this.dom,this.selectionRange);return t<0&&!n?null:(t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new Ps(this.view,t,e,i))}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=Cs(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.dirty|=4),"childList"==t.type){let i=As(e,t.previousSibling||t.target.previousSibling,-1),n=As(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 As(t,e,i){for(;e;){let n=Se.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 Ts{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),this._dispatch=t.dispatch||(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 us(t.state||xt.create(t)),this.plugins=this.state.facet(Ci).map((t=>new Xi(t)));for(let t of this.plugins)t.update(this);this.observer=new Zs(this),this.inputState=new yn(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new sn(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),t.parent&&t.parent.appendChild(this.dom)}get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}dispatch(...t){this._dispatch(1==t.length&&t[0]instanceof dt?t[0]:this.state.update(...t))}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,a=null;t.some((t=>t.annotation(zn)))?(this.inputState.notifiedFocused=r,o=1):r!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=r,a=In(s,r),a||(o=1));let l=this.observer.delayedAndroidKey,h=null;if(l?(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(xt.phrases)!=this.state.facet(xt.phrases))return this.setState(s);e=Di.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 xi(t.empty?t:A.cursor(t.head,t.head>t.anchor?-1:1))}for(let t of e.effects)t.is(ki)&&(c=t.value)}this.viewState.update(e,c),this.bidiCache=Vs.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),i=this.docView.update(e),this.state.facet(Vi)!=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(ws)!=e.state.facet(ws)&&(this.viewState.mustMeasureContent=!0),(i||n||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!e.empty)for(let t of this.state.facet(bi))t(e);(a||h)&&Promise.resolve().then((()=>{a&&this.state==a.startState&&this.dispatch(a),h&&!Cs(this,h)&&l.force&&be(this.contentDOM,l.key,l.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 us(t),this.plugins=t.facet(Ci).map((t=>new Xi(t))),this.pluginMap.clear();for(let t of this.plugins)t.update(this);this.docView=new sn(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(Ci),i=t.state.facet(Ci);if(e!=i){let n=[];for(let s of i){let i=e.indexOf(s);if(i<0)n.push(new Xi(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.measureScheduled=0,t&&this.observer.forceFlush();let e=null,{scrollHeight:i,scrollTop:n,clientHeight:s}=this.scrollDOM,r=n>i-s-4?i:n;try{for(let t=0;;t++){this.updateState=1;let i=this.viewport,n=this.viewState.lineBlockAtHeight(r),s=this.viewState.measure(this);if(!s&&!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 o=[];4&s||([this.measureRequests,o]=[o,this.measureRequests]);let a=o.map((t=>{try{return t.read(this)}catch(t){return Qi(this.state,t),Es}})),l=Di.create(this,this.state,[]),h=!1,c=!1;l.flags|=s,e?e.flags|=s:e=l,this.updateState=2,l.empty||(this.updatePlugins(l),this.inputState.update(l),this.updateAttrs(),h=this.docView.update(l));for(let t=0;t1||t<-1)&&(this.scrollDOM.scrollTop+=t,c=!0)}if(h&&this.docView.updateSelection(!0),this.viewport.from==i.from&&this.viewport.to==i.to&&!c&&0==this.measureRequests.length)break}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let t of this.state.facet(bi))t(e)}get themeClasses(){return ys+" "+(this.state.facet(vs)?xs:Ss)+" "+this.state.facet(ws)}updateAttrs(){let t=Ms(this,Zi,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet($i)?"true":"false",class:"cm-content",style:`${De.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Ms(this,Ai,e);let i=this.observer.ignore((()=>{let i=ti(this.contentDOM,this.contentAttrs,e),n=ti(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)if(t.is(Ts.announce)){e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(Vi),It.mount(this.root,this.styleModules.concat($s).reverse())}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}}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 vn(this,t,wn(this,t,e,i))}moveByCharSelected(t,e,i){return vn(this,t,wn(this,t,e,i),!0)}moveByGroup(t,e){return vn(this,t,wn(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==wt.Space&&(s=e),s==e}}(this,t.head,e))))}moveToLineBoundary(t,e,i=!0){return function(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=n&&t.lineWrapping?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==Wi.LTR)?e.right-1:e.left+1,y:(r.top+r.bottom)/2});if(null!=o)return A.cursor(o,i?-1:1)}let o=hi.find(t.docView,e.head),a=o?i?o.posAtEnd:o.posAtStart:i?s.to:s.from;return A.cursor(a,i?-1:1)}(this,t,e,i)}moveVertically(t,e,i){return vn(this,t,function(t,e,i,n){let s=e.head,r=i?1:-1;if(s==(i?t.state.doc.length:0))return A.cursor(s,e.assoc);let o,a=e.goalColumn,l=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s),c=t.documentTop;if(h)null==a&&(a=h.left-l.left),o=r<0?h.top:h.bottom;else{let e=t.viewState.lineBlockAt(s);null==a&&(a=Math.min(l.right-l.left,t.defaultCharacterWidth*(s-e.from))),o=(r<0?e.top:e.bottom)+c}let u=l.left+a,d=null!=n?n:t.defaultLineHeight>>1;for(let i=0;;i+=10){let n=o+(d+i)*r,h=mn(t,{x:u,y:n},!1,r);if(nl.bottom||(r<0?hs))return A.cursor(h,e.assoc,void 0,a)}}(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(),mn(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 ue(i,s[Ni.find(s,t-n.from,-1,e)].dir==Wi.LTR==e>0)}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(yi)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Rs)return Fi(t.length);let e=this.textDirectionAt(t.from);for(let i of this.bidiCache)if(i.from==t.from&&i.dir==e)return i.order;let i=function(t,e){let i=t.length,n=e==Ui?1:2,s=e==Ui?2:1;if(!t||1==n&&!ji.test(t))return Fi(i);for(let e=0,s=n,o=n;e=0;t-=3)if(Bi[t+1]==-r){let e=Bi[t+2],i=2&e?n:4&e?1&e?s:n:0;i&&(Gi[a]=Gi[Bi[t]]=i),l=t;break}}else{if(189==Bi.length)break;Bi[l++]=a,Bi[l++]=e,Bi[l++]=h}else if(2==(o=Gi[a])||1==o){let t=o==n;h=t?0:1;for(let e=l-3;e>=0;e-=3){let i=Bi[e+2];if(2&i)break;if(t)Bi[e+2]|=2;else{if(4&i)break;Bi[e+2]|=4}}}for(let t=0;te;){let t=i,n=2!=Gi[--i];for(;i>e&&n==(2!=Gi[i-1]);)i--;o.push(new Ni(i,t,n?2:1))}else o.push(new Ni(e,t,0))}else for(let t=0;tDate.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{ge(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 ki.of(new xi("number"==typeof t?A.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}static domEventHandlers(t){return _i.define((()=>({})),{eventHandlers:t})}static theme(t,e){let i=It.newName(),n=[ws.of(i),Vi.of(Qs(`.${i}`,t))];return e&&e.dark&&n.push(vs.of(!0)),n}static baseTheme(t){return N.lowest(Vi.of(Qs("."+ys,t,ks)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),n=i&&Se.get(i)||Se.get(t);return(null===(e=null==n?void 0:n.rootView)||void 0===e?void 0:e.view)||null}}Ts.styleModule=Vi,Ts.inputHandler=wi,Ts.focusChangeEffect=vi,Ts.perLineTextDirection=yi,Ts.exceptionSink=mi,Ts.updateListener=bi,Ts.editable=$i,Ts.mouseSelectionStyle=gi,Ts.dragMovesSelection=Oi,Ts.clickAddsSelectionRange=pi,Ts.decorations=Ti,Ts.atomicRanges=Ri,Ts.scrollMargins=Ei,Ts.darkTheme=vs,Ts.contentAttributes=Ai,Ts.editorAttributes=Zi,Ts.lineWrapping=Ts.contentAttributes.of({class:"cm-lineWrapping"}),Ts.announce=ut.define();const Rs=4096,Es={};class Vs{constructor(t,e,i,n){this.from=t,this.to=e,this.dir=i,this.order=n}static update(t,e){if(e.empty)return t;let i=[],n=t.length?t[t.length-1].dir:Wi.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&&Je(r,i)}return i}const Ds=De.mac?"mac":De.windows?"win":De.linux?"linux":"key";function Ws(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 Us=N.default(Ts.domEventHandlers({keydown:(t,e)=>Bs(Ls(e.state),t,e,"editor")})),Ys=E.define({enables:Us}),qs=new WeakMap;function Ls(t){let e=t.facet(Ys),i=qs.get(e);return i||qs.set(e,i=function(t,e=Ds){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)=>{var a,l;let h=i[t]||(i[t]=Object.create(null)),c=n.split(/ (?!$)/).map((t=>function(t,e){const i=t.split(/-(?!$)/);let n,s,r,o,a=i[i.length-1];"Space"==a&&(a=" ");for(let t=0;t{let n=zs={view:e,prefix:i,scope:t};return setTimeout((()=>{zs==n&&(zs=null)}),Is),!0}]})}let u=c.join(" ");s(u,!1);let d=h[u]||(h[u]={preventDefault:!1,run:(null===(l=null===(a=h._any)||void 0===a?void 0:a.run)||void 0===l?void 0:l.slice())||[]});r&&d.run.push(r),o&&(d.preventDefault=!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,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.shift&&r(e,"Shift-"+s,n.shift,n.preventDefault)}return i}(e.reduce(((t,e)=>t.concat(e)),[]))),i}let zs=null;const Is=4e3;function Bs(t,e,i,n){let s=function(t){var e=!(Kt&&(t.ctrlKey||t.altKey||t.metaKey)||Jt&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?Gt:Nt)[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=v(b(s,0))==s.length&&" "!=s,o="",a=!1;zs&&zs.view==i&&zs.scope==n&&(o=zs.prefix+" ",(a=kn.indexOf(e.keyCode)<0)&&(zs=null));let l,h,c=new Set,u=t=>{if(t){for(let n of t.run)if(!c.has(n)&&(c.add(n),n(i,e)))return!0;t.preventDefault&&(a=!0)}return!1},d=t[n];if(d){if(u(d[o+Ws(s,e,!r)]))return!0;if(r&&(e.altKey||e.metaKey||e.ctrlKey)&&!(De.windows&&e.ctrlKey&&e.altKey)&&(l=Nt[e.keyCode])&&l!=s){if(u(d[o+Ws(l,e,!0)]))return!0;if(e.shiftKey&&(h=Gt[e.keyCode])!=s&&h!=l&&u(d[o+Ws(h,e,!1)]))return!0}else if(r&&e.shiftKey&&u(d[o+Ws(s,e,!0)]))return!0;if(u(d._any))return!0}return a}class js{constructor(t,e,i,n,s){this.className=t,this.left=e,this.top=i,this.width=n,this.height=s}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className==this.className&&(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",null!=this.width&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,i){if(i.empty){let n=t.coordsAtPos(i.head,i.assoc||1);if(!n)return[];let s=Ns(t);return[new js(e,n.left-s.left,n.top-s.top,null,n.bottom-n.top)]}return function(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];let n=Math.max(i.from,t.viewport.from),s=Math.min(i.to,t.viewport.to),r=t.textDirection==Wi.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=Ns(t),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),u=a.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),d=a.right-(c?parseInt(c.paddingRight):0),f=Fs(t,n),p=Fs(t,s),O=f.type==ii.Text?f:null,g=p.type==ii.Text?p:null;t.lineWrapping&&(O&&(O=Gs(t,n,O)),g&&(g=Gs(t,s,g)));if(O&&g&&O.from==g.from)return b(w(i.from,i.to,O));{let e=O?w(i.from,null,O):v(f,!1),n=g?w(null,i.to,g):v(p,!0),s=[];return(O||f).to<(g||p).from-1?s.push(m(u,e.bottom,d,n.top)):e.bottomh&&n.from=r)break;a>s&&l(Math.max(t,s),null==e&&t<=h,Math.min(a,r),null==i&&a>=c,o.dir)}if(s=n.to+1,s>=r)break}return 0==a.length&&l(h,null==e,c,null==i,t.textDirection),{top:s,bottom:o,horizontal:a}}function v(t,e){let i=a.top+(e?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]}}}(t,e,i)}}function Ns(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Wi.LTR?e.left:e.right-t.scrollDOM.clientWidth)-t.scrollDOM.scrollLeft,top:e.top-t.scrollDOM.scrollTop}}function Gs(t,e,i){let n=A.cursor(e);return{from:Math.max(i.from,t.moveToLineBoundary(n,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(n,!0,!0).from),type:ii.Text}}function Fs(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==ii.Text))return t;return i}class Hs{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),e.above&&this.dom.classList.add("cm-layer-above"),e.class&&this.dom.classList.add(e.class),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(Js)!=t.state.facet(Js)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&t.view.requestMeasure(this.measureReq)}setOrder(t){let e=0,i=t.facet(Js);for(;e{return i=t,n=this.drawn[e],!(i.constructor==n.constructor&&i.eq(n));var i,n}))){let e=this.dom.firstChild,i=0;for(let n of t)n.update&&e&&n.constructor&&this.drawn[i].constructor&&n.update(e,this.drawn[i])?(e=e.nextSibling,i++):this.dom.insertBefore(n.draw(),e);for(;e;){let t=e.nextSibling;e.remove(),e=t}this.drawn=t}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Js=E.define();function Ks(t){return[_i.define((e=>new Hs(e,t))),Js.of(t)]}const tr=!De.ios,er=E.define({combine:t=>kt(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})});function ir(t={}){return[er.of(t),sr,or,lr,Si.of(!0)]}function nr(t){return t.startState.facet(er)!=t.state.facet(er)}const sr=Ks({above:!0,markers(t){let{state:e}=t,i=e.facet(er),n=[];for(let s of e.selection.ranges){let r=s==e.selection.main;if(s.empty?!r||tr:i.drawRangeCursor){let e=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",i=s.empty?s:A.cursor(s.head,s.head>s.anchor?-1:1);for(let s of js.forRange(t,e,i))n.push(s)}}return n},update(t,e){t.transactions.some((t=>t.selection))&&(e.style.animationName="cm-blink"==e.style.animationName?"cm-blink2":"cm-blink");let i=nr(t);return i&&rr(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){rr(e.state,t)},class:"cm-cursorLayer"});function rr(t,e){e.style.animationDuration=t.facet(er).cursorBlinkRate+"ms"}const or=Ks({above:!1,markers:t=>t.state.selection.ranges.map((e=>e.empty?[]:js.forRange(t,"cm-selectionBackground",e))).reduce(((t,e)=>t.concat(e))),update:(t,e)=>t.docChanged||t.selectionSet||t.viewportChanged||nr(t),class:"cm-selectionLayer"}),ar={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};tr&&(ar[".cm-line"].caretColor="transparent !important");const lr=N.highest(Ts.theme(ar)),hr=ut.define({map:(t,e)=>null==t?null:e.mapPos(t)}),cr=q.define({create:()=>null,update:(t,e)=>(null!=t&&(t=e.changes.mapPos(t)),e.effects.reduce(((t,e)=>e.is(hr)?e.value:t),t))}),ur=_i.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let i=t.state.field(cr);null==i?null!=this.cursor&&(null===(e=this.cursor)||void 0===e||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(cr)!=i||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let t=this.view.state.field(cr),e=null!=t&&this.view.coordsAtPos(t);if(!e)return null;let i=this.view.scrollDOM.getBoundingClientRect();return{left:e.left-i.left+this.view.scrollDOM.scrollLeft,top:e.top-i.top+this.view.scrollDOM.scrollTop,height:e.bottom-e.top}}drawCursor(t){this.cursor&&(t?(this.cursor.style.left=t.left+"px",this.cursor.style.top=t.top+"px",this.cursor.style.height=t.height+"px"):this.cursor.style.left="-100000px")}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(cr)!=t&&this.view.dispatch({effects:hr.of(t)})}},{eventHandlers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){t.target!=this.view.contentDOM&&this.view.contentDOM.contains(t.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function dr(){return[cr,ur]}function fr(t,e,i,n,s){e.lastIndex=0;for(let r,o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)if(!o.lineBreak)for(;r=e.exec(o.value);)s(a+r.index,r)}class pr{constructor(t){const{regexp:e,decoration:i,decorate:n,boundary:s,maxLength:r=1e3}=t;if(!e.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=e,n)this.addMatch=(t,e,i,s)=>n(s,i,i+t[0].length,t,e);else if("function"==typeof i)this.addMatch=(t,e,n,s)=>{let r=i(t,e,n);r&&s(n,n+t[0].length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(t,e,n,s)=>s(n,n+t[0].length,i)}this.boundary=s,this.maxLength=r}createDeco(t){let e=new Xt,i=e.add.bind(e);for(let{from:e,to:n}of function(t,e){let i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;let n=[];for(let{from:s,to:r}of i)s=Math.max(t.state.doc.lineAt(s).from,s-e),r=Math.min(t.state.doc.lineAt(r).to,r+e),n.length&&n[n.length-1].to>=s?n[n.length-1].to=r:n.push({from:s,to:r});return n}(t,this.maxLength))fr(t.state.doc,this.regexp,e,n,((e,n)=>this.addMatch(n,t,e,i)));return e.finish()}updateDeco(t,e){let i=1e9,n=-1;return t.docChanged&&t.changes.iterChanges(((e,s,r,o)=>{o>t.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e}updateRange(t,e,i,n){for(let s of t.visibleRanges){let r=Math.max(s.from,i),o=Math.min(s.to,n);if(o>r){let i=t.state.doc.lineAt(r),n=i.toi.from;r--)if(this.boundary.test(i.text[r-1-i.from])){a=r;break}for(;oc.push(i.range(t,e));if(i==n)for(this.regexp.lastIndex=a-i.from;(h=this.regexp.exec(i.text))&&h.indexthis.addMatch(i,t,e,u)));e=e.update({filterFrom:a,filterTo:l,filter:(t,e)=>tl,add:c})}}return e}}const Or=null!=/x/.unicode?"gu":"g",gr=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",Or),mr={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let br=null;const wr=E.define({combine(t){let e=kt(t,{render:null,specialChars:gr,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==br&&"undefined"!=typeof document&&document.body){let e=document.body.style;br=null!=(null!==(t=e.tabSize)&&void 0!==t?t:e.MozTabSize)}return br||!1}())&&(e.specialChars=new RegExp("\t|"+e.specialChars.source,Or)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Or)),e}});function vr(t={}){return[wr.of(t),yr||(yr=_i.fromClass(class{constructor(t){this.view=t,this.decorations=ni.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(wr)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new pr({regexp:t.specialChars,decoration:(e,i,n)=>{let{doc:s}=i.state,r=b(e[0],0);if(9==r){let t=s.lineAt(n),e=i.state.tabSize,r=Yt(t.text,e,n-t.from);return ni.replace({widget:new xr((e-r%e)*this.view.defaultCharacterWidth)})}return this.decorationCache[r]||(this.decorationCache[r]=ni.replace({widget:new Sr(t,r)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(wr);t.startState.facet(wr)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))]}let yr=null;class Sr extends ei{constructor(t,e){super(),this.options=t,this.code=e}eq(t){return t.code==this.code}toDOM(t){let e=function(t){return t>=32?"•":10==t?"␤":String.fromCharCode(9216+t)}(this.code),i=t.state.phrase("Control character")+" "+(mr[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,i,e);if(n)return n;let s=document.createElement("span");return s.textContent=e,s.title=i,s.setAttribute("aria-label",i),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class xr extends ei{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent="\t",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}class kr extends ei{constructor(t){super(),this.content=t}toDOM(){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):this.content),"string"==typeof this.content?t.setAttribute("aria-label","placeholder "+this.content):t.setAttribute("aria-hidden","true"),t}ignoreEvent(){return!1}}const Qr="-10000px";class $r{constructor(t,e,i){this.facet=e,this.createTooltipView=i,this.input=t.state.facet(e),this.tooltips=this.input.filter((t=>t)),this.tooltipViews=this.tooltips.map(i)}update(t){var e;let i=t.state.facet(this.facet),n=i.filter((t=>t));if(i===this.input){for(let e of this.tooltipViews)e.update&&e.update(t);return!1}let s=[];for(let e=0;e{var e,i,n;return{position:De.ios?"absolute":(null===(e=t.find((t=>t.position)))||void 0===e?void 0:e.position)||"fixed",parent:(null===(i=t.find((t=>t.parent)))||void 0===i?void 0:i.parent)||null,tooltipSpace:(null===(n=t.find((t=>t.tooltipSpace)))||void 0===n?void 0:n.tooltipSpace)||Pr}}}),_r=new WeakMap,Xr=_i.fromClass(class{constructor(t){this.view=t,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(Cr);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new $r(t,Tr,(t=>this.createTooltip(t))),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout((()=>{this.measureTimeout=-1,this.maybeMeasure()}),50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t);e&&this.observeIntersection();let i=e||t.geometryChanged,n=t.state.facet(Cr);if(n.position!=this.position){this.position=n.position;for(let t of this.manager.tooltipViews)t.dom.style.position=this.position;i=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let t of this.manager.tooltipViews)this.container.appendChild(t.dom);i=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure()}createTooltip(t){let e=t.create(this.view);if(e.dom.classList.add("cm-tooltip"),t.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",e.dom.appendChild(t)}return e.dom.style.position=this.position,e.dom.style.top=Qr,this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var t,e;this.view.win.removeEventListener("resize",this.measureSoon);for(let e of this.manager.tooltipViews)e.dom.remove(),null===(t=e.destroy)||void 0===t||t.call(e);null===(e=this.intersectionObserver)||void 0===e||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=this.view.dom.getBoundingClientRect();return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map(((t,e)=>{let i=this.manager.tooltipViews[e];return i.getCoords?i.getCoords(t.pos):this.view.coordsAtPos(t.pos)})),size:this.manager.tooltipViews.map((({dom:t})=>t.getBoundingClientRect())),space:this.view.state.facet(Cr).tooltipSpace(this.view)}}writeMeasure(t){var e;let{editor:i,space:n}=t,s=[];for(let r=0;r=Math.min(i.bottom,n.bottom)||h.rightMath.min(i.right,n.right)+.1){l.style.top=Qr;continue}let u=o.arrow?a.dom.querySelector(".cm-tooltip-arrow"):null,d=u?7:0,f=c.right-c.left,p=null!==(e=_r.get(a))&&void 0!==e?e:c.bottom-c.top,O=a.offset||Ar,g=this.view.textDirection==Wi.LTR,m=c.width>n.right-n.left?g?n.left:n.right-c.width:g?Math.min(h.left-(u?14:0)+O.x,n.right-f):Math.max(n.left,h.left-f+(u?14:0)-O.x),b=!!o.above;!o.strictSide&&(b?h.top-(c.bottom-c.top)-O.yn.bottom)&&b==n.bottom-h.bottom>h.top-n.top&&(b=!b);let w=(b?h.top-n.top:n.bottom-h.bottom)-d;if(wm&&t.topv&&(v=b?t.top-p-2-d:t.bottom+d+2);"absolute"==this.position?(l.style.top=v-t.parent.top+"px",l.style.left=m-t.parent.left+"px"):(l.style.top=v+"px",l.style.left=m+"px"),u&&(u.style.left=h.left+(g?O.x:-O.x)-(m+14-7)+"px"),!0!==a.overlap&&s.push({left:m,top:v,right:y,bottom:v+p}),l.classList.toggle("cm-tooltip-above",b),l.classList.toggle("cm-tooltip-below",!b),a.positioned&&a.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=Qr}},{eventHandlers:{scroll(){this.maybeMeasure()}}}),Zr=Ts.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Ar={x:0,y:0},Tr=E.define({enables:[Xr,Zr]});function Rr(t,e){let i=t.plugin(Xr);if(!i)return null;let n=i.manager.tooltips.indexOf(e);return n<0?null:i.manager.tooltipViews[n]}const Er=E.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 Vr(t,e){let i=t.plugin(Mr),n=i?i.specs.indexOf(e):-1;return n>-1?i.panels[n]:null}const Mr=_i.fromClass(class{constructor(t){this.input=t.state.facet(Ur),this.specs=this.input.filter((t=>t)),this.panels=this.specs.map((e=>e(t)));let e=t.state.facet(Er);this.top=new Dr(t,!0,e.topContainer),this.bottom=new Dr(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(Er);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Dr(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Dr(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(Ur);if(i!=this.input){let e=i.filter((t=>t)),n=[],s=[],r=[],o=[];for(let i of e){let e,a=this.specs.indexOf(i);a<0?(e=i(t.view),o.push(e)):(e=this.panels[a],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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}}))});class Dr{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=Wr(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=Wr(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 Wr(t){let e=t.nextSibling;return t.remove(),e}const Ur=E.define({enables:Mr});class Yr extends Qt{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Yr.prototype.elementClass="",Yr.prototype.toDOM=void 0,Yr.prototype.mapMode=S.TrackBefore,Yr.prototype.startSide=Yr.prototype.endSide=-1,Yr.prototype.point=!0;const qr=E.define(),Lr={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>_t.empty,lineMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},zr=E.define();function Ir(t){return[jr(),zr.of(Object.assign(Object.assign({},Lr),t))]}const Br=E.define({combine:t=>t.some((t=>t))});function jr(t){let e=[Nr];return t&&!1===t.fixed&&e.push(Br.of(!0)),e}const Nr=_i.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+"px",this.gutters=t.state.facet(zr).map((e=>new Jr(t,e)));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!t.state.facet(Br),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(Br)!=!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=_t.iter(this.view.state.facet(qr),this.view.viewport.from),n=[],s=this.gutters.map((t=>new Hr(t,this.view.viewport,-this.view.documentPadding.top)));for(let t of this.view.viewportLineBlocks){let e;if(Array.isArray(t.type)){for(let i of t.type)if(i.type==ii.Text){e=i;break}}else e=t.type==ii.Text?t:void 0;if(e){n.length&&(n=[]),Fr(i,n,t.from);for(let t of s)t.line(this.view,e,n)}}for(let t of s)t.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(zr),i=t.state.facet(zr),n=t.docChanged||t.heightChanged||t.viewportChanged||!_t.eq(t.startState.facet(qr),t.state.facet(qr),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 Jr(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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&0!=i.gutters.length&&i.fixed?e.textDirection==Wi.LTR?{left:i.dom.offsetWidth}:{right:i.dom.offsetWidth}:null}))});function Gr(t){return Array.isArray(t)?t:[t]}function Fr(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class Hr{constructor(t,e,i){this.gutter=t,this.height=i,this.i=0,this.cursor=_t.iter(t.markers,e.from)}line(t,e,i){let n=[];Fr(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;if(0==n.length&&!r.config.renderEmptyElements)return;let o=e.top-this.height;if(this.i==r.elements.length){let i=new Kr(t,e.height,o,n);r.elements.push(i),r.dom.appendChild(i.dom)}else r.elements[this.i].update(t,e.height,o,n);this.height=e.bottom,this.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 Jr{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=Gr(e.markers(t)),e.initialSpacer&&(this.spacer=new Kr(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=Gr(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!_t.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 Kr{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.dom.style.height=(this.height=e)+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),function(t,e){if(t.length!=e.length)return!1;for(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 io extends Yr{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function no(t,e){return t.state.facet(eo).formatNumber(e,t.state)}const so=zr.compute([eo],(t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:t=>t.state.facet(to),lineMarker:(t,e,i)=>i.some((t=>t.toDOM))?null:new io(no(t,t.state.doc.lineAt(e.from).number)),lineMarkerChange:t=>t.startState.facet(eo)!=t.state.facet(eo),initialSpacer:t=>new io(no(t,ro(t.state.doc.lines))),updateSpacer(t,e){let i=no(e.view,ro(e.view.state.doc.lines));return i==t.number?t:new io(i)},domEventHandlers:t.facet(eo).domEventHandlers})));function ro(t){let e=9;for(;e{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=fo.match(t)),e=>{let i=t(e);return void 0===i?null:[this,i]}}}ho.closedBy=new ho({deserialize:t=>t.split(" ")}),ho.openedBy=new ho({deserialize:t=>t.split(" ")}),ho.group=new ho({deserialize:t=>t.split(" ")}),ho.contextHash=new ho({perNode:!0}),ho.lookAhead=new ho({perNode:!0}),ho.mounted=new ho({perNode:!0});class co{constructor(t,e,i){this.tree=t,this.overlay=e,this.parser=i}}const uo=Object.create(null);class fo{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):uo,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),n=new fo(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(ho.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(ho.group),n=-1;n<(i?i.length:0);n++){let s=e[n<0?t.name:i[n]];if(s)return s}}}}fo.none=new fo("",Object.create(null),0,8);class po{constructor(t){this.types=t;for(let e=0;e=n&&(r.type.isAnonymous||!1!==e(r))){if(r.firstChild())continue;t=!0}for(;t&&i&&!r.type.isAnonymous&&i(r),!r.nextSibling();){if(!r.parent())return;t=!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:To(fo.none,this.children,this.positions,0,this.children.length,0,this.length,((t,e,i)=>new bo(this.type,t,e,i,this.propValues)),t.makeTree||((t,e,i)=>new bo(fo.none,t,e,i)))}static build(t){return function(t){var e;let{buffer:i,nodeSet:n,maxBufferLength:s=oo,reused:r=[],minRepeatType:o=n.types.length}=t,a=Array.isArray(i)?new wo(i,i.length):i,l=n.types,h=0,c=0;function u(t,e,i,m,b){let{id:w,start:v,end:y,size:S}=a,x=c;for(;S<0;){if(a.next(),-1==S){let e=r[w];return i.push(e),void m.push(v-t)}if(-3==S)return void(h=w);if(-4==S)return void(c=w);throw new RangeError(`Unrecognized record size: ${S}`)}let k,Q,$=l[w],P=v-t;if(y-v<=s&&(Q=O(a.pos-e,b))){let e=new Uint16Array(Q.size-Q.skip),i=a.pos-Q.size,s=e.length;for(;a.pos>i;)s=g(Q.start,e,s);k=new vo(e,y-Q.start,n),P=Q.start-t}else{let t=a.pos-S;a.next();let e=[],i=[],n=w>=o?w:-1,r=0,l=y;for(;a.pos>t;)n>=0&&a.id==n&&a.size>=0?(a.end<=l-s&&(f(e,i,v,r,a.end,l,n,x),r=e.length,l=a.end),a.next()):u(v,t,e,i,n);if(n>=0&&r>0&&r-1&&r>0){let t=d($);k=To($,e,i,0,e.length,0,y-v,t,t)}else k=p($,e,i,y-v,x-y)}i.push(k),m.push(P)}function d(t){return(e,i,n)=>{let s,r,o=0,a=e.length-1;if(a>=0&&(s=e[a])instanceof bo){if(!a&&s.type==t&&s.length==n)return s;(r=s.prop(ho.lookAhead))&&(o=i[a]+s.length+r)}return p(t,e,i,n,o)}}function f(t,e,i,s,r,o,a,l){let h=[],c=[];for(;t.length>s;)h.push(t.pop()),c.push(e.pop()+i-r);t.push(p(n.types[a],h,c,o-r,l-o)),e.push(r-i)}function p(t,e,i,n,s=0,r){if(h){let t=[ho.contextHash,h];r=r?[t].concat(r):[t]}if(s>25){let t=[ho.lookAhead,s];r=r?[t].concat(r):[t]}return new bo(t,e,i,n,r)}function O(t,e){let i=a.fork(),n=0,r=0,l=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=l,l+=4,n+=4,i.next();continue}let a=i.pos-t;if(t<0||a=o?4:0,d=i.start;for(i.next();i.pos>a;){if(i.size<0){if(-3!=i.size)break t;u+=4}else i.id>=o&&(u+=4);i.next()}r=d,n+=t,l+=u}return(e<0||n==t)&&(c.size=n,c.start=r,c.skip=l),c.size>4?c:void 0}function g(t,e,i){let{id:n,start:s,end:r,size:l}=a;if(a.next(),l>=0&&n4){let n=a.pos-(l-4);for(;a.pos>n;)i=g(t,e,i)}e[--i]=o,e[--i]=r-t,e[--i]=s-t,e[--i]=n}else-3==l?h=n:-4==l&&(c=n);return i}let m=[],b=[];for(;a.pos>0;)u(t.start||0,t.bufferStart||0,m,b,-1);let w=null!==(e=t.length)&&void 0!==e?e:m.length?b[0]+m[0].length:0;return new bo(l[t.topID],m.reverse(),b.reverse(),w)}(t)}}bo.empty=new bo(fo.none,[],[],0);class wo{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 wo(this.buffer,this.index)}}class vo{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return fo.none}toString(){let t=[];for(let e=0;e0));a=r[a+3]);return o}slice(t,e,i){let n=this.buffer,s=new Uint16Array(e-t),r=0;for(let o=t,a=0;o=e&&ie;case 1:return i<=e&&n>e;case 2:return n>e;case 4:return!0}}function So(t,e){let i=t.childBefore(e);for(;i;){let e=i.lastChild;if(!e||e.to!=i.to)break;e.type.isError&&e.from==e.to?(t=i,i=e.prevSibling):i=e}return t}function xo(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!=l;t+=e){let l=o[t],h=a[t]+r.from;if(yo(n,i,h,h+l.length))if(l instanceof vo){if(s&mo.ExcludeBuffers)continue;let o=l.findChild(0,l.buffer.length,e,i-h,n);if(o>-1)return new Co(new Po(r,l,t,h),null,o)}else if(s&mo.IncludeAnonymous||!l.type.isAnonymous||Xo(l)){let o;if(!(s&mo.IgnoreMounts)&&l.props&&(o=l.prop(ho.mounted))&&!o.overlay)return new ko(o.tree,h,t,r);let a=new ko(l,h,t,r);return s&mo.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(e<0?l.children.length-1:0,e,i,n)}}if(s&mo.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&mo.IgnoreOverlays)&&(n=this._tree.prop(ho.mounted))&&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 ko(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}cursor(t=0){return new _o(this,t)}get tree(){return this._tree}toTree(){return this._tree}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return So(this,t)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}toString(){return this._tree.toString()}get node(){return this}matchContext(t){return $o(this,t)}}function Qo(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 $o(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 Po{constructor(t,e,i,n){this.parent=t,this.buffer=e,this.index=i,this.start=n}}class Co{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){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 Co(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&mo.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 Co(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 Co(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 Co(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}cursor(t=0){return new _o(this,t)}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 bo(this.type,t,e,this.to-this.from)}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return So(this,t)}toString(){return this.context.buffer.childString(this.index)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}get node(){return this}matchContext(t){return $o(this,t)}}class _o{get name(){return this.type.name}constructor(t,e=0){if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof ko)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let e=t._parent;e;e=e._parent)this.stack.unshift(e.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return!!t&&(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0)}yieldBuf(t,e){this.index=t;let{start:i,buffer:n}=this.buffer;return this.type=e||n.set.types[n.buffer[t]],this.from=i+n.buffer[t+1],this.to=i+n.buffer[t+2],!0}yield(t){return!!t&&(t instanceof ko?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,i){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,i,this.mode));let{buffer:n}=this.buffer,s=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.buffer.start,i);return!(s<0)&&(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,i=this.mode){return this.buffer?!(i&mo.ExcludeBuffers)&&this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&mo.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&mo.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode));let{buffer:e}=this.buffer,i=this.stack.length-1;if(t<0){let t=i<0?0:this.stack[i]+4;if(this.index!=t)return this.yieldBuf(e.findChild(t,this.index,-1,0,4))}else{let t=e.buffer[this.index+3];if(t<(i<0?e.buffer.length:e.buffer[this.stack[i]+3]))return this.yieldBuf(t)}return i<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,i,{buffer:n}=this;if(n){if(t>0){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&mo.IncludeAnonymous||t instanceof vo||!t.type.isAnonymous||Xo(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 $o(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 Xo(t){return t.children.some((t=>t instanceof vo||!t.type.isAnonymous||Xo(t)))}const Zo=new WeakMap;function Ao(t,e){if(!t.isAnonymous||e instanceof vo||e.type!=t)return 1;let i=Zo.get(e);if(null==i){i=1;for(let n of e.children){if(n.type!=t||!(n instanceof bo)){i=1;break}i+=Ao(t,n)}Zo.set(e,i)}return i}function To(t,e,i,n,s,r,o,a,l){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]+a);continue}u.push(i[s])}else{let e=n[h-1]+i[h-1].length-f;u.push(To(t,i,n,s,h,f,e,null,l))}d.push(f+a-r)}}(e,i,n,s,0),(a||l)(u,d,o)}class Ro{constructor(){this.map=new WeakMap}setBuffer(t,e,i){let n=this.map.get(t);n||this.map.set(t,n=new Map),n.set(e,i)}getBuffer(t,e){let i=this.map.get(t);return i&&i.get(e)}set(t,e){t instanceof Co?this.setBuffer(t.context.buffer,t.index,e):t instanceof ko&&this.map.set(t.tree,e)}get(t){return t instanceof Co?this.getBuffer(t.context.buffer,t.index):t instanceof ko?this.map.get(t.tree):void 0}cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}}class Eo{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 Eo(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,a=0,l=0;;o++){let h=o=i)for(;r&&r.from=e.from||c<=e.to||l){let t=Math.max(e.from,a)-l,i=Math.min(e.to,c)-l;e=t>=i?null:new Eo(t,i,e.tree,e.offset+l,o>0,!!h)}if(e&&n.push(e),r.to>c)break;r=snew lo(t.from,t.to))):[new lo(0,0)]:[new lo(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 Mo{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)}}function Do(t){return(e,i,n,s)=>new qo(e,t,i,n,s)}class Wo{constructor(t,e,i,n,s){this.parser=t,this.parse=e,this.overlay=i,this.target=n,this.ranges=s}}class Uo{constructor(t,e,i,n,s,r,o){this.parser=t,this.predicate=e,this.mounts=i,this.index=n,this.start=s,this.target=r,this.prev=o,this.depth=0,this.ranges=[]}}const Yo=new ho({perNode:!0});class qo{constructor(t,e,i,n,s){this.nest=e,this.input=i,this.fragments=n,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=t}advance(){if(this.baseParse){let t=this.baseParse.advance();if(!t)return null;if(this.baseParse=null,this.baseTree=t,this.startInner(),null!=this.stoppedAt)for(let t of this.inner)t.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let t=this.baseTree;return null!=this.stoppedAt&&(t=new bo(t.type,t.children,t.positions,t.length,t.propValues.concat([[Yo,this.stoppedAt]]))),t}let t=this.inner[this.innerDone],e=t.parse.advance();if(e){this.innerDone++;let i=Object.assign(Object.create(null),t.target.props);i[ho.mounted.id]=new co(e,t.overlay,t.parser),t.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let t=this.input.length;for(let e=this.innerDone;et.frag.from<=n.from&&t.frag.to>=n.to&&t.mount.overlay));if(t)for(let i of t.mount.overlay){let s=i.from+t.pos,r=i.to+t.pos;s>=n.from&&r<=n.to&&!e.ranges.some((t=>t.froms))&&e.ranges.push({from:s,to:r})}}a=!1}else if(i&&(r=Lo(i.ranges,n.from,n.to)))a=2!=r;else if(!n.type.isAnonymous&&n.fromnew lo(t.from-n.from,t.to-n.from))):null,n.tree,t)),s.overlay?t.length&&(i={ranges:t,depth:0,prev:i}):a=!1}}else e&&(o=e.predicate(n))&&(!0===o&&(o=new lo(n.from,n.to)),o.fromnew lo(t.from-e.start,t.to-e.start))),e.target,t)),e=e.prev}i&&! --i.depth&&(i=i.prev)}}}}function Lo(t,e,i){for(let n of t){if(n.from>=i)break;if(n.to>e)return n.from<=e&&n.to>=i?2:1}return 0}function zo(t,e,i,n,s,r){if(e=e.to);n++);let o=s.children[n],a=o.buffer;s.children[n]=function t(i,n,s,l,h){let c=i;for(;a[c+2]+r<=e.from;)c=a[c+3];let u=[],d=[];zo(o,i,c,u,d,l);let f=a[c+1],p=a[c+2],O=f+r==e.from&&p+r==e.to&&a[c]==e.type.id;return u.push(O?e.toTree():t(c+4,a[c+3],o.set.types[a[c]],f,p-f)),d.push(f-l),zo(o,a[c+3],n,u,d,l),new bo(s,u,d,h)}(0,a.length,fo.none,0,o.length);for(let n=0;n<=i;n++)t.childAfter(e.from)}class Bo{constructor(t,e){this.offset=e,this.done=!1,this.cursor=t.cursor(mo.IncludeAnonymous|mo.IgnoreMounts)}moveTo(t){let{cursor:e}=this,i=t-this.offset;for(;!this.done&&e.from=t&&e.enter(i,1,mo.IgnoreOverlays|mo.ExcludeBuffers)||e.next(!1)||(this.done=!0)}hasNode(t){if(this.moveTo(t.from),!this.done&&this.cursor.from+this.offset==t.from&&this.cursor.tree)for(let e=this.cursor.tree;;){if(e==t.tree)return!0;if(!(e.children.length&&0==e.positions[0]&&e.children[0]instanceof bo))break;e=e.children[0]}return!1}}let jo=class{constructor(t){var e;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){let i=this.curFrag=t[0];this.curTo=null!==(e=i.tree.prop(Yo))&&void 0!==e?e:i.to,this.inner=new Bo(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t)}nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=null!==(t=e.tree.prop(Yo))&&void 0!==t?t:e.to,this.inner=new Bo(e.tree,-e.offset)}}findMounts(t,e){var i;let n=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let t=this.inner.cursor.node;t;t=t.parent){let s=null===(i=t.tree)||void 0===i?void 0:i.prop(ho.mounted);if(s&&s.parser==e)for(let e=this.fragI;e=t.to)break;i.tree==this.curFrag.tree&&n.push({frag:i,pos:t.from-i.offset,mount:s})}}}return n}};function No(t,e){let i=null,n=e;for(let s=1,r=0;s=a)break;t.to<=o||(i||(n=i=e.slice()),t.froma&&i.splice(r+1,0,new lo(a,t.to))):t.to>a?i[r--]=new lo(a,t.to):i.splice(r--,1))}}return n}function Go(t,e,i,n){let s=0,r=0,o=!1,a=!1,l=-1e9,h=[];for(;;){let c=s==t.length?1e9:o?t[s].to:t[s].from,u=r==e.length?1e9:a?e[r].to:e[r].from;if(o!=a){let t=Math.max(l,i),e=Math.min(c,u,n);tnew lo(t.from+n,t.to+n))),a,l);for(let e=0,n=a;;e++){let a=e==o.length,h=a?l:o[e].from;if(h>n&&i.push(new Eo(n,h,s.tree,-t,r.from>=n||r.openStart,r.to<=h||r.openEnd)),a)break;n=o[e].to}}else i.push(new Eo(a,l,s.tree,-t,r.from>=t||r.openStart,r.to<=o||r.openEnd))}return i}let Ho=0;class Jo{constructor(t,e,i){this.set=t,this.base=e,this.modified=i,this.id=Ho++}static define(t){if(null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let e=new Jo([],null,[]);if(e.set.push(e),t)for(let i of t.set)e.set.push(i);return e}static defineModifier(){let t=new ta;return e=>e.modified.indexOf(t)>-1?e:ta.get(e.base||e,e.modified.concat(t).sort(((t,e)=>t.id-e.id)))}}let Ko=0;class ta{constructor(){this.instances=[],this.id=Ko++}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 Jo(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(ta.get(e,t));return s}}function ea(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,a=i[o];if(!a)throw new RangeError("Invalid path: "+t);let l=new na(n,s,o>0?i.slice(0,o):null);e[a]=l.sort(e[a])}}return ia.add(e)}const ia=new ho;class na{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 ra(t,e,i,n=0,s=t.length){let r=new oa(n,Array.isArray(e)?e:[e],i);r.highlightRange(t.cursor(),n,s,"",r.highlighters),r.flush(s)}na.empty=new na([],2,null);class oa{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:a}=t;if(o>=i||a<=e)return;r.isTop&&(s=this.highlighters.filter((t=>!t.scope||t.scope(r))));let l=n,h=function(t){let e=t.type.prop(ia);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}(t)||na.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&&(l&&(l+=" "),l+=c,1==h.mode&&(n+=(n?" ":"")+c)),this.startSpan(t.from,l),h.opaque)return;let u=t.tree&&t.tree.prop(ho.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 d=0,f=o;;d++){let p=d=O)&&t.nextSibling()););if(!p||O>i)break;f=p.to+o,f>e&&(this.highlightRange(r.cursor(),Math.max(e,p.from+o),Math.min(i,f),n,h),this.startSpan(f,l))}c&&t.parent()}else if(t.firstChild()){do{if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,n,s),this.startSpan(Math.min(i,t.to),l)}}while(t.nextSibling());t.parent()}}}const aa=Jo.define,la=aa(),ha=aa(),ca=aa(ha),ua=aa(ha),da=aa(),fa=aa(da),pa=aa(da),Oa=aa(),ga=aa(Oa),ma=aa(),ba=aa(),wa=aa(),va=aa(wa),ya=aa(),Sa={comment:la,lineComment:aa(la),blockComment:aa(la),docComment:aa(la),name:ha,variableName:aa(ha),typeName:ca,tagName:aa(ca),propertyName:ua,attributeName:aa(ua),className:aa(ha),labelName:aa(ha),namespace:aa(ha),macroName:aa(ha),literal:da,string:fa,docString:aa(fa),character:aa(fa),attributeValue:aa(fa),number:pa,integer:aa(pa),float:aa(pa),bool:aa(da),regexp:aa(da),escape:aa(da),color:aa(da),url:aa(da),keyword:ma,self:aa(ma),null:aa(ma),atom:aa(ma),unit:aa(ma),modifier:aa(ma),operatorKeyword:aa(ma),controlKeyword:aa(ma),definitionKeyword:aa(ma),moduleKeyword:aa(ma),operator:ba,derefOperator:aa(ba),arithmeticOperator:aa(ba),logicOperator:aa(ba),bitwiseOperator:aa(ba),compareOperator:aa(ba),updateOperator:aa(ba),definitionOperator:aa(ba),typeOperator:aa(ba),controlOperator:aa(ba),punctuation:wa,separator:aa(wa),bracket:va,angleBracket:aa(va),squareBracket:aa(va),paren:aa(va),brace:aa(va),content:Oa,heading:ga,heading1:aa(ga),heading2:aa(ga),heading3:aa(ga),heading4:aa(ga),heading5:aa(ga),heading6:aa(ga),contentSeparator:aa(Oa),list:aa(Oa),quote:aa(Oa),emphasis:aa(Oa),strong:aa(Oa),link:aa(Oa),monospace:aa(Oa),strikethrough:aa(Oa),inserted:aa(),deleted:aa(),changed:aa(),invalid:aa(),meta:ya,documentMeta:aa(ya),annotation:aa(ya),processingInstruction:aa(ya),definition:Jo.defineModifier(),constant:Jo.defineModifier(),function:Jo.defineModifier(),standard:Jo.defineModifier(),local:Jo.defineModifier(),special:Jo.defineModifier()};var xa;sa([{tag:Sa.link,class:"tok-link"},{tag:Sa.heading,class:"tok-heading"},{tag:Sa.emphasis,class:"tok-emphasis"},{tag:Sa.strong,class:"tok-strong"},{tag:Sa.keyword,class:"tok-keyword"},{tag:Sa.atom,class:"tok-atom"},{tag:Sa.bool,class:"tok-bool"},{tag:Sa.url,class:"tok-url"},{tag:Sa.labelName,class:"tok-labelName"},{tag:Sa.inserted,class:"tok-inserted"},{tag:Sa.deleted,class:"tok-deleted"},{tag:Sa.literal,class:"tok-literal"},{tag:Sa.string,class:"tok-string"},{tag:Sa.number,class:"tok-number"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],class:"tok-string2"},{tag:Sa.variableName,class:"tok-variableName"},{tag:Sa.local(Sa.variableName),class:"tok-variableName tok-local"},{tag:Sa.definition(Sa.variableName),class:"tok-variableName tok-definition"},{tag:Sa.special(Sa.variableName),class:"tok-variableName2"},{tag:Sa.definition(Sa.propertyName),class:"tok-propertyName tok-definition"},{tag:Sa.typeName,class:"tok-typeName"},{tag:Sa.namespace,class:"tok-namespace"},{tag:Sa.className,class:"tok-className"},{tag:Sa.macroName,class:"tok-macroName"},{tag:Sa.propertyName,class:"tok-propertyName"},{tag:Sa.operator,class:"tok-operator"},{tag:Sa.comment,class:"tok-comment"},{tag:Sa.meta,class:"tok-meta"},{tag:Sa.invalid,class:"tok-invalid"},{tag:Sa.punctuation,class:"tok-punctuation"}]);const ka=new ho;function Qa(t){return E.define({combine:t?e=>e.concat(t):void 0})}const $a=new ho;class Pa{constructor(t,e,i=[],n=""){this.data=t,this.name=n,xt.prototype.hasOwnProperty("tree")||Object.defineProperty(xt.prototype,"tree",{get(){return Xa(this)}}),this.parser=e,this.extension=[Wa.of(this),xt.languageData.of(((t,e,i)=>{let n=Ca(t,e,i),s=n.type.prop(ka);if(!s)return[];let r=t.facet(s),o=n.type.prop($a);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 Ca(t,e,i).type.prop(ka)==this.data}findRegions(t){let e=t.facet(Wa);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(ka)==this.data)return void i.push({from:e,to:e+t.length});let s=t.prop(ho.mounted);if(s){if(s.tree.prop(ka)==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;it.isTop?e:void 0))]}),t.name)}configure(t,e){return new _a(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Xa(t){let e=t.field(Pa.state,!1);return e?e.tree:bo.empty}class Za{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let i=this.cursorPos-this.string.length;return t=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i)}}let Aa=null;class Ta{constructor(t,e,i=[],n,s,r,o,a){this.parser=t,this.state=e,this.fragments=i,this.tree=n,this.treeLen=s,this.viewport=r,this.skipped=o,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(t,e,i){return new Ta(t,e,[],bo.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Za(this.state.doc),this.fragments)}work(t,e){return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=bo.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(Eo.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Aa;Aa=this;try{return t()}finally{Aa=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=Ra(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=Eo.applyChanges(i,e),n=bo.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=Ra(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 Vo{createParse(e,i,n){let s=n[0].from,r=n[n.length-1].to;return{parsedPos:s,advance(){let e=Aa;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 bo(fo.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 Aa}}function Ra(t,e,i){return Eo.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class Ea{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 Ea(e)}static init(t){let e=Math.min(3e3,t.doc.length),i=Ta.create(t.facet(Wa).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new Ea(i)}}Pa.state=q.define({create:Ea.init,update(t,e){for(let t of e.effects)if(t.is(Pa.setState))return t.value;return e.startState.facet(Wa)!=e.state.facet(Wa)?Ea.init(e.state):t.apply(e)}});let Va=t=>{let e=setTimeout((()=>t()),500);return()=>clearTimeout(e)};"undefined"!=typeof requestIdleCallback&&(Va=t=>{let e=-1,i=setTimeout((()=>{e=requestIdleCallback(t,{timeout:400})}),100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const Ma="undefined"!=typeof navigator&&(null===(xa=navigator.scheduling)||void 0===xa?void 0:xa.isInputPending)?()=>navigator.scheduling.isInputPending():null,Da=_i.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(Pa.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),t.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(Pa.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=Va(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEndn+1e3,a=s.context.work((()=>Ma&&Ma()||Date.now()>r),n+(o?0:1e5));this.chunkBudget-=Date.now()-e,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Pa.setState.of(new Ea(s.context))})),this.chunkBudget>0&&(!a||o)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then((()=>this.scheduleWork())).catch((t=>Qi(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()}}}),Wa=E.define({combine:t=>t.length?t[0]:null,enables:t=>[Pa.state,Da,Ts.contentAttributes.compute([t],(e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}}))]});class Ua{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}class Ya{constructor(t,e,i,n,s,r=void 0){this.name=t,this.alias=e,this.extensions=i,this.filename=n,this.loadFunc=s,this.support=r,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then((t=>this.support=t),(t=>{throw this.loading=null,t})))}static of(t){let{load:e,support:i}=t;if(!e){if(!i)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");e=()=>Promise.resolve(i)}return new Ya(t.name,(t.alias||[]).concat(t.name).map((t=>t.toLowerCase())),t.extensions||[],t.filename,e,i)}static matchFilename(t,e){for(let i of t)if(i.filename&&i.filename.test(e))return i;let i=/\.([^.]+)$/.exec(e);if(i)for(let e of t)if(e.extensions.indexOf(i[1])>-1)return e;return null}static matchLanguageName(t,e,i=!0){e=e.toLowerCase();for(let i of t)if(i.alias.some((t=>t==e)))return i;if(i)for(let i of t)for(let t of i.alias){let n=e.indexOf(t);if(n>-1&&(t.length>2||!/\w/.test(e[n-1])&&!/\w/.test(e[n+t.length])))return i}return null}}const qa=E.define(),La=E.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 za(t){let e=t.facet(La);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function Ia(t,e){let i="",n=t.tabSize,s=t.facet(La)[0];if("\t"==s){for(;e>=n;)i+="\t",e-=n;s=" "}for(let t=0;t=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 Yt(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 Na=new ho;function Ga(t){let e=t.type.prop(Na);if(e)return e;let i,n=t.firstChild;if(n&&(i=n.type.prop(ho.closedBy))){let e=t.lastChild,n=e&&i.indexOf(e.name)>-1;return t=>el(t,!0,1,void 0,n&&!function(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}(t)?e.from:void 0)}return null==t.parent?Ha:null}function Fa(t,e,i){for(;t;t=t.parent){let n=Ga(t);if(n)return n(Ja.create(i,e,t))}return null}function Ha(){return 0}class Ja extends ja{constructor(t,e,i){super(t.state,t.options),this.base=t,this.pos=e,this.node=i}static create(t,e,i){return new Ja(t,e,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){let t=this.state.doc.lineAt(this.node.from);for(;;){let e=this.node.resolve(t.from);for(;e.parent&&e.parent.from==e.from;)e=e.parent;if(Ka(e,this.node))break;t=this.state.doc.lineAt(e.from)}return this.lineIndent(t.from)}continue(){let t=this.node.parent;return t?Fa(t,this.pos,this.base):0}}function Ka(t,e){for(let i=e;i;i=i.parent)if(t==i)return!0;return!1}function tl({closing:t,align:e=!0,units:i=1}){return n=>el(n,e,i,t)}function el(t,e,i,n,s){let r=t.textAfter,o=r.match(/^\s*/)[0].length,a=n&&r.slice(o,o+n.length)==n||s==t.pos+o,l=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.from{let n=t&&t.test(i.textAfter);return i.baseIndent+(n?0:e*i.unit)}}function nl(){return xt.transactionFilter.of((t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let i=t.newDoc,{head:n}=t.newSelection.main,s=i.lineAt(n);if(n>s.from+200)return t;let r=i.sliceString(s.from,n);if(!e.some((t=>t.test(r))))return t;let{state:o}=t,a=-1,l=[];for(let{head:t}of o.selection.ranges){let e=o.doc.lineAt(t);if(e.from==a)continue;a=e.from;let i=Ba(o,e.from);if(null==i)continue;let n=/^\s*/.exec(e.text)[0],s=Ia(o,i);n!=s&&l.push({from:e.from,to:e.from+n.length,insert:s})}return l.length?[t,{changes:l,sequential:!0}]:t}))}const sl=E.define(),rl=new ho;function ol(t){let e=t.firstChild,i=t.lastChild;return e&&e.toi)continue;if(s&&r.from=e&&n.to>i&&(s=n)}}return s}(t,e,i)}function hl(t,e){let i=e.mapPos(t.from,1),n=e.mapPos(t.to,-1);return i>=n?void 0:{from:i,to:n}}const cl=ut.define({map:hl}),ul=ut.define({map:hl}),dl=q.define({create:()=>ni.none,update(t,e){t=t.map(e.changes);for(let i of e.effects)i.is(cl)&&!pl(t,i.value.from,i.value.to)?t=t.update({add:[bl.range(i.value.from,i.value.to)]}):i.is(ul)&&(t=t.update({filter:(t,e)=>i.value.from!=t||i.value.to!=e,filterFrom:i.value.from,filterTo:i.value.to}));if(e.selection){let i=!1,{head:n}=e.selection.main;t.between(n,n,((t,e)=>{tn&&(i=!0)})),i&&(t=t.update({filterFrom:n,filterTo:n,filter:(t,e)=>e<=n||t>=n}))}return t},provide:t=>Ts.decorations.from(t),toJSON(t,e){let i=[];return t.between(0,e.doc.length,((t,e)=>{i.push(t,e)})),i},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let i=0;i{(!s||s.from>t)&&(s={from:t,to:e})})),s}function pl(t,e,i){let n=!1;return t.between(e,e,((t,s)=>{t==e&&s==i&&(n=!0)})),n}const Ol={placeholderDOM:null,placeholderText:"…"},gl=E.define({combine:t=>kt(t,Ol)});function ml(t){let e=[dl,yl];return t&&e.push(gl.of(t)),e}const bl=ni.replace({widget:new class extends ei{toDOM(t){let{state:e}=t,i=e.facet(gl),n=e=>{let i=t.lineBlockAt(t.posAtDOM(e.target)),n=fl(t.state,i.from,i.to);n&&t.dispatch({effects:ul.of(n)}),e.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(t,n);let s=document.createElement("span");return s.textContent=i.placeholderText,s.setAttribute("aria-label",e.phrase("folded code")),s.title=e.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=n,s}}}),wl={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class vl extends Yr{constructor(t,e){super(),this.config=t,this.open=e}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let e=document.createElement("span");return e.textContent=this.open?this.config.openText:this.config.closedText,e.title=t.state.phrase(this.open?"Fold line":"Unfold line"),e}}const yl=Ts.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Sl{constructor(t,e){let i;function n(t){let e=It.newName();return(i||(i=Object.create(null)))["."+e]=t,e}this.specs=t;const s="string"==typeof e.all?e.all:e.all?n(e.all):void 0,r=e.scope;this.scope=r instanceof Pa?t=>t.prop(ka)==r.data:r?t=>t==r:void 0,this.style=sa(t.map((t=>({tag:t.tag,class:t.class||n(Object.assign({},t,{tag:null}))}))),{all:s}).style,this.module=i?new It(i):null,this.themeType=e.themeType}static define(t,e){return new Sl(t,e||{})}}const xl=E.define(),kl=E.define({combine:t=>t.length?[t[0]]:null});function Ql(t){let e=t.facet(xl);return e.length?e:t.facet(kl)}function $l(t,e){let i,n=[Cl];return t instanceof Sl&&(t.module&&n.push(Ts.styleModule.of(t.module)),i=t.themeType),(null==e?void 0:e.fallback)?n.push(kl.of(t)):i?n.push(xl.computeN([Ts.darkTheme],(e=>e.facet(Ts.darkTheme)==("dark"==i)?[t]:[]))):n.push(xl.of(t)),n}class Pl{constructor(t){this.markCache=Object.create(null),this.tree=Xa(t.state),this.decorations=this.buildDeco(t,Ql(t.state))}update(t){let e=Xa(t.state),i=Ql(t.state),n=i!=Ql(t.startState);e.length{i.add(t,e,this.markCache[n]||(this.markCache[n]=ni.mark({class:n})))}),n,s);return i.finish()}}const Cl=N.high(_i.fromClass(Pl,{decorations:t=>t.decorations})),_l=Sl.define([{tag:Sa.meta,color:"#404740"},{tag:Sa.link,textDecoration:"underline"},{tag:Sa.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Sa.emphasis,fontStyle:"italic"},{tag:Sa.strong,fontWeight:"bold"},{tag:Sa.strikethrough,textDecoration:"line-through"},{tag:Sa.keyword,color:"#708"},{tag:[Sa.atom,Sa.bool,Sa.url,Sa.contentSeparator,Sa.labelName],color:"#219"},{tag:[Sa.literal,Sa.inserted],color:"#164"},{tag:[Sa.string,Sa.deleted],color:"#a11"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],color:"#e40"},{tag:Sa.definition(Sa.variableName),color:"#00f"},{tag:Sa.local(Sa.variableName),color:"#30a"},{tag:[Sa.typeName,Sa.namespace],color:"#085"},{tag:Sa.className,color:"#167"},{tag:[Sa.special(Sa.variableName),Sa.macroName],color:"#256"},{tag:Sa.definition(Sa.propertyName),color:"#00c"},{tag:Sa.comment,color:"#940"},{tag:Sa.invalid,color:"#f00"}]),Xl=Ts.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Zl=1e4,Al="()[]{}",Tl=E.define({combine:t=>kt(t,{afterCursor:!0,brackets:Al,maxScanDistance:Zl,renderMatch:Vl})}),Rl=ni.mark({class:"cm-matchingBracket"}),El=ni.mark({class:"cm-nonmatchingBracket"});function Vl(t){let e=[],i=t.matched?Rl:El;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 Ml=q.define({create:()=>ni.none,update(t,e){if(!e.docChanged&&!e.selection)return t;let i=[],n=e.state.facet(Tl);for(let t of e.state.selection.ranges){if(!t.empty)continue;let s=Ll(e.state,t.head,-1,n)||t.head>0&&Ll(e.state,t.head-1,1,n)||n.afterCursor&&(Ll(e.state,t.head,1,n)||t.headTs.decorations.from(t)}),Dl=[Ml,Xl];function Wl(t={}){return[Tl.of(t),Dl]}const Ul=new ho;function Yl(t,e,i){let n=t.prop(e<0?ho.openedBy:ho.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 ql(t){let e=t.type.prop(Ul);return e?e(t.node):t}function Ll(t,e,i,n={}){let s=n.maxScanDistance||Zl,r=n.brackets||Al,o=Xa(t),a=o.resolveInner(e,i);for(let n=a;n;n=n.parent){let s=Yl(n.type,i,r);if(s&&n.from0?e>=o.from&&eo.from&&e<=o.to))return zl(t,e,i,n,o,s,r)}}return function(t,e,i,n,s,r,o){let a=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%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 a=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(a+t,1).type!=s))if(e%2==0==i>0)u++;else{if(1==u)return{start:h,end:{from:a+t,to:a+t+1},matched:e>>1==l>>1};u--}}i>0&&(t+=r.length)}return c.done?{start:h,matched:!1}:null}(t,e,i,o,a.type,s,r)}function zl(t,e,i,n,s,r,o){let a=n.parent,l={from:s.from,to:s.to},h=0,c=null==a?void 0:a.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 jl(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 Nl=new WeakMap;class Gl extends Pa{constructor(t){let e,i=Qa(t.languageData),n={name:(s=t).name||"",token:s.token,blankLine:s.blankLine||(()=>{}),startState:s.startState||(()=>!0),copyState:s.copyState||jl,indent:s.indent||(()=>null),languageData:s.languageData||{},tokenTable:s.tokenTable||th};var s;super(i,new class extends Vo{createParse(t,i,n){return new Jl(e,t,i,n)}},[qa.of(((t,e)=>this.getIndent(t,e)))],t.name),this.topNode=function(t){let e=fo.define({id:eh.length,name:"Document",props:[ka.add((()=>t))]});return eh.push(e),e}(i),e=this,this.streamParser=n,this.stateAfter=new ho({perNode:!0}),this.tokenTable=t.tokenTable?new rh(n.tokenTable):oh}static define(t){return new Gl(t)}getIndent(t,e){let i,n=Xa(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=Nl.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],a=i+e.positions[r],l=o instanceof bo&&a=e.length)return e;s||e.type!=t.topNode||(s=!0);for(let r=e.children.length-1;r>=0;r--){let o,a=e.positions[r],l=e.children[r];if(ai&&Fl(t,n.tree,0-n.offset,i,r);if(o&&(e=Hl(t,n.tree,i+n.offset,o.pos+n.offset,!1)))return{state:o.state,tree:e}}return{state:t.streamParser.startState(n?za(n):4),tree:bo.empty}}(t,i,r,null==s?void 0:s.state);this.state=o,this.parsedPos=this.chunkStart=r+a.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 Bl(e,t?t.state.tabSize:4,t?za(t.state):2);if(r.eol())s.blankLine(this.state,r.indentUnit);else for(;!r.eol();){let t=Kl(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 th=Object.create(null),eh=[fo.none],ih=new po(eh),nh=[],sh=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"]])sh[t]=lh(th,e);class rh{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),sh)}resolve(t){return t?this.table[t]||(this.table[t]=lh(this.extra,t)):0}}const oh=new rh(th);function ah(t,e){nh.indexOf(t)>-1||(nh.push(t),console.warn(e))}function lh(t,e){let i=null;for(let n of e.split(".")){let e=t[n]||Sa[n];e?"function"==typeof e?i?i=e(i):ah(n,`Modifier ${n} used at start of tag`):i?ah(n,`Tag ${n} used as modifier`):i=e:ah(n,`Unknown highlighting tag ${n}`)}if(!i)return 0;let n=e.replace(/ /g,"_"),s=fo.define({id:eh.length,name:n,props:[ea({[n]:i})]});return eh.push(s),s.id}function hh(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 ch=hh(gh,0),uh=hh(Oh,0),dh=hh(((t,e)=>Oh(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 fh(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}const ph=50;function Oh(t,e,i=e.selection.ranges){let n=i.map((t=>fh(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,a=t.sliceDoc(n-ph,n),l=t.sliceDoc(s,s+ph),h=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(l)[0].length,u=a.length-h;if(a.slice(u-e.length,u)==e&&l.slice(c,c+i.length)==i)return{open:{pos:n-h,margin:h&&1},close:{pos:s+c,margin:c&&1}};s-n<=2*ph?r=o=t.sliceDoc(n,s):(r=t.sliceDoc(n,n+ph),o=t.sliceDoc(s-ph,s));let d=/^\s*/.exec(r)[0].length,f=/\s*$/.exec(o)[0].length,p=o.length-f-i.length;return r.slice(d,d+e.length)==e&&o.slice(p,p+i.length)==i?{open:{pos:n+d+e.length,margin:/\s/.test(r.charAt(d+e.length))?1:0},close:{pos:s-f-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>l.from)){s=l.from;let t=/^\s*/.exec(l.text)[0].length,e=t==l.length,i=l.text.slice(t,t+a.length)==a?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 mh=lt.define(),bh=lt.define(),wh=E.define(),vh=E.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)})});const yh=q.define({create:()=>Dh.empty,update(t,e){let i=e.state.facet(vh),n=e.annotation(mh);if(n){let s=e.docChanged?A.single(function(t){let e=0;return t.iterChangedRanges(((t,i)=>e=i)),e}(e.changes)):void 0,r=Ch.fromTransaction(e,s),o=n.side,a=0==o?t.undone:t.done;return a=r?_h(a,a.length,i.minDepth,r):Th(a,e.startState.selection),new Dh(0==o?n.rest:a,0==o?a:n.rest)}let s=e.annotation(bh);if("full"!=s&&"before"!=s||(t=t.isolate()),!1===e.annotation(dt.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);let r=Ch.fromTransaction(e),o=e.annotation(dt.time),a=e.annotation(dt.userEvent);return r?t=t.addChanges(r,o,a,i,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,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 Dh(t.done.map(Ch.fromJSON),t.undone.map(Ch.fromJSON))});function Sh(t={}){return[yh,vh.of(t),Ts.domEventHandlers({beforeinput(t,e){let i="historyUndo"==t.inputType?kh:"historyRedo"==t.inputType?Qh:null;return!!i&&(t.preventDefault(),i(e))}})]}function xh(t,e){return function({state:i,dispatch:n}){if(!e&&i.readOnly)return!1;let s=i.field(yh,!1);if(!s)return!1;let r=s.pop(t,i,e);return!!r&&(n(r),!0)}}const kh=xh(0,!1),Qh=xh(1,!1),$h=xh(0,!0),Ph=xh(1,!0);class Ch{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 Ch(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 Ch(t.changes&&k.fromJSON(t.changes),[],t.mapped&&x.fromJSON(t.mapped),t.startSelection&&A.fromJSON(t.startSelection),t.selectionsAfter.map(A.fromJSON))}static fromTransaction(t,e){let i=Zh;for(let e of t.startState.facet(wh)){let n=e(t);n.length&&(i=i.concat(n))}return!i.length&&t.changes.empty?null:new Ch(t.changes.invert(t.startState.doc),i,void 0,e||t.startState.selection,Zh)}static selection(t){return new Ch(void 0,Zh,void 0,void 0,t)}}function _h(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 Xh(t,e){return t.length?e.length?t.concat(e):t:e}const Zh=[],Ah=200;function Th(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-Ah));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),_h(t,t.length-1,1e9,i.setSelAfter(n)))}return[Ch.selection([e])]}function Rh(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 Eh(t,e){if(!t.length)return t;let i=t.length,n=Zh;for(;i;){let s=Vh(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?[Ch.selection(n)]:Zh}function Vh(t,e,i){let n=Xh(t.selectionsAfter.length?t.selectionsAfter.map((t=>t.map(e))):Zh,i);if(!t.changes)return Ch.selection(n);let s=t.changes.map(e),r=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(r):r;return new Ch(s,ut.mapEffects(t.effects,e),o,t.startSelection.map(r),n)}const Mh=/^(input\.type|delete)($|\.)/;class Dh{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 Dh(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||Mh.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)?_h(r,r.length-1,n.minDepth,new Ch(t.changes.compose(o.changes),Xh(t.effects,o.effects),o.mapped,o.startSelection,Zh)):_h(r,r.length,n.minDepth,t),new Dh(r,Zh,e,i)}addSelection(t,e,i,n){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Zh;return s.length>0&&e-this.prevTimet.empty!=o.ranges[e].empty)).length)?this:new Dh(Th(this.done,t),this.undone,e,i);var r,o}addMapping(t){return new Dh(Eh(this.done,t),Eh(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:mh.of({side:t,rest:Rh(n)}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let i=1==n.length?Zh:n.slice(0,n.length-1);return s.mapped&&(i=Eh(i,s.mapped)),e.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:mh.of({side:t,rest:i}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}}Dh.empty=new Dh(Zh,Zh);const Wh=[{key:"Mod-z",run:kh,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Qh,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Qh,preventDefault:!0},{key:"Mod-u",run:$h,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Ph,preventDefault:!0}];function Uh(t,e){return A.create(t.ranges.map(e),t.mainIndex)}function Yh(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function qh({state:t,dispatch:e},i){let n=Uh(t.selection,i);return!n.eq(t.selection)&&(e(Yh(t,n)),!0)}function Lh(t,e){return A.cursor(e?t.to:t.from)}function zh(t,e){return qh(t,(i=>i.empty?t.moveByChar(i,e):Lh(i,e)))}function Ih(t){return t.textDirectionAt(t.state.selection.main.head)==Wi.LTR}const Bh=t=>zh(t,!Ih(t)),jh=t=>zh(t,Ih(t));function Nh(t,e){return qh(t,(i=>i.empty?t.moveByGroup(i,e):Lh(i,e)))}function Gh(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 Fh(t,e,i){let n,s,r=Xa(t).resolveInner(e.head),o=i?ho.closedBy:ho.openedBy;for(let n=e.head;;){let e=i?r.childAfter(n):r.childBefore(n);if(!e)break;Gh(t,e,o)?r=e:n=i?e.to:e.from}return s=r.type.prop(o)&&(n=i?Ll(t,r.from,1):Ll(t,r.to,-1))&&n.matched?i?n.end.to:n.end.from:i?r.to:r.from,A.cursor(s,i?-1:1)}function Hh(t,e){return qh(t,(i=>{if(!i.empty)return Lh(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)}))}const Jh=t=>Hh(t,!1),Kh=t=>Hh(t,!0);function tc(t){let e,i=t.scrollDOM.clientHeighti.empty?t.moveVertically(i,e,n.height):Lh(i,e)));if(r.eq(s.selection))return!1;if(n.selfScroll){let e=t.coordsAtPos(s.selection.main.head),o=t.scrollDOM.getBoundingClientRect(),a=o.top+n.marginTop,l=o.bottom-n.marginBottom;e&&e.top>a&&e.bottomec(t,!1),nc=t=>ec(t,!0);function sc(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=A.cursor(n.from+i))}return s}function rc(t,e){let i=Uh(t.state.selection,(t=>{let i=e(t);return A.range(t.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)}));return!i.eq(t.state.selection)&&(t.dispatch(Yh(t.state,i)),!0)}function oc(t,e){return console.log("Select!"),rc(t,(i=>t.moveByCharSelected(i,e)))}const ac=t=>oc(t,!Ih(t)),lc=t=>oc(t,Ih(t));function hc(t,e){return rc(t,(i=>t.moveByGroup(i,e)))}function cc(t,e){return rc(t,(i=>t.moveVertically(i,e)))}const uc=t=>cc(t,!1),dc=t=>cc(t,!0);function fc(t,e){return rc(t,(i=>t.moveVertically(i,e,tc(t).height)))}const pc=t=>fc(t,!1),Oc=t=>fc(t,!0),gc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:0})),!0),mc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.doc.length})),!0),bc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:0})),!0),wc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0);function vc(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=yc(t,n,!0)),s=Math.min(s,n),r=Math.max(r,n)}else s=yc(t,s,!1),r=yc(t,r,!0);return s==r?{range:n}:{changes:{from:s,to:r},range:A.cursor(s)}}));return!s.changes.empty&&(t.dispatch(n.update(s,{scrollIntoView:!0,userEvent:i,effects:"delete.selection"==i?Ts.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function yc(t,e,i){if(t instanceof Ts)for(let n of t.state.facet(Ts.atomicRanges).map((e=>e(t))))n.between(e,e,((t,n)=>{te&&(e=i?n:t)}));return e}const Sc=(t,e)=>vc(t,(i=>{let n,s,{state:r}=t,o=r.doc.lineAt(i);if(!e&&i>o.from&&iSc(t,!1),kc=t=>Sc(t,!0),Qc=(t,e)=>vc(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 a=f(r.text,n-r.from,e)+r.from,l=r.text.slice(Math.min(n,a)-r.from,Math.max(n,a)-r.from),h=o(l);if(null!=t&&h!=t)break;" "==l&&n==i||(t=h),n=a}return n})),$c=t=>Qc(t,!1),Pc=t=>vc(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 _c(t,e,i){if(t.readOnly)return!1;let n=[],s=[];for(let e of Cc(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(A.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(A.range(t.anchor-o,t.head-o))}}return!!n.length&&(e(t.update({changes:n,scrollIntoView:!0,selection:A.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0)}function Xc(t,e,i){if(t.readOnly)return!1;let n=[];for(let e of Cc(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 Zc=Ac(!1);function Ac(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),a=!e&&s==r&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i,n=Xa(t).resolveInner(e),s=n.childBefore(e),r=n.childAfter(e);return s&&r&&s.to<=e&&r.from>=e&&(i=s.type.prop(ho.closedBy))&&i.indexOf(r.name)>-1&&t.doc.lineAt(s.to).from==t.doc.lineAt(r.from).from?{from:s.to,to:r.from}:null}(i,s);e&&(s=r=(r<=o.to?o:i.doc.lineAt(r)).to);let l=new ja(i,{simulateBreak:s,simulateDoubleBreak:!!a}),h=Ba(l,s);for(null==h&&(h=/^\s*/.exec(i.doc.lineAt(s).text)[0].length);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:A.range(r.mapPos(n.anchor,1),r.mapPos(n.head,1))}}))}const Rc=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{i.push({from:e.from,insert:t.facet(La)})})),{userEvent:"input.indent"})),!0),Ec=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{let n=/^\s*/.exec(e.text)[0];if(!n)return;let s=Yt(n,t.tabSize),r=0,o=Ia(t,Math.max(0,s-za(t)));for(;rqh(t,(e=>Fh(t.state,e,!Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,!Ih(t))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:t=>qh(t,(e=>Fh(t.state,e,Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,Ih(t))))},{key:"Alt-ArrowUp",run:({state:t,dispatch:e})=>_c(t,e,!1)},{key:"Shift-Alt-ArrowUp",run:({state:t,dispatch:e})=>Xc(t,e,!1)},{key:"Alt-ArrowDown",run:({state:t,dispatch:e})=>_c(t,e,!0)},{key:"Shift-Alt-ArrowDown",run:({state:t,dispatch:e})=>Xc(t,e,!0)},{key:"Escape",run:({state:t,dispatch:e})=>{let i=t.selection,n=null;return i.ranges.length>1?n=A.create([i.main]):i.main.empty||(n=A.create([A.cursor(i.main.head)])),!!n&&(e(Yh(t,n)),!0)}},{key:"Mod-Enter",run:Ac(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:t,dispatch:e})=>{let i=Cc(t).map((({from:e,to:i})=>A.range(e,Math.min(i+1,t.doc.length))));return e(t.update({selection:A.create(i),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:t,dispatch:e})=>{let i=Uh(t.selection,(e=>{var i;let n=Xa(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 A.range(n.to,n.from)}));return e(Yh(t,i)),!0},preventDefault:!0},{key:"Mod-[",run:Ec},{key:"Mod-]",run:Rc},{key:"Mod-Alt-\\",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new ja(t,{overrideIndentation:t=>{let e=i[t];return null==e?-1:e}}),s=Tc(t,((e,s,r)=>{let o=Ba(n,e.from);if(null==o)return;/\S/.test(e.text)||(o=0);let a=/^\s*/.exec(e.text)[0],l=Ia(t,o);(a!=l||r.from{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(Cc(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=Uh(t.selection,(e=>{let s=Ll(t,e.head,-1)||Ll(t,e.head,1)||e.head>0&&Ll(t,e.head-1,1)||e.head{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=fh(t.state,i.from);return n.line?ch(t):!!n.block&&dh(t)}},{key:"Alt-A",run:uh}].concat([{key:"ArrowLeft",run:Bh,shift:ac,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:t=>Nh(t,!Ih(t)),shift:t=>hc(t,!Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:t=>qh(t,(e=>sc(t,e,!Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,!Ih(t)))),preventDefault:!0},{key:"ArrowRight",run:jh,shift:lc,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:t=>Nh(t,Ih(t)),shift:t=>hc(t,Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:t=>qh(t,(e=>sc(t,e,Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,Ih(t)))),preventDefault:!0},{key:"ArrowUp",run:Jh,shift:uc,preventDefault:!0},{mac:"Cmd-ArrowUp",run:gc,shift:bc},{mac:"Ctrl-ArrowUp",run:ic,shift:pc},{key:"ArrowDown",run:Kh,shift:dc,preventDefault:!0},{mac:"Cmd-ArrowDown",run:mc,shift:wc},{mac:"Ctrl-ArrowDown",run:nc,shift:Oc},{key:"PageUp",run:ic,shift:pc},{key:"PageDown",run:nc,shift:Oc},{key:"Home",run:t=>qh(t,(e=>sc(t,e,!1))),shift:t=>rc(t,(e=>sc(t,e,!1))),preventDefault:!0},{key:"Mod-Home",run:gc,shift:bc},{key:"End",run:t=>qh(t,(e=>sc(t,e,!0))),shift:t=>rc(t,(e=>sc(t,e,!0))),preventDefault:!0},{key:"Mod-End",run:mc,shift:wc},{key:"Enter",run:Zc},{key:"Mod-a",run:({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:xc,shift:xc},{key:"Delete",run:kc},{key:"Mod-Backspace",mac:"Alt-Backspace",run:$c},{key:"Mod-Delete",mac:"Alt-Delete",run:t=>Qc(t,!0)},{mac:"Mod-Backspace",run:t=>vc(t,(e=>{let i=t.lineBlockAt(e).from;return e>i?i:Math.max(0,e-1)}))},{mac:"Mod-Delete",run:Pc}].concat([{key:"Ctrl-b",run:Bh,shift:ac,preventDefault:!0},{key:"Ctrl-f",run:jh,shift:lc},{key:"Ctrl-p",run:Jh,shift:uc},{key:"Ctrl-n",run:Kh,shift:dc},{key:"Ctrl-a",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).from,1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).from)))},{key:"Ctrl-e",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).to,-1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).to)))},{key:"Ctrl-d",run:kc},{key:"Ctrl-h",run:xc},{key:"Ctrl-k",run:Pc},{key:"Ctrl-Alt-h",run:$c},{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:A.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:f(n.text,i-n.from,!1)+n.from,r=i==n.to?i+1:f(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:A.cursor(r)}}));return!i.changes.empty&&(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:nc}].map((t=>({mac:t.key,run:t.run,shift:t.shift})))));function Mc(){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 Uc{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(Wc(t)):Wc,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 b(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=w(t),i=this.bufferStart+this.bufferPos;this.bufferPos+=v(t);let n=this.normalize(e);for(let t=0,s=i;;t++){let r=n.charCodeAt(t),o=this.match(r,s);if(o)return this.value=o,this;if(t==n.length-1)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=jc(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 Ic(e,t.sliceString(e,i));return zc.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=jc(this.text,i+(t==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ic.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function jc(t,e){if(e>=t.length)return e;let i,n=t.lineAt(e);for(;e=56320&&i<57344;)e++;return e}function Nc(t){let e=Mc("input",{class:"cm-textfield",name:"line"});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,a,l]=i,h=a?+a.slice(1):0,c=o?+o:s.number;if(o&&l){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)));t.dispatch({effects:Gc.of(!1),selection:A.cursor(u.from+Math.max(0,Math.min(h,u.length))),scrollIntoView:!0}),t.focus()}return{dom:Mc("form",{class:"cm-gotoLine",onkeydown:e=>{27==e.keyCode?(e.preventDefault(),t.dispatch({effects:Gc.of(!1)}),t.focus()):13==e.keyCode&&(e.preventDefault(),i())},onsubmit:t=>{t.preventDefault(),i()}},Mc("label",t.state.phrase("Go to line"),": ",e)," ",Mc("button",{class:"cm-button",type:"submit"},t.state.phrase("go")))}}"undefined"!=typeof Symbol&&(Lc.prototype[Symbol.iterator]=Bc.prototype[Symbol.iterator]=function(){return this});const Gc=ut.define(),Fc=q.define({create:()=>!0,update(t,e){for(let i of e.effects)i.is(Gc)&&(t=i.value);return t},provide:t=>Ur.from(t,(t=>t?Nc:null))}),Hc=Ts.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),Jc={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Kc=E.define({combine:t=>kt(t,Jc,{highlightWordAroundCursor:(t,e)=>t||e,minSelectionLength:Math.min,maxMatches:Math.min})});function tu(t){let e=[ru,su];return t&&e.push(Kc.of(t)),e}const eu=ni.mark({class:"cm-selectionMatch"}),iu=ni.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function nu(t,e,i,n){return!(0!=i&&t(e.sliceDoc(i-1,i))==wt.Word||n!=e.doc.length&&t(e.sliceDoc(n,n+1))==wt.Word)}const su=_i.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(Kc),{state:i}=t,n=i.selection;if(n.ranges.length>1)return ni.none;let s,r=n.main,o=null;if(r.empty){if(!e.highlightWordAroundCursor)return ni.none;let t=i.wordAt(r.head);if(!t)return ni.none;o=i.charCategorizer(r.head),s=i.sliceDoc(t.from,t.to)}else{let t=r.to-r.from;if(t200)return ni.none;if(e.wholeWords){if(s=i.sliceDoc(r.from,r.to),o=i.charCategorizer(r.head),!nu(o,i,r.from,r.to)||!function(t,e,i,n){return t(e.sliceDoc(i,i+1))==wt.Word&&t(e.sliceDoc(n-1,n))==wt.Word}(o,i,r.from,r.to))return ni.none}else if(s=i.sliceDoc(r.from,r.to).trim(),!s)return ni.none}let a=[];for(let n of t.visibleRanges){let t=new Uc(i.doc,s,n.from,n.to);for(;!t.next().done;){let{from:n,to:s}=t.value;if((!o||nu(o,i,n,s))&&(r.empty&&n<=r.from&&s>=r.to?a.push(iu.range(n,s)):(n>=r.to||s<=r.from)&&a.push(eu.range(n,s)),a.length>e.maxMatches))return ni.none}}return ni.set(a)}},{decorations:t=>t.decorations}),ru=Ts.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});const ou=E.define({combine:t=>kt(t,{top:!1,caseSensitive:!1,literal:!1,wholeWord:!1,createPanel:t=>new Eu(t),scrollToMatch:t=>Ts.scrollIntoView(t)})});class au{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,qc),!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 pu(this):new cu(this)}getCursor(t,e=0,i){let n=t.doc?t:xt.create({doc:t});return null==i&&(i=n.doc.length),this.regexp?uu(this,n,e,i):hu(this,n,e,i)}}class lu{constructor(t){this.spec=t}}function hu(t,e,i,n){return new Uc(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=hu(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 uu(t,e,i,n){return new Lc(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?(s=e.charCategorizer(e.selection.main.head),(t,e,i)=>!i[0].length||(s(du(i.input,i.index))!=wt.Word||s(fu(i.input,i.index))!=wt.Word)&&(s(fu(i.input,i.index+i[0].length))!=wt.Word||s(du(i.input,i.index+i[0].length))!=wt.Word)):void 0},i,n);var s}function du(t,e){return t.slice(f(t,e,!1),e)}function fu(t,e){return t.slice(e,f(t,e))}class pu extends lu{nextMatch(t,e,i){let n=uu(this.spec,t,i,t.doc.length).next();return n.done&&(n=uu(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=uu(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=uu(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 Ou=ut.define(),gu=ut.define(),mu=q.define({create:t=>new bu(_u(t).create(),null),update(t,e){for(let i of e.effects)i.is(Ou)?t=new bu(i.value.create(),t.panel):i.is(gu)&&(t=new bu(t.query,i.value?Cu:null));return t},provide:t=>Ur.from(t,(t=>t.panel))});class bu{constructor(t,e){this.query=t,this.panel=e}}const wu=ni.mark({class:"cm-searchMatch"}),vu=ni.mark({class:"cm-searchMatch cm-searchMatch-selected"}),yu=_i.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(mu))}update(t){let e=t.state.field(mu);(e!=t.startState.field(mu)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ni.none;let{view:i}=this,n=new Xt;for(let e=0,s=i.visibleRanges,r=s.length;es[e+1].from-500;)a=s[++e].to;t.highlight(i.state,o,a,((t,e)=>{let s=i.state.selection.ranges.some((i=>i.from==t&&i.to==e));n.add(t,e,s?vu:wu)}))}return n.finish()}},{decorations:t=>t.decorations});function Su(t){return e=>{let i=e.state.field(mu,!1);return i&&i.query.spec.valid?t(e,i):Au(e)}}const xu=Su(((t,{query:e})=>{let{to:i}=t.state.selection.main,n=e.nextMatch(t.state,i,i);if(!n)return!1;let s=A.single(n.from,n.to),r=t.state.facet(ou);return t.dispatch({selection:s,effects:[Wu(t,n),r.scrollToMatch(s.main,t)],userEvent:"select.search"}),Zu(t),!0})),ku=Su(((t,{query:e})=>{let{state:i}=t,{from:n}=i.selection.main,s=e.prevMatch(i,n,n);if(!s)return!1;let r=A.single(s.from,s.to),o=t.state.facet(ou);return t.dispatch({selection:r,effects:[Wu(t,s),o.scrollToMatch(r.main,t)],userEvent:"select.search"}),Zu(t),!0})),Qu=Su(((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!(!i||!i.length)&&(t.dispatch({selection:A.create(i.map((t=>A.range(t.from,t.to)))),userEvent:"select.search.matches"}),!0)})),$u=Su(((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,a,l=[],h=[];if(r.from==n&&r.to==s&&(a=i.toText(e.getReplacement(r)),l.push({from:r.from,to:r.to,insert:a}),r=e.nextMatch(i,r.from,r.to),h.push(Ts.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(n).number)+"."))),r){let e=0==l.length||l[0].from>=r.to?0:r.to-r.from-a.length;o=A.single(r.from-e,r.to-e),h.push(Wu(t,r)),h.push(i.facet(ou).scrollToMatch(o.main,t))}return t.dispatch({changes:l,selection:o,effects:h,userEvent:"input.replace"}),!0})),Pu=Su(((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:Ts.announce.of(n),userEvent:"input.replace.all"}),!0}));function Cu(t){return t.state.facet(ou).createPanel(t)}function _u(t,e){var i,n,s,r;let o=t.selection.main,a=o.empty||o.to>o.from+100?"":t.sliceDoc(o.from,o.to);if(e&&!a)return e;let l=t.facet(ou);return new au({search:(null!==(i=null==e?void 0:e.literal)&&void 0!==i?i:l.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:null!==(n=null==e?void 0:e.caseSensitive)&&void 0!==n?n:l.caseSensitive,literal:null!==(s=null==e?void 0:e.literal)&&void 0!==s?s:l.literal,wholeWord:null!==(r=null==e?void 0:e.wholeWord)&&void 0!==r?r:l.wholeWord})}function Xu(t){let e=Vr(t,Cu);return e&&e.dom.querySelector("[main-field]")}function Zu(t){let e=Xu(t);e&&e==t.root.activeElement&&e.select()}const Au=t=>{let e=t.state.field(mu,!1);if(e&&e.panel){let i=Xu(t);if(i&&i!=t.root.activeElement){let n=_u(t.state,e.query.spec);n.valid&&t.dispatch({effects:Ou.of(n)}),i.focus(),i.select()}}else t.dispatch({effects:[gu.of(!0),e?Ou.of(_u(t.state,e.query.spec)):ut.appendConfig.of(Yu)]});return!0},Tu=t=>{let e=t.state.field(mu,!1);if(!e||!e.panel)return!1;let i=Vr(t,Cu);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:gu.of(!1)}),!0},Ru=[{key:"Mod-f",run:Au,scope:"editor search-panel"},{key:"F3",run:xu,shift:ku,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:xu,shift:ku,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Tu,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 Uc(t.doc,t.sliceDoc(n,s));!e.next().done;){if(r.length>1e3)return!1;e.value.from==n&&(o=r.length),r.push(A.range(e.value.from,e.value.to))}return e(t.update({selection:A.create(r,o),userEvent:"select.search.matches"})),!0}},{key:"Alt-g",run:t=>{let e=Vr(t,Nc);if(!e){let i=[Gc.of(!0)];null==t.state.field(Fc,!1)&&i.push(ut.appendConfig.of([Fc,Hc])),t.dispatch({effects:i}),e=Vr(t,Nc)}return e&&e.dom.querySelector("input").focus(),!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=A.create(i.ranges.map((e=>t.wordAt(e.head)||A.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 Uc(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 Uc(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(A.range(s.from,s.to),!1),effects:Ts.scrollIntoView(s.to)})),!0)},preventDefault:!0}];class Eu{constructor(t){this.view=t;let e=this.query=t.state.field(mu).query.spec;function i(t,e,i){return Mc("button",{class:"cm-button",name:t,onclick:e,type:"button"},i)}this.commit=this.commit.bind(this),this.searchField=Mc("input",{value:e.search,placeholder:Vu(t,"Find"),"aria-label":Vu(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Mc("input",{value:e.replace,placeholder:Vu(t,"Replace"),"aria-label":Vu(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Mc("input",{type:"checkbox",name:"case",form:"",checked:e.caseSensitive,onchange:this.commit}),this.reField=Mc("input",{type:"checkbox",name:"re",form:"",checked:e.regexp,onchange:this.commit}),this.wordField=Mc("input",{type:"checkbox",name:"word",form:"",checked:e.wholeWord,onchange:this.commit}),this.dom=Mc("div",{onkeydown:t=>this.keydown(t),class:"cm-search"},[this.searchField,i("next",(()=>xu(t)),[Vu(t,"next")]),i("prev",(()=>ku(t)),[Vu(t,"previous")]),i("select",(()=>Qu(t)),[Vu(t,"all")]),...t.state.readOnly?[]:[Mc("br"),this.replaceField,i("replace",(()=>$u(t)),[Vu(t,"replace")]),i("replaceAll",(()=>Pu(t)),[Vu(t,"replace all")])],Mc("button",{name:"close",onclick:()=>Tu(t),"aria-label":Vu(t,"close"),type:"button"},["×"])])}commit(){let t=new au({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:Ou.of(t)}))}keydown(t){var e,i,n;e=this.view,i=t,n="search-panel",Bs(Ls(e.state),i,e,n)?t.preventDefault():13==t.keyCode&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?ku:xu)(this.view)):13==t.keyCode&&t.target==this.replaceField&&(t.preventDefault(),$u(this.view))}update(t){for(let e of t.transactions)for(let t of e.effects)t.is(Ou)&&!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(ou).top}}function Vu(t,e){return t.state.phrase(e)}const Mu=30,Du=/[\s\.,:;?!]/;function Wu(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-Mu),o=Math.min(s,i+Mu),a=t.state.sliceDoc(r,o);if(r!=n.from)for(let t=0;ta.length-Mu;t--)if(!Du.test(a[t-1])&&Du.test(a[t])){a=a.slice(0,t);break}return Ts.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${n.number}.`)}const Uu=Ts.baseTheme({".cm-panel.cm-search":{padding:"0.25rem 0.5rem 0.25rem 0.5rem",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"0.5rem",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"}}),Yu=[mu,N.lowest(yu),Uu];class qu{constructor(t,e,i){this.state=t,this.pos=e,this.explicit=i,this.abortListeners=[]}tokenBefore(t){let e=Xa(this.state).resolveInner(this.pos,-1);for(;e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null}matchBefore(t){let e=this.state.doc.lineAt(this.pos),i=Math.max(e.from,this.pos-250),n=e.text.slice(i-e.from,this.pos-e.from),s=n.search(ju(t,!1));return s<0?null:{from:i+s,to:this.pos,text:n.slice(s)}}get aborted(){return null==this.abortListeners}addEventListener(t,e){"abort"==t&&this.abortListeners&&this.abortListeners.push(e)}}function Lu(t){let e=Object.keys(t).join(""),i=/\w/.test(e);return i&&(e=e.replace(/\w/g,"")),`[${i?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function zu(t){let e=t.map((t=>"string"==typeof t?{label:t}:t)),[i,n]=e.every((t=>/^\w+$/.test(t.label)))?[/\w*$/,/\w+$/]:function(t){let e=Object.create(null),i=Object.create(null);for(let{label:n}of t){e[n[0]]=!0;for(let t=1;t{let s=t.matchBefore(n);return s||t.explicit?{from:s?s.from:t.pos,options:e,validFor:i}:null}}class Iu{constructor(t,e,i,n){this.completion=t,this.source=e,this.match=i,this.score=n}}function Bu(t){return t.selection.main.from}function ju(t,e){var i;let{source:n}=t,s=e&&"^"!=n[0],r="$"!=n[n.length-1];return s||r?new RegExp(`${s?"^":""}(?:${n})${r?"$":""}`,null!==(i=t.flags)&&void 0!==i?i:t.ignoreCase?"i":""):t}const Nu=lt.define();const Gu=new WeakMap;function Fu(t){if(!Array.isArray(t))return t;let e=Gu.get(t);return e||Gu.set(t,e=zu(t)),e}const Hu=ut.define(),Ju=ut.define();class Ku{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[];for(let e=0;e=48&&l<=57||l>=97&&l<=122?2:l>=65&&l<=90?1:0:(y=w(l))!=y.toLowerCase()?1:y!=y.toUpperCase()?2:0;(!n||1==S&&O||0==m&&0!=S)&&(e[c]==l||i[c]==l&&(u=!0)?r[c++]=n:r.length&&(g=!1)),m=S,n+=v(l)}return c==a&&0==r[0]&&g?this.result((u?-200:0)-100,r,t):d==a&&0==f?[-200-t.length+(p==t.length?0:-100),0,p]:o>-1?[-700-t.length,o,o+this.pattern.length]:d==a?[-900-t.length,f,p]:c==a?this.result((u?-200:0)-100-700+(g?0:-1100),r,t):2==e.length?null:this.result((n[0]?-700:0)-200-1100,n,t)}result(t,e,i){let n=[t-i.length],s=1;for(let t of e){let e=t+(this.astral?v(b(i,t)):1);s>1&&n[s-1]==t?n[s-1]=e:(n[s++]=t,n[s++]=e)}return n}}const td=E.define({combine:t=>kt(t,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:id,compareCompletions:(t,e)=>t.label.localeCompare(e.label),interactionDelay:75},{defaultKeymap:(t,e)=>t&&e,closeOnBlur:(t,e)=>t&&e,icons:(t,e)=>t&&e,tooltipClass:(t,e)=>i=>ed(t(i),e(i)),optionClass:(t,e)=>i=>ed(t(i),e(i)),addToOptions:(t,e)=>t.concat(e)})});function ed(t,e){return t?e?t+" "+e:t:e}function id(t,e,i,n,s){let r,o,a=t.textDirection==Wi.RTL,l=a,h=!1,c="top",u=e.left-s.left,d=s.right-e.right,f=n.right-n.left,p=n.bottom-n.top;if(l&&u=p||t>e.top?r=i.bottom-e.top:(c="bottom",r=e.bottom-i.top)}return{style:`${c}: ${r}px; max-width: ${o}px`,class:"cm-completionInfo-"+(h?a?"left-narrow":"right-narrow":l?"left":"right")}}function nd(t,e="option"){return i=>{let n=i.state.field(yd,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp-1?n.open.selected+r*(t?1:-1):t?0:o-1;return a<0?a="page"==e?0:o-1:a>=o&&(a="page"==e?o-1:0),i.dispatch({effects:vd.of(a)}),!0}}const sd=t=>{let e=t.state.field(yd,!1);return!(t.state.readOnly||!e||!e.open||e.open.selected<0||Date.now()-e.open.timestamp(t.selection||t.docChanged)&&!gd(t)));for(let e=0;e50&&Date.now()-n.time>1e3){for(let t of n.context.abortListeners)try{t()}catch(t){Qi(this.view.state,t)}n.context.abortListeners=null,this.running.splice(e--,1)}else n.updates.push(...t.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some((t=>1==t.state&&!this.running.some((e=>e.active.source==t.source))))?setTimeout((()=>this.startUpdate()),50):-1,0!=this.composing)for(let e of t.transactions)"input"==gd(e)?this.composing=2:2==this.composing&&e.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:t}=this.view,e=t.field(yd);for(let t of e.active)1!=t.state||this.running.some((e=>e.active.source==t.source))||this.startQuery(t)}startQuery(t){let{state:e}=this.view,i=Bu(e),n=new qu(e,i,t.explicitPos==i),s=new rd(t,n);this.running.push(s),Promise.resolve(t.source(n)).then((t=>{s.context.aborted||(s.done=t||null,this.scheduleAccept())}),(t=>{this.view.dispatch({effects:Ju.of(null)}),Qi(this.view.state,t)}))}scheduleAccept(){this.running.every((t=>void 0!==t.done))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((()=>this.accept()),50))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],i=this.view.state.facet(td);for(let n=0;nt.source==s.active.source));if(r&&1==r.state)if(null==s.done){let t=new md(s.active.source,0);for(let e of s.updates)t=t.update(e,i);1!=t.state&&e.push(t)}else this.startQuery(r)}e.length&&this.view.dispatch({effects:wd.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(yd,!1);if(e&&e.tooltip&&this.view.state.facet(td).closeOnBlur){let i=e.open&&Rr(this.view,e.open.tooltip);i&&i.dom.contains(t.relatedTarget)||this.view.dispatch({effects:Ju.of(null)})}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout((()=>this.view.dispatch({effects:Hu.of(!1)})),20),this.composing=0}}});function ad(t,e){const i=e.completion.apply||e.completion.label;let n=t.state.field(yd).active.find((t=>t.source==e.source));return n instanceof bd&&("string"==typeof i?t.dispatch(Object.assign(Object.assign({},function(t,e,i,n){let{main:s}=t.selection,r=i-s.from,o=n-s.from;return Object.assign(Object.assign({},t.changeByRange((a=>a!=s&&i!=n&&t.sliceDoc(a.from+r,a.from+o)!=t.sliceDoc(i,n)?{range:a}:{changes:{from:a.from+r,to:n==s.from?a.to:a.from+o,insert:e},range:A.cursor(a.from+r+e.length)}))),{userEvent:"input.complete"})}(t.state,i,n.from,n.to)),{annotations:Nu.of(e.completion)})):i(t,e.completion,n.from,n.to),!0)}function ld(t,e,i){if(t<=i)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let t=Math.floor(e/i);return{from:t*i,to:(t+1)*i}}let n=Math.floor((t-e)/i);return{from:t-(n+1)*i,to:t-n*i}}class hd{constructor(t,e){this.view=t,this.stateField=e,this.info=null,this.placeInfoReq={read:()=>this.measureInfo(),write:t=>this.placeInfo(t),key:this},this.space=null,this.currentClass="";let i=t.state.field(e),{options:n,selected:s}=i.open,r=t.state.facet(td);this.optionContent=function(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(t){let e=document.createElement("div");return e.classList.add("cm-completionIcon"),t.type&&e.classList.add(...t.type.split(/\s+/g).map((t=>"cm-completionIcon-"+t))),e.setAttribute("aria-hidden","true"),e},position:20}),e.push({render(t,e,i){let n=document.createElement("span");n.className="cm-completionLabel";let{label:s}=t,r=0;for(let t=1;tr&&n.appendChild(document.createTextNode(s.slice(r,e)));let a=n.appendChild(document.createElement("span"));a.appendChild(document.createTextNode(s.slice(e,o))),a.className="cm-completionMatchedText",r=o}return rt.position-e.position)).map((t=>t.render))}(r),this.optionClass=r.optionClass,this.tooltipClass=r.tooltipClass,this.range=ld(n.length,s,r.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",(e=>{for(let i,s=e.target;s&&s!=this.dom;s=s.parentNode)if("LI"==s.nodeName&&(i=/-(\d+)$/.exec(s.id))&&+i[1]{let i=t.state.field(this.stateField,!1);i&&i.tooltip&&t.state.facet(td).closeOnBlur&&e.relatedTarget!=t.contentDOM&&t.dispatch({effects:Ju.of(null)})})),this.list=this.dom.appendChild(this.createListBox(n,i.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))}mount(){this.updateSel()}update(t){var e,i,n;let s=t.state.field(this.stateField),r=t.startState.field(this.stateField);this.updateTooltipClass(t.state),s!=r&&(this.updateSel(),(null===(e=s.open)||void 0===e?void 0:e.disabled)!=(null===(i=r.open)||void 0===i?void 0:i.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!(null===(n=s.open)||void 0===n?void 0:n.disabled)))}updateTooltipClass(t){let e=this.tooltipClass(t);if(e!=this.currentClass){for(let t of this.currentClass.split(" "))t&&this.dom.classList.remove(t);for(let t of e.split(" "))t&&this.dom.classList.add(t);this.currentClass=e}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),e=t.open;if((e.selected>-1&&e.selected=this.range.to)&&(this.range=ld(e.options.length,e.selected,this.view.state.facet(td).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e.options,t.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))),this.updateSelectedOption(e.selected)){this.info&&(this.info.remove(),this.info=null);let{completion:i}=e.options[e.selected],{info:n,label:s,c:r}=i;if(!n)return;let o="string"==typeof n?document.createTextNode(n+" "):n(i);if(!o)return;if(!r){const t=document.createElement("span");t.appendChild(o),o=t;const e=document.createElement("a");e.innerText="🔎",e.href="/docFind/"+s,e.target="blank",o.appendChild(e)}if(!o)return;"then"in o?o.then((e=>{e&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(e)})).catch((t=>Qi(this.view.state,t,"completion info"))):this.addInfoPane(o)}}addInfoPane(t){let e=this.info=document.createElement("div");e.className="cm-tooltip cm-completionInfo",e.appendChild(t),this.dom.appendChild(e),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let e=null;for(let i=this.list.firstChild,n=this.range.from;i;i=i.nextSibling,n++)"LI"==i.nodeName&&i.id?n==t?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),e=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected"):n--;return e&&function(t,e){let i=t.getBoundingClientRect(),n=e.getBoundingClientRect();n.topi.bottom&&(t.scrollTop+=n.bottom-i.bottom)}(this.list,e),e}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let e=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),n=t.getBoundingClientRect(),s=this.space;if(!s){let t=this.dom.ownerDocument.defaultView||window;s={left:0,top:0,right:t.innerWidth,bottom:t.innerHeight}}return n.top>Math.min(s.bottom,e.bottom)-10||n.bottomi.from||0==i.from))if(s=t,"string"!=typeof l&&l.header)n.appendChild(l.header(l));else{n.appendChild(document.createElement("completion-section")).textContent=t}}const h=n.appendChild(document.createElement("li"));h.id=e+"-"+r,h.setAttribute("role","option");let c=this.optionClass(o);c&&(h.className=c);for(let t of this.optionContent){let e=t(o,this.view.state,a);e&&h.appendChild(e)}}return i.from&&n.classList.add("cm-completionListIncompleteTop"),i.to=this.options.length?this:new ud(this.options,pd(e,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,e,i,n,s){let r=function(t,e){let i=[],n=null,s=t=>{i.push(t);let{section:e}=t.completion;if(e){n||(n=[]);let t="string"==typeof e?e:e.name;n.some((e=>e.name==t))||n.push("string"==typeof e?{name:t}:e)}};for(let n of t)if(n.hasResult())if(!1===n.result.filter){let t=n.result.getMatch;for(let e of n.result.options){let r=[1e9-i.length];if(t)for(let i of t(e))r.push(i);s(new Iu(e,n.source,r,r[0]))}}else{let t,i=new Ku(e.sliceDoc(n.from,n.to));for(let e of n.result.options)(t=i.match(e.label))&&s(new Iu(e,n.source,t,t[0]+(e.boost||0)))}if(n){let t=Object.create(null),e=0,s=(t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:1e9)-(null!==(n=e.rank)&&void 0!==n?n:1e9)||(t.namee.score-t.score||a(t.completion,e.completion))))!o||o.label!=t.completion.label||o.detail!=t.completion.detail||null!=o.type&&null!=t.completion.type&&o.type!=t.completion.type||o.apply!=t.completion.apply?r.push(t):cd(t.completion)>cd(o)&&(r[r.length-1]=t),o=t.completion;return r}(t,e);if(!r.length)return n&&t.some((t=>1==t.state))?new ud(n.options,n.attrs,n.tooltip,n.timestamp,n.selected,!0):null;let o=e.facet(td).selectOnOpen?0:-1;if(n&&n.selected!=o&&-1!=n.selected){let t=n.options[n.selected].completion;for(let e=0;ee.hasResult()?Math.min(t,e.from):t),1e8),create:(a=yd,t=>new hd(t,a)),above:s.aboveCursor},n?n.timestamp:Date.now(),o,!1);var a}map(t){return new ud(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class dd{constructor(t,e,i){this.active=t,this.id=e,this.open=i}static start(){return new dd(Od,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(t){let{state:e}=t,i=e.facet(td),n=(i.override||e.languageDataAt("autocomplete",Bu(e)).map(Fu)).map((e=>(this.active.find((t=>t.source==e))||new md(e,this.active.some((t=>0!=t.state))?1:0)).update(t,i)));n.length==this.active.length&&n.every(((t,e)=>t==this.active[e]))&&(n=this.active);let s=this.open;s&&t.docChanged&&(s=s.map(t.changes)),t.selection||n.some((e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to)))||!function(t,e){if(t==e)return!0;for(let i=0,n=0;;){for(;i1==t.state))&&(s=null),!s&&n.every((t=>1!=t.state))&&n.some((t=>t.hasResult()))&&(n=n.map((t=>t.hasResult()?new md(t.source,0):t)));for(let e of t.effects)e.is(vd)&&(s=s&&s.setSelected(e.value,this.id));return n==this.active&&s==this.open?this:new dd(n,this.id,s)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:fd}}const fd={"aria-autocomplete":"list"};function pd(t,e){let i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(i["aria-activedescendant"]=t+"-"+e),i}const Od=[];function gd(t){return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null}class md{constructor(t,e,i=-1){this.source=t,this.state=e,this.explicitPos=i}hasResult(){return!1}update(t,e){let i=gd(t),n=this;i?n=n.handleUserEvent(t,i,e):t.docChanged?n=n.handleChange(t):t.selection&&0!=n.state&&(n=new md(n.source,0));for(let e of t.effects)if(e.is(Hu))n=new md(n.source,1,e.value?Bu(t.state):-1);else if(e.is(Ju))n=new md(n.source,0);else if(e.is(wd))for(let t of e.value)t.source==n.source&&(n=t);return n}handleUserEvent(t,e,i){return"delete"!=e&&i.activateOnTyping?new md(this.source,1):this.map(t.changes)}handleChange(t){return t.changes.touchesRange(Bu(t.startState))?new md(this.source,0):this.map(t.changes)}map(t){return t.empty||this.explicitPos<0?this:new md(this.source,this.state,t.mapPos(this.explicitPos))}}class bd extends md{constructor(t,e,i,n,s){super(t,2,e),this.result=i,this.from=n,this.to=s}hasResult(){return!0}handleUserEvent(t,e,i){var n;let s=t.changes.mapPos(this.from),r=t.changes.mapPos(this.to,1),o=Bu(t.state);if((this.explicitPos<0?o<=s:or||"delete"==e&&Bu(t.startState)==this.from)return new md(this.source,"input"==e&&i.activateOnTyping?1:0);let a,l=this.explicitPos<0?-1:t.changes.mapPos(this.explicitPos);return function(t,e,i,n){if(!t)return!1;let s=e.sliceDoc(i,n);return"function"==typeof t?t(s,i,n,e):ju(t,!0).test(s)}(this.result.validFor,t.state,s,r)?new bd(this.source,l,this.result,s,r):this.result.update&&(a=this.result.update(this.result,s,r,new qu(t.state,o,l>=0)))?new bd(this.source,l,a,a.from,null!==(n=a.to)&&void 0!==n?n:Bu(t.state)):new md(this.source,1,l)}handleChange(t){return t.changes.touchesRange(this.from,this.to)?new md(this.source,0):this.map(t.changes)}map(t){return t.empty?this:new bd(this.source,this.explicitPos<0?-1:t.mapPos(this.explicitPos),this.result,t.mapPos(this.from),t.mapPos(this.to,1))}}const wd=ut.define({map:(t,e)=>t.map((t=>t.map(e)))}),vd=ut.define(),yd=q.define({create:()=>dd.start(),update:(t,e)=>t.update(e),provide:t=>[Tr.from(t,(t=>t.tooltip)),Ts.contentAttributes.from(t,(t=>t.attrs))]}),Sd=Ts.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class xd{constructor(t,e,i,n){this.field=t,this.line=e,this.from=i,this.to=n}}class kd{constructor(t,e,i){this.field=t,this.from=e,this.to=i}map(t){let e=t.mapPos(this.from,-1,S.TrackDel),i=t.mapPos(this.to,1,S.TrackDel);return null==e||null==i?null:new kd(this.field,e,i)}}class Qd{constructor(t,e){this.lines=t,this.fieldPositions=e}instantiate(t,e){let i=[],n=[e],s=t.doc.lineAt(e),r=/^\s*/.exec(s.text)[0];for(let s of this.lines){if(i.length){let i=r,o=/^\t*/.exec(s)[0].length;for(let e=0;enew kd(t.field,n[t.line]+t.from,n[t.line]+t.to)));return{text:i,ranges:o}}static parse(t){let e,i=[],n=[],s=[];for(let r of t.split(/\r\n?|\n/)){for(;e=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(r);){let t=e[1]?+e[1]:null,o=e[2]||e[3]||"",a=-1;for(let e=0;e=a&&t.field++}s.push(new xd(a,n.length,e.index,e.index+o.length)),r=r.slice(0,e.index)+o+r.slice(e.index+e[0].length)}for(let t;t=/\\([{}])/.exec(r);){r=r.slice(0,t.index)+t[1]+r.slice(t.index+t[0].length);for(let e of s)e.line==n.length&&e.from>t.index&&(e.from--,e.to--)}n.push(r)}return new Qd(n,s)}}let $d=ni.widget({widget:new class extends ei{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),Pd=ni.mark({class:"cm-snippetField"});class Cd{constructor(t,e){this.ranges=t,this.active=e,this.deco=ni.set(t.map((t=>(t.from==t.to?$d:Pd).range(t.from,t.to))))}map(t){let e=[];for(let i of this.ranges){let n=i.map(t);if(!n)return null;e.push(n)}return new Cd(e,this.active)}selectionInsideField(t){return t.ranges.every((t=>this.ranges.some((e=>e.field==this.active&&e.from<=t.from&&e.to>=t.to))))}}const _d=ut.define({map:(t,e)=>t&&t.map(e)}),Xd=ut.define(),Zd=q.define({create:()=>null,update(t,e){for(let i of e.effects){if(i.is(_d))return i.value;if(i.is(Xd)&&t)return new Cd(t.ranges,i.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>Ts.decorations.from(t,(t=>t?t.deco:ni.none))});function Ad(t,e){return A.create(t.filter((t=>t.field==e)).map((t=>A.range(t.from,t.to))))}function Td(e){let i=Qd.parse(e);return(e,n,s,r)=>{let{text:o,ranges:a}=i.instantiate(e.state,s),l={changes:{from:s,to:r,insert:t.of(o)},scrollIntoView:!0,annotations:n?Nu.of(n):void 0};if(a.length&&(l.selection=Ad(a,0)),a.length>1){let t=new Cd(a,0),i=l.effects=[_d.of(t)];void 0===e.state.field(Zd,!1)&&i.push(ut.appendConfig.of([Zd,Md,Wd,Sd]))}e.dispatch(e.state.update(l))}}function Rd(t){return({state:e,dispatch:i})=>{let n=e.field(Zd,!1);if(!n||t<0&&0==n.active)return!1;let s=n.active+t,r=t>0&&!n.ranges.some((e=>e.field==s+t));return i(e.update({selection:Ad(n.ranges,s),effects:_d.of(r?null:new Cd(n.ranges,s))})),!0}}const Ed=[{key:"Tab",run:Rd(1),shift:Rd(-1)},{key:"Escape",run:({state:t,dispatch:e})=>!!t.field(Zd,!1)&&(e(t.update({effects:_d.of(null)})),!0)}],Vd=E.define({combine:t=>t.length?t[0]:Ed}),Md=N.highest(Ys.compute([Vd],(t=>t.facet(Vd))));function Dd(t,e){return Object.assign(Object.assign({},e),{apply:Td(t)})}const Wd=Ts.domEventHandlers({mousedown(t,e){let i,n=e.state.field(Zd,!1);if(!n||null==(i=e.posAtCoords({x:t.clientX,y:t.clientY})))return!1;let s=n.ranges.find((t=>t.from<=i&&t.to>=i));return!(!s||s.field==n.active)&&(e.dispatch({selection:Ad(n.ranges,s.field),effects:_d.of(n.ranges.some((t=>t.field>s.field))?new Cd(n.ranges,s.field):null)}),!0)}}),Ud=new class extends Qt{};function Yd(t={}){return[yd,td.of(t),od,Ld,Sd]}Ud.startSide=1,Ud.endSide=-1;const qd=[{key:"Ctrl-Space",run:t=>!!t.state.field(yd,!1)&&(t.dispatch({effects:Hu.of(!0)}),!0)},{key:"Escape",run:t=>{let e=t.state.field(yd,!1);return!(!e||!e.active.some((t=>0!=t.state)))&&(t.dispatch({effects:Ju.of(null)}),!0)}},{key:"ArrowDown",run:nd(!0)},{key:"ArrowUp",run:nd(!1)},{key:"PageDown",run:nd(!0,"page")},{key:"PageUp",run:nd(!1,"page")},{key:"Enter",run:sd}],Ld=N.highest(Ys.computeN([td],(t=>t.facet(td).defaultKeymap?[qd]:[]))),zd=(()=>[vr(),Sh(),ir(),$l(_l,{fallback:!0}),Ys.of([...Vc,...Wh])])();class Id{constructor(t,e,i,n,s,r,o,a,l,h=0,c){this.p=t,this.stack=e,this.state=i,this.reducePos=n,this.pos=s,this.score=r,this.buffer=o,this.bufferBase=a,this.curContext=l,this.lookAhead=h,this.parent=c}toString(){return`[${this.stack.filter(((t,e)=>e%3==0)).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,i=0){let n=t.parser.context;return new Id(t,[],e,i,i,0,[],0,n?new Bd(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let i=t>>19,n=65535&t,{parser:s}=this.p,r=s.dynamicPrecedence(n);if(r&&(this.score+=r),0==i)return this.pushState(s.getGoto(this.state,n,!0),this.reducePos),n=2e3&&!(null===(e=this.p.parser.nodeSet.types[n])||void 0===e?void 0:e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=l):this.p.lastBigReductionSizeo;)this.stack.pop();this.reduceContext(n,a)}storeNode(t,e,i,n=4,s=!1){if(0==t&&(!this.stack.length||this.stack[this.stack.length-1]0&&0==t.buffer[n-4]&&t.buffer[n-1]>-1){if(e==i)return;if(t.buffer[n-2]>=e)return void(t.buffer[n-2]=i)}}if(s&&this.pos!=i){let s=this.buffer.length;if(s>0&&0!=this.buffer[s-4])for(;s>0&&this.buffer[s-2]>i;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,n>4&&(n-=4);this.buffer[s]=t,this.buffer[s+1]=e,this.buffer[s+2]=i,this.buffer[s+3]=n}else this.buffer.push(t,e,i,n)}shift(t,e,i){let n=this.pos;if(131072&t)this.pushState(65535&t,this.pos);else if(0==(262144&t)){let s=t,{parser:r}=this.p;(i>this.pos||e<=r.maxNode)&&(this.pos=i,r.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,n),this.shiftContext(e,n),e<=r.maxNode&&this.buffer.push(e,n,i,4)}else this.pos=i,this.shiftContext(e,n),e<=this.p.parser.maxNode&&this.buffer.push(e,n,i,4)}apply(t,e,i){65536&t?this.reduce(t):this.shift(t,e,i)}useNode(t,e){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=t)&&(this.p.reused.push(t),i++);let n=this.pos;this.reducePos=this.pos=n+t.length,this.pushState(e,n),this.buffer.push(i,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let i=t.buffer.slice(e),n=t.bufferBase+e;for(;t&&n==t.bufferBase;)t=t.parent;return new Id(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,n,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let i=t<=this.p.parser.maxNode;i&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,i?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new Nd(this);;){let i=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(0==i)return!1;if(0==(65536&i))return!0;e.reduce(i)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let n,s=0;s1&e&&t==n))||i.push(e[t],n)}e=i}let i=[];for(let t=0;t>19,n=65535&t,s=this.stack.length-3*i;if(s<0||e.getGoto(this.stack[s],n,!1)<0)return!1;this.storeNode(0,this.reducePos,this.reducePos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:t}=this.p;return 65535==t.data[t.stateSlot(this.state,1)]&&!t.stateSlot(this.state,4)}restart(){this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;ethis.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Bd{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}var jd;!function(t){t[t.Insert=200]="Insert",t[t.Delete=190]="Delete",t[t.Reduce=100]="Reduce",t[t.MaxNext=4]="MaxNext",t[t.MaxInsertStackDepth=300]="MaxInsertStackDepth",t[t.DampenInsertStackDepth=120]="DampenInsertStackDepth",t[t.MinBigReduction=2e3]="MinBigReduction"}(jd||(jd={}));class Nd{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=65535&t,i=t>>19;0==i?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(i-1);let n=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=n}}class Gd{constructor(t,e,i){this.stack=t,this.pos=e,this.index=i,this.buffer=t.buffer,0==this.index&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new Gd(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;null!=t&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new Gd(this.stack,this.pos,this.index)}}function Fd(t,e=Uint16Array){if("string"!=typeof t)return t;let i=null;for(let n=0,s=0;n=92&&e--,e>=34&&e--;let s=e-32;if(s>=46&&(s-=46,i=!0),r+=s,i)break;r*=46}i?i[s++]=r:i=new e(r)}return i}class Hd{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Jd=new Hd;class Kd{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Jd,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let i=this.range,n=this.rangeIndex,s=this.pos+t;for(;si.to:s>=i.to;){if(n==this.ranges.length-1)return null;let t=this.ranges[++n];s+=t.from-i.to,i=t}return s}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,e.from);return this.end}peek(t){let e,i,n=this.chunkOff+t;if(n>=0&&n=this.chunk2Pos&&en.to&&(this.chunk2=this.chunk2.slice(0,n.to-e)),i=this.chunk2.charCodeAt(0)}}return e>=this.token.lookAhead&&(this.token.lookAhead=e+1),i}acceptToken(t,e=0){let i=e?this.resolveOffset(e,-1):this.pos;if(null==i||i=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=Jd,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let i="";for(let n of this.ranges){if(n.from>=e)break;n.to>t&&(i+=this.input.read(Math.max(n.from,t),Math.min(n.to,e)))}return i}}class tf{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:i}=e.p;sf(this.data,t,e,this.id,i.data,i.tokenPrecTable)}}tf.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class ef{constructor(t,e,i){this.precTable=e,this.elseToken=i,this.data="string"==typeof t?Fd(t):t}token(t,e){let i=t.pos,n=0;for(;sf(this.data,t,e,0,this.data,this.precTable),!(t.token.value>-1);){if(null==this.elseToken)return;if(t.next<0)break;t.advance(),t.reset(t.pos,t.token),n++}n&&(t.reset(i,t.token),t.acceptToken(this.elseToken,n))}}ef.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class nf{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function sf(t,e,i,n,s,r){let o=0,a=1<0){let i=t[n];if(l.allows(i)&&(-1==e.token.value||e.token.value==i||of(i,e.token.value,s,r))){e.acceptToken(i);break}}let n=e.next,h=0,c=t[o+2];if(!(e.next<0&&c>h&&65535==t[i+3*c-3]&&65535==t[i+3*c-3])){for(;h>1,r=i+s+(s<<1),a=t[r],l=t[r+1]||65536;if(n=l)){o=t[r+2],e.advance();continue t}h=s+1}}break}o=t[i+3*c-1]}}function rf(t,e,i){for(let n,s=e;65535!=(n=t[s]);s++)if(n==i)return s-e;return-1}function of(t,e,i,n){let s=rf(i,n,e);return s<0||rf(i,n,t)e)&&!n.type.isError)return i<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(t.length,Math.max(n.from+1,e+25));if(i<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return i<0?0:t.length}}!function(t){t[t.Margin=25]="Margin"}(hf||(hf={}));let uf=class{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?cf(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?cf(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=r,null;if(s instanceof bo){if(r==t){if(r=Math.max(this.safeFrom,t)&&(this.trees.push(s),this.start.push(r),this.index.push(0))}else this.index[e]++,this.nextStart=r+s.length}}};class df{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map((t=>new Hd))}getActions(t){let e=0,i=null,{parser:n}=t.p,{tokenizers:s}=n,r=n.stateSlot(t.state,3),o=t.curContext?t.curContext.hash:0,a=0;for(let n=0;nh.end+25&&(a=Math.max(h.lookAhead,a)),0!=h.value)){let n=e;if(h.extended>-1&&(e=this.addActions(t,h.extended,h.end,e)),e=this.addActions(t,h.value,h.end,e),!l.extend&&(i=h,e>n))break}}for(;this.actions.length>e;)this.actions.pop();return a&&t.setLookAhead(a),i||t.pos!=this.stream.end||(i=new Hd,i.value=t.p.parser.eofTerm,i.start=i.end=t.pos,e=this.addActions(t,i.value,i.end,e)),this.mainToken=i,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new Hd,{pos:i,p:n}=t;return e.start=i,e.end=Math.min(i+1,n.stream.end),e.value=i==n.stream.end?n.parser.eofTerm:0,e}updateCachedToken(t,e,i){let n=this.stream.clipPos(i.pos);if(e.token(this.stream.reset(n,t),i),t.value>-1){let{parser:e}=i.p;for(let n=0;n=0&&i.p.parser.dialect.allows(s>>1)){0==(1&s)?t.value=s>>1:t.extended=s>>1;break}}}else t.value=0,t.end=this.stream.clipPos(n+1)}putAction(t,e,i,n){for(let e=0;e4*t.bufferLength?new uf(i,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t,e,i=this.stacks,n=this.minStackPos,s=this.stacks=[];if(this.bigReductionCount>300&&1==i.length){let[t]=i;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;rn)s.push(o);else{if(this.advanceStack(o,s,i))continue;{t||(t=[],e=[]),t.push(o);let i=this.tokens.getMainToken(o);e.push(i.value,i.end)}}break}}if(!s.length){let e=t&&function(t){let e=null;for(let i of t){let t=i.p.stoppedAt;(i.pos==i.p.stream.end||null!=t&&i.pos>t)&&i.p.parser.stateFlag(i.state,2)&&(!e||e.scorethis.stoppedAt?t[0]:this.runRecovery(t,e,s);if(i)return this.stackToTree(i.forceAll())}if(this.recovering){let t=1==this.recovering?1:3*this.recovering;if(s.length>t)for(s.sort(((t,e)=>e.score-t.score));s.length>t;)s.pop();s.some((t=>t.reducePos>n))&&this.recovering--}else if(s.length>1){t:for(let t=0;t500&&n.buffer.length>500){if(!((e.score-n.score||e.buffer.length-n.buffer.length)>0)){s.splice(t--,1);continue t}s.splice(i--,1)}}}s.length>12&&s.splice(12,s.length-12)}this.minStackPos=s[0].pos;for(let t=1;t ":"";if(null!=this.stoppedAt&&n>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let e=t.curContext&&t.curContext.tracker.strict,i=e?t.curContext.hash:0;for(let o=this.fragments.nodeAt(n);o;){let n=this.parser.nodeSet.types[o.type.id]==o.type?s.getGoto(t.state,o.type.id):-1;if(n>-1&&o.length&&(!e||(o.prop(ho.contextHash)||0)==i))return t.useNode(o,n),af&&console.log(r+this.stackID(t)+` (via reuse of ${s.getName(o.type.id)})`),!0;if(!(o instanceof bo)||0==o.children.length||o.positions[0]>0)break;let a=o.children[0];if(!(a instanceof bo&&0==o.positions[0]))break;o=a}}let o=s.stateSlot(t.state,4);if(o>0)return t.reduce(o),af&&console.log(r+this.stackID(t)+` (via always-reduce ${s.getName(65535&o)})`),!0;if(t.stack.length>=15e3)for(;t.stack.length>9e3&&t.forceReduce(););let a=this.tokens.getActions(t);for(let o=0;on?e.push(d):i.push(d)}return!1}advanceFully(t,e){let i=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>i)return Of(t,e),!0}}runRecovery(t,e,i){let n=null,s=!1;for(let r=0;r ":"";if(o.deadEnd){if(s)continue;if(s=!0,o.restart(),af&&console.log(h+this.stackID(o)+" (restarted)"),this.advanceFully(o,i))continue}let c=o.split(),u=h;for(let t=0;c.forceReduce()&&t<10;t++){if(af&&console.log(u+this.stackID(c)+" (via force-reduce)"),this.advanceFully(c,i))break;af&&(u=this.stackID(c)+" -> ")}for(let t of o.recoverByInsert(a))af&&console.log(h+this.stackID(t)+" (via recover-insert)"),this.advanceFully(t,i);this.stream.end>o.pos?(l==o.pos&&(l++,a=0),o.recoverByDelete(a,l),af&&console.log(h+this.stackID(o)+` (via recover-delete ${this.parser.getName(a)})`),Of(o,i)):(!n||n.scoret;class bf{constructor(t){this.start=t.start,this.shift=t.shift||mf,this.reduce=t.reduce||mf,this.reuse=t.reuse||mf,this.hash=t.hash||(()=>0),this.strict=!1!==t.strict}}class wf extends Vo{constructor(t){if(super(),this.wrappers=[],14!=t.version)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let i=0;it.topRules[e][1])),n=[];for(let t=0;t=0)s(n,t,e[i++]);else{let r=e[i+-n];for(let o=-n;o>0;o--)s(e[i++],t,r);i++}}}this.nodeSet=new po(e.map(((e,s)=>fo.define({name:s>=this.minRepeatTerm?void 0:e,id:s,props:n[s],top:i.indexOf(s)>-1,error:0==s,skipped:t.skippedNodes&&t.skippedNodes.indexOf(s)>-1})))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=oo;let r=Fd(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let t=0;t"number"==typeof t?new tf(r,t):t)),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,i){let n=new pf(this,t,e,i);for(let s of this.wrappers)n=s(n,t,e,i);return n}getGoto(t,e,i=!1){let n=this.goto;if(e>=n[0])return-1;for(let s=n[e+1];;){let e=n[s++],r=1&e,o=n[s++];if(r&&i)return o;for(let i=s+(e>>1);s0}validAction(t,e){if(e==this.stateSlot(t,4))return!0;for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])return!1;i=vf(this.data,i+2)}if(e==vf(this.data,i+1))return!0}}nextStates(t){let e=[];for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])break;i=vf(this.data,i+2)}if(0==(1&this.data[i+2])){let t=this.data[i+1];e.some(((e,i)=>1&i&&e==t))||e.push(this.data[i],t)}}return e}configure(t){let e=Object.assign(Object.create(wf.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let i=this.topRules[t.top];if(!i)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=i}return t.tokenizers&&(e.tokenizers=this.tokenizers.map((e=>{let i=t.tokenizers.find((t=>t.from==e));return i?i.to:e}))),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map(((i,n)=>{let s=t.specializers.find((t=>t.from==i.external));if(!s)return i;let r=Object.assign(Object.assign({},i),{external:s.to});return e.specializers[n]=yf(r),r}))),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),null!=t.strict&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),null!=t.bufferLength&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return null==e?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),i=e.map((()=>!1));if(t)for(let n of t.split(" ")){let t=e.indexOf(n);t>=0&&(i[t]=!0)}let n=null;for(let t=0;tt.external(i,n)<<1|e}return t.get}const Sf=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],xf=new bf({start:!1,shift:(t,e)=>3==e||4==e||305==e?t:306==e,strict:!1}),kf=new nf(((t,e)=>{let{next:i}=t;(125==i||-1==i||e.context)&&e.canShift(303)&&t.acceptToken(303)}),{contextual:!0,fallback:!0}),Qf=new nf(((t,e)=>{let i,{next:n}=t;Sf.indexOf(n)>-1||(47!=n||47!=(i=t.peek(1))&&42!=i)&&125!=n&&59!=n&&-1!=n&&!e.context&&e.canShift(302)&&t.acceptToken(302)}),{contextual:!0}),$f=new nf(((t,e)=>{let{next:i}=t;if((43==i||45==i)&&(t.advance(),i==t.next)){t.advance();let i=!e.context&&e.canShift(1);t.acceptToken(i?1:2)}}),{contextual:!0}),Pf=ea({"get set async static":Sa.modifier,"for while do if else switch try catch finally return throw break continue default case":Sa.controlKeyword,"in of await yield void typeof delete instanceof":Sa.operatorKeyword,"let var const function class extends":Sa.definitionKeyword,"import export from":Sa.moduleKeyword,"with debugger as new":Sa.keyword,TemplateString:Sa.special(Sa.string),super:Sa.atom,BooleanLiteral:Sa.bool,this:Sa.self,null:Sa.null,Star:Sa.modifier,VariableName:Sa.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":Sa.function(Sa.variableName),VariableDefinition:Sa.definition(Sa.variableName),Label:Sa.labelName,PropertyName:Sa.propertyName,PrivatePropertyName:Sa.special(Sa.propertyName),"CallExpression/MemberExpression/PropertyName":Sa.function(Sa.propertyName),"FunctionDeclaration/VariableDefinition":Sa.function(Sa.definition(Sa.variableName)),"ClassDeclaration/VariableDefinition":Sa.definition(Sa.className),PropertyDefinition:Sa.definition(Sa.propertyName),PrivatePropertyDefinition:Sa.definition(Sa.special(Sa.propertyName)),UpdateOp:Sa.updateOperator,LineComment:Sa.lineComment,BlockComment:Sa.blockComment,Number:Sa.number,String:Sa.string,Escape:Sa.escape,ArithOp:Sa.arithmeticOperator,LogicOp:Sa.logicOperator,BitOp:Sa.bitwiseOperator,CompareOp:Sa.compareOperator,RegExp:Sa.regexp,Equals:Sa.definitionOperator,Arrow:Sa.function(Sa.punctuation),": Spread":Sa.punctuation,"( )":Sa.paren,"[ ]":Sa.squareBracket,"{ }":Sa.brace,"InterpolationStart InterpolationEnd":Sa.special(Sa.brace),".":Sa.derefOperator,", ;":Sa.separator,"@":Sa.meta,TypeName:Sa.typeName,TypeDefinition:Sa.definition(Sa.typeName),"type enum interface implements namespace module declare":Sa.definitionKeyword,"abstract global Privacy readonly override":Sa.modifier,"is keyof unique infer":Sa.operatorKeyword,JSXAttributeValue:Sa.attributeValue,JSXText:Sa.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":Sa.angleBracket,"JSXIdentifier JSXNameSpacedName":Sa.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":Sa.attributeName,"JSXBuiltin/JSXIdentifier":Sa.standard(Sa.tagName)}),Cf={__proto__:null,export:14,as:19,from:27,default:30,async:35,function:36,extends:46,this:50,true:58,false:58,null:70,void:74,typeof:78,super:96,new:130,delete:146,yield:155,await:159,class:164,public:221,private:221,protected:221,readonly:223,instanceof:242,satisfies:245,in:246,const:248,import:280,keyof:335,unique:339,infer:345,is:381,abstract:401,implements:403,type:405,let:408,var:410,interface:417,enum:421,namespace:427,module:429,declare:433,global:437,for:456,of:465,while:468,with:472,do:476,if:480,else:482,switch:486,case:492,try:498,catch:502,finally:506,return:510,throw:514,break:518,continue:522,debugger:526},_f={__proto__:null,async:117,get:119,set:121,declare:181,public:183,private:183,protected:183,static:185,abstract:187,override:189,readonly:195,accessor:197,new:385},Xf={__proto__:null,"<":137},Zf=wf.deserialize({version:14,states:"$6[O`QUOOO%QQUOOO'TQWOOP(bOSOOO*pQ(CjO'#CfO*wOpO'#CgO+VO!bO'#CgO+eO07`O'#DZO-vQUO'#DaO.WQUO'#DlO%QQUO'#DvO0[QUO'#EOOOQ(CY'#EW'#EWO0uQSO'#ETOOQO'#Ei'#EiOOQO'#Ib'#IbO0}QSO'#GkO1YQSO'#EhO1_QSO'#EhO3aQ(CjO'#JcO6QQ(CjO'#JdO6nQSO'#FWO6sQ#tO'#FoOOQ(CY'#F`'#F`O7OO&jO'#F`O7^Q,UO'#FvO8tQSO'#FuOOQ(CY'#Jd'#JdOOQ(CW'#Jc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ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXStartTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:364,context:xf,nodeProps:[["group",-26,6,14,16,62,199,203,206,207,209,212,215,225,227,233,235,237,239,242,248,254,256,258,260,262,264,265,"Statement",-32,10,11,25,28,29,35,45,48,49,51,56,64,72,76,78,80,81,103,104,113,114,131,134,136,137,138,139,141,142,162,163,165,"Expression",-23,24,26,30,34,36,38,166,168,170,171,173,174,175,177,178,179,181,182,183,193,195,197,198,"Type",-3,84,96,102,"ClassItem"],["openedBy",31,"InterpolationStart",50,"[",54,"{",69,"(",143,"JSXStartTag",155,"JSXStartTag JSXStartCloseTag"],["closedBy",33,"InterpolationEnd",44,"]",55,"}",70,")",144,"JSXSelfCloseEndTag JSXEndTag",160,"JSXEndTag"]],propSources:[Pf],skippedNodes:[0,3,4,268],repeatNodeCount:33,tokenData:"$>y(CSR!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tu>PuvBavwDxwxGgxyMvyz! Qz{!![{|!%O|}!&]}!O!%O!O!P!'g!P!Q!1w!Q!R#0t!R![#3T![!]#@T!]!^#Aa!^!_#Bk!_!`#GS!`!a#In!a!b#N{!b!c$$z!c!}>P!}#O$&U#O#P$'`#P#Q$,w#Q#R$.R#R#S>P#S#T$/`#T#o$0j#o#p$4z#p#q$5p#q#r$7Q#r#s$8^#s$f%Z$f$g+g$g#BY>P#BY#BZ$9h#BZ$IS>P$IS$I_$9h$I_$I|>P$I|$I}$P$JT$JU$9h$JU$KV>P$KV$KW$9h$KW&FU>P&FU&FV$9h&FV;'S>P;'S;=`BZ<%l?HT>P?HT?HU$9h?H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9h$KW&FU>P&FU&FV$9h&FV;'S>P;'S;=`BZ<%l?HT>P?HT?HU$9h?HUO>P(CS$=Uk$d&j'wp'z!b'n(;d(U!LY't&;d$W#tOY%ZYZ&cZr%Zrs&}st%Ztu>Puw%Zwx(rx}%Z}!O@T!O!Q%Z!Q![>P![!^%Z!^!_*g!_!c%Z!c!}>P!}#O%Z#O#P&c#P#R%Z#R#S>P#S#T%Z#T#o>P#o#p*g#p$g%Z$g;'S>P;'S;=`BZ<%lO>P",tokenizers:[Qf,$f,2,3,4,5,6,7,8,9,10,11,12,13,kf,new ef("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOq~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!O~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(T~~",141,326),new ef("j~RQYZXz{^~^O'q~~aP!P!Qd~iO'r~~",25,308)],topRules:{Script:[0,5],SingleExpression:[1,266],SingleClassItem:[2,267]},dialects:{jsx:12686,ts:12688},dynamicPrecedences:{76:1,78:1,163:1,191:1},specialized:[{term:312,get:t=>Cf[t]||-1},{term:328,get:t=>_f[t]||-1},{term:67,get:t=>Xf[t]||-1}],tokenPrec:12712}),Af=[Dd("function ${name}(${params}) {\n\t${}\n}",{label:"function",detail:"definition",type:"keyword"}),Dd("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n\t${}\n}",{label:"for",detail:"loop",type:"keyword"}),Dd("for (let ${name} of ${collection}) {\n\t${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Dd("do {\n\t${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),Dd("while (${}) {\n\t${}\n}",{label:"while",detail:"loop",type:"keyword"}),Dd("try {\n\t${}\n} catch (${error}) {\n\t${}\n}",{label:"try",detail:"/ catch block",type:"keyword"}),Dd("if (${}) {\n\t${}\n}",{label:"if",detail:"block",type:"keyword"}),Dd("if (${}) {\n\t${}\n} else {\n\t${}\n}",{label:"if",detail:"/ else block",type:"keyword"}),Dd("class ${name} {\n\tconstructor(${params}) {\n\t\t${}\n\t}\n}",{label:"class",detail:"definition",type:"keyword"}),Dd('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Dd('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Tf=new Ro,Rf=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Ef(t){return(e,i)=>{let n=e.node.getChild("VariableDefinition");return n&&i(n,t),!0}}const Vf=["FunctionDeclaration"],Mf={FunctionDeclaration:Ef("function"),ClassDeclaration:Ef("class"),ClassExpression:()=>!0,EnumDeclaration:Ef("constant"),TypeAliasDeclaration:Ef("type"),NamespaceDeclaration:Ef("namespace"),VariableDefinition(t,e){t.matchContext(Vf)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function Df(t,e){let i=Tf.get(e);if(i)return i;let n=[],s=!0;function r(e,i){let s=t.sliceString(e.from,e.to);n.push({label:s,type:i})}return e.cursor(mo.IncludeAnonymous).iterate((e=>{if(s)s=!1;else if(e.name){let t=Mf[e.name];if(t&&t(e,r)||Rf.has(e.name))return!1}else if(e.to-e.from>8192){for(let i of Df(t,e.node))n.push(i);return!1}})),Tf.set(e,n),n}const Wf=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Uf=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName"];function Yf(t){let e=Xa(t.state).resolveInner(t.pos,-1);if(Uf.indexOf(e.name)>-1)return null;let i="VariableName"==e.name||e.to-e.from<20&&Wf.test(t.state.sliceDoc(e.from,e.to));if(!i&&!t.explicit)return null;let n=[];for(let i=e;i;i=i.parent)Rf.has(i.name)&&(n=n.concat(Df(t.state.doc,i)));return{options:n,from:i?e.from:t.pos,validFor:Wf}}const qf=_a.define({name:"javascript",parser:Zf.configure({props:[Na.add({IfStatement:il({except:/^\s*({|else\b)/}),TryStatement:il({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:t=>t.baseIndent,SwitchBody:t=>{let e=t.textAfter,i=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return t.baseIndent+(i?0:n?1:2)*t.unit},Block:tl({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":il({except:/^{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag":t=>t.column(t.node.from)+t.unit}),rl.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression":ol,BlockComment:t=>({from:t.from+2,to:t.to-2})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Lf={test:t=>/^JSX/.test(t.name),facet:Qa({commentTokens:{block:{open:"{/*",close:"*/}"}}})},zf=qf.configure({dialect:"ts"},"typescript"),If=qf.configure({dialect:"jsx",props:[$a.add((t=>t.isTop?[Lf]:void 0))]}),Bf=qf.configure({dialect:"jsx ts",props:[$a.add((t=>t.isTop?[Lf]:void 0))]},"typescript"),jf="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map((t=>({label:t,type:"keyword"})));function Nf(t={}){let e=t.jsx?t.typescript?Bf:If:t.typescript?zf:qf;return new Ua(e,[qf.data.of({autocomplete:(i=Uf,n=zu(Af.concat(jf)),t=>{for(let e=Xa(t.state).resolveInner(t.pos,-1);e;e=e.parent){if(i.indexOf(e.name)>-1)return null;if(e.type.isTop)break}return n(t)})}),qf.data.of({autocomplete:Yf}),t.jsx?Hf:[]]);var i,n}function Gf(t,e,i=t.length){for(let n=null==e?void 0:e.firstChild;n;n=n.nextSibling)if("JSXIdentifier"==n.name||"JSXBuiltin"==n.name||"JSXNamespacedName"==n.name||"JSXMemberExpression"==n.name)return t.sliceString(n.from,Math.min(n.to,i));return""}const Ff="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),Hf=Ts.inputHandler.of(((t,e,i,n)=>{if((Ff?t.composing:t.compositionStarted)||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!qf.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((t=>{var e,i;let r,{head:o}=t,a=Xa(s).resolveInner(o,-1);if("JSXStartTag"==a.name&&(a=a.parent),">"==n&&"JSXFragmentTag"==a.name)return{range:A.cursor(o+1),changes:{from:o,insert:">"}};if("/"==n&&"JSXFragmentTag"==a.name){let t=a.parent,i=null==t?void 0:t.parent;if(t.from==o-1&&"JSXEndTag"!=(null===(e=i.lastChild)||void 0===e?void 0:e.name)&&(r=Gf(s.doc,null==i?void 0:i.firstChild,o))){let t=`/${r}>`;return{range:A.cursor(o+t.length),changes:{from:o,insert:t}}}}else if(">"==n){let t=function(t){for(;;){if("JSXOpenTag"==t.name||"JSXSelfClosingTag"==t.name||"JSXFragmentTag"==t.name)return t;if(!t.parent)return null;t=t.parent}}(a);if(t&&"JSXEndTag"!=(null===(i=t.lastChild)||void 0===i?void 0:i.name)&&"`}}}return{range:t}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)}));class Jf{constructor(t,e,i,n,s,r,o){this.type=t,this.value=e,this.from=i,this.hash=n,this.end=s,this.children=r,this.positions=o,this.hashProp=[[ho.contextHash,n]]}static create(t,e,i,n,s){return new Jf(t,e,i,n+(n<<8)+t+(e<<4)|0,s,[],[])}addChild(t,e){t.prop(ho.contextHash)!=this.hash&&(t=new bo(t.type,t.children,t.positions,t.length,this.hashProp)),this.children.push(t),this.positions.push(e)}toTree(t,e=this.end){let i=this.children.length-1;return i>=0&&(e=Math.max(e,this.positions[i]+this.children[i].length+this.from)),new bo(t.types[this.type],this.children,this.positions,e-this.from).balance({makeTree:(t,e,i)=>new bo(fo.none,t,e,i,this.hashProp)})}}var Kf;!function(t){t[t.Document=1]="Document",t[t.CodeBlock=2]="CodeBlock",t[t.FencedCode=3]="FencedCode",t[t.Blockquote=4]="Blockquote",t[t.HorizontalRule=5]="HorizontalRule",t[t.BulletList=6]="BulletList",t[t.OrderedList=7]="OrderedList",t[t.ListItem=8]="ListItem",t[t.ATXHeading1=9]="ATXHeading1",t[t.ATXHeading2=10]="ATXHeading2",t[t.ATXHeading3=11]="ATXHeading3",t[t.ATXHeading4=12]="ATXHeading4",t[t.ATXHeading5=13]="ATXHeading5",t[t.ATXHeading6=14]="ATXHeading6",t[t.SetextHeading1=15]="SetextHeading1",t[t.SetextHeading2=16]="SetextHeading2",t[t.HTMLBlock=17]="HTMLBlock",t[t.LinkReference=18]="LinkReference",t[t.Paragraph=19]="Paragraph",t[t.CommentBlock=20]="CommentBlock",t[t.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",t[t.Escape=22]="Escape",t[t.Entity=23]="Entity",t[t.HardBreak=24]="HardBreak",t[t.Emphasis=25]="Emphasis",t[t.StrongEmphasis=26]="StrongEmphasis",t[t.Link=27]="Link",t[t.Image=28]="Image",t[t.InlineCode=29]="InlineCode",t[t.HTMLTag=30]="HTMLTag",t[t.Comment=31]="Comment",t[t.ProcessingInstruction=32]="ProcessingInstruction",t[t.URL=33]="URL",t[t.HeaderMark=34]="HeaderMark",t[t.QuoteMark=35]="QuoteMark",t[t.ListMark=36]="ListMark",t[t.LinkMark=37]="LinkMark",t[t.EmphasisMark=38]="EmphasisMark",t[t.CodeMark=39]="CodeMark",t[t.CodeText=40]="CodeText",t[t.CodeInfo=41]="CodeInfo",t[t.LinkTitle=42]="LinkTitle",t[t.LinkLabel=43]="LinkLabel"}(Kf||(Kf={}));class tp{constructor(t,e){this.start=t,this.content=e,this.marks=[],this.parsers=[]}}class ep{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let t=this.skipSpace(this.basePos);this.indent=this.countIndent(t,this.pos,this.indent),this.pos=t,this.next=t==this.text.length?-1:this.text.charCodeAt(t)}skipSpace(t){return rp(this.text,t)}reset(t){for(this.text=t,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(t){this.basePos=t,this.baseIndent=this.countIndent(t,this.pos,this.indent)}moveBaseColumn(t){this.baseIndent=t,this.basePos=this.findColumn(t)}addMarker(t){this.markers.push(t)}countIndent(t,e=0,i=0){for(let n=e;n=e.stack[i.depth+1].value+i.baseIndent)return!0;if(i.indent>=i.baseIndent+4)return!1;let n=(t.type==Kf.OrderedList?dp:up)(i,e,!1);return n>0&&(t.type!=Kf.BulletList||hp(i,e,!1)<0)&&i.text.charCodeAt(i.pos+n-1)==t.value}const np={[Kf.Blockquote]:(t,e,i)=>62==i.next&&(i.markers.push(Up(Kf.QuoteMark,e.lineStart+i.pos,e.lineStart+i.pos+1)),i.moveBase(i.pos+(sp(i.text.charCodeAt(i.pos+1))?2:1)),t.end=e.lineStart+i.text.length,!0),[Kf.ListItem]:(t,e,i)=>!(i.indent-1)&&(i.moveBaseColumn(i.baseIndent+t.value),!0),[Kf.OrderedList]:ip,[Kf.BulletList]:ip,[Kf.Document]:()=>!0};function sp(t){return 32==t||9==t||10==t||13==t}function rp(t,e=0){for(;ei&&sp(t.charCodeAt(e-1));)e--;return e}function ap(t){if(96!=t.next&&126!=t.next)return-1;let e=t.pos+1;for(;e-1&&t.depth==e.stack.length||n<3?-1:1}function cp(t,e){for(let i=t.stack.length-1;i>=0;i--)if(t.stack[i].type==e)return!0;return!1}function up(t,e,i){return 45!=t.next&&43!=t.next&&42!=t.next||t.pos!=t.text.length-1&&!sp(t.text.charCodeAt(t.pos+1))||!(!i||cp(e,Kf.BulletList)||t.skipSpace(t.pos+2)=48&&s<=57;){if(n++,n==t.text.length)return-1;s=t.text.charCodeAt(n)}return n==t.pos||n>t.pos+9||46!=s&&41!=s||nt.pos+1||49!=t.next)?-1:n+1-t.pos}function fp(t){if(35!=t.next)return-1;let e=t.pos+1;for(;e6?-1:i}function pp(t){if(45!=t.next&&61!=t.next||t.indent>=t.baseIndent+4)return-1;let e=t.pos+1;for(;e/,mp=/\?>/,bp=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*/i.exec(n);if(r)return t.append(Up(Kf.Comment,i,i+1+r[0].length));let o=/^\?[^]*?\?>/.exec(n);if(o)return t.append(Up(Kf.ProcessingInstruction,i,i+1+o[0].length));let a=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(n);return a?t.append(Up(Kf.HTMLTag,i,i+1+a[0].length)):-1},Emphasis(t,e,i){if(95!=e&&42!=e)return-1;let n=i+1;for(;t.char(n)==e;)n++;let s=t.slice(i-1,i),r=t.slice(n,n+1),o=jp.test(s),a=jp.test(r),l=/\s|^$/.test(s),h=/\s|^$/.test(r),c=!h&&(!a||l||o),u=!l&&(!o||h||a),d=c&&(42==e||!u||o),f=u&&(42==e||!c||a);return t.append(new Ip(95==e?Yp:qp,i,n,(d?1:0)|(f?2:0)))},HardBreak(t,e,i){if(92==e&&10==t.char(i+1))return t.append(Up(Kf.HardBreak,i,i+2));if(32==e){let e=i+1;for(;32==t.char(e);)e++;if(10==t.char(e)&&e>=i+2)return t.append(Up(Kf.HardBreak,i,e+1))}return-1},Link:(t,e,i)=>91==e?t.append(new Ip(Lp,i,i+1,1)):-1,Image:(t,e,i)=>33==e&&91==t.char(i+1)?t.append(new Ip(zp,i,i+2,1)):-1,LinkEnd(t,e,i){if(93!=e)return-1;for(let e=t.parts.length-1;e>=0;e--){let n=t.parts[e];if(n instanceof Ip&&(n.type==Lp||n.type==zp)){if(!n.side||t.skipSpace(n.to)==i&&!/[(\[]/.test(t.slice(i+1,i+2)))return t.parts[e]=null,-1;let s=t.takeContent(e),r=t.parts[e]=Gp(t,s,n.type==Lp?Kf.Link:Kf.Image,n.from,i+1);if(n.type==Lp)for(let i=0;ie?Up(Kf.URL,e+i,s+i):s==t.length&&null}}function Hp(t,e,i){let n=t.charCodeAt(e);if(39!=n&&34!=n&&40!=n)return!1;let s=40==n?41:n;for(let n=e+1,r=!1;n=this.end?-1:this.text.charCodeAt(t-this.offset)}get end(){return this.offset+this.text.length}slice(t,e){return this.text.slice(t-this.offset,e-this.offset)}append(t){return this.parts.push(t),t.to}addDelimiter(t,e,i,n,s){return this.append(new Ip(t,e,i,(n?1:0)|(s?2:0)))}addElement(t){return this.append(t)}resolveMarkers(t){for(let e=t;e=t;o--){let t=this.parts[o];if(t instanceof Ip&&1&t.side&&t.type==i.type&&!(s&&(1&i.side||2&t.side)&&(t.to-t.from+r)%3==0&&((t.to-t.from)%3||r%3))){n=t;break}}if(!n)continue;let a=i.type.resolve,l=[],h=n.from,c=i.to;if(s){let t=Math.min(2,n.to-n.from,r);h=n.to-t,c=i.from+t,a=1==t?"Emphasis":"StrongEmphasis"}n.type.mark&&l.push(this.elt(n.type.mark,h,n.to));for(let t=o+1;t=0;e--){let i=this.parts[e];if(i instanceof Ip&&i.type==t)return e}return null}takeContent(t){let e=this.resolveMarkers(t);return this.parts.length=t,e}skipSpace(t){return rp(this.text,t-this.offset)+this.offset}elt(t,e,i,n){return"string"==typeof t?Up(this.parser.getNodeType(t),e,i,n):new Wp(t,e)}}function tO(t,e){if(!e.length)return t;if(!t.length)return e;let i=t.slice(),n=0;for(let t of e){for(;n(t?t-1:0))return!1;if(this.fragmentEnd<0){let t=this.fragment.to;for(;t>0&&"\n"!=this.input.read(t-1,t);)t--;this.fragmentEnd=t?t-1:0}let i=this.cursor;i||(i=this.cursor=this.fragment.tree.cursor(),i.firstChild());let n=t+this.fragment.offset;for(;i.to<=n;)if(!i.parent())return!1;for(;;){if(i.from>=n)return this.fragment.from<=e;if(!i.childAfter(n))return!1}}matches(t){let e=this.cursor.tree;return e&&e.prop(ho.contextHash)==t}takeNodes(t){let e=this.cursor,i=this.fragment.offset,n=this.fragmentEnd-(this.fragment.openEnd?1:0),s=t.absoluteLineStart,r=s,o=t.block.children.length,a=r,l=o;for(;;){if(e.to-i>n){if(e.type.isAnonymous&&e.firstChild())continue;break}if(t.dontInject.add(e.tree),t.addNode(e.tree,e.from-i),e.type.is("Block")&&(eO.indexOf(e.type.id)<0?(r=e.to-i,o=t.block.children.length):(r=a,o=l,a=e.to-i,l=t.block.children.length)),!e.nextSibling())break}for(;t.block.children.length>o;)t.block.children.pop(),t.block.positions.pop();return r-s}}const nO=ea({"Blockquote/...":Sa.quote,HorizontalRule:Sa.contentSeparator,"ATXHeading1/... SetextHeading1/...":Sa.heading1,"ATXHeading2/... SetextHeading2/...":Sa.heading2,"ATXHeading3/...":Sa.heading3,"ATXHeading4/...":Sa.heading4,"ATXHeading5/...":Sa.heading5,"ATXHeading6/...":Sa.heading6,"Comment CommentBlock":Sa.comment,Escape:Sa.escape,Entity:Sa.character,"Emphasis/...":Sa.emphasis,"StrongEmphasis/...":Sa.strong,"Link/... Image/...":Sa.link,"OrderedList/... BulletList/...":Sa.list,"BlockQuote/...":Sa.quote,"InlineCode CodeText":Sa.monospace,URL:Sa.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":Sa.processingInstruction,"CodeInfo LinkLabel":Sa.labelName,LinkTitle:Sa.string,Paragraph:Sa.content}),sO=new Zp(new po(Ep).extend(nO),Object.keys(Sp).map((t=>Sp[t])),Object.keys(Sp).map((t=>$p[t])),Object.keys(Sp),Pp,np,Object.keys(Np).map((t=>Np[t])),Object.keys(Np),[]);function rO(t,e,i){let n=[];for(let s=t.firstChild,r=e;;s=s.nextSibling){let t=s?s.from:i;if(t>r&&n.push({from:r,to:t}),!s)break;r=s.to}return n}const oO={resolve:"Strikethrough",mark:"StrikethroughMark"},aO={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":Sa.strikethrough}},{name:"StrikethroughMark",style:Sa.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,i){if(126!=e||126!=t.char(i+1)||126==t.char(i+2))return-1;let n=t.slice(i-1,i),s=t.slice(i+2,i+3),r=/\s|^$/.test(n),o=/\s|^$/.test(s),a=jp.test(n),l=jp.test(s);return t.addDelimiter(oO,i,i+2,!o&&(!l||r||a),!r&&(!a||o||l))},after:"Emphasis"}]};function lO(t,e,i=0,n,s=0){let r=0,o=!0,a=-1,l=-1,h=!1,c=()=>{n.push(t.elt("TableCell",s+a,s+l,t.parser.parseInline(e.slice(a,l),s+a)))};for(let u=i;u-1)&&r++,o=!1,n&&(a>-1&&c(),n.push(t.elt("TableDelimiter",u+s,u+s+1))),a=l=-1),h=!h&&92==i}return a>-1&&(r++,n&&c()),r}function hO(t,e){for(let i=e;ihO(e.content,0)?new uO:null,endLeaf(t,e,i){if(i.parsers.some((t=>t instanceof uO))||!hO(e.text,e.basePos))return!1;let n=t.scanLine(t.absoluteLineEnd+1).text;return cO.test(n)&&lO(t,e.text,e.basePos)==lO(t,n,e.basePos)},before:"SetextHeading"}]};class fO{nextLine(){return!1}finish(t,e){return t.addLeafElement(e,t.elt("Task",e.start,e.start+e.content.length,[t.elt("TaskMarker",e.start,e.start+3),...t.parser.parseInline(e.content.slice(3),e.start+3)])),!0}}const pO=[dO,{defineNodes:[{name:"Task",block:!0,style:Sa.list},{name:"TaskMarker",style:Sa.atom}],parseBlock:[{name:"TaskList",leaf:(t,e)=>/^\[[ xX]\]/.test(e.content)&&"ListItem"==t.parentType().name?new fO:null,after:"SetextHeading"}]},aO];function OO(t,e,i){return(n,s,r)=>{if(s!=t||n.char(r+1)==t)return-1;let o=[n.elt(i,r,r+1)];for(let s=r+1;s=65&&r<=90||95==r||r>=97&&r<=122||r>=161;)s+=String.fromCharCode(n),n=t.peek(++e);var r;return RO=t,EO=i,TO=s?s.toLowerCase():n==MO||n==DO?void 0:null}const MO=63,DO=33;function WO(t,e){this.name=t,this.parent=e,this.hash=e?e.hash:0;for(let e=0;eUO.indexOf(e)>-1?new WO(VO(n,1)||"",t):t,reduce:(t,e)=>e==wO&&t?t.parent:t,reuse(t,e,i,n){let s=e.type.id;return 6==s||36==s?new WO(VO(n,1)||"",t):t},hash:t=>t?t.hash:0,strict:!1}),qO=new nf(((t,e)=>{if(60!=t.next)return void(t.next<0&&e.context&&t.acceptToken(57));t.advance();let i=47==t.next;i&&t.advance();let n=VO(t,0);if(void 0===n)return;if(!n)return t.acceptToken(i?14:6);let s=e.context?e.context.name:null;if(i){if(n==s)return t.acceptToken(11);if(s&&XO[s])return t.acceptToken(57,-2);if(e.dialectEnabled(0))return t.acceptToken(12);for(let t=e.context;t;t=t.parent)if(t.name==n)return;t.acceptToken(13)}else{if("script"==n)return t.acceptToken(7);if("style"==n)return t.acceptToken(8);if("textarea"==n)return t.acceptToken(9);if(_O.hasOwnProperty(n))return t.acceptToken(10);s&&ZO[s]&&ZO[s][n]?t.acceptToken(57,-1):t.acceptToken(6)}}),{contextual:!0}),LO=new nf((t=>{for(let e=0,i=0;;i++){if(t.next<0){i&&t.acceptToken(58);break}if(45==t.next)e++;else{if(62==t.next&&e>=2){i>3&&t.acceptToken(58,-2);break}e=0}t.advance()}}));const zO=new nf(((t,e)=>{if(47==t.next&&62==t.peek(1)){let i=e.dialectEnabled(1)||function(t){for(;t;t=t.parent)if("svg"==t.name||"math"==t.name)return!0;return!1}(e.context);t.acceptToken(i?5:4,2)}else 62==t.next&&t.acceptToken(4,1)}));function IO(t,e,i){let n=2+t.length;return new nf((s=>{for(let r=0,o=0,a=0;;a++){if(s.next<0){a&&s.acceptToken(e);break}if(0==r&&60==s.next||1==r&&47==s.next||r>=2&&ro?s.acceptToken(e,-o):s.acceptToken(i,-(o-2));break}if((10==s.next||13==s.next)&&a){s.acceptToken(e,1);break}r=o=0}else o++;s.advance()}}))}const BO=IO("script",54,1),jO=IO("style",55,2),NO=IO("textarea",56,3),GO=ea({"Text RawText":Sa.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":Sa.angleBracket,TagName:Sa.tagName,"MismatchedCloseTag/TagName":[Sa.tagName,Sa.invalid],AttributeName:Sa.attributeName,"AttributeValue UnquotedAttributeValue":Sa.attributeValue,Is:Sa.definitionOperator,"EntityReference CharacterReference":Sa.character,Comment:Sa.blockComment,ProcessingInst:Sa.processingInstruction,DoctypeDecl:Sa.documentMeta}),FO=wf.deserialize({version:14,states:",xOVO!rOOO!WQ#tO'#CqO!]Q#tO'#CzO!bQ#tO'#C}O!gQ#tO'#DQO!lQ#tO'#DSO!qOaO'#CpO!|ObO'#CpO#XOdO'#CpO$eO!rO'#CpOOO`'#Cp'#CpO$lO$fO'#DTO$tQ#tO'#DVO$yQ#tO'#DWOOO`'#Dk'#DkOOO`'#DY'#DYQVO!rOOO%OQ&rO,59]O%WQ&rO,59fO%`Q&rO,59iO%hQ&rO,59lO%sQ&rO,59nOOOa'#D^'#D^O%{OaO'#CxO&WOaO,59[OOOb'#D_'#D_O&`ObO'#C{O&kObO,59[OOOd'#D`'#D`O&sOdO'#DOO'OOdO,59[OOO`'#Da'#DaO'WO!rO,59[O'_Q#tO'#DROOO`,59[,59[OOOp'#Db'#DbO'dO$fO,59oOOO`,59o,59oO'lQ#|O,59qO'qQ#|O,59rOOO`-E7W-E7WO'vQ&rO'#CsOOQW'#DZ'#DZO(UQ&rO1G.wOOOa1G.w1G.wO(^Q&r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OS!sO~OS!tO~Oa!uOb!uOc!uO!`!wO!a!uO~Oa!xOb!xOc!xO!b!wO!c!xO~Oa!uOb!uOc!uO!`!{O!a!uO~Oa!xOb!xOc!xO!b!{O!c!xO~OT~bac!dx{!d~",goto:"%p!`PPPPPPPPPPPPPPPPPPPP!a!gP!mPP!yP!|#P#S#Y#]#`#f#i#l#r#x!aP!a!aP$O$U$l$r$x%O%U%[%bPPPPPPPP%hX^OX`pXUOX`pezabcde{}!P!R!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ}bQ!PcQ!RdQ!UeZ!e{}!P!R!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:67,context:YO,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,21,30,33,36,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,29,32,35,37,"OpenTag"],["group",-9,14,17,18,19,20,39,40,41,42,"Entity",16,"Entity TextContent",-3,28,31,34,"TextContent Entity"]],propSources:[GO],skippedNodes:[0],repeatNodeCount:9,tokenData:"#%g!aR!YOX$qXY,QYZ,QZ[$q[]&X]^,Q^p$qpq,Qqr-_rs4ysv-_vw5iwxJ^x}-_}!OKP!O!P-_!P!Q$q!Q![-_![!]!!O!]!^-_!^!_!&W!_!`#$o!`!a&X!a!c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;'S;=`#!}<%l?Ah!Nc?Ah?BY!Hp?BY?Mn!Nc?MnO!HpT##QP;=`<%l!Nc!V##^chS!a`!cpOq!G_qr!Eyrs!HUsv!Eyvw!Ncwx!Jvx!P!Ey!P!Q!G_!Q!_!Ey!_!`!G_!`!a!Mm!a#s!Ey#s$f!G_$f;'S!Ey;'S;=`#$i<%l?Ah!Ey?Ah?BY!G_?BY?Mn!Ey?MnO!G_!V#$lP;=`<%l!Ey!V#$zXiS`P!a`!cpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X",tokenizers:[BO,jO,NO,zO,qO,LO,0,1,2,3,4,5],topRules:{Document:[0,15]},dialects:{noMatch:0,selfClosing:485},tokenPrec:487});function HO(t,e){let i=Object.create(null);for(let n of t.getChildren(yO)){let t=n.getChild(SO),s=n.getChild(xO)||n.getChild(kO);t&&(i[e.read(t.from,t.to)]=s?s.type.id==xO?e.read(s.from+1,s.to-1):e.read(s.from,s.to):"")}return i}function JO(t,e){let i=t.getChild(vO);return i?e.read(i.from,i.to):" "}function KO(t,e,i){let n;for(let s of i)if(!s.attrs||s.attrs(n||(n=HO(t.node.parent.firstChild,e))))return{parser:s.parser};return null}function tg(t=[],e=[]){let i=[],n=[],s=[],r=[];for(let e of t){("script"==e.tag?i:"style"==e.tag?n:"textarea"==e.tag?s:r).push(e)}let o=e.length?Object.create(null):null;for(let t of e)(o[t.name]||(o[t.name]=[])).push(t);return Do(((t,e)=>{let a=t.type.id;if(a==QO)return KO(t,e,i);if(a==$O)return KO(t,e,n);if(a==PO)return KO(t,e,s);if(a==wO&&r.length){let i,n=t.node,s=n.firstChild,o=s&&JO(s,e);if(o)for(let t of r)if(t.tag==o&&(!t.attrs||t.attrs(i||(i=HO(n,e))))){let e=n.lastChild;return{parser:t.parser,overlay:[{from:s.to,to:e.type.id==CO?e.from:n.to}]}}}if(o&&a==yO){let i,n=t.node;if(i=n.firstChild){let t=o[e.read(i.from,i.to)];if(t)for(let i of t){if(i.tagName&&i.tagName!=JO(n.parent,e))continue;let t=n.lastChild;if(t.type.id==xO){let e=t.from+1,n=t.lastChild,s=t.to-(n&&n.isError?0:1);if(s>e)return{parser:i.parser,overlay:[{from:e,to:s}]}}else if(t.type.id==kO)return{parser:i.parser,overlay:[{from:t.from,to:t.to}]}}}}return null}))}const eg=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288];function ig(t){return t>=65&&t<=90||t>=97&&t<=122||t>=161}const ng=new nf(((t,e)=>{for(let n=!1,s=0,r=0;;r++){let{next:o}=t;if(!(ig(o)||45==o||95==o||n&&(i=o,i>=48&&i<=57))){n&&t.acceptToken(40==o?95:2==s&&e.canShift(2)?2:96);break}!n&&(45!=o||r>0)&&(n=!0),s===r&&45==o&&s++,t.advance()}var i})),sg=new nf((t=>{if(eg.includes(t.peek(-1))){let{next:e}=t;(ig(e)||95==e||35==e||46==e||91==e||58==e||45==e)&&t.acceptToken(94)}})),rg=new nf((t=>{if(!eg.includes(t.peek(-1))){let{next:e}=t;if(37==e&&(t.advance(),t.acceptToken(1)),ig(e)){do{t.advance()}while(ig(t.next));t.acceptToken(1)}}})),og=ea({"AtKeyword import charset namespace keyframes media supports":Sa.definitionKeyword,"from to selector":Sa.keyword,NamespaceName:Sa.namespace,KeyframeName:Sa.labelName,TagName:Sa.tagName,ClassName:Sa.className,PseudoClassName:Sa.constant(Sa.className),IdName:Sa.labelName,"FeatureName PropertyName":Sa.propertyName,AttributeName:Sa.attributeName,NumberLiteral:Sa.number,KeywordQuery:Sa.keyword,UnaryQueryOp:Sa.operatorKeyword,"CallTag ValueName":Sa.atom,VariableName:Sa.variableName,Callee:Sa.operatorKeyword,Unit:Sa.unit,"UniversalSelector NestingSelector":Sa.definitionOperator,MatchOp:Sa.compareOperator,"ChildOp SiblingOp, LogicOp":Sa.logicOperator,BinOp:Sa.arithmeticOperator,Important:Sa.modifier,Comment:Sa.blockComment,ParenthesizedContent:Sa.special(Sa.name),ColorLiteral:Sa.color,StringLiteral:Sa.string,":":Sa.punctuation,"PseudoOp #":Sa.derefOperator,"; ,":Sa.separator,"( )":Sa.paren,"[ ]":Sa.squareBracket,"{ }":Sa.brace}),ag={__proto__:null,lang:32,"nth-child":32,"nth-last-child":32,"nth-of-type":32,"nth-last-of-type":32,dir:32,"host-context":32,url:60,"url-prefix":60,domain:60,regexp:60,selector:134},lg={__proto__:null,"@import":114,"@media":138,"@charset":142,"@namespace":146,"@keyframes":152,"@supports":164},hg={__proto__:null,not:128,only:128,from:158,to:160},cg=wf.deserialize({version:14,states:"7WQYQ[OOO#_Q[OOOOQP'#Cd'#CdOOQP'#Cc'#CcO#fQ[O'#CfO$YQXO'#CaO$aQ[O'#ChO$lQ[O'#DPO$qQ[O'#DTOOQP'#Ed'#EdO$vQdO'#DeO%bQ[O'#DrO$vQdO'#DtO%sQ[O'#DvO&OQ[O'#DyO&TQ[O'#EPO&cQ[O'#EROOQS'#Ec'#EcOOQS'#ET'#ETQYQ[OOO&jQXO'#CdO'_QWO'#DaO'dQWO'#EjO'oQ[O'#EjQOQWOOOOQP'#Cg'#CgOOQP,59Q,59QO#fQ[O,59QO'yQ[O'#EWO(eQWO,58{O(mQ[O,59SO$lQ[O,59kO$qQ[O,59oO'yQ[O,59sO'yQ[O,59uO'yQ[O,59vO(xQ[O'#D`OOQS,58{,58{OOQP'#Ck'#CkOOQO'#C}'#C}OOQP,59S,59SO)PQWO,59SO)UQWO,59SOOQP'#DR'#DROOQP,59k,59kOOQO'#DV'#DVO)ZQ`O,59oOOQS'#Cp'#CpO$vQdO'#CqO)cQvO'#CsO*pQtO,5:POOQO'#Cx'#CxO)UQWO'#CwO+UQWO'#CyOOQS'#Eg'#EgOOQO'#Dh'#DhO+ZQ[O'#DoO+iQWO'#EkO&TQ[O'#DmO+wQWO'#DpOOQO'#El'#ElO(hQWO,5:^O+|QpO,5:`OOQS'#Dx'#DxO,UQWO,5:bO,ZQ[O,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W%^#W#XJf#X;'S%^;'S;=`%o<%lO%^XJmS!`PoWOy%^z;'S%^;'S;=`%o<%lO%^XJ|UOy%^z#f%^#f#gJf#g;'S%^;'S;=`%o<%lO%^XKeS!RPOy%^z;'S%^;'S;=`%o<%lO%^_KvS!QVOy%^z;'S%^;'S;=`%o<%lO%^ZLXU!PPOy%^z!_%^!_!`6y!`;'S%^;'S;=`%o<%lO%^WLnP;=`<%l$}",tokenizers:[sg,rg,ng,0,1,2,3],topRules:{StyleSheet:[0,4],Styles:[1,84]},specialized:[{term:95,get:t=>ag[t]||-1},{term:56,get:t=>lg[t]||-1},{term:96,get:t=>hg[t]||-1}],tokenPrec:1123});let ug=null;function dg(){if(!ug&&"object"==typeof document&&document.body){let{style:t}=document.body,e=[],i=new Set;for(let n in t)"cssText"!=n&&"cssFloat"!=n&&"string"==typeof t[n]&&(/[A-Z]/.test(n)&&(n=n.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))),i.has(n)||(e.push(n),i.add(n)));ug=e.sort().map((t=>({type:"property",label:t})))}return ug||[]}const fg=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map((t=>({type:"class",label:t}))),pg=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map((t=>({type:"keyword",label:t}))).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map((t=>({type:"constant",label:t})))),Og=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map((t=>({type:"type",label:t}))),gg=/^(\w[\w-]*|-\w[\w-]*|)$/,mg=/^-(-[\w-]*)?$/;const bg=new Ro,wg=["Declaration"];function vg(t){for(let e=t;;){if(e.type.isTop)return e;if(!(e=e.parent))return t}}function yg(t,e,i){if(e.to-e.from>4096){let n=bg.get(e);if(n)return n;let s=[],r=new Set,o=e.cursor(mo.IncludeAnonymous);if(o.firstChild())do{for(let e of yg(t,o.node,i))r.has(e.label)||(r.add(e.label),s.push(e))}while(o.nextSibling());return bg.set(e,s),s}{let n=[],s=new Set;return e.cursor().iterate((e=>{var r;if(i(e)&&e.matchContext(wg)&&":"==(null===(r=e.node.nextSibling)||void 0===r?void 0:r.name)){let i=t.sliceString(e.from,e.to);s.has(i)||(s.add(i),n.push({label:i,type:"variable"}))}})),n}}const Sg=t=>e=>{let{state:i,pos:n}=e,s=Xa(i).resolveInner(n,-1),r=s.type.isError&&s.from==s.to-1&&"-"==i.doc.sliceString(s.from,s.to);if("PropertyName"==s.name||(r||"TagName"==s.name)&&/^(Block|Styles)$/.test(s.resolve(s.to).name))return{from:s.from,options:dg(),validFor:gg};if("ValueName"==s.name)return{from:s.from,options:pg,validFor:gg};if("PseudoClassName"==s.name)return{from:s.from,options:fg,validFor:gg};if(t(s)||(e.explicit||r)&&function(t,e){var i;if(("("==t.name||t.type.isError)&&(t=t.parent||t),"ArgList"!=t.name)return!1;let n=null===(i=t.parent)||void 0===i?void 0:i.firstChild;return"Callee"==(null==n?void 0:n.name)&&"var"==e.sliceString(n.from,n.to)}(s,i.doc))return{from:t(s)||r?s.from:n,options:yg(i.doc,vg(s),t),validFor:mg};if("TagName"==s.name){for(let{parent:t}=s;t;t=t.parent)if("Block"==t.name)return{from:s.from,options:dg(),validFor:gg};return{from:s.from,options:Og,validFor:gg}}if(!e.explicit)return null;let o=s.resolve(n),a=o.childBefore(n);return a&&":"==a.name&&"PseudoClassSelector"==o.name?{from:n,options:fg,validFor:gg}:a&&":"==a.name&&"Declaration"==o.name||"ArgList"==o.name?{from:n,options:pg,validFor:gg}:"Block"==o.name||"Styles"==o.name?{from:n,options:dg(),validFor:gg}:null},xg=Sg((t=>"VariableName"==t.name)),kg=_a.define({name:"css",parser:cg.configure({props:[Na.add({Declaration:il()}),rl.add({"Block KeyframeList":ol})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function Qg(){return new Ua(kg,kg.data.of({autocomplete:xg}))}const $g=["_blank","_self","_top","_parent"],Pg=["ascii","utf-8","utf-16","latin1","latin1"],Cg=["get","post","put","delete"],_g=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Xg=["true","false"],Zg={},Ag={a:{attrs:{href:null,ping:null,type:null,media:null,target:$g,hreflang:null}},abbr:Zg,address:Zg,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Zg,aside:Zg,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Zg,base:{attrs:{href:null,target:$g}},bdi:Zg,bdo:Zg,blockquote:{attrs:{cite:null}},body:Zg,br:Zg,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Zg,center:Zg,cite:Zg,code:Zg,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:Zg,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Zg,div:Zg,dl:Zg,dt:Zg,em:Zg,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Zg,figure:Zg,footer:Zg,form:{attrs:{action:null,name:null,"accept-charset":Pg,autocomplete:["on","off"],enctype:_g,method:Cg,novalidate:["novalidate"],target:$g}},h1:Zg,h2:Zg,h3:Zg,h4:Zg,h5:Zg,h6:Zg,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Zg,hgroup:Zg,hr:Zg,html:{attrs:{manifest:null}},i:Zg,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:Zg,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Zg,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:Zg,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Pg,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:Zg,noscript:Zg,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:Zg,param:{attrs:{name:null,value:null}},pre:Zg,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Zg,rt:Zg,ruby:Zg,samp:Zg,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Pg}},section:Zg,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Zg,source:{attrs:{src:null,type:null,media:null}},span:Zg,strong:Zg,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Zg,summary:Zg,sup:Zg,table:Zg,tbody:Zg,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Zg,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:Zg,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Zg,time:{attrs:{datetime:null}},title:Zg,tr:Zg,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Zg,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:Zg},Tg={accesskey:null,class:null,contenteditable:Xg,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Xg,autocorrect:Xg,autocapitalize:Xg,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Xg,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Xg,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Xg,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Xg,"aria-hidden":Xg,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Xg,"aria-multiselectable":Xg,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Xg,"aria-relevant":null,"aria-required":Xg,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},Rg="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map((t=>"on"+t));for(let t of Rg)Tg[t]=null;class Eg{constructor(t,e){this.tags=Object.assign(Object.assign({},Ag),t),this.globalAttrs=Object.assign(Object.assign({},Tg),e),this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}function Vg(t,e,i=t.length){if(!e)return"";let n=e.firstChild,s=n&&n.getChild("TagName");return s?t.sliceString(s.from,Math.min(s.to,i)):""}function Mg(t,e=!1){for(let i=t.parent;i;i=i.parent)if("Element"==i.name){if(!e)return i;e=!1}return null}function Dg(t,e,i){let n=i.tags[Vg(t,Mg(e,!0))];return(null==n?void 0:n.children)||i.allTags}function Wg(t,e){let i=[];for(let n=e;n=Mg(n);){let s=Vg(t,n);if(s&&"CloseTag"==n.lastChild.name)break;s&&i.indexOf(s)<0&&("EndTag"==e.name||e.from>=n.firstChild.to)&&i.push(s)}return i}Eg.default=new Eg;const Ug=/^[:\-\.\w\u00b7-\uffff]*$/;function Yg(t,e,i,n,s){let r=/\s*>/.test(t.sliceDoc(s,s+5))?"":">";return{from:n,to:s,options:Dg(t.doc,i,e).map((t=>({label:t,type:"type"}))).concat(Wg(t.doc,i).map(((t,e)=>({label:"/"+t,apply:"/"+t+r,type:"type",boost:99-e})))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function qg(t,e,i,n){let s=/\s*>/.test(t.sliceDoc(n,n+5))?"":">";return{from:i,to:n,options:Wg(t.doc,e).map(((t,e)=>({label:t,apply:t+s,type:"type",boost:99-e}))),validFor:Ug}}function Lg(t,e){let{state:i,pos:n}=e,s=Xa(i).resolveInner(n),r=s.resolve(n,-1);for(let t,e=n;s==r&&(t=r.childBefore(e));){let i=t.lastChild;if(!i||!i.type.isError||i.from({label:t,type:"property"}))),validFor:Ug}}(i,t,r,"AttributeName"==r.name?r.from:n,n):"Is"==r.name||"AttributeValue"==r.name||"UnquotedAttributeValue"==r.name?function(t,e,i,n,s){var r;let o,a=null===(r=i.parent)||void 0===r?void 0:r.getChild("AttributeName"),l=[];if(a){let r=t.sliceDoc(a.from,a.to),h=e.globalAttrs[r];if(!h){let n=Mg(i),s=n?e.tags[Vg(t.doc,n)]:null;h=(null==s?void 0:s.attrs)&&s.attrs[r]}if(h){let e=t.sliceDoc(n,s).toLowerCase(),i='"',r='"';/^['"]/.test(e)?(o='"'==e[0]?/^[^"]*$/:/^[^']*$/,i="",r=t.sliceDoc(s,s+1)==e[0]?"":e[0],e=e.slice(1),n++):o=/^[^\s<>='"]*$/;for(let t of h)l.push({label:t,apply:i+t+r,type:"constant"})}}return{from:n,to:s,options:l,validFor:o}}(i,t,r,"Is"==r.name?n:r.from,n):!e.explicit||"Element"!=s.name&&"Text"!=s.name&&"Document"!=s.name?null:function(t,e,i,n){let s=[],r=0;for(let n of Dg(t.doc,i,e))s.push({label:"<"+n,type:"type"});for(let e of Wg(t.doc,i))s.push({label:"",type:"type",boost:99-r++});return{from:n,to:n,options:s,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}(i,t,r,n)}function zg(t){let{extraTags:e,extraGlobalAttributes:i}=t,n=i||e?new Eg(e,i):Eg.default;return t=>Lg(n,t)}const Ig=[{tag:"script",attrs:t=>"text/typescript"==t.type||"ts"==t.lang,parser:zf.parser},{tag:"script",attrs:t=>"text/babel"==t.type||"text/jsx"==t.type,parser:If.parser},{tag:"script",attrs:t=>"text/typescript-jsx"==t.type,parser:Bf.parser},{tag:"script",attrs:t=>!t.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(t.type),parser:qf.parser},{tag:"style",attrs:t=>(!t.lang||"css"==t.lang)&&(!t.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(t.type)),parser:kg.parser}],Bg=[{name:"style",parser:kg.parser.configure({top:"Styles"})}].concat(Rg.map((t=>({name:t,parser:qf.parser})))),jg=_a.define({name:"html",parser:FO.configure({props:[Na.add({Element(t){let e=/^(\s*)(<\/)?/.exec(t.textAfter);return t.node.to<=t.pos+e[0].length?t.continue():t.lineIndent(t.node.from)+(e[2]?0:t.unit)},"OpenTag CloseTag SelfClosingTag":t=>t.column(t.node.from)+t.unit,Document(t){if(t.pos+/\s*/.exec(t.textAfter)[0].lengtht.getChild("TagName")})],wrap:tg(Ig,Bg)}),languageData:{commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-._"}});function Ng(t={}){let e,i="";!1===t.matchClosingTags&&(i="noMatch"),!0===t.selfClosingTags&&(i=(i?i+" ":"")+"selfClosing"),(t.nestedLanguages&&t.nestedLanguages.length||t.nestedAttributes&&t.nestedAttributes.length)&&(e=tg((t.nestedLanguages||[]).concat(Ig),(t.nestedAttributes||[]).concat(Bg)));let n=e||i?jg.configure({dialect:i,wrap:e}):jg;return new Ua(n,[jg.data.of({autocomplete:zg(t)}),!1!==t.autoCloseTags?Fg:[],Nf().support,Qg().support])}const Gg=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),Fg=Ts.inputHandler.of(((t,e,i,n)=>{if(t.composing||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!jg.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((e=>{var i,r,o;let a,{head:l}=e,h=Xa(s).resolveInner(l,-1);if("TagName"!=h.name&&"StartTag"!=h.name||(h=h.parent),">"==n&&"OpenTag"==h.name){if("CloseTag"!=(null===(r=null===(i=h.parent)||void 0===i?void 0:i.lastChild)||void 0===r?void 0:r.name)&&(a=Vg(s.doc,h.parent,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`${e?"":">"}`;return{range:A.cursor(l+1),changes:{from:l+(e?1:0),insert:i}}}}else if("/"==n&&"OpenTag"==h.name){let e=h.parent,i=null==e?void 0:e.parent;if(e.from==l-1&&"CloseTag"!=(null===(o=i.lastChild)||void 0===o?void 0:o.name)&&(a=Vg(s.doc,i,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`/${a}${e?"":">"}`,n=l+i.length+(e?1:0);return{range:A.cursor(n),changes:{from:l,insert:i}}}}return{range:e}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)})),Hg=Qa({commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}}}),Jg=new ho,Kg=sO.configure({props:[rl.add((t=>!t.is("Block")||t.is("Document")||null!=tm(t)?void 0:(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to}))),Jg.add(tm),Na.add({Document:()=>null}),ka.add({Document:Hg})]});function tm(t){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(t.name);return e?+e[1]:void 0}function em(t,e){let i=t;for(;;){let t,n=i.nextSibling;if(!n||null!=(t=tm(n.type))&&t<=e)break;i=n}return i.to}const im=sl.of(((t,e,i)=>{for(let n=Xa(t).resolveInner(i,-1);n&&!(n.fromi)return{from:i,to:e}}return null}));function nm(t){return new Pa(Hg,t,[im],"markdown")}const sm=nm(Kg),rm=nm(Kg.configure([pO,mO,gO,bO]));class om{constructor(t,e,i,n,s,r,o){this.node=t,this.from=e,this.to=i,this.spaceBefore=n,this.spaceAfter=s,this.type=r,this.item=o}blank(t,e=!0){let i=this.spaceBefore+("Blockquote"==this.node.name?">":"");if(null!=t){for(;i.length0;t--)i+=" ";return i+(e?this.spaceAfter:"")}marker(t,e){let i="OrderedList"==this.node.name?String(+lm(this.item,t)[2]+e):"";return this.spaceBefore+i+this.type+this.spaceAfter}}function am(t,e){let i=[];for(let e=t;e&&"Document"!=e.name;e=e.parent)"ListItem"!=e.name&&"Blockquote"!=e.name&&"FencedCode"!=e.name||i.push(e);let n=[];for(let t=i.length-1;t>=0;t--){let s,r=i[t],o=e.lineAt(r.from),a=r.from-o.from;if("FencedCode"==r.name)n.push(new om(r,a,a,"","","",null));else if("Blockquote"==r.name&&(s=/^[ \t]*>( ?)/.exec(o.text.slice(a))))n.push(new om(r,a,a+s[0].length,"",s[1],">",null));else if("ListItem"==r.name&&"OrderedList"==r.parent.name&&(s=/^([ \t]*)\d+([.)])([ \t]*)/.exec(o.text.slice(a)))){let t=s[3],e=s[0].length;t.length>=4&&(t=t.slice(0,t.length-4),e-=4),n.push(new om(r.parent,a,a+e,s[1],t,s[2],r))}else if("ListItem"==r.name&&"BulletList"==r.parent.name&&(s=/^([ \t]*)([-+*])([ \t]{1,4}\[[ xX]\])?([ \t]+)/.exec(o.text.slice(a)))){let t=s[4],e=s[0].length;t.length>4&&(t=t.slice(0,t.length-4),e-=4);let i=s[2];s[3]&&(i+=s[3].replace(/[xX]/," ")),n.push(new om(r.parent,a,a+e,s[1],t,i,r))}}return n}function lm(t,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(t.from,t.from+10))}function hm(t,e,i,n=0){for(let s=-1,r=t;;){if("ListItem"==r.name){let t=lm(r,e),o=+t[2];if(s>=0){if(o!=s+1)return;i.push({from:r.from+t[1].length,to:r.from+t[0].length,insert:String(s+2+n)})}s=o}let t=r.nextSibling;if(!t)break;r=t}}function cm(t){return"QuoteMark"==t.name||"ListMark"==t.name}const um=[{key:"Enter",run:({state:t,dispatch:e})=>{let i=Xa(t),{doc:n}=t,s=null,r=t.changeByRange((e=>{if(!e.empty||!rm.isActiveAt(t,e.from))return s={range:e};let r=e.from,o=n.lineAt(r),a=am(i.resolveInner(r,-1),n);for(;a.length&&a[a.length-1].from>r-o.from;)a.pop();if(!a.length)return s={range:e};let l=a[a.length-1];if(l.to-l.spaceAfter.length>r-o.from)return s={range:e};let h=r>=l.to-l.spaceAfter.length&&!/\S/.test(o.text.slice(l.to));if(l.item&&h){if(l.node.firstChild.to>=r||o.from>0&&!/[^\s>]/.test(n.lineAt(o.from-1).text)){let t,e=a.length>1?a[a.length-2]:null,i="";e&&e.item?(t=o.from+e.from,i=e.marker(n,1)):t=o.from+(e?e.to:0);let s=[{from:t,to:r,insert:i}];return"OrderedList"==l.node.name&&hm(l.item,n,s,-2),e&&"OrderedList"==e.node.name&&hm(e.item,n,s),{range:A.cursor(t+i.length),changes:s}}{let e="";for(let t=0,i=a.length-2;t<=i;t++)e+=a[t].blank(t\s*$/.exec(i.text);if(s&&s.index==l.from){let n=t.changes([{from:i.from+s.index,to:i.to},{from:o.from+l.from,to:o.to}]);return{range:e.map(n),changes:n}}}let c=[];"OrderedList"==l.node.name&&hm(l.item,n,c);let u=l.item&&l.item.from]*/.exec(o.text)[0].length>=l.to)for(let t=0,e=a.length-1;t<=e;t++)d+=t!=e||u?a[t].blank(to.from&&/\s/.test(o.text.charAt(f-o.from-1));)f--;return d=t.lineBreak+d,c.push({from:f,to:r,insert:d}),{range:A.cursor(f+d.length),changes:c}}));return!s&&(e(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0)}},{key:"Backspace",run:({state:t,dispatch:e})=>{let i=Xa(t),n=null,s=t.changeByRange((e=>{let s=e.from,{doc:r}=t;if(e.empty&&rm.isActiveAt(t,e.from)){let t=r.lineAt(s),n=am(function(t,e){let i=t.resolveInner(e,-1),n=e;cm(i)&&(n=i.from,i=i.parent);for(let t;t=i.childBefore(n);)if(cm(t))n=t.from;else{if("OrderedList"!=t.name&&"BulletList"!=t.name)break;i=t.lastChild,n=i.to}return i}(i,s),r);if(n.length){let i=n[n.length-1],r=i.to-i.spaceAfter.length+(i.spaceAfter?1:0);if(s-t.from>r&&!/\S/.test(t.text.slice(r,s-t.from)))return{range:A.cursor(t.from+r),changes:{from:t.from+r,to:s}};if(s-t.from==r&&(!i.item||t.from<=i.item.from||!/\S/.test(t.text.slice(0,i.to)))){let n=t.from+i.from;if(i.item&&i.node.fromt.from-e.from||t.startSide-e.startSide)),ni.set(i)}getMatchingBracket(t){switch(t){case")":return"(";case"]":return"[";case"}":return"{";default:return null}}},{decorations:t=>t.decorations});var fm="[a-zA-Z\\$][a-zA-Z0-9\\$]*",pm="(?:\\.\\d+|\\d+\\.\\d*|\\d+)",Om="(?:`(?:`?"+pm+")?)",gm=new RegExp("(?:(?:\\d+)(?:\\^\\^(?:\\.\\w+|\\w+\\.\\w*|\\w+)"+Om+"?(?:\\*\\^[+-]?\\d+)?))"),mm=new RegExp("(?:"+pm+Om+"?(?:\\*\\^[+-]?\\d+)?)"),bm=new RegExp("(?:`?)(?:"+fm+")(?:`(?:"+fm+"))*(?:`?)");let wm=[];const vm=["True","False","All","None","Null","Full","$Failed","$Aborted"];function ym(t,e){var i;return'"'===(i=t.next())?(e.tokenize=Sm,e.tokenize(t,e)):"("===i&&t.eat("*")?(e.commentLevel++,e.tokenize=xm,e.tokenize(t,e)):(t.backUp(1),t.match(gm,!0,!1)||t.match(mm,!0,!1)?"number":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::usage)/,!0,!1)?"meta":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::[a-zA-Z\$][a-zA-Z0-9\$]*):?/,!0,!1)?"string.special":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*\s*:)(?:(?:[a-zA-Z\$][a-zA-Z0-9\$]*)|(?:[^:=>~@\^\&\*\)\[\]'\?,\|])).*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+/,!0,!1)||t.match(/_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)?"variableName.special":t.match(/\\\[[a-zA-Z\$][a-zA-Z0-9\$]*\]/,!0,!1)?"character":t.match(/(?:\[|\]|{|}|\(|\))/,!0,!1)?"bracket":t.match(/(?:#[a-zA-Z\$][a-zA-Z0-9\$]*|#+[0-9]?)/,!0,!1)?"variableName.constant":t.match(bm,!0,!1)?vm.indexOf(t.current())>-1?"number":wm.indexOf(t.current())>-1||0==wm.length?"keyword":t.current()in e.localVars?"atom":(e.localVars[t.current()]=!0,"function"):t.match(/(?:\\|\+|\-|\*|\/|,|;|\.|:|@|~|=|>|<|&|\||_|`|'|\^|\?|!|%)/,!0,!1)?"operator":(t.next(),"error"))}function Sm(t,e){for(var i,n=!1,s=!1;null!=(i=t.next());){if('"'===i&&!s){n=!0;break}s=!s&&"\\"===i}return n&&!s&&(e.tokenize=ym),"string"}function xm(t,e){for(var i,n;e.commentLevel>0&&null!=(n=t.next());)"("===i&&"*"===n&&e.commentLevel++,"*"===i&&")"===n&&e.commentLevel--,i=n;return e.commentLevel<=0&&(e.tokenize=ym),"comment"}const km={name:"mathematica",extendVariables:function(t){},startState:function(){return{tokenize:ym,commentLevel:0,localVars:{}}},token:function(t,e){return t.eatSpace()?null:e.tokenize(t,e)},languageData:{commentTokens:{block:{open:"(*",close:"*)"}}}};let Qm={of:t=>[Gl.define(km),Yd({override:[async e=>function(t,e){let i=t.matchBefore(/\w*/);return i.from!==i.to||t.explicit?{from:i.from,options:e.data}:null}(e,t)]}),Ys.of([{key:"Escape",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((t=>{let{from:e,to:i}=t;return{changes:{from:e,to:i,insert:"EC"},range:A.cursor(e+2)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])],reBuild:t=>{wm=t.map((t=>t.label))}};const $m=(t,e,i,n)=>{if(0==t.length)return;const s=(new Date).valueOf();let r=0;i.dom.loadingMark=!0;const o=i.dom.style.background;let a=0;console.log("Start animation");const l=setInterval((()=>{i.dom.style.setProperty("background","hsl("+a+"deg 100% 97%)","important"),a+=2,a>360&&(a=0)}),30);n.transaction(e,i,s,t.length);for(const a of t)Pm(a,((a,h)=>{n.file(e,i,s,a,h),r++,r>=t.length&&i.dom&&i.dom.loadingMark&&(i.dom.loadingMark=!1,setTimeout((()=>{i.dom.style.background=o,clearInterval(l),console.log("Stop animation")}),2e3))}),(()=>{console.warn("Fauilure");const t=i.dom.style.background;i.dom.style.background="rgb(255 189 189 / 97%)";let e=97;const n=setInterval((()=>{i.dom.style.background="rgb(255 189 189 / "+Math.round(e)+"%)",e*=.95}),30);clearInterval(l),setTimeout((()=>{clearInterval(n),i.dom.style.background=t}),3e3)}))};function Pm(t,e,i){const n=new FileReader;n.addEventListener("load",(n=>{const s=n.target.result;if(s.byteLength/1024/1024>100)return alert("Files > 100Mb are not supported for drag and drop"),void i();let r=base64ArrayBuffer(s);e(t.name,r)})),n.addEventListener("progress",(t=>{if(t.loaded&&t.total){const e=t.loaded/t.total*100;console.log(e)}})),n.readAsArrayBuffer(t)}const Cm=(t,e)=>Ts.domEventHandlers({drop(e,i){e.preventDefault();const n=[];e.dataTransfer.items?[...e.dataTransfer.items].forEach(((t,e)=>{if("file"===t.kind){const i=t.getAsFile();console.log(`… file[${e}].name = ${i.name}`),n.push(i)}})):[...e.dataTransfer.files].forEach(((t,e)=>{console.log(`… file[${e}].name = ${t.name}`),n.push(t)})),$m(n,e,i,t)},paste(t,i){let n=t.clipboardData||window.clipboardData;for(const s of n.items)if("string"===s.kind)switch(s.type){case"text/plain":break;case"image/png":t.preventDefault(),$m([s.getAsFile()],t,i,e)}else t.preventDefault(),$m([s.getAsFile()],t,i,e)}}),_m=new pr({regexp:/\\\[(\w+)\]/g,decoration:t=>ni.replace({widget:new Zm(t[1])})}),Xm=_i.fromClass(class{constructor(t){this.Greekholder=_m.createDeco(t)}update(t){this.Greekholder=_m.updateDeco(t,this.Greekholder)}},{decorations:t=>t.Greekholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Greekholder||ni.none))});class Zm extends ei{constructor(t){super(),this.name=t}eq(t){return this.name===t.name}toDOM(){let t=document.createElement("span");return t.innerHTML="&"+this.name.toLowerCase().replace("sqrt","radic").replace("undirectededge","harr").replace("directededge","rarr").replace(/capital(.*)/,((t,e)=>e.charAt(0).toUpperCase()+e.slice(1))).replace(/curly(.*)/,((t,e)=>e)).replace(/script(.*)/,((t,e)=>"el"+e.toLowerCase())).replace("transpose","#7488").replace("degree","deg")+";",t}ignoreEvent(){return!1}}const Am=new pr({regexp:/(->|<-)/g,decoration:t=>ni.replace({widget:new Tm(t[1])})});_i.fromClass(class{constructor(t){this.Arrowholder=Am.createDeco(t)}update(t){this.Arrowholder=Am.updateDeco(t,this.Arrowholder)}},{decorations:t=>t.Arrowholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Arrowholder||ni.none))});class Tm extends ei{constructor(t){super(),this.dir=t}eq(t){return this.dir===t.dir}toDOM(){let t=document.createElement("span");return"->"===this.dir?t.innerText="→":t.innerText="←",t}ignoreEvent(){return!1}}function Rm(t){if(!(t=t||{}).open)throw new Error('Balanced: please provide a "open" property');if(!t.close)throw new Error('Balanced: please provide a "close" property');if(this.balance=t.balance||!1,this.exceptions=t.exceptions||!1,this.caseInsensitive=t.caseInsensitive,this.head=t.head||t.open,this.head=Array.isArray(this.head)?this.head:[this.head],this.open=Array.isArray(t.open)?t.open:[t.open],this.close=Array.isArray(t.close)?t.close:[t.close],!Array.isArray(this.head)||!Array.isArray(this.open)||!Array.isArray(this.close)||this.head.length!==this.open.length||this.open.length!==this.close.length)throw new Error('Balanced: if you use arrays for a "head,open,close" you must use matching arrays for all options');var e=Dm(this.head.map(this.regExpFromArrayGroupedMap,this)),i=Dm(this.open.map(this.regExpFromArrayGroupedMap,this)),n=Dm(this.close.map(this.regExpFromArrayGroupedMap,this));this.regExp=Dm([e,i,n],"g"+(this.caseInsensitive?"i":"")),this.regExpGroupLength=this.head.length}function Em(t,e,i){for(var n=Mm(e.substr(0,i+1),/^.*\n?$/gim),s=Mm(e,/^.*\n?$/gim),r=n.length-1,o=i+1-(n.length?n[n.length-1].index:0),a="",l=2;l>=0;l--)r-l>=0&&s[r-l]&&(a+=e.substr(s[r-l].index,s[r-l].length)+"\n");for(l=0;l=0&&s[r+l]&&(a+=e.substr(s[r+l].index,s[r+l].length)+"\n");a=a.replace(/\t/g," ").replace(/\n$/,"");var h=new Error(t+" at "+(r+1)+":"+o+"\n\n"+a);return h.line=r+1,h.column=o,h.index=i,h}function Vm(t,e){return t>=e.index&&t<=e.index+e.length-1}function Mm(t,e){var i,n=new RegExp(e),s=[];if(t)for(;i=n.exec(t);)s.push({index:i.index,length:i[0].length,match:i[0]}),i[0].length||n.lastIndex++;return s}function Dm(t,e,i){var n=t.map((function(t){return t instanceof RegExp?t.source:function(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}(t)}),this).join("|");return n=i?"("+n+")":"(?:"+n+")",new RegExp(n,e||void 0)}Rm.prototype={regExpFromArrayGroupedMap:function(t){return Dm([t],null,!0)},matchContentsInBetweenBrackets:function(t,e){for(var i,n=new RegExp(this.regExp),s=[],r=[],o=null,a=!0;i=n.exec(t);){if(e){for(var l=!1,h=0;h{const i=((t,e,i)=>{var n,s=new RegExp(t),r=[];if(e)for(;n=s.exec(e);){if(i){for(var o=!1,a=0;a{new qm({open:"(*"+t+"[*)",close:"(*]"+t+"*)",balance:!1}).matchContentsInBetweenBrackets(e.value,[]).forEach((function(t){const s=e.value.slice(t.index+t.head.length,t.index+t.length-t.tail.length);n(i+t.index,{length:t.length,pos:i+t.index,argsPos:i+t.index+t.head.length,str:s})}))})(e,t,i,s)},o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)r(o,a)}var Im,Bm=function(){function t(t){var e=t.tag,i=t.decoration,n=t.decorate,s=t.boundary,r=t.maxLength,o=void 0===r?1e3:r;if(this.tag=e,n)this.addMatch=function(t,e,i,s){return n(s,i,i+t.length,t,e)};else if("function"==typeof i)this.addMatch=function(t,e,n,s){var r=i(t,e,n);r&&s(n,n+t.length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=function(t,e,n,s){return s(n,n+t.length,i)}}this.boundary=s,this.maxLength=o}return t.prototype.createDeco=function(t){for(var e=this,i=new Xt,n=i.add.bind(i),s=0,r=function(t,e){var i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;for(var n=[],s=0,r=i;s=a?n[n.length-1].to=l:n.push({from:a,to:l})}return n}(t,this.maxLength);st.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e},t.prototype.updateRange=function(t,e,i,n){for(var s=this,r=function(r){var a=Math.max(r.from,i),l=Math.min(r.to,n);if(l>a){var h=t.state.doc.lineAt(a),c=h.toh.from;a--)if(o.boundary.test(h.text[a-1-h.from])){u=a;break}for(;ld},add:f})}},o=this,a=0,l=t.visibleRanges;a{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*FB[*)((_)(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*FB[*)(("+s+")(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let Nm=class{constructor(t,e,i,n,s,r){this.view=e,this.visibleValue=t,this.placeholder=r,console.log(r),this.args=Lm(t.str,/\(\*,\*\)/gm);const o=this;let a,l;console.log("creating InstanceWidget"),a=Im({doc:o.args[0].body.slice(2,-1),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(o.visibleValue.pos),e.dispatch({selection:{anchor:o.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return l.dispatch({selection:{anchor:0}}),l.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){l.focus(),t.editorLastCursor=void 0}}])]}),l=Im({doc:o.args[2].body.slice(1,-2),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:a.state.doc.length}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:o.visibleValue.pos+o.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus(),t.editorLastCursor=void 0}}])]}),o.args[0].length=o.args[0].body.length,o.args[2].length=o.args[2].body.length,delete o.args[2].body,delete o.args[1].body,delete o.args[0].body,this.topEditor=a,this.bottomEditor=l}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="(("+t+")",s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length));const r=e.length-i[0].length;i[0].to=i[0].to+r,i[2].from=i[2].from+r,i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e="("+t+"))",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length));const r=e.length-i[2].length;i[2].to=i[2].to+r,i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t,e){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm),console.log("recreating InstanceWidget"),n=Im.state({doc:e.args[0].body.slice(2,-1),update:t=>e.applyChanges(t,0),eval:()=>{i.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(e.visibleValue.pos),i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus(),t.editorLastCursor=void 0}}])]}),s=Im.state({doc:e.args[2].body.slice(1,-2),update:t=>e.applyChanges(t,2),eval:()=>{e.view.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus(),t.editorLastCursor=void 0}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),console.log(e),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.placeholder=e,this.visibleValue.argsPos=t.argsPos}destroy(){this.topEditor.destroy(),this.bottomEditor.destroy()}},Gm=class extends ei{constructor(t,e,i,n){super(),this.view=i,this.visibleValue=t,this.reference=e,this.placeholder=n}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue,this),!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("fraction");const i=document.createElement("table");i.classList.add("container"),e.appendChild(i);const n=document.createElement("tbody");i.appendChild(n);const s=document.createElement("tr"),r=document.createElement("tr");n.appendChild(s),n.appendChild(r);const o=document.createElement("td");o.classList.add("enumenator"),s.appendChild(o);const a=document.createElement("td");r.appendChild(a);const l=this;return e.EditorWidget=new Nm(this.visibleValue,t,o,a,[],this),this.DOMElement=e,this.reference.push({destroy:()=>{l.destroy(e)}}),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const Fm=(t,e,i)=>new Bm({tag:"FB",decoration:n=>ni.replace({widget:new Gm(n,t,e,i)})}),Hm=t=>_i.fromClass(class{constructor(e){this.disposable=[],this.placeholder=Fm(this.disposable,e,this).createDeco(e),t.placeholder=this}update(t){this.placeholder=Fm(this.disposable,t,this).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var Jm;function Km(t){return Jm=t,[nb,Ys.of([{key:"Ctrl-2",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt[_](*]SqB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt["+s+"](*]SqB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let tb=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;this.sliceRanges=n,this.length=t.str.length,console.log("creating InstanceWidget"),this.editor=Jm({doc:t.str.slice(...n),parent:i,update:t=>r.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]})}applyChanges(t){const e=t,i={from:this.visibleValue.argsPos+5,to:this.visibleValue.argsPos+this.length-1,insert:e};console.log(this.visibleValue);const n=e.length+6-this.length;this.length=this.length+n,this.visibleValue.length=this.visibleValue.length+n,this.visibleValue.str="Sqrt["+e+"]",this.view.dispatch({changes:i})}update(t){if(this.visibleValue.str==t.str)this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos;else{console.warn("Out of sync"),this.visibleValue=t;const e=this.sliceRanges,i=this.editor,n=this,s=this.view;this.length=t.str.length;const r=Jm.state({doc:t.str.slice(...e),update:t=>n.applyChanges(t),eval:()=>{s.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos+n.visibleValue.length}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]});i.setState(r)}}destroy(){console.warn("destroy Instance of Widget!"),this.editor.destroy()}},eb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("sqroot");const i=this,n=document.createElement("span");return n.classList.add("radicand"),e.EditorWidget=new tb(this.visibleValue,t,n,[5,-1],[]),e.appendChild(n),this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const ib=(t,e)=>new Bm({tag:"SqB",decoration:i=>ni.replace({widget:new eb(i,t,e)})}),nb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=ib(this.disposable,t).createDeco(t)}update(t){this.placeholder=ib(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var sb;function rb(t){return sb=t,[hb,Ys.of([{key:"Ctrl--",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SbB[*)Subscript[_(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SbB[*)Subscript["+s+"(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let ob=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),console.log(r.visibleValue),o=sb({doc:r.args[0].body.slice(10),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){a.focus()}}])]}),a=sb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Subscript["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),console.log(e.visibleValue),n=sb.state({doc:e.args[0].body.slice(10),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus()}}])]}),s=sb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},ab=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sub");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new ob(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const lb=(t,e)=>new Bm({tag:"SbB",decoration:i=>ni.replace({widget:new ab(i,t,e)})}),hb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=lb(this.disposable,t).createDeco(t)}update(t){this.placeholder=lb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var cb;function ub(t){return cb=t,[Ob,Ys.of([{key:"Ctrl-6",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SpB[*)Power[_(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SpB[*)Power["+s+"(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let db=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),o=cb({doc:r.args[0].body.slice(6),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus()}}])]}),a=cb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Power["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),n=cb.state({doc:e.args[0].body.slice(6),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.bottomEditor.focus()}}])]}),s=cb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},fb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sup");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new db(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}destroy(t){t.EditorWidget.destroy()}};const pb=(t,e)=>new Bm({tag:"SpB",decoration:i=>ni.replace({widget:new fb(i,t,e)})}),Ob=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=pb(this.disposable,t).createDeco(t)}update(t){this.placeholder=pb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var gb={},mb={},bb={},wb={};function vb(t){let e=t.length;for(;--e>=0;)t[e]=0}const yb=256,Sb=286,xb=30,kb=15,Qb=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),$b=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Pb=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Cb=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_b=new Array(576);vb(_b);const Xb=new Array(60);vb(Xb);const Zb=new Array(512);vb(Zb);const Ab=new Array(256);vb(Ab);const Tb=new Array(29);vb(Tb);const Rb=new Array(xb);function Eb(t,e,i,n,s){this.static_tree=t,this.extra_bits=e,this.extra_base=i,this.elems=n,this.max_length=s,this.has_stree=t&&t.length}let Vb,Mb,Db;function Wb(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}vb(Rb);const Ub=t=>t<256?Zb[t]:Zb[256+(t>>>7)],Yb=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},qb=(t,e,i)=>{t.bi_valid>16-i?(t.bi_buf|=e<>16-t.bi_valid,t.bi_valid+=i-16):(t.bi_buf|=e<{qb(t,i[2*e],i[2*e+1])},zb=(t,e)=>{let i=0;do{i|=1&t,t>>>=1,i<<=1}while(--e>0);return i>>>1},Ib=(t,e,i)=>{const n=new Array(16);let s,r,o=0;for(s=1;s<=kb;s++)o=o+i[s-1]<<1,n[s]=o;for(r=0;r<=e;r++){let e=t[2*r+1];0!==e&&(t[2*r]=zb(n[e]++,e))}},Bb=t=>{let e;for(e=0;e{t.bi_valid>8?Yb(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},Nb=(t,e,i,n)=>{const s=2*e,r=2*i;return t[s]{const n=t.heap[i];let s=i<<1;for(;s<=t.heap_len&&(s{let n,s,r,o,a=0;if(0!==t.sym_next)do{n=255&t.pending_buf[t.sym_buf+a++],n+=(255&t.pending_buf[t.sym_buf+a++])<<8,s=t.pending_buf[t.sym_buf+a++],0===n?Lb(t,s,e):(r=Ab[s],Lb(t,r+yb+1,e),o=Qb[r],0!==o&&(s-=Tb[r],qb(t,s,o)),n--,r=Ub(n),Lb(t,r,i),o=$b[r],0!==o&&(n-=Rb[r],qb(t,n,o)))}while(a{const i=e.dyn_tree,n=e.stat_desc.static_tree,s=e.stat_desc.has_stree,r=e.stat_desc.elems;let o,a,l,h=-1;for(t.heap_len=0,t.heap_max=573,o=0;o>1;o>=1;o--)Gb(t,i,o);l=r;do{o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Gb(t,i,1),a=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=a,i[2*l]=i[2*o]+i[2*a],t.depth[l]=(t.depth[o]>=t.depth[a]?t.depth[o]:t.depth[a])+1,i[2*o+1]=i[2*a+1]=l,t.heap[1]=l++,Gb(t,i,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const i=e.dyn_tree,n=e.max_code,s=e.stat_desc.static_tree,r=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,l=e.stat_desc.max_length;let h,c,u,d,f,p,O=0;for(d=0;d<=kb;d++)t.bl_count[d]=0;for(i[2*t.heap[t.heap_max]+1]=0,h=t.heap_max+1;h<573;h++)c=t.heap[h],d=i[2*i[2*c+1]+1]+1,d>l&&(d=l,O++),i[2*c+1]=d,c>n||(t.bl_count[d]++,f=0,c>=a&&(f=o[c-a]),p=i[2*c],t.opt_len+=p*(d+f),r&&(t.static_len+=p*(s[2*c+1]+f)));if(0!==O){do{for(d=l-1;0===t.bl_count[d];)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[l]--,O-=2}while(O>0);for(d=l;0!==d;d--)for(c=t.bl_count[d];0!==c;)u=t.heap[--h],u>n||(i[2*u+1]!==d&&(t.opt_len+=(d-i[2*u+1])*i[2*u],i[2*u+1]=d),c--)}})(t,e),Ib(i,h,t.bl_count)},Jb=(t,e,i)=>{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),e[2*(i+1)+1]=65535,n=0;n<=i;n++)s=o,o=e[2*(n+1)+1],++a{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),n=0;n<=i;n++)if(s=o,o=e[2*(n+1)+1],!(++a{qb(t,0+(n?1:0),3),jb(t),Yb(t,i),Yb(t,~i),i&&t.pending_buf.set(t.window.subarray(e,e+i),t.pending),t.pending+=i};wb._tr_init=t=>{tw||((()=>{let t,e,i,n,s;const r=new Array(16);for(i=0,n=0;n<28;n++)for(Tb[n]=i,t=0;t<1<>=7;n{let s,r,o=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e{let e;for(Jb(t,t.dyn_ltree,t.l_desc.max_code),Jb(t,t.dyn_dtree,t.d_desc.max_code),Hb(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*Cb[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=i+5,i+4<=s&&-1!==e?ew(t,e,i,n):4===t.strategy||r===s?(qb(t,2+(n?1:0),3),Fb(t,_b,Xb)):(qb(t,4+(n?1:0),3),((t,e,i,n)=>{let s;for(qb(t,e-257,5),qb(t,i-1,5),qb(t,n-4,4),s=0;s(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=i,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(Ab[i]+yb+1)]++,t.dyn_dtree[2*Ub(e)]++),t.sym_next===t.sym_end),wb._tr_align=t=>{qb(t,2,3),Lb(t,256,_b),(t=>{16===t.bi_valid?(Yb(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)};var iw=(t,e,i,n)=>{let s=65535&t|0,r=t>>>16&65535|0,o=0;for(;0!==i;){o=i>2e3?2e3:i,i-=o;do{s=s+e[n++]|0,r=r+s|0}while(--o);s%=65521,r%=65521}return s|r<<16|0};const nw=new Uint32Array((()=>{let t,e=[];for(var i=0;i<256;i++){t=i;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e})());var sw=(t,e,i,n)=>{const s=nw,r=n+i;t^=-1;for(let i=n;i>>8^s[255&(t^e[i])];return-1^t},rw={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},ow={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:aw,_tr_stored_block:lw,_tr_flush_block:hw,_tr_tally:cw,_tr_align:uw}=wb,dw=iw,fw=sw,pw=rw,{Z_NO_FLUSH:Ow,Z_PARTIAL_FLUSH:gw,Z_FULL_FLUSH:mw,Z_FINISH:bw,Z_BLOCK:ww,Z_OK:vw,Z_STREAM_END:yw,Z_STREAM_ERROR:Sw,Z_DATA_ERROR:xw,Z_BUF_ERROR:kw,Z_DEFAULT_COMPRESSION:Qw,Z_FILTERED:$w,Z_HUFFMAN_ONLY:Pw,Z_RLE:Cw,Z_FIXED:_w,Z_DEFAULT_STRATEGY:Xw,Z_UNKNOWN:Zw,Z_DEFLATED:Aw}=ow,Tw=258,Rw=262,Ew=42,Vw=113,Mw=666,Dw=(t,e)=>(t.msg=pw[e],e),Ww=t=>2*t-(t>4?9:0),Uw=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Yw=t=>{let e,i,n,s=t.w_size;e=t.hash_size,n=e;do{i=t.head[--n],t.head[n]=i>=s?i-s:0}while(--e);e=s,n=e;do{i=t.prev[--n],t.prev[n]=i>=s?i-s:0}while(--e)};let qw=(t,e,i)=>(e<{const e=t.state;let i=e.pending;i>t.avail_out&&(i=t.avail_out),0!==i&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+i),t.next_out),t.next_out+=i,e.pending_out+=i,t.total_out+=i,t.avail_out-=i,e.pending-=i,0===e.pending&&(e.pending_out=0))},zw=(t,e)=>{hw(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Lw(t.strm)},Iw=(t,e)=>{t.pending_buf[t.pending++]=e},Bw=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},jw=(t,e,i,n)=>{let s=t.avail_in;return s>n&&(s=n),0===s?0:(t.avail_in-=s,e.set(t.input.subarray(t.next_in,t.next_in+s),i),1===t.state.wrap?t.adler=dw(t.adler,e,s,i):2===t.state.wrap&&(t.adler=fw(t.adler,e,s,i)),t.next_in+=s,t.total_in+=s,s)},Nw=(t,e)=>{let i,n,s=t.max_chain_length,r=t.strstart,o=t.prev_length,a=t.nice_match;const l=t.strstart>t.w_size-Rw?t.strstart-(t.w_size-Rw):0,h=t.window,c=t.w_mask,u=t.prev,d=t.strstart+Tw;let f=h[r+o-1],p=h[r+o];t.prev_length>=t.good_match&&(s>>=2),a>t.lookahead&&(a=t.lookahead);do{if(i=e,h[i+o]===p&&h[i+o-1]===f&&h[i]===h[r]&&h[++i]===h[r+1]){r+=2,i++;do{}while(h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&ro){if(t.match_start=e,o=n,n>=a)break;f=h[r+o-1],p=h[r+o]}}}while((e=u[e&c])>l&&0!=--s);return o<=t.lookahead?o:t.lookahead},Gw=t=>{const e=t.w_size;let i,n,s;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Rw)&&(t.window.set(t.window.subarray(e,e+e-n),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Yw(t),n+=e),0===t.strm.avail_in)break;if(i=jw(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=i,t.lookahead+t.insert>=3)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=qw(t,t.ins_h,t.window[s+1]);t.insert&&(t.ins_h=qw(t,t.ins_h,t.window[s+3-1]),t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead{let i,n,s,r=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,o=0,a=t.strm.avail_in;do{if(i=65535,s=t.bi_valid+42>>3,t.strm.avail_outn+t.strm.avail_in&&(i=n+t.strm.avail_in),i>s&&(i=s),i>8,t.pending_buf[t.pending-2]=~i,t.pending_buf[t.pending-1]=~i>>8,Lw(t.strm),n&&(n>i&&(n=i),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+n),t.strm.next_out),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n,t.block_start+=n,i-=n),i&&(jw(t.strm,t.strm.output,t.strm.next_out,i),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i)}while(0===o);return a-=t.strm.avail_in,a&&(a>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=a&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-a,t.strm.next_in),t.strstart),t.strstart+=a,t.insert+=a>t.w_size-t.insert?t.w_size-t.insert:a),t.block_start=t.strstart),t.high_waters&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,s+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),s>t.strm.avail_in&&(s=t.strm.avail_in),s&&(jw(t.strm,t.window,t.strstart,s),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.high_water>3,s=t.pending_buf_size-s>65535?65535:t.pending_buf_size-s,r=s>t.w_size?t.w_size:s,n=t.strstart-t.block_start,(n>=r||(n||e===bw)&&e!==Ow&&0===t.strm.avail_in&&n<=s)&&(i=n>s?s:n,o=e===bw&&0===t.strm.avail_in&&i===n?1:0,lw(t,t.block_start,i,o),t.block_start+=i,Lw(t.strm)),o?3:1)},Hw=(t,e)=>{let i,n;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==i&&t.strstart-i<=t.w_size-Rw&&(t.match_length=Nw(t,i)),t.match_length>=3)if(n=cw(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=qw(t,t.ins_h,t.window[t.strstart+1]);else n=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2},Jw=(t,e)=>{let i,n,s;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==i&&t.prev_length4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){s=t.strstart+t.lookahead-3,n=cw(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=s&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(zw(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(n=cw(t,0,t.window[t.strstart-1]),n&&zw(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=cw(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2};function Kw(t,e,i,n,s){this.good_length=t,this.max_lazy=e,this.nice_length=i,this.max_chain=n,this.func=s}const tv=[new Kw(0,0,0,0,Fw),new Kw(4,4,8,4,Hw),new Kw(4,5,16,8,Hw),new Kw(4,6,32,32,Hw),new Kw(4,4,16,16,Jw),new Kw(8,16,32,32,Jw),new Kw(8,16,128,128,Jw),new Kw(8,32,128,256,Jw),new Kw(32,128,258,1024,Jw),new Kw(32,258,258,4096,Jw)];function ev(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Aw,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Uw(this.dyn_ltree),Uw(this.dyn_dtree),Uw(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Uw(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Uw(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const iv=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==Ew&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==Vw&&e.status!==Mw?1:0},nv=t=>{if(iv(t))return Dw(t,Sw);t.total_in=t.total_out=0,t.data_type=Zw;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?Ew:Vw,t.adler=2===e.wrap?0:1,e.last_flush=-2,aw(e),vw},sv=t=>{const e=nv(t);var i;return e===vw&&((i=t.state).window_size=2*i.w_size,Uw(i.head),i.max_lazy_match=tv[i.level].max_lazy,i.good_match=tv[i.level].good_length,i.nice_match=tv[i.level].nice_length,i.max_chain_length=tv[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=2,i.match_available=0,i.ins_h=0),e},rv=(t,e,i,n,s,r)=>{if(!t)return Sw;let o=1;if(e===Qw&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),s<1||s>9||i!==Aw||n<8||n>15||e<0||e>9||r<0||r>_w||8===n&&1!==o)return Dw(t,Sw);8===n&&(n=9);const a=new ev;return t.state=a,a.strm=t,a.status=Ew,a.wrap=o,a.gzhead=null,a.w_bits=n,a.w_size=1<rv(t,e,Aw,15,8,Xw),bb.deflateInit2=rv,bb.deflateReset=sv,bb.deflateResetKeep=nv,bb.deflateSetHeader=(t,e)=>iv(t)||2!==t.state.wrap?Sw:(t.state.gzhead=e,vw),bb.deflate=(t,e)=>{if(iv(t)||e>ww||e<0)return t?Dw(t,Sw):Sw;const i=t.state;if(!t.output||0!==t.avail_in&&!t.input||i.status===Mw&&e!==bw)return Dw(t,0===t.avail_out?kw:Sw);const n=i.last_flush;if(i.last_flush=e,0!==i.pending){if(Lw(t),0===t.avail_out)return i.last_flush=-1,vw}else if(0===t.avail_in&&Ww(e)<=Ww(n)&&e!==bw)return Dw(t,kw);if(i.status===Mw&&0!==t.avail_in)return Dw(t,kw);if(i.status===Ew&&0===i.wrap&&(i.status=Vw),i.status===Ew){let e=Aw+(i.w_bits-8<<4)<<8,n=-1;if(n=i.strategy>=Pw||i.level<2?0:i.level<6?1:6===i.level?2:3,e|=n<<6,0!==i.strstart&&(e|=32),e+=31-e%31,Bw(i,e),0!==i.strstart&&(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),t.adler=1,i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(57===i.status)if(t.adler=0,Iw(i,31),Iw(i,139),Iw(i,8),i.gzhead)Iw(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),Iw(i,255&i.gzhead.time),Iw(i,i.gzhead.time>>8&255),Iw(i,i.gzhead.time>>16&255),Iw(i,i.gzhead.time>>24&255),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(Iw(i,255&i.gzhead.extra.length),Iw(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=fw(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if(Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,3),i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw;if(69===i.status){if(i.gzhead.extra){let e=i.pending,n=(65535&i.gzhead.extra.length)-i.gzindex;for(;i.pending+n>i.pending_buf_size;){let s=i.pending_buf_size-i.pending;if(i.pending_buf.set(i.gzhead.extra.subarray(i.gzindex,i.gzindex+s),i.pending),i.pending=i.pending_buf_size,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex+=s,Lw(t),0!==i.pending)return i.last_flush=-1,vw;e=0,n-=s}let s=new Uint8Array(i.gzhead.extra);i.pending_buf.set(s.subarray(i.gzindex,i.gzindex+n),i.pending),i.pending+=n,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex=0}i.status=73}if(73===i.status){if(i.gzhead.name){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),i.gzindex=0}i.status=91}if(91===i.status){if(i.gzhead.comment){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n))}i.status=103}if(103===i.status){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size&&(Lw(t),0!==i.pending))return i.last_flush=-1,vw;Iw(i,255&t.adler),Iw(i,t.adler>>8&255),t.adler=0}if(i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(0!==t.avail_in||0!==i.lookahead||e!==Ow&&i.status!==Mw){let n=0===i.level?Fw(i,e):i.strategy===Pw?((t,e)=>{let i;for(;;){if(0===t.lookahead&&(Gw(t),0===t.lookahead)){if(e===Ow)return 1;break}if(t.match_length=0,i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):i.strategy===Cw?((t,e)=>{let i,n,s,r;const o=t.window;for(;;){if(t.lookahead<=Tw){if(Gw(t),t.lookahead<=Tw&&e===Ow)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(s=t.strstart-1,n=o[s],n===o[++s]&&n===o[++s]&&n===o[++s])){r=t.strstart+Tw;do{}while(n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&st.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(i=cw(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):tv[i.level].func(i,e);if(3!==n&&4!==n||(i.status=Mw),1===n||3===n)return 0===t.avail_out&&(i.last_flush=-1),vw;if(2===n&&(e===gw?uw(i):e!==ww&&(lw(i,0,0,!1),e===mw&&(Uw(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),Lw(t),0===t.avail_out))return i.last_flush=-1,vw}return e!==bw?vw:i.wrap<=0?yw:(2===i.wrap?(Iw(i,255&t.adler),Iw(i,t.adler>>8&255),Iw(i,t.adler>>16&255),Iw(i,t.adler>>24&255),Iw(i,255&t.total_in),Iw(i,t.total_in>>8&255),Iw(i,t.total_in>>16&255),Iw(i,t.total_in>>24&255)):(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),Lw(t),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?vw:yw)},bb.deflateEnd=t=>{if(iv(t))return Sw;const e=t.state.status;return t.state=null,e===Vw?Dw(t,xw):vw},bb.deflateSetDictionary=(t,e)=>{let i=e.length;if(iv(t))return Sw;const n=t.state,s=n.wrap;if(2===s||1===s&&n.status!==Ew||n.lookahead)return Sw;if(1===s&&(t.adler=dw(t.adler,e,i,0)),n.wrap=0,i>=n.w_size){0===s&&(Uw(n.head),n.strstart=0,n.block_start=0,n.insert=0);let t=new Uint8Array(n.w_size);t.set(e.subarray(i-n.w_size,i),0),e=t,i=n.w_size}const r=t.avail_in,o=t.next_in,a=t.input;for(t.avail_in=i,t.next_in=0,t.input=e,Gw(n);n.lookahead>=3;){let t=n.strstart,e=n.lookahead-2;do{n.ins_h=qw(n,n.ins_h,n.window[t+3-1]),n.prev[t&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=t,t++}while(--e);n.strstart=t,n.lookahead=2,Gw(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,t.next_in=o,t.input=a,t.avail_in=r,n.wrap=s,vw},bb.deflateInfo="pako deflate (from Nodeca project)";var ov={};const av=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);ov.assign=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const e in i)av(i,e)&&(t[e]=i[e])}}return t},ov.flattenChunks=t=>{let e=0;for(let i=0,n=t.length;i=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;cv[254]=cv[254]=1,lv.string2buf=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,i,n,s,r,o=t.length,a=0;for(s=0;s>>6,e[r++]=128|63&i):i<65536?(e[r++]=224|i>>>12,e[r++]=128|i>>>6&63,e[r++]=128|63&i):(e[r++]=240|i>>>18,e[r++]=128|i>>>12&63,e[r++]=128|i>>>6&63,e[r++]=128|63&i);return e};lv.buf2string=(t,e)=>{const i=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let n,s;const r=new Array(2*i);for(s=0,n=0;n4)r[s++]=65533,n+=o-1;else{for(e&=2===o?31:3===o?15:7;o>1&&n1?r[s++]=65533:e<65536?r[s++]=e:(e-=65536,r[s++]=55296|e>>10&1023,r[s++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&hv)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let i="";for(let n=0;n{(e=e||t.length)>t.length&&(e=t.length);let i=e-1;for(;i>=0&&128==(192&t[i]);)i--;return i<0||0===i?e:i+cv[t[i]]>e?i:e};var uv=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const dv=bb,fv=ov,pv=lv,Ov=rw,gv=uv,mv=Object.prototype.toString,{Z_NO_FLUSH:bv,Z_SYNC_FLUSH:wv,Z_FULL_FLUSH:vv,Z_FINISH:yv,Z_OK:Sv,Z_STREAM_END:xv,Z_DEFAULT_COMPRESSION:kv,Z_DEFAULT_STRATEGY:Qv,Z_DEFLATED:$v}=ow;function Pv(t){this.options=fv.assign({level:kv,method:$v,chunkSize:16384,windowBits:15,memLevel:8,strategy:Qv},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new gv,this.strm.avail_out=0;let i=dv.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(i!==Sv)throw new Error(Ov[i]);if(e.header&&dv.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?pv.string2buf(e.dictionary):"[object ArrayBuffer]"===mv.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,i=dv.deflateSetDictionary(this.strm,t),i!==Sv)throw new Error(Ov[i]);this._dict_set=!0}}function Cv(t,e){const i=new Pv(e);if(i.push(t,!0),i.err)throw i.msg||Ov[i.err];return i.result}Pv.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize;let s,r;if(this.ended)return!1;for(r=e===~~e?e:!0===e?yv:bv,"string"==typeof t?i.input=pv.string2buf(t):"[object ArrayBuffer]"===mv.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),(r===wv||r===vv)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(s=dv.deflate(i,r),s===xv)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),s=dv.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===Sv;if(0!==i.avail_out){if(r>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},Pv.prototype.onData=function(t){this.chunks.push(t)},Pv.prototype.onEnd=function(t){t===Sv&&(this.result=fv.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},mb.Deflate=Pv,mb.deflate=Cv,mb.deflateRaw=function(t,e){return(e=e||{}).raw=!0,Cv(t,e)},mb.gzip=function(t,e){return(e=e||{}).gzip=!0,Cv(t,e)},mb.constants=ow;var _v={},Xv={};const Zv=16209;const Av=15,Tv=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Rv=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Ev=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Vv=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Mv=(t,e,i,n,s,r,o,a)=>{const l=a.bits;let h,c,u,d,f,p,O=0,g=0,m=0,b=0,w=0,v=0,y=0,S=0,x=0,k=0,Q=null;const $=new Uint16Array(16),P=new Uint16Array(16);let C,_,X,Z=null;for(O=0;O<=Av;O++)$[O]=0;for(g=0;g=1&&0===$[b];b--);if(w>b&&(w=b),0===b)return s[r++]=20971520,s[r++]=20971520,a.bits=1,0;for(m=1;m0&&(0===t||1!==b))return-1;for(P[1]=0,O=1;O852||2===t&&x>592)return 1;for(;;){C=O-y,o[g]+1=p?(_=Z[o[g]-p],X=Q[o[g]-p]):(_=96,X=0),h=1<>y)+c]=C<<24|_<<16|X|0}while(0!==c);for(h=1<>=1;if(0!==h?(k&=h-1,k+=h):k=0,g++,0==--$[O]){if(O===b)break;O=e[i+o[g]]}if(O>w&&(k&d)!==u){for(0===y&&(y=w),f+=m,v=O-y,S=1<852||2===t&&x>592)return 1;u=k&d,s[u]=w<<24|v<<16|f-r|0}}return 0!==k&&(s[f+k]=O-y<<24|64<<16|0),a.bits=w,0};const Dv=iw,Wv=sw,Uv=function(t,e){let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,y,S,x,k,Q;const $=t.state;i=t.next_in,k=t.input,n=i+(t.avail_in-5),s=t.next_out,Q=t.output,r=s-(e-t.avail_out),o=s+(t.avail_out-257),a=$.dmax,l=$.wsize,h=$.whave,c=$.wnext,u=$.window,d=$.hold,f=$.bits,p=$.lencode,O=$.distcode,g=(1<<$.lenbits)-1,m=(1<<$.distbits)-1;t:do{f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,0===w)Q[s++]=65535&b;else{if(!(16&w)){if(0==(64&w)){b=p[(65535&b)+(d&(1<>>=w,f-=w),f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,!(16&w)){if(0==(64&w)){b=O[(65535&b)+(d&(1<a){t.msg="invalid distance too far back",$.mode=Zv;break t}if(d>>>=w,f-=w,w=s-r,y>w){if(w=y-w,w>h&&$.sane){t.msg="invalid distance too far back",$.mode=Zv;break t}if(S=0,x=u,0===c){if(S+=l-w,w2;)Q[s++]=x[S++],Q[s++]=x[S++],Q[s++]=x[S++],v-=3;v&&(Q[s++]=x[S++],v>1&&(Q[s++]=x[S++]))}else{S=s-y;do{Q[s++]=Q[S++],Q[s++]=Q[S++],Q[s++]=Q[S++],v-=3}while(v>2);v&&(Q[s++]=Q[S++],v>1&&(Q[s++]=Q[S++]))}break}}break}}while(i>3,i-=v,f-=v<<3,d&=(1<(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function hy(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const cy=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode16211?1:0},uy=t=>{if(cy(t))return Nv;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Kv,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,Iv},dy=t=>{if(cy(t))return Nv;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,uy(t)},fy=(t,e)=>{let i;if(cy(t))return Nv;const n=t.state;return e<0?(i=0,e=-e):(i=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?Nv:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=i,n.wbits=e,dy(t))},py=(t,e)=>{if(!t)return Nv;const i=new hy;t.state=i,i.strm=t,i.window=null,i.mode=Kv;const n=fy(t,e);return n!==Iv&&(t.state=null),n};let Oy,gy,my=!0;const by=t=>{if(my){Oy=new Int32Array(512),gy=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Yv(1,t.lens,0,288,Oy,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Yv(2,t.lens,0,32,gy,0,t.work,{bits:5}),my=!1}t.lencode=Oy,t.lenbits=9,t.distcode=gy,t.distbits=5},wy=(t,e,i,n)=>{let s;const r=t.state;return null===r.window&&(r.wsize=1<=r.wsize?(r.window.set(e.subarray(i-r.wsize,i),0),r.wnext=0,r.whave=r.wsize):(s=r.wsize-r.wnext,s>n&&(s=n),r.window.set(e.subarray(i-n,i-n+s),r.wnext),(n-=s)?(r.window.set(e.subarray(i-n,i),0),r.wnext=n,r.whave=r.wsize):(r.wnext+=s,r.wnext===r.wsize&&(r.wnext=0),r.whavepy(t,15),Xv.inflateInit2=py,Xv.inflate=(t,e)=>{let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,y,S,x,k=0;const Q=new Uint8Array(4);let $,P;const C=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(cy(t)||!t.output||!t.input&&0!==t.avail_in)return Nv;i=t.state,i.mode===ey&&(i.mode=iy),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,u=a,d=l,x=Iv;t:for(;;)switch(i.mode){case Kv:if(0===i.wrap){i.mode=iy;break}for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0),h=0,c=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",i.mode=ay;break}if((15&h)!==Jv){t.msg="unknown compression method",i.mode=ay;break}if(h>>>=4,c-=4,S=8+(15&h),0===i.wbits&&(i.wbits=S),S>15||S>i.wbits){t.msg="invalid window size",i.mode=ay;break}i.dmax=1<>8&1),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16182;case 16182:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>8&255,Q[2]=h>>>16&255,Q[3]=h>>>24&255,i.check=Wv(i.check,Q,4,0)),h=0,c=0,i.mode=16183;case 16183:for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>8),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16184;case 16184:if(1024&i.flags){for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(f=i.length,f>a&&(f=a),f&&(i.head&&(S=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(n.subarray(r,r+f),S)),512&i.flags&&4&i.wrap&&(i.check=Wv(i.check,n,f,r)),a-=f,r+=f,i.length-=f),i.length))break t;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===a)break t;f=0;do{S=n[r+f++],i.head&&S&&i.length<65536&&(i.head.name+=String.fromCharCode(S))}while(S&&f>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=ey;break;case 16189:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>=7&c,c-=7&c,i.mode=oy;break}for(;c<3;){if(0===a)break t;a--,h+=n[r++]<>>=1,c-=1,3&h){case 0:i.mode=16193;break;case 1:if(by(i),i.mode=sy,e===zv){h>>>=2,c-=2;break t}break;case 2:i.mode=16196;break;case 3:t.msg="invalid block type",i.mode=ay}h>>>=2,c-=2;break;case 16193:for(h>>>=7&c,c-=7&c;c<32;){if(0===a)break t;a--,h+=n[r++]<>>16^65535)){t.msg="invalid stored block lengths",i.mode=ay;break}if(i.length=65535&h,h=0,c=0,i.mode=ny,e===zv)break t;case ny:i.mode=16195;case 16195:if(f=i.length,f){if(f>a&&(f=a),f>l&&(f=l),0===f)break t;s.set(n.subarray(r,r+f),o),a-=f,r+=f,l-=f,o+=f,i.length-=f;break}i.mode=ey;break;case 16196:for(;c<14;){if(0===a)break t;a--,h+=n[r++]<>>=5,c-=5,i.ndist=1+(31&h),h>>>=5,c-=5,i.ncode=4+(15&h),h>>>=4,c-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=ay;break}i.have=0,i.mode=16197;case 16197:for(;i.have>>=3,c-=3}for(;i.have<19;)i.lens[C[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,$={bits:i.lenbits},x=Yv(0,i.lens,0,19,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid code lengths set",i.mode=ay;break}i.have=0,i.mode=16198;case 16198:for(;i.have>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=g,c-=g,i.lens[i.have++]=b;else{if(16===b){for(P=g+2;c>>=g,c-=g,0===i.have){t.msg="invalid bit length repeat",i.mode=ay;break}S=i.lens[i.have-1],f=3+(3&h),h>>>=2,c-=2}else if(17===b){for(P=g+3;c>>=g,c-=g,S=0,f=3+(7&h),h>>>=3,c-=3}else{for(P=g+7;c>>=g,c-=g,S=0,f=11+(127&h),h>>>=7,c-=7}if(i.have+f>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=ay;break}for(;f--;)i.lens[i.have++]=S}}if(i.mode===ay)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=ay;break}if(i.lenbits=9,$={bits:i.lenbits},x=Yv(1,i.lens,0,i.nlen,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid literal/lengths set",i.mode=ay;break}if(i.distbits=6,i.distcode=i.distdyn,$={bits:i.distbits},x=Yv(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,$),i.distbits=$.bits,x){t.msg="invalid distances set",i.mode=ay;break}if(i.mode=sy,e===zv)break t;case sy:i.mode=ry;case ry:if(a>=6&&l>=258){t.next_out=o,t.avail_out=l,t.next_in=r,t.avail_in=a,i.hold=h,i.bits=c,Uv(t,d),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,i.mode===ey&&(i.back=-1);break}for(i.back=0;k=i.lencode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,i.length=b,0===m){i.mode=16205;break}if(32&m){i.back=-1,i.mode=ey;break}if(64&m){t.msg="invalid literal/length code",i.mode=ay;break}i.extra=15&m,i.mode=16201;case 16201:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;k=i.distcode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,64&m){t.msg="invalid distance code",i.mode=ay;break}i.offset=b,i.extra=15&m,i.mode=16203;case 16203:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=ay;break}i.mode=16204;case 16204:if(0===l)break t;if(f=d-l,i.offset>f){if(f=i.offset-f,f>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=ay;break}f>i.wnext?(f-=i.wnext,p=i.wsize-f):p=i.wnext-f,f>i.length&&(f=i.length),O=i.window}else O=s,p=o-i.offset,f=i.length;f>l&&(f=l),l-=f,i.length-=f;do{s[o++]=O[p++]}while(--f);0===i.length&&(i.mode=ry);break;case 16205:if(0===l)break t;s[o++]=i.length,l--,i.mode=ry;break;case oy:if(i.wrap){for(;c<32;){if(0===a)break t;a--,h|=n[r++]<{if(cy(t))return Nv;let e=t.state;return e.window&&(e.window=null),t.state=null,Iv},Xv.inflateGetHeader=(t,e)=>{if(cy(t))return Nv;const i=t.state;return 0==(2&i.wrap)?Nv:(i.head=e,e.done=!1,Iv)},Xv.inflateSetDictionary=(t,e)=>{const i=e.length;let n,s,r;return cy(t)?Nv:(n=t.state,0!==n.wrap&&n.mode!==ty?Nv:n.mode===ty&&(s=1,s=Dv(s,e,i,0),s!==n.check)?Gv:(r=wy(t,e,i,i),r?(n.mode=16210,Fv):(n.havedict=1,Iv)))},Xv.inflateInfo="pako inflate (from Nodeca project)";const vy=Xv,yy=ov,Sy=lv,xy=rw,ky=uv,Qy=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},$y=Object.prototype.toString,{Z_NO_FLUSH:Py,Z_FINISH:Cy,Z_OK:_y,Z_STREAM_END:Xy,Z_NEED_DICT:Zy,Z_STREAM_ERROR:Ay,Z_DATA_ERROR:Ty,Z_MEM_ERROR:Ry}=ow;function Ey(t){this.options=yy.assign({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ky,this.strm.avail_out=0;let i=vy.inflateInit2(this.strm,e.windowBits);if(i!==_y)throw new Error(xy[i]);if(this.header=new Qy,vy.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=Sy.string2buf(e.dictionary):"[object ArrayBuffer]"===$y.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(i=vy.inflateSetDictionary(this.strm,e.dictionary),i!==_y)))throw new Error(xy[i])}function Vy(t,e){const i=new Ey(e);if(i.push(t),i.err)throw i.msg||xy[i.err];return i.result}Ey.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize,s=this.options.dictionary;let r,o,a;if(this.ended)return!1;for(o=e===~~e?e:!0===e?Cy:Py,"[object ArrayBuffer]"===$y.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),r=vy.inflate(i,o),r===Zy&&s&&(r=vy.inflateSetDictionary(i,s),r===_y?r=vy.inflate(i,o):r===Ty&&(r=Zy));i.avail_in>0&&r===Xy&&i.state.wrap>0&&0!==t[i.next_in];)vy.inflateReset(i),r=vy.inflate(i,o);switch(r){case Ay:case Ty:case Zy:case Ry:return this.onEnd(r),this.ended=!0,!1}if(a=i.avail_out,i.next_out&&(0===i.avail_out||r===Xy))if("string"===this.options.to){let t=Sy.utf8border(i.output,i.next_out),e=i.next_out-t,s=Sy.buf2string(i.output,t);i.next_out=e,i.avail_out=n-e,e&&i.output.set(i.output.subarray(t,t+e),0),this.onData(s)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(r!==_y||0!==a){if(r===Xy)return r=vy.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},Ey.prototype.onData=function(t){this.chunks.push(t)},Ey.prototype.onEnd=function(t){t===_y&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=yy.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},_v.Inflate=Ey,_v.inflate=Vy,_v.inflateRaw=function(t,e){return(e=e||{}).raw=!0,Vy(t,e)},_v.ungzip=Vy,_v.constants=ow;const{Deflate:My,deflate:Dy,deflateRaw:Wy,gzip:Uy}=mb,{Inflate:Yy,inflate:qy,inflateRaw:Ly,ungzip:zy}=_v,Iy=ow;gb.Deflate=My,gb.deflate=Dy,gb.deflateRaw=Wy,gb.gzip=Uy,gb.Inflate=Yy,gb.inflate=qy,gb.inflateRaw=Ly,gb.ungzip=zy,gb.constants=Iy;const By=gb;let jy={};var Ny;function Gy(t){return Ny=t,[tS]}jy.Util={},jy.Decode={},jy.Messages=[],jy.Log=function(t){jy.Messages.push(["I",t]),console.log("Mma.js INFO: ",t)},jy.Warn=function(t){jy.Messages.push(["W",t]),console.log("Mma.js WARNING: ",t)},jy.Fail=function(t){throw jy.Messages.push(["E",t]),"Mma.js ERROR: "+t},jy.Util.Base64Decode=function(t){for(var e=atob(t),i=e.length>>>0,n=new Uint8Array(i),s=0;s1&&0===t[0]&&jy.Fail("IntegerAP: input starts with 0: "+String(t)),this.nstring=t}else void 0===t?this.nstring=void 0:jy.Fail("Integer: invalid input: "+String(t))},jy.RealMP=function(t){"number"==typeof t?this.n=t:void 0===t?this.n=void 0:jy.Fail("RealMP: invalid input")},jy.RealAP=function(t){"string"==typeof t?(t.length>1&&0===t[0]&&jy.Fail("RealAP: input starts with 0: "+String(t)),this.nstring=t):void 0===t?this.nstring=void 0:jy.Fail("RealAP: invalid input: "+String(t))},jy.Symbol=function(t){"string"==typeof t?this.name=t:void 0===t?this.name=void 0:jy.Fail("Symbol: invalid input: "+String(t))},jy.String=function(t){"string"==typeof t?this.str=t:void 0===t?this.str=void 0:jy.Fail("String: invalid input: "+String(t))},jy.Expression=function(t,e){t instanceof jy.Symbol||jy.Fail("Expression: head must be an Mma.Symbol"),e instanceof Array||jy.Fail("Expression: parts must be an Array"),this.head=t,this.parts=e},jy.Decode.Int32=function(t,e){try{return new DataView(t.buffer).getInt32(e,!0)}catch(t){return 0}},jy.Decode.Float64=function(t,e){try{return new DataView(t.buffer).getFloat64(e,!0)}catch(t){return 0}},jy.Decode.String=function(t,e,i){return void 0===e&&(e=0),void 0===i&&(i=t.length),jy.Util.U8ArrayToString(t.slice(e,e+i))},jy.Decode.StringEntry=function(t,e){void 0===e&&(e=0);var i=jy.Decode.Int32(t,e);return{length:i,string:jy.Decode.String(t,e+4,i),bytesRead:i+4}},jy.Decode.Any=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=1/0);var n=e;for(var s=0,r=[];ee%2!=0?t:{...t,body:Lm(t.body,/\(\*\|\*\)/gm)})),Array.isArray(this.args[this.args.length-1].body)||(this.decorator=this.args.pop());const r=this.args;console.log("creating InstanceWidget");for(let t=0;t{e.viewState.state.config.eval()},update:e=>this.applyChanges(e,t,i),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to&&!t.stringOnly)return i-2>=0?(o[i-2].editor.dispatch({selection:{anchor:o[i-2].editor.state.doc.length}}),o[i-2].editor.focus(),void(t.editorLastCursor=void 0)):(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0));t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to&&!t.stringOnly)return i+2=0)return r[t-2].body[i].editor.focus(),void(e.editorLastCursor=void 0)}},{key:"ArrowDown",run:function(e,n){if(t+2{},focus:()=>{},dispatch:()=>{},stringOnly:!0};const t=l.match(Fy);if(t){a.innerHTML=t[1];const e=jy.DecompressDecode(t[2]),i=jy.toArray(e.parts[0]),n=uuidv4();interpretate(i,{global:{call:n},element:a})}else a.innerHTML=l.slice(1,-1)}delete o[i].body,n.appendChild(a)}i.appendChild(n)}if(this.decorator){const t=jy.DecompressDecode(this.decorator.body.slice(2,-2)),e=jy.toArray(t.parts[0]);let n={global:{call:uuidv4(),EditorWidget:s},element:i};this.interpretated=interpretate(e,n)}}applyChanges(t,e,i){const n=this.args,s=this.args[e].body,r=this.visibleValue.argsPos,o=this.args[e].from;let a=t;0==i&&0==e&&(a="{{"+a),0==i&&0!=e&&(a="{"+a),i==s.length-1&&e==n.length-1&&(a+="}}"),i==s.length-1&&e!=n.length-1&&(a+="}");const l=s[i].length,h={from:r+o+s[i].from,to:r+o+s[i].from+l,insert:a},c=a.length-l;for(let t=i+1;t{s.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.args[0].body[0].editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.args[0].body[0].editor.focus();else{const t=this.DOMElement.EditorWidget.args,e=t[t.length-1].body[t[t.length-1].body.length-1].editor;e.dispatch({selection:{anchor:e.state.doc.length}}),e.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const Ky=(t,e)=>new Bm({tag:"GB",decoration:i=>ni.replace({widget:new Jy(i,t,e)})}),tS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=Ky(this.disposable,t).createDeco(t)}update(t){this.placeholder=Ky(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});function eS(t){return[rS]}let iS=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.span=i,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this,r=this.args[1].body.slice(3,-3),o=jy.DecompressDecode(r),a=jy.toArray(o.parts[0]);this.data=a;const l="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}));this.cuid=l;let h={call:l,EditorWidget:s},c={global:h,element:i};this.expression=a,this.env=c,this.interpretated=interpretate(a,c),this.interpretated.then((()=>{if(c.options?.Event){console.warn("Event listeners are enabled!"),s.events=c.options.Event;let t=c;if(h.stack){const e=Object.values(h.stack);e.length>0&&(console.log("Attaching first found instance..."),t=e[0].env)}interpretate(["MetaMarker","'"+l+"'"],t).then((()=>{server.kernel.emitt(s.events,'"'+l+'"',"Mounted")}))}}))}getDoc(){return this.args[0].body.slice(1,-1)}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+t+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].length=s.length,this.view.dispatch({changes:r})}applyOuterChanges(t){const e=this.visibleValue,i=t,n={from:e.pos,to:e.pos+e.length,insert:i};this.view.dispatch({changes:n})}update(t){if(!this.deactivated){if(t.str!=this.visibleValue.str){console.warn("Out of sync"),console.log("recreate..."),this.destroy();const e=this.span;return e.replaceChildren(),void this._construct(t,this.view,e)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}}destroy(t){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.events&&server.kernel.emitt(this.events,'"'+this.cuid+'"',"Destroy"),delete this.data}},nS=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=this;let i=document.createElement("span");return i.classList.add("frontend-view"),i.EditorWidget=new iS(this.visibleValue,t,i),this.reference.push({destroy:()=>{e.destroy(i)}}),i}ignoreEvent(){return!0}destroy(t){console.log("destroy in general*"),t.EditorWidget.destroy()}};const sS=(t,e)=>new Bm({tag:"VB",decoration:i=>ni.replace({widget:new nS(i,t,e)})}),rS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=sS(this.disposable,t).createDeco(t)}update(t){this.placeholder=sS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var oS;function aS(t){return oS=t,[uS]}let lS=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.span=i,this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this;this.epilog={offset:0,string:""},this.prolog={offset:0,string:""};const r=this.args[1].body.slice(3,-3),o=jy.DecompressDecode(r),a=jy.toArray(o.parts[0]);this.data=a;let l={global:{call:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)})),element:i,origin:s},element:i};this.env=l,interpretate(a,l).then((()=>{if(l.options?.Head&&(s.prolog.offset=l.options.Head.length+1,s.prolog.string=l.options.Head+"[",s.epilog.offset=1,s.epilog.string="]"),l.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=l.options.Event),l.options?.String){s.prolog.offset=1,s.prolog.string='"',s.epilog.offset=1,s.epilog.string='"',l.options?.HeadString&&(s.prolog.string=l.options.HeadString,s.prolog.offset=s.prolog.string.length),l.options?.TailString&&(s.epilog.string=l.options.TailString,s.epilog.offset=s.epilog.string.length),s.editor={destroy:()=>{console.log("Nothing to destroy, this is just a text field.")}};const t=document.createElement("span");return this.aa,t.onkeydown=function(t){13===t.keyCode&&t.preventDefault()},t.contentEditable="plaintext-only",t.innerText=s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),t.addEventListener("input",console.log),t.addEventListener("input",(()=>{console.log("Update"),console.log(t.innerText),this.applyChanges(t.innerText)})),l.global.element.appendChild(t),void(s.events&&server.kernel.emitt(s.events,"Null","Mounted"))}s.editor=oS({doc:s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),parent:l.global.element,update:t=>this.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos+s.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]}),s.events&&server.kernel.emitt(s.events,"Null","Mounted")}))}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+this.prolog.string+t+this.epilog.string+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length));const o=s.length-i[0].length;i[0].length=s.length,this.visibleValue.length=this.visibleValue.length+o,this.view.dispatch({changes:r})}update(t){if(this.visibleValue.str!=t.str)return console.warn("Out of sync"),console.log("recreating InstanceWidget"),this.destroy(),this.span.replaceChildren(),void this._construct(t,this.view,this.span);this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.editor.destroy(),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}},hS=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("subscript-tail"),e.EditorWidget=new lS(this.visibleValue,t,e,[]);const i=this;return this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const cS=(t,e)=>new Bm({tag:"BB",decoration:i=>ni.replace({widget:new hS(i,t,e)})}),uS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=cS(this.disposable,t).createDeco(t)}update(t){this.placeholder=cS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var dS;function fS(t){return dS=t,[mS]}class pS{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm);const s=this,r=Array.from({length:Math.ceil((s.args.length-3)/2)},((t,e)=>2*e+1));s.indexes=r;const o=[];this.span=i,this.spans=o;for(let t=0;t{c.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=c.options.Event),s.editors=r.map(((t,i)=>dS({doc:s.args[t].body,parent:o[i],update:e=>this.applyChanges(e,t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i>0?s.editors[i-1].focus():(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus()),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return it.destroy())),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}}class OS extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("inline-flex"),e.EditorWidget=new pS(this.visibleValue,t,e,[]);const i=this;return this.DOMElement=e,this.reference.push({destroy:()=>{i.destroy(e)}}),e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;const n=this.DOMElement.EditorWidget.editors;return t.from-e.from<0?(n[n.length-1].dispatch({selection:{anchor:n[n.length-1].state.doc.length}}),n[n.length-1].focus()):(n[0].dispatch({selection:{anchor:0}}),n[0].focus()),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}}const gS=(t,e)=>new Bm({tag:"TB",decoration:i=>ni.replace({widget:new OS(i,t,e)})}),mS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=gS(this.disposable,t).createDeco(t)}update(t){this.placeholder=gS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});const bS=_i.fromClass(class{decorations=ni.none;constructor(t){this.view=t,this.recompute()}recompute(t){let e,i,n=[];for(let{from:t,to:e}of this.view.visibleRanges)this.getDecorationsFor(t,e,n);this.decorations=ni.set(n,!0),this.decorations=this.decorations.update({filter:(n,s)=>!(n>e&&s=e&&s.selection.main.head<=i)return!0;if(!n&&s.selection.main.head>e&&s.selection.main.headt.decorations});class wS extends ei{constructor(t,e){super(),this.rawValue=t,this.visibleValue=e}eq(t){return this.rawValue===t.rawValue}toDOM(){let t=document.createElement("div");t.classList.add("cell-type-widget");const e=this.rawValue.split(" "),i=e[0].split(".");if(console.log(i),t.classList.add("cell-type-"+i[1].trim()),t.innerText=e[0].trim(),e.length>1){const n=e.slice(1),s=document.createElement("span");return s.appendChild(t),n.forEach((t=>{const e=document.createElement("span");e.innerText=t,e.classList.add("cell-type-"+i[1].trim()+"-"+t.split("=")[0]),s.appendChild(e)})),s}return t}ignoreEvent(){return!1}}const vS=new F,yS=new F,SS=[],xS=Sl.define([{tag:Sa.meta,color:"var(--editor-key-meta)"},{tag:Sa.link,textDecoration:"underline"},{tag:Sa.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Sa.emphasis,fontStyle:"italic"},{tag:Sa.strong,fontWeight:"bold"},{tag:Sa.strikethrough,textDecoration:"line-through"},{tag:Sa.keyword,color:"var(--editor-key-keyword)"},{tag:[Sa.atom,Sa.bool,Sa.url,Sa.contentSeparator,Sa.labelName],color:"var(--editor-key-atom)"},{tag:[Sa.literal,Sa.inserted],color:"var(--editor-key-literal)"},{tag:[Sa.string,Sa.deleted],color:"var(--editor-key-string)"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],color:"var(--editor-key-escape)"},{tag:Sa.definition(Sa.variableName),color:"var(--editor-key-variable)"},{tag:Sa.local(Sa.variableName),color:"var(--editor-local-variable)"},{tag:[Sa.typeName,Sa.namespace],color:"var(--editor-key-type)"},{tag:Sa.className,color:"var(--editor-key-class)"},{tag:[Sa.special(Sa.variableName),Sa.macroName],color:"var(--editor-special-variable)"},{tag:Sa.definition(Sa.propertyName),color:"var(--editor-key-property)"},{tag:Sa.comment,color:"var(--editor-key-comment)"},{tag:Sa.invalid,color:"var(--editor-key-invalid)"}]),kS={data:[],extend:t=>{kS.data.push(...t),Qm.reBuild(kS.data)},replaceAll:t=>{kS.data=t,Qm.reBuild(kS.data)}},QS=Gl.define({name:"spreadsheet",startState:function(){return{stringType:null,stack:[]}},token:function(t,e){if(t){switch(0===e.stack.length&&('"'!=t.peek()&&"'"!=t.peek()||(e.stringType=t.peek(),t.next(),e.stack.unshift("string"))),e.stack[0]){case"string":for(;"string"===e.stack[0]&&!t.eol();)t.peek()===e.stringType?(t.next(),e.stack.shift()):"\\"===t.peek()?(t.next(),t.next()):t.match(/^.[^\\\"\']*/);return"string";case"characterClass":for(;"characterClass"===e.stack[0]&&!t.eol();)t.match(/^[^\]\\]+/)||t.match(/^\\./)||e.stack.shift();return"operator"}var i=t.peek();switch(i){case"[":return t.next(),e.stack.unshift("characterClass"),"bracket";case":":return t.next(),"operator";case"\\":return t.match(/\\[a-z]+/)?"string.special":(t.next(),"atom");case".":case",":case";":case"*":case"-":case"+":case"^":case"<":case"/":case"=":return t.next(),"atom";case"$":return t.next(),"builtin"}return t.match(/\d+/)?t.match(/^\w+/)?"error":"number":t.match(/^[a-zA-Z_]\w*/)?t.match(/(?=[\(.])/,!1)?"keyword":"variable":-1!=["[","]","(",")","{","}"].indexOf(i)?(t.next(),"bracket"):(t.eatSpace()||t.next(),null)}}}),$S=new RegExp(/^[\w]*\.[\w]+/);function PS(t){const e=$S.exec(t),i=Object.values(window.SupportedLanguages);for(let t=0;t{if(!t.docChanged)return null;let e=PS(t.newDoc.line(1).text);if(e.legacy){const i=t.startState.facet(Wa);if(i){if(i.name==e.name)return null}else if(t.startState.facet(CS)==e.name)return null;return console.log("switching... to "+e.name),{effects:vS.reconfigure(e.plugins)}}return e.name===t.startState.facet(Wa).name?null:(console.log("switching... to "+e.name),{effects:vS.reconfigure(e.plugins)})}));let XS,ZS=null;const AS=t=>{const e=t||XS;return e&&e.viewState?(console.log(),PS(e.state.doc.line(1).text).name):""},TS=t=>{const e=t||XS;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return!1;const n=i[0];return[n.from,n.to]},RS=t=>{const e=t||XS;return e&&e.viewState?e.state.doc.toString():""},ES=t=>{const e=t||XS;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return"";const n=i[0];return console.log("yoko"),console.log(n),console.log(e.state.doc.toString().slice(n.from,n.to)),console.log("processing"),e.state.doc.toString().slice(n.from,n.to)},VS=(t,e)=>{const i=e||XS;if(!i)return;if(!i.viewState)return;const n=i.viewState.state.selection.ranges;if(!n.length)return;const s=n[0];console.log("result"),console.log(t),i.dispatch({changes:{...s,insert:t}})},MS=()=>XS,DS=(t,e)=>{const i=e||XS;i&&i.viewState&&(console.log("result"),console.log(t),i.dispatch({changes:{from:0,to:i.viewState.state.doc.length,insert:t}}))};ZS=t=>{let e=new Ts({doc:t.doc,extensions:[Ys.of([{key:"Tab",run:function(t,e){return sd(t)}},{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,zS,Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(XS=e.view)}))],parent:t.parent});return e.viewState.state.config.eval=t.eval,e},ZS.state=t=>{let e=xt.create({doc:t.doc,extensions:[Ys.of([{key:"Tab",run:function(t,e){return sd(t)}},{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,zS,Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(XS=e.view)}))]});return e.config.eval=t.eval,e};const WS=(t,e)=>{if(!t||e<=0)return[];const i=[];for(let n=0;n{if(console.log(e.dom.ocellref),e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:DropEvent"]')}},file:(t,e,i,n,s)=>{if(e.dom.ocellref)if(s.length>5242880){const t=WS(s,5242880);t.forEach(((e,s)=>{server.emitt(i,`<|"Data"->"${e}", "Name"->"${n}", "Chunk"->${s+1}, "Chunks"->${t.length}|>`,"Chunk")}))}else server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},YS={transaction:(t,e,i,n)=>{if(console.log(e.dom.ocellref),e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:PasteEvent"]')}},file:(t,e,i,n,s)=>{if(console.log(e.dom.ocellref),e.dom.ocellref)if(s.length>5242880){const t=WS(s,5242880);t.forEach(((e,s)=>{server.emitt(i,`<|"Data"->"${e}", "Name"->"${n}", "Chunk"->${s+1}, "Chunks"->${t.length}|>`,"Chunk")}))}else server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},qS=[Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Cm(US,YS)];let LS=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"}}),zS=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"},".cm-scroller":{"line-height":"inherit","overflow-x":"overlay","overflow-y":"overlay","align-items":"initial"},".cm-content":{padding:"0px 0"},".rainbow-bracket-red":{color:"var(--editor-bracket-1)"},".rainbow-bracket-orange":{color:"var(--editor-bracket-2)"},".rainbow-bracket-yellow":{color:"var(--editor-bracket-3)"},".rainbow-bracket-green":{color:"var(--editor-bracket-4)"},".rainbow-bracket-blue":{color:"var(--editor-bracket-5)"},".rainbow-bracket-indigo":{color:"var(--editor-bracket-6)"},".rainbow-bracket-violet":{color:"var(--editor-bracket-7)"},".rainbow-bracket-red > span":{color:"var(--editor-bracket-1-a)"},".rainbow-bracket-orange > span":{color:"var(--editor-bracket-2-a)"},".rainbow-bracket-yellow > span":{color:"var(--editor-bracket-3-a)"},".rainbow-bracket-green > span":{color:"var(--editor-bracket-4-a)"},".rainbow-bracket-blue > span":{color:"var(--editor-bracket-5-a)"},".rainbow-bracket-indigo > span":{color:"var(--editor-bracket-6-a)"},".rainbow-bracket-violet > span":{color:"var(--editor-bracket-7-a)"}}),IS=!1;const BS=[()=>vr(),()=>Sh(),()=>ir(),()=>dr(),()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xS,{fallback:!1}),()=>tu()],jS={},NS=[()=>vr(),()=>Sh(),()=>ir(),()=>dr(),t=>GS.of(t),()=>jS.gutter?function(t={}){return[eo.of(t),jr(),so]}():[],()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xS,{fallback:!1}),()=>tu(),()=>bS,()=>function(t){return _i.fromClass(class{constructor(e){this.view=e,this.placeholder=ni.set([ni.widget({widget:new kr(t),side:1}).range(0)])}get decorations(){return this.view.state.doc.length?ni.none:this.placeholder}},{decorations:t=>t.decorations})}("Type WL Expression / .md / .js"),()=>xt.allowMultipleSelections.of(!0),(t,e)=>vS.of(e),()=>yS.of(xt.readOnly.of(!1)),()=>_S,()=>{return t?[ou.of(t),Yu]:Yu;var t},(t,e)=>Ys.of([{key:"Tab",run:function(t,e){const i=sd(t);return i||Rc(t)},shift:Ec},{key:"Backspace",run:function(e,i){if(0===e.state.doc.length)return t.origin.remove(),!0}},{key:"ArrowLeft",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus prev"),t.origin.focusPrev(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus next"),t.origin.focusNext(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"Shift-Enter",preventDefault:!0,run:function(e,i){console.log(e.state.doc.toString()),t.origin.eval(e.state.doc.toString())}},...Vc,...Wh,...Ru]),(t,e)=>Ts.updateListener.of((e=>{e.docChanged&&t.origin.save(encodeURIComponent(e.state.doc.toString())),e.selectionSet&&(XS=e.view)})),()=>LS];const GS=E.define();function FS(t){return t.replace(/\\\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\\\:/g,""),16))})).replaceAll("\\:F74E","I").replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))}function HS(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(t=>(+t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+t/4).toString(16)))}core.ReadOnly=()=>"ReadOnly",core.EditorView=async(t,e)=>{let i=await interpretate(t[0],e);i=FS(i),console.log("UNICODE Disaster");const n=await core._getRules(t,e);let s=()=>{},r=()=>{},o=i;const a=[];n.ReadOnly&&a.push(xt.readOnly.of(!0)),n.ForceUpdate&&(e.local.forceUpdate=n.ForceUpdate),n.Event&&(r=t=>{o=t,console.log("editor view emitt data: "+t),server.kernel.emitt(n.Event,'"'+t.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Input")},s=()=>{server.kernel.emitt(n.Event,'"'+o.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Evaluate")}),e.local?e.local.editor=ZS({doc:i,parent:e.element,eval:s,update:r,extensions:a}):ZS({doc:i,parent:e.element,eval:s,update:r,extensions:a}),e.element.style.verticalAlign="inherit"},core.StripOnInput=async()=>{},core.EditorView.update=async(t,e)=>{if(!e.local.editor)return;const i=FS(await interpretate(t[0],e));console.log("editor view: dispatch"),e.local.forceUpdate,e.local.editor.dispatch({changes:{from:0,to:e.local.editor.state.doc.length,insert:i}})},core.EditorView.destroy=async(t,e)=>{await interpretate(t[0],e),e.local&&e.local.editor&&e.local.editor.destroy()},core.EditorView.virtual=!0,core.PreviewCell=(t,e)=>{},window.SupportedLanguages.push({check:t=>null===t,legacy:!0,plugins:qS,name:"mathematica"}),window.SupportedLanguages.push({check:t=>null!=t[0].match(/\w+\.(wl|wls)$/),plugins:qS,legacy:!0,name:"mathematica"}),window.SupportedCells.codemirror={view:class{origin={};editor={};trash=[];forceFocusNext(){IS=!0}focus(t){t>0?this.editor.dispatch({selection:{anchor:0}}):t<0&&this.editor.dispatch({selection:{anchor:this.editor.state.doc.length}}),this.editor.focus()}setContent(t){if(console.warn("content mutation!"),!this.editor.viewState)return;const e=this.editor;console.log("result"),console.log(t),this.editor.dispatch({changes:{from:0,to:e.viewState.state.doc.length,insert:t}})}addDisposable(t){this.trash.push(t)}dispose(){this.editor.destroy()}readOnly(t){this.editor.dispatch({effects:yS.reconfigure(xt.readOnly.of(t))})}constructor(t,e){this.origin=t;const i=this.origin,n=PS(e).plugins,s=this;this.origin.element.ocellref=s;const r=new Ts({doc:(o=e,o.replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))),extensions:NS.map((t=>t(s,n))),parent:this.origin.element});var o;return this.editor=r,this.editor.dom.ocellref=s,this.editor.viewState.state.config.eval=()=>{i.eval(this.editor.state.doc.toString())},IS&&r.focus(),IS=!1,this}},context:{EditorAutocomplete:kS,javascriptLanguage:qf,javascript:Nf,markdownLanguage:rm,markdown:function(t={}){let{codeLanguages:e,defaultCodeLanguage:i,addKeymap:n=!0,base:{parser:s}=sm}=t;if(!(s instanceof Zp))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let r,o=t.extensions?[t.extensions]:[],a=[dm.support];i instanceof Ua?(a.push(i.support),r=i.language):i&&(r=i);let l=e||r?(h=e,c=r,t=>{if(t&&h){let e=null;if(t=/\S*/.exec(t)[0],e="function"==typeof h?h(t):Ya.matchLanguageName(h,t,!0),e instanceof Ya)return e.support?e.support.language.parser:Ta.getSkippingParser(e.load());if(e)return e.parser}return c?c.parser:null}):void 0;var h,c;return o.push(function(t){let{codeParser:e,htmlParser:i}=t,n=Do(((t,n)=>{let s=t.type.id;if(!e||s!=Kf.CodeBlock&&s!=Kf.FencedCode){if(i&&(s==Kf.HTMLBlock||s==Kf.HTMLTag))return{parser:i,overlay:rO(t.node,t.from,t.to)}}else{let i="";if(s==Kf.FencedCode){let e=t.node.getChild(Kf.CodeInfo);e&&(i=n.read(e.from,e.to))}let r=e(i);if(r)return{parser:r,overlay:t=>t.type.id==Kf.CodeText}}return null}));return{wrap:n}}({codeParser:l,htmlParser:dm.language.parser})),n&&a.push(N.high(Ys.of(um))),new Ua(nm(s.configure(o)),a)},htmlLanguage:jg,html:Ng,cssLanguage:kg,css:Qg,EditorView:Ts,EditorState:xt,highlightSpecialChars:vr,syntaxHighlighting:$l,defaultHighlightStyle:xS,editorCustomTheme:LS,foldGutter:function(t={}){let e=Object.assign(Object.assign({},wl),t),i=new vl(e,!0),n=new vl(e,!1),s=_i.fromClass(class{constructor(t){this.from=t.viewport.from,this.markers=this.buildMarkers(t)}update(t){(t.docChanged||t.viewportChanged||t.startState.facet(Wa)!=t.state.facet(Wa)||t.startState.field(dl,!1)!=t.state.field(dl,!1)||Xa(t.startState)!=Xa(t.state)||e.foldingChanged(t))&&(this.markers=this.buildMarkers(t.view))}buildMarkers(t){let e=new Xt;for(let s of t.viewportLineBlocks){let r=fl(t.state,s.from,s.to)?n:ll(t.state,s.from,s.to)?i:null;r&&e.add(s.from,s.from,r)}return e.finish()}}),{domEventHandlers:r}=e;return[s,Ir({class:"cm-foldGutter",markers(t){var e;return(null===(e=t.plugin(s))||void 0===e?void 0:e.markers)||_t.empty},initialSpacer:()=>new vl(e,!1),domEventHandlers:Object.assign(Object.assign({},r),{click:(t,e,i)=>{if(r.click&&r.click(t,e,i))return!0;let n=fl(t.state,e.from,e.to);if(n)return t.dispatch({effects:ul.of(n)}),!0;let s=ll(t.state,e.from,e.to);return!!s&&(t.dispatch({effects:cl.of(s)}),!0)}})}),ml()]},Facet:E,Compartment:F,mathematicaPlugins:qS,legacyLangNameFacet:CS,DropPasteHandlers:Cm,EditorExtensionsMinimal:BS,EditorParameters:jS,EditorExtensions:NS,StateField:q,Decoration:ni,ViewPlugin:_i,WidgetType:ei,originFacet:GS,MatchDecorator:pr}},window.OfflineMode&&SS.push(xt.readOnly.of(!0)),core.CellView=async(t,e)=>{const i=await core._getRules(t,e);i.Display||(i.Display="codemirror");const n=await interpretate(t[0],e),s={element:e.element,uid:HS()};i.Style&&(e.element.style=i.Style),i.Class&&e.element.classList.add(...i.Class.split(" ")),i.ImageSize&&(Array.isArray(i.ImageSize)?(e.element.style.width=i.ImageSize[0]+"px",e.element.style.height=i.ImageSize[1]+"px"):e.element.style.width=i.ImageSize+"px"),new window.SupportedCells[i.Display].view(s,n)};const JS={};core.FrontEditorSelected=async(t,e)=>{console.log("check");const i=await interpretate(t[0],e),n=await core._getRules(t,e);let s;switch(n.Editor&&(s=JS[n.Editor],console.log("Editor"),console.log(n.Editor),console.log(s)),i){case"Get":return ES(s);case"Set":let i=await interpretate(t[1],e);VS(i,s);break;case"GetDoc":return RS(s);case"SetDoc":let n=await interpretate(t[1],e);DS(n,s);break;case"Cursor":return TS(s);case"Type":return AS(s);case"Editor":const r=HS();return JS[r]=MS(),r}};window.SupportedCells.shell={view:class{dispose(){}constructor(t,e){this.origin=t;const i=document.createElement("div");return i.classList.add(..."flex sc-b max-h-60 text-sm overflow-y-scroll".split(" ")),i.style.overflowAnchor="auto",i.style.flexDirection="column-reverse",i.innerText=e,this.origin.element.appendChild(i),this}}}; +class t{constructor(){}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 a(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}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 l(n,o,i,r);n=o+1,i++}}decompose(t,i,r,o){let a=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(a.text,t.text.slice(),0,a.length);if(i.length<=32)r.push(new e(i,t.length+a.length));else{let t=i.length>>1;r.push(new e(i.slice(0,t)),new e(i.slice(t)))}}else r.push(a)}replace(t,r,o){if(!(o instanceof e))return super.replace(t,r,o);let a=n(this.text,n(o.text,s(this.text,0,t)),r),l=this.length+o.length-(r-t);return a.length<=32?new e(a,l):i.from(e.split(a,[]),l)}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=a+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,a=i+r.lines-1;if((e?a:o)>=t)return r.lineInner(t,e,i,n);n=o+1,i=a+1}}decompose(t,e,i,n){for(let s=0,r=0;r<=e&&s=r){let s=n&((r<=t?1:0)|(a>=e?2:0));r>=t&&a<=e&&!s?i.push(o):o.decompose(t-r,e-r,i,s)}r=a+1}}replace(t,e,n){if(n.lines=r&&e<=a){let l=o.replace(t-r,e-r,n),h=this.lines-o.lines+l.lines;if(l.lines>4&&l.lines>h>>6){let r=this.children.slice();return r[s]=l,new i(r,this.length-(e-t)+n.length)}return super.replace(r,a,l)}r=a+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=a+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,a]=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==a)return n;let i=this.children[s],l=t.children[r];if(i!=l)return n+i.scanIdentical(l,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,a=r>>1,l=[],h=0,c=-1,u=[];function d(t){let n;if(t.lines>o&&t instanceof i)for(let e of t.children)d(e);else t.lines>a&&(h>a||!h)?(f(),l.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&&f(),h+=t.lines,c+=t.length+1,u.push(t))}function f(){0!=h&&(l.push(1==u.length?u[0]:i.from(u,c)),c=-1,h=u.length=0)}for(let e of t)d(e);return f(),1==l.length?l[0]:new i(l,n)}}function n(t,e,i=0,n=1e9){for(let s=0,r=0,o=!0;r=i&&(l>n&&(a=a.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,a=s instanceof e?s.text.length:s.children.length;if(o==(i>0?a: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 a{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]=a.prototype[Symbol.iterator]=function(){return this});let l=class{constructor(t,e,i,n){this.from=t,this.to=e,this.number=i,this.text=n}get length(){return this.to-this.from}},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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,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 d=8205;function f(t,e,i=!0,n=!0){return(i?p:O)(t,e,n)}function p(t,e,i){if(e==t.length)return e;e&&g(t.charCodeAt(e))&&m(t.charCodeAt(e-1))&&e--;let n=b(t,e);for(e+=v(n);e=0&&u(b(t,n));)i++,n-=2;if(i%2==0)break;e+=2}}}return e}function O(t,e,i){for(;e>0;){let n=p(t,e-2,i);if(n=56320&&t<57344}function m(t){return t>=55296&&t<56320}function b(t,e){let i=t.charCodeAt(e);if(!m(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return g(n)?n-56320+(i-55296<<10)+65536:i}function w(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function v(t){return t<65536?1:2}const y=/\r\n?|\n/;var S=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(S||(S={}));class x{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;et)return s+(t-n);s+=o}else{if(i!=S.Simple&&l>=t&&(i==S.TrackDel&&nt||i==S.TrackBefore&&nt))return null;if(l>t||l==t&&e<0&&!o)return t==n||e<0?s:s+a;s+=a}n=l}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 x(t)}static create(t){return new x(t)}}class k extends x{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 P(this,((e,i,n,s,r)=>t=t.replace(n,n+(i-e),r)),!1),t}mapDesc(t,e=!1){return C(this,t,e,!0)}invert(e){let i=this.sections.slice(),n=[];for(let s=0,r=0;s=0){i[s]=a,i[s+1]=o;let l=s>>1;for(;n.length0&&$(i,e,s.text),s.forward(t),o+=t}let l=t[r++];for(;o>1].toJSON()))}return t}static of(e,i,n){let s=[],r=[],o=0,a=null;function l(t=!1){if(!t&&!s.length)return;oa||e<0||a>i)throw new RangeError(`Invalid change range ${e} to ${a} (in doc of length ${i})`);let u=c?"string"==typeof c?t.of(c.split(n||y)):c:t.empty,d=u.length;if(e==a&&0==d)return;eo&&Q(s,e-o,-1),Q(s,a-e,d),$(r,s,u),o=a}}(e),l(!a),a}static empty(t){return new k(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 $(e,i,n){if(0==n.length)return;let s=i.length-2>>1;if(s>1])),!(n||a==e.sections.length||e.sections[a+1]<0);)l=e.sections[a++],h=e.sections[a++];i(r,c,o,u,d),r=c,o=u}}}function C(t,e,i,n=!1){let s=[],r=n?[]:null,o=new X(t),a=new X(e);for(let t=-1;;)if(-1==o.ins&&-1==a.ins){let t=Math.min(o.len,a.len);Q(s,t,-1),o.forward(t),a.forward(t)}else if(a.ins>=0&&(o.ins<0||t==o.i||0==o.off&&(a.len=0&&t=0)){if(o.done&&a.done)return r?k.createSet(s,r):x.create(s);throw new Error("Mismatched change set lengths")}{let e=0,i=o.len;for(;i;)if(-1==a.ins){let t=Math.min(i,a.len);e+=t,i-=t,a.forward(t)}else{if(!(0==a.ins&&a.lene||o.ins>=0&&o.len>e)&&(t||n.length>i),r.forward2(e),o.forward(e)}}else Q(n,0,o.ins,t),s&&$(s,n,o.text),o.next()}}class X{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 Z{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 Z(i,n,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return A.range(t,e);let i=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return A.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 A.range(t.anchor,t.head)}static create(t,e,i){return new Z(t,e,i)}}class A{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:A.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 A(t.ranges.map((t=>Z.fromJSON(t))),t.main)}static single(t,e=t){return new A([A.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?A.range(o,r):A.range(r,o))}}return new A(t,e)}}function T(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let R=0;class E{constructor(t,e,i,n,s){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=n,this.id=R++,this.default=t([]),this.extensions="function"==typeof s?s(this):s}static define(t={}){return new E(t.combine||(t=>t),t.compareInput||((t,e)=>t===e),t.compare||(t.combine?(t,e)=>t===e:V),!!t.static,t.enables)}of(t){return new M([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,2,e)}from(t,e){return e||(e=t=>t),this.compute([t],(i=>e(i.field(t))))}}function V(t,e){return t==e||t.length==e.length&&t.every(((t,i)=>t===e[i]))}class M{constructor(t,e,i,n){this.dependencies=t,this.facet=e,this.type=i,this.value=n,this.id=R++}dynamicSlot(t){var e;let i=this.value,n=this.facet.compareInput,s=this.id,r=t[s]>>1,o=2==this.type,a=!1,l=!1,h=[];for(let i of this.dependencies)"doc"==i?a=!0:"selection"==i?l=!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(a&&e.docChanged||l&&(e.docChanged||e.selection)||W(t,h)){let e=i(t);if(o?!D(e,t.values[r],n):!n(e,t.values[r]))return t.values[r]=e,1}return 0},reconfigure:(t,e)=>{let a,l=e.config.address[s];if(null!=l){let s=tt(e,l);if(this.dependencies.every((i=>i instanceof E?e.facet(i)===t.facet(i):!(i instanceof q)||e.field(i,!1)==t.field(i,!1)))||(o?D(a=i(t),s,n):n(a=i(t),s)))return t.values[r]=s,0}else a=i(t);return t.values[r]=a,1}}}}function D(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 a(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(Y).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,Y.of({field:this,create:t})]}get extension(){return this}}const L=4,z=3,I=2,B=1;function j(t){return e=>new G(e,t)}const N={highest:j(0),high:j(B),default:j(I),low:j(z),lowest:j(L)};class G{constructor(t,e){this.inner=t,this.prec=e}}class F{of(t){return new H(this,t)}reconfigure(t){return F.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class H{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;function r(t,o){let a=s.get(t);if(null!=a){if(a<=o)return;let e=n[a].indexOf(t);e>-1&&n[a].splice(e,1),t instanceof H&&i.delete(t.compartment)}if(s.set(t,o),Array.isArray(t))for(let e of t)r(e,o);else if(t instanceof H){if(i.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");let n=e.get(t.compartment)||t.inner;i.set(t.compartment,n),r(n,o)}else if(t instanceof G)r(t.inner,t.prec);else if(t instanceof q)n[o].push(t),t.provides&&r(t.provides,o);else if(t instanceof M)n[o].push(t),t.facet.extensions&&r(t.facet.extensions,I);else{let e=t.extension;if(!e)throw new Error(`Unrecognized extension value in extension set (${t}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(e,o)}}return r(t,I),n.reduce(((t,e)=>t.concat(e)))}(t,e,r))i instanceof q?n.push(i):(s[i.facet.id]||(s[i.facet.id]=[])).push(i);let o=Object.create(null),a=[],l=[];for(let t of n)o[t.id]=l.length<<1,l.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]=a.length<<1|1,V(r,e))a.push(i.facet(n));else{let t=n.combine(e.map((t=>t.value)));a.push(i&&n.compare(t,i.facet(n))?i.facet(n):t)}else{for(let t of e)0==t.type?(o[t.id]=a.length<<1|1,a.push(t.value)):(o[t.id]=l.length<<1,l.push((e=>t.dynamicSlot(e))));o[n.id]=l.length<<1,l.push((t=>U(t,n,e)))}}let c=l.map((t=>t(o)));return new J(t,r,c,o,a,s)}}function K(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 tt(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}const et=E.define(),it=E.define({combine:t=>t.some((t=>t)),static:!0}),nt=E.define({combine:t=>t.length?t[0]:void 0,static:!0}),st=E.define(),rt=E.define(),ot=E.define(),at=E.define({combine:t=>!!t.length&&t[0]});class lt{constructor(t,e){this.type=t,this.value=e}static define(){return new ht}}class ht{of(t){return new lt(this,t)}}class ct{constructor(t){this.map=t}of(t){return new ut(this,t)}}class ut{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 ut(this.type,e)}is(t){return this.type==t}static define(t={}){return new ct(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}}ut.reconfigure=ut.define(),ut.appendConfig=ut.define();class dt{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&&T(i,e.newLength),s.some((t=>t.type==dt.time))||(this.annotations=s.concat(dt.time.of(Date.now())))}static create(t,e,i,n,s,r){return new dt(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(dt.userEvent);return!(!e||!(e==t||e.length>t.length&&e.slice(0,t.length)==t&&"."==e[t.length]))}}function ft(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=pt(n,Ot(e,r,t.changes.newLength),!0))}return n==t?t:dt.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(st)){let e=n(t);if(!1===e){i=!1;break}Array.isArray(e)&&(i=!0===i?e:ft(i,e))}if(!0!==i){let n,s;if(!1===i)s=t.changes.invertedDesc,n=k.empty(e.doc.length);else{let e=t.changes.filter(i);n=e.changes,s=e.filtered.mapDesc(e.changes).invertedDesc}t=dt.create(e,n,t.selection&&t.selection.map(s),ut.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let n=e.facet(rt);for(let i=n.length-1;i>=0;i--){let s=n[i](t);t=s instanceof dt?s:Array.isArray(s)&&1==s.length&&s[0]instanceof dt?s[0]:gt(e,bt(s),!1)}return t}(s):s)}dt.time=lt.define(),dt.userEvent=lt.define(),dt.addToHistory=lt.define(),dt.remote=lt.define();const mt=[];function bt(t){return null==t?mt:Array.isArray(t)?t:[t]}var wt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(wt||(wt={}));const vt=/[\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){}function St(t){return e=>{if(!/\S/.test(e))return wt.Space;if(function(t){if(yt)return yt.test(t);for(let e=0;e"€"&&(i.toUpperCase()!=i.toLowerCase()||vt.test(i)))return!0}return!1}(e))return wt.Word;for(let i=0;i-1)return wt.Word;return wt.Other}}class xt{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(ut.reconfigure)?(i=null,n=e.value):e.is(ut.appendConfig)&&(i=null,n=bt(n).concat(e.value));if(i)e=t.startState.values.slice();else{i=J.resolve(n,s,this),e=new xt(i,this.doc,this.selection,i.dynamicSlots.map((()=>null)),((t,e)=>e.reconfigure(t,this)),null).values}new xt(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:A.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=bt(i.effects);for(let i=1;is.spec.fromJSON(r,t))))}return xt.create({doc:t.doc,selection:A.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(xt.lineSeparator)||y)),s=e.selection?e.selection instanceof A?e.selection:A.single(e.selection.anchor,e.selection.head):A.single(0);return T(s,n.length),i.staticFacet(it)||(s=s.asSingle()),new xt(i,n,s,i.dynamicSlots.map((()=>null)),((t,e)=>e.create(t)),null)}get tabSize(){return this.facet(xt.tabSize)}get lineBreak(){return this.facet(xt.lineSeparator)||"\n"}get readOnly(){return this.facet(at)}phrase(t,...e){for(let e of this.facet(xt.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(et))for(let r of s(this,e,i))Object.prototype.hasOwnProperty.call(r,t)&&n.push(r[t]);return n}charCategorizer(t){return St(this.languageDataAt("wordChars",t).join(""))}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=f(e,r,!1);if(s(e.slice(t,r))!=wt.Word)break;r=t}for(;ot.length?t[0]:4}),xt.lineSeparator=nt,xt.readOnly=at,xt.phrases=E.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]))}}),xt.languageData=et,xt.changeFilter=st,xt.transactionFilter=rt,xt.transactionExtender=ot,F.reconfigure=ut.define();class Qt{eq(t){return this==t}range(t,e=t){return $t.create(t,e,this)}}Qt.prototype.startSide=Qt.prototype.endSide=0,Qt.prototype.point=!1,Qt.prototype.mapMode=S.TrackDel;let $t=class t{constructor(t,e,i){this.from=t,this.to=e,this.value=i}static create(e,i,n){return new t(e,i,n)}};function Pt(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Ct{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,a=s[n]-t||(i?this.value[n].endSide:this.value[n].startSide)-e;if(n==r)return a>=0?r:o;a>=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||l==h&&c.startSide>0&&c.endSide<=0)continue;(h-l||c.endSide-c.startSide)<0||(r<0&&(r=l),c.point&&(o=Math.max(o,h-l)),i.push(c),n.push(l-r),s.push(h-r))}return{mapped:i.length?new Ct(n,s,i,o):null,pos:r}}}class _t{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 _t(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(Pt)),this.isEmpty)return e.length?_t.of(e):this;let o=new At(this,null,-1).goto(0),a=0,l=[],h=new Xt;for(;o.value||a=0){let t=e[a++];h.addInner(t.from,t.to,t.value)||l.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 Tt.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return Tt.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)),a=Zt(r,o,i),l=new Et(r,a,s),h=new Et(o,a,s);i.iterGaps(((t,e,i)=>Vt(l,t,h,e,i,n))),i.empty&&0==i.length&&Vt(l,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=Zt(s,r),a=new Et(s,o,0).goto(i),l=new Et(r,o,0).goto(i);for(;;){if(a.to!=l.to||!Mt(a.active,l.active)||a.point&&(!l.point||!a.point.eq(l.point)))return!1;if(a.to>n)return!0;a.next(),l.next()}}static spans(t,e,i,n,s=-1){let r=new Et(t,null,s).goto(e),o=e,a=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,a),a=r.openEnd(t));if(r.to>i)return a+(r.point&&r.to>i?1:0);o=r.to,r.next()}}static of(t,e=!1){let i=new Xt;for(let n of t instanceof $t?[t]:e?function(t){if(t.length>1)for(let e=t[0],i=1;i0)return t.slice().sort(Pt);e=n}return t}(t):t)i.add(n.from,n.to,n.value);return i.finish()}}_t.empty=new _t([],[],null,-1),_t.empty.nextLayer=_t.empty;class Xt{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}finishChunk(t){this.chunks.push(new Ct(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=[])}add(t,e,i){this.addInner(t,e,i)||(this.nextLayer||(this.nextLayer=new Xt)).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(_t.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;let e=_t.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function Zt(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 At(r,e,i,s));return 1==n.length?n[0]:new Tt(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--)Rt(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--)Rt(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(),Rt(this.heap,0)}}}function Rt(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 Et{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=Tt.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){Dt(this.active,t),Dt(this.activeTo,t),Dt(this.activeRank,t),this.minActive=Ut(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&&Dt(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 Vt(t,e,i,n,s,r){t.goto(e),i.goto(n);let o=n+s,a=n,l=n-e;for(;;){let e=t.to+l-i.to||t.endSide-i.endSide,n=e<0?t.to+l: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))&&Mt(t.activeForPoint(t.to+l),i.activeForPoint(i.to))||r.comparePoint(a,s,t.point,i.point):s>a&&!Mt(t.active,i.active)&&r.compareRange(a,s,t.active,i.active),n>o)break;a=n,e<=0&&t.next(),e>=0&&i.next()}}function Mt(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 Ut(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(!l)throw new RangeError("The value of a property ("+i+") should be a primitive value.");s(n(i),o,a,h)}else null!=o&&a.push(i.replace(/_.*/,"").replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))+": "+o+";")}(a.length||h)&&r.push((!i||l||o?t:t.map(i)).join(", ")+" {"+a.join(" ")+"}")}for(let e in t)s(n(e),t[e],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let t=zt[qt]||1;return zt[qt]=t+1,"ͼ"+t.toString(36)}static mount(t,e){(t[Lt]||new jt(t)).mount(Array.isArray(e)?e:[e])}}let Bt=new Map;class jt{constructor(t){let e=t.ownerDocument||t,i=e.defaultView;if(!t.head&&t.adoptedStyleSheets&&i.CSSStyleSheet){let n=Bt.get(e);if(n)return t.adoptedStyleSheets=[n.sheet,...t.adoptedStyleSheets],t[Lt]=n;this.sheet=new i.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets],Bt.set(e,this)}else{this.styleTag=e.createElement("style");let i=t.head||t;i.insertBefore(this.styleTag,i.firstChild)}this.modules=[],t[Lt]=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:'"'},Ft="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),Ht="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Jt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Kt=Ht||Ft&&+Ft[1]<57,te=0;te<10;te++)Nt[48+te]=Nt[96+te]=String(te);for(te=1;te<=24;te++)Nt[te+111]="F"+te;for(te=65;te<=90;te++)Nt[te]=String.fromCharCode(te+32),Gt[te]=String.fromCharCode(te);for(var ee in Nt)Gt.hasOwnProperty(ee)||(Gt[ee]=Nt[ee]);function ie(t){let e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection()}function ne(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function se(t,e){if(!e.anchorNode)return!1;try{return ne(t,e.anchorNode)}catch(t){return!1}}function re(t){return 3==t.nodeType?me(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function oe(t,e,i,n){return!!i&&(le(t,e,i,n,-1)||le(t,e,i,n,1))}function ae(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function le(t,e,i,n,s){for(;;){if(t==i&&e==n)return!0;if(e==(s<0?0:he(t))){if("DIV"==t.nodeName)return!1;let i=t.parentNode;if(!i||1!=i.nodeType)return!1;e=ae(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?he(t):0}}}function he(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}const ce={left:0,right:0,top:0,bottom:0};function ue(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function de(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}class fe{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){this.set(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset)}set(t,e,i,n){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=n}}let pe,Oe=null;function ge(t){if(t.setActive)return t.setActive();if(Oe)return t.focus(Oe);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==Oe?{get preventScroll(){return Oe={preventScroll:!0},!0}}:void 0),!Oe){Oe=!1;for(let t=0;te)return i.domBoundsAround(t,e,l);if(c>=t&&-1==n&&(n=a,s=l),l>e&&i.dom.parentNode==this.dom){r=a,o=h;break}h=c,l=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.dirty|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.dirty|=2),1&e.dirty)return;e.dirty|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,this.dirty&&this.markParentsDirty(!0))}setDOM(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=ye){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 Qe(t,e,i,n,s,r,o,a,l){let{children:h}=t,c=h.length?h[e]:null,u=r.length?r[r.length-1]:null,d=u?u.breakAfter:o;if(!(e==n&&c&&!o&&!d&&r.length<2&&c.merge(i,s,r.length?u:null,0==i,a,l))){if(n0&&(!o&&r.length&&c.merge(i,c.length,r[0],!1,a,0)?c.breakAfter=r.shift().breakAfter:(i2);var De={mac:Me||/Mac/.test(Pe.platform),windows:/Win/.test(Pe.platform),linux:/Linux|X11/.test(Pe.platform),ie:Ae,ie_version:Xe?Ce.documentMode||6:Ze?+Ze[1]:_e?+_e[1]:0,gecko:Te,gecko_version:Te?+(/Firefox\/(\d+)/.exec(Pe.userAgent)||[0,0])[1]:0,chrome:!!Re,chrome_version:Re?+Re[1]:0,ios:Me,android:/Android\b/.test(Pe.userAgent),webkit:Ee,safari:Ve,webkit_version:Ee?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Ce.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class We extends Se{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(!i||i instanceof We&&!(this.length-(e-t)+i.length>256))&&(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),!0)}split(t){let e=new We(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new ve(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 Ye(this.dom,t,e)}}class Ue extends Se{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(we(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}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.dirty|=6)}sync(t,e){this.dom?4&this.dirty&&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 Ue&&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 Ue(this.mark,e,r)}domAtPos(t){return Ge(this,t)}coordsAt(t,e){return He(this,t,e)}}function Ye(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?De.chrome||De.gecko||(e?(s--,o=1):r=0)?0:a.length-1];return De.safari&&!o&&0==l.width&&(l=Array.prototype.find.call(a,(t=>t.width))||l),o?ue(l,o<0):l||null}class qe extends Se{constructor(t,e,i){super(),this.widget=t,this.length=e,this.side=i,this.prevWidget=null}static create(t,e,i){return new(t.customView||qe)(t,e,i)}split(t){let e=qe.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 qe&&this.widget.compare(i.widget))||t>0&&s<=0||e0)?ve.before(this.dom):ve.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let i=this.dom.getClientRects(),n=null;if(!i.length)return ce;for(let e=t>0?i.length-1:0;n=i[e],!(t>0?0==e:e==i.length-1||n.top0?-1:1);return this.length?n:ue(n,this.side>0)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class Le extends qe{domAtPos(t){let{topView:e,text:i}=this.widget;return e?ze(t,0,e,i,this.length-e.length,((t,e)=>t.domAtPos(e)),((t,e)=>new ve(t,Math.min(e,t.nodeValue.length)))):new ve(i,Math.min(t,i.nodeValue.length))}sync(){this.setDOM(this.widget.toDOM())}localPosFromDOM(t,e){let{topView:i,text:n}=this.widget;return i?Be(t,e,i,n,this.length-i.length):Math.min(e,this.length)}ignoreMutation(){return!1}get overrideDOMText(){return null}coordsAt(t,e){let{topView:i,text:n}=this.widget;return i?ze(t,e,i,n,this.length-i.length,((t,e,i)=>t.coordsAt(e,i)),((t,e,i)=>Ye(t,e,i))):Ye(n,t,e)}destroy(){var t;super.destroy(),null===(t=this.widget.topView)||void 0===t||t.destroy()}get isEditable(){return!0}canReuseDOM(){return!0}}function ze(t,e,i,n,s,r,o){if(i instanceof Ue){for(let a=i.dom.firstChild;a;a=a.nextSibling){let i=Se.get(a);if(i){let l=ne(a,n),h=i.length+(l?s:0);if(t0?ve.before(this.dom):ve.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){let e=this.dom.getBoundingClientRect(),i=function(t,e){let i=t.parent,n=i?i.children.indexOf(t):-1;for(;i&&n>=0;)if(e<0?n>0:n0?-1:1);return i&&i.tope.top?{left:e.left,right:e.right,top:i.top,bottom:i.bottom}:e}get overrideDOMText(){return t.empty}get isHidden(){return!0}}function Ge(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 Ue&&s.length&&(n=s[s.length-1])instanceof Ue&&n.mark.eq(e.mark)?Fe(n,e.children[0],i-1):(s.push(e),e.setParent(t)),t.length+=e.length}function He(t,e,i){let n=null,s=-1,r=null,o=-1;!function t(e,a){for(let l=0,h=0;l=a&&(c.children.length?t(c,a-h):(!r||r instanceof Ne&&i>0)&&(u>a||h==u&&c.getSide()>0)?(r=c,o=a-h):(h0?3e8:-4e8:e>0?1e8:-1e8,new oi(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}=ai(t,n);e=(s?n?-3e8:-1:5e8)-1,i=1+(r?n?2e8:1:-6e8)}return new oi(t,e,i,n,t.widget||null,!0)}static line(t){return new ri(t)}static set(t,e=!1){return _t.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}ni.none=_t.empty;class si extends ni{constructor(t){let{start:e,end:i}=ai(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){return this==t||t instanceof si&&this.tagName==t.tagName&&this.class==t.class&&Ke(this.attrs,t.attrs)}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}si.prototype.point=!1;class ri extends ni{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof ri&&this.spec.class==t.spec.class&&Ke(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)}}ri.prototype.mapMode=S.TrackBefore,ri.prototype.point=!0;class oi extends ni{constructor(t,e,i,n,s,r){super(e,i,s,t),this.block=n,this.isReplace=r,this.mapMode=n?e<=0?S.TrackBefore:S.TrackAfter:S.TrackDel}get type(){return this.startSide=5}eq(t){return t instanceof oi&&(e=this.widget,i=t.widget,e==i||!!(e&&i&&e.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var e,i}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 ai(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 li(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)}oi.prototype.point=!0;class hi extends Se{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 hi))return!1;this.dom||i.transferDOM(this)}return n&&this.setDeco(i?i.attrs:null),$e(this,t,e,i?i.children:[],s,r),!0}split(t){let e=new hi;if(e.breakAfter=this.breakAfter,0==this.length)return e;let{i: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){Ke(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){Fe(this,t,e)}addLineDeco(t){let e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=Je(e,this.attrs||{})),i&&(this.attrs=Je({class:i},this.attrs||{}))}domAtPos(t){return Ge(this,t)}reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.dirty|=6)}sync(t,e){var i;this.dom?4&this.dirty&&(we(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&&(ti(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&&Se.get(n)instanceof Ue;)n=n.lastChild;if(!(n&&this.length&&("BR"==n.nodeName||0!=(null===(i=Se.get(n))||void 0===i?void 0:i.isEditable)||De.ios&&this.children.some((t=>t instanceof We))))){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 We)||/[^ -~]/.test(i.text))return null;let n=re(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=He(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 hi)return s;if(r>e)break}n=r+s.breakAfter}return null}}class ci extends Se{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 ci&&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(di(new We(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 oi){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let o=e-t;if(i instanceof oi)if(i.block){let{type:t}=i;t!=ii.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new ci(i.widget||new fi("div"),o,t))}else{let r=qe.create(i.widget||new fi("span"),o,o?0:i.startSide),a=this.atCursorPos&&!r.isEditable&&s<=n.length&&(t0),l=!r.isEditable&&(tn.length||i.startSide<=0),h=this.getLine();2!=this.pendingBuffer||a||r.isEditable||(this.pendingBuffer=0),this.flushBuffer(n),a&&(h.append(di(new Ne(1),n),s),s=n.length+Math.max(0,s-n.length)),h.append(di(r,n),s),this.atCursorPos=l,this.pendingBuffer=l?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 ui(t,e,i,s);return r.openEnd=_t.spans(n,e,i,r),r.openStart<0&&(r.openStart=r.openEnd),r.finish(r.openEnd),r}}function di(t,e){for(let i of e)t=new Ue(i,[t],t.length);return t}class fi extends ei{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 pi=E.define(),Oi=E.define(),gi=E.define(),mi=E.define(),bi=E.define(),wi=E.define(),vi=E.define(),yi=E.define({combine:t=>t.some((t=>t))}),Si=E.define({combine:t=>t.some((t=>t))});class xi{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 xi(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin)}}const ki=ut.define({map:(t,e)=>t.map(e)});function Qi(t,e,i){let n=t.facet(mi);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 $i=E.define({combine:t=>!t.length||t[0]});let Pi=0;const Ci=E.define();class _i{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 _i(Pi++,t,i,(t=>{let e=[Ci.of(t)];return s&&e.push(Ti.of((e=>{let i=e.plugin(t);return i?s(i):ni.none}))),n&&e.push(n(t)),e}))}static fromClass(t,e){return _i.define((e=>new t(e)),e)}}class Xi{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(Qi(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){Qi(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){Qi(t.state,e,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Zi=E.define(),Ai=E.define(),Ti=E.define(),Ri=E.define(),Ei=E.define(),Vi=E.define();class Mi{constructor(t,e,i,n){this.fromA=t,this.toA=e,this.fromB=i,this.toB=n}join(t){return new Mi(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(!a)return i;new Mi(a.fromA,a.toA,a.fromB,a.toB).addToSet(i),r=a.toA,o=a.toB}}}class Di{constructor(t,e,i){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=k.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 Mi(t,e,i,s)))),this.changedRanges=n}static create(t,e,i){return new Di(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 Wi=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Wi||(Wi={}));const Ui=Wi.LTR,Yi=Wi.RTL;function qi(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}}const Gi=[];function Fi(t){return[new Ni(0,t,0)]}let Hi="";function Ji(t,e,i,n,s){var r;let o=n.head-t.from,a=-1;if(0==o){if(!s||!t.length)return null;e[0].level!=i&&(o=e[0].side(!1,i),a=0)}else if(o==t.length){if(s)return null;let t=e[e.length-1];t.level!=i&&(o=t.side(!0,i),a=e.length-1)}a<0&&(a=Ni.find(e,o,null!==(r=n.bidiLevel)&&void 0!==r?r:-1,n.assoc));let l=e[a];o==l.side(s,i)&&(l=e[a+=s?1:-1],o=l.side(!s,i));let h=s==(l.dir==i),c=f(t.text,o,h);if(Hi=t.text.slice(Math.min(o,c),Math.max(o,c)),c!=l.side(s,i))return A.cursor(c+t.from,h?-1:1,l.level);let u=a==(s?e.length-1:0)?null:e[a+(s?1:-1)];return u||l.level==i?u&&u.level1)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=Se.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 en(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}class nn{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class sn extends Se{constructor(t){super(),this.view=t,this.compositionDeco=ni.none,this.decorations=[],this.dynamicDecorationMap=[],this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(t.contentDOM),this.children=[new hi],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Mi(0,0,0,t.state.doc.length)],0)}get length(){return this.view.state.doc.length}update(t){let e=t.changedRanges;this.minWidth>0&&e.length&&(e.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),this.view.inputState.composing<0?this.compositionDeco=ni.none:(t.transactions.length||this.dirty)&&(this.compositionDeco=function(t,e){let i=on(t);if(!i)return ni.none;let{from:n,to:s,node:r,text:o}=i,a=e.mapPos(n,1),l=Math.max(a,e.mapPos(s,-1)),{state:h}=t,c=3==r.nodeType?r.nodeValue:new tn([],h).readRange(r.firstChild,null).text;if(l-a{this.dom.style.height=this.view.viewState.contentHeight+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let t=De.chrome||De.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,t),this.dirty=0,t&&(t.written||i.selectionRange.focusNode!=t.node)&&(this.forceSelection=!0),this.dom.style.height=""}));let n=[];if(this.view.viewport.from||this.view.viewport.to=0?t[e]:null;if(!n)break;let{fromA:s,toA:r,fromB:o,toB:a}=n,{content:l,breakAtStart:h,openStart:c,openEnd:u}=ui.build(this.view.state.doc,o,a,this.decorations,this.dynamicDecorationMap),{i:d,off:f}=i.findPos(r,1),{i:p,off:O}=i.findPos(s,-1);Qe(this,p,O,d,f,l,h,c,u)}}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&&se(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,a=this.domAtPos(o.anchor),l=o.empty?a:this.domAtPos(o.head);if(De.gecko&&o.empty&&!this.compositionDeco.size&&(1==(h=a).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((()=>a.node.insertBefore(t,a.node.childNodes[a.offset]||null))),a=l=new ve(t,0),r=!0}var h;let c=this.view.observer.selectionRange;!r&&c.focusNode&&oe(a.node,a.offset,c.anchorNode,c.anchorOffset)&&oe(l.node,l.offset,c.focusNode,c.focusOffset)||(this.view.observer.ignore((()=>{De.android&&De.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=ie(this.view.root);if(t)if(o.empty){if(De.gecko){let t=(e=a.node,n=a.offset,1!=e.nodeType?0:(n&&"false"==e.childNodes[n-1].contentEditable?1:0)|(no.head&&([a,l]=[l,a]),e.setEnd(l.node,l.offset),e.setStart(a.node,a.offset),t.removeAllRanges(),t.addRange(e)}else;var e,n;s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())})),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new ve(c.anchorNode,c.anchorOffset),this.impreciseHead=l.precise?null:new ve(c.focusNode,c.focusOffset)}enforceCursorAssoc(){if(this.compositionDeco.size)return;let{view:t}=this,e=t.state.selection.main,i=ie(t.root),{anchorNode:n,anchorOffset:s}=t.observer.selectionRange;if(!(i&&e.empty&&e.assoc&&i.modify))return;let r=hi.find(this,e.head);if(!r)return;let o=r.posAtStart;if(e.head==o||e.head==o+r.length)return;let a=this.coordsAt(e.head,-1),l=this.coordsAt(e.head,1);if(!a||!l||a.bottom>l.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)}nearest(t){for(let e=t;e;){let t=Se.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!=ii.WidgetBefore&&s.type!=ii.WidgetAfter&&(!n||2==e||this.children[n-1].breakAfter||this.children[n-1].type==ii.WidgetBefore&&e>-2))return s.coordsAt(t-r,e);i=r}}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,a=this.view.textDirection==Wi.LTR;for(let t=0,l=0;ln)break;if(t>=i){let i=h.dom.getBoundingClientRect();if(e.push(i.height),r){let e=h.dom.lastChild,n=e?re(e):[];if(n.length){let e=n[n.length-1],r=a?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?Wi.RTL:Wi.LTR}measureTextSize(){for(let t of this.children)if(t instanceof hi){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.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(n);let s=re(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 ke(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;t.push(ni.replace({widget:new rn(n),block:!0,inclusive:!0,isBlockGap:!0}).range(i,r))}if(!s)break;i=s.to+1}return ni.set(t)}updateDeco(){let t=this.view.state.facet(Ti).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=0,r=0,o=0,a=0;for(let t of this.view.state.facet(Ei).map((t=>t(this.view))))if(t){let{left:e,right:i,top:n,bottom:l}=t;null!=e&&(s=Math.max(s,e)),null!=i&&(r=Math.max(r,i)),null!=n&&(o=Math.max(o,n)),null!=l&&(a=Math.max(a,l))}let l={left:n.left-s,top:n.top-o,right:n.right+r,bottom:n.bottom+a};!function(t,e,i,n,s,r,o,a){let l=t.ownerDocument,h=l.defaultView||window;for(let c=t;c;)if(1==c.nodeType){let t,u=c==l.body;if(u)t=de(h);else{if(c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let e=c.getBoundingClientRect();t={left:e.left,right:e.left+c.clientWidth,top:e.top,bottom:e.top+c.clientHeight}}let d=0,f=0;if("nearest"==s)e.top0&&e.bottom>t.bottom+f&&(f=e.bottom-t.bottom+f+o)):e.bottom>t.bottom&&(f=e.bottom-t.bottom+o,i<0&&e.top-f0&&e.right>t.right+d&&(d=e.right-t.right+d+r)):e.right>t.right&&(d=e.right-t.right+r,i<0&&e.left0))break;i=i.childNodes[n-1],n=he(i)}if(i>=0)for(let n=t,s=e;;){if(3==n.nodeType)return n;if(!(1==n.nodeType&&s=0))break;n=n.childNodes[s],s=0}return null}class hn{constructor(){this.changes=[]}compareRange(t,e){li(t,e,this.changes)}comparePoint(t,e){li(t,e,this.changes)}}function cn(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function un(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function dn(t,e){return t.tope.top+1}function fn(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,a,l,h,c,u=!1;for(let d=t.firstChild;d;d=d.nextSibling){let t=re(d);for(let f=0;fg||o==g&&r>O){n=d,s=p,r=O,o=g;let a=g?i0?f0)}0==O?i>p.bottom&&(!h||h.bottomp.top)&&(l=d,c=p):h&&dn(h,p)?h=pn(h,p.bottom):c&&dn(c,p)&&(c=fn(c,p.top))}}if(h&&h.bottom>=i?(n=a,s=h):c&&c.top<=i&&(n=l,s=c),!n)return{node:t,offset:0};let d=Math.max(s.left,Math.min(s.right,e));return 3==n.nodeType?gn(n,d,i):u&&"false"!=n.contentEditable?On(n,d,i):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,n)+(e>=(s.left+s.right)/2?1:0)}}function gn(t,e,i){let n=t.nodeValue.length,s=-1,r=1e9,o=0;for(let a=0;ai?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(De.chrome||De.gecko){me(t,a).getBoundingClientRect().left==h.right&&(n=!i)}if(c<=0)return{node:t,offset:a+(n?1:0)};s=a+(n?1:0),r=c}}}return{node:t,offset:s>-1?s:o>0?t.nodeValue.length:0}}function mn(t,e,i,n=-1){var s,r;let o,a=t.contentDOM.getBoundingClientRect(),l=a.top+t.viewState.paddingTop,{docHeight:h}=t.viewState,{x:c,y:u}=e,d=u-l;if(d<0)return 0;if(d>h)return t.state.doc.length;for(let e=t.defaultLineHeight/2,s=!1;o=t.elementAtHeight(d),o.type!=ii.Text;)for(;d=n>0?o.bottom+e:o.top-e,!(d>=0&&d<=h);){if(s)return i?null:0;s=!0,n=-n}u=l+d;let f=o.from;if(ft.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:bn(t,a,o,c,u);let p=t.dom.ownerDocument,O=t.root.elementFromPoint?t.root:p,g=O.elementFromPoint(c,u);g&&!t.contentDOM.contains(g)&&(g=null),g||(c=Math.max(a.left+1,Math.min(a.right-1,c)),g=O.elementFromPoint(c,u),g&&!t.contentDOM.contains(g)&&(g=null));let m,b=-1;if(g&&0!=(null===(s=t.docView.nearest(g))||void 0===s?void 0:s.isEditable))if(p.caretPositionFromPoint){let t=p.caretPositionFromPoint(c,u);t&&({offsetNode:m,offset:b}=t)}else if(p.caretRangeFromPoint){let e=p.caretRangeFromPoint(c,u);e&&(({startContainer:m,startOffset:b}=e),(!t.contentDOM.contains(m)||De.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 me(t,n-1,n).getBoundingClientRect().left>i}(m,b,c)||De.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}let n=1==t.nodeType?t.getBoundingClientRect():me(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return i-n.left>5}(m,b,c))&&(m=void 0))}if(!m||!t.docView.dom.contains(m)){let e=hi.find(t.docView,f);if(!e)return d>o.top+o.height/2?o.to:o.from;({node:m,offset:b}=On(e.dom,c,u))}let w=t.docView.nearest(m);if(!w)return null;if(w.isWidget&&1==(null===(r=w.dom)||void 0===r?void 0:r.nodeType)){let t=w.dom.getBoundingClientRect();return e.y1.5*t.defaultLineHeight){r+=Math.floor((s-i.top)/t.defaultLineHeight)*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=f(t,n)}return!0===n?-1:t.length}(o,r,t.state.tabSize)}function wn(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=t.bidiSpans(s),o=t.textDirectionAt(s.from);for(let a=e,l=null;;){let e=Ji(s,r,o,a,i),h=Hi;if(!e){if(s.number==(i?t.state.doc.lines:1))return a;h="\n",s=t.state.doc.line(s.number+(i?1:-1)),r=t.bidiSpans(s),e=A.cursor(i?s.from:s.to)}if(l){if(!l(h))return a}else{if(!n)return e;l=n(h)}a=e}}function vn(t,e,i,n){let s=t.state.facet(Ri).map((e=>e(t)));for(;;){let t=!1;for(let r of s)r.between(i.from-1,i.from+1,((s,r,o)=>{i.from>s&&i.fromi.from?A.cursor(s,1):A.cursor(r,-1),t=!0,o.widget.skipPosition&&(i=o.widget.skipPosition(i,e,n)))}));if(!t)return i}}class yn{constructor(t){this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null;let e=(e,i)=>{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 Cn){let n=Cn[i];t.contentDOM.addEventListener(i,(i=>{Pn(t,i)&&e(n,i)}),_n[i]),this.registeredEvents.push(i)}t.scrollDOM.addEventListener("mousedown",(i=>{if(i.target==t.scrollDOM&&i.clientY>t.contentDOM.getBoundingClientRect().bottom&&(e(Cn.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)}})),De.chrome&&102==De.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,De.safari&&t.contentDOM.addEventListener("input",(()=>null))}setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}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=>{Pn(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){Qi(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){Qi(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||xn.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,be(t.contentDOM,e.key,e.keyCode))}ignoreDuringComposition(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(De.safari&&!De.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 Sn=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],xn="dthko",kn=[16,17,18,20,91,92,224,225];function Qn(t){return.7*Math.max(0,t)+8}class $n{constructor(t,e,i,n){this.view=t,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);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(xt.allowMultipleSelections)&&function(t,e){let i=t.state.facet(pi);return i.length?i[0](e):(De.mac,e.altKey)}(t,e),this.dragMove=function(t,e){let i=t.state.facet(Oi);return i.length?i[0](e):De.mac?!e.altKey:!e.ctrlKey}(t,e),this.dragging=!(!function(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let n=ie(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!=Yn(e))&&null}start(t){!1===this.dragging&&(t.preventDefault(),this.select(t))}move(t){var e;if(0==t.buttons)return this.destroy();if(!1!==this.dragging)return;this.select(this.lastEvent=t);let i=0,n=0,s=(null===(e=this.scrollParent)||void 0===e?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight};t.clientX<=s.left+6?i=-Qn(s.left-t.clientX):t.clientX>=s.right-6&&(i=Qn(t.clientX-s.right)),t.clientY<=s.top+6?n=-Qn(s.top-t.clientY):t.clientY>=s.bottom-6&&(n=Qn(t.clientY-s.bottom)),this.setScrollSpeed(i,n)}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)}select(t){let e=this.style.get(t,this.extend,this.multiple);!this.mustSelect&&e.eq(this.view.state.selection)&&e.main.assoc==this.view.state.selection.main.assoc||this.view.dispatch({selection:e,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.docChanged&&this.dragging&&(this.dragging=this.dragging.map(t.changes)),this.style.update(t)&&setTimeout((()=>this.select(this.lastEvent)),20)}}function Pn(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=Se.get(n))&&i.ignoreEvent(e))return!1;return!0}const Cn=Object.create(null),_n=Object.create(null),Xn=De.ie&&De.ie_version<15||De.ios&&De.webkit_version<604;function Zn(t,e){let i,{state:n}=t,s=1,r=n.toText(e),o=r.lines==n.selection.ranges.length;if(null!=Ln&&n.selection.ranges.every((t=>t.empty))&&Ln==r.toString()){let t=-1;i=n.changeByRange((i=>{let a=n.doc.lineAt(i.from);if(a.from==t)return{range:i};t=a.from;let l=n.toText((o?r.line(s++).text:e)+n.lineBreak);return{changes:{from:a.from,insert:l},range:A.cursor(i.from+l.length)}}))}else i=o?n.changeByRange((t=>{let e=r.line(s++);return{changes:{from:t.from,to:t.to,insert:e.text},range:A.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 A.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 A.cursor(e);0==r?i=1:r==s.length&&(i=-1);let o=r,a=r;i<0?o=f(s.text,r,!1):a=f(s.text,r);let l=n(s.text.slice(o,a));for(;o>0;){let t=f(s.text,o,!1);if(n(s.text.slice(t,o))!=l)break;o=t}for(;a{t.inputState.setSelectionOrigin("select"),27==e.keyCode&&(t.inputState.lastEscPress=Date.now())},Cn.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},Cn.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},_n.touchstart=_n.touchmove={passive:!0},Cn.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return;let i=null;for(let n of t.state.facet(gi))if(i=n(t,e),i)break;if(i||0!=e.button||(i=function(t,e){let i=Vn(t,e),n=Yn(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 a,l=Vn(t,e),h=An(t,l.pos,l.bias,n);if(i.pos!=l.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&&(a=function(t,e){for(let i=0;i=e)return A.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,l.pos))?a:o?s.addRange(h):A.create([h])}}}(t,e)),i){let n=t.root.activeElement!=t.contentDOM;t.inputState.startMouseSelection(new $n(t,e,i,n)),n&&t.observer.ignore((()=>ge(t.contentDOM))),t.inputState.mouseSelection&&t.inputState.mouseSelection.start(e)}};let Tn=(t,e)=>t>=e.top&&t<=e.bottom,Rn=(t,e,i)=>Tn(e,i)&&t>=i.left&&t<=i.right;function En(t,e,i,n){let s=hi.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&&Rn(i,n,o))return-1;let a=s.coordsAt(r,1);return a&&Rn(i,n,a)?1:o&&Tn(n,o)?-1:1}function Vn(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:En(t,i,e.clientX,e.clientY)}}const Mn=De.ie&&De.ie_version<=11;let Dn=null,Wn=0,Un=0;function Yn(t){if(!Mn)return t.detail;let e=Dn,i=Un;return Dn=t,Un=Date.now(),Wn=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Wn+1)%3:1}function qn(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&&r.dragMove?{from:r.dragging.from,to:r.dragging.to}:null,a={from:s,insert:i},l=t.state.changes(o?[o,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(s,-1),head:l.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"})}Cn.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")},Cn.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&&qn(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 qn(t,e,e.dataTransfer.getData("Text"),!0)},Cn.paste=(t,e)=>{if(t.state.readOnly)return e.preventDefault();t.observer.flush();let i=Xn?null:e.clipboardData;i?(Zn(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(),Zn(t,i.value)}),50)}(t)};let Ln=null;Cn.copy=Cn.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;Ln=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 zn=lt.define();function In(t,e){let i=[];for(let n of t.facet(vi)){let s=n(t,e);s&&i.push(s)}return i?t.update({effects:i,annotations:zn.of(!0)}):null}function Bn(t){setTimeout((()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=In(t.state,e);i?t.dispatch(i):t.update([])}}),10)}Cn.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),Bn(t)},Cn.blur=t=>{t.observer.clearSelectionRange(),Bn(t)},Cn.compositionstart=Cn.compositionupdate=t=>{null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},Cn.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,De.chrome&&De.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then((()=>t.observer.flush())):setTimeout((()=>{t.inputState.composing<0&&t.docView.compositionDeco.size&&t.update([])}),50)},Cn.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},Cn.beforeinput=(t,e)=>{var i;let n;if(De.chrome&&De.android&&(n=Sn.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 jn=["pre-wrap","normal","pre-line","break-spaces"];class Nn{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){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return jn.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i-1,a=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,a){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)>Jn&&(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:a,toA:l,fromB:h,toB:c}=n[o],u=s.lineAt(a,Hn.ByPosNoHeight,i.setDoc(e),0,0),d=u.to>=l?u:s.lineAt(l,Hn.ByPosNoHeight,i,0,0);for(c+=d.to-l,l=d.to;o>0&&u.from<=n[o-1].toA;)a=n[o-1].fromA,h=n[o-1].fromB,o--,a2*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 es extends ts{constructor(t,e){super(t,e,ii.Text),this.collapsed=0,this.widgetHeight=0}replace(t,e,i){let n=i[0];return 1==i.length&&(n instanceof es||n instanceof is&&4&n.flags)&&Math.abs(this.length-n.length)<10?(n instanceof is?n=new es(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.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class is 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:a}=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),l=o+r.length*a,h=Math.max(i,t-l/2);return new Fn(r.from,r.length,h,l,ii.Text)}{let n=Math.max(0,Math.min(r-s,Math.floor((t-i)/o))),{from:a,length:l}=e.doc.line(s+n);return new Fn(a,l,i+o*n,o,ii.Text)}}lineAt(t,e,i,n,s){if(e==Hn.ByHeight)return this.blockAt(t,i,n,s);if(e==Hn.ByPosNoHeight){let{from:e,to:n}=i.doc.lineAt(t);return new Fn(e,n-e,0,0,ii.Text)}let{firstLine:r,perLine:o,perChar:a}=this.heightMetrics(i,s),l=i.doc.lineAt(t),h=o+l.length*a,c=l.number-r,u=n+o*c+a*(l.from-s-c);return new Fn(l.from,l.length,Math.max(n,Math.min(u,n+this.height-h)),h,ii.Text)}forEachLine(t,e,i,n,s,r){t=Math.max(t,s),e=Math.min(e,s+this.length);let{firstLine:o,perLine:a,perChar:l}=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+=a*i+l*(t-s-i)}let n=a+l*e.length;r(new Fn(e.from,e.length,c,n,ii.Text)),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 is?i[i.length-1]=new is(t.length+n):i.push(null,new is(n-1))}if(t>0){let e=i[0];e instanceof is?i[0]=new is(t+e.length):i.unshift(new is(t-1),null)}return Kn.of(i)}decomposeLeft(t,e){e.push(new is(t-1),null)}decomposeRight(t,e){e.push(null,new is(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 is(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)>=Jn&&(o=-2);let a=new es(e,s);a.outdated=!1,i.push(a),r+=e+1}r<=s&&i.push(null,new is(s-r).updateHeight(t,r));let a=Kn.of(i);return(o<0||Math.abs(a.height-this.height)>=Jn||Math.abs(o-this.heightMetrics(t,e).perLine)>=Jn)&&(t.heightChanged=!0),a}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class ns 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 l;let h=e==Hn.ByPosNoHeight?Hn.ByPosNoHeight:Hn.ByPos;return a?l.join(this.right.lineAt(o,h,i,r,o)):this.left.lineAt(o,h,i,n,s).join(l)}forEachLine(t,e,i,n,s,r){let o=n+this.left.height,a=s+this.left.length+this.break;if(this.break)t=a&&this.right.forEachLine(t,e,i,o,a,r);else{let l=this.lineAt(a,Hn.ByPos,i,n,s);t=t&&l.from<=e&&r(l),e>l.to&&this.right.forEachLine(l.to+1,e,i,o,a,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&&ss(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,a=null;return n&&n.from<=e+s.length&&n.more?a=s=s.updateHeight(t,e,i,n):s.updateHeight(t,e,i),n&&n.from<=o+r.length&&n.more?a=r=r.updateHeight(t,o,i,n):r.updateHeight(t,o,i),a?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 ss(t,e){let i,n;null==t[e]&&(i=t[e-1])instanceof is&&(n=t[e+1])instanceof is&&t.splice(e-1,3,new is(i.length+1+n.length))}class rs{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 es?i.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new es(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)}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 es(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let i=new is(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 es)return t;let e=new es(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine(),t.type!=ii.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,t.type!=ii.WidgetBefore&&(this.covering=t)}addLineDeco(t,e){let i=this.ensureLine();i.length+=e,i.collapsed+=e,i.widgetHeight=Math.max(i.widgetHeight,t),this.writtenTo=this.pos=this.pos+e}finish(t){let e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof es||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),a=Math.max(a,n.top),l=e==t.parentNode?n.bottom:Math.min(l,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:a-(i.top+e),bottom:Math.max(a,l)-(i.top+e)}}function ls(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class hs{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 Nn(i),this.stateDeco=e.facet(Ti).filter((t=>"function"!=typeof t)),this.heightMap=Kn.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle.setDoc(e.doc),[new Mi(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ni.set(this.lineGaps.map((t=>t.draw(!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 ds(e,i))}}this.viewports=t.sort(((t,e)=>t.from-e.from)),this.scaler=this.heightMap.height<=7e6?gs:new ms(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:bs(t,this.scaler))}))}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=this.state.facet(Ti).filter((t=>"function"!=typeof t));let n=t.changedRanges,s=Mi.extendWithRanges(n,function(t,e,i){let n=new os;return _t.compare(t,e,i,n,0),n.changes}(i,this.stateDeco,t?t.changes:k.empty(this.state.doc.length))),r=this.heightMap.height;this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),s),this.heightMap.height!=r&&(t.flags|=2);let o=s.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.heado.to)||!this.viewportIsAppropriate(o))&&(o=this.getViewport(0,e));let a=!t.changes.empty||2&t.flags||o.from!=this.viewport.from||o.to!=this.viewport.to;this.viewport=o,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(Si)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let i=e.contentDOM,n=window.getComputedStyle(i),s=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Wi.RTL:Wi.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),a=i.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let h=0,c=0,u=parseInt(n.paddingTop)||0,d=parseInt(n.paddingBottom)||0;this.paddingTop==u&&this.paddingBottom==d||(this.paddingTop=u,this.paddingBottom=d,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let f=(this.printing?ls:as)(i,this.paddingTop),p=f.top-this.pixelViewport.top,O=f.bottom-this.pixelViewport.bottom;this.pixelViewport=f;let g=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(g!=this.inView&&(this.inView=g,g&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let m=a.width;if(this.contentDOMWidth==m&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,h|=8),l){let i=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(i)&&(o=!0),o||s.lineWrapping&&Math.abs(m-this.contentDOMWidth)>s.charWidth){let{lineHeight:t,charWidth:n,textHeight:a}=e.docView.measureTextSize();o=t>0&&s.refresh(r,t,n,a,m/n,i),o&&(e.docView.minWidth=0,h|=8)}p>0&&O>0?c=Math.max(p,O):p<0&&O<0&&(c=Math.min(p,O)),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 Mi(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new Gn(n.from,r))}s.heightChanged&&(h|=2)}let b=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return b&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(2&h||b)&&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,a=new ds(n.lineAt(r-1e3*i,Hn.ByHeight,s,0,0).from,n.lineAt(o+1e3*(1-i),Hn.ByHeight,s,0,0).to);if(e){let{head:t}=e.range;if(ta.to){let i,r=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=n.lineAt(t,Hn.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!=Wi.LTR&&!i)return[];let o=[],a=(n,r,l,h)=>{if(r-nn&&tt.from>=l.from&&t.to<=l.to&&Math.abs(t.from-n)t.frome))));if(!d){if(rt.from<=r&&t.to>=r))){let t=e.moveToLineBoundary(A.cursor(r),!1,!0).head;t>n&&(r=t)}d=new hs(n,r,this.gapSize(l,n,r,h))}o.push(d)};for(let t of this.viewportLines){if(t.lengtht.from&&a(t.from,s,t,e),ot.draw(this.heightOracle.lineWrapping)))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];_t.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))||bs(this.heightMap.lineAt(t,Hn.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return bs(this.heightMap.lineAt(this.scaler.fromDOM(t),Hn.ByHeight,this.heightOracle,0,0),this.scaler)}elementAtHeight(t){return bs(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 ds{constructor(t,e){this.from=t,this.to=e}}function fs(t,e,i){let n=[],s=t,r=0;return _t.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 Os(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 gs={toDOM:t=>t,fromDOM:t=>t,scale:1};class ms{constructor(t,e,i){let n=0,s=0,r=0;this.viewports=i.map((({from:i,to:s})=>{let r=e.lineAt(i,Hn.ByPos,t,0,0).top,o=e.lineAt(s,Hn.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=ebs(t,e))):t.type)}const ws=E.define({combine:t=>t.join(" ")}),vs=E.define({combine:t=>t.indexOf(!0)>-1}),ys=It.newName(),Ss=It.newName(),xs=It.newName(),ks={"&light":"."+Ss,"&dark":"."+xs};function Qs(t,e,i){return new It(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 $s=Qs("."+ys,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",borderRadius:"4px",marginTop:"0.5rem",width:"30%",minWidth:"190px",marginLeft:"auto",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&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:"#333338",fontSize:"70%",padding:".2em 1em",borderRadius:"4px"},"&light .cm-button":{background:"#eee"},"&dark .cm-button":{background:"#eee"},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",borderRadius:"0.25rem",border:"1px solid silver",padding:".0em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},ks);class Ps{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;i&&(e.push(new nn(i,n)),s==i&&r==n||e.push(new nn(s,r)));return e}(t),i=new tn(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?A.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||!ne(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||!ne(t.contentDOM,e.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(e.anchorNode,e.anchorOffset);this.newSel=A.single(n,i)}}}function Cs(e,i){let n,{newSel:s}=i,r=e.state.selection.main;if(i.bounds){let{from:s,to:o}=i.bounds,a=r.from,l=null;(8===e.inputState.lastKeyCode&&e.inputState.lastKeyTime>Date.now()-100||De.android&&i.text.length0&&a>0&&t.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if("end"==n){i-=o+Math.max(0,r-Math.min(o,a))-r}if(o=o?r-i:0,a=r+(a-o),o=r}else if(a=a?r-i:0,o=r+(o-a),a=r}return{from:r,toA:o,toB:a}}(e.state.doc.sliceString(s,o,Ki),i.text,a-s,l);h&&(De.chrome&&13==e.inputState.lastKeyCode&&h.toB==h.from+2&&i.text.slice(h.from,h.toB)==Ki+Ki&&h.toB--,n={from:s+h.from,to:s+h.toA,insert:t.of(i.text.slice(h.from,h.toB).split(Ki))})}else s&&(!e.hasFocus&&e.state.facet($i)||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))}:(De.mac||De.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=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}):De.chrome&&n&&n.from==n.to&&n.from==r.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(s&&(s=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}),n){let t=e.state;if(De.ios&&e.inputState.flushIOSKey(e))return!0;if(De.android&&(n.from==r.from&&n.to==r.to&&1==n.insert.length&&2==n.insert.lines&&be(e.contentDOM,"Enter",13)||n.from==r.from-1&&n.to==r.to&&0==n.insert.length&&be(e.contentDOM,"Backspace",8)||n.from==r.from&&n.to==r.to+1&&0==n.insert.length&&be(e.contentDOM,"Delete",46)))return!0;let i,o=n.insert.toString();if(e.state.facet(wi).some((t=>t(e,n.from,n.to,o))))return!0;if(e.inputState.composing>=0&&e.inputState.composing++,n.from>=r.from&&n.to<=r.to&&n.to-n.from>=(r.to-r.from)/3&&(!s||s.main.empty&&s.main.from==n.from+n.insert.length)&&e.inputState.composing<0){let s=r.fromn.to?t.sliceDoc(n.to,r.to):"";i=t.replaceSelection(e.state.toText(s+n.insert.sliceString(0,void 0,e.state.lineBreak)+o))}else{let o=t.changes(n),a=s&&s.main.to<=o.newLength?s.main:void 0;if(t.selection.ranges.length>1&&e.inputState.composing>=0&&n.to<=r.to&&n.to>=r.to-10){let s=e.state.sliceDoc(n.from,n.to),l=on(e)||e.state.doc.lineAt(r.head),h=r.to-n.to,c=r.to-r.from;i=t.changeByRange((i=>{if(i.from==r.from&&i.to==r.to)return{changes:o,range:a||i.map(o)};let u=i.to-h,d=u-s.length;if(i.to-i.from!=c||e.state.sliceDoc(d,u)!=s||l&&i.to>=l.from&&i.from<=l.to)return{range:i};let f=t.changes({from:d,to:u,insert:n.insert}),p=i.to-r.to;return{changes:f,range:a?A.range(Math.max(0,a.anchor+p),Math.max(0,a.head+p)):i.map(f)}}))}else i={changes:o,selection:a&&t.selection.replaceRange(a)}}let a="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,a+=".compose",e.inputState.compositionFirstChange&&(a+=".start",e.inputState.compositionFirstChange=!1)),e.dispatch(i,{scrollIntoView:!0,userEvent:a}),!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 _s={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Xs=De.ie&&De.ie_version<=11;class Zs{constructor(t){this.view=t,this.active=!1,this.selectionRange=new fe,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);(De.ie&&De.ie_version<=11||De.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()})),Xs&&(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")))}),{}),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($i)?i.root.activeElement!=this.dom:!se(i.dom,n))return;let s=n.anchorNode&&i.docView.nearest(n.anchorNode);s&&s.ignoreEvent(t)?e||(this.selectionChanged=!1):(De.ie&&De.ie_version<=11||De.android&&De.chrome)&&!i.state.selection.main.empty&&n.focusNode&&oe(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=De.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,a=t.docView.domAtPos(t.state.selection.main.anchor);oe(a.node,a.offset,r,o)&&([n,s,r,o]=[r,o,n,s]);return{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:o}}(this.view)||ie(t.root);if(!e||this.selectionRange.eq(e))return!1;let i=se(this.dom,e);return i&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let t=this.delayedAndroidKey;t&&(this.clearDelayedAndroidKey(),!this.flush()&&t.force&&be(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&&se(this.dom,this.selectionRange);return t<0&&!n?null:(t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new Ps(this.view,t,e,i))}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=Cs(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.dirty|=4),"childList"==t.type){let i=As(e,t.previousSibling||t.target.previousSibling,-1),n=As(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 As(t,e,i){for(;e;){let n=Se.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 Ts{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),this._dispatch=t.dispatch||(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 us(t.state||xt.create(t)),this.plugins=this.state.facet(Ci).map((t=>new Xi(t)));for(let t of this.plugins)t.update(this);this.observer=new Zs(this),this.inputState=new yn(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new sn(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),t.parent&&t.parent.appendChild(this.dom)}get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}dispatch(...t){this._dispatch(1==t.length&&t[0]instanceof dt?t[0]:this.state.update(...t))}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,a=null;t.some((t=>t.annotation(zn)))?(this.inputState.notifiedFocused=r,o=1):r!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=r,a=In(s,r),a||(o=1));let l=this.observer.delayedAndroidKey,h=null;if(l?(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(xt.phrases)!=this.state.facet(xt.phrases))return this.setState(s);e=Di.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 xi(t.empty?t:A.cursor(t.head,t.head>t.anchor?-1:1))}for(let t of e.effects)t.is(ki)&&(c=t.value)}this.viewState.update(e,c),this.bidiCache=Vs.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),i=this.docView.update(e),this.state.facet(Vi)!=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(ws)!=e.state.facet(ws)&&(this.viewState.mustMeasureContent=!0),(i||n||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!e.empty)for(let t of this.state.facet(bi))t(e);(a||h)&&Promise.resolve().then((()=>{a&&this.state==a.startState&&this.dispatch(a),h&&!Cs(this,h)&&l.force&&be(this.contentDOM,l.key,l.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 us(t),this.plugins=t.facet(Ci).map((t=>new Xi(t))),this.pluginMap.clear();for(let t of this.plugins)t.update(this);this.docView=new sn(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(Ci),i=t.state.facet(Ci);if(e!=i){let n=[];for(let s of i){let i=e.indexOf(s);if(i<0)n.push(new Xi(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.measureScheduled=0,t&&this.observer.forceFlush();let e=null,{scrollHeight:i,scrollTop:n,clientHeight:s}=this.scrollDOM,r=n>i-s-4?i:n;try{for(let t=0;;t++){this.updateState=1;let i=this.viewport,n=this.viewState.lineBlockAtHeight(r),s=this.viewState.measure(this);if(!s&&!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 o=[];4&s||([this.measureRequests,o]=[o,this.measureRequests]);let a=o.map((t=>{try{return t.read(this)}catch(t){return Qi(this.state,t),Es}})),l=Di.create(this,this.state,[]),h=!1,c=!1;l.flags|=s,e?e.flags|=s:e=l,this.updateState=2,l.empty||(this.updatePlugins(l),this.inputState.update(l),this.updateAttrs(),h=this.docView.update(l));for(let t=0;t1||t<-1)&&(this.scrollDOM.scrollTop+=t,c=!0)}if(h&&this.docView.updateSelection(!0),this.viewport.from==i.from&&this.viewport.to==i.to&&!c&&0==this.measureRequests.length)break}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let t of this.state.facet(bi))t(e)}get themeClasses(){return ys+" "+(this.state.facet(vs)?xs:Ss)+" "+this.state.facet(ws)}updateAttrs(){let t=Ms(this,Zi,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet($i)?"true":"false",class:"cm-content",style:`${De.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Ms(this,Ai,e);let i=this.observer.ignore((()=>{let i=ti(this.contentDOM,this.contentAttrs,e),n=ti(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)if(t.is(Ts.announce)){e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(Vi),It.mount(this.root,this.styleModules.concat($s).reverse())}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}}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 vn(this,t,wn(this,t,e,i))}moveByCharSelected(t,e,i){return vn(this,t,wn(this,t,e,i),!0)}moveByGroup(t,e){return vn(this,t,wn(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==wt.Space&&(s=e),s==e}}(this,t.head,e))))}moveToLineBoundary(t,e,i=!0){return function(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=n&&t.lineWrapping?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==Wi.LTR)?e.right-1:e.left+1,y:(r.top+r.bottom)/2});if(null!=o)return A.cursor(o,i?-1:1)}let o=hi.find(t.docView,e.head),a=o?i?o.posAtEnd:o.posAtStart:i?s.to:s.from;return A.cursor(a,i?-1:1)}(this,t,e,i)}moveVertically(t,e,i){return vn(this,t,function(t,e,i,n){let s=e.head,r=i?1:-1;if(s==(i?t.state.doc.length:0))return A.cursor(s,e.assoc);let o,a=e.goalColumn,l=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s),c=t.documentTop;if(h)null==a&&(a=h.left-l.left),o=r<0?h.top:h.bottom;else{let e=t.viewState.lineBlockAt(s);null==a&&(a=Math.min(l.right-l.left,t.defaultCharacterWidth*(s-e.from))),o=(r<0?e.top:e.bottom)+c}let u=l.left+a,d=null!=n?n:t.defaultLineHeight>>1;for(let i=0;;i+=10){let n=o+(d+i)*r,h=mn(t,{x:u,y:n},!1,r);if(nl.bottom||(r<0?hs))return A.cursor(h,e.assoc,void 0,a)}}(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(),mn(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 ue(i,s[Ni.find(s,t-n.from,-1,e)].dir==Wi.LTR==e>0)}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(yi)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Rs)return Fi(t.length);let e=this.textDirectionAt(t.from);for(let i of this.bidiCache)if(i.from==t.from&&i.dir==e)return i.order;let i=function(t,e){let i=t.length,n=e==Ui?1:2,s=e==Ui?2:1;if(!t||1==n&&!ji.test(t))return Fi(i);for(let e=0,s=n,o=n;e=0;t-=3)if(Bi[t+1]==-r){let e=Bi[t+2],i=2&e?n:4&e?1&e?s:n:0;i&&(Gi[a]=Gi[Bi[t]]=i),l=t;break}}else{if(189==Bi.length)break;Bi[l++]=a,Bi[l++]=e,Bi[l++]=h}else if(2==(o=Gi[a])||1==o){let t=o==n;h=t?0:1;for(let e=l-3;e>=0;e-=3){let i=Bi[e+2];if(2&i)break;if(t)Bi[e+2]|=2;else{if(4&i)break;Bi[e+2]|=4}}}for(let t=0;te;){let t=i,n=2!=Gi[--i];for(;i>e&&n==(2!=Gi[i-1]);)i--;o.push(new Ni(i,t,n?2:1))}else o.push(new Ni(e,t,0))}else for(let t=0;tDate.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{ge(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 ki.of(new xi("number"==typeof t?A.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}static domEventHandlers(t){return _i.define((()=>({})),{eventHandlers:t})}static theme(t,e){let i=It.newName(),n=[ws.of(i),Vi.of(Qs(`.${i}`,t))];return e&&e.dark&&n.push(vs.of(!0)),n}static baseTheme(t){return N.lowest(Vi.of(Qs("."+ys,t,ks)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),n=i&&Se.get(i)||Se.get(t);return(null===(e=null==n?void 0:n.rootView)||void 0===e?void 0:e.view)||null}}Ts.styleModule=Vi,Ts.inputHandler=wi,Ts.focusChangeEffect=vi,Ts.perLineTextDirection=yi,Ts.exceptionSink=mi,Ts.updateListener=bi,Ts.editable=$i,Ts.mouseSelectionStyle=gi,Ts.dragMovesSelection=Oi,Ts.clickAddsSelectionRange=pi,Ts.decorations=Ti,Ts.atomicRanges=Ri,Ts.scrollMargins=Ei,Ts.darkTheme=vs,Ts.contentAttributes=Ai,Ts.editorAttributes=Zi,Ts.lineWrapping=Ts.contentAttributes.of({class:"cm-lineWrapping"}),Ts.announce=ut.define();const Rs=4096,Es={};class Vs{constructor(t,e,i,n){this.from=t,this.to=e,this.dir=i,this.order=n}static update(t,e){if(e.empty)return t;let i=[],n=t.length?t[t.length-1].dir:Wi.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&&Je(r,i)}return i}const Ds=De.mac?"mac":De.windows?"win":De.linux?"linux":"key";function Ws(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 Us=N.default(Ts.domEventHandlers({keydown:(t,e)=>Bs(Ls(e.state),t,e,"editor")})),Ys=E.define({enables:Us}),qs=new WeakMap;function Ls(t){let e=t.facet(Ys),i=qs.get(e);return i||qs.set(e,i=function(t,e=Ds){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)=>{var a,l;let h=i[t]||(i[t]=Object.create(null)),c=n.split(/ (?!$)/).map((t=>function(t,e){const i=t.split(/-(?!$)/);let n,s,r,o,a=i[i.length-1];"Space"==a&&(a=" ");for(let t=0;t{let n=zs={view:e,prefix:i,scope:t};return setTimeout((()=>{zs==n&&(zs=null)}),Is),!0}]})}let u=c.join(" ");s(u,!1);let d=h[u]||(h[u]={preventDefault:!1,run:(null===(l=null===(a=h._any)||void 0===a?void 0:a.run)||void 0===l?void 0:l.slice())||[]});r&&d.run.push(r),o&&(d.preventDefault=!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,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.shift&&r(e,"Shift-"+s,n.shift,n.preventDefault)}return i}(e.reduce(((t,e)=>t.concat(e)),[]))),i}let zs=null;const Is=4e3;function Bs(t,e,i,n){let s=function(t){var e=!(Kt&&(t.ctrlKey||t.altKey||t.metaKey)||Jt&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?Gt:Nt)[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=v(b(s,0))==s.length&&" "!=s,o="",a=!1;zs&&zs.view==i&&zs.scope==n&&(o=zs.prefix+" ",(a=kn.indexOf(e.keyCode)<0)&&(zs=null));let l,h,c=new Set,u=t=>{if(t){for(let n of t.run)if(!c.has(n)&&(c.add(n),n(i,e)))return!0;t.preventDefault&&(a=!0)}return!1},d=t[n];if(d){if(u(d[o+Ws(s,e,!r)]))return!0;if(r&&(e.altKey||e.metaKey||e.ctrlKey)&&!(De.windows&&e.ctrlKey&&e.altKey)&&(l=Nt[e.keyCode])&&l!=s){if(u(d[o+Ws(l,e,!0)]))return!0;if(e.shiftKey&&(h=Gt[e.keyCode])!=s&&h!=l&&u(d[o+Ws(h,e,!1)]))return!0}else if(r&&e.shiftKey&&u(d[o+Ws(s,e,!0)]))return!0;if(u(d._any))return!0}return a}class js{constructor(t,e,i,n,s){this.className=t,this.left=e,this.top=i,this.width=n,this.height=s}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className==this.className&&(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",null!=this.width&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,i){if(i.empty){let n=t.coordsAtPos(i.head,i.assoc||1);if(!n)return[];let s=Ns(t);return[new js(e,n.left-s.left,n.top-s.top,null,n.bottom-n.top)]}return function(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];let n=Math.max(i.from,t.viewport.from),s=Math.min(i.to,t.viewport.to),r=t.textDirection==Wi.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=Ns(t),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),u=a.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),d=a.right-(c?parseInt(c.paddingRight):0),f=Fs(t,n),p=Fs(t,s),O=f.type==ii.Text?f:null,g=p.type==ii.Text?p:null;t.lineWrapping&&(O&&(O=Gs(t,n,O)),g&&(g=Gs(t,s,g)));if(O&&g&&O.from==g.from)return b(w(i.from,i.to,O));{let e=O?w(i.from,null,O):v(f,!1),n=g?w(null,i.to,g):v(p,!0),s=[];return(O||f).to<(g||p).from-1?s.push(m(u,e.bottom,d,n.top)):e.bottomh&&n.from=r)break;a>s&&l(Math.max(t,s),null==e&&t<=h,Math.min(a,r),null==i&&a>=c,o.dir)}if(s=n.to+1,s>=r)break}return 0==a.length&&l(h,null==e,c,null==i,t.textDirection),{top:s,bottom:o,horizontal:a}}function v(t,e){let i=a.top+(e?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]}}}(t,e,i)}}function Ns(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Wi.LTR?e.left:e.right-t.scrollDOM.clientWidth)-t.scrollDOM.scrollLeft,top:e.top-t.scrollDOM.scrollTop}}function Gs(t,e,i){let n=A.cursor(e);return{from:Math.max(i.from,t.moveToLineBoundary(n,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(n,!0,!0).from),type:ii.Text}}function Fs(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==ii.Text))return t;return i}class Hs{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),e.above&&this.dom.classList.add("cm-layer-above"),e.class&&this.dom.classList.add(e.class),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(Js)!=t.state.facet(Js)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&t.view.requestMeasure(this.measureReq)}setOrder(t){let e=0,i=t.facet(Js);for(;e{return i=t,n=this.drawn[e],!(i.constructor==n.constructor&&i.eq(n));var i,n}))){let e=this.dom.firstChild,i=0;for(let n of t)n.update&&e&&n.constructor&&this.drawn[i].constructor&&n.update(e,this.drawn[i])?(e=e.nextSibling,i++):this.dom.insertBefore(n.draw(),e);for(;e;){let t=e.nextSibling;e.remove(),e=t}this.drawn=t}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Js=E.define();function Ks(t){return[_i.define((e=>new Hs(e,t))),Js.of(t)]}const tr=!De.ios,er=E.define({combine:t=>kt(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})});function ir(t={}){return[er.of(t),sr,or,lr,Si.of(!0)]}function nr(t){return t.startState.facet(er)!=t.state.facet(er)}const sr=Ks({above:!0,markers(t){let{state:e}=t,i=e.facet(er),n=[];for(let s of e.selection.ranges){let r=s==e.selection.main;if(s.empty?!r||tr:i.drawRangeCursor){let e=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",i=s.empty?s:A.cursor(s.head,s.head>s.anchor?-1:1);for(let s of js.forRange(t,e,i))n.push(s)}}return n},update(t,e){t.transactions.some((t=>t.selection))&&(e.style.animationName="cm-blink"==e.style.animationName?"cm-blink2":"cm-blink");let i=nr(t);return i&&rr(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){rr(e.state,t)},class:"cm-cursorLayer"});function rr(t,e){e.style.animationDuration=t.facet(er).cursorBlinkRate+"ms"}const or=Ks({above:!1,markers:t=>t.state.selection.ranges.map((e=>e.empty?[]:js.forRange(t,"cm-selectionBackground",e))).reduce(((t,e)=>t.concat(e))),update:(t,e)=>t.docChanged||t.selectionSet||t.viewportChanged||nr(t),class:"cm-selectionLayer"}),ar={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};tr&&(ar[".cm-line"].caretColor="transparent !important");const lr=N.highest(Ts.theme(ar)),hr=ut.define({map:(t,e)=>null==t?null:e.mapPos(t)}),cr=q.define({create:()=>null,update:(t,e)=>(null!=t&&(t=e.changes.mapPos(t)),e.effects.reduce(((t,e)=>e.is(hr)?e.value:t),t))}),ur=_i.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let i=t.state.field(cr);null==i?null!=this.cursor&&(null===(e=this.cursor)||void 0===e||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(cr)!=i||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let t=this.view.state.field(cr),e=null!=t&&this.view.coordsAtPos(t);if(!e)return null;let i=this.view.scrollDOM.getBoundingClientRect();return{left:e.left-i.left+this.view.scrollDOM.scrollLeft,top:e.top-i.top+this.view.scrollDOM.scrollTop,height:e.bottom-e.top}}drawCursor(t){this.cursor&&(t?(this.cursor.style.left=t.left+"px",this.cursor.style.top=t.top+"px",this.cursor.style.height=t.height+"px"):this.cursor.style.left="-100000px")}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(cr)!=t&&this.view.dispatch({effects:hr.of(t)})}},{eventHandlers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){t.target!=this.view.contentDOM&&this.view.contentDOM.contains(t.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function dr(){return[cr,ur]}function fr(t,e,i,n,s){e.lastIndex=0;for(let r,o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)if(!o.lineBreak)for(;r=e.exec(o.value);)s(a+r.index,r)}class pr{constructor(t){const{regexp:e,decoration:i,decorate:n,boundary:s,maxLength:r=1e3}=t;if(!e.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=e,n)this.addMatch=(t,e,i,s)=>n(s,i,i+t[0].length,t,e);else if("function"==typeof i)this.addMatch=(t,e,n,s)=>{let r=i(t,e,n);r&&s(n,n+t[0].length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(t,e,n,s)=>s(n,n+t[0].length,i)}this.boundary=s,this.maxLength=r}createDeco(t){let e=new Xt,i=e.add.bind(e);for(let{from:e,to:n}of function(t,e){let i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;let n=[];for(let{from:s,to:r}of i)s=Math.max(t.state.doc.lineAt(s).from,s-e),r=Math.min(t.state.doc.lineAt(r).to,r+e),n.length&&n[n.length-1].to>=s?n[n.length-1].to=r:n.push({from:s,to:r});return n}(t,this.maxLength))fr(t.state.doc,this.regexp,e,n,((e,n)=>this.addMatch(n,t,e,i)));return e.finish()}updateDeco(t,e){let i=1e9,n=-1;return t.docChanged&&t.changes.iterChanges(((e,s,r,o)=>{o>t.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e}updateRange(t,e,i,n){for(let s of t.visibleRanges){let r=Math.max(s.from,i),o=Math.min(s.to,n);if(o>r){let i=t.state.doc.lineAt(r),n=i.toi.from;r--)if(this.boundary.test(i.text[r-1-i.from])){a=r;break}for(;oc.push(i.range(t,e));if(i==n)for(this.regexp.lastIndex=a-i.from;(h=this.regexp.exec(i.text))&&h.indexthis.addMatch(i,t,e,u)));e=e.update({filterFrom:a,filterTo:l,filter:(t,e)=>tl,add:c})}}return e}}const Or=null!=/x/.unicode?"gu":"g",gr=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",Or),mr={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let br=null;const wr=E.define({combine(t){let e=kt(t,{render:null,specialChars:gr,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==br&&"undefined"!=typeof document&&document.body){let e=document.body.style;br=null!=(null!==(t=e.tabSize)&&void 0!==t?t:e.MozTabSize)}return br||!1}())&&(e.specialChars=new RegExp("\t|"+e.specialChars.source,Or)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Or)),e}});function vr(t={}){return[wr.of(t),yr||(yr=_i.fromClass(class{constructor(t){this.view=t,this.decorations=ni.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(wr)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new pr({regexp:t.specialChars,decoration:(e,i,n)=>{let{doc:s}=i.state,r=b(e[0],0);if(9==r){let t=s.lineAt(n),e=i.state.tabSize,r=Yt(t.text,e,n-t.from);return ni.replace({widget:new xr((e-r%e)*this.view.defaultCharacterWidth)})}return this.decorationCache[r]||(this.decorationCache[r]=ni.replace({widget:new Sr(t,r)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(wr);t.startState.facet(wr)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))]}let yr=null;class Sr extends ei{constructor(t,e){super(),this.options=t,this.code=e}eq(t){return t.code==this.code}toDOM(t){let e=function(t){return t>=32?"•":10==t?"␤":String.fromCharCode(9216+t)}(this.code),i=t.state.phrase("Control character")+" "+(mr[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,i,e);if(n)return n;let s=document.createElement("span");return s.textContent=e,s.title=i,s.setAttribute("aria-label",i),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class xr extends ei{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent="\t",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}class kr extends ei{constructor(t){super(),this.content=t}toDOM(){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):this.content),"string"==typeof this.content?t.setAttribute("aria-label","placeholder "+this.content):t.setAttribute("aria-hidden","true"),t}ignoreEvent(){return!1}}const Qr="-10000px";class $r{constructor(t,e,i){this.facet=e,this.createTooltipView=i,this.input=t.state.facet(e),this.tooltips=this.input.filter((t=>t)),this.tooltipViews=this.tooltips.map(i)}update(t){var e;let i=t.state.facet(this.facet),n=i.filter((t=>t));if(i===this.input){for(let e of this.tooltipViews)e.update&&e.update(t);return!1}let s=[];for(let e=0;e{var e,i,n;return{position:De.ios?"absolute":(null===(e=t.find((t=>t.position)))||void 0===e?void 0:e.position)||"fixed",parent:(null===(i=t.find((t=>t.parent)))||void 0===i?void 0:i.parent)||null,tooltipSpace:(null===(n=t.find((t=>t.tooltipSpace)))||void 0===n?void 0:n.tooltipSpace)||Pr}}}),_r=new WeakMap,Xr=_i.fromClass(class{constructor(t){this.view=t,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(Cr);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new $r(t,Tr,(t=>this.createTooltip(t))),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout((()=>{this.measureTimeout=-1,this.maybeMeasure()}),50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t);e&&this.observeIntersection();let i=e||t.geometryChanged,n=t.state.facet(Cr);if(n.position!=this.position){this.position=n.position;for(let t of this.manager.tooltipViews)t.dom.style.position=this.position;i=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let t of this.manager.tooltipViews)this.container.appendChild(t.dom);i=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure()}createTooltip(t){let e=t.create(this.view);if(e.dom.classList.add("cm-tooltip"),t.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",e.dom.appendChild(t)}return e.dom.style.position=this.position,e.dom.style.top=Qr,this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var t,e;this.view.win.removeEventListener("resize",this.measureSoon);for(let e of this.manager.tooltipViews)e.dom.remove(),null===(t=e.destroy)||void 0===t||t.call(e);null===(e=this.intersectionObserver)||void 0===e||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=this.view.dom.getBoundingClientRect();return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map(((t,e)=>{let i=this.manager.tooltipViews[e];return i.getCoords?i.getCoords(t.pos):this.view.coordsAtPos(t.pos)})),size:this.manager.tooltipViews.map((({dom:t})=>t.getBoundingClientRect())),space:this.view.state.facet(Cr).tooltipSpace(this.view)}}writeMeasure(t){var e;let{editor:i,space:n}=t,s=[];for(let r=0;r=Math.min(i.bottom,n.bottom)||h.rightMath.min(i.right,n.right)+.1){l.style.top=Qr;continue}let u=o.arrow?a.dom.querySelector(".cm-tooltip-arrow"):null,d=u?7:0,f=c.right-c.left,p=null!==(e=_r.get(a))&&void 0!==e?e:c.bottom-c.top,O=a.offset||Ar,g=this.view.textDirection==Wi.LTR,m=c.width>n.right-n.left?g?n.left:n.right-c.width:g?Math.min(h.left-(u?14:0)+O.x,n.right-f):Math.max(n.left,h.left-f+(u?14:0)-O.x),b=!!o.above;!o.strictSide&&(b?h.top-(c.bottom-c.top)-O.yn.bottom)&&b==n.bottom-h.bottom>h.top-n.top&&(b=!b);let w=(b?h.top-n.top:n.bottom-h.bottom)-d;if(wm&&t.topv&&(v=b?t.top-p-2-d:t.bottom+d+2);"absolute"==this.position?(l.style.top=v-t.parent.top+"px",l.style.left=m-t.parent.left+"px"):(l.style.top=v+"px",l.style.left=m+"px"),u&&(u.style.left=h.left+(g?O.x:-O.x)-(m+14-7)+"px"),!0!==a.overlap&&s.push({left:m,top:v,right:y,bottom:v+p}),l.classList.toggle("cm-tooltip-above",b),l.classList.toggle("cm-tooltip-below",!b),a.positioned&&a.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=Qr}},{eventHandlers:{scroll(){this.maybeMeasure()}}}),Zr=Ts.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Ar={x:0,y:0},Tr=E.define({enables:[Xr,Zr]});function Rr(t,e){let i=t.plugin(Xr);if(!i)return null;let n=i.manager.tooltips.indexOf(e);return n<0?null:i.manager.tooltipViews[n]}const Er=E.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 Vr(t,e){let i=t.plugin(Mr),n=i?i.specs.indexOf(e):-1;return n>-1?i.panels[n]:null}const Mr=_i.fromClass(class{constructor(t){this.input=t.state.facet(Ur),this.specs=this.input.filter((t=>t)),this.panels=this.specs.map((e=>e(t)));let e=t.state.facet(Er);this.top=new Dr(t,!0,e.topContainer),this.bottom=new Dr(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(Er);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Dr(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Dr(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(Ur);if(i!=this.input){let e=i.filter((t=>t)),n=[],s=[],r=[],o=[];for(let i of e){let e,a=this.specs.indexOf(i);a<0?(e=i(t.view),o.push(e)):(e=this.panels[a],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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}}))});class Dr{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=Wr(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=Wr(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 Wr(t){let e=t.nextSibling;return t.remove(),e}const Ur=E.define({enables:Mr});class Yr extends Qt{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Yr.prototype.elementClass="",Yr.prototype.toDOM=void 0,Yr.prototype.mapMode=S.TrackBefore,Yr.prototype.startSide=Yr.prototype.endSide=-1,Yr.prototype.point=!0;const qr=E.define(),Lr={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>_t.empty,lineMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},zr=E.define();function Ir(t){return[jr(),zr.of(Object.assign(Object.assign({},Lr),t))]}const Br=E.define({combine:t=>t.some((t=>t))});function jr(t){let e=[Nr];return t&&!1===t.fixed&&e.push(Br.of(!0)),e}const Nr=_i.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+"px",this.gutters=t.state.facet(zr).map((e=>new Jr(t,e)));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!t.state.facet(Br),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(Br)!=!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=_t.iter(this.view.state.facet(qr),this.view.viewport.from),n=[],s=this.gutters.map((t=>new Hr(t,this.view.viewport,-this.view.documentPadding.top)));for(let t of this.view.viewportLineBlocks){let e;if(Array.isArray(t.type)){for(let i of t.type)if(i.type==ii.Text){e=i;break}}else e=t.type==ii.Text?t:void 0;if(e){n.length&&(n=[]),Fr(i,n,t.from);for(let t of s)t.line(this.view,e,n)}}for(let t of s)t.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(zr),i=t.state.facet(zr),n=t.docChanged||t.heightChanged||t.viewportChanged||!_t.eq(t.startState.facet(qr),t.state.facet(qr),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 Jr(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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&0!=i.gutters.length&&i.fixed?e.textDirection==Wi.LTR?{left:i.dom.offsetWidth}:{right:i.dom.offsetWidth}:null}))});function Gr(t){return Array.isArray(t)?t:[t]}function Fr(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class Hr{constructor(t,e,i){this.gutter=t,this.height=i,this.i=0,this.cursor=_t.iter(t.markers,e.from)}line(t,e,i){let n=[];Fr(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;if(0==n.length&&!r.config.renderEmptyElements)return;let o=e.top-this.height;if(this.i==r.elements.length){let i=new Kr(t,e.height,o,n);r.elements.push(i),r.dom.appendChild(i.dom)}else r.elements[this.i].update(t,e.height,o,n);this.height=e.bottom,this.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 Jr{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=Gr(e.markers(t)),e.initialSpacer&&(this.spacer=new Kr(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=Gr(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!_t.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 Kr{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.dom.style.height=(this.height=e)+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),function(t,e){if(t.length!=e.length)return!1;for(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 io extends Yr{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function no(t,e){return t.state.facet(eo).formatNumber(e,t.state)}const so=zr.compute([eo],(t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:t=>t.state.facet(to),lineMarker:(t,e,i)=>i.some((t=>t.toDOM))?null:new io(no(t,t.state.doc.lineAt(e.from).number)),lineMarkerChange:t=>t.startState.facet(eo)!=t.state.facet(eo),initialSpacer:t=>new io(no(t,ro(t.state.doc.lines))),updateSpacer(t,e){let i=no(e.view,ro(e.view.state.doc.lines));return i==t.number?t:new io(i)},domEventHandlers:t.facet(eo).domEventHandlers})));function ro(t){let e=9;for(;e{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=fo.match(t)),e=>{let i=t(e);return void 0===i?null:[this,i]}}}ho.closedBy=new ho({deserialize:t=>t.split(" ")}),ho.openedBy=new ho({deserialize:t=>t.split(" ")}),ho.group=new ho({deserialize:t=>t.split(" ")}),ho.contextHash=new ho({perNode:!0}),ho.lookAhead=new ho({perNode:!0}),ho.mounted=new ho({perNode:!0});class co{constructor(t,e,i){this.tree=t,this.overlay=e,this.parser=i}}const uo=Object.create(null);class fo{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):uo,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),n=new fo(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(ho.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(ho.group),n=-1;n<(i?i.length:0);n++){let s=e[n<0?t.name:i[n]];if(s)return s}}}}fo.none=new fo("",Object.create(null),0,8);class po{constructor(t){this.types=t;for(let e=0;e=n&&(r.type.isAnonymous||!1!==e(r))){if(r.firstChild())continue;t=!0}for(;t&&i&&!r.type.isAnonymous&&i(r),!r.nextSibling();){if(!r.parent())return;t=!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:To(fo.none,this.children,this.positions,0,this.children.length,0,this.length,((t,e,i)=>new bo(this.type,t,e,i,this.propValues)),t.makeTree||((t,e,i)=>new bo(fo.none,t,e,i)))}static build(t){return function(t){var e;let{buffer:i,nodeSet:n,maxBufferLength:s=oo,reused:r=[],minRepeatType:o=n.types.length}=t,a=Array.isArray(i)?new wo(i,i.length):i,l=n.types,h=0,c=0;function u(t,e,i,m,b){let{id:w,start:v,end:y,size:S}=a,x=c;for(;S<0;){if(a.next(),-1==S){let e=r[w];return i.push(e),void m.push(v-t)}if(-3==S)return void(h=w);if(-4==S)return void(c=w);throw new RangeError(`Unrecognized record size: ${S}`)}let k,Q,$=l[w],P=v-t;if(y-v<=s&&(Q=O(a.pos-e,b))){let e=new Uint16Array(Q.size-Q.skip),i=a.pos-Q.size,s=e.length;for(;a.pos>i;)s=g(Q.start,e,s);k=new vo(e,y-Q.start,n),P=Q.start-t}else{let t=a.pos-S;a.next();let e=[],i=[],n=w>=o?w:-1,r=0,l=y;for(;a.pos>t;)n>=0&&a.id==n&&a.size>=0?(a.end<=l-s&&(f(e,i,v,r,a.end,l,n,x),r=e.length,l=a.end),a.next()):u(v,t,e,i,n);if(n>=0&&r>0&&r-1&&r>0){let t=d($);k=To($,e,i,0,e.length,0,y-v,t,t)}else k=p($,e,i,y-v,x-y)}i.push(k),m.push(P)}function d(t){return(e,i,n)=>{let s,r,o=0,a=e.length-1;if(a>=0&&(s=e[a])instanceof bo){if(!a&&s.type==t&&s.length==n)return s;(r=s.prop(ho.lookAhead))&&(o=i[a]+s.length+r)}return p(t,e,i,n,o)}}function f(t,e,i,s,r,o,a,l){let h=[],c=[];for(;t.length>s;)h.push(t.pop()),c.push(e.pop()+i-r);t.push(p(n.types[a],h,c,o-r,l-o)),e.push(r-i)}function p(t,e,i,n,s=0,r){if(h){let t=[ho.contextHash,h];r=r?[t].concat(r):[t]}if(s>25){let t=[ho.lookAhead,s];r=r?[t].concat(r):[t]}return new bo(t,e,i,n,r)}function O(t,e){let i=a.fork(),n=0,r=0,l=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=l,l+=4,n+=4,i.next();continue}let a=i.pos-t;if(t<0||a=o?4:0,d=i.start;for(i.next();i.pos>a;){if(i.size<0){if(-3!=i.size)break t;u+=4}else i.id>=o&&(u+=4);i.next()}r=d,n+=t,l+=u}return(e<0||n==t)&&(c.size=n,c.start=r,c.skip=l),c.size>4?c:void 0}function g(t,e,i){let{id:n,start:s,end:r,size:l}=a;if(a.next(),l>=0&&n4){let n=a.pos-(l-4);for(;a.pos>n;)i=g(t,e,i)}e[--i]=o,e[--i]=r-t,e[--i]=s-t,e[--i]=n}else-3==l?h=n:-4==l&&(c=n);return i}let m=[],b=[];for(;a.pos>0;)u(t.start||0,t.bufferStart||0,m,b,-1);let w=null!==(e=t.length)&&void 0!==e?e:m.length?b[0]+m[0].length:0;return new bo(l[t.topID],m.reverse(),b.reverse(),w)}(t)}}bo.empty=new bo(fo.none,[],[],0);class wo{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 wo(this.buffer,this.index)}}class vo{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return fo.none}toString(){let t=[];for(let e=0;e0));a=r[a+3]);return o}slice(t,e,i){let n=this.buffer,s=new Uint16Array(e-t),r=0;for(let o=t,a=0;o=e&&ie;case 1:return i<=e&&n>e;case 2:return n>e;case 4:return!0}}function So(t,e){let i=t.childBefore(e);for(;i;){let e=i.lastChild;if(!e||e.to!=i.to)break;e.type.isError&&e.from==e.to?(t=i,i=e.prevSibling):i=e}return t}function xo(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!=l;t+=e){let l=o[t],h=a[t]+r.from;if(yo(n,i,h,h+l.length))if(l instanceof vo){if(s&mo.ExcludeBuffers)continue;let o=l.findChild(0,l.buffer.length,e,i-h,n);if(o>-1)return new Co(new Po(r,l,t,h),null,o)}else if(s&mo.IncludeAnonymous||!l.type.isAnonymous||Xo(l)){let o;if(!(s&mo.IgnoreMounts)&&l.props&&(o=l.prop(ho.mounted))&&!o.overlay)return new ko(o.tree,h,t,r);let a=new ko(l,h,t,r);return s&mo.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(e<0?l.children.length-1:0,e,i,n)}}if(s&mo.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&mo.IgnoreOverlays)&&(n=this._tree.prop(ho.mounted))&&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 ko(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}cursor(t=0){return new _o(this,t)}get tree(){return this._tree}toTree(){return this._tree}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return So(this,t)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}toString(){return this._tree.toString()}get node(){return this}matchContext(t){return $o(this,t)}}function Qo(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 $o(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 Po{constructor(t,e,i,n){this.parent=t,this.buffer=e,this.index=i,this.start=n}}class Co{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){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 Co(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&mo.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 Co(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 Co(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 Co(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}cursor(t=0){return new _o(this,t)}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 bo(this.type,t,e,this.to-this.from)}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return So(this,t)}toString(){return this.context.buffer.childString(this.index)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}get node(){return this}matchContext(t){return $o(this,t)}}class _o{get name(){return this.type.name}constructor(t,e=0){if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof ko)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let e=t._parent;e;e=e._parent)this.stack.unshift(e.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return!!t&&(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0)}yieldBuf(t,e){this.index=t;let{start:i,buffer:n}=this.buffer;return this.type=e||n.set.types[n.buffer[t]],this.from=i+n.buffer[t+1],this.to=i+n.buffer[t+2],!0}yield(t){return!!t&&(t instanceof ko?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,i){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,i,this.mode));let{buffer:n}=this.buffer,s=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.buffer.start,i);return!(s<0)&&(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,i=this.mode){return this.buffer?!(i&mo.ExcludeBuffers)&&this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&mo.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&mo.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode));let{buffer:e}=this.buffer,i=this.stack.length-1;if(t<0){let t=i<0?0:this.stack[i]+4;if(this.index!=t)return this.yieldBuf(e.findChild(t,this.index,-1,0,4))}else{let t=e.buffer[this.index+3];if(t<(i<0?e.buffer.length:e.buffer[this.stack[i]+3]))return this.yieldBuf(t)}return i<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,i,{buffer:n}=this;if(n){if(t>0){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&mo.IncludeAnonymous||t instanceof vo||!t.type.isAnonymous||Xo(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 $o(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 Xo(t){return t.children.some((t=>t instanceof vo||!t.type.isAnonymous||Xo(t)))}const Zo=new WeakMap;function Ao(t,e){if(!t.isAnonymous||e instanceof vo||e.type!=t)return 1;let i=Zo.get(e);if(null==i){i=1;for(let n of e.children){if(n.type!=t||!(n instanceof bo)){i=1;break}i+=Ao(t,n)}Zo.set(e,i)}return i}function To(t,e,i,n,s,r,o,a,l){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]+a);continue}u.push(i[s])}else{let e=n[h-1]+i[h-1].length-f;u.push(To(t,i,n,s,h,f,e,null,l))}d.push(f+a-r)}}(e,i,n,s,0),(a||l)(u,d,o)}class Ro{constructor(){this.map=new WeakMap}setBuffer(t,e,i){let n=this.map.get(t);n||this.map.set(t,n=new Map),n.set(e,i)}getBuffer(t,e){let i=this.map.get(t);return i&&i.get(e)}set(t,e){t instanceof Co?this.setBuffer(t.context.buffer,t.index,e):t instanceof ko&&this.map.set(t.tree,e)}get(t){return t instanceof Co?this.getBuffer(t.context.buffer,t.index):t instanceof ko?this.map.get(t.tree):void 0}cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}}class Eo{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 Eo(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,a=0,l=0;;o++){let h=o=i)for(;r&&r.from=e.from||c<=e.to||l){let t=Math.max(e.from,a)-l,i=Math.min(e.to,c)-l;e=t>=i?null:new Eo(t,i,e.tree,e.offset+l,o>0,!!h)}if(e&&n.push(e),r.to>c)break;r=snew lo(t.from,t.to))):[new lo(0,0)]:[new lo(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 Mo{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)}}function Do(t){return(e,i,n,s)=>new qo(e,t,i,n,s)}class Wo{constructor(t,e,i,n,s){this.parser=t,this.parse=e,this.overlay=i,this.target=n,this.ranges=s}}class Uo{constructor(t,e,i,n,s,r,o){this.parser=t,this.predicate=e,this.mounts=i,this.index=n,this.start=s,this.target=r,this.prev=o,this.depth=0,this.ranges=[]}}const Yo=new ho({perNode:!0});class qo{constructor(t,e,i,n,s){this.nest=e,this.input=i,this.fragments=n,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=t}advance(){if(this.baseParse){let t=this.baseParse.advance();if(!t)return null;if(this.baseParse=null,this.baseTree=t,this.startInner(),null!=this.stoppedAt)for(let t of this.inner)t.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let t=this.baseTree;return null!=this.stoppedAt&&(t=new bo(t.type,t.children,t.positions,t.length,t.propValues.concat([[Yo,this.stoppedAt]]))),t}let t=this.inner[this.innerDone],e=t.parse.advance();if(e){this.innerDone++;let i=Object.assign(Object.create(null),t.target.props);i[ho.mounted.id]=new co(e,t.overlay,t.parser),t.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let t=this.input.length;for(let e=this.innerDone;et.frag.from<=n.from&&t.frag.to>=n.to&&t.mount.overlay));if(t)for(let i of t.mount.overlay){let s=i.from+t.pos,r=i.to+t.pos;s>=n.from&&r<=n.to&&!e.ranges.some((t=>t.froms))&&e.ranges.push({from:s,to:r})}}a=!1}else if(i&&(r=Lo(i.ranges,n.from,n.to)))a=2!=r;else if(!n.type.isAnonymous&&n.fromnew lo(t.from-n.from,t.to-n.from))):null,n.tree,t)),s.overlay?t.length&&(i={ranges:t,depth:0,prev:i}):a=!1}}else e&&(o=e.predicate(n))&&(!0===o&&(o=new lo(n.from,n.to)),o.fromnew lo(t.from-e.start,t.to-e.start))),e.target,t)),e=e.prev}i&&! --i.depth&&(i=i.prev)}}}}function Lo(t,e,i){for(let n of t){if(n.from>=i)break;if(n.to>e)return n.from<=e&&n.to>=i?2:1}return 0}function zo(t,e,i,n,s,r){if(e=e.to);n++);let o=s.children[n],a=o.buffer;s.children[n]=function t(i,n,s,l,h){let c=i;for(;a[c+2]+r<=e.from;)c=a[c+3];let u=[],d=[];zo(o,i,c,u,d,l);let f=a[c+1],p=a[c+2],O=f+r==e.from&&p+r==e.to&&a[c]==e.type.id;return u.push(O?e.toTree():t(c+4,a[c+3],o.set.types[a[c]],f,p-f)),d.push(f-l),zo(o,a[c+3],n,u,d,l),new bo(s,u,d,h)}(0,a.length,fo.none,0,o.length);for(let n=0;n<=i;n++)t.childAfter(e.from)}class Bo{constructor(t,e){this.offset=e,this.done=!1,this.cursor=t.cursor(mo.IncludeAnonymous|mo.IgnoreMounts)}moveTo(t){let{cursor:e}=this,i=t-this.offset;for(;!this.done&&e.from=t&&e.enter(i,1,mo.IgnoreOverlays|mo.ExcludeBuffers)||e.next(!1)||(this.done=!0)}hasNode(t){if(this.moveTo(t.from),!this.done&&this.cursor.from+this.offset==t.from&&this.cursor.tree)for(let e=this.cursor.tree;;){if(e==t.tree)return!0;if(!(e.children.length&&0==e.positions[0]&&e.children[0]instanceof bo))break;e=e.children[0]}return!1}}let jo=class{constructor(t){var e;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){let i=this.curFrag=t[0];this.curTo=null!==(e=i.tree.prop(Yo))&&void 0!==e?e:i.to,this.inner=new Bo(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t)}nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=null!==(t=e.tree.prop(Yo))&&void 0!==t?t:e.to,this.inner=new Bo(e.tree,-e.offset)}}findMounts(t,e){var i;let n=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let t=this.inner.cursor.node;t;t=t.parent){let s=null===(i=t.tree)||void 0===i?void 0:i.prop(ho.mounted);if(s&&s.parser==e)for(let e=this.fragI;e=t.to)break;i.tree==this.curFrag.tree&&n.push({frag:i,pos:t.from-i.offset,mount:s})}}}return n}};function No(t,e){let i=null,n=e;for(let s=1,r=0;s=a)break;t.to<=o||(i||(n=i=e.slice()),t.froma&&i.splice(r+1,0,new lo(a,t.to))):t.to>a?i[r--]=new lo(a,t.to):i.splice(r--,1))}}return n}function Go(t,e,i,n){let s=0,r=0,o=!1,a=!1,l=-1e9,h=[];for(;;){let c=s==t.length?1e9:o?t[s].to:t[s].from,u=r==e.length?1e9:a?e[r].to:e[r].from;if(o!=a){let t=Math.max(l,i),e=Math.min(c,u,n);tnew lo(t.from+n,t.to+n))),a,l);for(let e=0,n=a;;e++){let a=e==o.length,h=a?l:o[e].from;if(h>n&&i.push(new Eo(n,h,s.tree,-t,r.from>=n||r.openStart,r.to<=h||r.openEnd)),a)break;n=o[e].to}}else i.push(new Eo(a,l,s.tree,-t,r.from>=t||r.openStart,r.to<=o||r.openEnd))}return i}let Ho=0;class Jo{constructor(t,e,i){this.set=t,this.base=e,this.modified=i,this.id=Ho++}static define(t){if(null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let e=new Jo([],null,[]);if(e.set.push(e),t)for(let i of t.set)e.set.push(i);return e}static defineModifier(){let t=new ta;return e=>e.modified.indexOf(t)>-1?e:ta.get(e.base||e,e.modified.concat(t).sort(((t,e)=>t.id-e.id)))}}let Ko=0;class ta{constructor(){this.instances=[],this.id=Ko++}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 Jo(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(ta.get(e,t));return s}}function ea(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,a=i[o];if(!a)throw new RangeError("Invalid path: "+t);let l=new na(n,s,o>0?i.slice(0,o):null);e[a]=l.sort(e[a])}}return ia.add(e)}const ia=new ho;class na{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 ra(t,e,i,n=0,s=t.length){let r=new oa(n,Array.isArray(e)?e:[e],i);r.highlightRange(t.cursor(),n,s,"",r.highlighters),r.flush(s)}na.empty=new na([],2,null);class oa{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:a}=t;if(o>=i||a<=e)return;r.isTop&&(s=this.highlighters.filter((t=>!t.scope||t.scope(r))));let l=n,h=function(t){let e=t.type.prop(ia);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}(t)||na.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&&(l&&(l+=" "),l+=c,1==h.mode&&(n+=(n?" ":"")+c)),this.startSpan(t.from,l),h.opaque)return;let u=t.tree&&t.tree.prop(ho.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 d=0,f=o;;d++){let p=d=O)&&t.nextSibling()););if(!p||O>i)break;f=p.to+o,f>e&&(this.highlightRange(r.cursor(),Math.max(e,p.from+o),Math.min(i,f),n,h),this.startSpan(f,l))}c&&t.parent()}else if(t.firstChild()){do{if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,n,s),this.startSpan(Math.min(i,t.to),l)}}while(t.nextSibling());t.parent()}}}const aa=Jo.define,la=aa(),ha=aa(),ca=aa(ha),ua=aa(ha),da=aa(),fa=aa(da),pa=aa(da),Oa=aa(),ga=aa(Oa),ma=aa(),ba=aa(),wa=aa(),va=aa(wa),ya=aa(),Sa={comment:la,lineComment:aa(la),blockComment:aa(la),docComment:aa(la),name:ha,variableName:aa(ha),typeName:ca,tagName:aa(ca),propertyName:ua,attributeName:aa(ua),className:aa(ha),labelName:aa(ha),namespace:aa(ha),macroName:aa(ha),literal:da,string:fa,docString:aa(fa),character:aa(fa),attributeValue:aa(fa),number:pa,integer:aa(pa),float:aa(pa),bool:aa(da),regexp:aa(da),escape:aa(da),color:aa(da),url:aa(da),keyword:ma,self:aa(ma),null:aa(ma),atom:aa(ma),unit:aa(ma),modifier:aa(ma),operatorKeyword:aa(ma),controlKeyword:aa(ma),definitionKeyword:aa(ma),moduleKeyword:aa(ma),operator:ba,derefOperator:aa(ba),arithmeticOperator:aa(ba),logicOperator:aa(ba),bitwiseOperator:aa(ba),compareOperator:aa(ba),updateOperator:aa(ba),definitionOperator:aa(ba),typeOperator:aa(ba),controlOperator:aa(ba),punctuation:wa,separator:aa(wa),bracket:va,angleBracket:aa(va),squareBracket:aa(va),paren:aa(va),brace:aa(va),content:Oa,heading:ga,heading1:aa(ga),heading2:aa(ga),heading3:aa(ga),heading4:aa(ga),heading5:aa(ga),heading6:aa(ga),contentSeparator:aa(Oa),list:aa(Oa),quote:aa(Oa),emphasis:aa(Oa),strong:aa(Oa),link:aa(Oa),monospace:aa(Oa),strikethrough:aa(Oa),inserted:aa(),deleted:aa(),changed:aa(),invalid:aa(),meta:ya,documentMeta:aa(ya),annotation:aa(ya),processingInstruction:aa(ya),definition:Jo.defineModifier(),constant:Jo.defineModifier(),function:Jo.defineModifier(),standard:Jo.defineModifier(),local:Jo.defineModifier(),special:Jo.defineModifier()};var xa;sa([{tag:Sa.link,class:"tok-link"},{tag:Sa.heading,class:"tok-heading"},{tag:Sa.emphasis,class:"tok-emphasis"},{tag:Sa.strong,class:"tok-strong"},{tag:Sa.keyword,class:"tok-keyword"},{tag:Sa.atom,class:"tok-atom"},{tag:Sa.bool,class:"tok-bool"},{tag:Sa.url,class:"tok-url"},{tag:Sa.labelName,class:"tok-labelName"},{tag:Sa.inserted,class:"tok-inserted"},{tag:Sa.deleted,class:"tok-deleted"},{tag:Sa.literal,class:"tok-literal"},{tag:Sa.string,class:"tok-string"},{tag:Sa.number,class:"tok-number"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],class:"tok-string2"},{tag:Sa.variableName,class:"tok-variableName"},{tag:Sa.local(Sa.variableName),class:"tok-variableName tok-local"},{tag:Sa.definition(Sa.variableName),class:"tok-variableName tok-definition"},{tag:Sa.special(Sa.variableName),class:"tok-variableName2"},{tag:Sa.definition(Sa.propertyName),class:"tok-propertyName tok-definition"},{tag:Sa.typeName,class:"tok-typeName"},{tag:Sa.namespace,class:"tok-namespace"},{tag:Sa.className,class:"tok-className"},{tag:Sa.macroName,class:"tok-macroName"},{tag:Sa.propertyName,class:"tok-propertyName"},{tag:Sa.operator,class:"tok-operator"},{tag:Sa.comment,class:"tok-comment"},{tag:Sa.meta,class:"tok-meta"},{tag:Sa.invalid,class:"tok-invalid"},{tag:Sa.punctuation,class:"tok-punctuation"}]);const ka=new ho;function Qa(t){return E.define({combine:t?e=>e.concat(t):void 0})}const $a=new ho;class Pa{constructor(t,e,i=[],n=""){this.data=t,this.name=n,xt.prototype.hasOwnProperty("tree")||Object.defineProperty(xt.prototype,"tree",{get(){return Xa(this)}}),this.parser=e,this.extension=[Wa.of(this),xt.languageData.of(((t,e,i)=>{let n=Ca(t,e,i),s=n.type.prop(ka);if(!s)return[];let r=t.facet(s),o=n.type.prop($a);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 Ca(t,e,i).type.prop(ka)==this.data}findRegions(t){let e=t.facet(Wa);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(ka)==this.data)return void i.push({from:e,to:e+t.length});let s=t.prop(ho.mounted);if(s){if(s.tree.prop(ka)==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;it.isTop?e:void 0))]}),t.name)}configure(t,e){return new _a(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Xa(t){let e=t.field(Pa.state,!1);return e?e.tree:bo.empty}class Za{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let i=this.cursorPos-this.string.length;return t=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i)}}let Aa=null;class Ta{constructor(t,e,i=[],n,s,r,o,a){this.parser=t,this.state=e,this.fragments=i,this.tree=n,this.treeLen=s,this.viewport=r,this.skipped=o,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(t,e,i){return new Ta(t,e,[],bo.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Za(this.state.doc),this.fragments)}work(t,e){return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=bo.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(Eo.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Aa;Aa=this;try{return t()}finally{Aa=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=Ra(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=Eo.applyChanges(i,e),n=bo.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=Ra(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 Vo{createParse(e,i,n){let s=n[0].from,r=n[n.length-1].to;return{parsedPos:s,advance(){let e=Aa;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 bo(fo.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 Aa}}function Ra(t,e,i){return Eo.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class Ea{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 Ea(e)}static init(t){let e=Math.min(3e3,t.doc.length),i=Ta.create(t.facet(Wa).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new Ea(i)}}Pa.state=q.define({create:Ea.init,update(t,e){for(let t of e.effects)if(t.is(Pa.setState))return t.value;return e.startState.facet(Wa)!=e.state.facet(Wa)?Ea.init(e.state):t.apply(e)}});let Va=t=>{let e=setTimeout((()=>t()),500);return()=>clearTimeout(e)};"undefined"!=typeof requestIdleCallback&&(Va=t=>{let e=-1,i=setTimeout((()=>{e=requestIdleCallback(t,{timeout:400})}),100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const Ma="undefined"!=typeof navigator&&(null===(xa=navigator.scheduling)||void 0===xa?void 0:xa.isInputPending)?()=>navigator.scheduling.isInputPending():null,Da=_i.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(Pa.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),t.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(Pa.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=Va(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEndn+1e3,a=s.context.work((()=>Ma&&Ma()||Date.now()>r),n+(o?0:1e5));this.chunkBudget-=Date.now()-e,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Pa.setState.of(new Ea(s.context))})),this.chunkBudget>0&&(!a||o)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then((()=>this.scheduleWork())).catch((t=>Qi(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()}}}),Wa=E.define({combine:t=>t.length?t[0]:null,enables:t=>[Pa.state,Da,Ts.contentAttributes.compute([t],(e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}}))]});class Ua{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}class Ya{constructor(t,e,i,n,s,r=void 0){this.name=t,this.alias=e,this.extensions=i,this.filename=n,this.loadFunc=s,this.support=r,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then((t=>this.support=t),(t=>{throw this.loading=null,t})))}static of(t){let{load:e,support:i}=t;if(!e){if(!i)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");e=()=>Promise.resolve(i)}return new Ya(t.name,(t.alias||[]).concat(t.name).map((t=>t.toLowerCase())),t.extensions||[],t.filename,e,i)}static matchFilename(t,e){for(let i of t)if(i.filename&&i.filename.test(e))return i;let i=/\.([^.]+)$/.exec(e);if(i)for(let e of t)if(e.extensions.indexOf(i[1])>-1)return e;return null}static matchLanguageName(t,e,i=!0){e=e.toLowerCase();for(let i of t)if(i.alias.some((t=>t==e)))return i;if(i)for(let i of t)for(let t of i.alias){let n=e.indexOf(t);if(n>-1&&(t.length>2||!/\w/.test(e[n-1])&&!/\w/.test(e[n+t.length])))return i}return null}}const qa=E.define(),La=E.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 za(t){let e=t.facet(La);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function Ia(t,e){let i="",n=t.tabSize,s=t.facet(La)[0];if("\t"==s){for(;e>=n;)i+="\t",e-=n;s=" "}for(let t=0;t=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 Yt(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 Na=new ho;function Ga(t){let e=t.type.prop(Na);if(e)return e;let i,n=t.firstChild;if(n&&(i=n.type.prop(ho.closedBy))){let e=t.lastChild,n=e&&i.indexOf(e.name)>-1;return t=>el(t,!0,1,void 0,n&&!function(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}(t)?e.from:void 0)}return null==t.parent?Ha:null}function Fa(t,e,i){for(;t;t=t.parent){let n=Ga(t);if(n)return n(Ja.create(i,e,t))}return null}function Ha(){return 0}class Ja extends ja{constructor(t,e,i){super(t.state,t.options),this.base=t,this.pos=e,this.node=i}static create(t,e,i){return new Ja(t,e,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){let t=this.state.doc.lineAt(this.node.from);for(;;){let e=this.node.resolve(t.from);for(;e.parent&&e.parent.from==e.from;)e=e.parent;if(Ka(e,this.node))break;t=this.state.doc.lineAt(e.from)}return this.lineIndent(t.from)}continue(){let t=this.node.parent;return t?Fa(t,this.pos,this.base):0}}function Ka(t,e){for(let i=e;i;i=i.parent)if(t==i)return!0;return!1}function tl({closing:t,align:e=!0,units:i=1}){return n=>el(n,e,i,t)}function el(t,e,i,n,s){let r=t.textAfter,o=r.match(/^\s*/)[0].length,a=n&&r.slice(o,o+n.length)==n||s==t.pos+o,l=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.from{let n=t&&t.test(i.textAfter);return i.baseIndent+(n?0:e*i.unit)}}function nl(){return xt.transactionFilter.of((t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let i=t.newDoc,{head:n}=t.newSelection.main,s=i.lineAt(n);if(n>s.from+200)return t;let r=i.sliceString(s.from,n);if(!e.some((t=>t.test(r))))return t;let{state:o}=t,a=-1,l=[];for(let{head:t}of o.selection.ranges){let e=o.doc.lineAt(t);if(e.from==a)continue;a=e.from;let i=Ba(o,e.from);if(null==i)continue;let n=/^\s*/.exec(e.text)[0],s=Ia(o,i);n!=s&&l.push({from:e.from,to:e.from+n.length,insert:s})}return l.length?[t,{changes:l,sequential:!0}]:t}))}const sl=E.define(),rl=new ho;function ol(t){let e=t.firstChild,i=t.lastChild;return e&&e.toi)continue;if(s&&r.from=e&&n.to>i&&(s=n)}}return s}(t,e,i)}function hl(t,e){let i=e.mapPos(t.from,1),n=e.mapPos(t.to,-1);return i>=n?void 0:{from:i,to:n}}const cl=ut.define({map:hl}),ul=ut.define({map:hl}),dl=q.define({create:()=>ni.none,update(t,e){t=t.map(e.changes);for(let i of e.effects)i.is(cl)&&!pl(t,i.value.from,i.value.to)?t=t.update({add:[bl.range(i.value.from,i.value.to)]}):i.is(ul)&&(t=t.update({filter:(t,e)=>i.value.from!=t||i.value.to!=e,filterFrom:i.value.from,filterTo:i.value.to}));if(e.selection){let i=!1,{head:n}=e.selection.main;t.between(n,n,((t,e)=>{tn&&(i=!0)})),i&&(t=t.update({filterFrom:n,filterTo:n,filter:(t,e)=>e<=n||t>=n}))}return t},provide:t=>Ts.decorations.from(t),toJSON(t,e){let i=[];return t.between(0,e.doc.length,((t,e)=>{i.push(t,e)})),i},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let i=0;i{(!s||s.from>t)&&(s={from:t,to:e})})),s}function pl(t,e,i){let n=!1;return t.between(e,e,((t,s)=>{t==e&&s==i&&(n=!0)})),n}const Ol={placeholderDOM:null,placeholderText:"…"},gl=E.define({combine:t=>kt(t,Ol)});function ml(t){let e=[dl,yl];return t&&e.push(gl.of(t)),e}const bl=ni.replace({widget:new class extends ei{toDOM(t){let{state:e}=t,i=e.facet(gl),n=e=>{let i=t.lineBlockAt(t.posAtDOM(e.target)),n=fl(t.state,i.from,i.to);n&&t.dispatch({effects:ul.of(n)}),e.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(t,n);let s=document.createElement("span");return s.textContent=i.placeholderText,s.setAttribute("aria-label",e.phrase("folded code")),s.title=e.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=n,s}}}),wl={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class vl extends Yr{constructor(t,e){super(),this.config=t,this.open=e}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let e=document.createElement("span");return e.textContent=this.open?this.config.openText:this.config.closedText,e.title=t.state.phrase(this.open?"Fold line":"Unfold line"),e}}const yl=Ts.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Sl{constructor(t,e){let i;function n(t){let e=It.newName();return(i||(i=Object.create(null)))["."+e]=t,e}this.specs=t;const s="string"==typeof e.all?e.all:e.all?n(e.all):void 0,r=e.scope;this.scope=r instanceof Pa?t=>t.prop(ka)==r.data:r?t=>t==r:void 0,this.style=sa(t.map((t=>({tag:t.tag,class:t.class||n(Object.assign({},t,{tag:null}))}))),{all:s}).style,this.module=i?new It(i):null,this.themeType=e.themeType}static define(t,e){return new Sl(t,e||{})}}const xl=E.define(),kl=E.define({combine:t=>t.length?[t[0]]:null});function Ql(t){let e=t.facet(xl);return e.length?e:t.facet(kl)}function $l(t,e){let i,n=[Cl];return t instanceof Sl&&(t.module&&n.push(Ts.styleModule.of(t.module)),i=t.themeType),(null==e?void 0:e.fallback)?n.push(kl.of(t)):i?n.push(xl.computeN([Ts.darkTheme],(e=>e.facet(Ts.darkTheme)==("dark"==i)?[t]:[]))):n.push(xl.of(t)),n}class Pl{constructor(t){this.markCache=Object.create(null),this.tree=Xa(t.state),this.decorations=this.buildDeco(t,Ql(t.state))}update(t){let e=Xa(t.state),i=Ql(t.state),n=i!=Ql(t.startState);e.length{i.add(t,e,this.markCache[n]||(this.markCache[n]=ni.mark({class:n})))}),n,s);return i.finish()}}const Cl=N.high(_i.fromClass(Pl,{decorations:t=>t.decorations})),_l=Sl.define([{tag:Sa.meta,color:"#404740"},{tag:Sa.link,textDecoration:"underline"},{tag:Sa.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Sa.emphasis,fontStyle:"italic"},{tag:Sa.strong,fontWeight:"bold"},{tag:Sa.strikethrough,textDecoration:"line-through"},{tag:Sa.keyword,color:"#708"},{tag:[Sa.atom,Sa.bool,Sa.url,Sa.contentSeparator,Sa.labelName],color:"#219"},{tag:[Sa.literal,Sa.inserted],color:"#164"},{tag:[Sa.string,Sa.deleted],color:"#a11"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],color:"#e40"},{tag:Sa.definition(Sa.variableName),color:"#00f"},{tag:Sa.local(Sa.variableName),color:"#30a"},{tag:[Sa.typeName,Sa.namespace],color:"#085"},{tag:Sa.className,color:"#167"},{tag:[Sa.special(Sa.variableName),Sa.macroName],color:"#256"},{tag:Sa.definition(Sa.propertyName),color:"#00c"},{tag:Sa.comment,color:"#940"},{tag:Sa.invalid,color:"#f00"}]),Xl=Ts.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Zl=1e4,Al="()[]{}",Tl=E.define({combine:t=>kt(t,{afterCursor:!0,brackets:Al,maxScanDistance:Zl,renderMatch:Vl})}),Rl=ni.mark({class:"cm-matchingBracket"}),El=ni.mark({class:"cm-nonmatchingBracket"});function Vl(t){let e=[],i=t.matched?Rl:El;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 Ml=q.define({create:()=>ni.none,update(t,e){if(!e.docChanged&&!e.selection)return t;let i=[],n=e.state.facet(Tl);for(let t of e.state.selection.ranges){if(!t.empty)continue;let s=Ll(e.state,t.head,-1,n)||t.head>0&&Ll(e.state,t.head-1,1,n)||n.afterCursor&&(Ll(e.state,t.head,1,n)||t.headTs.decorations.from(t)}),Dl=[Ml,Xl];function Wl(t={}){return[Tl.of(t),Dl]}const Ul=new ho;function Yl(t,e,i){let n=t.prop(e<0?ho.openedBy:ho.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 ql(t){let e=t.type.prop(Ul);return e?e(t.node):t}function Ll(t,e,i,n={}){let s=n.maxScanDistance||Zl,r=n.brackets||Al,o=Xa(t),a=o.resolveInner(e,i);for(let n=a;n;n=n.parent){let s=Yl(n.type,i,r);if(s&&n.from0?e>=o.from&&eo.from&&e<=o.to))return zl(t,e,i,n,o,s,r)}}return function(t,e,i,n,s,r,o){let a=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%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 a=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(a+t,1).type!=s))if(e%2==0==i>0)u++;else{if(1==u)return{start:h,end:{from:a+t,to:a+t+1},matched:e>>1==l>>1};u--}}i>0&&(t+=r.length)}return c.done?{start:h,matched:!1}:null}(t,e,i,o,a.type,s,r)}function zl(t,e,i,n,s,r,o){let a=n.parent,l={from:s.from,to:s.to},h=0,c=null==a?void 0:a.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 jl(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 Nl=new WeakMap;class Gl extends Pa{constructor(t){let e,i=Qa(t.languageData),n={name:(s=t).name||"",token:s.token,blankLine:s.blankLine||(()=>{}),startState:s.startState||(()=>!0),copyState:s.copyState||jl,indent:s.indent||(()=>null),languageData:s.languageData||{},tokenTable:s.tokenTable||th};var s;super(i,new class extends Vo{createParse(t,i,n){return new Jl(e,t,i,n)}},[qa.of(((t,e)=>this.getIndent(t,e)))],t.name),this.topNode=function(t){let e=fo.define({id:eh.length,name:"Document",props:[ka.add((()=>t))]});return eh.push(e),e}(i),e=this,this.streamParser=n,this.stateAfter=new ho({perNode:!0}),this.tokenTable=t.tokenTable?new rh(n.tokenTable):oh}static define(t){return new Gl(t)}getIndent(t,e){let i,n=Xa(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=Nl.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],a=i+e.positions[r],l=o instanceof bo&&a=e.length)return e;s||e.type!=t.topNode||(s=!0);for(let r=e.children.length-1;r>=0;r--){let o,a=e.positions[r],l=e.children[r];if(ai&&Fl(t,n.tree,0-n.offset,i,r);if(o&&(e=Hl(t,n.tree,i+n.offset,o.pos+n.offset,!1)))return{state:o.state,tree:e}}return{state:t.streamParser.startState(n?za(n):4),tree:bo.empty}}(t,i,r,null==s?void 0:s.state);this.state=o,this.parsedPos=this.chunkStart=r+a.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 Bl(e,t?t.state.tabSize:4,t?za(t.state):2);if(r.eol())s.blankLine(this.state,r.indentUnit);else for(;!r.eol();){let t=Kl(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 th=Object.create(null),eh=[fo.none],ih=new po(eh),nh=[],sh=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"]])sh[t]=lh(th,e);class rh{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),sh)}resolve(t){return t?this.table[t]||(this.table[t]=lh(this.extra,t)):0}}const oh=new rh(th);function ah(t,e){nh.indexOf(t)>-1||(nh.push(t),console.warn(e))}function lh(t,e){let i=null;for(let n of e.split(".")){let e=t[n]||Sa[n];e?"function"==typeof e?i?i=e(i):ah(n,`Modifier ${n} used at start of tag`):i?ah(n,`Tag ${n} used as modifier`):i=e:ah(n,`Unknown highlighting tag ${n}`)}if(!i)return 0;let n=e.replace(/ /g,"_"),s=fo.define({id:eh.length,name:n,props:[ea({[n]:i})]});return eh.push(s),s.id}function hh(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 ch=hh(gh,0),uh=hh(Oh,0),dh=hh(((t,e)=>Oh(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 fh(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}const ph=50;function Oh(t,e,i=e.selection.ranges){let n=i.map((t=>fh(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,a=t.sliceDoc(n-ph,n),l=t.sliceDoc(s,s+ph),h=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(l)[0].length,u=a.length-h;if(a.slice(u-e.length,u)==e&&l.slice(c,c+i.length)==i)return{open:{pos:n-h,margin:h&&1},close:{pos:s+c,margin:c&&1}};s-n<=2*ph?r=o=t.sliceDoc(n,s):(r=t.sliceDoc(n,n+ph),o=t.sliceDoc(s-ph,s));let d=/^\s*/.exec(r)[0].length,f=/\s*$/.exec(o)[0].length,p=o.length-f-i.length;return r.slice(d,d+e.length)==e&&o.slice(p,p+i.length)==i?{open:{pos:n+d+e.length,margin:/\s/.test(r.charAt(d+e.length))?1:0},close:{pos:s-f-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>l.from)){s=l.from;let t=/^\s*/.exec(l.text)[0].length,e=t==l.length,i=l.text.slice(t,t+a.length)==a?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 mh=lt.define(),bh=lt.define(),wh=E.define(),vh=E.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)})});const yh=q.define({create:()=>Dh.empty,update(t,e){let i=e.state.facet(vh),n=e.annotation(mh);if(n){let s=e.docChanged?A.single(function(t){let e=0;return t.iterChangedRanges(((t,i)=>e=i)),e}(e.changes)):void 0,r=Ch.fromTransaction(e,s),o=n.side,a=0==o?t.undone:t.done;return a=r?_h(a,a.length,i.minDepth,r):Th(a,e.startState.selection),new Dh(0==o?n.rest:a,0==o?a:n.rest)}let s=e.annotation(bh);if("full"!=s&&"before"!=s||(t=t.isolate()),!1===e.annotation(dt.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);let r=Ch.fromTransaction(e),o=e.annotation(dt.time),a=e.annotation(dt.userEvent);return r?t=t.addChanges(r,o,a,i,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,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 Dh(t.done.map(Ch.fromJSON),t.undone.map(Ch.fromJSON))});function Sh(t={}){return[yh,vh.of(t),Ts.domEventHandlers({beforeinput(t,e){let i="historyUndo"==t.inputType?kh:"historyRedo"==t.inputType?Qh:null;return!!i&&(t.preventDefault(),i(e))}})]}function xh(t,e){return function({state:i,dispatch:n}){if(!e&&i.readOnly)return!1;let s=i.field(yh,!1);if(!s)return!1;let r=s.pop(t,i,e);return!!r&&(n(r),!0)}}const kh=xh(0,!1),Qh=xh(1,!1),$h=xh(0,!0),Ph=xh(1,!0);class Ch{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 Ch(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 Ch(t.changes&&k.fromJSON(t.changes),[],t.mapped&&x.fromJSON(t.mapped),t.startSelection&&A.fromJSON(t.startSelection),t.selectionsAfter.map(A.fromJSON))}static fromTransaction(t,e){let i=Zh;for(let e of t.startState.facet(wh)){let n=e(t);n.length&&(i=i.concat(n))}return!i.length&&t.changes.empty?null:new Ch(t.changes.invert(t.startState.doc),i,void 0,e||t.startState.selection,Zh)}static selection(t){return new Ch(void 0,Zh,void 0,void 0,t)}}function _h(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 Xh(t,e){return t.length?e.length?t.concat(e):t:e}const Zh=[],Ah=200;function Th(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-Ah));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),_h(t,t.length-1,1e9,i.setSelAfter(n)))}return[Ch.selection([e])]}function Rh(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 Eh(t,e){if(!t.length)return t;let i=t.length,n=Zh;for(;i;){let s=Vh(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?[Ch.selection(n)]:Zh}function Vh(t,e,i){let n=Xh(t.selectionsAfter.length?t.selectionsAfter.map((t=>t.map(e))):Zh,i);if(!t.changes)return Ch.selection(n);let s=t.changes.map(e),r=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(r):r;return new Ch(s,ut.mapEffects(t.effects,e),o,t.startSelection.map(r),n)}const Mh=/^(input\.type|delete)($|\.)/;class Dh{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 Dh(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||Mh.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)?_h(r,r.length-1,n.minDepth,new Ch(t.changes.compose(o.changes),Xh(t.effects,o.effects),o.mapped,o.startSelection,Zh)):_h(r,r.length,n.minDepth,t),new Dh(r,Zh,e,i)}addSelection(t,e,i,n){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Zh;return s.length>0&&e-this.prevTimet.empty!=o.ranges[e].empty)).length)?this:new Dh(Th(this.done,t),this.undone,e,i);var r,o}addMapping(t){return new Dh(Eh(this.done,t),Eh(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:mh.of({side:t,rest:Rh(n)}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let i=1==n.length?Zh:n.slice(0,n.length-1);return s.mapped&&(i=Eh(i,s.mapped)),e.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:mh.of({side:t,rest:i}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}}Dh.empty=new Dh(Zh,Zh);const Wh=[{key:"Mod-z",run:kh,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Qh,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Qh,preventDefault:!0},{key:"Mod-u",run:$h,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Ph,preventDefault:!0}];function Uh(t,e){return A.create(t.ranges.map(e),t.mainIndex)}function Yh(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function qh({state:t,dispatch:e},i){let n=Uh(t.selection,i);return!n.eq(t.selection)&&(e(Yh(t,n)),!0)}function Lh(t,e){return A.cursor(e?t.to:t.from)}function zh(t,e){return qh(t,(i=>i.empty?t.moveByChar(i,e):Lh(i,e)))}function Ih(t){return t.textDirectionAt(t.state.selection.main.head)==Wi.LTR}const Bh=t=>zh(t,!Ih(t)),jh=t=>zh(t,Ih(t));function Nh(t,e){return qh(t,(i=>i.empty?t.moveByGroup(i,e):Lh(i,e)))}function Gh(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 Fh(t,e,i){let n,s,r=Xa(t).resolveInner(e.head),o=i?ho.closedBy:ho.openedBy;for(let n=e.head;;){let e=i?r.childAfter(n):r.childBefore(n);if(!e)break;Gh(t,e,o)?r=e:n=i?e.to:e.from}return s=r.type.prop(o)&&(n=i?Ll(t,r.from,1):Ll(t,r.to,-1))&&n.matched?i?n.end.to:n.end.from:i?r.to:r.from,A.cursor(s,i?-1:1)}function Hh(t,e){return qh(t,(i=>{if(!i.empty)return Lh(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)}))}const Jh=t=>Hh(t,!1),Kh=t=>Hh(t,!0);function tc(t){let e,i=t.scrollDOM.clientHeighti.empty?t.moveVertically(i,e,n.height):Lh(i,e)));if(r.eq(s.selection))return!1;if(n.selfScroll){let e=t.coordsAtPos(s.selection.main.head),o=t.scrollDOM.getBoundingClientRect(),a=o.top+n.marginTop,l=o.bottom-n.marginBottom;e&&e.top>a&&e.bottomec(t,!1),nc=t=>ec(t,!0);function sc(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=A.cursor(n.from+i))}return s}function rc(t,e){let i=Uh(t.state.selection,(t=>{let i=e(t);return A.range(t.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)}));return!i.eq(t.state.selection)&&(t.dispatch(Yh(t.state,i)),!0)}function oc(t,e){return console.log("Select!"),rc(t,(i=>t.moveByCharSelected(i,e)))}const ac=t=>oc(t,!Ih(t)),lc=t=>oc(t,Ih(t));function hc(t,e){return rc(t,(i=>t.moveByGroup(i,e)))}function cc(t,e){return rc(t,(i=>t.moveVertically(i,e)))}const uc=t=>cc(t,!1),dc=t=>cc(t,!0);function fc(t,e){return rc(t,(i=>t.moveVertically(i,e,tc(t).height)))}const pc=t=>fc(t,!1),Oc=t=>fc(t,!0),gc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:0})),!0),mc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.doc.length})),!0),bc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:0})),!0),wc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0);function vc(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=yc(t,n,!0)),s=Math.min(s,n),r=Math.max(r,n)}else s=yc(t,s,!1),r=yc(t,r,!0);return s==r?{range:n}:{changes:{from:s,to:r},range:A.cursor(s)}}));return!s.changes.empty&&(t.dispatch(n.update(s,{scrollIntoView:!0,userEvent:i,effects:"delete.selection"==i?Ts.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function yc(t,e,i){if(t instanceof Ts)for(let n of t.state.facet(Ts.atomicRanges).map((e=>e(t))))n.between(e,e,((t,n)=>{te&&(e=i?n:t)}));return e}const Sc=(t,e)=>vc(t,(i=>{let n,s,{state:r}=t,o=r.doc.lineAt(i);if(!e&&i>o.from&&iSc(t,!1),kc=t=>Sc(t,!0),Qc=(t,e)=>vc(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 a=f(r.text,n-r.from,e)+r.from,l=r.text.slice(Math.min(n,a)-r.from,Math.max(n,a)-r.from),h=o(l);if(null!=t&&h!=t)break;" "==l&&n==i||(t=h),n=a}return n})),$c=t=>Qc(t,!1),Pc=t=>vc(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 _c(t,e,i){if(t.readOnly)return!1;let n=[],s=[];for(let e of Cc(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(A.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(A.range(t.anchor-o,t.head-o))}}return!!n.length&&(e(t.update({changes:n,scrollIntoView:!0,selection:A.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0)}function Xc(t,e,i){if(t.readOnly)return!1;let n=[];for(let e of Cc(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 Zc=Ac(!1);function Ac(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),a=!e&&s==r&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i,n=Xa(t).resolveInner(e),s=n.childBefore(e),r=n.childAfter(e);return s&&r&&s.to<=e&&r.from>=e&&(i=s.type.prop(ho.closedBy))&&i.indexOf(r.name)>-1&&t.doc.lineAt(s.to).from==t.doc.lineAt(r.from).from?{from:s.to,to:r.from}:null}(i,s);e&&(s=r=(r<=o.to?o:i.doc.lineAt(r)).to);let l=new ja(i,{simulateBreak:s,simulateDoubleBreak:!!a}),h=Ba(l,s);for(null==h&&(h=/^\s*/.exec(i.doc.lineAt(s).text)[0].length);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:A.range(r.mapPos(n.anchor,1),r.mapPos(n.head,1))}}))}const Rc=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{i.push({from:e.from,insert:t.facet(La)})})),{userEvent:"input.indent"})),!0),Ec=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{let n=/^\s*/.exec(e.text)[0];if(!n)return;let s=Yt(n,t.tabSize),r=0,o=Ia(t,Math.max(0,s-za(t)));for(;rqh(t,(e=>Fh(t.state,e,!Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,!Ih(t))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:t=>qh(t,(e=>Fh(t.state,e,Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,Ih(t))))},{key:"Alt-ArrowUp",run:({state:t,dispatch:e})=>_c(t,e,!1)},{key:"Shift-Alt-ArrowUp",run:({state:t,dispatch:e})=>Xc(t,e,!1)},{key:"Alt-ArrowDown",run:({state:t,dispatch:e})=>_c(t,e,!0)},{key:"Shift-Alt-ArrowDown",run:({state:t,dispatch:e})=>Xc(t,e,!0)},{key:"Escape",run:({state:t,dispatch:e})=>{let i=t.selection,n=null;return i.ranges.length>1?n=A.create([i.main]):i.main.empty||(n=A.create([A.cursor(i.main.head)])),!!n&&(e(Yh(t,n)),!0)}},{key:"Mod-Enter",run:Ac(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:t,dispatch:e})=>{let i=Cc(t).map((({from:e,to:i})=>A.range(e,Math.min(i+1,t.doc.length))));return e(t.update({selection:A.create(i),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:t,dispatch:e})=>{let i=Uh(t.selection,(e=>{var i;let n=Xa(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 A.range(n.to,n.from)}));return e(Yh(t,i)),!0},preventDefault:!0},{key:"Mod-[",run:Ec},{key:"Mod-]",run:Rc},{key:"Mod-Alt-\\",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new ja(t,{overrideIndentation:t=>{let e=i[t];return null==e?-1:e}}),s=Tc(t,((e,s,r)=>{let o=Ba(n,e.from);if(null==o)return;/\S/.test(e.text)||(o=0);let a=/^\s*/.exec(e.text)[0],l=Ia(t,o);(a!=l||r.from{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(Cc(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=Uh(t.selection,(e=>{let s=Ll(t,e.head,-1)||Ll(t,e.head,1)||e.head>0&&Ll(t,e.head-1,1)||e.head{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=fh(t.state,i.from);return n.line?ch(t):!!n.block&&dh(t)}},{key:"Alt-A",run:uh}].concat([{key:"ArrowLeft",run:Bh,shift:ac,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:t=>Nh(t,!Ih(t)),shift:t=>hc(t,!Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:t=>qh(t,(e=>sc(t,e,!Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,!Ih(t)))),preventDefault:!0},{key:"ArrowRight",run:jh,shift:lc,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:t=>Nh(t,Ih(t)),shift:t=>hc(t,Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:t=>qh(t,(e=>sc(t,e,Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,Ih(t)))),preventDefault:!0},{key:"ArrowUp",run:Jh,shift:uc,preventDefault:!0},{mac:"Cmd-ArrowUp",run:gc,shift:bc},{mac:"Ctrl-ArrowUp",run:ic,shift:pc},{key:"ArrowDown",run:Kh,shift:dc,preventDefault:!0},{mac:"Cmd-ArrowDown",run:mc,shift:wc},{mac:"Ctrl-ArrowDown",run:nc,shift:Oc},{key:"PageUp",run:ic,shift:pc},{key:"PageDown",run:nc,shift:Oc},{key:"Home",run:t=>qh(t,(e=>sc(t,e,!1))),shift:t=>rc(t,(e=>sc(t,e,!1))),preventDefault:!0},{key:"Mod-Home",run:gc,shift:bc},{key:"End",run:t=>qh(t,(e=>sc(t,e,!0))),shift:t=>rc(t,(e=>sc(t,e,!0))),preventDefault:!0},{key:"Mod-End",run:mc,shift:wc},{key:"Enter",run:Zc},{key:"Mod-a",run:({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:xc,shift:xc},{key:"Delete",run:kc},{key:"Mod-Backspace",mac:"Alt-Backspace",run:$c},{key:"Mod-Delete",mac:"Alt-Delete",run:t=>Qc(t,!0)},{mac:"Mod-Backspace",run:t=>vc(t,(e=>{let i=t.lineBlockAt(e).from;return e>i?i:Math.max(0,e-1)}))},{mac:"Mod-Delete",run:Pc}].concat([{key:"Ctrl-b",run:Bh,shift:ac,preventDefault:!0},{key:"Ctrl-f",run:jh,shift:lc},{key:"Ctrl-p",run:Jh,shift:uc},{key:"Ctrl-n",run:Kh,shift:dc},{key:"Ctrl-a",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).from,1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).from)))},{key:"Ctrl-e",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).to,-1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).to)))},{key:"Ctrl-d",run:kc},{key:"Ctrl-h",run:xc},{key:"Ctrl-k",run:Pc},{key:"Ctrl-Alt-h",run:$c},{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:A.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:f(n.text,i-n.from,!1)+n.from,r=i==n.to?i+1:f(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:A.cursor(r)}}));return!i.changes.empty&&(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:nc}].map((t=>({mac:t.key,run:t.run,shift:t.shift})))));function Mc(){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 Uc{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(Wc(t)):Wc,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 b(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=w(t),i=this.bufferStart+this.bufferPos;this.bufferPos+=v(t);let n=this.normalize(e);for(let t=0,s=i;;t++){let r=n.charCodeAt(t),o=this.match(r,s);if(o)return this.value=o,this;if(t==n.length-1)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=jc(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 Ic(e,t.sliceString(e,i));return zc.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=jc(this.text,i+(t==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ic.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function jc(t,e){if(e>=t.length)return e;let i,n=t.lineAt(e);for(;e=56320&&i<57344;)e++;return e}function Nc(t){let e=Mc("input",{class:"cm-textfield",name:"line"});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,a,l]=i,h=a?+a.slice(1):0,c=o?+o:s.number;if(o&&l){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)));t.dispatch({effects:Gc.of(!1),selection:A.cursor(u.from+Math.max(0,Math.min(h,u.length))),scrollIntoView:!0}),t.focus()}return{dom:Mc("form",{class:"cm-gotoLine",onkeydown:e=>{27==e.keyCode?(e.preventDefault(),t.dispatch({effects:Gc.of(!1)}),t.focus()):13==e.keyCode&&(e.preventDefault(),i())},onsubmit:t=>{t.preventDefault(),i()}},Mc("label",t.state.phrase("Go to line"),": ",e)," ",Mc("button",{class:"cm-button",type:"submit"},t.state.phrase("go")))}}"undefined"!=typeof Symbol&&(Lc.prototype[Symbol.iterator]=Bc.prototype[Symbol.iterator]=function(){return this});const Gc=ut.define(),Fc=q.define({create:()=>!0,update(t,e){for(let i of e.effects)i.is(Gc)&&(t=i.value);return t},provide:t=>Ur.from(t,(t=>t?Nc:null))}),Hc=Ts.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),Jc={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Kc=E.define({combine:t=>kt(t,Jc,{highlightWordAroundCursor:(t,e)=>t||e,minSelectionLength:Math.min,maxMatches:Math.min})});function tu(t){let e=[ru,su];return t&&e.push(Kc.of(t)),e}const eu=ni.mark({class:"cm-selectionMatch"}),iu=ni.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function nu(t,e,i,n){return!(0!=i&&t(e.sliceDoc(i-1,i))==wt.Word||n!=e.doc.length&&t(e.sliceDoc(n,n+1))==wt.Word)}const su=_i.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(Kc),{state:i}=t,n=i.selection;if(n.ranges.length>1)return ni.none;let s,r=n.main,o=null;if(r.empty){if(!e.highlightWordAroundCursor)return ni.none;let t=i.wordAt(r.head);if(!t)return ni.none;o=i.charCategorizer(r.head),s=i.sliceDoc(t.from,t.to)}else{let t=r.to-r.from;if(t200)return ni.none;if(e.wholeWords){if(s=i.sliceDoc(r.from,r.to),o=i.charCategorizer(r.head),!nu(o,i,r.from,r.to)||!function(t,e,i,n){return t(e.sliceDoc(i,i+1))==wt.Word&&t(e.sliceDoc(n-1,n))==wt.Word}(o,i,r.from,r.to))return ni.none}else if(s=i.sliceDoc(r.from,r.to).trim(),!s)return ni.none}let a=[];for(let n of t.visibleRanges){let t=new Uc(i.doc,s,n.from,n.to);for(;!t.next().done;){let{from:n,to:s}=t.value;if((!o||nu(o,i,n,s))&&(r.empty&&n<=r.from&&s>=r.to?a.push(iu.range(n,s)):(n>=r.to||s<=r.from)&&a.push(eu.range(n,s)),a.length>e.maxMatches))return ni.none}}return ni.set(a)}},{decorations:t=>t.decorations}),ru=Ts.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});const ou=E.define({combine:t=>kt(t,{top:!1,caseSensitive:!1,literal:!1,wholeWord:!1,createPanel:t=>new Eu(t),scrollToMatch:t=>Ts.scrollIntoView(t)})});class au{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,qc),!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 pu(this):new cu(this)}getCursor(t,e=0,i){let n=t.doc?t:xt.create({doc:t});return null==i&&(i=n.doc.length),this.regexp?uu(this,n,e,i):hu(this,n,e,i)}}class lu{constructor(t){this.spec=t}}function hu(t,e,i,n){return new Uc(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=hu(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 uu(t,e,i,n){return new Lc(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?(s=e.charCategorizer(e.selection.main.head),(t,e,i)=>!i[0].length||(s(du(i.input,i.index))!=wt.Word||s(fu(i.input,i.index))!=wt.Word)&&(s(fu(i.input,i.index+i[0].length))!=wt.Word||s(du(i.input,i.index+i[0].length))!=wt.Word)):void 0},i,n);var s}function du(t,e){return t.slice(f(t,e,!1),e)}function fu(t,e){return t.slice(e,f(t,e))}class pu extends lu{nextMatch(t,e,i){let n=uu(this.spec,t,i,t.doc.length).next();return n.done&&(n=uu(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=uu(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=uu(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 Ou=ut.define(),gu=ut.define(),mu=q.define({create:t=>new bu(_u(t).create(),null),update(t,e){for(let i of e.effects)i.is(Ou)?t=new bu(i.value.create(),t.panel):i.is(gu)&&(t=new bu(t.query,i.value?Cu:null));return t},provide:t=>Ur.from(t,(t=>t.panel))});class bu{constructor(t,e){this.query=t,this.panel=e}}const wu=ni.mark({class:"cm-searchMatch"}),vu=ni.mark({class:"cm-searchMatch cm-searchMatch-selected"}),yu=_i.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(mu))}update(t){let e=t.state.field(mu);(e!=t.startState.field(mu)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ni.none;let{view:i}=this,n=new Xt;for(let e=0,s=i.visibleRanges,r=s.length;es[e+1].from-500;)a=s[++e].to;t.highlight(i.state,o,a,((t,e)=>{let s=i.state.selection.ranges.some((i=>i.from==t&&i.to==e));n.add(t,e,s?vu:wu)}))}return n.finish()}},{decorations:t=>t.decorations});function Su(t){return e=>{let i=e.state.field(mu,!1);return i&&i.query.spec.valid?t(e,i):Au(e)}}const xu=Su(((t,{query:e})=>{let{to:i}=t.state.selection.main,n=e.nextMatch(t.state,i,i);if(!n)return!1;let s=A.single(n.from,n.to),r=t.state.facet(ou);return t.dispatch({selection:s,effects:[Wu(t,n),r.scrollToMatch(s.main,t)],userEvent:"select.search"}),Zu(t),!0})),ku=Su(((t,{query:e})=>{let{state:i}=t,{from:n}=i.selection.main,s=e.prevMatch(i,n,n);if(!s)return!1;let r=A.single(s.from,s.to),o=t.state.facet(ou);return t.dispatch({selection:r,effects:[Wu(t,s),o.scrollToMatch(r.main,t)],userEvent:"select.search"}),Zu(t),!0})),Qu=Su(((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!(!i||!i.length)&&(t.dispatch({selection:A.create(i.map((t=>A.range(t.from,t.to)))),userEvent:"select.search.matches"}),!0)})),$u=Su(((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,a,l=[],h=[];if(r.from==n&&r.to==s&&(a=i.toText(e.getReplacement(r)),l.push({from:r.from,to:r.to,insert:a}),r=e.nextMatch(i,r.from,r.to),h.push(Ts.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(n).number)+"."))),r){let e=0==l.length||l[0].from>=r.to?0:r.to-r.from-a.length;o=A.single(r.from-e,r.to-e),h.push(Wu(t,r)),h.push(i.facet(ou).scrollToMatch(o.main,t))}return t.dispatch({changes:l,selection:o,effects:h,userEvent:"input.replace"}),!0})),Pu=Su(((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:Ts.announce.of(n),userEvent:"input.replace.all"}),!0}));function Cu(t){return t.state.facet(ou).createPanel(t)}function _u(t,e){var i,n,s,r;let o=t.selection.main,a=o.empty||o.to>o.from+100?"":t.sliceDoc(o.from,o.to);if(e&&!a)return e;let l=t.facet(ou);return new au({search:(null!==(i=null==e?void 0:e.literal)&&void 0!==i?i:l.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:null!==(n=null==e?void 0:e.caseSensitive)&&void 0!==n?n:l.caseSensitive,literal:null!==(s=null==e?void 0:e.literal)&&void 0!==s?s:l.literal,wholeWord:null!==(r=null==e?void 0:e.wholeWord)&&void 0!==r?r:l.wholeWord})}function Xu(t){let e=Vr(t,Cu);return e&&e.dom.querySelector("[main-field]")}function Zu(t){let e=Xu(t);e&&e==t.root.activeElement&&e.select()}const Au=t=>{let e=t.state.field(mu,!1);if(e&&e.panel){let i=Xu(t);if(i&&i!=t.root.activeElement){let n=_u(t.state,e.query.spec);n.valid&&t.dispatch({effects:Ou.of(n)}),i.focus(),i.select()}}else t.dispatch({effects:[gu.of(!0),e?Ou.of(_u(t.state,e.query.spec)):ut.appendConfig.of(Yu)]});return!0},Tu=t=>{let e=t.state.field(mu,!1);if(!e||!e.panel)return!1;let i=Vr(t,Cu);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:gu.of(!1)}),!0},Ru=[{key:"Mod-f",run:Au,scope:"editor search-panel"},{key:"F3",run:xu,shift:ku,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:xu,shift:ku,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Tu,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 Uc(t.doc,t.sliceDoc(n,s));!e.next().done;){if(r.length>1e3)return!1;e.value.from==n&&(o=r.length),r.push(A.range(e.value.from,e.value.to))}return e(t.update({selection:A.create(r,o),userEvent:"select.search.matches"})),!0}},{key:"Alt-g",run:t=>{let e=Vr(t,Nc);if(!e){let i=[Gc.of(!0)];null==t.state.field(Fc,!1)&&i.push(ut.appendConfig.of([Fc,Hc])),t.dispatch({effects:i}),e=Vr(t,Nc)}return e&&e.dom.querySelector("input").focus(),!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=A.create(i.ranges.map((e=>t.wordAt(e.head)||A.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 Uc(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 Uc(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(A.range(s.from,s.to),!1),effects:Ts.scrollIntoView(s.to)})),!0)},preventDefault:!0}];class Eu{constructor(t){this.view=t;let e=this.query=t.state.field(mu).query.spec;function i(t,e,i){return Mc("button",{class:"cm-button",name:t,onclick:e,type:"button"},i)}this.commit=this.commit.bind(this),this.searchField=Mc("input",{value:e.search,placeholder:Vu(t,"Find"),"aria-label":Vu(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Mc("input",{value:e.replace,placeholder:Vu(t,"Replace"),"aria-label":Vu(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Mc("input",{type:"checkbox",name:"case",form:"",checked:e.caseSensitive,onchange:this.commit}),this.reField=Mc("input",{type:"checkbox",name:"re",form:"",checked:e.regexp,onchange:this.commit}),this.wordField=Mc("input",{type:"checkbox",name:"word",form:"",checked:e.wholeWord,onchange:this.commit}),this.dom=Mc("div",{onkeydown:t=>this.keydown(t),class:"cm-search"},[this.searchField,i("next",(()=>xu(t)),[Vu(t,"next")]),i("prev",(()=>ku(t)),[Vu(t,"previous")]),i("select",(()=>Qu(t)),[Vu(t,"all")]),...t.state.readOnly?[]:[Mc("br"),this.replaceField,i("replace",(()=>$u(t)),[Vu(t,"replace")]),i("replaceAll",(()=>Pu(t)),[Vu(t,"replace all")])],Mc("button",{name:"close",onclick:()=>Tu(t),"aria-label":Vu(t,"close"),type:"button"},["×"])])}commit(){let t=new au({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:Ou.of(t)}))}keydown(t){var e,i,n;e=this.view,i=t,n="search-panel",Bs(Ls(e.state),i,e,n)?t.preventDefault():13==t.keyCode&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?ku:xu)(this.view)):13==t.keyCode&&t.target==this.replaceField&&(t.preventDefault(),$u(this.view))}update(t){for(let e of t.transactions)for(let t of e.effects)t.is(Ou)&&!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(ou).top}}function Vu(t,e){return t.state.phrase(e)}const Mu=30,Du=/[\s\.,:;?!]/;function Wu(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-Mu),o=Math.min(s,i+Mu),a=t.state.sliceDoc(r,o);if(r!=n.from)for(let t=0;ta.length-Mu;t--)if(!Du.test(a[t-1])&&Du.test(a[t])){a=a.slice(0,t);break}return Ts.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${n.number}.`)}const Uu=Ts.baseTheme({".cm-panel.cm-search":{padding:"0.25rem 0.5rem 0.25rem 0.5rem",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"0.5rem",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"}}),Yu=[mu,N.lowest(yu),Uu];class qu{constructor(t,e,i){this.state=t,this.pos=e,this.explicit=i,this.abortListeners=[]}tokenBefore(t){let e=Xa(this.state).resolveInner(this.pos,-1);for(;e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null}matchBefore(t){let e=this.state.doc.lineAt(this.pos),i=Math.max(e.from,this.pos-250),n=e.text.slice(i-e.from,this.pos-e.from),s=n.search(ju(t,!1));return s<0?null:{from:i+s,to:this.pos,text:n.slice(s)}}get aborted(){return null==this.abortListeners}addEventListener(t,e){"abort"==t&&this.abortListeners&&this.abortListeners.push(e)}}function Lu(t){let e=Object.keys(t).join(""),i=/\w/.test(e);return i&&(e=e.replace(/\w/g,"")),`[${i?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function zu(t){let e=t.map((t=>"string"==typeof t?{label:t}:t)),[i,n]=e.every((t=>/^\w+$/.test(t.label)))?[/\w*$/,/\w+$/]:function(t){let e=Object.create(null),i=Object.create(null);for(let{label:n}of t){e[n[0]]=!0;for(let t=1;t{let s=t.matchBefore(n);return s||t.explicit?{from:s?s.from:t.pos,options:e,validFor:i}:null}}class Iu{constructor(t,e,i,n){this.completion=t,this.source=e,this.match=i,this.score=n}}function Bu(t){return t.selection.main.from}function ju(t,e){var i;let{source:n}=t,s=e&&"^"!=n[0],r="$"!=n[n.length-1];return s||r?new RegExp(`${s?"^":""}(?:${n})${r?"$":""}`,null!==(i=t.flags)&&void 0!==i?i:t.ignoreCase?"i":""):t}const Nu=lt.define();const Gu=new WeakMap;function Fu(t){if(!Array.isArray(t))return t;let e=Gu.get(t);return e||Gu.set(t,e=zu(t)),e}const Hu=ut.define(),Ju=ut.define();class Ku{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[];for(let e=0;e=48&&l<=57||l>=97&&l<=122?2:l>=65&&l<=90?1:0:(y=w(l))!=y.toLowerCase()?1:y!=y.toUpperCase()?2:0;(!n||1==S&&O||0==m&&0!=S)&&(e[c]==l||i[c]==l&&(u=!0)?r[c++]=n:r.length&&(g=!1)),m=S,n+=v(l)}return c==a&&0==r[0]&&g?this.result((u?-200:0)-100,r,t):d==a&&0==f?[-200-t.length+(p==t.length?0:-100),0,p]:o>-1?[-700-t.length,o,o+this.pattern.length]:d==a?[-900-t.length,f,p]:c==a?this.result((u?-200:0)-100-700+(g?0:-1100),r,t):2==e.length?null:this.result((n[0]?-700:0)-200-1100,n,t)}result(t,e,i){let n=[t-i.length],s=1;for(let t of e){let e=t+(this.astral?v(b(i,t)):1);s>1&&n[s-1]==t?n[s-1]=e:(n[s++]=t,n[s++]=e)}return n}}const td=E.define({combine:t=>kt(t,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:id,compareCompletions:(t,e)=>t.label.localeCompare(e.label),interactionDelay:75},{defaultKeymap:(t,e)=>t&&e,closeOnBlur:(t,e)=>t&&e,icons:(t,e)=>t&&e,tooltipClass:(t,e)=>i=>ed(t(i),e(i)),optionClass:(t,e)=>i=>ed(t(i),e(i)),addToOptions:(t,e)=>t.concat(e)})});function ed(t,e){return t?e?t+" "+e:t:e}function id(t,e,i,n,s){let r,o,a=t.textDirection==Wi.RTL,l=a,h=!1,c="top",u=e.left-s.left,d=s.right-e.right,f=n.right-n.left,p=n.bottom-n.top;if(l&&u=p||t>e.top?r=i.bottom-e.top:(c="bottom",r=e.bottom-i.top)}return{style:`${c}: ${r}px; max-width: ${o}px`,class:"cm-completionInfo-"+(h?a?"left-narrow":"right-narrow":l?"left":"right")}}function nd(t,e="option"){return i=>{let n=i.state.field(yd,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp-1?n.open.selected+r*(t?1:-1):t?0:o-1;return a<0?a="page"==e?0:o-1:a>=o&&(a="page"==e?o-1:0),i.dispatch({effects:vd.of(a)}),!0}}const sd=t=>{let e=t.state.field(yd,!1);return!(t.state.readOnly||!e||!e.open||e.open.selected<0||Date.now()-e.open.timestamp(t.selection||t.docChanged)&&!gd(t)));for(let e=0;e50&&Date.now()-n.time>1e3){for(let t of n.context.abortListeners)try{t()}catch(t){Qi(this.view.state,t)}n.context.abortListeners=null,this.running.splice(e--,1)}else n.updates.push(...t.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some((t=>1==t.state&&!this.running.some((e=>e.active.source==t.source))))?setTimeout((()=>this.startUpdate()),50):-1,0!=this.composing)for(let e of t.transactions)"input"==gd(e)?this.composing=2:2==this.composing&&e.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:t}=this.view,e=t.field(yd);for(let t of e.active)1!=t.state||this.running.some((e=>e.active.source==t.source))||this.startQuery(t)}startQuery(t){let{state:e}=this.view,i=Bu(e),n=new qu(e,i,t.explicitPos==i),s=new rd(t,n);this.running.push(s),Promise.resolve(t.source(n)).then((t=>{s.context.aborted||(s.done=t||null,this.scheduleAccept())}),(t=>{this.view.dispatch({effects:Ju.of(null)}),Qi(this.view.state,t)}))}scheduleAccept(){this.running.every((t=>void 0!==t.done))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((()=>this.accept()),50))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],i=this.view.state.facet(td);for(let n=0;nt.source==s.active.source));if(r&&1==r.state)if(null==s.done){let t=new md(s.active.source,0);for(let e of s.updates)t=t.update(e,i);1!=t.state&&e.push(t)}else this.startQuery(r)}e.length&&this.view.dispatch({effects:wd.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(yd,!1);if(e&&e.tooltip&&this.view.state.facet(td).closeOnBlur){let i=e.open&&Rr(this.view,e.open.tooltip);i&&i.dom.contains(t.relatedTarget)||this.view.dispatch({effects:Ju.of(null)})}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout((()=>this.view.dispatch({effects:Hu.of(!1)})),20),this.composing=0}}});function ad(t,e){const i=e.completion.apply||e.completion.label;let n=t.state.field(yd).active.find((t=>t.source==e.source));return n instanceof bd&&("string"==typeof i?t.dispatch(Object.assign(Object.assign({},function(t,e,i,n){let{main:s}=t.selection,r=i-s.from,o=n-s.from;return Object.assign(Object.assign({},t.changeByRange((a=>a!=s&&i!=n&&t.sliceDoc(a.from+r,a.from+o)!=t.sliceDoc(i,n)?{range:a}:{changes:{from:a.from+r,to:n==s.from?a.to:a.from+o,insert:e},range:A.cursor(a.from+r+e.length)}))),{userEvent:"input.complete"})}(t.state,i,n.from,n.to)),{annotations:Nu.of(e.completion)})):i(t,e.completion,n.from,n.to),!0)}function ld(t,e,i){if(t<=i)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let t=Math.floor(e/i);return{from:t*i,to:(t+1)*i}}let n=Math.floor((t-e)/i);return{from:t-(n+1)*i,to:t-n*i}}class hd{constructor(t,e){this.view=t,this.stateField=e,this.info=null,this.placeInfoReq={read:()=>this.measureInfo(),write:t=>this.placeInfo(t),key:this},this.space=null,this.currentClass="";let i=t.state.field(e),{options:n,selected:s}=i.open,r=t.state.facet(td);this.optionContent=function(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(t){let e=document.createElement("div");return e.classList.add("cm-completionIcon"),t.type&&e.classList.add(...t.type.split(/\s+/g).map((t=>"cm-completionIcon-"+t))),e.setAttribute("aria-hidden","true"),e},position:20}),e.push({render(t,e,i){let n=document.createElement("span");n.className="cm-completionLabel";let{label:s}=t,r=0;for(let t=1;tr&&n.appendChild(document.createTextNode(s.slice(r,e)));let a=n.appendChild(document.createElement("span"));a.appendChild(document.createTextNode(s.slice(e,o))),a.className="cm-completionMatchedText",r=o}return rt.position-e.position)).map((t=>t.render))}(r),this.optionClass=r.optionClass,this.tooltipClass=r.tooltipClass,this.range=ld(n.length,s,r.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",(e=>{for(let i,s=e.target;s&&s!=this.dom;s=s.parentNode)if("LI"==s.nodeName&&(i=/-(\d+)$/.exec(s.id))&&+i[1]{let i=t.state.field(this.stateField,!1);i&&i.tooltip&&t.state.facet(td).closeOnBlur&&e.relatedTarget!=t.contentDOM&&t.dispatch({effects:Ju.of(null)})})),this.list=this.dom.appendChild(this.createListBox(n,i.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))}mount(){this.updateSel()}update(t){var e,i,n;let s=t.state.field(this.stateField),r=t.startState.field(this.stateField);this.updateTooltipClass(t.state),s!=r&&(this.updateSel(),(null===(e=s.open)||void 0===e?void 0:e.disabled)!=(null===(i=r.open)||void 0===i?void 0:i.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!(null===(n=s.open)||void 0===n?void 0:n.disabled)))}updateTooltipClass(t){let e=this.tooltipClass(t);if(e!=this.currentClass){for(let t of this.currentClass.split(" "))t&&this.dom.classList.remove(t);for(let t of e.split(" "))t&&this.dom.classList.add(t);this.currentClass=e}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),e=t.open;if((e.selected>-1&&e.selected=this.range.to)&&(this.range=ld(e.options.length,e.selected,this.view.state.facet(td).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e.options,t.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))),this.updateSelectedOption(e.selected)){this.info&&(this.info.remove(),this.info=null);let{completion:i}=e.options[e.selected],{info:n,label:s,c:r}=i;if(!n)return;let o="string"==typeof n?document.createTextNode(n+" "):n(i);if(!o)return;if(!r){const t=document.createElement("span");t.appendChild(o),o=t;const e=document.createElement("a");e.innerText="🔎",e.href="/docFind/"+s,e.target="blank",o.appendChild(e)}if(!o)return;"then"in o?o.then((e=>{e&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(e)})).catch((t=>Qi(this.view.state,t,"completion info"))):this.addInfoPane(o)}}addInfoPane(t){let e=this.info=document.createElement("div");e.className="cm-tooltip cm-completionInfo",e.appendChild(t),this.dom.appendChild(e),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let e=null;for(let i=this.list.firstChild,n=this.range.from;i;i=i.nextSibling,n++)"LI"==i.nodeName&&i.id?n==t?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),e=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected"):n--;return e&&function(t,e){let i=t.getBoundingClientRect(),n=e.getBoundingClientRect();n.topi.bottom&&(t.scrollTop+=n.bottom-i.bottom)}(this.list,e),e}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let e=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),n=t.getBoundingClientRect(),s=this.space;if(!s){let t=this.dom.ownerDocument.defaultView||window;s={left:0,top:0,right:t.innerWidth,bottom:t.innerHeight}}return n.top>Math.min(s.bottom,e.bottom)-10||n.bottomi.from||0==i.from))if(s=t,"string"!=typeof l&&l.header)n.appendChild(l.header(l));else{n.appendChild(document.createElement("completion-section")).textContent=t}}const h=n.appendChild(document.createElement("li"));h.id=e+"-"+r,h.setAttribute("role","option");let c=this.optionClass(o);c&&(h.className=c);for(let t of this.optionContent){let e=t(o,this.view.state,a);e&&h.appendChild(e)}}return i.from&&n.classList.add("cm-completionListIncompleteTop"),i.to=this.options.length?this:new ud(this.options,pd(e,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,e,i,n,s){let r=function(t,e){let i=[],n=null,s=t=>{i.push(t);let{section:e}=t.completion;if(e){n||(n=[]);let t="string"==typeof e?e:e.name;n.some((e=>e.name==t))||n.push("string"==typeof e?{name:t}:e)}};for(let n of t)if(n.hasResult())if(!1===n.result.filter){let t=n.result.getMatch;for(let e of n.result.options){let r=[1e9-i.length];if(t)for(let i of t(e))r.push(i);s(new Iu(e,n.source,r,r[0]))}}else{let t,i=new Ku(e.sliceDoc(n.from,n.to));for(let e of n.result.options)(t=i.match(e.label))&&s(new Iu(e,n.source,t,t[0]+(e.boost||0)))}if(n){let t=Object.create(null),e=0,s=(t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:1e9)-(null!==(n=e.rank)&&void 0!==n?n:1e9)||(t.namee.score-t.score||a(t.completion,e.completion))))!o||o.label!=t.completion.label||o.detail!=t.completion.detail||null!=o.type&&null!=t.completion.type&&o.type!=t.completion.type||o.apply!=t.completion.apply?r.push(t):cd(t.completion)>cd(o)&&(r[r.length-1]=t),o=t.completion;return r}(t,e);if(!r.length)return n&&t.some((t=>1==t.state))?new ud(n.options,n.attrs,n.tooltip,n.timestamp,n.selected,!0):null;let o=e.facet(td).selectOnOpen?0:-1;if(n&&n.selected!=o&&-1!=n.selected){let t=n.options[n.selected].completion;for(let e=0;ee.hasResult()?Math.min(t,e.from):t),1e8),create:(a=yd,t=>new hd(t,a)),above:s.aboveCursor},n?n.timestamp:Date.now(),o,!1);var a}map(t){return new ud(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class dd{constructor(t,e,i){this.active=t,this.id=e,this.open=i}static start(){return new dd(Od,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(t){let{state:e}=t,i=e.facet(td),n=(i.override||e.languageDataAt("autocomplete",Bu(e)).map(Fu)).map((e=>(this.active.find((t=>t.source==e))||new md(e,this.active.some((t=>0!=t.state))?1:0)).update(t,i)));n.length==this.active.length&&n.every(((t,e)=>t==this.active[e]))&&(n=this.active);let s=this.open;s&&t.docChanged&&(s=s.map(t.changes)),t.selection||n.some((e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to)))||!function(t,e){if(t==e)return!0;for(let i=0,n=0;;){for(;i1==t.state))&&(s=null),!s&&n.every((t=>1!=t.state))&&n.some((t=>t.hasResult()))&&(n=n.map((t=>t.hasResult()?new md(t.source,0):t)));for(let e of t.effects)e.is(vd)&&(s=s&&s.setSelected(e.value,this.id));return n==this.active&&s==this.open?this:new dd(n,this.id,s)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:fd}}const fd={"aria-autocomplete":"list"};function pd(t,e){let i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(i["aria-activedescendant"]=t+"-"+e),i}const Od=[];function gd(t){return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null}class md{constructor(t,e,i=-1){this.source=t,this.state=e,this.explicitPos=i}hasResult(){return!1}update(t,e){let i=gd(t),n=this;i?n=n.handleUserEvent(t,i,e):t.docChanged?n=n.handleChange(t):t.selection&&0!=n.state&&(n=new md(n.source,0));for(let e of t.effects)if(e.is(Hu))n=new md(n.source,1,e.value?Bu(t.state):-1);else if(e.is(Ju))n=new md(n.source,0);else if(e.is(wd))for(let t of e.value)t.source==n.source&&(n=t);return n}handleUserEvent(t,e,i){return"delete"!=e&&i.activateOnTyping?new md(this.source,1):this.map(t.changes)}handleChange(t){return t.changes.touchesRange(Bu(t.startState))?new md(this.source,0):this.map(t.changes)}map(t){return t.empty||this.explicitPos<0?this:new md(this.source,this.state,t.mapPos(this.explicitPos))}}class bd extends md{constructor(t,e,i,n,s){super(t,2,e),this.result=i,this.from=n,this.to=s}hasResult(){return!0}handleUserEvent(t,e,i){var n;let s=t.changes.mapPos(this.from),r=t.changes.mapPos(this.to,1),o=Bu(t.state);if((this.explicitPos<0?o<=s:or||"delete"==e&&Bu(t.startState)==this.from)return new md(this.source,"input"==e&&i.activateOnTyping?1:0);let a,l=this.explicitPos<0?-1:t.changes.mapPos(this.explicitPos);return function(t,e,i,n){if(!t)return!1;let s=e.sliceDoc(i,n);return"function"==typeof t?t(s,i,n,e):ju(t,!0).test(s)}(this.result.validFor,t.state,s,r)?new bd(this.source,l,this.result,s,r):this.result.update&&(a=this.result.update(this.result,s,r,new qu(t.state,o,l>=0)))?new bd(this.source,l,a,a.from,null!==(n=a.to)&&void 0!==n?n:Bu(t.state)):new md(this.source,1,l)}handleChange(t){return t.changes.touchesRange(this.from,this.to)?new md(this.source,0):this.map(t.changes)}map(t){return t.empty?this:new bd(this.source,this.explicitPos<0?-1:t.mapPos(this.explicitPos),this.result,t.mapPos(this.from),t.mapPos(this.to,1))}}const wd=ut.define({map:(t,e)=>t.map((t=>t.map(e)))}),vd=ut.define(),yd=q.define({create:()=>dd.start(),update:(t,e)=>t.update(e),provide:t=>[Tr.from(t,(t=>t.tooltip)),Ts.contentAttributes.from(t,(t=>t.attrs))]}),Sd=Ts.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class xd{constructor(t,e,i,n){this.field=t,this.line=e,this.from=i,this.to=n}}class kd{constructor(t,e,i){this.field=t,this.from=e,this.to=i}map(t){let e=t.mapPos(this.from,-1,S.TrackDel),i=t.mapPos(this.to,1,S.TrackDel);return null==e||null==i?null:new kd(this.field,e,i)}}class Qd{constructor(t,e){this.lines=t,this.fieldPositions=e}instantiate(t,e){let i=[],n=[e],s=t.doc.lineAt(e),r=/^\s*/.exec(s.text)[0];for(let s of this.lines){if(i.length){let i=r,o=/^\t*/.exec(s)[0].length;for(let e=0;enew kd(t.field,n[t.line]+t.from,n[t.line]+t.to)));return{text:i,ranges:o}}static parse(t){let e,i=[],n=[],s=[];for(let r of t.split(/\r\n?|\n/)){for(;e=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(r);){let t=e[1]?+e[1]:null,o=e[2]||e[3]||"",a=-1;for(let e=0;e=a&&t.field++}s.push(new xd(a,n.length,e.index,e.index+o.length)),r=r.slice(0,e.index)+o+r.slice(e.index+e[0].length)}for(let t;t=/\\([{}])/.exec(r);){r=r.slice(0,t.index)+t[1]+r.slice(t.index+t[0].length);for(let e of s)e.line==n.length&&e.from>t.index&&(e.from--,e.to--)}n.push(r)}return new Qd(n,s)}}let $d=ni.widget({widget:new class extends ei{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),Pd=ni.mark({class:"cm-snippetField"});class Cd{constructor(t,e){this.ranges=t,this.active=e,this.deco=ni.set(t.map((t=>(t.from==t.to?$d:Pd).range(t.from,t.to))))}map(t){let e=[];for(let i of this.ranges){let n=i.map(t);if(!n)return null;e.push(n)}return new Cd(e,this.active)}selectionInsideField(t){return t.ranges.every((t=>this.ranges.some((e=>e.field==this.active&&e.from<=t.from&&e.to>=t.to))))}}const _d=ut.define({map:(t,e)=>t&&t.map(e)}),Xd=ut.define(),Zd=q.define({create:()=>null,update(t,e){for(let i of e.effects){if(i.is(_d))return i.value;if(i.is(Xd)&&t)return new Cd(t.ranges,i.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>Ts.decorations.from(t,(t=>t?t.deco:ni.none))});function Ad(t,e){return A.create(t.filter((t=>t.field==e)).map((t=>A.range(t.from,t.to))))}function Td(e){let i=Qd.parse(e);return(e,n,s,r)=>{let{text:o,ranges:a}=i.instantiate(e.state,s),l={changes:{from:s,to:r,insert:t.of(o)},scrollIntoView:!0,annotations:n?Nu.of(n):void 0};if(a.length&&(l.selection=Ad(a,0)),a.length>1){let t=new Cd(a,0),i=l.effects=[_d.of(t)];void 0===e.state.field(Zd,!1)&&i.push(ut.appendConfig.of([Zd,Md,Wd,Sd]))}e.dispatch(e.state.update(l))}}function Rd(t){return({state:e,dispatch:i})=>{let n=e.field(Zd,!1);if(!n||t<0&&0==n.active)return!1;let s=n.active+t,r=t>0&&!n.ranges.some((e=>e.field==s+t));return i(e.update({selection:Ad(n.ranges,s),effects:_d.of(r?null:new Cd(n.ranges,s))})),!0}}const Ed=[{key:"Tab",run:Rd(1),shift:Rd(-1)},{key:"Escape",run:({state:t,dispatch:e})=>!!t.field(Zd,!1)&&(e(t.update({effects:_d.of(null)})),!0)}],Vd=E.define({combine:t=>t.length?t[0]:Ed}),Md=N.highest(Ys.compute([Vd],(t=>t.facet(Vd))));function Dd(t,e){return Object.assign(Object.assign({},e),{apply:Td(t)})}const Wd=Ts.domEventHandlers({mousedown(t,e){let i,n=e.state.field(Zd,!1);if(!n||null==(i=e.posAtCoords({x:t.clientX,y:t.clientY})))return!1;let s=n.ranges.find((t=>t.from<=i&&t.to>=i));return!(!s||s.field==n.active)&&(e.dispatch({selection:Ad(n.ranges,s.field),effects:_d.of(n.ranges.some((t=>t.field>s.field))?new Cd(n.ranges,s.field):null)}),!0)}}),Ud=new class extends Qt{};function Yd(t={}){return[yd,td.of(t),od,Ld,Sd]}Ud.startSide=1,Ud.endSide=-1;const qd=[{key:"Ctrl-Space",run:t=>!!t.state.field(yd,!1)&&(t.dispatch({effects:Hu.of(!0)}),!0)},{key:"Escape",run:t=>{let e=t.state.field(yd,!1);return!(!e||!e.active.some((t=>0!=t.state)))&&(t.dispatch({effects:Ju.of(null)}),!0)}},{key:"ArrowDown",run:nd(!0)},{key:"ArrowUp",run:nd(!1)},{key:"PageDown",run:nd(!0,"page")},{key:"PageUp",run:nd(!1,"page")},{key:"Enter",run:sd}],Ld=N.highest(Ys.computeN([td],(t=>t.facet(td).defaultKeymap?[qd]:[]))),zd=(()=>[vr(),Sh(),ir(),$l(_l,{fallback:!0}),Ys.of([...Vc,...Wh])])();class Id{constructor(t,e,i,n,s,r,o,a,l,h=0,c){this.p=t,this.stack=e,this.state=i,this.reducePos=n,this.pos=s,this.score=r,this.buffer=o,this.bufferBase=a,this.curContext=l,this.lookAhead=h,this.parent=c}toString(){return`[${this.stack.filter(((t,e)=>e%3==0)).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,i=0){let n=t.parser.context;return new Id(t,[],e,i,i,0,[],0,n?new Bd(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let i=t>>19,n=65535&t,{parser:s}=this.p,r=s.dynamicPrecedence(n);if(r&&(this.score+=r),0==i)return this.pushState(s.getGoto(this.state,n,!0),this.reducePos),n=2e3&&!(null===(e=this.p.parser.nodeSet.types[n])||void 0===e?void 0:e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=l):this.p.lastBigReductionSizeo;)this.stack.pop();this.reduceContext(n,a)}storeNode(t,e,i,n=4,s=!1){if(0==t&&(!this.stack.length||this.stack[this.stack.length-1]0&&0==t.buffer[n-4]&&t.buffer[n-1]>-1){if(e==i)return;if(t.buffer[n-2]>=e)return void(t.buffer[n-2]=i)}}if(s&&this.pos!=i){let s=this.buffer.length;if(s>0&&0!=this.buffer[s-4])for(;s>0&&this.buffer[s-2]>i;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,n>4&&(n-=4);this.buffer[s]=t,this.buffer[s+1]=e,this.buffer[s+2]=i,this.buffer[s+3]=n}else this.buffer.push(t,e,i,n)}shift(t,e,i){let n=this.pos;if(131072&t)this.pushState(65535&t,this.pos);else if(0==(262144&t)){let s=t,{parser:r}=this.p;(i>this.pos||e<=r.maxNode)&&(this.pos=i,r.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,n),this.shiftContext(e,n),e<=r.maxNode&&this.buffer.push(e,n,i,4)}else this.pos=i,this.shiftContext(e,n),e<=this.p.parser.maxNode&&this.buffer.push(e,n,i,4)}apply(t,e,i){65536&t?this.reduce(t):this.shift(t,e,i)}useNode(t,e){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=t)&&(this.p.reused.push(t),i++);let n=this.pos;this.reducePos=this.pos=n+t.length,this.pushState(e,n),this.buffer.push(i,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let i=t.buffer.slice(e),n=t.bufferBase+e;for(;t&&n==t.bufferBase;)t=t.parent;return new Id(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,n,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let i=t<=this.p.parser.maxNode;i&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,i?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new Nd(this);;){let i=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(0==i)return!1;if(0==(65536&i))return!0;e.reduce(i)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let n,s=0;s1&e&&t==n))||i.push(e[t],n)}e=i}let i=[];for(let t=0;t>19,n=65535&t,s=this.stack.length-3*i;if(s<0||e.getGoto(this.stack[s],n,!1)<0)return!1;this.storeNode(0,this.reducePos,this.reducePos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:t}=this.p;return 65535==t.data[t.stateSlot(this.state,1)]&&!t.stateSlot(this.state,4)}restart(){this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;ethis.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Bd{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}var jd;!function(t){t[t.Insert=200]="Insert",t[t.Delete=190]="Delete",t[t.Reduce=100]="Reduce",t[t.MaxNext=4]="MaxNext",t[t.MaxInsertStackDepth=300]="MaxInsertStackDepth",t[t.DampenInsertStackDepth=120]="DampenInsertStackDepth",t[t.MinBigReduction=2e3]="MinBigReduction"}(jd||(jd={}));class Nd{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=65535&t,i=t>>19;0==i?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(i-1);let n=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=n}}class Gd{constructor(t,e,i){this.stack=t,this.pos=e,this.index=i,this.buffer=t.buffer,0==this.index&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new Gd(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;null!=t&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new Gd(this.stack,this.pos,this.index)}}function Fd(t,e=Uint16Array){if("string"!=typeof t)return t;let i=null;for(let n=0,s=0;n=92&&e--,e>=34&&e--;let s=e-32;if(s>=46&&(s-=46,i=!0),r+=s,i)break;r*=46}i?i[s++]=r:i=new e(r)}return i}class Hd{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Jd=new Hd;class Kd{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Jd,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let i=this.range,n=this.rangeIndex,s=this.pos+t;for(;si.to:s>=i.to;){if(n==this.ranges.length-1)return null;let t=this.ranges[++n];s+=t.from-i.to,i=t}return s}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,e.from);return this.end}peek(t){let e,i,n=this.chunkOff+t;if(n>=0&&n=this.chunk2Pos&&en.to&&(this.chunk2=this.chunk2.slice(0,n.to-e)),i=this.chunk2.charCodeAt(0)}}return e>=this.token.lookAhead&&(this.token.lookAhead=e+1),i}acceptToken(t,e=0){let i=e?this.resolveOffset(e,-1):this.pos;if(null==i||i=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=Jd,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let i="";for(let n of this.ranges){if(n.from>=e)break;n.to>t&&(i+=this.input.read(Math.max(n.from,t),Math.min(n.to,e)))}return i}}class tf{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:i}=e.p;sf(this.data,t,e,this.id,i.data,i.tokenPrecTable)}}tf.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class ef{constructor(t,e,i){this.precTable=e,this.elseToken=i,this.data="string"==typeof t?Fd(t):t}token(t,e){let i=t.pos,n=0;for(;sf(this.data,t,e,0,this.data,this.precTable),!(t.token.value>-1);){if(null==this.elseToken)return;if(t.next<0)break;t.advance(),t.reset(t.pos,t.token),n++}n&&(t.reset(i,t.token),t.acceptToken(this.elseToken,n))}}ef.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class nf{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function sf(t,e,i,n,s,r){let o=0,a=1<0){let i=t[n];if(l.allows(i)&&(-1==e.token.value||e.token.value==i||of(i,e.token.value,s,r))){e.acceptToken(i);break}}let n=e.next,h=0,c=t[o+2];if(!(e.next<0&&c>h&&65535==t[i+3*c-3]&&65535==t[i+3*c-3])){for(;h>1,r=i+s+(s<<1),a=t[r],l=t[r+1]||65536;if(n=l)){o=t[r+2],e.advance();continue t}h=s+1}}break}o=t[i+3*c-1]}}function rf(t,e,i){for(let n,s=e;65535!=(n=t[s]);s++)if(n==i)return s-e;return-1}function of(t,e,i,n){let s=rf(i,n,e);return s<0||rf(i,n,t)e)&&!n.type.isError)return i<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(t.length,Math.max(n.from+1,e+25));if(i<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return i<0?0:t.length}}!function(t){t[t.Margin=25]="Margin"}(hf||(hf={}));let uf=class{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?cf(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?cf(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=r,null;if(s instanceof bo){if(r==t){if(r=Math.max(this.safeFrom,t)&&(this.trees.push(s),this.start.push(r),this.index.push(0))}else this.index[e]++,this.nextStart=r+s.length}}};class df{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map((t=>new Hd))}getActions(t){let e=0,i=null,{parser:n}=t.p,{tokenizers:s}=n,r=n.stateSlot(t.state,3),o=t.curContext?t.curContext.hash:0,a=0;for(let n=0;nh.end+25&&(a=Math.max(h.lookAhead,a)),0!=h.value)){let n=e;if(h.extended>-1&&(e=this.addActions(t,h.extended,h.end,e)),e=this.addActions(t,h.value,h.end,e),!l.extend&&(i=h,e>n))break}}for(;this.actions.length>e;)this.actions.pop();return a&&t.setLookAhead(a),i||t.pos!=this.stream.end||(i=new Hd,i.value=t.p.parser.eofTerm,i.start=i.end=t.pos,e=this.addActions(t,i.value,i.end,e)),this.mainToken=i,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new Hd,{pos:i,p:n}=t;return e.start=i,e.end=Math.min(i+1,n.stream.end),e.value=i==n.stream.end?n.parser.eofTerm:0,e}updateCachedToken(t,e,i){let n=this.stream.clipPos(i.pos);if(e.token(this.stream.reset(n,t),i),t.value>-1){let{parser:e}=i.p;for(let n=0;n=0&&i.p.parser.dialect.allows(s>>1)){0==(1&s)?t.value=s>>1:t.extended=s>>1;break}}}else t.value=0,t.end=this.stream.clipPos(n+1)}putAction(t,e,i,n){for(let e=0;e4*t.bufferLength?new uf(i,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t,e,i=this.stacks,n=this.minStackPos,s=this.stacks=[];if(this.bigReductionCount>300&&1==i.length){let[t]=i;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;rn)s.push(o);else{if(this.advanceStack(o,s,i))continue;{t||(t=[],e=[]),t.push(o);let i=this.tokens.getMainToken(o);e.push(i.value,i.end)}}break}}if(!s.length){let e=t&&function(t){let e=null;for(let i of t){let t=i.p.stoppedAt;(i.pos==i.p.stream.end||null!=t&&i.pos>t)&&i.p.parser.stateFlag(i.state,2)&&(!e||e.scorethis.stoppedAt?t[0]:this.runRecovery(t,e,s);if(i)return this.stackToTree(i.forceAll())}if(this.recovering){let t=1==this.recovering?1:3*this.recovering;if(s.length>t)for(s.sort(((t,e)=>e.score-t.score));s.length>t;)s.pop();s.some((t=>t.reducePos>n))&&this.recovering--}else if(s.length>1){t:for(let t=0;t500&&n.buffer.length>500){if(!((e.score-n.score||e.buffer.length-n.buffer.length)>0)){s.splice(t--,1);continue t}s.splice(i--,1)}}}s.length>12&&s.splice(12,s.length-12)}this.minStackPos=s[0].pos;for(let t=1;t ":"";if(null!=this.stoppedAt&&n>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let e=t.curContext&&t.curContext.tracker.strict,i=e?t.curContext.hash:0;for(let o=this.fragments.nodeAt(n);o;){let n=this.parser.nodeSet.types[o.type.id]==o.type?s.getGoto(t.state,o.type.id):-1;if(n>-1&&o.length&&(!e||(o.prop(ho.contextHash)||0)==i))return t.useNode(o,n),af&&console.log(r+this.stackID(t)+` (via reuse of ${s.getName(o.type.id)})`),!0;if(!(o instanceof bo)||0==o.children.length||o.positions[0]>0)break;let a=o.children[0];if(!(a instanceof bo&&0==o.positions[0]))break;o=a}}let o=s.stateSlot(t.state,4);if(o>0)return t.reduce(o),af&&console.log(r+this.stackID(t)+` (via always-reduce ${s.getName(65535&o)})`),!0;if(t.stack.length>=15e3)for(;t.stack.length>9e3&&t.forceReduce(););let a=this.tokens.getActions(t);for(let o=0;on?e.push(d):i.push(d)}return!1}advanceFully(t,e){let i=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>i)return Of(t,e),!0}}runRecovery(t,e,i){let n=null,s=!1;for(let r=0;r ":"";if(o.deadEnd){if(s)continue;if(s=!0,o.restart(),af&&console.log(h+this.stackID(o)+" (restarted)"),this.advanceFully(o,i))continue}let c=o.split(),u=h;for(let t=0;c.forceReduce()&&t<10;t++){if(af&&console.log(u+this.stackID(c)+" (via force-reduce)"),this.advanceFully(c,i))break;af&&(u=this.stackID(c)+" -> ")}for(let t of o.recoverByInsert(a))af&&console.log(h+this.stackID(t)+" (via recover-insert)"),this.advanceFully(t,i);this.stream.end>o.pos?(l==o.pos&&(l++,a=0),o.recoverByDelete(a,l),af&&console.log(h+this.stackID(o)+` (via recover-delete ${this.parser.getName(a)})`),Of(o,i)):(!n||n.scoret;class bf{constructor(t){this.start=t.start,this.shift=t.shift||mf,this.reduce=t.reduce||mf,this.reuse=t.reuse||mf,this.hash=t.hash||(()=>0),this.strict=!1!==t.strict}}class wf extends Vo{constructor(t){if(super(),this.wrappers=[],14!=t.version)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let i=0;it.topRules[e][1])),n=[];for(let t=0;t=0)s(n,t,e[i++]);else{let r=e[i+-n];for(let o=-n;o>0;o--)s(e[i++],t,r);i++}}}this.nodeSet=new po(e.map(((e,s)=>fo.define({name:s>=this.minRepeatTerm?void 0:e,id:s,props:n[s],top:i.indexOf(s)>-1,error:0==s,skipped:t.skippedNodes&&t.skippedNodes.indexOf(s)>-1})))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=oo;let r=Fd(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let t=0;t"number"==typeof t?new tf(r,t):t)),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,i){let n=new pf(this,t,e,i);for(let s of this.wrappers)n=s(n,t,e,i);return n}getGoto(t,e,i=!1){let n=this.goto;if(e>=n[0])return-1;for(let s=n[e+1];;){let e=n[s++],r=1&e,o=n[s++];if(r&&i)return o;for(let i=s+(e>>1);s0}validAction(t,e){if(e==this.stateSlot(t,4))return!0;for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])return!1;i=vf(this.data,i+2)}if(e==vf(this.data,i+1))return!0}}nextStates(t){let e=[];for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])break;i=vf(this.data,i+2)}if(0==(1&this.data[i+2])){let t=this.data[i+1];e.some(((e,i)=>1&i&&e==t))||e.push(this.data[i],t)}}return e}configure(t){let e=Object.assign(Object.create(wf.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let i=this.topRules[t.top];if(!i)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=i}return t.tokenizers&&(e.tokenizers=this.tokenizers.map((e=>{let i=t.tokenizers.find((t=>t.from==e));return i?i.to:e}))),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map(((i,n)=>{let s=t.specializers.find((t=>t.from==i.external));if(!s)return i;let r=Object.assign(Object.assign({},i),{external:s.to});return e.specializers[n]=yf(r),r}))),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),null!=t.strict&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),null!=t.bufferLength&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return null==e?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),i=e.map((()=>!1));if(t)for(let n of t.split(" ")){let t=e.indexOf(n);t>=0&&(i[t]=!0)}let n=null;for(let t=0;tt.external(i,n)<<1|e}return t.get}const Sf=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],xf=new bf({start:!1,shift:(t,e)=>3==e||4==e||305==e?t:306==e,strict:!1}),kf=new nf(((t,e)=>{let{next:i}=t;(125==i||-1==i||e.context)&&e.canShift(303)&&t.acceptToken(303)}),{contextual:!0,fallback:!0}),Qf=new nf(((t,e)=>{let i,{next:n}=t;Sf.indexOf(n)>-1||(47!=n||47!=(i=t.peek(1))&&42!=i)&&125!=n&&59!=n&&-1!=n&&!e.context&&e.canShift(302)&&t.acceptToken(302)}),{contextual:!0}),$f=new nf(((t,e)=>{let{next:i}=t;if((43==i||45==i)&&(t.advance(),i==t.next)){t.advance();let i=!e.context&&e.canShift(1);t.acceptToken(i?1:2)}}),{contextual:!0}),Pf=ea({"get set async static":Sa.modifier,"for while do if else switch try catch finally return throw break continue default case":Sa.controlKeyword,"in of await yield void typeof delete instanceof":Sa.operatorKeyword,"let var const function class extends":Sa.definitionKeyword,"import export from":Sa.moduleKeyword,"with debugger as new":Sa.keyword,TemplateString:Sa.special(Sa.string),super:Sa.atom,BooleanLiteral:Sa.bool,this:Sa.self,null:Sa.null,Star:Sa.modifier,VariableName:Sa.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":Sa.function(Sa.variableName),VariableDefinition:Sa.definition(Sa.variableName),Label:Sa.labelName,PropertyName:Sa.propertyName,PrivatePropertyName:Sa.special(Sa.propertyName),"CallExpression/MemberExpression/PropertyName":Sa.function(Sa.propertyName),"FunctionDeclaration/VariableDefinition":Sa.function(Sa.definition(Sa.variableName)),"ClassDeclaration/VariableDefinition":Sa.definition(Sa.className),PropertyDefinition:Sa.definition(Sa.propertyName),PrivatePropertyDefinition:Sa.definition(Sa.special(Sa.propertyName)),UpdateOp:Sa.updateOperator,LineComment:Sa.lineComment,BlockComment:Sa.blockComment,Number:Sa.number,String:Sa.string,Escape:Sa.escape,ArithOp:Sa.arithmeticOperator,LogicOp:Sa.logicOperator,BitOp:Sa.bitwiseOperator,CompareOp:Sa.compareOperator,RegExp:Sa.regexp,Equals:Sa.definitionOperator,Arrow:Sa.function(Sa.punctuation),": Spread":Sa.punctuation,"( )":Sa.paren,"[ ]":Sa.squareBracket,"{ }":Sa.brace,"InterpolationStart InterpolationEnd":Sa.special(Sa.brace),".":Sa.derefOperator,", ;":Sa.separator,"@":Sa.meta,TypeName:Sa.typeName,TypeDefinition:Sa.definition(Sa.typeName),"type enum interface implements namespace module declare":Sa.definitionKeyword,"abstract global Privacy readonly override":Sa.modifier,"is keyof unique infer":Sa.operatorKeyword,JSXAttributeValue:Sa.attributeValue,JSXText:Sa.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":Sa.angleBracket,"JSXIdentifier JSXNameSpacedName":Sa.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":Sa.attributeName,"JSXBuiltin/JSXIdentifier":Sa.standard(Sa.tagName)}),Cf={__proto__:null,export:14,as:19,from:27,default:30,async:35,function:36,extends:46,this:50,true:58,false:58,null:70,void:74,typeof:78,super:96,new:130,delete:146,yield:155,await:159,class:164,public:221,private:221,protected:221,readonly:223,instanceof:242,satisfies:245,in:246,const:248,import:280,keyof:335,unique:339,infer:345,is:381,abstract:401,implements:403,type:405,let:408,var:410,interface:417,enum:421,namespace:427,module:429,declare:433,global:437,for:456,of:465,while:468,with:472,do:476,if:480,else:482,switch:486,case:492,try:498,catch:502,finally:506,return:510,throw:514,break:518,continue:522,debugger:526},_f={__proto__:null,async:117,get:119,set:121,declare:181,public:183,private:183,protected:183,static:185,abstract:187,override:189,readonly:195,accessor:197,new:385},Xf={__proto__:null,"<":137},Zf=wf.deserialize({version:14,states:"$6[O`QUOOO%QQUOOO'TQWOOP(bOSOOO*pQ(CjO'#CfO*wOpO'#CgO+VO!bO'#CgO+eO07`O'#DZO-vQUO'#DaO.WQUO'#DlO%QQUO'#D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h)`R3Z.kT*O$u*QR*W$xQ/}*zQ2e.OQ4s0wQ5{2iQ7X4vQ7x5zQ8e7WQ8w7wQ9W8gQ9`8yQ9e9XR9h9alpOXr!X#`%]&d&f&g&i,],b1b1eQ&^!TR,Q&ZV%z|},ZR0q+qR,P&XQ%szR+c%tR+X%nT&b!U&eT&c!U&eT1d,b1e",nodeNames:"⚠ ArithOp ArithOp LineComment BlockComment Script ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXStartTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:364,context:xf,nodeProps:[["group",-26,6,14,16,62,199,203,206,207,209,212,215,225,227,233,235,237,239,242,248,254,256,258,260,262,264,265,"Statement",-32,10,11,25,28,29,35,45,48,49,51,56,64,72,76,78,80,81,103,104,113,114,131,134,136,137,138,139,141,142,162,163,165,"Expression",-23,24,26,30,34,36,38,166,168,170,171,173,174,175,177,178,179,181,182,183,193,195,197,198,"Type",-3,84,96,102,"ClassItem"],["openedBy",31,"InterpolationStart",50,"[",54,"{",69,"(",143,"JSXStartTag",155,"JSXStartTag JSXStartCloseTag"],["closedBy",33,"InterpolationEnd",44,"]",55,"}",70,")",144,"JSXSelfCloseEndTag JSXEndTag",160,"JSXEndTag"]],propSources:[Pf],skippedNodes:[0,3,4,268],repeatNodeCount:33,tokenData:"$>y(CSR!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tu>PuvBavwDxwxGgxyMvyz! Qz{!![{|!%O|}!&]}!O!%O!O!P!'g!P!Q!1w!Q!R#0t!R![#3T![!]#@T!]!^#Aa!^!_#Bk!_!`#GS!`!a#In!a!b#N{!b!c$$z!c!}>P!}#O$&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S;=`+a<%lO%Z%Gh#@b_!a$b$d&j#y%Puw%Zwx(rx}%Z}!O@T!O!Q%Z!Q![>P![!^%Z!^!_*g!_!c%Z!c!}>P!}#O%Z#O#P&c#P#R%Z#R#S>P#S#T%Z#T#o>P#o#p*g#p$f%Z$f$g+g$g#BY>P#BY#BZ$9h#BZ$IS>P$IS$I_$9h$I_$JT>P$JT$JU$9h$JU$KV>P$KV$KW$9h$KW&FU>P&FU&FV$9h&FV;'S>P;'S;=`BZ<%l?HT>P?HT?HU$9h?HUO>P(CS$=Uk$d&j'wp'z!b'n(;d(U!LY't&;d$W#tOY%ZYZ&cZr%Zrs&}st%Ztu>Puw%Zwx(rx}%Z}!O@T!O!Q%Z!Q![>P![!^%Z!^!_*g!_!c%Z!c!}>P!}#O%Z#O#P&c#P#R%Z#R#S>P#S#T%Z#T#o>P#o#p*g#p$g%Z$g;'S>P;'S;=`BZ<%lO>P",tokenizers:[Qf,$f,2,3,4,5,6,7,8,9,10,11,12,13,kf,new ef("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOq~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!O~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(T~~",141,326),new ef("j~RQYZXz{^~^O'q~~aP!P!Qd~iO'r~~",25,308)],topRules:{Script:[0,5],SingleExpression:[1,266],SingleClassItem:[2,267]},dialects:{jsx:12686,ts:12688},dynamicPrecedences:{76:1,78:1,163:1,191:1},specialized:[{term:312,get:t=>Cf[t]||-1},{term:328,get:t=>_f[t]||-1},{term:67,get:t=>Xf[t]||-1}],tokenPrec:12712}),Af=[Dd("function ${name}(${params}) {\n\t${}\n}",{label:"function",detail:"definition",type:"keyword"}),Dd("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n\t${}\n}",{label:"for",detail:"loop",type:"keyword"}),Dd("for (let ${name} of ${collection}) {\n\t${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Dd("do {\n\t${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),Dd("while (${}) {\n\t${}\n}",{label:"while",detail:"loop",type:"keyword"}),Dd("try {\n\t${}\n} catch (${error}) {\n\t${}\n}",{label:"try",detail:"/ catch block",type:"keyword"}),Dd("if (${}) {\n\t${}\n}",{label:"if",detail:"block",type:"keyword"}),Dd("if (${}) {\n\t${}\n} else {\n\t${}\n}",{label:"if",detail:"/ else block",type:"keyword"}),Dd("class ${name} {\n\tconstructor(${params}) {\n\t\t${}\n\t}\n}",{label:"class",detail:"definition",type:"keyword"}),Dd('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Dd('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Tf=new Ro,Rf=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Ef(t){return(e,i)=>{let n=e.node.getChild("VariableDefinition");return n&&i(n,t),!0}}const Vf=["FunctionDeclaration"],Mf={FunctionDeclaration:Ef("function"),ClassDeclaration:Ef("class"),ClassExpression:()=>!0,EnumDeclaration:Ef("constant"),TypeAliasDeclaration:Ef("type"),NamespaceDeclaration:Ef("namespace"),VariableDefinition(t,e){t.matchContext(Vf)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function Df(t,e){let i=Tf.get(e);if(i)return i;let n=[],s=!0;function r(e,i){let s=t.sliceString(e.from,e.to);n.push({label:s,type:i})}return e.cursor(mo.IncludeAnonymous).iterate((e=>{if(s)s=!1;else if(e.name){let t=Mf[e.name];if(t&&t(e,r)||Rf.has(e.name))return!1}else if(e.to-e.from>8192){for(let i of Df(t,e.node))n.push(i);return!1}})),Tf.set(e,n),n}const Wf=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Uf=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName"];function Yf(t){let e=Xa(t.state).resolveInner(t.pos,-1);if(Uf.indexOf(e.name)>-1)return null;let i="VariableName"==e.name||e.to-e.from<20&&Wf.test(t.state.sliceDoc(e.from,e.to));if(!i&&!t.explicit)return null;let n=[];for(let i=e;i;i=i.parent)Rf.has(i.name)&&(n=n.concat(Df(t.state.doc,i)));return{options:n,from:i?e.from:t.pos,validFor:Wf}}const qf=_a.define({name:"javascript",parser:Zf.configure({props:[Na.add({IfStatement:il({except:/^\s*({|else\b)/}),TryStatement:il({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:t=>t.baseIndent,SwitchBody:t=>{let e=t.textAfter,i=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return t.baseIndent+(i?0:n?1:2)*t.unit},Block:tl({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":il({except:/^{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag":t=>t.column(t.node.from)+t.unit}),rl.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression":ol,BlockComment:t=>({from:t.from+2,to:t.to-2})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Lf={test:t=>/^JSX/.test(t.name),facet:Qa({commentTokens:{block:{open:"{/*",close:"*/}"}}})},zf=qf.configure({dialect:"ts"},"typescript"),If=qf.configure({dialect:"jsx",props:[$a.add((t=>t.isTop?[Lf]:void 0))]}),Bf=qf.configure({dialect:"jsx ts",props:[$a.add((t=>t.isTop?[Lf]:void 0))]},"typescript"),jf="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map((t=>({label:t,type:"keyword"})));function Nf(t={}){let e=t.jsx?t.typescript?Bf:If:t.typescript?zf:qf;return new Ua(e,[qf.data.of({autocomplete:(i=Uf,n=zu(Af.concat(jf)),t=>{for(let e=Xa(t.state).resolveInner(t.pos,-1);e;e=e.parent){if(i.indexOf(e.name)>-1)return null;if(e.type.isTop)break}return n(t)})}),qf.data.of({autocomplete:Yf}),t.jsx?Hf:[]]);var i,n}function Gf(t,e,i=t.length){for(let n=null==e?void 0:e.firstChild;n;n=n.nextSibling)if("JSXIdentifier"==n.name||"JSXBuiltin"==n.name||"JSXNamespacedName"==n.name||"JSXMemberExpression"==n.name)return t.sliceString(n.from,Math.min(n.to,i));return""}const Ff="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),Hf=Ts.inputHandler.of(((t,e,i,n)=>{if((Ff?t.composing:t.compositionStarted)||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!qf.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((t=>{var e,i;let r,{head:o}=t,a=Xa(s).resolveInner(o,-1);if("JSXStartTag"==a.name&&(a=a.parent),">"==n&&"JSXFragmentTag"==a.name)return{range:A.cursor(o+1),changes:{from:o,insert:">"}};if("/"==n&&"JSXFragmentTag"==a.name){let t=a.parent,i=null==t?void 0:t.parent;if(t.from==o-1&&"JSXEndTag"!=(null===(e=i.lastChild)||void 0===e?void 0:e.name)&&(r=Gf(s.doc,null==i?void 0:i.firstChild,o))){let t=`/${r}>`;return{range:A.cursor(o+t.length),changes:{from:o,insert:t}}}}else if(">"==n){let t=function(t){for(;;){if("JSXOpenTag"==t.name||"JSXSelfClosingTag"==t.name||"JSXFragmentTag"==t.name)return t;if(!t.parent)return null;t=t.parent}}(a);if(t&&"JSXEndTag"!=(null===(i=t.lastChild)||void 0===i?void 0:i.name)&&"`}}}return{range:t}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)}));class Jf{constructor(t,e,i,n,s,r,o){this.type=t,this.value=e,this.from=i,this.hash=n,this.end=s,this.children=r,this.positions=o,this.hashProp=[[ho.contextHash,n]]}static create(t,e,i,n,s){return new Jf(t,e,i,n+(n<<8)+t+(e<<4)|0,s,[],[])}addChild(t,e){t.prop(ho.contextHash)!=this.hash&&(t=new bo(t.type,t.children,t.positions,t.length,this.hashProp)),this.children.push(t),this.positions.push(e)}toTree(t,e=this.end){let i=this.children.length-1;return i>=0&&(e=Math.max(e,this.positions[i]+this.children[i].length+this.from)),new bo(t.types[this.type],this.children,this.positions,e-this.from).balance({makeTree:(t,e,i)=>new bo(fo.none,t,e,i,this.hashProp)})}}var Kf;!function(t){t[t.Document=1]="Document",t[t.CodeBlock=2]="CodeBlock",t[t.FencedCode=3]="FencedCode",t[t.Blockquote=4]="Blockquote",t[t.HorizontalRule=5]="HorizontalRule",t[t.BulletList=6]="BulletList",t[t.OrderedList=7]="OrderedList",t[t.ListItem=8]="ListItem",t[t.ATXHeading1=9]="ATXHeading1",t[t.ATXHeading2=10]="ATXHeading2",t[t.ATXHeading3=11]="ATXHeading3",t[t.ATXHeading4=12]="ATXHeading4",t[t.ATXHeading5=13]="ATXHeading5",t[t.ATXHeading6=14]="ATXHeading6",t[t.SetextHeading1=15]="SetextHeading1",t[t.SetextHeading2=16]="SetextHeading2",t[t.HTMLBlock=17]="HTMLBlock",t[t.LinkReference=18]="LinkReference",t[t.Paragraph=19]="Paragraph",t[t.CommentBlock=20]="CommentBlock",t[t.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",t[t.Escape=22]="Escape",t[t.Entity=23]="Entity",t[t.HardBreak=24]="HardBreak",t[t.Emphasis=25]="Emphasis",t[t.StrongEmphasis=26]="StrongEmphasis",t[t.Link=27]="Link",t[t.Image=28]="Image",t[t.InlineCode=29]="InlineCode",t[t.HTMLTag=30]="HTMLTag",t[t.Comment=31]="Comment",t[t.ProcessingInstruction=32]="ProcessingInstruction",t[t.URL=33]="URL",t[t.HeaderMark=34]="HeaderMark",t[t.QuoteMark=35]="QuoteMark",t[t.ListMark=36]="ListMark",t[t.LinkMark=37]="LinkMark",t[t.EmphasisMark=38]="EmphasisMark",t[t.CodeMark=39]="CodeMark",t[t.CodeText=40]="CodeText",t[t.CodeInfo=41]="CodeInfo",t[t.LinkTitle=42]="LinkTitle",t[t.LinkLabel=43]="LinkLabel"}(Kf||(Kf={}));class tp{constructor(t,e){this.start=t,this.content=e,this.marks=[],this.parsers=[]}}class ep{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let t=this.skipSpace(this.basePos);this.indent=this.countIndent(t,this.pos,this.indent),this.pos=t,this.next=t==this.text.length?-1:this.text.charCodeAt(t)}skipSpace(t){return rp(this.text,t)}reset(t){for(this.text=t,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(t){this.basePos=t,this.baseIndent=this.countIndent(t,this.pos,this.indent)}moveBaseColumn(t){this.baseIndent=t,this.basePos=this.findColumn(t)}addMarker(t){this.markers.push(t)}countIndent(t,e=0,i=0){for(let n=e;n=e.stack[i.depth+1].value+i.baseIndent)return!0;if(i.indent>=i.baseIndent+4)return!1;let n=(t.type==Kf.OrderedList?dp:up)(i,e,!1);return n>0&&(t.type!=Kf.BulletList||hp(i,e,!1)<0)&&i.text.charCodeAt(i.pos+n-1)==t.value}const np={[Kf.Blockquote]:(t,e,i)=>62==i.next&&(i.markers.push(Up(Kf.QuoteMark,e.lineStart+i.pos,e.lineStart+i.pos+1)),i.moveBase(i.pos+(sp(i.text.charCodeAt(i.pos+1))?2:1)),t.end=e.lineStart+i.text.length,!0),[Kf.ListItem]:(t,e,i)=>!(i.indent-1)&&(i.moveBaseColumn(i.baseIndent+t.value),!0),[Kf.OrderedList]:ip,[Kf.BulletList]:ip,[Kf.Document]:()=>!0};function sp(t){return 32==t||9==t||10==t||13==t}function rp(t,e=0){for(;ei&&sp(t.charCodeAt(e-1));)e--;return e}function ap(t){if(96!=t.next&&126!=t.next)return-1;let e=t.pos+1;for(;e-1&&t.depth==e.stack.length||n<3?-1:1}function cp(t,e){for(let i=t.stack.length-1;i>=0;i--)if(t.stack[i].type==e)return!0;return!1}function up(t,e,i){return 45!=t.next&&43!=t.next&&42!=t.next||t.pos!=t.text.length-1&&!sp(t.text.charCodeAt(t.pos+1))||!(!i||cp(e,Kf.BulletList)||t.skipSpace(t.pos+2)=48&&s<=57;){if(n++,n==t.text.length)return-1;s=t.text.charCodeAt(n)}return n==t.pos||n>t.pos+9||46!=s&&41!=s||nt.pos+1||49!=t.next)?-1:n+1-t.pos}function fp(t){if(35!=t.next)return-1;let e=t.pos+1;for(;e6?-1:i}function pp(t){if(45!=t.next&&61!=t.next||t.indent>=t.baseIndent+4)return-1;let e=t.pos+1;for(;e/,mp=/\?>/,bp=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*/i.exec(n);if(r)return t.append(Up(Kf.Comment,i,i+1+r[0].length));let o=/^\?[^]*?\?>/.exec(n);if(o)return t.append(Up(Kf.ProcessingInstruction,i,i+1+o[0].length));let a=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(n);return a?t.append(Up(Kf.HTMLTag,i,i+1+a[0].length)):-1},Emphasis(t,e,i){if(95!=e&&42!=e)return-1;let n=i+1;for(;t.char(n)==e;)n++;let s=t.slice(i-1,i),r=t.slice(n,n+1),o=jp.test(s),a=jp.test(r),l=/\s|^$/.test(s),h=/\s|^$/.test(r),c=!h&&(!a||l||o),u=!l&&(!o||h||a),d=c&&(42==e||!u||o),f=u&&(42==e||!c||a);return t.append(new Ip(95==e?Yp:qp,i,n,(d?1:0)|(f?2:0)))},HardBreak(t,e,i){if(92==e&&10==t.char(i+1))return t.append(Up(Kf.HardBreak,i,i+2));if(32==e){let e=i+1;for(;32==t.char(e);)e++;if(10==t.char(e)&&e>=i+2)return t.append(Up(Kf.HardBreak,i,e+1))}return-1},Link:(t,e,i)=>91==e?t.append(new Ip(Lp,i,i+1,1)):-1,Image:(t,e,i)=>33==e&&91==t.char(i+1)?t.append(new Ip(zp,i,i+2,1)):-1,LinkEnd(t,e,i){if(93!=e)return-1;for(let e=t.parts.length-1;e>=0;e--){let n=t.parts[e];if(n instanceof Ip&&(n.type==Lp||n.type==zp)){if(!n.side||t.skipSpace(n.to)==i&&!/[(\[]/.test(t.slice(i+1,i+2)))return t.parts[e]=null,-1;let s=t.takeContent(e),r=t.parts[e]=Gp(t,s,n.type==Lp?Kf.Link:Kf.Image,n.from,i+1);if(n.type==Lp)for(let i=0;ie?Up(Kf.URL,e+i,s+i):s==t.length&&null}}function Hp(t,e,i){let n=t.charCodeAt(e);if(39!=n&&34!=n&&40!=n)return!1;let s=40==n?41:n;for(let n=e+1,r=!1;n=this.end?-1:this.text.charCodeAt(t-this.offset)}get end(){return this.offset+this.text.length}slice(t,e){return this.text.slice(t-this.offset,e-this.offset)}append(t){return this.parts.push(t),t.to}addDelimiter(t,e,i,n,s){return this.append(new Ip(t,e,i,(n?1:0)|(s?2:0)))}addElement(t){return this.append(t)}resolveMarkers(t){for(let e=t;e=t;o--){let t=this.parts[o];if(t instanceof Ip&&1&t.side&&t.type==i.type&&!(s&&(1&i.side||2&t.side)&&(t.to-t.from+r)%3==0&&((t.to-t.from)%3||r%3))){n=t;break}}if(!n)continue;let a=i.type.resolve,l=[],h=n.from,c=i.to;if(s){let t=Math.min(2,n.to-n.from,r);h=n.to-t,c=i.from+t,a=1==t?"Emphasis":"StrongEmphasis"}n.type.mark&&l.push(this.elt(n.type.mark,h,n.to));for(let t=o+1;t=0;e--){let i=this.parts[e];if(i instanceof Ip&&i.type==t)return e}return null}takeContent(t){let e=this.resolveMarkers(t);return this.parts.length=t,e}skipSpace(t){return rp(this.text,t-this.offset)+this.offset}elt(t,e,i,n){return"string"==typeof t?Up(this.parser.getNodeType(t),e,i,n):new Wp(t,e)}}function tO(t,e){if(!e.length)return t;if(!t.length)return e;let i=t.slice(),n=0;for(let t of e){for(;n(t?t-1:0))return!1;if(this.fragmentEnd<0){let t=this.fragment.to;for(;t>0&&"\n"!=this.input.read(t-1,t);)t--;this.fragmentEnd=t?t-1:0}let i=this.cursor;i||(i=this.cursor=this.fragment.tree.cursor(),i.firstChild());let n=t+this.fragment.offset;for(;i.to<=n;)if(!i.parent())return!1;for(;;){if(i.from>=n)return this.fragment.from<=e;if(!i.childAfter(n))return!1}}matches(t){let e=this.cursor.tree;return e&&e.prop(ho.contextHash)==t}takeNodes(t){let e=this.cursor,i=this.fragment.offset,n=this.fragmentEnd-(this.fragment.openEnd?1:0),s=t.absoluteLineStart,r=s,o=t.block.children.length,a=r,l=o;for(;;){if(e.to-i>n){if(e.type.isAnonymous&&e.firstChild())continue;break}if(t.dontInject.add(e.tree),t.addNode(e.tree,e.from-i),e.type.is("Block")&&(eO.indexOf(e.type.id)<0?(r=e.to-i,o=t.block.children.length):(r=a,o=l,a=e.to-i,l=t.block.children.length)),!e.nextSibling())break}for(;t.block.children.length>o;)t.block.children.pop(),t.block.positions.pop();return r-s}}const nO=ea({"Blockquote/...":Sa.quote,HorizontalRule:Sa.contentSeparator,"ATXHeading1/... SetextHeading1/...":Sa.heading1,"ATXHeading2/... SetextHeading2/...":Sa.heading2,"ATXHeading3/...":Sa.heading3,"ATXHeading4/...":Sa.heading4,"ATXHeading5/...":Sa.heading5,"ATXHeading6/...":Sa.heading6,"Comment CommentBlock":Sa.comment,Escape:Sa.escape,Entity:Sa.character,"Emphasis/...":Sa.emphasis,"StrongEmphasis/...":Sa.strong,"Link/... Image/...":Sa.link,"OrderedList/... BulletList/...":Sa.list,"BlockQuote/...":Sa.quote,"InlineCode CodeText":Sa.monospace,URL:Sa.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":Sa.processingInstruction,"CodeInfo LinkLabel":Sa.labelName,LinkTitle:Sa.string,Paragraph:Sa.content}),sO=new Zp(new po(Ep).extend(nO),Object.keys(Sp).map((t=>Sp[t])),Object.keys(Sp).map((t=>$p[t])),Object.keys(Sp),Pp,np,Object.keys(Np).map((t=>Np[t])),Object.keys(Np),[]);function rO(t,e,i){let n=[];for(let s=t.firstChild,r=e;;s=s.nextSibling){let t=s?s.from:i;if(t>r&&n.push({from:r,to:t}),!s)break;r=s.to}return n}const oO={resolve:"Strikethrough",mark:"StrikethroughMark"},aO={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":Sa.strikethrough}},{name:"StrikethroughMark",style:Sa.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,i){if(126!=e||126!=t.char(i+1)||126==t.char(i+2))return-1;let n=t.slice(i-1,i),s=t.slice(i+2,i+3),r=/\s|^$/.test(n),o=/\s|^$/.test(s),a=jp.test(n),l=jp.test(s);return t.addDelimiter(oO,i,i+2,!o&&(!l||r||a),!r&&(!a||o||l))},after:"Emphasis"}]};function lO(t,e,i=0,n,s=0){let r=0,o=!0,a=-1,l=-1,h=!1,c=()=>{n.push(t.elt("TableCell",s+a,s+l,t.parser.parseInline(e.slice(a,l),s+a)))};for(let u=i;u-1)&&r++,o=!1,n&&(a>-1&&c(),n.push(t.elt("TableDelimiter",u+s,u+s+1))),a=l=-1),h=!h&&92==i}return a>-1&&(r++,n&&c()),r}function hO(t,e){for(let i=e;ihO(e.content,0)?new uO:null,endLeaf(t,e,i){if(i.parsers.some((t=>t instanceof uO))||!hO(e.text,e.basePos))return!1;let n=t.scanLine(t.absoluteLineEnd+1).text;return cO.test(n)&&lO(t,e.text,e.basePos)==lO(t,n,e.basePos)},before:"SetextHeading"}]};class fO{nextLine(){return!1}finish(t,e){return t.addLeafElement(e,t.elt("Task",e.start,e.start+e.content.length,[t.elt("TaskMarker",e.start,e.start+3),...t.parser.parseInline(e.content.slice(3),e.start+3)])),!0}}const pO=[dO,{defineNodes:[{name:"Task",block:!0,style:Sa.list},{name:"TaskMarker",style:Sa.atom}],parseBlock:[{name:"TaskList",leaf:(t,e)=>/^\[[ xX]\]/.test(e.content)&&"ListItem"==t.parentType().name?new fO:null,after:"SetextHeading"}]},aO];function OO(t,e,i){return(n,s,r)=>{if(s!=t||n.char(r+1)==t)return-1;let o=[n.elt(i,r,r+1)];for(let s=r+1;s=65&&r<=90||95==r||r>=97&&r<=122||r>=161;)s+=String.fromCharCode(n),n=t.peek(++e);var r;return RO=t,EO=i,TO=s?s.toLowerCase():n==MO||n==DO?void 0:null}const MO=63,DO=33;function WO(t,e){this.name=t,this.parent=e,this.hash=e?e.hash:0;for(let e=0;eUO.indexOf(e)>-1?new WO(VO(n,1)||"",t):t,reduce:(t,e)=>e==wO&&t?t.parent:t,reuse(t,e,i,n){let s=e.type.id;return 6==s||36==s?new WO(VO(n,1)||"",t):t},hash:t=>t?t.hash:0,strict:!1}),qO=new nf(((t,e)=>{if(60!=t.next)return void(t.next<0&&e.context&&t.acceptToken(57));t.advance();let i=47==t.next;i&&t.advance();let n=VO(t,0);if(void 0===n)return;if(!n)return t.acceptToken(i?14:6);let s=e.context?e.context.name:null;if(i){if(n==s)return t.acceptToken(11);if(s&&XO[s])return t.acceptToken(57,-2);if(e.dialectEnabled(0))return t.acceptToken(12);for(let t=e.context;t;t=t.parent)if(t.name==n)return;t.acceptToken(13)}else{if("script"==n)return t.acceptToken(7);if("style"==n)return t.acceptToken(8);if("textarea"==n)return t.acceptToken(9);if(_O.hasOwnProperty(n))return t.acceptToken(10);s&&ZO[s]&&ZO[s][n]?t.acceptToken(57,-1):t.acceptToken(6)}}),{contextual:!0}),LO=new nf((t=>{for(let e=0,i=0;;i++){if(t.next<0){i&&t.acceptToken(58);break}if(45==t.next)e++;else{if(62==t.next&&e>=2){i>3&&t.acceptToken(58,-2);break}e=0}t.advance()}}));const zO=new nf(((t,e)=>{if(47==t.next&&62==t.peek(1)){let i=e.dialectEnabled(1)||function(t){for(;t;t=t.parent)if("svg"==t.name||"math"==t.name)return!0;return!1}(e.context);t.acceptToken(i?5:4,2)}else 62==t.next&&t.acceptToken(4,1)}));function IO(t,e,i){let n=2+t.length;return new nf((s=>{for(let r=0,o=0,a=0;;a++){if(s.next<0){a&&s.acceptToken(e);break}if(0==r&&60==s.next||1==r&&47==s.next||r>=2&&ro?s.acceptToken(e,-o):s.acceptToken(i,-(o-2));break}if((10==s.next||13==s.next)&&a){s.acceptToken(e,1);break}r=o=0}else o++;s.advance()}}))}const BO=IO("script",54,1),jO=IO("style",55,2),NO=IO("textarea",56,3),GO=ea({"Text RawText":Sa.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":Sa.angleBracket,TagName:Sa.tagName,"MismatchedCloseTag/TagName":[Sa.tagName,Sa.invalid],AttributeName:Sa.attributeName,"AttributeValue UnquotedAttributeValue":Sa.attributeValue,Is:Sa.definitionOperator,"EntityReference CharacterReference":Sa.character,Comment:Sa.blockComment,ProcessingInst:Sa.processingInstruction,DoctypeDecl:Sa.documentMeta}),FO=wf.deserialize({version:14,states:",xOVO!rOOO!WQ#tO'#CqO!]Q#tO'#CzO!bQ#tO'#C}O!gQ#tO'#DQO!lQ#tO'#DSO!qOaO'#CpO!|ObO'#CpO#XOdO'#CpO$eO!rO'#CpOOO`'#Cp'#CpO$lO$fO'#DTO$tQ#tO'#DVO$yQ#tO'#DWOOO`'#Dk'#DkOOO`'#DY'#DYQVO!rOOO%OQ&rO,59]O%WQ&rO,59fO%`Q&rO,59iO%hQ&rO,59lO%sQ&rO,59nOOOa'#D^'#D^O%{OaO'#CxO&WOaO,59[OOOb'#D_'#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OP!WO!Z!XO~O!XiOQoX!ZoX~OQ!ZO!Z!XO~O!YlORrX!ZrX~OR!]O!Z!XO~O!Z!XO~P#dOf!_O~O![sO!e!aO~OS!bO~OS!cO~Oi!dOSgXhgXTgX~OS!fOhyO~OS!gOhyO~OS!hOhyO~OS!iOT!jOhyO~OS!jOhyO~Of!kO~Of!lO~Of!mO~OS!nO~Ok!qO!`!oO!b!pO~OS!rO~OS!sO~OS!tO~Oa!uOb!uOc!uO!`!wO!a!uO~Oa!xOb!xOc!xO!b!wO!c!xO~Oa!uOb!uOc!uO!`!{O!a!uO~Oa!xOb!xOc!xO!b!{O!c!xO~OT~bac!dx{!d~",goto:"%p!`PPPPPPPPPPPPPPPPPPPP!a!gP!mPP!yP!|#P#S#Y#]#`#f#i#l#r#x!aP!a!aP$O$U$l$r$x%O%U%[%bPPPPPPPP%hX^OX`pXUOX`pezabcde{}!P!R!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ}bQ!PcQ!RdQ!UeZ!e{}!P!R!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:67,context:YO,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,21,30,33,36,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,29,32,35,37,"OpenTag"],["group",-9,14,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Hpx!P!Nc!P!Q!Hp!Q!_!Nc!_!a!Hp!a!b# p!b#s!Nc#s$f!Hp$f;'S!Nc;'S;=`#!}<%l?Ah!Nc?Ah?BY!Hp?BY?Mn!Nc?MnO!HpT# ubhSOq!Hpqr!Ncrs!Hpsw!Ncwx!Hpx!P!Nc!P!Q!Hp!Q!_!Nc!_!`!Hp!`!a!If!a#s!Nc#s$f!Hp$f;'S!Nc;'S;=`#!}<%l?Ah!Nc?Ah?BY!Hp?BY?Mn!Nc?MnO!HpT##QP;=`<%l!Nc!V##^chS!a`!cpOq!G_qr!Eyrs!HUsv!Eyvw!Ncwx!Jvx!P!Ey!P!Q!G_!Q!_!Ey!_!`!G_!`!a!Mm!a#s!Ey#s$f!G_$f;'S!Ey;'S;=`#$i<%l?Ah!Ey?Ah?BY!G_?BY?Mn!Ey?MnO!G_!V#$lP;=`<%l!Ey!V#$zXiS`P!a`!cpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X",tokenizers:[BO,jO,NO,zO,qO,LO,0,1,2,3,4,5],topRules:{Document:[0,15]},dialects:{noMatch:0,selfClosing:485},tokenPrec:487});function HO(t,e){let i=Object.create(null);for(let n of t.getChildren(yO)){let t=n.getChild(SO),s=n.getChild(xO)||n.getChild(kO);t&&(i[e.read(t.from,t.to)]=s?s.type.id==xO?e.read(s.from+1,s.to-1):e.read(s.from,s.to):"")}return i}function JO(t,e){let i=t.getChild(vO);return i?e.read(i.from,i.to):" "}function KO(t,e,i){let n;for(let s of i)if(!s.attrs||s.attrs(n||(n=HO(t.node.parent.firstChild,e))))return{parser:s.parser};return null}function tg(t=[],e=[]){let i=[],n=[],s=[],r=[];for(let e of t){("script"==e.tag?i:"style"==e.tag?n:"textarea"==e.tag?s:r).push(e)}let o=e.length?Object.create(null):null;for(let t of e)(o[t.name]||(o[t.name]=[])).push(t);return Do(((t,e)=>{let a=t.type.id;if(a==QO)return KO(t,e,i);if(a==$O)return KO(t,e,n);if(a==PO)return KO(t,e,s);if(a==wO&&r.length){let i,n=t.node,s=n.firstChild,o=s&&JO(s,e);if(o)for(let t of r)if(t.tag==o&&(!t.attrs||t.attrs(i||(i=HO(n,e))))){let e=n.lastChild;return{parser:t.parser,overlay:[{from:s.to,to:e.type.id==CO?e.from:n.to}]}}}if(o&&a==yO){let i,n=t.node;if(i=n.firstChild){let t=o[e.read(i.from,i.to)];if(t)for(let i of t){if(i.tagName&&i.tagName!=JO(n.parent,e))continue;let t=n.lastChild;if(t.type.id==xO){let e=t.from+1,n=t.lastChild,s=t.to-(n&&n.isError?0:1);if(s>e)return{parser:i.parser,overlay:[{from:e,to:s}]}}else if(t.type.id==kO)return{parser:i.parser,overlay:[{from:t.from,to:t.to}]}}}}return null}))}const eg=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288];function ig(t){return t>=65&&t<=90||t>=97&&t<=122||t>=161}const ng=new nf(((t,e)=>{for(let n=!1,s=0,r=0;;r++){let{next:o}=t;if(!(ig(o)||45==o||95==o||n&&(i=o,i>=48&&i<=57))){n&&t.acceptToken(40==o?95:2==s&&e.canShift(2)?2:96);break}!n&&(45!=o||r>0)&&(n=!0),s===r&&45==o&&s++,t.advance()}var i})),sg=new nf((t=>{if(eg.includes(t.peek(-1))){let{next:e}=t;(ig(e)||95==e||35==e||46==e||91==e||58==e||45==e)&&t.acceptToken(94)}})),rg=new nf((t=>{if(!eg.includes(t.peek(-1))){let{next:e}=t;if(37==e&&(t.advance(),t.acceptToken(1)),ig(e)){do{t.advance()}while(ig(t.next));t.acceptToken(1)}}})),og=ea({"AtKeyword import charset namespace keyframes media supports":Sa.definitionKeyword,"from to selector":Sa.keyword,NamespaceName:Sa.namespace,KeyframeName:Sa.labelName,TagName:Sa.tagName,ClassName:Sa.className,PseudoClassName:Sa.constant(Sa.className),IdName:Sa.labelName,"FeatureName PropertyName":Sa.propertyName,AttributeName:Sa.attributeName,NumberLiteral:Sa.number,KeywordQuery:Sa.keyword,UnaryQueryOp:Sa.operatorKeyword,"CallTag ValueName":Sa.atom,VariableName:Sa.variableName,Callee:Sa.operatorKeyword,Unit:Sa.unit,"UniversalSelector NestingSelector":Sa.definitionOperator,MatchOp:Sa.compareOperator,"ChildOp SiblingOp, LogicOp":Sa.logicOperator,BinOp:Sa.arithmeticOperator,Important:Sa.modifier,Comment:Sa.blockComment,ParenthesizedContent:Sa.special(Sa.name),ColorLiteral:Sa.color,StringLiteral:Sa.string,":":Sa.punctuation,"PseudoOp #":Sa.derefOperator,"; ,":Sa.separator,"( )":Sa.paren,"[ ]":Sa.squareBracket,"{ }":Sa.brace}),ag={__proto__:null,lang:32,"nth-child":32,"nth-last-child":32,"nth-of-type":32,"nth-last-of-type":32,dir:32,"host-context":32,url:60,"url-prefix":60,domain:60,regexp:60,selector:134},lg={__proto__:null,"@import":114,"@media":138,"@charset":142,"@namespace":146,"@keyframes":152,"@supports":164},hg={__proto__:null,not:128,only:128,from:158,to:160},cg=wf.deserialize({version:14,states:"7WQYQ[OOO#_Q[OOOOQP'#Cd'#CdOOQP'#Cc'#CcO#fQ[O'#CfO$YQXO'#CaO$aQ[O'#ChO$lQ[O'#DPO$qQ[O'#DTOOQP'#Ed'#EdO$vQdO'#DeO%bQ[O'#DrO$vQdO'#DtO%sQ[O'#DvO&OQ[O'#DyO&TQ[O'#EPO&cQ[O'#EROOQS'#Ec'#EcOOQS'#ET'#ETQYQ[OOO&jQXO'#CdO'_QWO'#DaO'dQWO'#EjO'oQ[O'#EjQOQWOOOOQP'#Cg'#CgOOQP,59Q,59QO#fQ[O,59QO'yQ[O'#EWO(eQWO,58{O(mQ[O,59SO$lQ[O,59kO$qQ[O,59oO'yQ[O,59sO'yQ[O,59uO'yQ[O,59vO(xQ[O'#D`OOQS,58{,58{OOQP'#Ck'#CkOOQO'#C}'#C}OOQP,59S,59SO)PQWO,59SO)UQWO,59SOOQP'#DR'#DROOQP,59k,59kOOQO'#DV'#DVO)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oGw#o;'S%^;'S;=`%o<%lO%^XHO[!YPoWOy%^z}%^}!OGw!O!Q%^!Q![Gw![!c%^!c!}Gw!}#T%^#T#oGw#o;'S%^;'S;=`%o<%lO%^XHySxPOy%^z;'S%^;'S;=`%o<%lO%^^I[SvUOy%^z;'S%^;'S;=`%o<%lO%^XIkUOy%^z#b%^#b#cI}#c;'S%^;'S;=`%o<%lO%^XJSUoWOy%^z#W%^#W#XJf#X;'S%^;'S;=`%o<%lO%^XJmS!`PoWOy%^z;'S%^;'S;=`%o<%lO%^XJ|UOy%^z#f%^#f#gJf#g;'S%^;'S;=`%o<%lO%^XKeS!RPOy%^z;'S%^;'S;=`%o<%lO%^_KvS!QVOy%^z;'S%^;'S;=`%o<%lO%^ZLXU!PPOy%^z!_%^!_!`6y!`;'S%^;'S;=`%o<%lO%^WLnP;=`<%l$}",tokenizers:[sg,rg,ng,0,1,2,3],topRules:{StyleSheet:[0,4],Styles:[1,84]},specialized:[{term:95,get:t=>ag[t]||-1},{term:56,get:t=>lg[t]||-1},{term:96,get:t=>hg[t]||-1}],tokenPrec:1123});let ug=null;function dg(){if(!ug&&"object"==typeof document&&document.body){let{style:t}=document.body,e=[],i=new Set;for(let n in t)"cssText"!=n&&"cssFloat"!=n&&"string"==typeof t[n]&&(/[A-Z]/.test(n)&&(n=n.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))),i.has(n)||(e.push(n),i.add(n)));ug=e.sort().map((t=>({type:"property",label:t})))}return ug||[]}const fg=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map((t=>({type:"class",label:t}))),pg=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map((t=>({type:"keyword",label:t}))).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map((t=>({type:"constant",label:t})))),Og=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map((t=>({type:"type",label:t}))),gg=/^(\w[\w-]*|-\w[\w-]*|)$/,mg=/^-(-[\w-]*)?$/;const bg=new Ro,wg=["Declaration"];function vg(t){for(let e=t;;){if(e.type.isTop)return e;if(!(e=e.parent))return t}}function yg(t,e,i){if(e.to-e.from>4096){let n=bg.get(e);if(n)return n;let s=[],r=new Set,o=e.cursor(mo.IncludeAnonymous);if(o.firstChild())do{for(let e of yg(t,o.node,i))r.has(e.label)||(r.add(e.label),s.push(e))}while(o.nextSibling());return bg.set(e,s),s}{let n=[],s=new Set;return e.cursor().iterate((e=>{var r;if(i(e)&&e.matchContext(wg)&&":"==(null===(r=e.node.nextSibling)||void 0===r?void 0:r.name)){let i=t.sliceString(e.from,e.to);s.has(i)||(s.add(i),n.push({label:i,type:"variable"}))}})),n}}const Sg=t=>e=>{let{state:i,pos:n}=e,s=Xa(i).resolveInner(n,-1),r=s.type.isError&&s.from==s.to-1&&"-"==i.doc.sliceString(s.from,s.to);if("PropertyName"==s.name||(r||"TagName"==s.name)&&/^(Block|Styles)$/.test(s.resolve(s.to).name))return{from:s.from,options:dg(),validFor:gg};if("ValueName"==s.name)return{from:s.from,options:pg,validFor:gg};if("PseudoClassName"==s.name)return{from:s.from,options:fg,validFor:gg};if(t(s)||(e.explicit||r)&&function(t,e){var i;if(("("==t.name||t.type.isError)&&(t=t.parent||t),"ArgList"!=t.name)return!1;let n=null===(i=t.parent)||void 0===i?void 0:i.firstChild;return"Callee"==(null==n?void 0:n.name)&&"var"==e.sliceString(n.from,n.to)}(s,i.doc))return{from:t(s)||r?s.from:n,options:yg(i.doc,vg(s),t),validFor:mg};if("TagName"==s.name){for(let{parent:t}=s;t;t=t.parent)if("Block"==t.name)return{from:s.from,options:dg(),validFor:gg};return{from:s.from,options:Og,validFor:gg}}if(!e.explicit)return null;let o=s.resolve(n),a=o.childBefore(n);return a&&":"==a.name&&"PseudoClassSelector"==o.name?{from:n,options:fg,validFor:gg}:a&&":"==a.name&&"Declaration"==o.name||"ArgList"==o.name?{from:n,options:pg,validFor:gg}:"Block"==o.name||"Styles"==o.name?{from:n,options:dg(),validFor:gg}:null},xg=Sg((t=>"VariableName"==t.name)),kg=_a.define({name:"css",parser:cg.configure({props:[Na.add({Declaration:il()}),rl.add({"Block KeyframeList":ol})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function Qg(){return new Ua(kg,kg.data.of({autocomplete:xg}))}const $g=["_blank","_self","_top","_parent"],Pg=["ascii","utf-8","utf-16","latin1","latin1"],Cg=["get","post","put","delete"],_g=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Xg=["true","false"],Zg={},Ag={a:{attrs:{href:null,ping:null,type:null,media:null,target:$g,hreflang:null}},abbr:Zg,address:Zg,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Zg,aside:Zg,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Zg,base:{attrs:{href:null,target:$g}},bdi:Zg,bdo:Zg,blockquote:{attrs:{cite:null}},body:Zg,br:Zg,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Zg,center:Zg,cite:Zg,code:Zg,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:Zg,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Zg,div:Zg,dl:Zg,dt:Zg,em:Zg,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Zg,figure:Zg,footer:Zg,form:{attrs:{action:null,name:null,"accept-charset":Pg,autocomplete:["on","off"],enctype:_g,method:Cg,novalidate:["novalidate"],target:$g}},h1:Zg,h2:Zg,h3:Zg,h4:Zg,h5:Zg,h6:Zg,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Zg,hgroup:Zg,hr:Zg,html:{attrs:{manifest:null}},i:Zg,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:Zg,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Zg,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:Zg,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Pg,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:Zg,noscript:Zg,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:Zg,param:{attrs:{name:null,value:null}},pre:Zg,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Zg,rt:Zg,ruby:Zg,samp:Zg,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Pg}},section:Zg,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Zg,source:{attrs:{src:null,type:null,media:null}},span:Zg,strong:Zg,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Zg,summary:Zg,sup:Zg,table:Zg,tbody:Zg,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Zg,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:Zg,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Zg,time:{attrs:{datetime:null}},title:Zg,tr:Zg,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Zg,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:Zg},Tg={accesskey:null,class:null,contenteditable:Xg,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Xg,autocorrect:Xg,autocapitalize:Xg,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Xg,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Xg,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Xg,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Xg,"aria-hidden":Xg,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Xg,"aria-multiselectable":Xg,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Xg,"aria-relevant":null,"aria-required":Xg,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},Rg="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map((t=>"on"+t));for(let t of Rg)Tg[t]=null;class Eg{constructor(t,e){this.tags=Object.assign(Object.assign({},Ag),t),this.globalAttrs=Object.assign(Object.assign({},Tg),e),this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}function Vg(t,e,i=t.length){if(!e)return"";let n=e.firstChild,s=n&&n.getChild("TagName");return s?t.sliceString(s.from,Math.min(s.to,i)):""}function Mg(t,e=!1){for(let i=t.parent;i;i=i.parent)if("Element"==i.name){if(!e)return i;e=!1}return null}function Dg(t,e,i){let n=i.tags[Vg(t,Mg(e,!0))];return(null==n?void 0:n.children)||i.allTags}function Wg(t,e){let i=[];for(let n=e;n=Mg(n);){let s=Vg(t,n);if(s&&"CloseTag"==n.lastChild.name)break;s&&i.indexOf(s)<0&&("EndTag"==e.name||e.from>=n.firstChild.to)&&i.push(s)}return i}Eg.default=new Eg;const Ug=/^[:\-\.\w\u00b7-\uffff]*$/;function Yg(t,e,i,n,s){let r=/\s*>/.test(t.sliceDoc(s,s+5))?"":">";return{from:n,to:s,options:Dg(t.doc,i,e).map((t=>({label:t,type:"type"}))).concat(Wg(t.doc,i).map(((t,e)=>({label:"/"+t,apply:"/"+t+r,type:"type",boost:99-e})))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function qg(t,e,i,n){let s=/\s*>/.test(t.sliceDoc(n,n+5))?"":">";return{from:i,to:n,options:Wg(t.doc,e).map(((t,e)=>({label:t,apply:t+s,type:"type",boost:99-e}))),validFor:Ug}}function Lg(t,e){let{state:i,pos:n}=e,s=Xa(i).resolveInner(n),r=s.resolve(n,-1);for(let t,e=n;s==r&&(t=r.childBefore(e));){let i=t.lastChild;if(!i||!i.type.isError||i.from({label:t,type:"property"}))),validFor:Ug}}(i,t,r,"AttributeName"==r.name?r.from:n,n):"Is"==r.name||"AttributeValue"==r.name||"UnquotedAttributeValue"==r.name?function(t,e,i,n,s){var r;let o,a=null===(r=i.parent)||void 0===r?void 0:r.getChild("AttributeName"),l=[];if(a){let r=t.sliceDoc(a.from,a.to),h=e.globalAttrs[r];if(!h){let n=Mg(i),s=n?e.tags[Vg(t.doc,n)]:null;h=(null==s?void 0:s.attrs)&&s.attrs[r]}if(h){let e=t.sliceDoc(n,s).toLowerCase(),i='"',r='"';/^['"]/.test(e)?(o='"'==e[0]?/^[^"]*$/:/^[^']*$/,i="",r=t.sliceDoc(s,s+1)==e[0]?"":e[0],e=e.slice(1),n++):o=/^[^\s<>='"]*$/;for(let t of h)l.push({label:t,apply:i+t+r,type:"constant"})}}return{from:n,to:s,options:l,validFor:o}}(i,t,r,"Is"==r.name?n:r.from,n):!e.explicit||"Element"!=s.name&&"Text"!=s.name&&"Document"!=s.name?null:function(t,e,i,n){let s=[],r=0;for(let n of Dg(t.doc,i,e))s.push({label:"<"+n,type:"type"});for(let e of Wg(t.doc,i))s.push({label:"",type:"type",boost:99-r++});return{from:n,to:n,options:s,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}(i,t,r,n)}function zg(t){let{extraTags:e,extraGlobalAttributes:i}=t,n=i||e?new Eg(e,i):Eg.default;return t=>Lg(n,t)}const Ig=[{tag:"script",attrs:t=>"text/typescript"==t.type||"ts"==t.lang,parser:zf.parser},{tag:"script",attrs:t=>"text/babel"==t.type||"text/jsx"==t.type,parser:If.parser},{tag:"script",attrs:t=>"text/typescript-jsx"==t.type,parser:Bf.parser},{tag:"script",attrs:t=>!t.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(t.type),parser:qf.parser},{tag:"style",attrs:t=>(!t.lang||"css"==t.lang)&&(!t.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(t.type)),parser:kg.parser}],Bg=[{name:"style",parser:kg.parser.configure({top:"Styles"})}].concat(Rg.map((t=>({name:t,parser:qf.parser})))),jg=_a.define({name:"html",parser:FO.configure({props:[Na.add({Element(t){let e=/^(\s*)(<\/)?/.exec(t.textAfter);return t.node.to<=t.pos+e[0].length?t.continue():t.lineIndent(t.node.from)+(e[2]?0:t.unit)},"OpenTag CloseTag SelfClosingTag":t=>t.column(t.node.from)+t.unit,Document(t){if(t.pos+/\s*/.exec(t.textAfter)[0].lengtht.getChild("TagName")})],wrap:tg(Ig,Bg)}),languageData:{commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-._"}});function Ng(t={}){let e,i="";!1===t.matchClosingTags&&(i="noMatch"),!0===t.selfClosingTags&&(i=(i?i+" ":"")+"selfClosing"),(t.nestedLanguages&&t.nestedLanguages.length||t.nestedAttributes&&t.nestedAttributes.length)&&(e=tg((t.nestedLanguages||[]).concat(Ig),(t.nestedAttributes||[]).concat(Bg)));let n=e||i?jg.configure({dialect:i,wrap:e}):jg;return new Ua(n,[jg.data.of({autocomplete:zg(t)}),!1!==t.autoCloseTags?Fg:[],Nf().support,Qg().support])}const Gg=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),Fg=Ts.inputHandler.of(((t,e,i,n)=>{if(t.composing||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!jg.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((e=>{var i,r,o;let a,{head:l}=e,h=Xa(s).resolveInner(l,-1);if("TagName"!=h.name&&"StartTag"!=h.name||(h=h.parent),">"==n&&"OpenTag"==h.name){if("CloseTag"!=(null===(r=null===(i=h.parent)||void 0===i?void 0:i.lastChild)||void 0===r?void 0:r.name)&&(a=Vg(s.doc,h.parent,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`${e?"":">"}`;return{range:A.cursor(l+1),changes:{from:l+(e?1:0),insert:i}}}}else if("/"==n&&"OpenTag"==h.name){let e=h.parent,i=null==e?void 0:e.parent;if(e.from==l-1&&"CloseTag"!=(null===(o=i.lastChild)||void 0===o?void 0:o.name)&&(a=Vg(s.doc,i,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`/${a}${e?"":">"}`,n=l+i.length+(e?1:0);return{range:A.cursor(n),changes:{from:l,insert:i}}}}return{range:e}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)})),Hg=Qa({commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}}}),Jg=new ho,Kg=sO.configure({props:[rl.add((t=>!t.is("Block")||t.is("Document")||null!=tm(t)?void 0:(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to}))),Jg.add(tm),Na.add({Document:()=>null}),ka.add({Document:Hg})]});function tm(t){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(t.name);return e?+e[1]:void 0}function em(t,e){let i=t;for(;;){let t,n=i.nextSibling;if(!n||null!=(t=tm(n.type))&&t<=e)break;i=n}return i.to}const im=sl.of(((t,e,i)=>{for(let n=Xa(t).resolveInner(i,-1);n&&!(n.fromi)return{from:i,to:e}}return null}));function nm(t){return new Pa(Hg,t,[im],"markdown")}const sm=nm(Kg),rm=nm(Kg.configure([pO,mO,gO,bO]));class om{constructor(t,e,i,n,s,r,o){this.node=t,this.from=e,this.to=i,this.spaceBefore=n,this.spaceAfter=s,this.type=r,this.item=o}blank(t,e=!0){let i=this.spaceBefore+("Blockquote"==this.node.name?">":"");if(null!=t){for(;i.length0;t--)i+=" ";return i+(e?this.spaceAfter:"")}marker(t,e){let i="OrderedList"==this.node.name?String(+lm(this.item,t)[2]+e):"";return this.spaceBefore+i+this.type+this.spaceAfter}}function am(t,e){let i=[];for(let e=t;e&&"Document"!=e.name;e=e.parent)"ListItem"!=e.name&&"Blockquote"!=e.name&&"FencedCode"!=e.name||i.push(e);let n=[];for(let t=i.length-1;t>=0;t--){let s,r=i[t],o=e.lineAt(r.from),a=r.from-o.from;if("FencedCode"==r.name)n.push(new om(r,a,a,"","","",null));else if("Blockquote"==r.name&&(s=/^[ \t]*>( ?)/.exec(o.text.slice(a))))n.push(new om(r,a,a+s[0].length,"",s[1],">",null));else if("ListItem"==r.name&&"OrderedList"==r.parent.name&&(s=/^([ \t]*)\d+([.)])([ \t]*)/.exec(o.text.slice(a)))){let t=s[3],e=s[0].length;t.length>=4&&(t=t.slice(0,t.length-4),e-=4),n.push(new om(r.parent,a,a+e,s[1],t,s[2],r))}else if("ListItem"==r.name&&"BulletList"==r.parent.name&&(s=/^([ \t]*)([-+*])([ \t]{1,4}\[[ xX]\])?([ \t]+)/.exec(o.text.slice(a)))){let t=s[4],e=s[0].length;t.length>4&&(t=t.slice(0,t.length-4),e-=4);let i=s[2];s[3]&&(i+=s[3].replace(/[xX]/," ")),n.push(new om(r.parent,a,a+e,s[1],t,i,r))}}return n}function lm(t,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(t.from,t.from+10))}function hm(t,e,i,n=0){for(let s=-1,r=t;;){if("ListItem"==r.name){let t=lm(r,e),o=+t[2];if(s>=0){if(o!=s+1)return;i.push({from:r.from+t[1].length,to:r.from+t[0].length,insert:String(s+2+n)})}s=o}let t=r.nextSibling;if(!t)break;r=t}}function cm(t){return"QuoteMark"==t.name||"ListMark"==t.name}const um=[{key:"Enter",run:({state:t,dispatch:e})=>{let i=Xa(t),{doc:n}=t,s=null,r=t.changeByRange((e=>{if(!e.empty||!rm.isActiveAt(t,e.from))return s={range:e};let r=e.from,o=n.lineAt(r),a=am(i.resolveInner(r,-1),n);for(;a.length&&a[a.length-1].from>r-o.from;)a.pop();if(!a.length)return s={range:e};let l=a[a.length-1];if(l.to-l.spaceAfter.length>r-o.from)return s={range:e};let h=r>=l.to-l.spaceAfter.length&&!/\S/.test(o.text.slice(l.to));if(l.item&&h){if(l.node.firstChild.to>=r||o.from>0&&!/[^\s>]/.test(n.lineAt(o.from-1).text)){let t,e=a.length>1?a[a.length-2]:null,i="";e&&e.item?(t=o.from+e.from,i=e.marker(n,1)):t=o.from+(e?e.to:0);let s=[{from:t,to:r,insert:i}];return"OrderedList"==l.node.name&&hm(l.item,n,s,-2),e&&"OrderedList"==e.node.name&&hm(e.item,n,s),{range:A.cursor(t+i.length),changes:s}}{let e="";for(let t=0,i=a.length-2;t<=i;t++)e+=a[t].blank(t\s*$/.exec(i.text);if(s&&s.index==l.from){let n=t.changes([{from:i.from+s.index,to:i.to},{from:o.from+l.from,to:o.to}]);return{range:e.map(n),changes:n}}}let c=[];"OrderedList"==l.node.name&&hm(l.item,n,c);let u=l.item&&l.item.from]*/.exec(o.text)[0].length>=l.to)for(let t=0,e=a.length-1;t<=e;t++)d+=t!=e||u?a[t].blank(to.from&&/\s/.test(o.text.charAt(f-o.from-1));)f--;return d=t.lineBreak+d,c.push({from:f,to:r,insert:d}),{range:A.cursor(f+d.length),changes:c}}));return!s&&(e(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0)}},{key:"Backspace",run:({state:t,dispatch:e})=>{let i=Xa(t),n=null,s=t.changeByRange((e=>{let s=e.from,{doc:r}=t;if(e.empty&&rm.isActiveAt(t,e.from)){let t=r.lineAt(s),n=am(function(t,e){let i=t.resolveInner(e,-1),n=e;cm(i)&&(n=i.from,i=i.parent);for(let t;t=i.childBefore(n);)if(cm(t))n=t.from;else{if("OrderedList"!=t.name&&"BulletList"!=t.name)break;i=t.lastChild,n=i.to}return i}(i,s),r);if(n.length){let i=n[n.length-1],r=i.to-i.spaceAfter.length+(i.spaceAfter?1:0);if(s-t.from>r&&!/\S/.test(t.text.slice(r,s-t.from)))return{range:A.cursor(t.from+r),changes:{from:t.from+r,to:s}};if(s-t.from==r&&(!i.item||t.from<=i.item.from||!/\S/.test(t.text.slice(0,i.to)))){let n=t.from+i.from;if(i.item&&i.node.fromt.from-e.from||t.startSide-e.startSide)),ni.set(i)}getMatchingBracket(t){switch(t){case")":return"(";case"]":return"[";case"}":return"{";default:return null}}},{decorations:t=>t.decorations});var fm="[a-zA-Z\\$][a-zA-Z0-9\\$]*",pm="(?:\\.\\d+|\\d+\\.\\d*|\\d+)",Om="(?:`(?:`?"+pm+")?)",gm=new RegExp("(?:(?:\\d+)(?:\\^\\^(?:\\.\\w+|\\w+\\.\\w*|\\w+)"+Om+"?(?:\\*\\^[+-]?\\d+)?))"),mm=new RegExp("(?:"+pm+Om+"?(?:\\*\\^[+-]?\\d+)?)"),bm=new RegExp("(?:`?)(?:"+fm+")(?:`(?:"+fm+"))*(?:`?)");let wm=[];const vm=["True","False","All","None","Null","Full","$Failed","$Aborted"];function ym(t,e){var i;return'"'===(i=t.next())?(e.tokenize=Sm,e.tokenize(t,e)):"("===i&&t.eat("*")?(e.commentLevel++,e.tokenize=xm,e.tokenize(t,e)):(t.backUp(1),t.match(gm,!0,!1)||t.match(mm,!0,!1)?"number":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::usage)/,!0,!1)?"meta":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::[a-zA-Z\$][a-zA-Z0-9\$]*):?/,!0,!1)?"string.special":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*\s*:)(?:(?:[a-zA-Z\$][a-zA-Z0-9\$]*)|(?:[^:=>~@\^\&\*\)\[\]'\?,\|])).*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+/,!0,!1)||t.match(/_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)?"variableName.special":t.match(/\\\[[a-zA-Z\$][a-zA-Z0-9\$]*\]/,!0,!1)?"character":t.match(/(?:\[|\]|{|}|\(|\))/,!0,!1)?"bracket":t.match(/(?:#[a-zA-Z\$][a-zA-Z0-9\$]*|#+[0-9]?)/,!0,!1)?"variableName.constant":t.match(bm,!0,!1)?vm.indexOf(t.current())>-1?"number":wm.indexOf(t.current())>-1||0==wm.length?"keyword":t.current()in e.localVars?"atom":(e.localVars[t.current()]=!0,"function"):t.match(/(?:\\|\+|\-|\*|\/|,|;|\.|:|@|~|=|>|<|&|\||_|`|'|\^|\?|!|%)/,!0,!1)?"operator":(t.next(),"error"))}function Sm(t,e){for(var i,n=!1,s=!1;null!=(i=t.next());){if('"'===i&&!s){n=!0;break}s=!s&&"\\"===i}return n&&!s&&(e.tokenize=ym),"string"}function xm(t,e){for(var i,n;e.commentLevel>0&&null!=(n=t.next());)"("===i&&"*"===n&&e.commentLevel++,"*"===i&&")"===n&&e.commentLevel--,i=n;return e.commentLevel<=0&&(e.tokenize=ym),"comment"}const km={name:"mathematica",extendVariables:function(t){},startState:function(){return{tokenize:ym,commentLevel:0,localVars:{}}},token:function(t,e){return t.eatSpace()?null:e.tokenize(t,e)},languageData:{commentTokens:{block:{open:"(*",close:"*)"}}}};let Qm={of:t=>[Gl.define(km),Yd({override:[async e=>function(t,e){let i=t.matchBefore(/\w*/);return i.from!==i.to||t.explicit?{from:i.from,options:e.data}:null}(e,t)]}),Ys.of([{key:"Escape",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((t=>{let{from:e,to:i}=t;return{changes:{from:e,to:i,insert:"EC"},range:A.cursor(e+2)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])],reBuild:t=>{wm=t.map((t=>t.label))}};const $m=(t,e,i,n)=>{if(0==t.length)return;const s=(new Date).valueOf();let r=0;i.dom.loadingMark=!0;const o=i.dom.style.background;let a=0;console.log("Start animation");const l=setInterval((()=>{i.dom.style.setProperty("background","hsl("+a+"deg 100% 97%)","important"),a+=2,a>360&&(a=0)}),30);n.transaction(e,i,s,t.length);for(const a of t)Pm(a,((a,h)=>{n.file(e,i,s,a,h),r++,r>=t.length&&i.dom&&i.dom.loadingMark&&(i.dom.loadingMark=!1,setTimeout((()=>{i.dom.style.background=o,clearInterval(l),console.log("Stop animation")}),2e3))}),(()=>{console.warn("Fauilure");const t=i.dom.style.background;i.dom.style.background="rgb(255 189 189 / 97%)";let e=97;const n=setInterval((()=>{i.dom.style.background="rgb(255 189 189 / "+Math.round(e)+"%)",e*=.95}),30);clearInterval(l),setTimeout((()=>{clearInterval(n),i.dom.style.background=t}),3e3)}))};function Pm(t,e,i){const n=new FileReader;n.addEventListener("load",(n=>{const s=n.target.result;if(s.byteLength/1024/1024>100)return alert("Files > 100Mb are not supported for drag and drop"),void i();let r=base64ArrayBuffer(s);e(t.name,r)})),n.addEventListener("progress",(t=>{if(t.loaded&&t.total){const e=t.loaded/t.total*100;console.log(e)}})),n.readAsArrayBuffer(t)}const Cm=(t,e)=>Ts.domEventHandlers({drop(e,i){e.preventDefault();const n=[];e.dataTransfer.items?[...e.dataTransfer.items].forEach(((t,e)=>{if("file"===t.kind){const i=t.getAsFile();console.log(`… file[${e}].name = ${i.name}`),n.push(i)}})):[...e.dataTransfer.files].forEach(((t,e)=>{console.log(`… file[${e}].name = ${t.name}`),n.push(t)})),$m(n,e,i,t)},paste(t,i){let n=t.clipboardData||window.clipboardData;for(const s of n.items)if("string"===s.kind)switch(s.type){case"text/plain":break;case"image/png":t.preventDefault(),$m([s.getAsFile()],t,i,e)}else t.preventDefault(),$m([s.getAsFile()],t,i,e)}}),_m=new pr({regexp:/\\\[(\w+)\]/g,decoration:t=>ni.replace({widget:new Zm(t[1])})}),Xm=_i.fromClass(class{constructor(t){this.Greekholder=_m.createDeco(t)}update(t){this.Greekholder=_m.updateDeco(t,this.Greekholder)}},{decorations:t=>t.Greekholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Greekholder||ni.none))});class Zm extends ei{constructor(t){super(),this.name=t}eq(t){return this.name===t.name}toDOM(){let t=document.createElement("span");return t.innerHTML="&"+this.name.toLowerCase().replace("sqrt","radic").replace("undirectededge","harr").replace("directededge","rarr").replace(/capital(.*)/,((t,e)=>e.charAt(0).toUpperCase()+e.slice(1))).replace(/curly(.*)/,((t,e)=>e)).replace(/script(.*)/,((t,e)=>"el"+e.toLowerCase())).replace("transpose","#7488").replace("degree","deg")+";",t}ignoreEvent(){return!1}}const Am=new pr({regexp:/(->|<-)/g,decoration:t=>ni.replace({widget:new Tm(t[1])})});_i.fromClass(class{constructor(t){this.Arrowholder=Am.createDeco(t)}update(t){this.Arrowholder=Am.updateDeco(t,this.Arrowholder)}},{decorations:t=>t.Arrowholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Arrowholder||ni.none))});class Tm extends ei{constructor(t){super(),this.dir=t}eq(t){return this.dir===t.dir}toDOM(){let t=document.createElement("span");return"->"===this.dir?t.innerText="→":t.innerText="←",t}ignoreEvent(){return!1}}function Rm(t){if(!(t=t||{}).open)throw new Error('Balanced: please provide a "open" property');if(!t.close)throw new Error('Balanced: please provide a "close" property');if(this.balance=t.balance||!1,this.exceptions=t.exceptions||!1,this.caseInsensitive=t.caseInsensitive,this.head=t.head||t.open,this.head=Array.isArray(this.head)?this.head:[this.head],this.open=Array.isArray(t.open)?t.open:[t.open],this.close=Array.isArray(t.close)?t.close:[t.close],!Array.isArray(this.head)||!Array.isArray(this.open)||!Array.isArray(this.close)||this.head.length!==this.open.length||this.open.length!==this.close.length)throw new Error('Balanced: if you use arrays for a "head,open,close" you must use matching arrays for all options');var e=Dm(this.head.map(this.regExpFromArrayGroupedMap,this)),i=Dm(this.open.map(this.regExpFromArrayGroupedMap,this)),n=Dm(this.close.map(this.regExpFromArrayGroupedMap,this));this.regExp=Dm([e,i,n],"g"+(this.caseInsensitive?"i":"")),this.regExpGroupLength=this.head.length}function Em(t,e,i){for(var n=Mm(e.substr(0,i+1),/^.*\n?$/gim),s=Mm(e,/^.*\n?$/gim),r=n.length-1,o=i+1-(n.length?n[n.length-1].index:0),a="",l=2;l>=0;l--)r-l>=0&&s[r-l]&&(a+=e.substr(s[r-l].index,s[r-l].length)+"\n");for(l=0;l=0&&s[r+l]&&(a+=e.substr(s[r+l].index,s[r+l].length)+"\n");a=a.replace(/\t/g," ").replace(/\n$/,"");var h=new Error(t+" at "+(r+1)+":"+o+"\n\n"+a);return h.line=r+1,h.column=o,h.index=i,h}function Vm(t,e){return t>=e.index&&t<=e.index+e.length-1}function Mm(t,e){var i,n=new RegExp(e),s=[];if(t)for(;i=n.exec(t);)s.push({index:i.index,length:i[0].length,match:i[0]}),i[0].length||n.lastIndex++;return s}function Dm(t,e,i){var n=t.map((function(t){return t instanceof RegExp?t.source:function(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}(t)}),this).join("|");return n=i?"("+n+")":"(?:"+n+")",new RegExp(n,e||void 0)}Rm.prototype={regExpFromArrayGroupedMap:function(t){return Dm([t],null,!0)},matchContentsInBetweenBrackets:function(t,e){for(var i,n=new RegExp(this.regExp),s=[],r=[],o=null,a=!0;i=n.exec(t);){if(e){for(var l=!1,h=0;h{const i=((t,e,i)=>{var n,s=new RegExp(t),r=[];if(e)for(;n=s.exec(e);){if(i){for(var o=!1,a=0;a{new qm({open:"(*"+t+"[*)",close:"(*]"+t+"*)",balance:!1}).matchContentsInBetweenBrackets(e.value,[]).forEach((function(t){const s=e.value.slice(t.index+t.head.length,t.index+t.length-t.tail.length);n(i+t.index,{length:t.length,pos:i+t.index,argsPos:i+t.index+t.head.length,str:s})}))})(e,t,i,s)},o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)r(o,a)}var Im,Bm=function(){function t(t){var e=t.tag,i=t.decoration,n=t.decorate,s=t.boundary,r=t.maxLength,o=void 0===r?1e3:r;if(this.tag=e,n)this.addMatch=function(t,e,i,s){return n(s,i,i+t.length,t,e)};else if("function"==typeof i)this.addMatch=function(t,e,n,s){var r=i(t,e,n);r&&s(n,n+t.length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=function(t,e,n,s){return s(n,n+t.length,i)}}this.boundary=s,this.maxLength=o}return t.prototype.createDeco=function(t){for(var e=this,i=new Xt,n=i.add.bind(i),s=0,r=function(t,e){var i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;for(var n=[],s=0,r=i;s=a?n[n.length-1].to=l:n.push({from:a,to:l})}return n}(t,this.maxLength);st.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e},t.prototype.updateRange=function(t,e,i,n){for(var s=this,r=function(r){var a=Math.max(r.from,i),l=Math.min(r.to,n);if(l>a){var h=t.state.doc.lineAt(a),c=h.toh.from;a--)if(o.boundary.test(h.text[a-1-h.from])){u=a;break}for(;ld},add:f})}},o=this,a=0,l=t.visibleRanges;a{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*FB[*)((_)(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*FB[*)(("+s+")(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let Nm=class{constructor(t,e,i,n,s,r){this.view=e,this.visibleValue=t,this.placeholder=r,console.log(r),this.args=Lm(t.str,/\(\*,\*\)/gm);const o=this;let a,l;console.log("creating InstanceWidget"),a=Im({doc:o.args[0].body.slice(2,-1),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(o.visibleValue.pos),e.dispatch({selection:{anchor:o.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return l.dispatch({selection:{anchor:0}}),l.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){l.focus(),t.editorLastCursor=void 0}}])]}),l=Im({doc:o.args[2].body.slice(1,-2),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:a.state.doc.length}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:o.visibleValue.pos+o.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus(),t.editorLastCursor=void 0}}])]}),o.args[0].length=o.args[0].body.length,o.args[2].length=o.args[2].body.length,delete o.args[2].body,delete o.args[1].body,delete o.args[0].body,this.topEditor=a,this.bottomEditor=l}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="(("+t+")",s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length));const r=e.length-i[0].length;i[0].to=i[0].to+r,i[2].from=i[2].from+r,i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e="("+t+"))",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length));const r=e.length-i[2].length;i[2].to=i[2].to+r,i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t,e){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm),console.log("recreating InstanceWidget"),n=Im.state({doc:e.args[0].body.slice(2,-1),update:t=>e.applyChanges(t,0),eval:()=>{i.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(e.visibleValue.pos),i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus(),t.editorLastCursor=void 0}}])]}),s=Im.state({doc:e.args[2].body.slice(1,-2),update:t=>e.applyChanges(t,2),eval:()=>{e.view.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus(),t.editorLastCursor=void 0}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),console.log(e),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.placeholder=e,this.visibleValue.argsPos=t.argsPos}destroy(){this.topEditor.destroy(),this.bottomEditor.destroy()}},Gm=class extends ei{constructor(t,e,i,n){super(),this.view=i,this.visibleValue=t,this.reference=e,this.placeholder=n}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue,this),!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("fraction");const i=document.createElement("table");i.classList.add("container"),e.appendChild(i);const n=document.createElement("tbody");i.appendChild(n);const s=document.createElement("tr"),r=document.createElement("tr");n.appendChild(s),n.appendChild(r);const o=document.createElement("td");o.classList.add("enumenator"),s.appendChild(o);const a=document.createElement("td");r.appendChild(a);const l=this;return e.EditorWidget=new Nm(this.visibleValue,t,o,a,[],this),this.DOMElement=e,this.reference.push({destroy:()=>{l.destroy(e)}}),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const Fm=(t,e,i)=>new Bm({tag:"FB",decoration:n=>ni.replace({widget:new Gm(n,t,e,i)})}),Hm=t=>_i.fromClass(class{constructor(e){this.disposable=[],this.placeholder=Fm(this.disposable,e,this).createDeco(e),t.placeholder=this}update(t){this.placeholder=Fm(this.disposable,t,this).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var Jm;function Km(t){return Jm=t,[nb,Ys.of([{key:"Ctrl-2",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt[_](*]SqB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt["+s+"](*]SqB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let tb=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;this.sliceRanges=n,this.length=t.str.length,console.log("creating InstanceWidget"),this.editor=Jm({doc:t.str.slice(...n),parent:i,update:t=>r.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]})}applyChanges(t){const e=t,i={from:this.visibleValue.argsPos+5,to:this.visibleValue.argsPos+this.length-1,insert:e};console.log(this.visibleValue);const n=e.length+6-this.length;this.length=this.length+n,this.visibleValue.length=this.visibleValue.length+n,this.visibleValue.str="Sqrt["+e+"]",this.view.dispatch({changes:i})}update(t){if(this.visibleValue.str==t.str)this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos;else{console.warn("Out of sync"),this.visibleValue=t;const e=this.sliceRanges,i=this.editor,n=this,s=this.view;this.length=t.str.length;const r=Jm.state({doc:t.str.slice(...e),update:t=>n.applyChanges(t),eval:()=>{s.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos+n.visibleValue.length}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]});i.setState(r)}}destroy(){console.warn("destroy Instance of Widget!"),this.editor.destroy()}},eb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("sqroot");const i=this,n=document.createElement("span");return n.classList.add("radicand"),e.EditorWidget=new tb(this.visibleValue,t,n,[5,-1],[]),e.appendChild(n),this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const ib=(t,e)=>new Bm({tag:"SqB",decoration:i=>ni.replace({widget:new eb(i,t,e)})}),nb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=ib(this.disposable,t).createDeco(t)}update(t){this.placeholder=ib(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var sb;function rb(t){return sb=t,[hb,Ys.of([{key:"Ctrl--",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SbB[*)Subscript[_(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SbB[*)Subscript["+s+"(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let ob=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),console.log(r.visibleValue),o=sb({doc:r.args[0].body.slice(10),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){a.focus()}}])]}),a=sb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Subscript["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),console.log(e.visibleValue),n=sb.state({doc:e.args[0].body.slice(10),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus()}}])]}),s=sb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},ab=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sub");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new ob(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const lb=(t,e)=>new Bm({tag:"SbB",decoration:i=>ni.replace({widget:new ab(i,t,e)})}),hb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=lb(this.disposable,t).createDeco(t)}update(t){this.placeholder=lb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var cb;function ub(t){return cb=t,[Ob,Ys.of([{key:"Ctrl-6",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SpB[*)Power[_(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SpB[*)Power["+s+"(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let db=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),o=cb({doc:r.args[0].body.slice(6),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus()}}])]}),a=cb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Power["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),n=cb.state({doc:e.args[0].body.slice(6),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.bottomEditor.focus()}}])]}),s=cb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},fb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sup");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new db(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}destroy(t){t.EditorWidget.destroy()}};const pb=(t,e)=>new Bm({tag:"SpB",decoration:i=>ni.replace({widget:new fb(i,t,e)})}),Ob=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=pb(this.disposable,t).createDeco(t)}update(t){this.placeholder=pb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var gb={},mb={},bb={},wb={};function vb(t){let e=t.length;for(;--e>=0;)t[e]=0}const yb=256,Sb=286,xb=30,kb=15,Qb=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),$b=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Pb=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Cb=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_b=new Array(576);vb(_b);const Xb=new Array(60);vb(Xb);const Zb=new Array(512);vb(Zb);const Ab=new Array(256);vb(Ab);const Tb=new Array(29);vb(Tb);const Rb=new Array(xb);function Eb(t,e,i,n,s){this.static_tree=t,this.extra_bits=e,this.extra_base=i,this.elems=n,this.max_length=s,this.has_stree=t&&t.length}let Vb,Mb,Db;function Wb(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}vb(Rb);const Ub=t=>t<256?Zb[t]:Zb[256+(t>>>7)],Yb=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},qb=(t,e,i)=>{t.bi_valid>16-i?(t.bi_buf|=e<>16-t.bi_valid,t.bi_valid+=i-16):(t.bi_buf|=e<{qb(t,i[2*e],i[2*e+1])},zb=(t,e)=>{let i=0;do{i|=1&t,t>>>=1,i<<=1}while(--e>0);return i>>>1},Ib=(t,e,i)=>{const n=new Array(16);let s,r,o=0;for(s=1;s<=kb;s++)o=o+i[s-1]<<1,n[s]=o;for(r=0;r<=e;r++){let e=t[2*r+1];0!==e&&(t[2*r]=zb(n[e]++,e))}},Bb=t=>{let e;for(e=0;e{t.bi_valid>8?Yb(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},Nb=(t,e,i,n)=>{const s=2*e,r=2*i;return t[s]{const n=t.heap[i];let s=i<<1;for(;s<=t.heap_len&&(s{let n,s,r,o,a=0;if(0!==t.sym_next)do{n=255&t.pending_buf[t.sym_buf+a++],n+=(255&t.pending_buf[t.sym_buf+a++])<<8,s=t.pending_buf[t.sym_buf+a++],0===n?Lb(t,s,e):(r=Ab[s],Lb(t,r+yb+1,e),o=Qb[r],0!==o&&(s-=Tb[r],qb(t,s,o)),n--,r=Ub(n),Lb(t,r,i),o=$b[r],0!==o&&(n-=Rb[r],qb(t,n,o)))}while(a{const i=e.dyn_tree,n=e.stat_desc.static_tree,s=e.stat_desc.has_stree,r=e.stat_desc.elems;let o,a,l,h=-1;for(t.heap_len=0,t.heap_max=573,o=0;o>1;o>=1;o--)Gb(t,i,o);l=r;do{o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Gb(t,i,1),a=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=a,i[2*l]=i[2*o]+i[2*a],t.depth[l]=(t.depth[o]>=t.depth[a]?t.depth[o]:t.depth[a])+1,i[2*o+1]=i[2*a+1]=l,t.heap[1]=l++,Gb(t,i,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const i=e.dyn_tree,n=e.max_code,s=e.stat_desc.static_tree,r=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,l=e.stat_desc.max_length;let h,c,u,d,f,p,O=0;for(d=0;d<=kb;d++)t.bl_count[d]=0;for(i[2*t.heap[t.heap_max]+1]=0,h=t.heap_max+1;h<573;h++)c=t.heap[h],d=i[2*i[2*c+1]+1]+1,d>l&&(d=l,O++),i[2*c+1]=d,c>n||(t.bl_count[d]++,f=0,c>=a&&(f=o[c-a]),p=i[2*c],t.opt_len+=p*(d+f),r&&(t.static_len+=p*(s[2*c+1]+f)));if(0!==O){do{for(d=l-1;0===t.bl_count[d];)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[l]--,O-=2}while(O>0);for(d=l;0!==d;d--)for(c=t.bl_count[d];0!==c;)u=t.heap[--h],u>n||(i[2*u+1]!==d&&(t.opt_len+=(d-i[2*u+1])*i[2*u],i[2*u+1]=d),c--)}})(t,e),Ib(i,h,t.bl_count)},Jb=(t,e,i)=>{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),e[2*(i+1)+1]=65535,n=0;n<=i;n++)s=o,o=e[2*(n+1)+1],++a{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),n=0;n<=i;n++)if(s=o,o=e[2*(n+1)+1],!(++a{qb(t,0+(n?1:0),3),jb(t),Yb(t,i),Yb(t,~i),i&&t.pending_buf.set(t.window.subarray(e,e+i),t.pending),t.pending+=i};wb._tr_init=t=>{tw||((()=>{let t,e,i,n,s;const r=new Array(16);for(i=0,n=0;n<28;n++)for(Tb[n]=i,t=0;t<1<>=7;n{let s,r,o=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e{let e;for(Jb(t,t.dyn_ltree,t.l_desc.max_code),Jb(t,t.dyn_dtree,t.d_desc.max_code),Hb(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*Cb[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=i+5,i+4<=s&&-1!==e?ew(t,e,i,n):4===t.strategy||r===s?(qb(t,2+(n?1:0),3),Fb(t,_b,Xb)):(qb(t,4+(n?1:0),3),((t,e,i,n)=>{let s;for(qb(t,e-257,5),qb(t,i-1,5),qb(t,n-4,4),s=0;s(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=i,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(Ab[i]+yb+1)]++,t.dyn_dtree[2*Ub(e)]++),t.sym_next===t.sym_end),wb._tr_align=t=>{qb(t,2,3),Lb(t,256,_b),(t=>{16===t.bi_valid?(Yb(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)};var iw=(t,e,i,n)=>{let s=65535&t|0,r=t>>>16&65535|0,o=0;for(;0!==i;){o=i>2e3?2e3:i,i-=o;do{s=s+e[n++]|0,r=r+s|0}while(--o);s%=65521,r%=65521}return s|r<<16|0};const nw=new Uint32Array((()=>{let t,e=[];for(var i=0;i<256;i++){t=i;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e})());var sw=(t,e,i,n)=>{const s=nw,r=n+i;t^=-1;for(let i=n;i>>8^s[255&(t^e[i])];return-1^t},rw={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},ow={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:aw,_tr_stored_block:lw,_tr_flush_block:hw,_tr_tally:cw,_tr_align:uw}=wb,dw=iw,fw=sw,pw=rw,{Z_NO_FLUSH:Ow,Z_PARTIAL_FLUSH:gw,Z_FULL_FLUSH:mw,Z_FINISH:bw,Z_BLOCK:ww,Z_OK:vw,Z_STREAM_END:yw,Z_STREAM_ERROR:Sw,Z_DATA_ERROR:xw,Z_BUF_ERROR:kw,Z_DEFAULT_COMPRESSION:Qw,Z_FILTERED:$w,Z_HUFFMAN_ONLY:Pw,Z_RLE:Cw,Z_FIXED:_w,Z_DEFAULT_STRATEGY:Xw,Z_UNKNOWN:Zw,Z_DEFLATED:Aw}=ow,Tw=258,Rw=262,Ew=42,Vw=113,Mw=666,Dw=(t,e)=>(t.msg=pw[e],e),Ww=t=>2*t-(t>4?9:0),Uw=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Yw=t=>{let e,i,n,s=t.w_size;e=t.hash_size,n=e;do{i=t.head[--n],t.head[n]=i>=s?i-s:0}while(--e);e=s,n=e;do{i=t.prev[--n],t.prev[n]=i>=s?i-s:0}while(--e)};let qw=(t,e,i)=>(e<{const e=t.state;let i=e.pending;i>t.avail_out&&(i=t.avail_out),0!==i&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+i),t.next_out),t.next_out+=i,e.pending_out+=i,t.total_out+=i,t.avail_out-=i,e.pending-=i,0===e.pending&&(e.pending_out=0))},zw=(t,e)=>{hw(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Lw(t.strm)},Iw=(t,e)=>{t.pending_buf[t.pending++]=e},Bw=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},jw=(t,e,i,n)=>{let s=t.avail_in;return s>n&&(s=n),0===s?0:(t.avail_in-=s,e.set(t.input.subarray(t.next_in,t.next_in+s),i),1===t.state.wrap?t.adler=dw(t.adler,e,s,i):2===t.state.wrap&&(t.adler=fw(t.adler,e,s,i)),t.next_in+=s,t.total_in+=s,s)},Nw=(t,e)=>{let i,n,s=t.max_chain_length,r=t.strstart,o=t.prev_length,a=t.nice_match;const l=t.strstart>t.w_size-Rw?t.strstart-(t.w_size-Rw):0,h=t.window,c=t.w_mask,u=t.prev,d=t.strstart+Tw;let f=h[r+o-1],p=h[r+o];t.prev_length>=t.good_match&&(s>>=2),a>t.lookahead&&(a=t.lookahead);do{if(i=e,h[i+o]===p&&h[i+o-1]===f&&h[i]===h[r]&&h[++i]===h[r+1]){r+=2,i++;do{}while(h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&ro){if(t.match_start=e,o=n,n>=a)break;f=h[r+o-1],p=h[r+o]}}}while((e=u[e&c])>l&&0!=--s);return o<=t.lookahead?o:t.lookahead},Gw=t=>{const e=t.w_size;let i,n,s;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Rw)&&(t.window.set(t.window.subarray(e,e+e-n),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Yw(t),n+=e),0===t.strm.avail_in)break;if(i=jw(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=i,t.lookahead+t.insert>=3)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=qw(t,t.ins_h,t.window[s+1]);t.insert&&(t.ins_h=qw(t,t.ins_h,t.window[s+3-1]),t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead{let i,n,s,r=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,o=0,a=t.strm.avail_in;do{if(i=65535,s=t.bi_valid+42>>3,t.strm.avail_outn+t.strm.avail_in&&(i=n+t.strm.avail_in),i>s&&(i=s),i>8,t.pending_buf[t.pending-2]=~i,t.pending_buf[t.pending-1]=~i>>8,Lw(t.strm),n&&(n>i&&(n=i),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+n),t.strm.next_out),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n,t.block_start+=n,i-=n),i&&(jw(t.strm,t.strm.output,t.strm.next_out,i),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i)}while(0===o);return a-=t.strm.avail_in,a&&(a>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=a&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-a,t.strm.next_in),t.strstart),t.strstart+=a,t.insert+=a>t.w_size-t.insert?t.w_size-t.insert:a),t.block_start=t.strstart),t.high_waters&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,s+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),s>t.strm.avail_in&&(s=t.strm.avail_in),s&&(jw(t.strm,t.window,t.strstart,s),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.high_water>3,s=t.pending_buf_size-s>65535?65535:t.pending_buf_size-s,r=s>t.w_size?t.w_size:s,n=t.strstart-t.block_start,(n>=r||(n||e===bw)&&e!==Ow&&0===t.strm.avail_in&&n<=s)&&(i=n>s?s:n,o=e===bw&&0===t.strm.avail_in&&i===n?1:0,lw(t,t.block_start,i,o),t.block_start+=i,Lw(t.strm)),o?3:1)},Hw=(t,e)=>{let i,n;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==i&&t.strstart-i<=t.w_size-Rw&&(t.match_length=Nw(t,i)),t.match_length>=3)if(n=cw(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=qw(t,t.ins_h,t.window[t.strstart+1]);else n=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2},Jw=(t,e)=>{let i,n,s;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==i&&t.prev_length4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){s=t.strstart+t.lookahead-3,n=cw(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=s&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(zw(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(n=cw(t,0,t.window[t.strstart-1]),n&&zw(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=cw(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2};function Kw(t,e,i,n,s){this.good_length=t,this.max_lazy=e,this.nice_length=i,this.max_chain=n,this.func=s}const tv=[new Kw(0,0,0,0,Fw),new Kw(4,4,8,4,Hw),new Kw(4,5,16,8,Hw),new Kw(4,6,32,32,Hw),new Kw(4,4,16,16,Jw),new Kw(8,16,32,32,Jw),new Kw(8,16,128,128,Jw),new Kw(8,32,128,256,Jw),new Kw(32,128,258,1024,Jw),new Kw(32,258,258,4096,Jw)];function ev(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Aw,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Uw(this.dyn_ltree),Uw(this.dyn_dtree),Uw(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Uw(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Uw(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const iv=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==Ew&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==Vw&&e.status!==Mw?1:0},nv=t=>{if(iv(t))return Dw(t,Sw);t.total_in=t.total_out=0,t.data_type=Zw;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?Ew:Vw,t.adler=2===e.wrap?0:1,e.last_flush=-2,aw(e),vw},sv=t=>{const e=nv(t);var i;return e===vw&&((i=t.state).window_size=2*i.w_size,Uw(i.head),i.max_lazy_match=tv[i.level].max_lazy,i.good_match=tv[i.level].good_length,i.nice_match=tv[i.level].nice_length,i.max_chain_length=tv[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=2,i.match_available=0,i.ins_h=0),e},rv=(t,e,i,n,s,r)=>{if(!t)return Sw;let o=1;if(e===Qw&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),s<1||s>9||i!==Aw||n<8||n>15||e<0||e>9||r<0||r>_w||8===n&&1!==o)return Dw(t,Sw);8===n&&(n=9);const a=new ev;return t.state=a,a.strm=t,a.status=Ew,a.wrap=o,a.gzhead=null,a.w_bits=n,a.w_size=1<rv(t,e,Aw,15,8,Xw),bb.deflateInit2=rv,bb.deflateReset=sv,bb.deflateResetKeep=nv,bb.deflateSetHeader=(t,e)=>iv(t)||2!==t.state.wrap?Sw:(t.state.gzhead=e,vw),bb.deflate=(t,e)=>{if(iv(t)||e>ww||e<0)return t?Dw(t,Sw):Sw;const i=t.state;if(!t.output||0!==t.avail_in&&!t.input||i.status===Mw&&e!==bw)return Dw(t,0===t.avail_out?kw:Sw);const n=i.last_flush;if(i.last_flush=e,0!==i.pending){if(Lw(t),0===t.avail_out)return i.last_flush=-1,vw}else if(0===t.avail_in&&Ww(e)<=Ww(n)&&e!==bw)return Dw(t,kw);if(i.status===Mw&&0!==t.avail_in)return Dw(t,kw);if(i.status===Ew&&0===i.wrap&&(i.status=Vw),i.status===Ew){let e=Aw+(i.w_bits-8<<4)<<8,n=-1;if(n=i.strategy>=Pw||i.level<2?0:i.level<6?1:6===i.level?2:3,e|=n<<6,0!==i.strstart&&(e|=32),e+=31-e%31,Bw(i,e),0!==i.strstart&&(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),t.adler=1,i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(57===i.status)if(t.adler=0,Iw(i,31),Iw(i,139),Iw(i,8),i.gzhead)Iw(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),Iw(i,255&i.gzhead.time),Iw(i,i.gzhead.time>>8&255),Iw(i,i.gzhead.time>>16&255),Iw(i,i.gzhead.time>>24&255),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(Iw(i,255&i.gzhead.extra.length),Iw(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=fw(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if(Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,3),i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw;if(69===i.status){if(i.gzhead.extra){let e=i.pending,n=(65535&i.gzhead.extra.length)-i.gzindex;for(;i.pending+n>i.pending_buf_size;){let s=i.pending_buf_size-i.pending;if(i.pending_buf.set(i.gzhead.extra.subarray(i.gzindex,i.gzindex+s),i.pending),i.pending=i.pending_buf_size,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex+=s,Lw(t),0!==i.pending)return i.last_flush=-1,vw;e=0,n-=s}let s=new Uint8Array(i.gzhead.extra);i.pending_buf.set(s.subarray(i.gzindex,i.gzindex+n),i.pending),i.pending+=n,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex=0}i.status=73}if(73===i.status){if(i.gzhead.name){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),i.gzindex=0}i.status=91}if(91===i.status){if(i.gzhead.comment){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n))}i.status=103}if(103===i.status){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size&&(Lw(t),0!==i.pending))return i.last_flush=-1,vw;Iw(i,255&t.adler),Iw(i,t.adler>>8&255),t.adler=0}if(i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(0!==t.avail_in||0!==i.lookahead||e!==Ow&&i.status!==Mw){let n=0===i.level?Fw(i,e):i.strategy===Pw?((t,e)=>{let i;for(;;){if(0===t.lookahead&&(Gw(t),0===t.lookahead)){if(e===Ow)return 1;break}if(t.match_length=0,i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):i.strategy===Cw?((t,e)=>{let i,n,s,r;const o=t.window;for(;;){if(t.lookahead<=Tw){if(Gw(t),t.lookahead<=Tw&&e===Ow)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(s=t.strstart-1,n=o[s],n===o[++s]&&n===o[++s]&&n===o[++s])){r=t.strstart+Tw;do{}while(n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&st.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(i=cw(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):tv[i.level].func(i,e);if(3!==n&&4!==n||(i.status=Mw),1===n||3===n)return 0===t.avail_out&&(i.last_flush=-1),vw;if(2===n&&(e===gw?uw(i):e!==ww&&(lw(i,0,0,!1),e===mw&&(Uw(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),Lw(t),0===t.avail_out))return i.last_flush=-1,vw}return e!==bw?vw:i.wrap<=0?yw:(2===i.wrap?(Iw(i,255&t.adler),Iw(i,t.adler>>8&255),Iw(i,t.adler>>16&255),Iw(i,t.adler>>24&255),Iw(i,255&t.total_in),Iw(i,t.total_in>>8&255),Iw(i,t.total_in>>16&255),Iw(i,t.total_in>>24&255)):(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),Lw(t),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?vw:yw)},bb.deflateEnd=t=>{if(iv(t))return Sw;const e=t.state.status;return t.state=null,e===Vw?Dw(t,xw):vw},bb.deflateSetDictionary=(t,e)=>{let i=e.length;if(iv(t))return Sw;const n=t.state,s=n.wrap;if(2===s||1===s&&n.status!==Ew||n.lookahead)return Sw;if(1===s&&(t.adler=dw(t.adler,e,i,0)),n.wrap=0,i>=n.w_size){0===s&&(Uw(n.head),n.strstart=0,n.block_start=0,n.insert=0);let t=new Uint8Array(n.w_size);t.set(e.subarray(i-n.w_size,i),0),e=t,i=n.w_size}const r=t.avail_in,o=t.next_in,a=t.input;for(t.avail_in=i,t.next_in=0,t.input=e,Gw(n);n.lookahead>=3;){let t=n.strstart,e=n.lookahead-2;do{n.ins_h=qw(n,n.ins_h,n.window[t+3-1]),n.prev[t&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=t,t++}while(--e);n.strstart=t,n.lookahead=2,Gw(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,t.next_in=o,t.input=a,t.avail_in=r,n.wrap=s,vw},bb.deflateInfo="pako deflate (from Nodeca project)";var ov={};const av=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);ov.assign=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const e in i)av(i,e)&&(t[e]=i[e])}}return t},ov.flattenChunks=t=>{let e=0;for(let i=0,n=t.length;i=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;cv[254]=cv[254]=1,lv.string2buf=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,i,n,s,r,o=t.length,a=0;for(s=0;s>>6,e[r++]=128|63&i):i<65536?(e[r++]=224|i>>>12,e[r++]=128|i>>>6&63,e[r++]=128|63&i):(e[r++]=240|i>>>18,e[r++]=128|i>>>12&63,e[r++]=128|i>>>6&63,e[r++]=128|63&i);return e};lv.buf2string=(t,e)=>{const i=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let n,s;const r=new Array(2*i);for(s=0,n=0;n4)r[s++]=65533,n+=o-1;else{for(e&=2===o?31:3===o?15:7;o>1&&n1?r[s++]=65533:e<65536?r[s++]=e:(e-=65536,r[s++]=55296|e>>10&1023,r[s++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&hv)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let i="";for(let n=0;n{(e=e||t.length)>t.length&&(e=t.length);let i=e-1;for(;i>=0&&128==(192&t[i]);)i--;return i<0||0===i?e:i+cv[t[i]]>e?i:e};var uv=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const dv=bb,fv=ov,pv=lv,Ov=rw,gv=uv,mv=Object.prototype.toString,{Z_NO_FLUSH:bv,Z_SYNC_FLUSH:wv,Z_FULL_FLUSH:vv,Z_FINISH:yv,Z_OK:Sv,Z_STREAM_END:xv,Z_DEFAULT_COMPRESSION:kv,Z_DEFAULT_STRATEGY:Qv,Z_DEFLATED:$v}=ow;function Pv(t){this.options=fv.assign({level:kv,method:$v,chunkSize:16384,windowBits:15,memLevel:8,strategy:Qv},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new gv,this.strm.avail_out=0;let i=dv.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(i!==Sv)throw new Error(Ov[i]);if(e.header&&dv.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?pv.string2buf(e.dictionary):"[object ArrayBuffer]"===mv.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,i=dv.deflateSetDictionary(this.strm,t),i!==Sv)throw new Error(Ov[i]);this._dict_set=!0}}function Cv(t,e){const i=new Pv(e);if(i.push(t,!0),i.err)throw i.msg||Ov[i.err];return i.result}Pv.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize;let s,r;if(this.ended)return!1;for(r=e===~~e?e:!0===e?yv:bv,"string"==typeof t?i.input=pv.string2buf(t):"[object ArrayBuffer]"===mv.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),(r===wv||r===vv)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(s=dv.deflate(i,r),s===xv)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),s=dv.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===Sv;if(0!==i.avail_out){if(r>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},Pv.prototype.onData=function(t){this.chunks.push(t)},Pv.prototype.onEnd=function(t){t===Sv&&(this.result=fv.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},mb.Deflate=Pv,mb.deflate=Cv,mb.deflateRaw=function(t,e){return(e=e||{}).raw=!0,Cv(t,e)},mb.gzip=function(t,e){return(e=e||{}).gzip=!0,Cv(t,e)},mb.constants=ow;var _v={},Xv={};const Zv=16209;const Av=15,Tv=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Rv=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Ev=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Vv=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Mv=(t,e,i,n,s,r,o,a)=>{const l=a.bits;let h,c,u,d,f,p,O=0,g=0,m=0,b=0,w=0,v=0,y=0,S=0,x=0,k=0,Q=null;const $=new Uint16Array(16),P=new Uint16Array(16);let C,_,X,Z=null;for(O=0;O<=Av;O++)$[O]=0;for(g=0;g=1&&0===$[b];b--);if(w>b&&(w=b),0===b)return s[r++]=20971520,s[r++]=20971520,a.bits=1,0;for(m=1;m0&&(0===t||1!==b))return-1;for(P[1]=0,O=1;O852||2===t&&x>592)return 1;for(;;){C=O-y,o[g]+1=p?(_=Z[o[g]-p],X=Q[o[g]-p]):(_=96,X=0),h=1<>y)+c]=C<<24|_<<16|X|0}while(0!==c);for(h=1<>=1;if(0!==h?(k&=h-1,k+=h):k=0,g++,0==--$[O]){if(O===b)break;O=e[i+o[g]]}if(O>w&&(k&d)!==u){for(0===y&&(y=w),f+=m,v=O-y,S=1<852||2===t&&x>592)return 1;u=k&d,s[u]=w<<24|v<<16|f-r|0}}return 0!==k&&(s[f+k]=O-y<<24|64<<16|0),a.bits=w,0};const Dv=iw,Wv=sw,Uv=function(t,e){let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,y,S,x,k,Q;const $=t.state;i=t.next_in,k=t.input,n=i+(t.avail_in-5),s=t.next_out,Q=t.output,r=s-(e-t.avail_out),o=s+(t.avail_out-257),a=$.dmax,l=$.wsize,h=$.whave,c=$.wnext,u=$.window,d=$.hold,f=$.bits,p=$.lencode,O=$.distcode,g=(1<<$.lenbits)-1,m=(1<<$.distbits)-1;t:do{f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,0===w)Q[s++]=65535&b;else{if(!(16&w)){if(0==(64&w)){b=p[(65535&b)+(d&(1<>>=w,f-=w),f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,!(16&w)){if(0==(64&w)){b=O[(65535&b)+(d&(1<a){t.msg="invalid distance too far back",$.mode=Zv;break t}if(d>>>=w,f-=w,w=s-r,y>w){if(w=y-w,w>h&&$.sane){t.msg="invalid distance too far back",$.mode=Zv;break t}if(S=0,x=u,0===c){if(S+=l-w,w2;)Q[s++]=x[S++],Q[s++]=x[S++],Q[s++]=x[S++],v-=3;v&&(Q[s++]=x[S++],v>1&&(Q[s++]=x[S++]))}else{S=s-y;do{Q[s++]=Q[S++],Q[s++]=Q[S++],Q[s++]=Q[S++],v-=3}while(v>2);v&&(Q[s++]=Q[S++],v>1&&(Q[s++]=Q[S++]))}break}}break}}while(i>3,i-=v,f-=v<<3,d&=(1<(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function hy(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const cy=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode16211?1:0},uy=t=>{if(cy(t))return Nv;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Kv,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,Iv},dy=t=>{if(cy(t))return Nv;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,uy(t)},fy=(t,e)=>{let i;if(cy(t))return Nv;const n=t.state;return e<0?(i=0,e=-e):(i=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?Nv:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=i,n.wbits=e,dy(t))},py=(t,e)=>{if(!t)return Nv;const i=new hy;t.state=i,i.strm=t,i.window=null,i.mode=Kv;const n=fy(t,e);return n!==Iv&&(t.state=null),n};let Oy,gy,my=!0;const by=t=>{if(my){Oy=new Int32Array(512),gy=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Yv(1,t.lens,0,288,Oy,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Yv(2,t.lens,0,32,gy,0,t.work,{bits:5}),my=!1}t.lencode=Oy,t.lenbits=9,t.distcode=gy,t.distbits=5},wy=(t,e,i,n)=>{let s;const r=t.state;return null===r.window&&(r.wsize=1<=r.wsize?(r.window.set(e.subarray(i-r.wsize,i),0),r.wnext=0,r.whave=r.wsize):(s=r.wsize-r.wnext,s>n&&(s=n),r.window.set(e.subarray(i-n,i-n+s),r.wnext),(n-=s)?(r.window.set(e.subarray(i-n,i),0),r.wnext=n,r.whave=r.wsize):(r.wnext+=s,r.wnext===r.wsize&&(r.wnext=0),r.whavepy(t,15),Xv.inflateInit2=py,Xv.inflate=(t,e)=>{let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,y,S,x,k=0;const Q=new Uint8Array(4);let $,P;const C=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(cy(t)||!t.output||!t.input&&0!==t.avail_in)return Nv;i=t.state,i.mode===ey&&(i.mode=iy),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,u=a,d=l,x=Iv;t:for(;;)switch(i.mode){case Kv:if(0===i.wrap){i.mode=iy;break}for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0),h=0,c=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",i.mode=ay;break}if((15&h)!==Jv){t.msg="unknown compression method",i.mode=ay;break}if(h>>>=4,c-=4,S=8+(15&h),0===i.wbits&&(i.wbits=S),S>15||S>i.wbits){t.msg="invalid window size",i.mode=ay;break}i.dmax=1<>8&1),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16182;case 16182:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>8&255,Q[2]=h>>>16&255,Q[3]=h>>>24&255,i.check=Wv(i.check,Q,4,0)),h=0,c=0,i.mode=16183;case 16183:for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>8),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16184;case 16184:if(1024&i.flags){for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(f=i.length,f>a&&(f=a),f&&(i.head&&(S=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(n.subarray(r,r+f),S)),512&i.flags&&4&i.wrap&&(i.check=Wv(i.check,n,f,r)),a-=f,r+=f,i.length-=f),i.length))break t;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===a)break t;f=0;do{S=n[r+f++],i.head&&S&&i.length<65536&&(i.head.name+=String.fromCharCode(S))}while(S&&f>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=ey;break;case 16189:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>=7&c,c-=7&c,i.mode=oy;break}for(;c<3;){if(0===a)break t;a--,h+=n[r++]<>>=1,c-=1,3&h){case 0:i.mode=16193;break;case 1:if(by(i),i.mode=sy,e===zv){h>>>=2,c-=2;break t}break;case 2:i.mode=16196;break;case 3:t.msg="invalid block type",i.mode=ay}h>>>=2,c-=2;break;case 16193:for(h>>>=7&c,c-=7&c;c<32;){if(0===a)break t;a--,h+=n[r++]<>>16^65535)){t.msg="invalid stored block lengths",i.mode=ay;break}if(i.length=65535&h,h=0,c=0,i.mode=ny,e===zv)break t;case ny:i.mode=16195;case 16195:if(f=i.length,f){if(f>a&&(f=a),f>l&&(f=l),0===f)break t;s.set(n.subarray(r,r+f),o),a-=f,r+=f,l-=f,o+=f,i.length-=f;break}i.mode=ey;break;case 16196:for(;c<14;){if(0===a)break t;a--,h+=n[r++]<>>=5,c-=5,i.ndist=1+(31&h),h>>>=5,c-=5,i.ncode=4+(15&h),h>>>=4,c-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=ay;break}i.have=0,i.mode=16197;case 16197:for(;i.have>>=3,c-=3}for(;i.have<19;)i.lens[C[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,$={bits:i.lenbits},x=Yv(0,i.lens,0,19,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid code lengths set",i.mode=ay;break}i.have=0,i.mode=16198;case 16198:for(;i.have>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=g,c-=g,i.lens[i.have++]=b;else{if(16===b){for(P=g+2;c>>=g,c-=g,0===i.have){t.msg="invalid bit length repeat",i.mode=ay;break}S=i.lens[i.have-1],f=3+(3&h),h>>>=2,c-=2}else if(17===b){for(P=g+3;c>>=g,c-=g,S=0,f=3+(7&h),h>>>=3,c-=3}else{for(P=g+7;c>>=g,c-=g,S=0,f=11+(127&h),h>>>=7,c-=7}if(i.have+f>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=ay;break}for(;f--;)i.lens[i.have++]=S}}if(i.mode===ay)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=ay;break}if(i.lenbits=9,$={bits:i.lenbits},x=Yv(1,i.lens,0,i.nlen,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid literal/lengths set",i.mode=ay;break}if(i.distbits=6,i.distcode=i.distdyn,$={bits:i.distbits},x=Yv(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,$),i.distbits=$.bits,x){t.msg="invalid distances set",i.mode=ay;break}if(i.mode=sy,e===zv)break t;case sy:i.mode=ry;case ry:if(a>=6&&l>=258){t.next_out=o,t.avail_out=l,t.next_in=r,t.avail_in=a,i.hold=h,i.bits=c,Uv(t,d),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,i.mode===ey&&(i.back=-1);break}for(i.back=0;k=i.lencode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,i.length=b,0===m){i.mode=16205;break}if(32&m){i.back=-1,i.mode=ey;break}if(64&m){t.msg="invalid literal/length code",i.mode=ay;break}i.extra=15&m,i.mode=16201;case 16201:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;k=i.distcode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,64&m){t.msg="invalid distance code",i.mode=ay;break}i.offset=b,i.extra=15&m,i.mode=16203;case 16203:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=ay;break}i.mode=16204;case 16204:if(0===l)break t;if(f=d-l,i.offset>f){if(f=i.offset-f,f>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=ay;break}f>i.wnext?(f-=i.wnext,p=i.wsize-f):p=i.wnext-f,f>i.length&&(f=i.length),O=i.window}else O=s,p=o-i.offset,f=i.length;f>l&&(f=l),l-=f,i.length-=f;do{s[o++]=O[p++]}while(--f);0===i.length&&(i.mode=ry);break;case 16205:if(0===l)break t;s[o++]=i.length,l--,i.mode=ry;break;case oy:if(i.wrap){for(;c<32;){if(0===a)break t;a--,h|=n[r++]<{if(cy(t))return Nv;let e=t.state;return e.window&&(e.window=null),t.state=null,Iv},Xv.inflateGetHeader=(t,e)=>{if(cy(t))return Nv;const i=t.state;return 0==(2&i.wrap)?Nv:(i.head=e,e.done=!1,Iv)},Xv.inflateSetDictionary=(t,e)=>{const i=e.length;let n,s,r;return cy(t)?Nv:(n=t.state,0!==n.wrap&&n.mode!==ty?Nv:n.mode===ty&&(s=1,s=Dv(s,e,i,0),s!==n.check)?Gv:(r=wy(t,e,i,i),r?(n.mode=16210,Fv):(n.havedict=1,Iv)))},Xv.inflateInfo="pako inflate (from Nodeca project)";const vy=Xv,yy=ov,Sy=lv,xy=rw,ky=uv,Qy=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},$y=Object.prototype.toString,{Z_NO_FLUSH:Py,Z_FINISH:Cy,Z_OK:_y,Z_STREAM_END:Xy,Z_NEED_DICT:Zy,Z_STREAM_ERROR:Ay,Z_DATA_ERROR:Ty,Z_MEM_ERROR:Ry}=ow;function Ey(t){this.options=yy.assign({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ky,this.strm.avail_out=0;let i=vy.inflateInit2(this.strm,e.windowBits);if(i!==_y)throw new Error(xy[i]);if(this.header=new Qy,vy.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=Sy.string2buf(e.dictionary):"[object ArrayBuffer]"===$y.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(i=vy.inflateSetDictionary(this.strm,e.dictionary),i!==_y)))throw new Error(xy[i])}function Vy(t,e){const i=new Ey(e);if(i.push(t),i.err)throw i.msg||xy[i.err];return i.result}Ey.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize,s=this.options.dictionary;let r,o,a;if(this.ended)return!1;for(o=e===~~e?e:!0===e?Cy:Py,"[object ArrayBuffer]"===$y.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),r=vy.inflate(i,o),r===Zy&&s&&(r=vy.inflateSetDictionary(i,s),r===_y?r=vy.inflate(i,o):r===Ty&&(r=Zy));i.avail_in>0&&r===Xy&&i.state.wrap>0&&0!==t[i.next_in];)vy.inflateReset(i),r=vy.inflate(i,o);switch(r){case Ay:case Ty:case Zy:case Ry:return this.onEnd(r),this.ended=!0,!1}if(a=i.avail_out,i.next_out&&(0===i.avail_out||r===Xy))if("string"===this.options.to){let t=Sy.utf8border(i.output,i.next_out),e=i.next_out-t,s=Sy.buf2string(i.output,t);i.next_out=e,i.avail_out=n-e,e&&i.output.set(i.output.subarray(t,t+e),0),this.onData(s)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(r!==_y||0!==a){if(r===Xy)return r=vy.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},Ey.prototype.onData=function(t){this.chunks.push(t)},Ey.prototype.onEnd=function(t){t===_y&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=yy.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},_v.Inflate=Ey,_v.inflate=Vy,_v.inflateRaw=function(t,e){return(e=e||{}).raw=!0,Vy(t,e)},_v.ungzip=Vy,_v.constants=ow;const{Deflate:My,deflate:Dy,deflateRaw:Wy,gzip:Uy}=mb,{Inflate:Yy,inflate:qy,inflateRaw:Ly,ungzip:zy}=_v,Iy=ow;gb.Deflate=My,gb.deflate=Dy,gb.deflateRaw=Wy,gb.gzip=Uy,gb.Inflate=Yy,gb.inflate=qy,gb.inflateRaw=Ly,gb.ungzip=zy,gb.constants=Iy;const By=gb;let jy={};var Ny;function Gy(t){return Ny=t,[tS]}jy.Util={},jy.Decode={},jy.Messages=[],jy.Log=function(t){jy.Messages.push(["I",t]),console.log("Mma.js INFO: ",t)},jy.Warn=function(t){jy.Messages.push(["W",t]),console.log("Mma.js WARNING: ",t)},jy.Fail=function(t){throw jy.Messages.push(["E",t]),"Mma.js ERROR: "+t},jy.Util.Base64Decode=function(t){for(var e=atob(t),i=e.length>>>0,n=new Uint8Array(i),s=0;s1&&0===t[0]&&jy.Fail("IntegerAP: input starts with 0: "+String(t)),this.nstring=t}else void 0===t?this.nstring=void 0:jy.Fail("Integer: invalid input: "+String(t))},jy.RealMP=function(t){"number"==typeof t?this.n=t:void 0===t?this.n=void 0:jy.Fail("RealMP: invalid input")},jy.RealAP=function(t){"string"==typeof t?(t.length>1&&0===t[0]&&jy.Fail("RealAP: input starts with 0: "+String(t)),this.nstring=t):void 0===t?this.nstring=void 0:jy.Fail("RealAP: invalid input: "+String(t))},jy.Symbol=function(t){"string"==typeof t?this.name=t:void 0===t?this.name=void 0:jy.Fail("Symbol: invalid input: "+String(t))},jy.String=function(t){"string"==typeof t?this.str=t:void 0===t?this.str=void 0:jy.Fail("String: invalid input: "+String(t))},jy.Expression=function(t,e){t instanceof jy.Symbol||jy.Fail("Expression: head must be an Mma.Symbol"),e instanceof Array||jy.Fail("Expression: parts must be an Array"),this.head=t,this.parts=e},jy.Decode.Int32=function(t,e){try{return new DataView(t.buffer).getInt32(e,!0)}catch(t){return 0}},jy.Decode.Float64=function(t,e){try{return new DataView(t.buffer).getFloat64(e,!0)}catch(t){return 0}},jy.Decode.String=function(t,e,i){return void 0===e&&(e=0),void 0===i&&(i=t.length),jy.Util.U8ArrayToString(t.slice(e,e+i))},jy.Decode.StringEntry=function(t,e){void 0===e&&(e=0);var i=jy.Decode.Int32(t,e);return{length:i,string:jy.Decode.String(t,e+4,i),bytesRead:i+4}},jy.Decode.Any=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=1/0);var n=e;for(var s=0,r=[];ee%2!=0?t:{...t,body:Lm(t.body,/\(\*\|\*\)/gm)})),Array.isArray(this.args[this.args.length-1].body)||(this.decorator=this.args.pop());const r=this.args;console.log("creating InstanceWidget");for(let t=0;t{e.viewState.state.config.eval()},update:e=>this.applyChanges(e,t,i),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to&&!t.stringOnly)return i-2>=0?(o[i-2].editor.dispatch({selection:{anchor:o[i-2].editor.state.doc.length}}),o[i-2].editor.focus(),void(t.editorLastCursor=void 0)):(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0));t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to&&!t.stringOnly)return i+2=0)return r[t-2].body[i].editor.focus(),void(e.editorLastCursor=void 0)}},{key:"ArrowDown",run:function(e,n){if(t+2{},focus:()=>{},dispatch:()=>{},stringOnly:!0};const t=l.match(Fy);if(t){a.innerHTML=t[1];const e=jy.DecompressDecode(t[2]),i=jy.toArray(e.parts[0]),n=uuidv4();interpretate(i,{global:{call:n},element:a})}else a.innerHTML=l.slice(1,-1)}delete o[i].body,n.appendChild(a)}i.appendChild(n)}if(this.decorator){const t=jy.DecompressDecode(this.decorator.body.slice(2,-2)),e=jy.toArray(t.parts[0]);let n={global:{call:uuidv4(),EditorWidget:s},element:i};this.interpretated=interpretate(e,n)}}applyChanges(t,e,i){const n=this.args,s=this.args[e].body,r=this.visibleValue.argsPos,o=this.args[e].from;let a=t;0==i&&0==e&&(a="{{"+a),0==i&&0!=e&&(a="{"+a),i==s.length-1&&e==n.length-1&&(a+="}}"),i==s.length-1&&e!=n.length-1&&(a+="}");const l=s[i].length,h={from:r+o+s[i].from,to:r+o+s[i].from+l,insert:a},c=a.length-l;for(let t=i+1;t{s.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.args[0].body[0].editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.args[0].body[0].editor.focus();else{const t=this.DOMElement.EditorWidget.args,e=t[t.length-1].body[t[t.length-1].body.length-1].editor;e.dispatch({selection:{anchor:e.state.doc.length}}),e.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const Ky=(t,e)=>new Bm({tag:"GB",decoration:i=>ni.replace({widget:new Jy(i,t,e)})}),tS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=Ky(this.disposable,t).createDeco(t)}update(t){this.placeholder=Ky(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});function eS(t){return[rS]}let iS=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.span=i,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this,r=this.args[1].body.slice(3,-3),o=jy.DecompressDecode(r),a=jy.toArray(o.parts[0]);this.data=a;const l="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}));this.cuid=l;let h={call:l,EditorWidget:s},c={global:h,element:i};this.expression=a,this.env=c,this.interpretated=interpretate(a,c),this.interpretated.then((()=>{if(c.options?.Event){console.warn("Event listeners are enabled!"),s.events=c.options.Event;let t=c;if(h.stack){const e=Object.values(h.stack);e.length>0&&(console.log("Attaching first found instance..."),t=e[0].env)}interpretate(["MetaMarker","'"+l+"'"],t).then((()=>{server.kernel.emitt(s.events,'"'+l+'"',"Mounted")}))}}))}getDoc(){return this.args[0].body.slice(1,-1)}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+t+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].length=s.length,this.view.dispatch({changes:r})}applyOuterChanges(t){const e=this.visibleValue,i=t,n={from:e.pos,to:e.pos+e.length,insert:i};this.view.dispatch({changes:n})}update(t){if(!this.deactivated){if(t.str!=this.visibleValue.str){console.warn("Out of sync"),console.log("recreate..."),this.destroy();const e=this.span;return e.replaceChildren(),void this._construct(t,this.view,e)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}}destroy(t){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.events&&server.kernel.emitt(this.events,'"'+this.cuid+'"',"Destroy"),delete this.data}},nS=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=this;let i=document.createElement("span");return i.classList.add("frontend-view"),i.EditorWidget=new iS(this.visibleValue,t,i),this.reference.push({destroy:()=>{e.destroy(i)}}),i}ignoreEvent(){return!0}destroy(t){console.log("destroy in general*"),t.EditorWidget.destroy()}};const sS=(t,e)=>new Bm({tag:"VB",decoration:i=>ni.replace({widget:new nS(i,t,e)})}),rS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=sS(this.disposable,t).createDeco(t)}update(t){this.placeholder=sS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var oS;function aS(t){return oS=t,[uS]}let lS=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.span=i,this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this;this.epilog={offset:0,string:""},this.prolog={offset:0,string:""};const r=this.args[1].body.slice(3,-3),o=jy.DecompressDecode(r),a=jy.toArray(o.parts[0]);this.data=a;let l={global:{call:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)})),element:i,origin:s},element:i};this.env=l,interpretate(a,l).then((()=>{if(l.options?.Head&&(s.prolog.offset=l.options.Head.length+1,s.prolog.string=l.options.Head+"[",s.epilog.offset=1,s.epilog.string="]"),l.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=l.options.Event),l.options?.String){s.prolog.offset=1,s.prolog.string='"',s.epilog.offset=1,s.epilog.string='"',l.options?.HeadString&&(s.prolog.string=l.options.HeadString,s.prolog.offset=s.prolog.string.length),l.options?.TailString&&(s.epilog.string=l.options.TailString,s.epilog.offset=s.epilog.string.length),s.editor={destroy:()=>{console.log("Nothing to destroy, this is just a text field.")}};const t=document.createElement("span");return this.aa,t.onkeydown=function(t){13===t.keyCode&&t.preventDefault()},t.contentEditable="plaintext-only",t.innerText=s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),t.addEventListener("input",console.log),t.addEventListener("input",(()=>{console.log("Update"),console.log(t.innerText),this.applyChanges(t.innerText)})),l.global.element.appendChild(t),void(s.events&&server.kernel.emitt(s.events,"Null","Mounted"))}s.editor=oS({doc:s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),parent:l.global.element,update:t=>this.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos+s.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]}),s.events&&server.kernel.emitt(s.events,"Null","Mounted")}))}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+this.prolog.string+t+this.epilog.string+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length));const o=s.length-i[0].length;i[0].length=s.length,this.visibleValue.length=this.visibleValue.length+o,this.view.dispatch({changes:r})}update(t){if(this.visibleValue.str!=t.str)return console.warn("Out of sync"),console.log("recreating InstanceWidget"),this.destroy(),this.span.replaceChildren(),void this._construct(t,this.view,this.span);this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.editor.destroy(),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}},hS=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("subscript-tail"),e.EditorWidget=new lS(this.visibleValue,t,e,[]);const i=this;return this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const cS=(t,e)=>new Bm({tag:"BB",decoration:i=>ni.replace({widget:new hS(i,t,e)})}),uS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=cS(this.disposable,t).createDeco(t)}update(t){this.placeholder=cS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var dS;function fS(t){return dS=t,[mS]}class pS{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm);const s=this,r=Array.from({length:Math.ceil((s.args.length-3)/2)},((t,e)=>2*e+1));s.indexes=r;const o=[];this.span=i,this.spans=o;for(let t=0;t{c.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=c.options.Event),s.editors=r.map(((t,i)=>dS({doc:s.args[t].body,parent:o[i],update:e=>this.applyChanges(e,t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i>0?s.editors[i-1].focus():(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus()),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return it.destroy())),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}}class OS extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("inline-flex"),e.EditorWidget=new pS(this.visibleValue,t,e,[]);const i=this;return this.DOMElement=e,this.reference.push({destroy:()=>{i.destroy(e)}}),e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;const n=this.DOMElement.EditorWidget.editors;return t.from-e.from<0?(n[n.length-1].dispatch({selection:{anchor:n[n.length-1].state.doc.length}}),n[n.length-1].focus()):(n[0].dispatch({selection:{anchor:0}}),n[0].focus()),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}}const gS=(t,e)=>new Bm({tag:"TB",decoration:i=>ni.replace({widget:new OS(i,t,e)})}),mS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=gS(this.disposable,t).createDeco(t)}update(t){this.placeholder=gS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});const bS=_i.fromClass(class{decorations=ni.none;constructor(t){this.view=t,this.recompute()}recompute(t){let e,i,n=[];for(let{from:t,to:e}of this.view.visibleRanges)this.getDecorationsFor(t,e,n);this.decorations=ni.set(n,!0),this.decorations=this.decorations.update({filter:(n,s)=>!(n>e&&s=e&&s.selection.main.head<=i)return!0;if(!n&&s.selection.main.head>e&&s.selection.main.headt.decorations});class wS extends ei{constructor(t,e){super(),this.rawValue=t,this.visibleValue=e}eq(t){return this.rawValue===t.rawValue}toDOM(){let t=document.createElement("div");t.classList.add("cell-type-widget");const e=this.rawValue.split(" "),i=e[0].split(".");if(console.log(i),t.classList.add("cell-type-"+i[1].trim()),t.innerText=e[0].trim(),e.length>1){const n=e.slice(1),s=document.createElement("span");return s.appendChild(t),n.forEach((t=>{const e=document.createElement("span");e.innerText=t,e.classList.add("cell-type-"+i[1].trim()+"-"+t.split("=")[0]),s.appendChild(e)})),s}return t}ignoreEvent(){return!1}}const vS=new F,yS=new F,SS=[],xS=Sl.define([{tag:Sa.meta,color:"var(--editor-key-meta)"},{tag:Sa.link,textDecoration:"underline"},{tag:Sa.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Sa.emphasis,fontStyle:"italic"},{tag:Sa.strong,fontWeight:"bold"},{tag:Sa.strikethrough,textDecoration:"line-through"},{tag:Sa.keyword,color:"var(--editor-key-keyword)"},{tag:[Sa.atom,Sa.bool,Sa.url,Sa.contentSeparator,Sa.labelName],color:"var(--editor-key-atom)"},{tag:[Sa.literal,Sa.inserted],color:"var(--editor-key-literal)"},{tag:[Sa.string,Sa.deleted],color:"var(--editor-key-string)"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],color:"var(--editor-key-escape)"},{tag:Sa.definition(Sa.variableName),color:"var(--editor-key-variable)"},{tag:Sa.local(Sa.variableName),color:"var(--editor-local-variable)"},{tag:[Sa.typeName,Sa.namespace],color:"var(--editor-key-type)"},{tag:Sa.className,color:"var(--editor-key-class)"},{tag:[Sa.special(Sa.variableName),Sa.macroName],color:"var(--editor-special-variable)"},{tag:Sa.definition(Sa.propertyName),color:"var(--editor-key-property)"},{tag:Sa.comment,color:"var(--editor-key-comment)"},{tag:Sa.invalid,color:"var(--editor-key-invalid)"}]),kS={data:[],extend:t=>{kS.data.push(...t),Qm.reBuild(kS.data)},replaceAll:t=>{kS.data=t,Qm.reBuild(kS.data)}},QS=Gl.define({name:"spreadsheet",startState:function(){return{stringType:null,stack:[]}},token:function(t,e){if(t){switch(0===e.stack.length&&('"'!=t.peek()&&"'"!=t.peek()||(e.stringType=t.peek(),t.next(),e.stack.unshift("string"))),e.stack[0]){case"string":for(;"string"===e.stack[0]&&!t.eol();)t.peek()===e.stringType?(t.next(),e.stack.shift()):"\\"===t.peek()?(t.next(),t.next()):t.match(/^.[^\\\"\']*/);return"string";case"characterClass":for(;"characterClass"===e.stack[0]&&!t.eol();)t.match(/^[^\]\\]+/)||t.match(/^\\./)||e.stack.shift();return"operator"}var i=t.peek();switch(i){case"[":return t.next(),e.stack.unshift("characterClass"),"bracket";case":":return t.next(),"operator";case"\\":return t.match(/\\[a-z]+/)?"string.special":(t.next(),"atom");case".":case",":case";":case"*":case"-":case"+":case"^":case"<":case"/":case"=":return t.next(),"atom";case"$":return t.next(),"builtin"}return t.match(/\d+/)?t.match(/^\w+/)?"error":"number":t.match(/^[a-zA-Z_]\w*/)?t.match(/(?=[\(.])/,!1)?"keyword":"variable":-1!=["[","]","(",")","{","}"].indexOf(i)?(t.next(),"bracket"):(t.eatSpace()||t.next(),null)}}}),$S=new RegExp(/^[\w]*\.[\w]+/);function PS(t){const e=$S.exec(t),i=Object.values(window.SupportedLanguages);for(let t=0;t{if(!t.docChanged)return null;let e=PS(t.newDoc.line(1).text);if(e.legacy){const i=t.startState.facet(Wa);if(i){if(i.name==e.name)return null}else if(t.startState.facet(CS)==e.name)return null;return console.log("switching... to "+e.name),{effects:vS.reconfigure(e.plugins)}}return e.name===t.startState.facet(Wa).name?null:(console.log("switching... to "+e.name),{effects:vS.reconfigure(e.plugins)})}));let XS,ZS=null;const AS=t=>{const e=t||XS;return e&&e.viewState?(console.log(),PS(e.state.doc.line(1).text).name):""},TS=t=>{const e=t||XS;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return!1;const n=i[0];return[n.from,n.to]},RS=t=>{const e=t||XS;return e&&e.viewState?e.state.doc.toString():""},ES=t=>{const e=t||XS;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return"";const n=i[0];return console.log("yoko"),console.log(n),console.log(e.state.doc.toString().slice(n.from,n.to)),console.log("processing"),e.state.doc.toString().slice(n.from,n.to)},VS=(t,e)=>{const i=e||XS;if(!i)return;if(!i.viewState)return;const n=i.viewState.state.selection.ranges;if(!n.length)return;const s=n[0];console.log("result"),console.log(t),i.dispatch({changes:{...s,insert:t}})},MS=()=>XS,DS=(t,e)=>{const i=e||XS;i&&i.viewState&&(console.log("result"),console.log(t),i.dispatch({changes:{from:0,to:i.viewState.state.doc.length,insert:t}}))};ZS=t=>{let e=new Ts({doc:t.doc,extensions:[Ys.of([{key:"Tab",run:function(t,e){return sd(t)}},{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,zS,Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(XS=e.view)}))],parent:t.parent});return e.viewState.state.config.eval=t.eval,e},ZS.state=t=>{let e=xt.create({doc:t.doc,extensions:[Ys.of([{key:"Tab",run:function(t,e){return sd(t)}},{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,zS,Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(XS=e.view)}))]});return e.config.eval=t.eval,e};const WS=(t,e)=>{if(!t||e<=0)return[];const i=[];for(let n=0;n{if(console.log(e.dom.ocellref),XS=e,e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:DropEvent"]')}},file:(t,e,i,n,s)=>{if(e.dom.ocellref)if(s.length>5242880){const t=WS(s,5242880);t.forEach(((e,s)=>{server.emitt(i,`<|"Data"->"${e}", "Name"->"${n}", "Chunk"->${s+1}, "Chunks"->${t.length}|>`,"Chunk")}))}else server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},YS={transaction:(t,e,i,n)=>{if(console.log(e.dom.ocellref),e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:PasteEvent"]')}},file:(t,e,i,n,s)=>{if(console.log(e.dom.ocellref),e.dom.ocellref)if(s.length>5242880){const t=WS(s,5242880);t.forEach(((e,s)=>{server.emitt(i,`<|"Data"->"${e}", "Name"->"${n}", "Chunk"->${s+1}, "Chunks"->${t.length}|>`,"Chunk")}))}else server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},qS=[Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Cm(US,YS)];let LS=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"}}),zS=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"},".cm-scroller":{"line-height":"inherit","overflow-x":"overlay","overflow-y":"overlay","align-items":"initial"},".cm-content":{padding:"0px 0"},".rainbow-bracket-red":{color:"var(--editor-bracket-1)"},".rainbow-bracket-orange":{color:"var(--editor-bracket-2)"},".rainbow-bracket-yellow":{color:"var(--editor-bracket-3)"},".rainbow-bracket-green":{color:"var(--editor-bracket-4)"},".rainbow-bracket-blue":{color:"var(--editor-bracket-5)"},".rainbow-bracket-indigo":{color:"var(--editor-bracket-6)"},".rainbow-bracket-violet":{color:"var(--editor-bracket-7)"},".rainbow-bracket-red > span":{color:"var(--editor-bracket-1-a)"},".rainbow-bracket-orange > span":{color:"var(--editor-bracket-2-a)"},".rainbow-bracket-yellow > span":{color:"var(--editor-bracket-3-a)"},".rainbow-bracket-green > span":{color:"var(--editor-bracket-4-a)"},".rainbow-bracket-blue > span":{color:"var(--editor-bracket-5-a)"},".rainbow-bracket-indigo > span":{color:"var(--editor-bracket-6-a)"},".rainbow-bracket-violet > span":{color:"var(--editor-bracket-7-a)"}}),IS=!1;const BS=[()=>vr(),()=>Sh(),()=>ir(),()=>dr(),()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xS,{fallback:!1}),()=>tu()],jS={},NS=[()=>vr(),()=>Sh(),()=>ir(),()=>dr(),t=>GS.of(t),()=>jS.gutter?function(t={}){return[eo.of(t),jr(),so]}():[],()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xS,{fallback:!1}),()=>tu(),()=>bS,()=>function(t){return _i.fromClass(class{constructor(e){this.view=e,this.placeholder=ni.set([ni.widget({widget:new kr(t),side:1}).range(0)])}get decorations(){return this.view.state.doc.length?ni.none:this.placeholder}},{decorations:t=>t.decorations})}("Type WL Expression / .md / .js"),()=>xt.allowMultipleSelections.of(!0),(t,e)=>vS.of(e),()=>yS.of(xt.readOnly.of(!1)),()=>_S,()=>{return t?[ou.of(t),Yu]:Yu;var t},(t,e)=>Ys.of([{key:"Tab",run:function(t,e){const i=sd(t);return i||Rc(t)},shift:Ec},{key:"Backspace",run:function(e,i){if(0===e.state.doc.length)return t.origin.remove(),!0}},{key:"ArrowLeft",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus prev"),t.origin.focusPrev(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus next"),t.origin.focusNext(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"Shift-Enter",preventDefault:!0,run:function(e,i){console.log(e.state.doc.toString()),t.origin.eval(e.state.doc.toString())}},...Vc,...Wh,...Ru]),(t,e)=>Ts.updateListener.of((e=>{e.docChanged&&t.origin.save(encodeURIComponent(e.state.doc.toString())),e.selectionSet&&(XS=e.view)})),()=>LS];const GS=E.define();function FS(t){return t.replace(/\\\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\\\:/g,""),16))})).replaceAll("\\:F74E","I").replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))}function HS(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(t=>(+t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+t/4).toString(16)))}core.ReadOnly=()=>"ReadOnly",core.EditorView=async(t,e)=>{let i=await interpretate(t[0],e);i=FS(i),console.log("UNICODE Disaster");const n=await core._getRules(t,e);let s=()=>{},r=()=>{},o=i;const a=[];n.ReadOnly&&a.push(xt.readOnly.of(!0)),n.ForceUpdate&&(e.local.forceUpdate=n.ForceUpdate),n.Event&&(r=t=>{o=t,console.log("editor view emitt data: "+t),server.kernel.emitt(n.Event,'"'+t.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Input")},s=()=>{server.kernel.emitt(n.Event,'"'+o.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Evaluate")}),e.local?e.local.editor=ZS({doc:i,parent:e.element,eval:s,update:r,extensions:a}):ZS({doc:i,parent:e.element,eval:s,update:r,extensions:a}),e.element.style.verticalAlign="inherit"},core.StripOnInput=async()=>{},core.EditorView.update=async(t,e)=>{if(!e.local.editor)return;const i=FS(await interpretate(t[0],e));console.log("editor view: dispatch"),e.local.forceUpdate,e.local.editor.dispatch({changes:{from:0,to:e.local.editor.state.doc.length,insert:i}})},core.EditorView.destroy=async(t,e)=>{await interpretate(t[0],e),e.local&&e.local.editor&&e.local.editor.destroy()},core.EditorView.virtual=!0,core.PreviewCell=(t,e)=>{},window.SupportedLanguages.push({check:t=>null===t,legacy:!0,plugins:qS,name:"mathematica"}),window.SupportedLanguages.push({check:t=>null!=t[0].match(/\w+\.(wl|wls)$/),plugins:qS,legacy:!0,name:"mathematica"}),window.SupportedCells.codemirror={view:class{origin={};editor={};trash=[];forceFocusNext(){IS=!0}focus(t){t>0?this.editor.dispatch({selection:{anchor:0}}):t<0&&this.editor.dispatch({selection:{anchor:this.editor.state.doc.length}}),this.editor.focus()}setContent(t){if(console.warn("content mutation!"),!this.editor.viewState)return;const e=this.editor;console.log("result"),console.log(t),this.editor.dispatch({changes:{from:0,to:e.viewState.state.doc.length,insert:t}})}addDisposable(t){this.trash.push(t)}dispose(){this.editor.destroy()}readOnly(t){this.editor.dispatch({effects:yS.reconfigure(xt.readOnly.of(t))})}constructor(t,e){this.origin=t;const i=this.origin,n=PS(e).plugins,s=this;this.origin.element.ocellref=s;const r=new Ts({doc:(o=e,o.replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))),extensions:NS.map((t=>t(s,n))),parent:this.origin.element});var o;return this.editor=r,this.editor.dom.ocellref=s,this.editor.viewState.state.config.eval=()=>{i.eval(this.editor.state.doc.toString())},IS&&r.focus(),IS=!1,this}},context:{EditorAutocomplete:kS,javascriptLanguage:qf,javascript:Nf,markdownLanguage:rm,markdown:function(t={}){let{codeLanguages:e,defaultCodeLanguage:i,addKeymap:n=!0,base:{parser:s}=sm}=t;if(!(s instanceof Zp))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let r,o=t.extensions?[t.extensions]:[],a=[dm.support];i instanceof Ua?(a.push(i.support),r=i.language):i&&(r=i);let l=e||r?(h=e,c=r,t=>{if(t&&h){let e=null;if(t=/\S*/.exec(t)[0],e="function"==typeof h?h(t):Ya.matchLanguageName(h,t,!0),e instanceof Ya)return e.support?e.support.language.parser:Ta.getSkippingParser(e.load());if(e)return e.parser}return c?c.parser:null}):void 0;var h,c;return o.push(function(t){let{codeParser:e,htmlParser:i}=t,n=Do(((t,n)=>{let s=t.type.id;if(!e||s!=Kf.CodeBlock&&s!=Kf.FencedCode){if(i&&(s==Kf.HTMLBlock||s==Kf.HTMLTag))return{parser:i,overlay:rO(t.node,t.from,t.to)}}else{let i="";if(s==Kf.FencedCode){let e=t.node.getChild(Kf.CodeInfo);e&&(i=n.read(e.from,e.to))}let r=e(i);if(r)return{parser:r,overlay:t=>t.type.id==Kf.CodeText}}return null}));return{wrap:n}}({codeParser:l,htmlParser:dm.language.parser})),n&&a.push(N.high(Ys.of(um))),new Ua(nm(s.configure(o)),a)},htmlLanguage:jg,html:Ng,cssLanguage:kg,css:Qg,EditorView:Ts,EditorState:xt,highlightSpecialChars:vr,syntaxHighlighting:$l,defaultHighlightStyle:xS,editorCustomTheme:LS,foldGutter:function(t={}){let e=Object.assign(Object.assign({},wl),t),i=new vl(e,!0),n=new vl(e,!1),s=_i.fromClass(class{constructor(t){this.from=t.viewport.from,this.markers=this.buildMarkers(t)}update(t){(t.docChanged||t.viewportChanged||t.startState.facet(Wa)!=t.state.facet(Wa)||t.startState.field(dl,!1)!=t.state.field(dl,!1)||Xa(t.startState)!=Xa(t.state)||e.foldingChanged(t))&&(this.markers=this.buildMarkers(t.view))}buildMarkers(t){let e=new Xt;for(let s of t.viewportLineBlocks){let r=fl(t.state,s.from,s.to)?n:ll(t.state,s.from,s.to)?i:null;r&&e.add(s.from,s.from,r)}return e.finish()}}),{domEventHandlers:r}=e;return[s,Ir({class:"cm-foldGutter",markers(t){var e;return(null===(e=t.plugin(s))||void 0===e?void 0:e.markers)||_t.empty},initialSpacer:()=>new vl(e,!1),domEventHandlers:Object.assign(Object.assign({},r),{click:(t,e,i)=>{if(r.click&&r.click(t,e,i))return!0;let n=fl(t.state,e.from,e.to);if(n)return t.dispatch({effects:ul.of(n)}),!0;let s=ll(t.state,e.from,e.to);return!!s&&(t.dispatch({effects:cl.of(s)}),!0)}})}),ml()]},Facet:E,Compartment:F,mathematicaPlugins:qS,legacyLangNameFacet:CS,DropPasteHandlers:Cm,EditorExtensionsMinimal:BS,EditorParameters:jS,EditorExtensions:NS,StateField:q,Decoration:ni,ViewPlugin:_i,WidgetType:ei,originFacet:GS,MatchDecorator:pr}},window.OfflineMode&&SS.push(xt.readOnly.of(!0)),core.CellView=async(t,e)=>{const i=await core._getRules(t,e);i.Display||(i.Display="codemirror");const n=await interpretate(t[0],e),s={element:e.element,uid:HS()};i.Style&&(e.element.style=i.Style),i.Class&&e.element.classList.add(...i.Class.split(" ")),i.ImageSize&&(Array.isArray(i.ImageSize)?(e.element.style.width=i.ImageSize[0]+"px",e.element.style.height=i.ImageSize[1]+"px"):e.element.style.width=i.ImageSize+"px"),new window.SupportedCells[i.Display].view(s,n)};const JS={};core.FrontEditorSelected=async(t,e)=>{console.log("check");const i=await interpretate(t[0],e),n=await core._getRules(t,e);let s;switch(n.Editor&&(s=JS[n.Editor],console.log("Editor"),console.log(n.Editor),console.log(s)),i){case"Get":return ES(s);case"Set":let i=await interpretate(t[1],e);VS(i,s);break;case"GetDoc":return RS(s);case"SetDoc":let n=await interpretate(t[1],e);DS(n,s);break;case"Cursor":return TS(s);case"Type":return AS(s);case"Editor":const r=HS();return JS[r]=MS(),r}};window.SupportedCells.shell={view:class{dispose(){}constructor(t,e){this.origin=t;const i=document.createElement("div");return i.classList.add(..."flex sc-b max-h-60 text-sm overflow-y-scroll".split(" ")),i.style.overflowAnchor="auto",i.style.flexDirection="column-reverse",i.innerText=e,this.origin.element.appendChild(i),this}}}; diff --git a/src/kernel.js b/src/kernel.js index 961dc24..b95e2e1 100644 --- a/src/kernel.js +++ b/src/kernel.js @@ -431,6 +431,7 @@ const splitStringIntoChunks = (str, chunkSize) => { const wlDrop = { transaction: (ev, view, id, length) => { console.log(view.dom.ocellref); + selectedEditor = view; if (view.dom.ocellref) { const channel = view.dom.ocellref.origin.channel; server._emitt(channel, `<|"Channel"->"${id}", "Length"->${length}, "CellType"->"wl"|>`, 'Forwarded["CM:DropEvent"]'); From 1906045642b9cc8da95da34f07d08f38c8294e16 Mon Sep 17 00:00:00 2001 From: Kirill Vasin Date: Sat, 23 Nov 2024 11:57:33 +0100 Subject: [PATCH 20/26] animated image added --- src/AutocompleteDefaults.wl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/AutocompleteDefaults.wl b/src/AutocompleteDefaults.wl index b7474fd..205aed8 100644 --- a/src/AutocompleteDefaults.wl +++ b/src/AutocompleteDefaults.wl @@ -1,4 +1,5 @@ { + <|"label"->"AnimatedImage", "type"->"keyword", "info"->"AnimatedImage[List[Image__]] produces an animated image from list of frames"|>, <|"label"->"ByteCount", "type"->"keyword", "info"->"ByteCount[expr] gives the number of bytes used internally by the Wolfram System"|>, <|"label"->"Sum", "type"->"keyword", "info"->"Sum[f,{i,imax}] evaluates the sum. Sum[f,{i,imax, di}] with a step di"|>, <|"label"->"Product", "type"->"keyword", "info"->"Product[f,{i,imax}] evaluates the product. Product[f,{i,imax, di}] with a step di"|>, From a5f6cd628235992460b6755b2c13d5fd7680d7b5 Mon Sep 17 00:00:00 2001 From: Kirill Vasin Date: Sun, 24 Nov 2024 14:34:55 +0100 Subject: [PATCH 21/26] sync monitor added --- src/FrontendObjectSync.wl | 153 +++++++++++++++++++++++++++++++++++++- src/objects.js | 53 +++++++++++++ templates/SyncMonitor.wlx | 21 ++++++ 3 files changed, 224 insertions(+), 3 deletions(-) create mode 100644 templates/SyncMonitor.wlx diff --git a/src/FrontendObjectSync.wl b/src/FrontendObjectSync.wl index e103dee..cbb00f3 100644 --- a/src/FrontendObjectSync.wl +++ b/src/FrontendObjectSync.wl @@ -2,15 +2,85 @@ BeginPackage["Notebook`Editor`FrontendObject`Sync`", { "JerryI`Misc`Events`", "JerryI`Misc`Events`Promise`", "JerryI`Notebook`", + "JerryI`WLX`", + "JerryI`WLX`Importer`", "JerryI`WLX`WebUI`", "JerryI`Notebook`AppExtensions`", - "JerryI`Misc`WLJS`Transport`" + "JerryI`Misc`WLJS`Transport`", + "JerryI`Misc`Language`" }] Begin["`Private`"] rootDir = $InputFileName // DirectoryName // ParentDirectory; +syncMonitor = ImportComponent[FileNameJoin[{rootDir, "templates", "SyncMonitor.wlx"}] ]; + +syncMonitorConstructor[uids_List, opts_Association, title_String: "Syncing data"] := LeakyModule[{ + object, + monitor = CreateUUID[], + time = AbsoluteTime[], + cnt = 0, + controller = CreateUUID[] +}, + + If[Length[uids] < 3, + + EventHandler[monitor, Function[Null, + cnt = cnt + 1; + Echo["SyncMonitor >> Syncing "<>ToString[cnt]<>" out of "<>ToString[Length[uids] ] ]; + ] ]; + + object /: Delete[object] := ( + EventRemove[monitor]; + ClearAll[cnt]; + ClearAll[time]; + ClearAll[controller]; + ClearAll[object]; + Echo["SyncMonitor >> removed"]; + ); + + Return[{object, monitor}]; + ]; + + With[{notification = Notifications`Custom["Topic"->title, "Body"->syncMonitor[controller], "Controls"->False]}, + + object /: Delete[object] := ( + EventRemove[monitor]; + EventRemove[controller]; + ClearAll[cnt]; + ClearAll[time]; + ClearAll[object]; + ClearAll[controller]; + Delete[notification]; + Echo["SyncMonitor >> removed"]; + ); + + EventHandler[monitor, Function[Null, + cnt = cnt + 1; + Echo["SyncMonitor >> Syncing "<>ToString[cnt]<>" out of "<>ToString[Length[uids] ] ]; + With[{t = AbsoluteTime[]}, + If[t - time > 2, + Echo["SyncMonitor >> Too long"]; + + EventFire[opts["Log"], notification, True]; + EventFire[controller, "Sync", <|"Client"->opts["Client"], "Current"->cnt, "Total"->Length[uids] |>]; + + EventHandler[monitor, Function[Null, + cnt = cnt + 1; + Echo["SyncMonitor >> Syncing "<>ToString[cnt]<>" out of "<>ToString[Length[uids] ] ]; + EventFire[controller, "Sync", <|"Client"->opts["Client"], "Current"->cnt, "Total"->Length[uids] |>]; + ] ]; + ]; + ]; + ] ]; + + + ]; + + {object, monitor} +] + WLJSTransportHandler["GetSymbol"] = Function[{expr, client, callback}, Print["evaluating cached symbol"]; With[{name = StringDrop[StringDrop[ToString[expr], StringLength["Hold["] ], -1]}, @@ -48,7 +118,84 @@ attachListeners[notebook_Notebook] := With[{}, Echo["OnBefore Save!!!!!!!!"]; With[{promise = Promise[]}, - Then[WebUIFetch[Global`UIObjects["GetAll"] , opts["Client"] ], + Then[WebUIFetch[Global`UIObjects["GetAllUids"] , opts["Client"] ], + Function[uids, + Echo["uids resolved!"]; + Echo[uids]; + + LeakyModule[{ + monitor, monitorHandler, + monitorSym, monitorHandlerSym + }, + + {monitorHandler, monitor} = syncMonitorConstructor[uids, opts]; + + With[{requests = Table[WebUIFetch[Global`UIObjects["GetById", i, "MonitorEvent"->monitor] , opts["Client"] ], {i, uids}]}, + If[Length[requests] == 0, + EventFire[promise, Resolve, True]; + , + + Then[requests, + Function[results, + Echo["results resolved!"]; + + + With[{processed = Map[<|"Public"->#|>&, AssociationThread[uids -> results]]}, + Notebook`Editor`FrontendObject`Objects = Join[Notebook`Editor`FrontendObject`Objects , processed]; + notebook["Objects"] = processed; + + monitorHandler // Delete; + ClearAll[monitor]; + ClearAll[monitorHandler]; + + Echo["FrontendObject`Sync`Objects >> ok "]; + + + Then[WebUIFetch[Global`UIObjects["GetAllSymbolsNames"] , opts["Client"] ], + Function[names, + Echo["symbols names resolved!"]; + Echo[names]; + + {monitorHandlerSym, monitorSym} = syncMonitorConstructor[names, opts, "Syncing symbols"]; + + With[{symRequests = Table[WebUIFetch[Global`UIObjects["GetSymbolByName", i, "MonitorEvent"->monitorSym] , opts["Client"] ], {i, names}]}, + If[Length[symRequests] == 0, + EventFire[promise, Resolve, True]; + , + Then[symRequests, + Function[symResults, + Echo["symbols resolved!"]; + + + notebook["Symbols"] = AssociationThread[names -> symResults]; + + Delete[monitorHandlerSym]; + + ClearAll[monitorSym]; + ClearAll[monitorHandlerSym]; + + Echo["FrontendObject`Sync`Symbols >> ok "]; + EventFire[promise, Resolve, True]; + ] + ] + ] + ] + ] + ]; + ] + ] + ] + ] + ] + ]; + ], + Function[error, + Echo["FrontendObject`Sync >> Syncing error!"]; + Echo[error] + ] + ]; + + (*Then[WebUIFetch[Global`UIObjects["GetAll"] , opts["Client"] ], Function[pay, Echo["resolved!"]; With[{processed = Map[<|"Public"->#|>&, pay]}, @@ -71,7 +218,7 @@ attachListeners[notebook_Notebook] := With[{}, , Function[error, Echo["FrontendObject`Sync >> Syncing error!"]; Echo[error] - ] ]; + ] ];*) promise ] diff --git a/src/objects.js b/src/objects.js index 6172175..9846d8c 100644 --- a/src/objects.js +++ b/src/objects.js @@ -166,6 +166,31 @@ core.UIObjects.GetAll = async (args, env) => { message.push(['Rule', "'"+list[i].uid+"'", list[i].cache]); } message.unshift('Association'); + //console.log(message); + return message; +} + +core.UIObjects.GetAllUids = async (args, env) => { + garbageCollect(); + const list = Object.values(ObjectHashMap); + const message = []; + for (let i=0; i { + const uid = await interpretate(args[0], env); + const opts = await core._getRules(args, env); + + if ('MonitorEvent' in opts) { + server.emitt(opts['MonitorEvent'], '"'+uid+'"'); + } + + const message = ObjectHashMap[uid].cache; console.log(message); return message; } @@ -183,10 +208,38 @@ core.UIObjects.GetAllSymbols = async (args, env) => { message.push(['Rule', "'"+list[i]+"'", core[list[i]].data]); } message.unshift('Association'); + + return message; +} + +core.UIObjects.GetAllSymbolsNames = async (args, env) => { + //garbageCollect(); + const list = Object.keys(server.kernel.trackedSymbols); + const message = []; + for (let i=0; i { + //garbageCollect(); + const name = await interpretate(args[0], env); + const opts = await core._getRules(args, env); + + if ('MonitorEvent' in opts) { + server.emitt(opts['MonitorEvent'], '"'+name+'"'); + } + + return core[name].data; +} + core.UIObjects.Get = async (args, env) => { //garbageCollect(); //const list = Object.values(ObjectHashMap); diff --git a/templates/SyncMonitor.wlx b/templates/SyncMonitor.wlx new file mode 100644 index 0000000..e247118 --- /dev/null +++ b/templates/SyncMonitor.wlx @@ -0,0 +1,21 @@ +Component[controller_] := With[{ + UId = CreateUUID[] +}, + +
+

Uploaded 0/0

+ + //will be executed once + const current = document.getElementById('-current'); + + this.on('Sync', async (data) => { + const assoc = await interpretate(data, {hold:true}); + const t = await interpretate(assoc.Total, {}); + const c = (await interpretate(assoc.Current, {})) - 1; + current.innerText = c + '/' + t; + }); + +
+] + +Component \ No newline at end of file From d8620852decec4ff6a62c8137415176e223c3580 Mon Sep 17 00:00:00 2001 From: Kirill Vasin Date: Wed, 27 Nov 2024 16:38:59 +0100 Subject: [PATCH 22/26] provided more components of CM6 --- .DS_Store | Bin 10244 -> 8196 bytes dist/kernel.js | 4 ++++ dist/kernel.min.js | 2 +- package-lock.json | 13 +++++++------ package.json | 6 +++--- src/.DS_Store | Bin 0 -> 8196 bytes src/kernel.js | 6 +++++- 7 files changed, 20 insertions(+), 11 deletions(-) create mode 100644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p!K-irPQocT17E{A_z8Z2OYkRLhAZ$F=HnbJKm`ji zfQzsU7vl=7!7$ci1GZorwqpl&;vS5miW>H#g-IO7gLnv^#3T4LK7-HV^LPwj!`Ja$ z{0KkBPw-Rx9M9snIEFvs@AwB^!Ye|)FhiIr6bOn?B+L_*3Kc>~s1r5_oA}y=)N$CG z*2QfIJp`tTDDSuz-k3O|N;f^QY4etrX&X`J=JFVte``sQ1y=3)`m_&nr%m~3ruVxp zpA{so%e%gjAX^TqBZy76f4?6k%gu*i&HO=?+__glo`BRA>SoZlqfTK zx3aWKR8ESD;CAKe($x}0pOQDWXklQ%8VWxJDe~B~@;doGiQ-Vn=iM?nEJ+G*F^#3o zBE^y-US}u&63)W+Z~-oolV8O=6tM(@xD2bX7B}EVa_dHH#_iaO50Y~;*WQc!FoH2O zFi!40hzT6QNAWRy9G}Q=@fYw#dv1^#Hv=@22;t<@T%KAFtgvq$nu8lcX76a$@nhk@JY}P z%}@_bu#I39y~ow;nFN*9^qleLYw`jK=_QpmzblHithis.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 a(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}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 l(n,o,i,r);n=o+1,i++}}decompose(t,i,r,o){let a=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(a.text,t.text.slice(),0,a.length);if(i.length<=32)r.push(new e(i,t.length+a.length));else{let t=i.length>>1;r.push(new e(i.slice(0,t)),new e(i.slice(t)))}}else r.push(a)}replace(t,r,o){if(!(o instanceof e))return super.replace(t,r,o);let a=n(this.text,n(o.text,s(this.text,0,t)),r),l=this.length+o.length-(r-t);return a.length<=32?new e(a,l):i.from(e.split(a,[]),l)}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=a+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,a=i+r.lines-1;if((e?a:o)>=t)return r.lineInner(t,e,i,n);n=o+1,i=a+1}}decompose(t,e,i,n){for(let s=0,r=0;r<=e&&s=r){let s=n&((r<=t?1:0)|(a>=e?2:0));r>=t&&a<=e&&!s?i.push(o):o.decompose(t-r,e-r,i,s)}r=a+1}}replace(t,e,n){if(n.lines=r&&e<=a){let l=o.replace(t-r,e-r,n),h=this.lines-o.lines+l.lines;if(l.lines>4&&l.lines>h>>6){let r=this.children.slice();return r[s]=l,new i(r,this.length-(e-t)+n.length)}return super.replace(r,a,l)}r=a+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=a+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,a]=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==a)return n;let i=this.children[s],l=t.children[r];if(i!=l)return n+i.scanIdentical(l,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,a=r>>1,l=[],h=0,c=-1,u=[];function d(t){let n;if(t.lines>o&&t instanceof i)for(let e of t.children)d(e);else t.lines>a&&(h>a||!h)?(f(),l.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&&f(),h+=t.lines,c+=t.length+1,u.push(t))}function f(){0!=h&&(l.push(1==u.length?u[0]:i.from(u,c)),c=-1,h=u.length=0)}for(let e of t)d(e);return f(),1==l.length?l[0]:new i(l,n)}}function n(t,e,i=0,n=1e9){for(let s=0,r=0,o=!0;r=i&&(l>n&&(a=a.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,a=s instanceof e?s.text.length:s.children.length;if(o==(i>0?a: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 a{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]=a.prototype[Symbol.iterator]=function(){return this});let l=class{constructor(t,e,i,n){this.from=t,this.to=e,this.number=i,this.text=n}get length(){return this.to-this.from}},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 d=8205;function f(t,e,i=!0,n=!0){return(i?p:O)(t,e,n)}function p(t,e,i){if(e==t.length)return e;e&&g(t.charCodeAt(e))&&m(t.charCodeAt(e-1))&&e--;let n=b(t,e);for(e+=v(n);e=0&&u(b(t,n));)i++,n-=2;if(i%2==0)break;e+=2}}}return e}function O(t,e,i){for(;e>0;){let n=p(t,e-2,i);if(n=56320&&t<57344}function m(t){return t>=55296&&t<56320}function b(t,e){let i=t.charCodeAt(e);if(!m(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return g(n)?n-56320+(i-55296<<10)+65536:i}function w(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function v(t){return t<65536?1:2}const y=/\r\n?|\n/;var S=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(S||(S={}));class x{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;et)return s+(t-n);s+=o}else{if(i!=S.Simple&&l>=t&&(i==S.TrackDel&&nt||i==S.TrackBefore&&nt))return null;if(l>t||l==t&&e<0&&!o)return t==n||e<0?s:s+a;s+=a}n=l}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 x(t)}static create(t){return new x(t)}}class k extends x{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 P(this,((e,i,n,s,r)=>t=t.replace(n,n+(i-e),r)),!1),t}mapDesc(t,e=!1){return C(this,t,e,!0)}invert(e){let i=this.sections.slice(),n=[];for(let s=0,r=0;s=0){i[s]=a,i[s+1]=o;let l=s>>1;for(;n.length0&&$(i,e,s.text),s.forward(t),o+=t}let l=t[r++];for(;o>1].toJSON()))}return t}static of(e,i,n){let s=[],r=[],o=0,a=null;function l(t=!1){if(!t&&!s.length)return;oa||e<0||a>i)throw new RangeError(`Invalid change range ${e} to ${a} (in doc of length ${i})`);let u=c?"string"==typeof c?t.of(c.split(n||y)):c:t.empty,d=u.length;if(e==a&&0==d)return;eo&&Q(s,e-o,-1),Q(s,a-e,d),$(r,s,u),o=a}}(e),l(!a),a}static empty(t){return new k(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 $(e,i,n){if(0==n.length)return;let s=i.length-2>>1;if(s>1])),!(n||a==e.sections.length||e.sections[a+1]<0);)l=e.sections[a++],h=e.sections[a++];i(r,c,o,u,d),r=c,o=u}}}function C(t,e,i,n=!1){let s=[],r=n?[]:null,o=new X(t),a=new X(e);for(let t=-1;;)if(-1==o.ins&&-1==a.ins){let t=Math.min(o.len,a.len);Q(s,t,-1),o.forward(t),a.forward(t)}else if(a.ins>=0&&(o.ins<0||t==o.i||0==o.off&&(a.len=0&&t=0)){if(o.done&&a.done)return r?k.createSet(s,r):x.create(s);throw new Error("Mismatched change set lengths")}{let e=0,i=o.len;for(;i;)if(-1==a.ins){let t=Math.min(i,a.len);e+=t,i-=t,a.forward(t)}else{if(!(0==a.ins&&a.lene||o.ins>=0&&o.len>e)&&(t||n.length>i),r.forward2(e),o.forward(e)}}else Q(n,0,o.ins,t),s&&$(s,n,o.text),o.next()}}class X{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 Z{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 Z(i,n,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return A.range(t,e);let i=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return A.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 A.range(t.anchor,t.head)}static create(t,e,i){return new Z(t,e,i)}}class A{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:A.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 A(t.ranges.map((t=>Z.fromJSON(t))),t.main)}static single(t,e=t){return new A([A.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?A.range(o,r):A.range(r,o))}}return new A(t,e)}}function T(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let R=0;class E{constructor(t,e,i,n,s){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=n,this.id=R++,this.default=t([]),this.extensions="function"==typeof s?s(this):s}static define(t={}){return new E(t.combine||(t=>t),t.compareInput||((t,e)=>t===e),t.compare||(t.combine?(t,e)=>t===e:V),!!t.static,t.enables)}of(t){return new M([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,2,e)}from(t,e){return e||(e=t=>t),this.compute([t],(i=>e(i.field(t))))}}function V(t,e){return t==e||t.length==e.length&&t.every(((t,i)=>t===e[i]))}class M{constructor(t,e,i,n){this.dependencies=t,this.facet=e,this.type=i,this.value=n,this.id=R++}dynamicSlot(t){var e;let i=this.value,n=this.facet.compareInput,s=this.id,r=t[s]>>1,o=2==this.type,a=!1,l=!1,h=[];for(let i of this.dependencies)"doc"==i?a=!0:"selection"==i?l=!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(a&&e.docChanged||l&&(e.docChanged||e.selection)||W(t,h)){let e=i(t);if(o?!D(e,t.values[r],n):!n(e,t.values[r]))return t.values[r]=e,1}return 0},reconfigure:(t,e)=>{let a,l=e.config.address[s];if(null!=l){let s=tt(e,l);if(this.dependencies.every((i=>i instanceof E?e.facet(i)===t.facet(i):!(i instanceof q)||e.field(i,!1)==t.field(i,!1)))||(o?D(a=i(t),s,n):n(a=i(t),s)))return t.values[r]=s,0}else a=i(t);return t.values[r]=a,1}}}}function D(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 a(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(Y).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,Y.of({field:this,create:t})]}get extension(){return this}}const L=4,z=3,I=2,B=1;function j(t){return e=>new G(e,t)}const N={highest:j(0),high:j(B),default:j(I),low:j(z),lowest:j(L)};class G{constructor(t,e){this.inner=t,this.prec=e}}class F{of(t){return new H(this,t)}reconfigure(t){return F.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class H{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;function r(t,o){let a=s.get(t);if(null!=a){if(a<=o)return;let e=n[a].indexOf(t);e>-1&&n[a].splice(e,1),t instanceof H&&i.delete(t.compartment)}if(s.set(t,o),Array.isArray(t))for(let e of t)r(e,o);else if(t instanceof H){if(i.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");let n=e.get(t.compartment)||t.inner;i.set(t.compartment,n),r(n,o)}else if(t instanceof G)r(t.inner,t.prec);else if(t instanceof q)n[o].push(t),t.provides&&r(t.provides,o);else if(t instanceof M)n[o].push(t),t.facet.extensions&&r(t.facet.extensions,I);else{let e=t.extension;if(!e)throw new Error(`Unrecognized extension value in extension set (${t}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(e,o)}}return r(t,I),n.reduce(((t,e)=>t.concat(e)))}(t,e,r))i instanceof q?n.push(i):(s[i.facet.id]||(s[i.facet.id]=[])).push(i);let o=Object.create(null),a=[],l=[];for(let t of n)o[t.id]=l.length<<1,l.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]=a.length<<1|1,V(r,e))a.push(i.facet(n));else{let t=n.combine(e.map((t=>t.value)));a.push(i&&n.compare(t,i.facet(n))?i.facet(n):t)}else{for(let t of e)0==t.type?(o[t.id]=a.length<<1|1,a.push(t.value)):(o[t.id]=l.length<<1,l.push((e=>t.dynamicSlot(e))));o[n.id]=l.length<<1,l.push((t=>U(t,n,e)))}}let c=l.map((t=>t(o)));return new J(t,r,c,o,a,s)}}function K(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 tt(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}const et=E.define(),it=E.define({combine:t=>t.some((t=>t)),static:!0}),nt=E.define({combine:t=>t.length?t[0]:void 0,static:!0}),st=E.define(),rt=E.define(),ot=E.define(),at=E.define({combine:t=>!!t.length&&t[0]});class lt{constructor(t,e){this.type=t,this.value=e}static define(){return new ht}}class ht{of(t){return new lt(this,t)}}class ct{constructor(t){this.map=t}of(t){return new ut(this,t)}}class ut{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 ut(this.type,e)}is(t){return this.type==t}static define(t={}){return new ct(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}}ut.reconfigure=ut.define(),ut.appendConfig=ut.define();class dt{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&&T(i,e.newLength),s.some((t=>t.type==dt.time))||(this.annotations=s.concat(dt.time.of(Date.now())))}static create(t,e,i,n,s,r){return new dt(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(dt.userEvent);return!(!e||!(e==t||e.length>t.length&&e.slice(0,t.length)==t&&"."==e[t.length]))}}function ft(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=pt(n,Ot(e,r,t.changes.newLength),!0))}return n==t?t:dt.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(st)){let e=n(t);if(!1===e){i=!1;break}Array.isArray(e)&&(i=!0===i?e:ft(i,e))}if(!0!==i){let n,s;if(!1===i)s=t.changes.invertedDesc,n=k.empty(e.doc.length);else{let e=t.changes.filter(i);n=e.changes,s=e.filtered.mapDesc(e.changes).invertedDesc}t=dt.create(e,n,t.selection&&t.selection.map(s),ut.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let n=e.facet(rt);for(let i=n.length-1;i>=0;i--){let s=n[i](t);t=s instanceof dt?s:Array.isArray(s)&&1==s.length&&s[0]instanceof dt?s[0]:gt(e,bt(s),!1)}return t}(s):s)}dt.time=lt.define(),dt.userEvent=lt.define(),dt.addToHistory=lt.define(),dt.remote=lt.define();const mt=[];function bt(t){return null==t?mt:Array.isArray(t)?t:[t]}var wt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(wt||(wt={}));const vt=/[\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){}function St(t){return e=>{if(!/\S/.test(e))return wt.Space;if(function(t){if(yt)return yt.test(t);for(let e=0;e"€"&&(i.toUpperCase()!=i.toLowerCase()||vt.test(i)))return!0}return!1}(e))return wt.Word;for(let i=0;i-1)return wt.Word;return wt.Other}}class xt{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(ut.reconfigure)?(i=null,n=e.value):e.is(ut.appendConfig)&&(i=null,n=bt(n).concat(e.value));if(i)e=t.startState.values.slice();else{i=J.resolve(n,s,this),e=new xt(i,this.doc,this.selection,i.dynamicSlots.map((()=>null)),((t,e)=>e.reconfigure(t,this)),null).values}new xt(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:A.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=bt(i.effects);for(let i=1;is.spec.fromJSON(r,t))))}return xt.create({doc:t.doc,selection:A.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(xt.lineSeparator)||y)),s=e.selection?e.selection instanceof A?e.selection:A.single(e.selection.anchor,e.selection.head):A.single(0);return T(s,n.length),i.staticFacet(it)||(s=s.asSingle()),new xt(i,n,s,i.dynamicSlots.map((()=>null)),((t,e)=>e.create(t)),null)}get tabSize(){return this.facet(xt.tabSize)}get lineBreak(){return this.facet(xt.lineSeparator)||"\n"}get readOnly(){return this.facet(at)}phrase(t,...e){for(let e of this.facet(xt.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(et))for(let r of s(this,e,i))Object.prototype.hasOwnProperty.call(r,t)&&n.push(r[t]);return n}charCategorizer(t){return St(this.languageDataAt("wordChars",t).join(""))}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=f(e,r,!1);if(s(e.slice(t,r))!=wt.Word)break;r=t}for(;ot.length?t[0]:4}),xt.lineSeparator=nt,xt.readOnly=at,xt.phrases=E.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]))}}),xt.languageData=et,xt.changeFilter=st,xt.transactionFilter=rt,xt.transactionExtender=ot,F.reconfigure=ut.define();class Qt{eq(t){return this==t}range(t,e=t){return $t.create(t,e,this)}}Qt.prototype.startSide=Qt.prototype.endSide=0,Qt.prototype.point=!1,Qt.prototype.mapMode=S.TrackDel;let $t=class t{constructor(t,e,i){this.from=t,this.to=e,this.value=i}static create(e,i,n){return new t(e,i,n)}};function Pt(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Ct{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,a=s[n]-t||(i?this.value[n].endSide:this.value[n].startSide)-e;if(n==r)return a>=0?r:o;a>=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||l==h&&c.startSide>0&&c.endSide<=0)continue;(h-l||c.endSide-c.startSide)<0||(r<0&&(r=l),c.point&&(o=Math.max(o,h-l)),i.push(c),n.push(l-r),s.push(h-r))}return{mapped:i.length?new Ct(n,s,i,o):null,pos:r}}}class _t{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 _t(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(Pt)),this.isEmpty)return e.length?_t.of(e):this;let o=new At(this,null,-1).goto(0),a=0,l=[],h=new Xt;for(;o.value||a=0){let t=e[a++];h.addInner(t.from,t.to,t.value)||l.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 Tt.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return Tt.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)),a=Zt(r,o,i),l=new Et(r,a,s),h=new Et(o,a,s);i.iterGaps(((t,e,i)=>Vt(l,t,h,e,i,n))),i.empty&&0==i.length&&Vt(l,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=Zt(s,r),a=new Et(s,o,0).goto(i),l=new Et(r,o,0).goto(i);for(;;){if(a.to!=l.to||!Mt(a.active,l.active)||a.point&&(!l.point||!a.point.eq(l.point)))return!1;if(a.to>n)return!0;a.next(),l.next()}}static spans(t,e,i,n,s=-1){let r=new Et(t,null,s).goto(e),o=e,a=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,a),a=r.openEnd(t));if(r.to>i)return a+(r.point&&r.to>i?1:0);o=r.to,r.next()}}static of(t,e=!1){let i=new Xt;for(let n of t instanceof $t?[t]:e?function(t){if(t.length>1)for(let e=t[0],i=1;i0)return t.slice().sort(Pt);e=n}return t}(t):t)i.add(n.from,n.to,n.value);return i.finish()}}_t.empty=new _t([],[],null,-1),_t.empty.nextLayer=_t.empty;class Xt{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}finishChunk(t){this.chunks.push(new Ct(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=[])}add(t,e,i){this.addInner(t,e,i)||(this.nextLayer||(this.nextLayer=new Xt)).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(_t.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;let e=_t.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function Zt(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 At(r,e,i,s));return 1==n.length?n[0]:new Tt(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--)Rt(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--)Rt(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(),Rt(this.heap,0)}}}function Rt(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 Et{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=Tt.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){Dt(this.active,t),Dt(this.activeTo,t),Dt(this.activeRank,t),this.minActive=Ut(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&&Dt(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 Vt(t,e,i,n,s,r){t.goto(e),i.goto(n);let o=n+s,a=n,l=n-e;for(;;){let e=t.to+l-i.to||t.endSide-i.endSide,n=e<0?t.to+l: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))&&Mt(t.activeForPoint(t.to+l),i.activeForPoint(i.to))||r.comparePoint(a,s,t.point,i.point):s>a&&!Mt(t.active,i.active)&&r.compareRange(a,s,t.active,i.active),n>o)break;a=n,e<=0&&t.next(),e>=0&&i.next()}}function Mt(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 Ut(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(!l)throw new RangeError("The value of a property ("+i+") should be a primitive value.");s(n(i),o,a,h)}else null!=o&&a.push(i.replace(/_.*/,"").replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))+": "+o+";")}(a.length||h)&&r.push((!i||l||o?t:t.map(i)).join(", ")+" {"+a.join(" ")+"}")}for(let e in t)s(n(e),t[e],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let t=zt[qt]||1;return zt[qt]=t+1,"ͼ"+t.toString(36)}static mount(t,e){(t[Lt]||new jt(t)).mount(Array.isArray(e)?e:[e])}}let Bt=new Map;class jt{constructor(t){let e=t.ownerDocument||t,i=e.defaultView;if(!t.head&&t.adoptedStyleSheets&&i.CSSStyleSheet){let n=Bt.get(e);if(n)return t.adoptedStyleSheets=[n.sheet,...t.adoptedStyleSheets],t[Lt]=n;this.sheet=new i.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets],Bt.set(e,this)}else{this.styleTag=e.createElement("style");let i=t.head||t;i.insertBefore(this.styleTag,i.firstChild)}this.modules=[],t[Lt]=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:'"'},Ft="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),Ht="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Jt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Kt=Ht||Ft&&+Ft[1]<57,te=0;te<10;te++)Nt[48+te]=Nt[96+te]=String(te);for(te=1;te<=24;te++)Nt[te+111]="F"+te;for(te=65;te<=90;te++)Nt[te]=String.fromCharCode(te+32),Gt[te]=String.fromCharCode(te);for(var ee in Nt)Gt.hasOwnProperty(ee)||(Gt[ee]=Nt[ee]);function ie(t){let e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection()}function ne(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function se(t,e){if(!e.anchorNode)return!1;try{return ne(t,e.anchorNode)}catch(t){return!1}}function re(t){return 3==t.nodeType?me(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function oe(t,e,i,n){return!!i&&(le(t,e,i,n,-1)||le(t,e,i,n,1))}function ae(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function le(t,e,i,n,s){for(;;){if(t==i&&e==n)return!0;if(e==(s<0?0:he(t))){if("DIV"==t.nodeName)return!1;let i=t.parentNode;if(!i||1!=i.nodeType)return!1;e=ae(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?he(t):0}}}function he(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}const ce={left:0,right:0,top:0,bottom:0};function ue(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function de(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}class fe{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){this.set(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset)}set(t,e,i,n){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=n}}let pe,Oe=null;function ge(t){if(t.setActive)return t.setActive();if(Oe)return t.focus(Oe);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==Oe?{get preventScroll(){return Oe={preventScroll:!0},!0}}:void 0),!Oe){Oe=!1;for(let t=0;te)return i.domBoundsAround(t,e,l);if(c>=t&&-1==n&&(n=a,s=l),l>e&&i.dom.parentNode==this.dom){r=a,o=h;break}h=c,l=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.dirty|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.dirty|=2),1&e.dirty)return;e.dirty|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,this.dirty&&this.markParentsDirty(!0))}setDOM(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=ye){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 Qe(t,e,i,n,s,r,o,a,l){let{children:h}=t,c=h.length?h[e]:null,u=r.length?r[r.length-1]:null,d=u?u.breakAfter:o;if(!(e==n&&c&&!o&&!d&&r.length<2&&c.merge(i,s,r.length?u:null,0==i,a,l))){if(n0&&(!o&&r.length&&c.merge(i,c.length,r[0],!1,a,0)?c.breakAfter=r.shift().breakAfter:(i2);var De={mac:Me||/Mac/.test(Pe.platform),windows:/Win/.test(Pe.platform),linux:/Linux|X11/.test(Pe.platform),ie:Ae,ie_version:Xe?Ce.documentMode||6:Ze?+Ze[1]:_e?+_e[1]:0,gecko:Te,gecko_version:Te?+(/Firefox\/(\d+)/.exec(Pe.userAgent)||[0,0])[1]:0,chrome:!!Re,chrome_version:Re?+Re[1]:0,ios:Me,android:/Android\b/.test(Pe.userAgent),webkit:Ee,safari:Ve,webkit_version:Ee?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Ce.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class We extends Se{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(!i||i instanceof We&&!(this.length-(e-t)+i.length>256))&&(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),!0)}split(t){let e=new We(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new ve(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 Ye(this.dom,t,e)}}class Ue extends Se{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(we(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}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.dirty|=6)}sync(t,e){this.dom?4&this.dirty&&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 Ue&&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 Ue(this.mark,e,r)}domAtPos(t){return Ge(this,t)}coordsAt(t,e){return He(this,t,e)}}function Ye(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?De.chrome||De.gecko||(e?(s--,o=1):r=0)?0:a.length-1];return De.safari&&!o&&0==l.width&&(l=Array.prototype.find.call(a,(t=>t.width))||l),o?ue(l,o<0):l||null}class qe extends Se{constructor(t,e,i){super(),this.widget=t,this.length=e,this.side=i,this.prevWidget=null}static create(t,e,i){return new(t.customView||qe)(t,e,i)}split(t){let e=qe.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 qe&&this.widget.compare(i.widget))||t>0&&s<=0||e0)?ve.before(this.dom):ve.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let i=this.dom.getClientRects(),n=null;if(!i.length)return ce;for(let e=t>0?i.length-1:0;n=i[e],!(t>0?0==e:e==i.length-1||n.top0?-1:1);return this.length?n:ue(n,this.side>0)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class Le extends qe{domAtPos(t){let{topView:e,text:i}=this.widget;return e?ze(t,0,e,i,this.length-e.length,((t,e)=>t.domAtPos(e)),((t,e)=>new ve(t,Math.min(e,t.nodeValue.length)))):new ve(i,Math.min(t,i.nodeValue.length))}sync(){this.setDOM(this.widget.toDOM())}localPosFromDOM(t,e){let{topView:i,text:n}=this.widget;return i?Be(t,e,i,n,this.length-i.length):Math.min(e,this.length)}ignoreMutation(){return!1}get overrideDOMText(){return null}coordsAt(t,e){let{topView:i,text:n}=this.widget;return i?ze(t,e,i,n,this.length-i.length,((t,e,i)=>t.coordsAt(e,i)),((t,e,i)=>Ye(t,e,i))):Ye(n,t,e)}destroy(){var t;super.destroy(),null===(t=this.widget.topView)||void 0===t||t.destroy()}get isEditable(){return!0}canReuseDOM(){return!0}}function ze(t,e,i,n,s,r,o){if(i instanceof Ue){for(let a=i.dom.firstChild;a;a=a.nextSibling){let i=Se.get(a);if(i){let l=ne(a,n),h=i.length+(l?s:0);if(t0?ve.before(this.dom):ve.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){let e=this.dom.getBoundingClientRect(),i=function(t,e){let i=t.parent,n=i?i.children.indexOf(t):-1;for(;i&&n>=0;)if(e<0?n>0:n0?-1:1);return i&&i.tope.top?{left:e.left,right:e.right,top:i.top,bottom:i.bottom}:e}get overrideDOMText(){return t.empty}get isHidden(){return!0}}function Ge(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 Ue&&s.length&&(n=s[s.length-1])instanceof Ue&&n.mark.eq(e.mark)?Fe(n,e.children[0],i-1):(s.push(e),e.setParent(t)),t.length+=e.length}function He(t,e,i){let n=null,s=-1,r=null,o=-1;!function t(e,a){for(let l=0,h=0;l=a&&(c.children.length?t(c,a-h):(!r||r instanceof Ne&&i>0)&&(u>a||h==u&&c.getSide()>0)?(r=c,o=a-h):(h0?3e8:-4e8:e>0?1e8:-1e8,new oi(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}=ai(t,n);e=(s?n?-3e8:-1:5e8)-1,i=1+(r?n?2e8:1:-6e8)}return new oi(t,e,i,n,t.widget||null,!0)}static line(t){return new ri(t)}static set(t,e=!1){return _t.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}ni.none=_t.empty;class si extends ni{constructor(t){let{start:e,end:i}=ai(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){return this==t||t instanceof si&&this.tagName==t.tagName&&this.class==t.class&&Ke(this.attrs,t.attrs)}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}si.prototype.point=!1;class ri extends ni{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof ri&&this.spec.class==t.spec.class&&Ke(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)}}ri.prototype.mapMode=S.TrackBefore,ri.prototype.point=!0;class oi extends ni{constructor(t,e,i,n,s,r){super(e,i,s,t),this.block=n,this.isReplace=r,this.mapMode=n?e<=0?S.TrackBefore:S.TrackAfter:S.TrackDel}get type(){return this.startSide=5}eq(t){return t instanceof oi&&(e=this.widget,i=t.widget,e==i||!!(e&&i&&e.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var e,i}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 ai(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 li(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)}oi.prototype.point=!0;class hi extends Se{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 hi))return!1;this.dom||i.transferDOM(this)}return n&&this.setDeco(i?i.attrs:null),$e(this,t,e,i?i.children:[],s,r),!0}split(t){let e=new hi;if(e.breakAfter=this.breakAfter,0==this.length)return e;let{i: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){Ke(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){Fe(this,t,e)}addLineDeco(t){let e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=Je(e,this.attrs||{})),i&&(this.attrs=Je({class:i},this.attrs||{}))}domAtPos(t){return Ge(this,t)}reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.dirty|=6)}sync(t,e){var i;this.dom?4&this.dirty&&(we(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&&(ti(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&&Se.get(n)instanceof Ue;)n=n.lastChild;if(!(n&&this.length&&("BR"==n.nodeName||0!=(null===(i=Se.get(n))||void 0===i?void 0:i.isEditable)||De.ios&&this.children.some((t=>t instanceof We))))){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 We)||/[^ -~]/.test(i.text))return null;let n=re(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=He(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 hi)return s;if(r>e)break}n=r+s.breakAfter}return null}}class ci extends Se{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 ci&&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(di(new We(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 oi){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let o=e-t;if(i instanceof oi)if(i.block){let{type:t}=i;t!=ii.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new ci(i.widget||new fi("div"),o,t))}else{let r=qe.create(i.widget||new fi("span"),o,o?0:i.startSide),a=this.atCursorPos&&!r.isEditable&&s<=n.length&&(t0),l=!r.isEditable&&(tn.length||i.startSide<=0),h=this.getLine();2!=this.pendingBuffer||a||r.isEditable||(this.pendingBuffer=0),this.flushBuffer(n),a&&(h.append(di(new Ne(1),n),s),s=n.length+Math.max(0,s-n.length)),h.append(di(r,n),s),this.atCursorPos=l,this.pendingBuffer=l?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 ui(t,e,i,s);return r.openEnd=_t.spans(n,e,i,r),r.openStart<0&&(r.openStart=r.openEnd),r.finish(r.openEnd),r}}function di(t,e){for(let i of e)t=new Ue(i,[t],t.length);return t}class fi extends ei{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 pi=E.define(),Oi=E.define(),gi=E.define(),mi=E.define(),bi=E.define(),wi=E.define(),vi=E.define(),yi=E.define({combine:t=>t.some((t=>t))}),Si=E.define({combine:t=>t.some((t=>t))});class xi{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 xi(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin)}}const ki=ut.define({map:(t,e)=>t.map(e)});function Qi(t,e,i){let n=t.facet(mi);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 $i=E.define({combine:t=>!t.length||t[0]});let Pi=0;const Ci=E.define();class _i{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 _i(Pi++,t,i,(t=>{let e=[Ci.of(t)];return s&&e.push(Ti.of((e=>{let i=e.plugin(t);return i?s(i):ni.none}))),n&&e.push(n(t)),e}))}static fromClass(t,e){return _i.define((e=>new t(e)),e)}}class Xi{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(Qi(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){Qi(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){Qi(t.state,e,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Zi=E.define(),Ai=E.define(),Ti=E.define(),Ri=E.define(),Ei=E.define(),Vi=E.define();class Mi{constructor(t,e,i,n){this.fromA=t,this.toA=e,this.fromB=i,this.toB=n}join(t){return new Mi(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(!a)return i;new Mi(a.fromA,a.toA,a.fromB,a.toB).addToSet(i),r=a.toA,o=a.toB}}}class Di{constructor(t,e,i){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=k.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 Mi(t,e,i,s)))),this.changedRanges=n}static create(t,e,i){return new Di(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 Wi=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Wi||(Wi={}));const Ui=Wi.LTR,Yi=Wi.RTL;function qi(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}}const Gi=[];function Fi(t){return[new Ni(0,t,0)]}let Hi="";function Ji(t,e,i,n,s){var r;let o=n.head-t.from,a=-1;if(0==o){if(!s||!t.length)return null;e[0].level!=i&&(o=e[0].side(!1,i),a=0)}else if(o==t.length){if(s)return null;let t=e[e.length-1];t.level!=i&&(o=t.side(!0,i),a=e.length-1)}a<0&&(a=Ni.find(e,o,null!==(r=n.bidiLevel)&&void 0!==r?r:-1,n.assoc));let l=e[a];o==l.side(s,i)&&(l=e[a+=s?1:-1],o=l.side(!s,i));let h=s==(l.dir==i),c=f(t.text,o,h);if(Hi=t.text.slice(Math.min(o,c),Math.max(o,c)),c!=l.side(s,i))return A.cursor(c+t.from,h?-1:1,l.level);let u=a==(s?e.length-1:0)?null:e[a+(s?1:-1)];return u||l.level==i?u&&u.level1)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=Se.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 en(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}class nn{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class sn extends Se{constructor(t){super(),this.view=t,this.compositionDeco=ni.none,this.decorations=[],this.dynamicDecorationMap=[],this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(t.contentDOM),this.children=[new hi],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Mi(0,0,0,t.state.doc.length)],0)}get length(){return this.view.state.doc.length}update(t){let e=t.changedRanges;this.minWidth>0&&e.length&&(e.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),this.view.inputState.composing<0?this.compositionDeco=ni.none:(t.transactions.length||this.dirty)&&(this.compositionDeco=function(t,e){let i=on(t);if(!i)return ni.none;let{from:n,to:s,node:r,text:o}=i,a=e.mapPos(n,1),l=Math.max(a,e.mapPos(s,-1)),{state:h}=t,c=3==r.nodeType?r.nodeValue:new tn([],h).readRange(r.firstChild,null).text;if(l-a{this.dom.style.height=this.view.viewState.contentHeight+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let t=De.chrome||De.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,t),this.dirty=0,t&&(t.written||i.selectionRange.focusNode!=t.node)&&(this.forceSelection=!0),this.dom.style.height=""}));let n=[];if(this.view.viewport.from||this.view.viewport.to=0?t[e]:null;if(!n)break;let{fromA:s,toA:r,fromB:o,toB:a}=n,{content:l,breakAtStart:h,openStart:c,openEnd:u}=ui.build(this.view.state.doc,o,a,this.decorations,this.dynamicDecorationMap),{i:d,off:f}=i.findPos(r,1),{i:p,off:O}=i.findPos(s,-1);Qe(this,p,O,d,f,l,h,c,u)}}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&&se(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,a=this.domAtPos(o.anchor),l=o.empty?a:this.domAtPos(o.head);if(De.gecko&&o.empty&&!this.compositionDeco.size&&(1==(h=a).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((()=>a.node.insertBefore(t,a.node.childNodes[a.offset]||null))),a=l=new ve(t,0),r=!0}var h;let c=this.view.observer.selectionRange;!r&&c.focusNode&&oe(a.node,a.offset,c.anchorNode,c.anchorOffset)&&oe(l.node,l.offset,c.focusNode,c.focusOffset)||(this.view.observer.ignore((()=>{De.android&&De.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=ie(this.view.root);if(t)if(o.empty){if(De.gecko){let t=(e=a.node,n=a.offset,1!=e.nodeType?0:(n&&"false"==e.childNodes[n-1].contentEditable?1:0)|(no.head&&([a,l]=[l,a]),e.setEnd(l.node,l.offset),e.setStart(a.node,a.offset),t.removeAllRanges(),t.addRange(e)}else;var e,n;s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())})),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new ve(c.anchorNode,c.anchorOffset),this.impreciseHead=l.precise?null:new ve(c.focusNode,c.focusOffset)}enforceCursorAssoc(){if(this.compositionDeco.size)return;let{view:t}=this,e=t.state.selection.main,i=ie(t.root),{anchorNode:n,anchorOffset:s}=t.observer.selectionRange;if(!(i&&e.empty&&e.assoc&&i.modify))return;let r=hi.find(this,e.head);if(!r)return;let o=r.posAtStart;if(e.head==o||e.head==o+r.length)return;let a=this.coordsAt(e.head,-1),l=this.coordsAt(e.head,1);if(!a||!l||a.bottom>l.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)}nearest(t){for(let e=t;e;){let t=Se.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!=ii.WidgetBefore&&s.type!=ii.WidgetAfter&&(!n||2==e||this.children[n-1].breakAfter||this.children[n-1].type==ii.WidgetBefore&&e>-2))return s.coordsAt(t-r,e);i=r}}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,a=this.view.textDirection==Wi.LTR;for(let t=0,l=0;ln)break;if(t>=i){let i=h.dom.getBoundingClientRect();if(e.push(i.height),r){let e=h.dom.lastChild,n=e?re(e):[];if(n.length){let e=n[n.length-1],r=a?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?Wi.RTL:Wi.LTR}measureTextSize(){for(let t of this.children)if(t instanceof hi){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.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(n);let s=re(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 ke(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;t.push(ni.replace({widget:new rn(n),block:!0,inclusive:!0,isBlockGap:!0}).range(i,r))}if(!s)break;i=s.to+1}return ni.set(t)}updateDeco(){let t=this.view.state.facet(Ti).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=0,r=0,o=0,a=0;for(let t of this.view.state.facet(Ei).map((t=>t(this.view))))if(t){let{left:e,right:i,top:n,bottom:l}=t;null!=e&&(s=Math.max(s,e)),null!=i&&(r=Math.max(r,i)),null!=n&&(o=Math.max(o,n)),null!=l&&(a=Math.max(a,l))}let l={left:n.left-s,top:n.top-o,right:n.right+r,bottom:n.bottom+a};!function(t,e,i,n,s,r,o,a){let l=t.ownerDocument,h=l.defaultView||window;for(let c=t;c;)if(1==c.nodeType){let t,u=c==l.body;if(u)t=de(h);else{if(c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let e=c.getBoundingClientRect();t={left:e.left,right:e.left+c.clientWidth,top:e.top,bottom:e.top+c.clientHeight}}let d=0,f=0;if("nearest"==s)e.top0&&e.bottom>t.bottom+f&&(f=e.bottom-t.bottom+f+o)):e.bottom>t.bottom&&(f=e.bottom-t.bottom+o,i<0&&e.top-f0&&e.right>t.right+d&&(d=e.right-t.right+d+r)):e.right>t.right&&(d=e.right-t.right+r,i<0&&e.left0))break;i=i.childNodes[n-1],n=he(i)}if(i>=0)for(let n=t,s=e;;){if(3==n.nodeType)return n;if(!(1==n.nodeType&&s=0))break;n=n.childNodes[s],s=0}return null}class hn{constructor(){this.changes=[]}compareRange(t,e){li(t,e,this.changes)}comparePoint(t,e){li(t,e,this.changes)}}function cn(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function un(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function dn(t,e){return t.tope.top+1}function fn(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,a,l,h,c,u=!1;for(let d=t.firstChild;d;d=d.nextSibling){let t=re(d);for(let f=0;fg||o==g&&r>O){n=d,s=p,r=O,o=g;let a=g?i0?f0)}0==O?i>p.bottom&&(!h||h.bottomp.top)&&(l=d,c=p):h&&dn(h,p)?h=pn(h,p.bottom):c&&dn(c,p)&&(c=fn(c,p.top))}}if(h&&h.bottom>=i?(n=a,s=h):c&&c.top<=i&&(n=l,s=c),!n)return{node:t,offset:0};let d=Math.max(s.left,Math.min(s.right,e));return 3==n.nodeType?gn(n,d,i):u&&"false"!=n.contentEditable?On(n,d,i):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,n)+(e>=(s.left+s.right)/2?1:0)}}function gn(t,e,i){let n=t.nodeValue.length,s=-1,r=1e9,o=0;for(let a=0;ai?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(De.chrome||De.gecko){me(t,a).getBoundingClientRect().left==h.right&&(n=!i)}if(c<=0)return{node:t,offset:a+(n?1:0)};s=a+(n?1:0),r=c}}}return{node:t,offset:s>-1?s:o>0?t.nodeValue.length:0}}function mn(t,e,i,n=-1){var s,r;let o,a=t.contentDOM.getBoundingClientRect(),l=a.top+t.viewState.paddingTop,{docHeight:h}=t.viewState,{x:c,y:u}=e,d=u-l;if(d<0)return 0;if(d>h)return t.state.doc.length;for(let e=t.defaultLineHeight/2,s=!1;o=t.elementAtHeight(d),o.type!=ii.Text;)for(;d=n>0?o.bottom+e:o.top-e,!(d>=0&&d<=h);){if(s)return i?null:0;s=!0,n=-n}u=l+d;let f=o.from;if(ft.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:bn(t,a,o,c,u);let p=t.dom.ownerDocument,O=t.root.elementFromPoint?t.root:p,g=O.elementFromPoint(c,u);g&&!t.contentDOM.contains(g)&&(g=null),g||(c=Math.max(a.left+1,Math.min(a.right-1,c)),g=O.elementFromPoint(c,u),g&&!t.contentDOM.contains(g)&&(g=null));let m,b=-1;if(g&&0!=(null===(s=t.docView.nearest(g))||void 0===s?void 0:s.isEditable))if(p.caretPositionFromPoint){let t=p.caretPositionFromPoint(c,u);t&&({offsetNode:m,offset:b}=t)}else if(p.caretRangeFromPoint){let e=p.caretRangeFromPoint(c,u);e&&(({startContainer:m,startOffset:b}=e),(!t.contentDOM.contains(m)||De.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 me(t,n-1,n).getBoundingClientRect().left>i}(m,b,c)||De.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}let n=1==t.nodeType?t.getBoundingClientRect():me(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return i-n.left>5}(m,b,c))&&(m=void 0))}if(!m||!t.docView.dom.contains(m)){let e=hi.find(t.docView,f);if(!e)return d>o.top+o.height/2?o.to:o.from;({node:m,offset:b}=On(e.dom,c,u))}let w=t.docView.nearest(m);if(!w)return null;if(w.isWidget&&1==(null===(r=w.dom)||void 0===r?void 0:r.nodeType)){let t=w.dom.getBoundingClientRect();return e.y1.5*t.defaultLineHeight){r+=Math.floor((s-i.top)/t.defaultLineHeight)*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=f(t,n)}return!0===n?-1:t.length}(o,r,t.state.tabSize)}function wn(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=t.bidiSpans(s),o=t.textDirectionAt(s.from);for(let a=e,l=null;;){let e=Ji(s,r,o,a,i),h=Hi;if(!e){if(s.number==(i?t.state.doc.lines:1))return a;h="\n",s=t.state.doc.line(s.number+(i?1:-1)),r=t.bidiSpans(s),e=A.cursor(i?s.from:s.to)}if(l){if(!l(h))return a}else{if(!n)return e;l=n(h)}a=e}}function vn(t,e,i,n){let s=t.state.facet(Ri).map((e=>e(t)));for(;;){let t=!1;for(let r of s)r.between(i.from-1,i.from+1,((s,r,o)=>{i.from>s&&i.fromi.from?A.cursor(s,1):A.cursor(r,-1),t=!0,o.widget.skipPosition&&(i=o.widget.skipPosition(i,e,n)))}));if(!t)return i}}class yn{constructor(t){this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null;let e=(e,i)=>{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 Cn){let n=Cn[i];t.contentDOM.addEventListener(i,(i=>{Pn(t,i)&&e(n,i)}),_n[i]),this.registeredEvents.push(i)}t.scrollDOM.addEventListener("mousedown",(i=>{if(i.target==t.scrollDOM&&i.clientY>t.contentDOM.getBoundingClientRect().bottom&&(e(Cn.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)}})),De.chrome&&102==De.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,De.safari&&t.contentDOM.addEventListener("input",(()=>null))}setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}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=>{Pn(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){Qi(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){Qi(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||xn.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,be(t.contentDOM,e.key,e.keyCode))}ignoreDuringComposition(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(De.safari&&!De.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 Sn=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],xn="dthko",kn=[16,17,18,20,91,92,224,225];function Qn(t){return.7*Math.max(0,t)+8}class $n{constructor(t,e,i,n){this.view=t,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);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(xt.allowMultipleSelections)&&function(t,e){let i=t.state.facet(pi);return i.length?i[0](e):(De.mac,e.altKey)}(t,e),this.dragMove=function(t,e){let i=t.state.facet(Oi);return i.length?i[0](e):De.mac?!e.altKey:!e.ctrlKey}(t,e),this.dragging=!(!function(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let n=ie(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!=Yn(e))&&null}start(t){!1===this.dragging&&(t.preventDefault(),this.select(t))}move(t){var e;if(0==t.buttons)return this.destroy();if(!1!==this.dragging)return;this.select(this.lastEvent=t);let i=0,n=0,s=(null===(e=this.scrollParent)||void 0===e?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight};t.clientX<=s.left+6?i=-Qn(s.left-t.clientX):t.clientX>=s.right-6&&(i=Qn(t.clientX-s.right)),t.clientY<=s.top+6?n=-Qn(s.top-t.clientY):t.clientY>=s.bottom-6&&(n=Qn(t.clientY-s.bottom)),this.setScrollSpeed(i,n)}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)}select(t){let e=this.style.get(t,this.extend,this.multiple);!this.mustSelect&&e.eq(this.view.state.selection)&&e.main.assoc==this.view.state.selection.main.assoc||this.view.dispatch({selection:e,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.docChanged&&this.dragging&&(this.dragging=this.dragging.map(t.changes)),this.style.update(t)&&setTimeout((()=>this.select(this.lastEvent)),20)}}function Pn(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=Se.get(n))&&i.ignoreEvent(e))return!1;return!0}const Cn=Object.create(null),_n=Object.create(null),Xn=De.ie&&De.ie_version<15||De.ios&&De.webkit_version<604;function Zn(t,e){let i,{state:n}=t,s=1,r=n.toText(e),o=r.lines==n.selection.ranges.length;if(null!=Ln&&n.selection.ranges.every((t=>t.empty))&&Ln==r.toString()){let t=-1;i=n.changeByRange((i=>{let a=n.doc.lineAt(i.from);if(a.from==t)return{range:i};t=a.from;let l=n.toText((o?r.line(s++).text:e)+n.lineBreak);return{changes:{from:a.from,insert:l},range:A.cursor(i.from+l.length)}}))}else i=o?n.changeByRange((t=>{let e=r.line(s++);return{changes:{from:t.from,to:t.to,insert:e.text},range:A.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 A.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 A.cursor(e);0==r?i=1:r==s.length&&(i=-1);let o=r,a=r;i<0?o=f(s.text,r,!1):a=f(s.text,r);let l=n(s.text.slice(o,a));for(;o>0;){let t=f(s.text,o,!1);if(n(s.text.slice(t,o))!=l)break;o=t}for(;a{t.inputState.setSelectionOrigin("select"),27==e.keyCode&&(t.inputState.lastEscPress=Date.now())},Cn.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},Cn.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},_n.touchstart=_n.touchmove={passive:!0},Cn.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return;let i=null;for(let n of t.state.facet(gi))if(i=n(t,e),i)break;if(i||0!=e.button||(i=function(t,e){let i=Vn(t,e),n=Yn(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 a,l=Vn(t,e),h=An(t,l.pos,l.bias,n);if(i.pos!=l.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&&(a=function(t,e){for(let i=0;i=e)return A.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,l.pos))?a:o?s.addRange(h):A.create([h])}}}(t,e)),i){let n=t.root.activeElement!=t.contentDOM;t.inputState.startMouseSelection(new $n(t,e,i,n)),n&&t.observer.ignore((()=>ge(t.contentDOM))),t.inputState.mouseSelection&&t.inputState.mouseSelection.start(e)}};let Tn=(t,e)=>t>=e.top&&t<=e.bottom,Rn=(t,e,i)=>Tn(e,i)&&t>=i.left&&t<=i.right;function En(t,e,i,n){let s=hi.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&&Rn(i,n,o))return-1;let a=s.coordsAt(r,1);return a&&Rn(i,n,a)?1:o&&Tn(n,o)?-1:1}function Vn(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:En(t,i,e.clientX,e.clientY)}}const Mn=De.ie&&De.ie_version<=11;let Dn=null,Wn=0,Un=0;function Yn(t){if(!Mn)return t.detail;let e=Dn,i=Un;return Dn=t,Un=Date.now(),Wn=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Wn+1)%3:1}function qn(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&&r.dragMove?{from:r.dragging.from,to:r.dragging.to}:null,a={from:s,insert:i},l=t.state.changes(o?[o,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(s,-1),head:l.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"})}Cn.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")},Cn.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&&qn(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 qn(t,e,e.dataTransfer.getData("Text"),!0)},Cn.paste=(t,e)=>{if(t.state.readOnly)return e.preventDefault();t.observer.flush();let i=Xn?null:e.clipboardData;i?(Zn(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(),Zn(t,i.value)}),50)}(t)};let Ln=null;Cn.copy=Cn.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;Ln=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 zn=lt.define();function In(t,e){let i=[];for(let n of t.facet(vi)){let s=n(t,e);s&&i.push(s)}return i?t.update({effects:i,annotations:zn.of(!0)}):null}function Bn(t){setTimeout((()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=In(t.state,e);i?t.dispatch(i):t.update([])}}),10)}Cn.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),Bn(t)},Cn.blur=t=>{t.observer.clearSelectionRange(),Bn(t)},Cn.compositionstart=Cn.compositionupdate=t=>{null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},Cn.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,De.chrome&&De.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then((()=>t.observer.flush())):setTimeout((()=>{t.inputState.composing<0&&t.docView.compositionDeco.size&&t.update([])}),50)},Cn.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},Cn.beforeinput=(t,e)=>{var i;let n;if(De.chrome&&De.android&&(n=Sn.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 jn=["pre-wrap","normal","pre-line","break-spaces"];class Nn{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){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return jn.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i-1,a=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,a){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)>Jn&&(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:a,toA:l,fromB:h,toB:c}=n[o],u=s.lineAt(a,Hn.ByPosNoHeight,i.setDoc(e),0,0),d=u.to>=l?u:s.lineAt(l,Hn.ByPosNoHeight,i,0,0);for(c+=d.to-l,l=d.to;o>0&&u.from<=n[o-1].toA;)a=n[o-1].fromA,h=n[o-1].fromB,o--,a2*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 es extends ts{constructor(t,e){super(t,e,ii.Text),this.collapsed=0,this.widgetHeight=0}replace(t,e,i){let n=i[0];return 1==i.length&&(n instanceof es||n instanceof is&&4&n.flags)&&Math.abs(this.length-n.length)<10?(n instanceof is?n=new es(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.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class is 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:a}=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),l=o+r.length*a,h=Math.max(i,t-l/2);return new Fn(r.from,r.length,h,l,ii.Text)}{let n=Math.max(0,Math.min(r-s,Math.floor((t-i)/o))),{from:a,length:l}=e.doc.line(s+n);return new Fn(a,l,i+o*n,o,ii.Text)}}lineAt(t,e,i,n,s){if(e==Hn.ByHeight)return this.blockAt(t,i,n,s);if(e==Hn.ByPosNoHeight){let{from:e,to:n}=i.doc.lineAt(t);return new Fn(e,n-e,0,0,ii.Text)}let{firstLine:r,perLine:o,perChar:a}=this.heightMetrics(i,s),l=i.doc.lineAt(t),h=o+l.length*a,c=l.number-r,u=n+o*c+a*(l.from-s-c);return new Fn(l.from,l.length,Math.max(n,Math.min(u,n+this.height-h)),h,ii.Text)}forEachLine(t,e,i,n,s,r){t=Math.max(t,s),e=Math.min(e,s+this.length);let{firstLine:o,perLine:a,perChar:l}=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+=a*i+l*(t-s-i)}let n=a+l*e.length;r(new Fn(e.from,e.length,c,n,ii.Text)),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 is?i[i.length-1]=new is(t.length+n):i.push(null,new is(n-1))}if(t>0){let e=i[0];e instanceof is?i[0]=new is(t+e.length):i.unshift(new is(t-1),null)}return Kn.of(i)}decomposeLeft(t,e){e.push(new is(t-1),null)}decomposeRight(t,e){e.push(null,new is(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 is(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)>=Jn&&(o=-2);let a=new es(e,s);a.outdated=!1,i.push(a),r+=e+1}r<=s&&i.push(null,new is(s-r).updateHeight(t,r));let a=Kn.of(i);return(o<0||Math.abs(a.height-this.height)>=Jn||Math.abs(o-this.heightMetrics(t,e).perLine)>=Jn)&&(t.heightChanged=!0),a}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class ns 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 l;let h=e==Hn.ByPosNoHeight?Hn.ByPosNoHeight:Hn.ByPos;return a?l.join(this.right.lineAt(o,h,i,r,o)):this.left.lineAt(o,h,i,n,s).join(l)}forEachLine(t,e,i,n,s,r){let o=n+this.left.height,a=s+this.left.length+this.break;if(this.break)t=a&&this.right.forEachLine(t,e,i,o,a,r);else{let l=this.lineAt(a,Hn.ByPos,i,n,s);t=t&&l.from<=e&&r(l),e>l.to&&this.right.forEachLine(l.to+1,e,i,o,a,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&&ss(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,a=null;return n&&n.from<=e+s.length&&n.more?a=s=s.updateHeight(t,e,i,n):s.updateHeight(t,e,i),n&&n.from<=o+r.length&&n.more?a=r=r.updateHeight(t,o,i,n):r.updateHeight(t,o,i),a?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 ss(t,e){let i,n;null==t[e]&&(i=t[e-1])instanceof is&&(n=t[e+1])instanceof is&&t.splice(e-1,3,new is(i.length+1+n.length))}class rs{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 es?i.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new es(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)}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 es(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let i=new is(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 es)return t;let e=new es(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine(),t.type!=ii.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,t.type!=ii.WidgetBefore&&(this.covering=t)}addLineDeco(t,e){let i=this.ensureLine();i.length+=e,i.collapsed+=e,i.widgetHeight=Math.max(i.widgetHeight,t),this.writtenTo=this.pos=this.pos+e}finish(t){let e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof es||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),a=Math.max(a,n.top),l=e==t.parentNode?n.bottom:Math.min(l,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:a-(i.top+e),bottom:Math.max(a,l)-(i.top+e)}}function ls(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class hs{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 Nn(i),this.stateDeco=e.facet(Ti).filter((t=>"function"!=typeof t)),this.heightMap=Kn.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle.setDoc(e.doc),[new Mi(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ni.set(this.lineGaps.map((t=>t.draw(!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 ds(e,i))}}this.viewports=t.sort(((t,e)=>t.from-e.from)),this.scaler=this.heightMap.height<=7e6?gs:new ms(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:bs(t,this.scaler))}))}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=this.state.facet(Ti).filter((t=>"function"!=typeof t));let n=t.changedRanges,s=Mi.extendWithRanges(n,function(t,e,i){let n=new os;return _t.compare(t,e,i,n,0),n.changes}(i,this.stateDeco,t?t.changes:k.empty(this.state.doc.length))),r=this.heightMap.height;this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),s),this.heightMap.height!=r&&(t.flags|=2);let o=s.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.heado.to)||!this.viewportIsAppropriate(o))&&(o=this.getViewport(0,e));let a=!t.changes.empty||2&t.flags||o.from!=this.viewport.from||o.to!=this.viewport.to;this.viewport=o,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(Si)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let i=e.contentDOM,n=window.getComputedStyle(i),s=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Wi.RTL:Wi.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),a=i.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let h=0,c=0,u=parseInt(n.paddingTop)||0,d=parseInt(n.paddingBottom)||0;this.paddingTop==u&&this.paddingBottom==d||(this.paddingTop=u,this.paddingBottom=d,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let f=(this.printing?ls:as)(i,this.paddingTop),p=f.top-this.pixelViewport.top,O=f.bottom-this.pixelViewport.bottom;this.pixelViewport=f;let g=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(g!=this.inView&&(this.inView=g,g&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let m=a.width;if(this.contentDOMWidth==m&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,h|=8),l){let i=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(i)&&(o=!0),o||s.lineWrapping&&Math.abs(m-this.contentDOMWidth)>s.charWidth){let{lineHeight:t,charWidth:n,textHeight:a}=e.docView.measureTextSize();o=t>0&&s.refresh(r,t,n,a,m/n,i),o&&(e.docView.minWidth=0,h|=8)}p>0&&O>0?c=Math.max(p,O):p<0&&O<0&&(c=Math.min(p,O)),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 Mi(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new Gn(n.from,r))}s.heightChanged&&(h|=2)}let b=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return b&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(2&h||b)&&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,a=new ds(n.lineAt(r-1e3*i,Hn.ByHeight,s,0,0).from,n.lineAt(o+1e3*(1-i),Hn.ByHeight,s,0,0).to);if(e){let{head:t}=e.range;if(ta.to){let i,r=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=n.lineAt(t,Hn.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!=Wi.LTR&&!i)return[];let o=[],a=(n,r,l,h)=>{if(r-nn&&tt.from>=l.from&&t.to<=l.to&&Math.abs(t.from-n)t.frome))));if(!d){if(rt.from<=r&&t.to>=r))){let t=e.moveToLineBoundary(A.cursor(r),!1,!0).head;t>n&&(r=t)}d=new hs(n,r,this.gapSize(l,n,r,h))}o.push(d)};for(let t of this.viewportLines){if(t.lengtht.from&&a(t.from,s,t,e),ot.draw(this.heightOracle.lineWrapping)))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];_t.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))||bs(this.heightMap.lineAt(t,Hn.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return bs(this.heightMap.lineAt(this.scaler.fromDOM(t),Hn.ByHeight,this.heightOracle,0,0),this.scaler)}elementAtHeight(t){return bs(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 ds{constructor(t,e){this.from=t,this.to=e}}function fs(t,e,i){let n=[],s=t,r=0;return _t.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 Os(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 gs={toDOM:t=>t,fromDOM:t=>t,scale:1};class ms{constructor(t,e,i){let n=0,s=0,r=0;this.viewports=i.map((({from:i,to:s})=>{let r=e.lineAt(i,Hn.ByPos,t,0,0).top,o=e.lineAt(s,Hn.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=ebs(t,e))):t.type)}const ws=E.define({combine:t=>t.join(" ")}),vs=E.define({combine:t=>t.indexOf(!0)>-1}),ys=It.newName(),Ss=It.newName(),xs=It.newName(),ks={"&light":"."+Ss,"&dark":"."+xs};function Qs(t,e,i){return new It(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 $s=Qs("."+ys,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",borderRadius:"4px",marginTop:"0.5rem",width:"30%",minWidth:"190px",marginLeft:"auto",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&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:"#333338",fontSize:"70%",padding:".2em 1em",borderRadius:"4px"},"&light .cm-button":{background:"#eee"},"&dark .cm-button":{background:"#eee"},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",borderRadius:"0.25rem",border:"1px solid silver",padding:".0em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},ks);class Ps{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;i&&(e.push(new nn(i,n)),s==i&&r==n||e.push(new nn(s,r)));return e}(t),i=new tn(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?A.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||!ne(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||!ne(t.contentDOM,e.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(e.anchorNode,e.anchorOffset);this.newSel=A.single(n,i)}}}function Cs(e,i){let n,{newSel:s}=i,r=e.state.selection.main;if(i.bounds){let{from:s,to:o}=i.bounds,a=r.from,l=null;(8===e.inputState.lastKeyCode&&e.inputState.lastKeyTime>Date.now()-100||De.android&&i.text.length0&&a>0&&t.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if("end"==n){i-=o+Math.max(0,r-Math.min(o,a))-r}if(o=o?r-i:0,a=r+(a-o),o=r}else if(a=a?r-i:0,o=r+(o-a),a=r}return{from:r,toA:o,toB:a}}(e.state.doc.sliceString(s,o,Ki),i.text,a-s,l);h&&(De.chrome&&13==e.inputState.lastKeyCode&&h.toB==h.from+2&&i.text.slice(h.from,h.toB)==Ki+Ki&&h.toB--,n={from:s+h.from,to:s+h.toA,insert:t.of(i.text.slice(h.from,h.toB).split(Ki))})}else s&&(!e.hasFocus&&e.state.facet($i)||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))}:(De.mac||De.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=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}):De.chrome&&n&&n.from==n.to&&n.from==r.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(s&&(s=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}),n){let t=e.state;if(De.ios&&e.inputState.flushIOSKey(e))return!0;if(De.android&&(n.from==r.from&&n.to==r.to&&1==n.insert.length&&2==n.insert.lines&&be(e.contentDOM,"Enter",13)||n.from==r.from-1&&n.to==r.to&&0==n.insert.length&&be(e.contentDOM,"Backspace",8)||n.from==r.from&&n.to==r.to+1&&0==n.insert.length&&be(e.contentDOM,"Delete",46)))return!0;let i,o=n.insert.toString();if(e.state.facet(wi).some((t=>t(e,n.from,n.to,o))))return!0;if(e.inputState.composing>=0&&e.inputState.composing++,n.from>=r.from&&n.to<=r.to&&n.to-n.from>=(r.to-r.from)/3&&(!s||s.main.empty&&s.main.from==n.from+n.insert.length)&&e.inputState.composing<0){let s=r.fromn.to?t.sliceDoc(n.to,r.to):"";i=t.replaceSelection(e.state.toText(s+n.insert.sliceString(0,void 0,e.state.lineBreak)+o))}else{let o=t.changes(n),a=s&&s.main.to<=o.newLength?s.main:void 0;if(t.selection.ranges.length>1&&e.inputState.composing>=0&&n.to<=r.to&&n.to>=r.to-10){let s=e.state.sliceDoc(n.from,n.to),l=on(e)||e.state.doc.lineAt(r.head),h=r.to-n.to,c=r.to-r.from;i=t.changeByRange((i=>{if(i.from==r.from&&i.to==r.to)return{changes:o,range:a||i.map(o)};let u=i.to-h,d=u-s.length;if(i.to-i.from!=c||e.state.sliceDoc(d,u)!=s||l&&i.to>=l.from&&i.from<=l.to)return{range:i};let f=t.changes({from:d,to:u,insert:n.insert}),p=i.to-r.to;return{changes:f,range:a?A.range(Math.max(0,a.anchor+p),Math.max(0,a.head+p)):i.map(f)}}))}else i={changes:o,selection:a&&t.selection.replaceRange(a)}}let a="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,a+=".compose",e.inputState.compositionFirstChange&&(a+=".start",e.inputState.compositionFirstChange=!1)),e.dispatch(i,{scrollIntoView:!0,userEvent:a}),!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 _s={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Xs=De.ie&&De.ie_version<=11;class Zs{constructor(t){this.view=t,this.active=!1,this.selectionRange=new fe,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);(De.ie&&De.ie_version<=11||De.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()})),Xs&&(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")))}),{}),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($i)?i.root.activeElement!=this.dom:!se(i.dom,n))return;let s=n.anchorNode&&i.docView.nearest(n.anchorNode);s&&s.ignoreEvent(t)?e||(this.selectionChanged=!1):(De.ie&&De.ie_version<=11||De.android&&De.chrome)&&!i.state.selection.main.empty&&n.focusNode&&oe(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=De.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,a=t.docView.domAtPos(t.state.selection.main.anchor);oe(a.node,a.offset,r,o)&&([n,s,r,o]=[r,o,n,s]);return{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:o}}(this.view)||ie(t.root);if(!e||this.selectionRange.eq(e))return!1;let i=se(this.dom,e);return i&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let t=this.delayedAndroidKey;t&&(this.clearDelayedAndroidKey(),!this.flush()&&t.force&&be(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&&se(this.dom,this.selectionRange);return t<0&&!n?null:(t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new Ps(this.view,t,e,i))}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=Cs(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.dirty|=4),"childList"==t.type){let i=As(e,t.previousSibling||t.target.previousSibling,-1),n=As(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 As(t,e,i){for(;e;){let n=Se.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 Ts{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),this._dispatch=t.dispatch||(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 us(t.state||xt.create(t)),this.plugins=this.state.facet(Ci).map((t=>new Xi(t)));for(let t of this.plugins)t.update(this);this.observer=new Zs(this),this.inputState=new yn(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new sn(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),t.parent&&t.parent.appendChild(this.dom)}get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}dispatch(...t){this._dispatch(1==t.length&&t[0]instanceof dt?t[0]:this.state.update(...t))}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,a=null;t.some((t=>t.annotation(zn)))?(this.inputState.notifiedFocused=r,o=1):r!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=r,a=In(s,r),a||(o=1));let l=this.observer.delayedAndroidKey,h=null;if(l?(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(xt.phrases)!=this.state.facet(xt.phrases))return this.setState(s);e=Di.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 xi(t.empty?t:A.cursor(t.head,t.head>t.anchor?-1:1))}for(let t of e.effects)t.is(ki)&&(c=t.value)}this.viewState.update(e,c),this.bidiCache=Vs.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),i=this.docView.update(e),this.state.facet(Vi)!=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(ws)!=e.state.facet(ws)&&(this.viewState.mustMeasureContent=!0),(i||n||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!e.empty)for(let t of this.state.facet(bi))t(e);(a||h)&&Promise.resolve().then((()=>{a&&this.state==a.startState&&this.dispatch(a),h&&!Cs(this,h)&&l.force&&be(this.contentDOM,l.key,l.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 us(t),this.plugins=t.facet(Ci).map((t=>new Xi(t))),this.pluginMap.clear();for(let t of this.plugins)t.update(this);this.docView=new sn(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(Ci),i=t.state.facet(Ci);if(e!=i){let n=[];for(let s of i){let i=e.indexOf(s);if(i<0)n.push(new Xi(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.measureScheduled=0,t&&this.observer.forceFlush();let e=null,{scrollHeight:i,scrollTop:n,clientHeight:s}=this.scrollDOM,r=n>i-s-4?i:n;try{for(let t=0;;t++){this.updateState=1;let i=this.viewport,n=this.viewState.lineBlockAtHeight(r),s=this.viewState.measure(this);if(!s&&!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 o=[];4&s||([this.measureRequests,o]=[o,this.measureRequests]);let a=o.map((t=>{try{return t.read(this)}catch(t){return Qi(this.state,t),Es}})),l=Di.create(this,this.state,[]),h=!1,c=!1;l.flags|=s,e?e.flags|=s:e=l,this.updateState=2,l.empty||(this.updatePlugins(l),this.inputState.update(l),this.updateAttrs(),h=this.docView.update(l));for(let t=0;t1||t<-1)&&(this.scrollDOM.scrollTop+=t,c=!0)}if(h&&this.docView.updateSelection(!0),this.viewport.from==i.from&&this.viewport.to==i.to&&!c&&0==this.measureRequests.length)break}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let t of this.state.facet(bi))t(e)}get themeClasses(){return ys+" "+(this.state.facet(vs)?xs:Ss)+" "+this.state.facet(ws)}updateAttrs(){let t=Ms(this,Zi,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet($i)?"true":"false",class:"cm-content",style:`${De.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Ms(this,Ai,e);let i=this.observer.ignore((()=>{let i=ti(this.contentDOM,this.contentAttrs,e),n=ti(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)if(t.is(Ts.announce)){e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(Vi),It.mount(this.root,this.styleModules.concat($s).reverse())}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}}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 vn(this,t,wn(this,t,e,i))}moveByCharSelected(t,e,i){return vn(this,t,wn(this,t,e,i),!0)}moveByGroup(t,e){return vn(this,t,wn(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==wt.Space&&(s=e),s==e}}(this,t.head,e))))}moveToLineBoundary(t,e,i=!0){return function(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=n&&t.lineWrapping?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==Wi.LTR)?e.right-1:e.left+1,y:(r.top+r.bottom)/2});if(null!=o)return A.cursor(o,i?-1:1)}let o=hi.find(t.docView,e.head),a=o?i?o.posAtEnd:o.posAtStart:i?s.to:s.from;return A.cursor(a,i?-1:1)}(this,t,e,i)}moveVertically(t,e,i){return vn(this,t,function(t,e,i,n){let s=e.head,r=i?1:-1;if(s==(i?t.state.doc.length:0))return A.cursor(s,e.assoc);let o,a=e.goalColumn,l=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s),c=t.documentTop;if(h)null==a&&(a=h.left-l.left),o=r<0?h.top:h.bottom;else{let e=t.viewState.lineBlockAt(s);null==a&&(a=Math.min(l.right-l.left,t.defaultCharacterWidth*(s-e.from))),o=(r<0?e.top:e.bottom)+c}let u=l.left+a,d=null!=n?n:t.defaultLineHeight>>1;for(let i=0;;i+=10){let n=o+(d+i)*r,h=mn(t,{x:u,y:n},!1,r);if(nl.bottom||(r<0?hs))return A.cursor(h,e.assoc,void 0,a)}}(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(),mn(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 ue(i,s[Ni.find(s,t-n.from,-1,e)].dir==Wi.LTR==e>0)}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(yi)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Rs)return Fi(t.length);let e=this.textDirectionAt(t.from);for(let i of this.bidiCache)if(i.from==t.from&&i.dir==e)return i.order;let i=function(t,e){let i=t.length,n=e==Ui?1:2,s=e==Ui?2:1;if(!t||1==n&&!ji.test(t))return Fi(i);for(let e=0,s=n,o=n;e=0;t-=3)if(Bi[t+1]==-r){let e=Bi[t+2],i=2&e?n:4&e?1&e?s:n:0;i&&(Gi[a]=Gi[Bi[t]]=i),l=t;break}}else{if(189==Bi.length)break;Bi[l++]=a,Bi[l++]=e,Bi[l++]=h}else if(2==(o=Gi[a])||1==o){let t=o==n;h=t?0:1;for(let e=l-3;e>=0;e-=3){let i=Bi[e+2];if(2&i)break;if(t)Bi[e+2]|=2;else{if(4&i)break;Bi[e+2]|=4}}}for(let t=0;te;){let t=i,n=2!=Gi[--i];for(;i>e&&n==(2!=Gi[i-1]);)i--;o.push(new Ni(i,t,n?2:1))}else o.push(new Ni(e,t,0))}else for(let t=0;tDate.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{ge(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 ki.of(new xi("number"==typeof t?A.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}static domEventHandlers(t){return _i.define((()=>({})),{eventHandlers:t})}static theme(t,e){let i=It.newName(),n=[ws.of(i),Vi.of(Qs(`.${i}`,t))];return e&&e.dark&&n.push(vs.of(!0)),n}static baseTheme(t){return N.lowest(Vi.of(Qs("."+ys,t,ks)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),n=i&&Se.get(i)||Se.get(t);return(null===(e=null==n?void 0:n.rootView)||void 0===e?void 0:e.view)||null}}Ts.styleModule=Vi,Ts.inputHandler=wi,Ts.focusChangeEffect=vi,Ts.perLineTextDirection=yi,Ts.exceptionSink=mi,Ts.updateListener=bi,Ts.editable=$i,Ts.mouseSelectionStyle=gi,Ts.dragMovesSelection=Oi,Ts.clickAddsSelectionRange=pi,Ts.decorations=Ti,Ts.atomicRanges=Ri,Ts.scrollMargins=Ei,Ts.darkTheme=vs,Ts.contentAttributes=Ai,Ts.editorAttributes=Zi,Ts.lineWrapping=Ts.contentAttributes.of({class:"cm-lineWrapping"}),Ts.announce=ut.define();const Rs=4096,Es={};class Vs{constructor(t,e,i,n){this.from=t,this.to=e,this.dir=i,this.order=n}static update(t,e){if(e.empty)return t;let i=[],n=t.length?t[t.length-1].dir:Wi.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&&Je(r,i)}return i}const Ds=De.mac?"mac":De.windows?"win":De.linux?"linux":"key";function Ws(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 Us=N.default(Ts.domEventHandlers({keydown:(t,e)=>Bs(Ls(e.state),t,e,"editor")})),Ys=E.define({enables:Us}),qs=new WeakMap;function Ls(t){let e=t.facet(Ys),i=qs.get(e);return i||qs.set(e,i=function(t,e=Ds){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)=>{var a,l;let h=i[t]||(i[t]=Object.create(null)),c=n.split(/ (?!$)/).map((t=>function(t,e){const i=t.split(/-(?!$)/);let n,s,r,o,a=i[i.length-1];"Space"==a&&(a=" ");for(let t=0;t{let n=zs={view:e,prefix:i,scope:t};return setTimeout((()=>{zs==n&&(zs=null)}),Is),!0}]})}let u=c.join(" ");s(u,!1);let d=h[u]||(h[u]={preventDefault:!1,run:(null===(l=null===(a=h._any)||void 0===a?void 0:a.run)||void 0===l?void 0:l.slice())||[]});r&&d.run.push(r),o&&(d.preventDefault=!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,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.shift&&r(e,"Shift-"+s,n.shift,n.preventDefault)}return i}(e.reduce(((t,e)=>t.concat(e)),[]))),i}let zs=null;const Is=4e3;function Bs(t,e,i,n){let s=function(t){var e=!(Kt&&(t.ctrlKey||t.altKey||t.metaKey)||Jt&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?Gt:Nt)[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=v(b(s,0))==s.length&&" "!=s,o="",a=!1;zs&&zs.view==i&&zs.scope==n&&(o=zs.prefix+" ",(a=kn.indexOf(e.keyCode)<0)&&(zs=null));let l,h,c=new Set,u=t=>{if(t){for(let n of t.run)if(!c.has(n)&&(c.add(n),n(i,e)))return!0;t.preventDefault&&(a=!0)}return!1},d=t[n];if(d){if(u(d[o+Ws(s,e,!r)]))return!0;if(r&&(e.altKey||e.metaKey||e.ctrlKey)&&!(De.windows&&e.ctrlKey&&e.altKey)&&(l=Nt[e.keyCode])&&l!=s){if(u(d[o+Ws(l,e,!0)]))return!0;if(e.shiftKey&&(h=Gt[e.keyCode])!=s&&h!=l&&u(d[o+Ws(h,e,!1)]))return!0}else if(r&&e.shiftKey&&u(d[o+Ws(s,e,!0)]))return!0;if(u(d._any))return!0}return a}class js{constructor(t,e,i,n,s){this.className=t,this.left=e,this.top=i,this.width=n,this.height=s}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className==this.className&&(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",null!=this.width&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,i){if(i.empty){let n=t.coordsAtPos(i.head,i.assoc||1);if(!n)return[];let s=Ns(t);return[new js(e,n.left-s.left,n.top-s.top,null,n.bottom-n.top)]}return function(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];let n=Math.max(i.from,t.viewport.from),s=Math.min(i.to,t.viewport.to),r=t.textDirection==Wi.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=Ns(t),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),u=a.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),d=a.right-(c?parseInt(c.paddingRight):0),f=Fs(t,n),p=Fs(t,s),O=f.type==ii.Text?f:null,g=p.type==ii.Text?p:null;t.lineWrapping&&(O&&(O=Gs(t,n,O)),g&&(g=Gs(t,s,g)));if(O&&g&&O.from==g.from)return b(w(i.from,i.to,O));{let e=O?w(i.from,null,O):v(f,!1),n=g?w(null,i.to,g):v(p,!0),s=[];return(O||f).to<(g||p).from-1?s.push(m(u,e.bottom,d,n.top)):e.bottomh&&n.from=r)break;a>s&&l(Math.max(t,s),null==e&&t<=h,Math.min(a,r),null==i&&a>=c,o.dir)}if(s=n.to+1,s>=r)break}return 0==a.length&&l(h,null==e,c,null==i,t.textDirection),{top:s,bottom:o,horizontal:a}}function v(t,e){let i=a.top+(e?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]}}}(t,e,i)}}function Ns(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Wi.LTR?e.left:e.right-t.scrollDOM.clientWidth)-t.scrollDOM.scrollLeft,top:e.top-t.scrollDOM.scrollTop}}function Gs(t,e,i){let n=A.cursor(e);return{from:Math.max(i.from,t.moveToLineBoundary(n,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(n,!0,!0).from),type:ii.Text}}function Fs(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==ii.Text))return t;return i}class Hs{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),e.above&&this.dom.classList.add("cm-layer-above"),e.class&&this.dom.classList.add(e.class),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(Js)!=t.state.facet(Js)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&t.view.requestMeasure(this.measureReq)}setOrder(t){let e=0,i=t.facet(Js);for(;e{return i=t,n=this.drawn[e],!(i.constructor==n.constructor&&i.eq(n));var i,n}))){let e=this.dom.firstChild,i=0;for(let n of t)n.update&&e&&n.constructor&&this.drawn[i].constructor&&n.update(e,this.drawn[i])?(e=e.nextSibling,i++):this.dom.insertBefore(n.draw(),e);for(;e;){let t=e.nextSibling;e.remove(),e=t}this.drawn=t}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Js=E.define();function Ks(t){return[_i.define((e=>new Hs(e,t))),Js.of(t)]}const tr=!De.ios,er=E.define({combine:t=>kt(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})});function ir(t={}){return[er.of(t),sr,or,lr,Si.of(!0)]}function nr(t){return t.startState.facet(er)!=t.state.facet(er)}const sr=Ks({above:!0,markers(t){let{state:e}=t,i=e.facet(er),n=[];for(let s of e.selection.ranges){let r=s==e.selection.main;if(s.empty?!r||tr:i.drawRangeCursor){let e=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",i=s.empty?s:A.cursor(s.head,s.head>s.anchor?-1:1);for(let s of js.forRange(t,e,i))n.push(s)}}return n},update(t,e){t.transactions.some((t=>t.selection))&&(e.style.animationName="cm-blink"==e.style.animationName?"cm-blink2":"cm-blink");let i=nr(t);return i&&rr(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){rr(e.state,t)},class:"cm-cursorLayer"});function rr(t,e){e.style.animationDuration=t.facet(er).cursorBlinkRate+"ms"}const or=Ks({above:!1,markers:t=>t.state.selection.ranges.map((e=>e.empty?[]:js.forRange(t,"cm-selectionBackground",e))).reduce(((t,e)=>t.concat(e))),update:(t,e)=>t.docChanged||t.selectionSet||t.viewportChanged||nr(t),class:"cm-selectionLayer"}),ar={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};tr&&(ar[".cm-line"].caretColor="transparent !important");const lr=N.highest(Ts.theme(ar)),hr=ut.define({map:(t,e)=>null==t?null:e.mapPos(t)}),cr=q.define({create:()=>null,update:(t,e)=>(null!=t&&(t=e.changes.mapPos(t)),e.effects.reduce(((t,e)=>e.is(hr)?e.value:t),t))}),ur=_i.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let i=t.state.field(cr);null==i?null!=this.cursor&&(null===(e=this.cursor)||void 0===e||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(cr)!=i||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let t=this.view.state.field(cr),e=null!=t&&this.view.coordsAtPos(t);if(!e)return null;let i=this.view.scrollDOM.getBoundingClientRect();return{left:e.left-i.left+this.view.scrollDOM.scrollLeft,top:e.top-i.top+this.view.scrollDOM.scrollTop,height:e.bottom-e.top}}drawCursor(t){this.cursor&&(t?(this.cursor.style.left=t.left+"px",this.cursor.style.top=t.top+"px",this.cursor.style.height=t.height+"px"):this.cursor.style.left="-100000px")}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(cr)!=t&&this.view.dispatch({effects:hr.of(t)})}},{eventHandlers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){t.target!=this.view.contentDOM&&this.view.contentDOM.contains(t.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function dr(){return[cr,ur]}function fr(t,e,i,n,s){e.lastIndex=0;for(let r,o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)if(!o.lineBreak)for(;r=e.exec(o.value);)s(a+r.index,r)}class pr{constructor(t){const{regexp:e,decoration:i,decorate:n,boundary:s,maxLength:r=1e3}=t;if(!e.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=e,n)this.addMatch=(t,e,i,s)=>n(s,i,i+t[0].length,t,e);else if("function"==typeof i)this.addMatch=(t,e,n,s)=>{let r=i(t,e,n);r&&s(n,n+t[0].length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(t,e,n,s)=>s(n,n+t[0].length,i)}this.boundary=s,this.maxLength=r}createDeco(t){let e=new Xt,i=e.add.bind(e);for(let{from:e,to:n}of function(t,e){let i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;let n=[];for(let{from:s,to:r}of i)s=Math.max(t.state.doc.lineAt(s).from,s-e),r=Math.min(t.state.doc.lineAt(r).to,r+e),n.length&&n[n.length-1].to>=s?n[n.length-1].to=r:n.push({from:s,to:r});return n}(t,this.maxLength))fr(t.state.doc,this.regexp,e,n,((e,n)=>this.addMatch(n,t,e,i)));return e.finish()}updateDeco(t,e){let i=1e9,n=-1;return t.docChanged&&t.changes.iterChanges(((e,s,r,o)=>{o>t.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e}updateRange(t,e,i,n){for(let s of t.visibleRanges){let r=Math.max(s.from,i),o=Math.min(s.to,n);if(o>r){let i=t.state.doc.lineAt(r),n=i.toi.from;r--)if(this.boundary.test(i.text[r-1-i.from])){a=r;break}for(;oc.push(i.range(t,e));if(i==n)for(this.regexp.lastIndex=a-i.from;(h=this.regexp.exec(i.text))&&h.indexthis.addMatch(i,t,e,u)));e=e.update({filterFrom:a,filterTo:l,filter:(t,e)=>tl,add:c})}}return e}}const Or=null!=/x/.unicode?"gu":"g",gr=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",Or),mr={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let br=null;const wr=E.define({combine(t){let e=kt(t,{render:null,specialChars:gr,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==br&&"undefined"!=typeof document&&document.body){let e=document.body.style;br=null!=(null!==(t=e.tabSize)&&void 0!==t?t:e.MozTabSize)}return br||!1}())&&(e.specialChars=new RegExp("\t|"+e.specialChars.source,Or)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Or)),e}});function vr(t={}){return[wr.of(t),yr||(yr=_i.fromClass(class{constructor(t){this.view=t,this.decorations=ni.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(wr)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new pr({regexp:t.specialChars,decoration:(e,i,n)=>{let{doc:s}=i.state,r=b(e[0],0);if(9==r){let t=s.lineAt(n),e=i.state.tabSize,r=Yt(t.text,e,n-t.from);return ni.replace({widget:new xr((e-r%e)*this.view.defaultCharacterWidth)})}return this.decorationCache[r]||(this.decorationCache[r]=ni.replace({widget:new Sr(t,r)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(wr);t.startState.facet(wr)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))]}let yr=null;class Sr extends ei{constructor(t,e){super(),this.options=t,this.code=e}eq(t){return t.code==this.code}toDOM(t){let e=function(t){return t>=32?"•":10==t?"␤":String.fromCharCode(9216+t)}(this.code),i=t.state.phrase("Control character")+" "+(mr[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,i,e);if(n)return n;let s=document.createElement("span");return s.textContent=e,s.title=i,s.setAttribute("aria-label",i),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class xr extends ei{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent="\t",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}class kr extends ei{constructor(t){super(),this.content=t}toDOM(){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):this.content),"string"==typeof this.content?t.setAttribute("aria-label","placeholder "+this.content):t.setAttribute("aria-hidden","true"),t}ignoreEvent(){return!1}}const Qr="-10000px";class $r{constructor(t,e,i){this.facet=e,this.createTooltipView=i,this.input=t.state.facet(e),this.tooltips=this.input.filter((t=>t)),this.tooltipViews=this.tooltips.map(i)}update(t){var e;let i=t.state.facet(this.facet),n=i.filter((t=>t));if(i===this.input){for(let e of this.tooltipViews)e.update&&e.update(t);return!1}let s=[];for(let e=0;e{var e,i,n;return{position:De.ios?"absolute":(null===(e=t.find((t=>t.position)))||void 0===e?void 0:e.position)||"fixed",parent:(null===(i=t.find((t=>t.parent)))||void 0===i?void 0:i.parent)||null,tooltipSpace:(null===(n=t.find((t=>t.tooltipSpace)))||void 0===n?void 0:n.tooltipSpace)||Pr}}}),_r=new WeakMap,Xr=_i.fromClass(class{constructor(t){this.view=t,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(Cr);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new $r(t,Tr,(t=>this.createTooltip(t))),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout((()=>{this.measureTimeout=-1,this.maybeMeasure()}),50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t);e&&this.observeIntersection();let i=e||t.geometryChanged,n=t.state.facet(Cr);if(n.position!=this.position){this.position=n.position;for(let t of this.manager.tooltipViews)t.dom.style.position=this.position;i=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let t of this.manager.tooltipViews)this.container.appendChild(t.dom);i=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure()}createTooltip(t){let e=t.create(this.view);if(e.dom.classList.add("cm-tooltip"),t.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",e.dom.appendChild(t)}return e.dom.style.position=this.position,e.dom.style.top=Qr,this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var t,e;this.view.win.removeEventListener("resize",this.measureSoon);for(let e of this.manager.tooltipViews)e.dom.remove(),null===(t=e.destroy)||void 0===t||t.call(e);null===(e=this.intersectionObserver)||void 0===e||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=this.view.dom.getBoundingClientRect();return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map(((t,e)=>{let i=this.manager.tooltipViews[e];return i.getCoords?i.getCoords(t.pos):this.view.coordsAtPos(t.pos)})),size:this.manager.tooltipViews.map((({dom:t})=>t.getBoundingClientRect())),space:this.view.state.facet(Cr).tooltipSpace(this.view)}}writeMeasure(t){var e;let{editor:i,space:n}=t,s=[];for(let r=0;r=Math.min(i.bottom,n.bottom)||h.rightMath.min(i.right,n.right)+.1){l.style.top=Qr;continue}let u=o.arrow?a.dom.querySelector(".cm-tooltip-arrow"):null,d=u?7:0,f=c.right-c.left,p=null!==(e=_r.get(a))&&void 0!==e?e:c.bottom-c.top,O=a.offset||Ar,g=this.view.textDirection==Wi.LTR,m=c.width>n.right-n.left?g?n.left:n.right-c.width:g?Math.min(h.left-(u?14:0)+O.x,n.right-f):Math.max(n.left,h.left-f+(u?14:0)-O.x),b=!!o.above;!o.strictSide&&(b?h.top-(c.bottom-c.top)-O.yn.bottom)&&b==n.bottom-h.bottom>h.top-n.top&&(b=!b);let w=(b?h.top-n.top:n.bottom-h.bottom)-d;if(wm&&t.topv&&(v=b?t.top-p-2-d:t.bottom+d+2);"absolute"==this.position?(l.style.top=v-t.parent.top+"px",l.style.left=m-t.parent.left+"px"):(l.style.top=v+"px",l.style.left=m+"px"),u&&(u.style.left=h.left+(g?O.x:-O.x)-(m+14-7)+"px"),!0!==a.overlap&&s.push({left:m,top:v,right:y,bottom:v+p}),l.classList.toggle("cm-tooltip-above",b),l.classList.toggle("cm-tooltip-below",!b),a.positioned&&a.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=Qr}},{eventHandlers:{scroll(){this.maybeMeasure()}}}),Zr=Ts.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Ar={x:0,y:0},Tr=E.define({enables:[Xr,Zr]});function Rr(t,e){let i=t.plugin(Xr);if(!i)return null;let n=i.manager.tooltips.indexOf(e);return n<0?null:i.manager.tooltipViews[n]}const Er=E.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 Vr(t,e){let i=t.plugin(Mr),n=i?i.specs.indexOf(e):-1;return n>-1?i.panels[n]:null}const Mr=_i.fromClass(class{constructor(t){this.input=t.state.facet(Ur),this.specs=this.input.filter((t=>t)),this.panels=this.specs.map((e=>e(t)));let e=t.state.facet(Er);this.top=new Dr(t,!0,e.topContainer),this.bottom=new Dr(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(Er);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Dr(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Dr(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(Ur);if(i!=this.input){let e=i.filter((t=>t)),n=[],s=[],r=[],o=[];for(let i of e){let e,a=this.specs.indexOf(i);a<0?(e=i(t.view),o.push(e)):(e=this.panels[a],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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}}))});class Dr{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=Wr(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=Wr(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 Wr(t){let e=t.nextSibling;return t.remove(),e}const Ur=E.define({enables:Mr});class Yr extends Qt{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Yr.prototype.elementClass="",Yr.prototype.toDOM=void 0,Yr.prototype.mapMode=S.TrackBefore,Yr.prototype.startSide=Yr.prototype.endSide=-1,Yr.prototype.point=!0;const qr=E.define(),Lr={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>_t.empty,lineMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},zr=E.define();function Ir(t){return[jr(),zr.of(Object.assign(Object.assign({},Lr),t))]}const Br=E.define({combine:t=>t.some((t=>t))});function jr(t){let e=[Nr];return t&&!1===t.fixed&&e.push(Br.of(!0)),e}const Nr=_i.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+"px",this.gutters=t.state.facet(zr).map((e=>new Jr(t,e)));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!t.state.facet(Br),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(Br)!=!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=_t.iter(this.view.state.facet(qr),this.view.viewport.from),n=[],s=this.gutters.map((t=>new Hr(t,this.view.viewport,-this.view.documentPadding.top)));for(let t of this.view.viewportLineBlocks){let e;if(Array.isArray(t.type)){for(let i of t.type)if(i.type==ii.Text){e=i;break}}else e=t.type==ii.Text?t:void 0;if(e){n.length&&(n=[]),Fr(i,n,t.from);for(let t of s)t.line(this.view,e,n)}}for(let t of s)t.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(zr),i=t.state.facet(zr),n=t.docChanged||t.heightChanged||t.viewportChanged||!_t.eq(t.startState.facet(qr),t.state.facet(qr),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 Jr(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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&0!=i.gutters.length&&i.fixed?e.textDirection==Wi.LTR?{left:i.dom.offsetWidth}:{right:i.dom.offsetWidth}:null}))});function Gr(t){return Array.isArray(t)?t:[t]}function Fr(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class Hr{constructor(t,e,i){this.gutter=t,this.height=i,this.i=0,this.cursor=_t.iter(t.markers,e.from)}line(t,e,i){let n=[];Fr(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;if(0==n.length&&!r.config.renderEmptyElements)return;let o=e.top-this.height;if(this.i==r.elements.length){let i=new Kr(t,e.height,o,n);r.elements.push(i),r.dom.appendChild(i.dom)}else r.elements[this.i].update(t,e.height,o,n);this.height=e.bottom,this.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 Jr{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=Gr(e.markers(t)),e.initialSpacer&&(this.spacer=new Kr(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=Gr(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!_t.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 Kr{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.dom.style.height=(this.height=e)+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),function(t,e){if(t.length!=e.length)return!1;for(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 io extends Yr{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function no(t,e){return t.state.facet(eo).formatNumber(e,t.state)}const so=zr.compute([eo],(t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:t=>t.state.facet(to),lineMarker:(t,e,i)=>i.some((t=>t.toDOM))?null:new io(no(t,t.state.doc.lineAt(e.from).number)),lineMarkerChange:t=>t.startState.facet(eo)!=t.state.facet(eo),initialSpacer:t=>new io(no(t,ro(t.state.doc.lines))),updateSpacer(t,e){let i=no(e.view,ro(e.view.state.doc.lines));return i==t.number?t:new io(i)},domEventHandlers:t.facet(eo).domEventHandlers})));function ro(t){let e=9;for(;e{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=fo.match(t)),e=>{let i=t(e);return void 0===i?null:[this,i]}}}ho.closedBy=new ho({deserialize:t=>t.split(" ")}),ho.openedBy=new ho({deserialize:t=>t.split(" ")}),ho.group=new ho({deserialize:t=>t.split(" ")}),ho.contextHash=new ho({perNode:!0}),ho.lookAhead=new ho({perNode:!0}),ho.mounted=new ho({perNode:!0});class co{constructor(t,e,i){this.tree=t,this.overlay=e,this.parser=i}}const uo=Object.create(null);class fo{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):uo,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),n=new fo(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(ho.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(ho.group),n=-1;n<(i?i.length:0);n++){let s=e[n<0?t.name:i[n]];if(s)return s}}}}fo.none=new fo("",Object.create(null),0,8);class po{constructor(t){this.types=t;for(let e=0;e=n&&(r.type.isAnonymous||!1!==e(r))){if(r.firstChild())continue;t=!0}for(;t&&i&&!r.type.isAnonymous&&i(r),!r.nextSibling();){if(!r.parent())return;t=!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:To(fo.none,this.children,this.positions,0,this.children.length,0,this.length,((t,e,i)=>new bo(this.type,t,e,i,this.propValues)),t.makeTree||((t,e,i)=>new bo(fo.none,t,e,i)))}static build(t){return function(t){var e;let{buffer:i,nodeSet:n,maxBufferLength:s=oo,reused:r=[],minRepeatType:o=n.types.length}=t,a=Array.isArray(i)?new wo(i,i.length):i,l=n.types,h=0,c=0;function u(t,e,i,m,b){let{id:w,start:v,end:y,size:S}=a,x=c;for(;S<0;){if(a.next(),-1==S){let e=r[w];return i.push(e),void m.push(v-t)}if(-3==S)return void(h=w);if(-4==S)return void(c=w);throw new RangeError(`Unrecognized record size: ${S}`)}let k,Q,$=l[w],P=v-t;if(y-v<=s&&(Q=O(a.pos-e,b))){let e=new Uint16Array(Q.size-Q.skip),i=a.pos-Q.size,s=e.length;for(;a.pos>i;)s=g(Q.start,e,s);k=new vo(e,y-Q.start,n),P=Q.start-t}else{let t=a.pos-S;a.next();let e=[],i=[],n=w>=o?w:-1,r=0,l=y;for(;a.pos>t;)n>=0&&a.id==n&&a.size>=0?(a.end<=l-s&&(f(e,i,v,r,a.end,l,n,x),r=e.length,l=a.end),a.next()):u(v,t,e,i,n);if(n>=0&&r>0&&r-1&&r>0){let t=d($);k=To($,e,i,0,e.length,0,y-v,t,t)}else k=p($,e,i,y-v,x-y)}i.push(k),m.push(P)}function d(t){return(e,i,n)=>{let s,r,o=0,a=e.length-1;if(a>=0&&(s=e[a])instanceof bo){if(!a&&s.type==t&&s.length==n)return s;(r=s.prop(ho.lookAhead))&&(o=i[a]+s.length+r)}return p(t,e,i,n,o)}}function f(t,e,i,s,r,o,a,l){let h=[],c=[];for(;t.length>s;)h.push(t.pop()),c.push(e.pop()+i-r);t.push(p(n.types[a],h,c,o-r,l-o)),e.push(r-i)}function p(t,e,i,n,s=0,r){if(h){let t=[ho.contextHash,h];r=r?[t].concat(r):[t]}if(s>25){let t=[ho.lookAhead,s];r=r?[t].concat(r):[t]}return new bo(t,e,i,n,r)}function O(t,e){let i=a.fork(),n=0,r=0,l=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=l,l+=4,n+=4,i.next();continue}let a=i.pos-t;if(t<0||a=o?4:0,d=i.start;for(i.next();i.pos>a;){if(i.size<0){if(-3!=i.size)break t;u+=4}else i.id>=o&&(u+=4);i.next()}r=d,n+=t,l+=u}return(e<0||n==t)&&(c.size=n,c.start=r,c.skip=l),c.size>4?c:void 0}function g(t,e,i){let{id:n,start:s,end:r,size:l}=a;if(a.next(),l>=0&&n4){let n=a.pos-(l-4);for(;a.pos>n;)i=g(t,e,i)}e[--i]=o,e[--i]=r-t,e[--i]=s-t,e[--i]=n}else-3==l?h=n:-4==l&&(c=n);return i}let m=[],b=[];for(;a.pos>0;)u(t.start||0,t.bufferStart||0,m,b,-1);let w=null!==(e=t.length)&&void 0!==e?e:m.length?b[0]+m[0].length:0;return new bo(l[t.topID],m.reverse(),b.reverse(),w)}(t)}}bo.empty=new bo(fo.none,[],[],0);class wo{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 wo(this.buffer,this.index)}}class vo{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return fo.none}toString(){let t=[];for(let e=0;e0));a=r[a+3]);return o}slice(t,e,i){let n=this.buffer,s=new Uint16Array(e-t),r=0;for(let o=t,a=0;o=e&&ie;case 1:return i<=e&&n>e;case 2:return n>e;case 4:return!0}}function So(t,e){let i=t.childBefore(e);for(;i;){let e=i.lastChild;if(!e||e.to!=i.to)break;e.type.isError&&e.from==e.to?(t=i,i=e.prevSibling):i=e}return t}function xo(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!=l;t+=e){let l=o[t],h=a[t]+r.from;if(yo(n,i,h,h+l.length))if(l instanceof vo){if(s&mo.ExcludeBuffers)continue;let o=l.findChild(0,l.buffer.length,e,i-h,n);if(o>-1)return new Co(new Po(r,l,t,h),null,o)}else if(s&mo.IncludeAnonymous||!l.type.isAnonymous||Xo(l)){let o;if(!(s&mo.IgnoreMounts)&&l.props&&(o=l.prop(ho.mounted))&&!o.overlay)return new ko(o.tree,h,t,r);let a=new ko(l,h,t,r);return s&mo.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(e<0?l.children.length-1:0,e,i,n)}}if(s&mo.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&mo.IgnoreOverlays)&&(n=this._tree.prop(ho.mounted))&&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 ko(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}cursor(t=0){return new _o(this,t)}get tree(){return this._tree}toTree(){return this._tree}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return So(this,t)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}toString(){return this._tree.toString()}get node(){return this}matchContext(t){return $o(this,t)}}function Qo(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 $o(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 Po{constructor(t,e,i,n){this.parent=t,this.buffer=e,this.index=i,this.start=n}}class Co{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){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 Co(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&mo.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 Co(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 Co(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 Co(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}cursor(t=0){return new _o(this,t)}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 bo(this.type,t,e,this.to-this.from)}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return So(this,t)}toString(){return this.context.buffer.childString(this.index)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}get node(){return this}matchContext(t){return $o(this,t)}}class _o{get name(){return this.type.name}constructor(t,e=0){if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof ko)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let e=t._parent;e;e=e._parent)this.stack.unshift(e.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return!!t&&(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0)}yieldBuf(t,e){this.index=t;let{start:i,buffer:n}=this.buffer;return this.type=e||n.set.types[n.buffer[t]],this.from=i+n.buffer[t+1],this.to=i+n.buffer[t+2],!0}yield(t){return!!t&&(t instanceof ko?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,i){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,i,this.mode));let{buffer:n}=this.buffer,s=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.buffer.start,i);return!(s<0)&&(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,i=this.mode){return this.buffer?!(i&mo.ExcludeBuffers)&&this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&mo.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&mo.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode));let{buffer:e}=this.buffer,i=this.stack.length-1;if(t<0){let t=i<0?0:this.stack[i]+4;if(this.index!=t)return this.yieldBuf(e.findChild(t,this.index,-1,0,4))}else{let t=e.buffer[this.index+3];if(t<(i<0?e.buffer.length:e.buffer[this.stack[i]+3]))return this.yieldBuf(t)}return i<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,i,{buffer:n}=this;if(n){if(t>0){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&mo.IncludeAnonymous||t instanceof vo||!t.type.isAnonymous||Xo(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 $o(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 Xo(t){return t.children.some((t=>t instanceof vo||!t.type.isAnonymous||Xo(t)))}const Zo=new WeakMap;function Ao(t,e){if(!t.isAnonymous||e instanceof vo||e.type!=t)return 1;let i=Zo.get(e);if(null==i){i=1;for(let n of e.children){if(n.type!=t||!(n instanceof bo)){i=1;break}i+=Ao(t,n)}Zo.set(e,i)}return i}function To(t,e,i,n,s,r,o,a,l){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]+a);continue}u.push(i[s])}else{let e=n[h-1]+i[h-1].length-f;u.push(To(t,i,n,s,h,f,e,null,l))}d.push(f+a-r)}}(e,i,n,s,0),(a||l)(u,d,o)}class Ro{constructor(){this.map=new WeakMap}setBuffer(t,e,i){let n=this.map.get(t);n||this.map.set(t,n=new Map),n.set(e,i)}getBuffer(t,e){let i=this.map.get(t);return i&&i.get(e)}set(t,e){t instanceof Co?this.setBuffer(t.context.buffer,t.index,e):t instanceof ko&&this.map.set(t.tree,e)}get(t){return t instanceof Co?this.getBuffer(t.context.buffer,t.index):t instanceof ko?this.map.get(t.tree):void 0}cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}}class Eo{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 Eo(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,a=0,l=0;;o++){let h=o=i)for(;r&&r.from=e.from||c<=e.to||l){let t=Math.max(e.from,a)-l,i=Math.min(e.to,c)-l;e=t>=i?null:new Eo(t,i,e.tree,e.offset+l,o>0,!!h)}if(e&&n.push(e),r.to>c)break;r=snew lo(t.from,t.to))):[new lo(0,0)]:[new lo(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 Mo{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)}}function Do(t){return(e,i,n,s)=>new qo(e,t,i,n,s)}class Wo{constructor(t,e,i,n,s){this.parser=t,this.parse=e,this.overlay=i,this.target=n,this.ranges=s}}class Uo{constructor(t,e,i,n,s,r,o){this.parser=t,this.predicate=e,this.mounts=i,this.index=n,this.start=s,this.target=r,this.prev=o,this.depth=0,this.ranges=[]}}const Yo=new ho({perNode:!0});class qo{constructor(t,e,i,n,s){this.nest=e,this.input=i,this.fragments=n,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=t}advance(){if(this.baseParse){let t=this.baseParse.advance();if(!t)return null;if(this.baseParse=null,this.baseTree=t,this.startInner(),null!=this.stoppedAt)for(let t of this.inner)t.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let t=this.baseTree;return null!=this.stoppedAt&&(t=new bo(t.type,t.children,t.positions,t.length,t.propValues.concat([[Yo,this.stoppedAt]]))),t}let t=this.inner[this.innerDone],e=t.parse.advance();if(e){this.innerDone++;let i=Object.assign(Object.create(null),t.target.props);i[ho.mounted.id]=new co(e,t.overlay,t.parser),t.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let t=this.input.length;for(let e=this.innerDone;et.frag.from<=n.from&&t.frag.to>=n.to&&t.mount.overlay));if(t)for(let i of t.mount.overlay){let s=i.from+t.pos,r=i.to+t.pos;s>=n.from&&r<=n.to&&!e.ranges.some((t=>t.froms))&&e.ranges.push({from:s,to:r})}}a=!1}else if(i&&(r=Lo(i.ranges,n.from,n.to)))a=2!=r;else if(!n.type.isAnonymous&&n.fromnew lo(t.from-n.from,t.to-n.from))):null,n.tree,t)),s.overlay?t.length&&(i={ranges:t,depth:0,prev:i}):a=!1}}else e&&(o=e.predicate(n))&&(!0===o&&(o=new lo(n.from,n.to)),o.fromnew lo(t.from-e.start,t.to-e.start))),e.target,t)),e=e.prev}i&&! --i.depth&&(i=i.prev)}}}}function Lo(t,e,i){for(let n of t){if(n.from>=i)break;if(n.to>e)return n.from<=e&&n.to>=i?2:1}return 0}function zo(t,e,i,n,s,r){if(e=e.to);n++);let o=s.children[n],a=o.buffer;s.children[n]=function t(i,n,s,l,h){let c=i;for(;a[c+2]+r<=e.from;)c=a[c+3];let u=[],d=[];zo(o,i,c,u,d,l);let f=a[c+1],p=a[c+2],O=f+r==e.from&&p+r==e.to&&a[c]==e.type.id;return u.push(O?e.toTree():t(c+4,a[c+3],o.set.types[a[c]],f,p-f)),d.push(f-l),zo(o,a[c+3],n,u,d,l),new bo(s,u,d,h)}(0,a.length,fo.none,0,o.length);for(let n=0;n<=i;n++)t.childAfter(e.from)}class Bo{constructor(t,e){this.offset=e,this.done=!1,this.cursor=t.cursor(mo.IncludeAnonymous|mo.IgnoreMounts)}moveTo(t){let{cursor:e}=this,i=t-this.offset;for(;!this.done&&e.from=t&&e.enter(i,1,mo.IgnoreOverlays|mo.ExcludeBuffers)||e.next(!1)||(this.done=!0)}hasNode(t){if(this.moveTo(t.from),!this.done&&this.cursor.from+this.offset==t.from&&this.cursor.tree)for(let e=this.cursor.tree;;){if(e==t.tree)return!0;if(!(e.children.length&&0==e.positions[0]&&e.children[0]instanceof bo))break;e=e.children[0]}return!1}}let jo=class{constructor(t){var e;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){let i=this.curFrag=t[0];this.curTo=null!==(e=i.tree.prop(Yo))&&void 0!==e?e:i.to,this.inner=new Bo(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t)}nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=null!==(t=e.tree.prop(Yo))&&void 0!==t?t:e.to,this.inner=new Bo(e.tree,-e.offset)}}findMounts(t,e){var i;let n=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let t=this.inner.cursor.node;t;t=t.parent){let s=null===(i=t.tree)||void 0===i?void 0:i.prop(ho.mounted);if(s&&s.parser==e)for(let e=this.fragI;e=t.to)break;i.tree==this.curFrag.tree&&n.push({frag:i,pos:t.from-i.offset,mount:s})}}}return n}};function No(t,e){let i=null,n=e;for(let s=1,r=0;s=a)break;t.to<=o||(i||(n=i=e.slice()),t.froma&&i.splice(r+1,0,new lo(a,t.to))):t.to>a?i[r--]=new lo(a,t.to):i.splice(r--,1))}}return n}function Go(t,e,i,n){let s=0,r=0,o=!1,a=!1,l=-1e9,h=[];for(;;){let c=s==t.length?1e9:o?t[s].to:t[s].from,u=r==e.length?1e9:a?e[r].to:e[r].from;if(o!=a){let t=Math.max(l,i),e=Math.min(c,u,n);tnew lo(t.from+n,t.to+n))),a,l);for(let e=0,n=a;;e++){let a=e==o.length,h=a?l:o[e].from;if(h>n&&i.push(new Eo(n,h,s.tree,-t,r.from>=n||r.openStart,r.to<=h||r.openEnd)),a)break;n=o[e].to}}else i.push(new Eo(a,l,s.tree,-t,r.from>=t||r.openStart,r.to<=o||r.openEnd))}return i}let Ho=0;class Jo{constructor(t,e,i){this.set=t,this.base=e,this.modified=i,this.id=Ho++}static define(t){if(null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let e=new Jo([],null,[]);if(e.set.push(e),t)for(let i of t.set)e.set.push(i);return e}static defineModifier(){let t=new ta;return e=>e.modified.indexOf(t)>-1?e:ta.get(e.base||e,e.modified.concat(t).sort(((t,e)=>t.id-e.id)))}}let Ko=0;class ta{constructor(){this.instances=[],this.id=Ko++}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 Jo(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(ta.get(e,t));return s}}function ea(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,a=i[o];if(!a)throw new RangeError("Invalid path: "+t);let l=new na(n,s,o>0?i.slice(0,o):null);e[a]=l.sort(e[a])}}return ia.add(e)}const ia=new ho;class na{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 ra(t,e,i,n=0,s=t.length){let r=new oa(n,Array.isArray(e)?e:[e],i);r.highlightRange(t.cursor(),n,s,"",r.highlighters),r.flush(s)}na.empty=new na([],2,null);class oa{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:a}=t;if(o>=i||a<=e)return;r.isTop&&(s=this.highlighters.filter((t=>!t.scope||t.scope(r))));let l=n,h=function(t){let e=t.type.prop(ia);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}(t)||na.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&&(l&&(l+=" "),l+=c,1==h.mode&&(n+=(n?" ":"")+c)),this.startSpan(t.from,l),h.opaque)return;let u=t.tree&&t.tree.prop(ho.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 d=0,f=o;;d++){let p=d=O)&&t.nextSibling()););if(!p||O>i)break;f=p.to+o,f>e&&(this.highlightRange(r.cursor(),Math.max(e,p.from+o),Math.min(i,f),n,h),this.startSpan(f,l))}c&&t.parent()}else if(t.firstChild()){do{if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,n,s),this.startSpan(Math.min(i,t.to),l)}}while(t.nextSibling());t.parent()}}}const aa=Jo.define,la=aa(),ha=aa(),ca=aa(ha),ua=aa(ha),da=aa(),fa=aa(da),pa=aa(da),Oa=aa(),ga=aa(Oa),ma=aa(),ba=aa(),wa=aa(),va=aa(wa),ya=aa(),Sa={comment:la,lineComment:aa(la),blockComment:aa(la),docComment:aa(la),name:ha,variableName:aa(ha),typeName:ca,tagName:aa(ca),propertyName:ua,attributeName:aa(ua),className:aa(ha),labelName:aa(ha),namespace:aa(ha),macroName:aa(ha),literal:da,string:fa,docString:aa(fa),character:aa(fa),attributeValue:aa(fa),number:pa,integer:aa(pa),float:aa(pa),bool:aa(da),regexp:aa(da),escape:aa(da),color:aa(da),url:aa(da),keyword:ma,self:aa(ma),null:aa(ma),atom:aa(ma),unit:aa(ma),modifier:aa(ma),operatorKeyword:aa(ma),controlKeyword:aa(ma),definitionKeyword:aa(ma),moduleKeyword:aa(ma),operator:ba,derefOperator:aa(ba),arithmeticOperator:aa(ba),logicOperator:aa(ba),bitwiseOperator:aa(ba),compareOperator:aa(ba),updateOperator:aa(ba),definitionOperator:aa(ba),typeOperator:aa(ba),controlOperator:aa(ba),punctuation:wa,separator:aa(wa),bracket:va,angleBracket:aa(va),squareBracket:aa(va),paren:aa(va),brace:aa(va),content:Oa,heading:ga,heading1:aa(ga),heading2:aa(ga),heading3:aa(ga),heading4:aa(ga),heading5:aa(ga),heading6:aa(ga),contentSeparator:aa(Oa),list:aa(Oa),quote:aa(Oa),emphasis:aa(Oa),strong:aa(Oa),link:aa(Oa),monospace:aa(Oa),strikethrough:aa(Oa),inserted:aa(),deleted:aa(),changed:aa(),invalid:aa(),meta:ya,documentMeta:aa(ya),annotation:aa(ya),processingInstruction:aa(ya),definition:Jo.defineModifier(),constant:Jo.defineModifier(),function:Jo.defineModifier(),standard:Jo.defineModifier(),local:Jo.defineModifier(),special:Jo.defineModifier()};var xa;sa([{tag:Sa.link,class:"tok-link"},{tag:Sa.heading,class:"tok-heading"},{tag:Sa.emphasis,class:"tok-emphasis"},{tag:Sa.strong,class:"tok-strong"},{tag:Sa.keyword,class:"tok-keyword"},{tag:Sa.atom,class:"tok-atom"},{tag:Sa.bool,class:"tok-bool"},{tag:Sa.url,class:"tok-url"},{tag:Sa.labelName,class:"tok-labelName"},{tag:Sa.inserted,class:"tok-inserted"},{tag:Sa.deleted,class:"tok-deleted"},{tag:Sa.literal,class:"tok-literal"},{tag:Sa.string,class:"tok-string"},{tag:Sa.number,class:"tok-number"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],class:"tok-string2"},{tag:Sa.variableName,class:"tok-variableName"},{tag:Sa.local(Sa.variableName),class:"tok-variableName tok-local"},{tag:Sa.definition(Sa.variableName),class:"tok-variableName tok-definition"},{tag:Sa.special(Sa.variableName),class:"tok-variableName2"},{tag:Sa.definition(Sa.propertyName),class:"tok-propertyName tok-definition"},{tag:Sa.typeName,class:"tok-typeName"},{tag:Sa.namespace,class:"tok-namespace"},{tag:Sa.className,class:"tok-className"},{tag:Sa.macroName,class:"tok-macroName"},{tag:Sa.propertyName,class:"tok-propertyName"},{tag:Sa.operator,class:"tok-operator"},{tag:Sa.comment,class:"tok-comment"},{tag:Sa.meta,class:"tok-meta"},{tag:Sa.invalid,class:"tok-invalid"},{tag:Sa.punctuation,class:"tok-punctuation"}]);const ka=new ho;function Qa(t){return E.define({combine:t?e=>e.concat(t):void 0})}const $a=new ho;class Pa{constructor(t,e,i=[],n=""){this.data=t,this.name=n,xt.prototype.hasOwnProperty("tree")||Object.defineProperty(xt.prototype,"tree",{get(){return Xa(this)}}),this.parser=e,this.extension=[Wa.of(this),xt.languageData.of(((t,e,i)=>{let n=Ca(t,e,i),s=n.type.prop(ka);if(!s)return[];let r=t.facet(s),o=n.type.prop($a);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 Ca(t,e,i).type.prop(ka)==this.data}findRegions(t){let e=t.facet(Wa);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(ka)==this.data)return void i.push({from:e,to:e+t.length});let s=t.prop(ho.mounted);if(s){if(s.tree.prop(ka)==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;it.isTop?e:void 0))]}),t.name)}configure(t,e){return new _a(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Xa(t){let e=t.field(Pa.state,!1);return e?e.tree:bo.empty}class Za{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let i=this.cursorPos-this.string.length;return t=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i)}}let Aa=null;class Ta{constructor(t,e,i=[],n,s,r,o,a){this.parser=t,this.state=e,this.fragments=i,this.tree=n,this.treeLen=s,this.viewport=r,this.skipped=o,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(t,e,i){return new Ta(t,e,[],bo.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Za(this.state.doc),this.fragments)}work(t,e){return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=bo.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(Eo.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Aa;Aa=this;try{return t()}finally{Aa=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=Ra(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=Eo.applyChanges(i,e),n=bo.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=Ra(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 Vo{createParse(e,i,n){let s=n[0].from,r=n[n.length-1].to;return{parsedPos:s,advance(){let e=Aa;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 bo(fo.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 Aa}}function Ra(t,e,i){return Eo.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class Ea{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 Ea(e)}static init(t){let e=Math.min(3e3,t.doc.length),i=Ta.create(t.facet(Wa).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new Ea(i)}}Pa.state=q.define({create:Ea.init,update(t,e){for(let t of e.effects)if(t.is(Pa.setState))return t.value;return e.startState.facet(Wa)!=e.state.facet(Wa)?Ea.init(e.state):t.apply(e)}});let Va=t=>{let e=setTimeout((()=>t()),500);return()=>clearTimeout(e)};"undefined"!=typeof requestIdleCallback&&(Va=t=>{let e=-1,i=setTimeout((()=>{e=requestIdleCallback(t,{timeout:400})}),100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const Ma="undefined"!=typeof navigator&&(null===(xa=navigator.scheduling)||void 0===xa?void 0:xa.isInputPending)?()=>navigator.scheduling.isInputPending():null,Da=_i.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(Pa.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),t.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(Pa.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=Va(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEndn+1e3,a=s.context.work((()=>Ma&&Ma()||Date.now()>r),n+(o?0:1e5));this.chunkBudget-=Date.now()-e,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Pa.setState.of(new Ea(s.context))})),this.chunkBudget>0&&(!a||o)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then((()=>this.scheduleWork())).catch((t=>Qi(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()}}}),Wa=E.define({combine:t=>t.length?t[0]:null,enables:t=>[Pa.state,Da,Ts.contentAttributes.compute([t],(e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}}))]});class Ua{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}class Ya{constructor(t,e,i,n,s,r=void 0){this.name=t,this.alias=e,this.extensions=i,this.filename=n,this.loadFunc=s,this.support=r,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then((t=>this.support=t),(t=>{throw this.loading=null,t})))}static of(t){let{load:e,support:i}=t;if(!e){if(!i)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");e=()=>Promise.resolve(i)}return new Ya(t.name,(t.alias||[]).concat(t.name).map((t=>t.toLowerCase())),t.extensions||[],t.filename,e,i)}static matchFilename(t,e){for(let i of t)if(i.filename&&i.filename.test(e))return i;let i=/\.([^.]+)$/.exec(e);if(i)for(let e of t)if(e.extensions.indexOf(i[1])>-1)return e;return null}static matchLanguageName(t,e,i=!0){e=e.toLowerCase();for(let i of t)if(i.alias.some((t=>t==e)))return i;if(i)for(let i of t)for(let t of i.alias){let n=e.indexOf(t);if(n>-1&&(t.length>2||!/\w/.test(e[n-1])&&!/\w/.test(e[n+t.length])))return i}return null}}const qa=E.define(),La=E.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 za(t){let e=t.facet(La);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function Ia(t,e){let i="",n=t.tabSize,s=t.facet(La)[0];if("\t"==s){for(;e>=n;)i+="\t",e-=n;s=" "}for(let t=0;t=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 Yt(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 Na=new ho;function Ga(t){let e=t.type.prop(Na);if(e)return e;let i,n=t.firstChild;if(n&&(i=n.type.prop(ho.closedBy))){let e=t.lastChild,n=e&&i.indexOf(e.name)>-1;return t=>el(t,!0,1,void 0,n&&!function(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}(t)?e.from:void 0)}return null==t.parent?Ha:null}function Fa(t,e,i){for(;t;t=t.parent){let n=Ga(t);if(n)return n(Ja.create(i,e,t))}return null}function Ha(){return 0}class Ja extends ja{constructor(t,e,i){super(t.state,t.options),this.base=t,this.pos=e,this.node=i}static create(t,e,i){return new Ja(t,e,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){let t=this.state.doc.lineAt(this.node.from);for(;;){let e=this.node.resolve(t.from);for(;e.parent&&e.parent.from==e.from;)e=e.parent;if(Ka(e,this.node))break;t=this.state.doc.lineAt(e.from)}return this.lineIndent(t.from)}continue(){let t=this.node.parent;return t?Fa(t,this.pos,this.base):0}}function Ka(t,e){for(let i=e;i;i=i.parent)if(t==i)return!0;return!1}function tl({closing:t,align:e=!0,units:i=1}){return n=>el(n,e,i,t)}function el(t,e,i,n,s){let r=t.textAfter,o=r.match(/^\s*/)[0].length,a=n&&r.slice(o,o+n.length)==n||s==t.pos+o,l=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.from{let n=t&&t.test(i.textAfter);return i.baseIndent+(n?0:e*i.unit)}}function nl(){return xt.transactionFilter.of((t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let i=t.newDoc,{head:n}=t.newSelection.main,s=i.lineAt(n);if(n>s.from+200)return t;let r=i.sliceString(s.from,n);if(!e.some((t=>t.test(r))))return t;let{state:o}=t,a=-1,l=[];for(let{head:t}of o.selection.ranges){let e=o.doc.lineAt(t);if(e.from==a)continue;a=e.from;let i=Ba(o,e.from);if(null==i)continue;let n=/^\s*/.exec(e.text)[0],s=Ia(o,i);n!=s&&l.push({from:e.from,to:e.from+n.length,insert:s})}return l.length?[t,{changes:l,sequential:!0}]:t}))}const sl=E.define(),rl=new ho;function ol(t){let e=t.firstChild,i=t.lastChild;return e&&e.toi)continue;if(s&&r.from=e&&n.to>i&&(s=n)}}return s}(t,e,i)}function hl(t,e){let i=e.mapPos(t.from,1),n=e.mapPos(t.to,-1);return i>=n?void 0:{from:i,to:n}}const cl=ut.define({map:hl}),ul=ut.define({map:hl}),dl=q.define({create:()=>ni.none,update(t,e){t=t.map(e.changes);for(let i of e.effects)i.is(cl)&&!pl(t,i.value.from,i.value.to)?t=t.update({add:[bl.range(i.value.from,i.value.to)]}):i.is(ul)&&(t=t.update({filter:(t,e)=>i.value.from!=t||i.value.to!=e,filterFrom:i.value.from,filterTo:i.value.to}));if(e.selection){let i=!1,{head:n}=e.selection.main;t.between(n,n,((t,e)=>{tn&&(i=!0)})),i&&(t=t.update({filterFrom:n,filterTo:n,filter:(t,e)=>e<=n||t>=n}))}return t},provide:t=>Ts.decorations.from(t),toJSON(t,e){let i=[];return t.between(0,e.doc.length,((t,e)=>{i.push(t,e)})),i},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let i=0;i{(!s||s.from>t)&&(s={from:t,to:e})})),s}function pl(t,e,i){let n=!1;return t.between(e,e,((t,s)=>{t==e&&s==i&&(n=!0)})),n}const Ol={placeholderDOM:null,placeholderText:"…"},gl=E.define({combine:t=>kt(t,Ol)});function ml(t){let e=[dl,yl];return t&&e.push(gl.of(t)),e}const bl=ni.replace({widget:new class extends ei{toDOM(t){let{state:e}=t,i=e.facet(gl),n=e=>{let i=t.lineBlockAt(t.posAtDOM(e.target)),n=fl(t.state,i.from,i.to);n&&t.dispatch({effects:ul.of(n)}),e.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(t,n);let s=document.createElement("span");return s.textContent=i.placeholderText,s.setAttribute("aria-label",e.phrase("folded code")),s.title=e.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=n,s}}}),wl={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class vl extends Yr{constructor(t,e){super(),this.config=t,this.open=e}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let e=document.createElement("span");return e.textContent=this.open?this.config.openText:this.config.closedText,e.title=t.state.phrase(this.open?"Fold line":"Unfold line"),e}}const yl=Ts.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Sl{constructor(t,e){let i;function n(t){let e=It.newName();return(i||(i=Object.create(null)))["."+e]=t,e}this.specs=t;const s="string"==typeof e.all?e.all:e.all?n(e.all):void 0,r=e.scope;this.scope=r instanceof Pa?t=>t.prop(ka)==r.data:r?t=>t==r:void 0,this.style=sa(t.map((t=>({tag:t.tag,class:t.class||n(Object.assign({},t,{tag:null}))}))),{all:s}).style,this.module=i?new It(i):null,this.themeType=e.themeType}static define(t,e){return new Sl(t,e||{})}}const xl=E.define(),kl=E.define({combine:t=>t.length?[t[0]]:null});function Ql(t){let e=t.facet(xl);return e.length?e:t.facet(kl)}function $l(t,e){let i,n=[Cl];return t instanceof Sl&&(t.module&&n.push(Ts.styleModule.of(t.module)),i=t.themeType),(null==e?void 0:e.fallback)?n.push(kl.of(t)):i?n.push(xl.computeN([Ts.darkTheme],(e=>e.facet(Ts.darkTheme)==("dark"==i)?[t]:[]))):n.push(xl.of(t)),n}class Pl{constructor(t){this.markCache=Object.create(null),this.tree=Xa(t.state),this.decorations=this.buildDeco(t,Ql(t.state))}update(t){let e=Xa(t.state),i=Ql(t.state),n=i!=Ql(t.startState);e.length{i.add(t,e,this.markCache[n]||(this.markCache[n]=ni.mark({class:n})))}),n,s);return i.finish()}}const Cl=N.high(_i.fromClass(Pl,{decorations:t=>t.decorations})),_l=Sl.define([{tag:Sa.meta,color:"#404740"},{tag:Sa.link,textDecoration:"underline"},{tag:Sa.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Sa.emphasis,fontStyle:"italic"},{tag:Sa.strong,fontWeight:"bold"},{tag:Sa.strikethrough,textDecoration:"line-through"},{tag:Sa.keyword,color:"#708"},{tag:[Sa.atom,Sa.bool,Sa.url,Sa.contentSeparator,Sa.labelName],color:"#219"},{tag:[Sa.literal,Sa.inserted],color:"#164"},{tag:[Sa.string,Sa.deleted],color:"#a11"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],color:"#e40"},{tag:Sa.definition(Sa.variableName),color:"#00f"},{tag:Sa.local(Sa.variableName),color:"#30a"},{tag:[Sa.typeName,Sa.namespace],color:"#085"},{tag:Sa.className,color:"#167"},{tag:[Sa.special(Sa.variableName),Sa.macroName],color:"#256"},{tag:Sa.definition(Sa.propertyName),color:"#00c"},{tag:Sa.comment,color:"#940"},{tag:Sa.invalid,color:"#f00"}]),Xl=Ts.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Zl=1e4,Al="()[]{}",Tl=E.define({combine:t=>kt(t,{afterCursor:!0,brackets:Al,maxScanDistance:Zl,renderMatch:Vl})}),Rl=ni.mark({class:"cm-matchingBracket"}),El=ni.mark({class:"cm-nonmatchingBracket"});function Vl(t){let e=[],i=t.matched?Rl:El;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 Ml=q.define({create:()=>ni.none,update(t,e){if(!e.docChanged&&!e.selection)return t;let i=[],n=e.state.facet(Tl);for(let t of e.state.selection.ranges){if(!t.empty)continue;let s=Ll(e.state,t.head,-1,n)||t.head>0&&Ll(e.state,t.head-1,1,n)||n.afterCursor&&(Ll(e.state,t.head,1,n)||t.headTs.decorations.from(t)}),Dl=[Ml,Xl];function Wl(t={}){return[Tl.of(t),Dl]}const Ul=new ho;function Yl(t,e,i){let n=t.prop(e<0?ho.openedBy:ho.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 ql(t){let e=t.type.prop(Ul);return e?e(t.node):t}function Ll(t,e,i,n={}){let s=n.maxScanDistance||Zl,r=n.brackets||Al,o=Xa(t),a=o.resolveInner(e,i);for(let n=a;n;n=n.parent){let s=Yl(n.type,i,r);if(s&&n.from0?e>=o.from&&eo.from&&e<=o.to))return zl(t,e,i,n,o,s,r)}}return function(t,e,i,n,s,r,o){let a=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%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 a=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(a+t,1).type!=s))if(e%2==0==i>0)u++;else{if(1==u)return{start:h,end:{from:a+t,to:a+t+1},matched:e>>1==l>>1};u--}}i>0&&(t+=r.length)}return c.done?{start:h,matched:!1}:null}(t,e,i,o,a.type,s,r)}function zl(t,e,i,n,s,r,o){let a=n.parent,l={from:s.from,to:s.to},h=0,c=null==a?void 0:a.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 jl(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 Nl=new WeakMap;class Gl extends Pa{constructor(t){let e,i=Qa(t.languageData),n={name:(s=t).name||"",token:s.token,blankLine:s.blankLine||(()=>{}),startState:s.startState||(()=>!0),copyState:s.copyState||jl,indent:s.indent||(()=>null),languageData:s.languageData||{},tokenTable:s.tokenTable||th};var s;super(i,new class extends Vo{createParse(t,i,n){return new Jl(e,t,i,n)}},[qa.of(((t,e)=>this.getIndent(t,e)))],t.name),this.topNode=function(t){let e=fo.define({id:eh.length,name:"Document",props:[ka.add((()=>t))]});return eh.push(e),e}(i),e=this,this.streamParser=n,this.stateAfter=new ho({perNode:!0}),this.tokenTable=t.tokenTable?new rh(n.tokenTable):oh}static define(t){return new Gl(t)}getIndent(t,e){let i,n=Xa(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=Nl.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],a=i+e.positions[r],l=o instanceof bo&&a=e.length)return e;s||e.type!=t.topNode||(s=!0);for(let r=e.children.length-1;r>=0;r--){let o,a=e.positions[r],l=e.children[r];if(ai&&Fl(t,n.tree,0-n.offset,i,r);if(o&&(e=Hl(t,n.tree,i+n.offset,o.pos+n.offset,!1)))return{state:o.state,tree:e}}return{state:t.streamParser.startState(n?za(n):4),tree:bo.empty}}(t,i,r,null==s?void 0:s.state);this.state=o,this.parsedPos=this.chunkStart=r+a.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 Bl(e,t?t.state.tabSize:4,t?za(t.state):2);if(r.eol())s.blankLine(this.state,r.indentUnit);else for(;!r.eol();){let t=Kl(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 th=Object.create(null),eh=[fo.none],ih=new po(eh),nh=[],sh=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"]])sh[t]=lh(th,e);class rh{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),sh)}resolve(t){return t?this.table[t]||(this.table[t]=lh(this.extra,t)):0}}const oh=new rh(th);function ah(t,e){nh.indexOf(t)>-1||(nh.push(t),console.warn(e))}function lh(t,e){let i=null;for(let n of e.split(".")){let e=t[n]||Sa[n];e?"function"==typeof e?i?i=e(i):ah(n,`Modifier ${n} used at start of tag`):i?ah(n,`Tag ${n} used as modifier`):i=e:ah(n,`Unknown highlighting tag ${n}`)}if(!i)return 0;let n=e.replace(/ /g,"_"),s=fo.define({id:eh.length,name:n,props:[ea({[n]:i})]});return eh.push(s),s.id}function hh(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 ch=hh(gh,0),uh=hh(Oh,0),dh=hh(((t,e)=>Oh(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 fh(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}const ph=50;function Oh(t,e,i=e.selection.ranges){let n=i.map((t=>fh(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,a=t.sliceDoc(n-ph,n),l=t.sliceDoc(s,s+ph),h=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(l)[0].length,u=a.length-h;if(a.slice(u-e.length,u)==e&&l.slice(c,c+i.length)==i)return{open:{pos:n-h,margin:h&&1},close:{pos:s+c,margin:c&&1}};s-n<=2*ph?r=o=t.sliceDoc(n,s):(r=t.sliceDoc(n,n+ph),o=t.sliceDoc(s-ph,s));let d=/^\s*/.exec(r)[0].length,f=/\s*$/.exec(o)[0].length,p=o.length-f-i.length;return r.slice(d,d+e.length)==e&&o.slice(p,p+i.length)==i?{open:{pos:n+d+e.length,margin:/\s/.test(r.charAt(d+e.length))?1:0},close:{pos:s-f-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>l.from)){s=l.from;let t=/^\s*/.exec(l.text)[0].length,e=t==l.length,i=l.text.slice(t,t+a.length)==a?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 mh=lt.define(),bh=lt.define(),wh=E.define(),vh=E.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)})});const yh=q.define({create:()=>Dh.empty,update(t,e){let i=e.state.facet(vh),n=e.annotation(mh);if(n){let s=e.docChanged?A.single(function(t){let e=0;return t.iterChangedRanges(((t,i)=>e=i)),e}(e.changes)):void 0,r=Ch.fromTransaction(e,s),o=n.side,a=0==o?t.undone:t.done;return a=r?_h(a,a.length,i.minDepth,r):Th(a,e.startState.selection),new Dh(0==o?n.rest:a,0==o?a:n.rest)}let s=e.annotation(bh);if("full"!=s&&"before"!=s||(t=t.isolate()),!1===e.annotation(dt.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);let r=Ch.fromTransaction(e),o=e.annotation(dt.time),a=e.annotation(dt.userEvent);return r?t=t.addChanges(r,o,a,i,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,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 Dh(t.done.map(Ch.fromJSON),t.undone.map(Ch.fromJSON))});function Sh(t={}){return[yh,vh.of(t),Ts.domEventHandlers({beforeinput(t,e){let i="historyUndo"==t.inputType?kh:"historyRedo"==t.inputType?Qh:null;return!!i&&(t.preventDefault(),i(e))}})]}function xh(t,e){return function({state:i,dispatch:n}){if(!e&&i.readOnly)return!1;let s=i.field(yh,!1);if(!s)return!1;let r=s.pop(t,i,e);return!!r&&(n(r),!0)}}const kh=xh(0,!1),Qh=xh(1,!1),$h=xh(0,!0),Ph=xh(1,!0);class Ch{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 Ch(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 Ch(t.changes&&k.fromJSON(t.changes),[],t.mapped&&x.fromJSON(t.mapped),t.startSelection&&A.fromJSON(t.startSelection),t.selectionsAfter.map(A.fromJSON))}static fromTransaction(t,e){let i=Zh;for(let e of t.startState.facet(wh)){let n=e(t);n.length&&(i=i.concat(n))}return!i.length&&t.changes.empty?null:new Ch(t.changes.invert(t.startState.doc),i,void 0,e||t.startState.selection,Zh)}static selection(t){return new Ch(void 0,Zh,void 0,void 0,t)}}function _h(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 Xh(t,e){return t.length?e.length?t.concat(e):t:e}const Zh=[],Ah=200;function Th(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-Ah));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),_h(t,t.length-1,1e9,i.setSelAfter(n)))}return[Ch.selection([e])]}function Rh(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 Eh(t,e){if(!t.length)return t;let i=t.length,n=Zh;for(;i;){let s=Vh(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?[Ch.selection(n)]:Zh}function Vh(t,e,i){let n=Xh(t.selectionsAfter.length?t.selectionsAfter.map((t=>t.map(e))):Zh,i);if(!t.changes)return Ch.selection(n);let s=t.changes.map(e),r=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(r):r;return new Ch(s,ut.mapEffects(t.effects,e),o,t.startSelection.map(r),n)}const Mh=/^(input\.type|delete)($|\.)/;class Dh{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 Dh(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||Mh.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)?_h(r,r.length-1,n.minDepth,new Ch(t.changes.compose(o.changes),Xh(t.effects,o.effects),o.mapped,o.startSelection,Zh)):_h(r,r.length,n.minDepth,t),new Dh(r,Zh,e,i)}addSelection(t,e,i,n){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Zh;return s.length>0&&e-this.prevTimet.empty!=o.ranges[e].empty)).length)?this:new Dh(Th(this.done,t),this.undone,e,i);var r,o}addMapping(t){return new Dh(Eh(this.done,t),Eh(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:mh.of({side:t,rest:Rh(n)}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let i=1==n.length?Zh:n.slice(0,n.length-1);return s.mapped&&(i=Eh(i,s.mapped)),e.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:mh.of({side:t,rest:i}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}}Dh.empty=new Dh(Zh,Zh);const Wh=[{key:"Mod-z",run:kh,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Qh,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Qh,preventDefault:!0},{key:"Mod-u",run:$h,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Ph,preventDefault:!0}];function Uh(t,e){return A.create(t.ranges.map(e),t.mainIndex)}function Yh(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function qh({state:t,dispatch:e},i){let n=Uh(t.selection,i);return!n.eq(t.selection)&&(e(Yh(t,n)),!0)}function Lh(t,e){return A.cursor(e?t.to:t.from)}function zh(t,e){return qh(t,(i=>i.empty?t.moveByChar(i,e):Lh(i,e)))}function Ih(t){return t.textDirectionAt(t.state.selection.main.head)==Wi.LTR}const Bh=t=>zh(t,!Ih(t)),jh=t=>zh(t,Ih(t));function Nh(t,e){return qh(t,(i=>i.empty?t.moveByGroup(i,e):Lh(i,e)))}function Gh(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 Fh(t,e,i){let n,s,r=Xa(t).resolveInner(e.head),o=i?ho.closedBy:ho.openedBy;for(let n=e.head;;){let e=i?r.childAfter(n):r.childBefore(n);if(!e)break;Gh(t,e,o)?r=e:n=i?e.to:e.from}return s=r.type.prop(o)&&(n=i?Ll(t,r.from,1):Ll(t,r.to,-1))&&n.matched?i?n.end.to:n.end.from:i?r.to:r.from,A.cursor(s,i?-1:1)}function Hh(t,e){return qh(t,(i=>{if(!i.empty)return Lh(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)}))}const Jh=t=>Hh(t,!1),Kh=t=>Hh(t,!0);function tc(t){let e,i=t.scrollDOM.clientHeighti.empty?t.moveVertically(i,e,n.height):Lh(i,e)));if(r.eq(s.selection))return!1;if(n.selfScroll){let e=t.coordsAtPos(s.selection.main.head),o=t.scrollDOM.getBoundingClientRect(),a=o.top+n.marginTop,l=o.bottom-n.marginBottom;e&&e.top>a&&e.bottomec(t,!1),nc=t=>ec(t,!0);function sc(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=A.cursor(n.from+i))}return s}function rc(t,e){let i=Uh(t.state.selection,(t=>{let i=e(t);return A.range(t.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)}));return!i.eq(t.state.selection)&&(t.dispatch(Yh(t.state,i)),!0)}function oc(t,e){return console.log("Select!"),rc(t,(i=>t.moveByCharSelected(i,e)))}const ac=t=>oc(t,!Ih(t)),lc=t=>oc(t,Ih(t));function hc(t,e){return rc(t,(i=>t.moveByGroup(i,e)))}function cc(t,e){return rc(t,(i=>t.moveVertically(i,e)))}const uc=t=>cc(t,!1),dc=t=>cc(t,!0);function fc(t,e){return rc(t,(i=>t.moveVertically(i,e,tc(t).height)))}const pc=t=>fc(t,!1),Oc=t=>fc(t,!0),gc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:0})),!0),mc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.doc.length})),!0),bc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:0})),!0),wc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0);function vc(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=yc(t,n,!0)),s=Math.min(s,n),r=Math.max(r,n)}else s=yc(t,s,!1),r=yc(t,r,!0);return s==r?{range:n}:{changes:{from:s,to:r},range:A.cursor(s)}}));return!s.changes.empty&&(t.dispatch(n.update(s,{scrollIntoView:!0,userEvent:i,effects:"delete.selection"==i?Ts.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function yc(t,e,i){if(t instanceof Ts)for(let n of t.state.facet(Ts.atomicRanges).map((e=>e(t))))n.between(e,e,((t,n)=>{te&&(e=i?n:t)}));return e}const Sc=(t,e)=>vc(t,(i=>{let n,s,{state:r}=t,o=r.doc.lineAt(i);if(!e&&i>o.from&&iSc(t,!1),kc=t=>Sc(t,!0),Qc=(t,e)=>vc(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 a=f(r.text,n-r.from,e)+r.from,l=r.text.slice(Math.min(n,a)-r.from,Math.max(n,a)-r.from),h=o(l);if(null!=t&&h!=t)break;" "==l&&n==i||(t=h),n=a}return n})),$c=t=>Qc(t,!1),Pc=t=>vc(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 _c(t,e,i){if(t.readOnly)return!1;let n=[],s=[];for(let e of Cc(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(A.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(A.range(t.anchor-o,t.head-o))}}return!!n.length&&(e(t.update({changes:n,scrollIntoView:!0,selection:A.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0)}function Xc(t,e,i){if(t.readOnly)return!1;let n=[];for(let e of Cc(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 Zc=Ac(!1);function Ac(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),a=!e&&s==r&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i,n=Xa(t).resolveInner(e),s=n.childBefore(e),r=n.childAfter(e);return s&&r&&s.to<=e&&r.from>=e&&(i=s.type.prop(ho.closedBy))&&i.indexOf(r.name)>-1&&t.doc.lineAt(s.to).from==t.doc.lineAt(r.from).from?{from:s.to,to:r.from}:null}(i,s);e&&(s=r=(r<=o.to?o:i.doc.lineAt(r)).to);let l=new ja(i,{simulateBreak:s,simulateDoubleBreak:!!a}),h=Ba(l,s);for(null==h&&(h=/^\s*/.exec(i.doc.lineAt(s).text)[0].length);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:A.range(r.mapPos(n.anchor,1),r.mapPos(n.head,1))}}))}const Rc=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{i.push({from:e.from,insert:t.facet(La)})})),{userEvent:"input.indent"})),!0),Ec=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{let n=/^\s*/.exec(e.text)[0];if(!n)return;let s=Yt(n,t.tabSize),r=0,o=Ia(t,Math.max(0,s-za(t)));for(;rqh(t,(e=>Fh(t.state,e,!Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,!Ih(t))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:t=>qh(t,(e=>Fh(t.state,e,Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,Ih(t))))},{key:"Alt-ArrowUp",run:({state:t,dispatch:e})=>_c(t,e,!1)},{key:"Shift-Alt-ArrowUp",run:({state:t,dispatch:e})=>Xc(t,e,!1)},{key:"Alt-ArrowDown",run:({state:t,dispatch:e})=>_c(t,e,!0)},{key:"Shift-Alt-ArrowDown",run:({state:t,dispatch:e})=>Xc(t,e,!0)},{key:"Escape",run:({state:t,dispatch:e})=>{let i=t.selection,n=null;return i.ranges.length>1?n=A.create([i.main]):i.main.empty||(n=A.create([A.cursor(i.main.head)])),!!n&&(e(Yh(t,n)),!0)}},{key:"Mod-Enter",run:Ac(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:t,dispatch:e})=>{let i=Cc(t).map((({from:e,to:i})=>A.range(e,Math.min(i+1,t.doc.length))));return e(t.update({selection:A.create(i),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:t,dispatch:e})=>{let i=Uh(t.selection,(e=>{var i;let n=Xa(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 A.range(n.to,n.from)}));return e(Yh(t,i)),!0},preventDefault:!0},{key:"Mod-[",run:Ec},{key:"Mod-]",run:Rc},{key:"Mod-Alt-\\",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new ja(t,{overrideIndentation:t=>{let e=i[t];return null==e?-1:e}}),s=Tc(t,((e,s,r)=>{let o=Ba(n,e.from);if(null==o)return;/\S/.test(e.text)||(o=0);let a=/^\s*/.exec(e.text)[0],l=Ia(t,o);(a!=l||r.from{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(Cc(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=Uh(t.selection,(e=>{let s=Ll(t,e.head,-1)||Ll(t,e.head,1)||e.head>0&&Ll(t,e.head-1,1)||e.head{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=fh(t.state,i.from);return n.line?ch(t):!!n.block&&dh(t)}},{key:"Alt-A",run:uh}].concat([{key:"ArrowLeft",run:Bh,shift:ac,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:t=>Nh(t,!Ih(t)),shift:t=>hc(t,!Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:t=>qh(t,(e=>sc(t,e,!Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,!Ih(t)))),preventDefault:!0},{key:"ArrowRight",run:jh,shift:lc,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:t=>Nh(t,Ih(t)),shift:t=>hc(t,Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:t=>qh(t,(e=>sc(t,e,Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,Ih(t)))),preventDefault:!0},{key:"ArrowUp",run:Jh,shift:uc,preventDefault:!0},{mac:"Cmd-ArrowUp",run:gc,shift:bc},{mac:"Ctrl-ArrowUp",run:ic,shift:pc},{key:"ArrowDown",run:Kh,shift:dc,preventDefault:!0},{mac:"Cmd-ArrowDown",run:mc,shift:wc},{mac:"Ctrl-ArrowDown",run:nc,shift:Oc},{key:"PageUp",run:ic,shift:pc},{key:"PageDown",run:nc,shift:Oc},{key:"Home",run:t=>qh(t,(e=>sc(t,e,!1))),shift:t=>rc(t,(e=>sc(t,e,!1))),preventDefault:!0},{key:"Mod-Home",run:gc,shift:bc},{key:"End",run:t=>qh(t,(e=>sc(t,e,!0))),shift:t=>rc(t,(e=>sc(t,e,!0))),preventDefault:!0},{key:"Mod-End",run:mc,shift:wc},{key:"Enter",run:Zc},{key:"Mod-a",run:({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:xc,shift:xc},{key:"Delete",run:kc},{key:"Mod-Backspace",mac:"Alt-Backspace",run:$c},{key:"Mod-Delete",mac:"Alt-Delete",run:t=>Qc(t,!0)},{mac:"Mod-Backspace",run:t=>vc(t,(e=>{let i=t.lineBlockAt(e).from;return e>i?i:Math.max(0,e-1)}))},{mac:"Mod-Delete",run:Pc}].concat([{key:"Ctrl-b",run:Bh,shift:ac,preventDefault:!0},{key:"Ctrl-f",run:jh,shift:lc},{key:"Ctrl-p",run:Jh,shift:uc},{key:"Ctrl-n",run:Kh,shift:dc},{key:"Ctrl-a",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).from,1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).from)))},{key:"Ctrl-e",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).to,-1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).to)))},{key:"Ctrl-d",run:kc},{key:"Ctrl-h",run:xc},{key:"Ctrl-k",run:Pc},{key:"Ctrl-Alt-h",run:$c},{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:A.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:f(n.text,i-n.from,!1)+n.from,r=i==n.to?i+1:f(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:A.cursor(r)}}));return!i.changes.empty&&(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:nc}].map((t=>({mac:t.key,run:t.run,shift:t.shift})))));function Mc(){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 Uc{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(Wc(t)):Wc,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 b(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=w(t),i=this.bufferStart+this.bufferPos;this.bufferPos+=v(t);let n=this.normalize(e);for(let t=0,s=i;;t++){let r=n.charCodeAt(t),o=this.match(r,s);if(o)return this.value=o,this;if(t==n.length-1)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=jc(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 Ic(e,t.sliceString(e,i));return zc.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=jc(this.text,i+(t==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ic.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function jc(t,e){if(e>=t.length)return e;let i,n=t.lineAt(e);for(;e=56320&&i<57344;)e++;return e}function Nc(t){let e=Mc("input",{class:"cm-textfield",name:"line"});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,a,l]=i,h=a?+a.slice(1):0,c=o?+o:s.number;if(o&&l){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)));t.dispatch({effects:Gc.of(!1),selection:A.cursor(u.from+Math.max(0,Math.min(h,u.length))),scrollIntoView:!0}),t.focus()}return{dom:Mc("form",{class:"cm-gotoLine",onkeydown:e=>{27==e.keyCode?(e.preventDefault(),t.dispatch({effects:Gc.of(!1)}),t.focus()):13==e.keyCode&&(e.preventDefault(),i())},onsubmit:t=>{t.preventDefault(),i()}},Mc("label",t.state.phrase("Go to line"),": ",e)," ",Mc("button",{class:"cm-button",type:"submit"},t.state.phrase("go")))}}"undefined"!=typeof Symbol&&(Lc.prototype[Symbol.iterator]=Bc.prototype[Symbol.iterator]=function(){return this});const Gc=ut.define(),Fc=q.define({create:()=>!0,update(t,e){for(let i of e.effects)i.is(Gc)&&(t=i.value);return t},provide:t=>Ur.from(t,(t=>t?Nc:null))}),Hc=Ts.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),Jc={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Kc=E.define({combine:t=>kt(t,Jc,{highlightWordAroundCursor:(t,e)=>t||e,minSelectionLength:Math.min,maxMatches:Math.min})});function tu(t){let e=[ru,su];return t&&e.push(Kc.of(t)),e}const eu=ni.mark({class:"cm-selectionMatch"}),iu=ni.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function nu(t,e,i,n){return!(0!=i&&t(e.sliceDoc(i-1,i))==wt.Word||n!=e.doc.length&&t(e.sliceDoc(n,n+1))==wt.Word)}const su=_i.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(Kc),{state:i}=t,n=i.selection;if(n.ranges.length>1)return ni.none;let s,r=n.main,o=null;if(r.empty){if(!e.highlightWordAroundCursor)return ni.none;let t=i.wordAt(r.head);if(!t)return ni.none;o=i.charCategorizer(r.head),s=i.sliceDoc(t.from,t.to)}else{let t=r.to-r.from;if(t200)return ni.none;if(e.wholeWords){if(s=i.sliceDoc(r.from,r.to),o=i.charCategorizer(r.head),!nu(o,i,r.from,r.to)||!function(t,e,i,n){return t(e.sliceDoc(i,i+1))==wt.Word&&t(e.sliceDoc(n-1,n))==wt.Word}(o,i,r.from,r.to))return ni.none}else if(s=i.sliceDoc(r.from,r.to).trim(),!s)return ni.none}let a=[];for(let n of t.visibleRanges){let t=new Uc(i.doc,s,n.from,n.to);for(;!t.next().done;){let{from:n,to:s}=t.value;if((!o||nu(o,i,n,s))&&(r.empty&&n<=r.from&&s>=r.to?a.push(iu.range(n,s)):(n>=r.to||s<=r.from)&&a.push(eu.range(n,s)),a.length>e.maxMatches))return ni.none}}return ni.set(a)}},{decorations:t=>t.decorations}),ru=Ts.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});const ou=E.define({combine:t=>kt(t,{top:!1,caseSensitive:!1,literal:!1,wholeWord:!1,createPanel:t=>new Eu(t),scrollToMatch:t=>Ts.scrollIntoView(t)})});class au{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,qc),!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 pu(this):new cu(this)}getCursor(t,e=0,i){let n=t.doc?t:xt.create({doc:t});return null==i&&(i=n.doc.length),this.regexp?uu(this,n,e,i):hu(this,n,e,i)}}class lu{constructor(t){this.spec=t}}function hu(t,e,i,n){return new Uc(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=hu(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 uu(t,e,i,n){return new Lc(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?(s=e.charCategorizer(e.selection.main.head),(t,e,i)=>!i[0].length||(s(du(i.input,i.index))!=wt.Word||s(fu(i.input,i.index))!=wt.Word)&&(s(fu(i.input,i.index+i[0].length))!=wt.Word||s(du(i.input,i.index+i[0].length))!=wt.Word)):void 0},i,n);var s}function du(t,e){return t.slice(f(t,e,!1),e)}function fu(t,e){return t.slice(e,f(t,e))}class pu extends lu{nextMatch(t,e,i){let n=uu(this.spec,t,i,t.doc.length).next();return n.done&&(n=uu(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=uu(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=uu(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 Ou=ut.define(),gu=ut.define(),mu=q.define({create:t=>new bu(_u(t).create(),null),update(t,e){for(let i of e.effects)i.is(Ou)?t=new bu(i.value.create(),t.panel):i.is(gu)&&(t=new bu(t.query,i.value?Cu:null));return t},provide:t=>Ur.from(t,(t=>t.panel))});class bu{constructor(t,e){this.query=t,this.panel=e}}const wu=ni.mark({class:"cm-searchMatch"}),vu=ni.mark({class:"cm-searchMatch cm-searchMatch-selected"}),yu=_i.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(mu))}update(t){let e=t.state.field(mu);(e!=t.startState.field(mu)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ni.none;let{view:i}=this,n=new Xt;for(let e=0,s=i.visibleRanges,r=s.length;es[e+1].from-500;)a=s[++e].to;t.highlight(i.state,o,a,((t,e)=>{let s=i.state.selection.ranges.some((i=>i.from==t&&i.to==e));n.add(t,e,s?vu:wu)}))}return n.finish()}},{decorations:t=>t.decorations});function Su(t){return e=>{let i=e.state.field(mu,!1);return i&&i.query.spec.valid?t(e,i):Au(e)}}const xu=Su(((t,{query:e})=>{let{to:i}=t.state.selection.main,n=e.nextMatch(t.state,i,i);if(!n)return!1;let s=A.single(n.from,n.to),r=t.state.facet(ou);return t.dispatch({selection:s,effects:[Wu(t,n),r.scrollToMatch(s.main,t)],userEvent:"select.search"}),Zu(t),!0})),ku=Su(((t,{query:e})=>{let{state:i}=t,{from:n}=i.selection.main,s=e.prevMatch(i,n,n);if(!s)return!1;let r=A.single(s.from,s.to),o=t.state.facet(ou);return t.dispatch({selection:r,effects:[Wu(t,s),o.scrollToMatch(r.main,t)],userEvent:"select.search"}),Zu(t),!0})),Qu=Su(((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!(!i||!i.length)&&(t.dispatch({selection:A.create(i.map((t=>A.range(t.from,t.to)))),userEvent:"select.search.matches"}),!0)})),$u=Su(((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,a,l=[],h=[];if(r.from==n&&r.to==s&&(a=i.toText(e.getReplacement(r)),l.push({from:r.from,to:r.to,insert:a}),r=e.nextMatch(i,r.from,r.to),h.push(Ts.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(n).number)+"."))),r){let e=0==l.length||l[0].from>=r.to?0:r.to-r.from-a.length;o=A.single(r.from-e,r.to-e),h.push(Wu(t,r)),h.push(i.facet(ou).scrollToMatch(o.main,t))}return t.dispatch({changes:l,selection:o,effects:h,userEvent:"input.replace"}),!0})),Pu=Su(((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:Ts.announce.of(n),userEvent:"input.replace.all"}),!0}));function Cu(t){return t.state.facet(ou).createPanel(t)}function _u(t,e){var i,n,s,r;let o=t.selection.main,a=o.empty||o.to>o.from+100?"":t.sliceDoc(o.from,o.to);if(e&&!a)return e;let l=t.facet(ou);return new au({search:(null!==(i=null==e?void 0:e.literal)&&void 0!==i?i:l.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:null!==(n=null==e?void 0:e.caseSensitive)&&void 0!==n?n:l.caseSensitive,literal:null!==(s=null==e?void 0:e.literal)&&void 0!==s?s:l.literal,wholeWord:null!==(r=null==e?void 0:e.wholeWord)&&void 0!==r?r:l.wholeWord})}function Xu(t){let e=Vr(t,Cu);return e&&e.dom.querySelector("[main-field]")}function Zu(t){let e=Xu(t);e&&e==t.root.activeElement&&e.select()}const Au=t=>{let e=t.state.field(mu,!1);if(e&&e.panel){let i=Xu(t);if(i&&i!=t.root.activeElement){let n=_u(t.state,e.query.spec);n.valid&&t.dispatch({effects:Ou.of(n)}),i.focus(),i.select()}}else t.dispatch({effects:[gu.of(!0),e?Ou.of(_u(t.state,e.query.spec)):ut.appendConfig.of(Yu)]});return!0},Tu=t=>{let e=t.state.field(mu,!1);if(!e||!e.panel)return!1;let i=Vr(t,Cu);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:gu.of(!1)}),!0},Ru=[{key:"Mod-f",run:Au,scope:"editor search-panel"},{key:"F3",run:xu,shift:ku,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:xu,shift:ku,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Tu,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 Uc(t.doc,t.sliceDoc(n,s));!e.next().done;){if(r.length>1e3)return!1;e.value.from==n&&(o=r.length),r.push(A.range(e.value.from,e.value.to))}return e(t.update({selection:A.create(r,o),userEvent:"select.search.matches"})),!0}},{key:"Alt-g",run:t=>{let e=Vr(t,Nc);if(!e){let i=[Gc.of(!0)];null==t.state.field(Fc,!1)&&i.push(ut.appendConfig.of([Fc,Hc])),t.dispatch({effects:i}),e=Vr(t,Nc)}return e&&e.dom.querySelector("input").focus(),!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=A.create(i.ranges.map((e=>t.wordAt(e.head)||A.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 Uc(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 Uc(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(A.range(s.from,s.to),!1),effects:Ts.scrollIntoView(s.to)})),!0)},preventDefault:!0}];class Eu{constructor(t){this.view=t;let e=this.query=t.state.field(mu).query.spec;function i(t,e,i){return Mc("button",{class:"cm-button",name:t,onclick:e,type:"button"},i)}this.commit=this.commit.bind(this),this.searchField=Mc("input",{value:e.search,placeholder:Vu(t,"Find"),"aria-label":Vu(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Mc("input",{value:e.replace,placeholder:Vu(t,"Replace"),"aria-label":Vu(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Mc("input",{type:"checkbox",name:"case",form:"",checked:e.caseSensitive,onchange:this.commit}),this.reField=Mc("input",{type:"checkbox",name:"re",form:"",checked:e.regexp,onchange:this.commit}),this.wordField=Mc("input",{type:"checkbox",name:"word",form:"",checked:e.wholeWord,onchange:this.commit}),this.dom=Mc("div",{onkeydown:t=>this.keydown(t),class:"cm-search"},[this.searchField,i("next",(()=>xu(t)),[Vu(t,"next")]),i("prev",(()=>ku(t)),[Vu(t,"previous")]),i("select",(()=>Qu(t)),[Vu(t,"all")]),...t.state.readOnly?[]:[Mc("br"),this.replaceField,i("replace",(()=>$u(t)),[Vu(t,"replace")]),i("replaceAll",(()=>Pu(t)),[Vu(t,"replace all")])],Mc("button",{name:"close",onclick:()=>Tu(t),"aria-label":Vu(t,"close"),type:"button"},["×"])])}commit(){let t=new au({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:Ou.of(t)}))}keydown(t){var e,i,n;e=this.view,i=t,n="search-panel",Bs(Ls(e.state),i,e,n)?t.preventDefault():13==t.keyCode&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?ku:xu)(this.view)):13==t.keyCode&&t.target==this.replaceField&&(t.preventDefault(),$u(this.view))}update(t){for(let e of t.transactions)for(let t of e.effects)t.is(Ou)&&!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(ou).top}}function Vu(t,e){return t.state.phrase(e)}const Mu=30,Du=/[\s\.,:;?!]/;function Wu(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-Mu),o=Math.min(s,i+Mu),a=t.state.sliceDoc(r,o);if(r!=n.from)for(let t=0;ta.length-Mu;t--)if(!Du.test(a[t-1])&&Du.test(a[t])){a=a.slice(0,t);break}return Ts.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${n.number}.`)}const Uu=Ts.baseTheme({".cm-panel.cm-search":{padding:"0.25rem 0.5rem 0.25rem 0.5rem",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"0.5rem",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"}}),Yu=[mu,N.lowest(yu),Uu];class qu{constructor(t,e,i){this.state=t,this.pos=e,this.explicit=i,this.abortListeners=[]}tokenBefore(t){let e=Xa(this.state).resolveInner(this.pos,-1);for(;e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null}matchBefore(t){let e=this.state.doc.lineAt(this.pos),i=Math.max(e.from,this.pos-250),n=e.text.slice(i-e.from,this.pos-e.from),s=n.search(ju(t,!1));return s<0?null:{from:i+s,to:this.pos,text:n.slice(s)}}get aborted(){return null==this.abortListeners}addEventListener(t,e){"abort"==t&&this.abortListeners&&this.abortListeners.push(e)}}function Lu(t){let e=Object.keys(t).join(""),i=/\w/.test(e);return i&&(e=e.replace(/\w/g,"")),`[${i?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function zu(t){let e=t.map((t=>"string"==typeof t?{label:t}:t)),[i,n]=e.every((t=>/^\w+$/.test(t.label)))?[/\w*$/,/\w+$/]:function(t){let e=Object.create(null),i=Object.create(null);for(let{label:n}of t){e[n[0]]=!0;for(let t=1;t{let s=t.matchBefore(n);return s||t.explicit?{from:s?s.from:t.pos,options:e,validFor:i}:null}}class Iu{constructor(t,e,i,n){this.completion=t,this.source=e,this.match=i,this.score=n}}function Bu(t){return t.selection.main.from}function ju(t,e){var i;let{source:n}=t,s=e&&"^"!=n[0],r="$"!=n[n.length-1];return s||r?new RegExp(`${s?"^":""}(?:${n})${r?"$":""}`,null!==(i=t.flags)&&void 0!==i?i:t.ignoreCase?"i":""):t}const Nu=lt.define();const Gu=new WeakMap;function Fu(t){if(!Array.isArray(t))return t;let e=Gu.get(t);return e||Gu.set(t,e=zu(t)),e}const Hu=ut.define(),Ju=ut.define();class Ku{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[];for(let e=0;e=48&&l<=57||l>=97&&l<=122?2:l>=65&&l<=90?1:0:(y=w(l))!=y.toLowerCase()?1:y!=y.toUpperCase()?2:0;(!n||1==S&&O||0==m&&0!=S)&&(e[c]==l||i[c]==l&&(u=!0)?r[c++]=n:r.length&&(g=!1)),m=S,n+=v(l)}return c==a&&0==r[0]&&g?this.result((u?-200:0)-100,r,t):d==a&&0==f?[-200-t.length+(p==t.length?0:-100),0,p]:o>-1?[-700-t.length,o,o+this.pattern.length]:d==a?[-900-t.length,f,p]:c==a?this.result((u?-200:0)-100-700+(g?0:-1100),r,t):2==e.length?null:this.result((n[0]?-700:0)-200-1100,n,t)}result(t,e,i){let n=[t-i.length],s=1;for(let t of e){let e=t+(this.astral?v(b(i,t)):1);s>1&&n[s-1]==t?n[s-1]=e:(n[s++]=t,n[s++]=e)}return n}}const td=E.define({combine:t=>kt(t,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:id,compareCompletions:(t,e)=>t.label.localeCompare(e.label),interactionDelay:75},{defaultKeymap:(t,e)=>t&&e,closeOnBlur:(t,e)=>t&&e,icons:(t,e)=>t&&e,tooltipClass:(t,e)=>i=>ed(t(i),e(i)),optionClass:(t,e)=>i=>ed(t(i),e(i)),addToOptions:(t,e)=>t.concat(e)})});function ed(t,e){return t?e?t+" "+e:t:e}function id(t,e,i,n,s){let r,o,a=t.textDirection==Wi.RTL,l=a,h=!1,c="top",u=e.left-s.left,d=s.right-e.right,f=n.right-n.left,p=n.bottom-n.top;if(l&&u=p||t>e.top?r=i.bottom-e.top:(c="bottom",r=e.bottom-i.top)}return{style:`${c}: ${r}px; max-width: ${o}px`,class:"cm-completionInfo-"+(h?a?"left-narrow":"right-narrow":l?"left":"right")}}function nd(t,e="option"){return i=>{let n=i.state.field(yd,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp-1?n.open.selected+r*(t?1:-1):t?0:o-1;return a<0?a="page"==e?0:o-1:a>=o&&(a="page"==e?o-1:0),i.dispatch({effects:vd.of(a)}),!0}}const sd=t=>{let e=t.state.field(yd,!1);return!(t.state.readOnly||!e||!e.open||e.open.selected<0||Date.now()-e.open.timestamp(t.selection||t.docChanged)&&!gd(t)));for(let e=0;e50&&Date.now()-n.time>1e3){for(let t of n.context.abortListeners)try{t()}catch(t){Qi(this.view.state,t)}n.context.abortListeners=null,this.running.splice(e--,1)}else n.updates.push(...t.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some((t=>1==t.state&&!this.running.some((e=>e.active.source==t.source))))?setTimeout((()=>this.startUpdate()),50):-1,0!=this.composing)for(let e of t.transactions)"input"==gd(e)?this.composing=2:2==this.composing&&e.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:t}=this.view,e=t.field(yd);for(let t of e.active)1!=t.state||this.running.some((e=>e.active.source==t.source))||this.startQuery(t)}startQuery(t){let{state:e}=this.view,i=Bu(e),n=new qu(e,i,t.explicitPos==i),s=new rd(t,n);this.running.push(s),Promise.resolve(t.source(n)).then((t=>{s.context.aborted||(s.done=t||null,this.scheduleAccept())}),(t=>{this.view.dispatch({effects:Ju.of(null)}),Qi(this.view.state,t)}))}scheduleAccept(){this.running.every((t=>void 0!==t.done))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((()=>this.accept()),50))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],i=this.view.state.facet(td);for(let n=0;nt.source==s.active.source));if(r&&1==r.state)if(null==s.done){let t=new md(s.active.source,0);for(let e of s.updates)t=t.update(e,i);1!=t.state&&e.push(t)}else this.startQuery(r)}e.length&&this.view.dispatch({effects:wd.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(yd,!1);if(e&&e.tooltip&&this.view.state.facet(td).closeOnBlur){let i=e.open&&Rr(this.view,e.open.tooltip);i&&i.dom.contains(t.relatedTarget)||this.view.dispatch({effects:Ju.of(null)})}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout((()=>this.view.dispatch({effects:Hu.of(!1)})),20),this.composing=0}}});function ad(t,e){const i=e.completion.apply||e.completion.label;let n=t.state.field(yd).active.find((t=>t.source==e.source));return n instanceof bd&&("string"==typeof i?t.dispatch(Object.assign(Object.assign({},function(t,e,i,n){let{main:s}=t.selection,r=i-s.from,o=n-s.from;return Object.assign(Object.assign({},t.changeByRange((a=>a!=s&&i!=n&&t.sliceDoc(a.from+r,a.from+o)!=t.sliceDoc(i,n)?{range:a}:{changes:{from:a.from+r,to:n==s.from?a.to:a.from+o,insert:e},range:A.cursor(a.from+r+e.length)}))),{userEvent:"input.complete"})}(t.state,i,n.from,n.to)),{annotations:Nu.of(e.completion)})):i(t,e.completion,n.from,n.to),!0)}function ld(t,e,i){if(t<=i)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let t=Math.floor(e/i);return{from:t*i,to:(t+1)*i}}let n=Math.floor((t-e)/i);return{from:t-(n+1)*i,to:t-n*i}}class hd{constructor(t,e){this.view=t,this.stateField=e,this.info=null,this.placeInfoReq={read:()=>this.measureInfo(),write:t=>this.placeInfo(t),key:this},this.space=null,this.currentClass="";let i=t.state.field(e),{options:n,selected:s}=i.open,r=t.state.facet(td);this.optionContent=function(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(t){let e=document.createElement("div");return e.classList.add("cm-completionIcon"),t.type&&e.classList.add(...t.type.split(/\s+/g).map((t=>"cm-completionIcon-"+t))),e.setAttribute("aria-hidden","true"),e},position:20}),e.push({render(t,e,i){let n=document.createElement("span");n.className="cm-completionLabel";let{label:s}=t,r=0;for(let t=1;tr&&n.appendChild(document.createTextNode(s.slice(r,e)));let a=n.appendChild(document.createElement("span"));a.appendChild(document.createTextNode(s.slice(e,o))),a.className="cm-completionMatchedText",r=o}return rt.position-e.position)).map((t=>t.render))}(r),this.optionClass=r.optionClass,this.tooltipClass=r.tooltipClass,this.range=ld(n.length,s,r.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",(e=>{for(let i,s=e.target;s&&s!=this.dom;s=s.parentNode)if("LI"==s.nodeName&&(i=/-(\d+)$/.exec(s.id))&&+i[1]{let i=t.state.field(this.stateField,!1);i&&i.tooltip&&t.state.facet(td).closeOnBlur&&e.relatedTarget!=t.contentDOM&&t.dispatch({effects:Ju.of(null)})})),this.list=this.dom.appendChild(this.createListBox(n,i.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))}mount(){this.updateSel()}update(t){var e,i,n;let s=t.state.field(this.stateField),r=t.startState.field(this.stateField);this.updateTooltipClass(t.state),s!=r&&(this.updateSel(),(null===(e=s.open)||void 0===e?void 0:e.disabled)!=(null===(i=r.open)||void 0===i?void 0:i.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!(null===(n=s.open)||void 0===n?void 0:n.disabled)))}updateTooltipClass(t){let e=this.tooltipClass(t);if(e!=this.currentClass){for(let t of this.currentClass.split(" "))t&&this.dom.classList.remove(t);for(let t of e.split(" "))t&&this.dom.classList.add(t);this.currentClass=e}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),e=t.open;if((e.selected>-1&&e.selected=this.range.to)&&(this.range=ld(e.options.length,e.selected,this.view.state.facet(td).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e.options,t.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))),this.updateSelectedOption(e.selected)){this.info&&(this.info.remove(),this.info=null);let{completion:i}=e.options[e.selected],{info:n,label:s,c:r}=i;if(!n)return;let o="string"==typeof n?document.createTextNode(n+" "):n(i);if(!o)return;if(!r){const t=document.createElement("span");t.appendChild(o),o=t;const e=document.createElement("a");e.innerText="🔎",e.href="/docFind/"+s,e.target="blank",o.appendChild(e)}if(!o)return;"then"in o?o.then((e=>{e&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(e)})).catch((t=>Qi(this.view.state,t,"completion info"))):this.addInfoPane(o)}}addInfoPane(t){let e=this.info=document.createElement("div");e.className="cm-tooltip cm-completionInfo",e.appendChild(t),this.dom.appendChild(e),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let e=null;for(let i=this.list.firstChild,n=this.range.from;i;i=i.nextSibling,n++)"LI"==i.nodeName&&i.id?n==t?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),e=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected"):n--;return e&&function(t,e){let i=t.getBoundingClientRect(),n=e.getBoundingClientRect();n.topi.bottom&&(t.scrollTop+=n.bottom-i.bottom)}(this.list,e),e}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let e=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),n=t.getBoundingClientRect(),s=this.space;if(!s){let t=this.dom.ownerDocument.defaultView||window;s={left:0,top:0,right:t.innerWidth,bottom:t.innerHeight}}return n.top>Math.min(s.bottom,e.bottom)-10||n.bottomi.from||0==i.from))if(s=t,"string"!=typeof l&&l.header)n.appendChild(l.header(l));else{n.appendChild(document.createElement("completion-section")).textContent=t}}const h=n.appendChild(document.createElement("li"));h.id=e+"-"+r,h.setAttribute("role","option");let c=this.optionClass(o);c&&(h.className=c);for(let t of this.optionContent){let e=t(o,this.view.state,a);e&&h.appendChild(e)}}return i.from&&n.classList.add("cm-completionListIncompleteTop"),i.to=this.options.length?this:new ud(this.options,pd(e,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,e,i,n,s){let r=function(t,e){let i=[],n=null,s=t=>{i.push(t);let{section:e}=t.completion;if(e){n||(n=[]);let t="string"==typeof e?e:e.name;n.some((e=>e.name==t))||n.push("string"==typeof e?{name:t}:e)}};for(let n of t)if(n.hasResult())if(!1===n.result.filter){let t=n.result.getMatch;for(let e of n.result.options){let r=[1e9-i.length];if(t)for(let i of t(e))r.push(i);s(new Iu(e,n.source,r,r[0]))}}else{let t,i=new Ku(e.sliceDoc(n.from,n.to));for(let e of n.result.options)(t=i.match(e.label))&&s(new Iu(e,n.source,t,t[0]+(e.boost||0)))}if(n){let t=Object.create(null),e=0,s=(t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:1e9)-(null!==(n=e.rank)&&void 0!==n?n:1e9)||(t.namee.score-t.score||a(t.completion,e.completion))))!o||o.label!=t.completion.label||o.detail!=t.completion.detail||null!=o.type&&null!=t.completion.type&&o.type!=t.completion.type||o.apply!=t.completion.apply?r.push(t):cd(t.completion)>cd(o)&&(r[r.length-1]=t),o=t.completion;return r}(t,e);if(!r.length)return n&&t.some((t=>1==t.state))?new ud(n.options,n.attrs,n.tooltip,n.timestamp,n.selected,!0):null;let o=e.facet(td).selectOnOpen?0:-1;if(n&&n.selected!=o&&-1!=n.selected){let t=n.options[n.selected].completion;for(let e=0;ee.hasResult()?Math.min(t,e.from):t),1e8),create:(a=yd,t=>new hd(t,a)),above:s.aboveCursor},n?n.timestamp:Date.now(),o,!1);var a}map(t){return new ud(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class dd{constructor(t,e,i){this.active=t,this.id=e,this.open=i}static start(){return new dd(Od,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(t){let{state:e}=t,i=e.facet(td),n=(i.override||e.languageDataAt("autocomplete",Bu(e)).map(Fu)).map((e=>(this.active.find((t=>t.source==e))||new md(e,this.active.some((t=>0!=t.state))?1:0)).update(t,i)));n.length==this.active.length&&n.every(((t,e)=>t==this.active[e]))&&(n=this.active);let s=this.open;s&&t.docChanged&&(s=s.map(t.changes)),t.selection||n.some((e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to)))||!function(t,e){if(t==e)return!0;for(let i=0,n=0;;){for(;i1==t.state))&&(s=null),!s&&n.every((t=>1!=t.state))&&n.some((t=>t.hasResult()))&&(n=n.map((t=>t.hasResult()?new md(t.source,0):t)));for(let e of t.effects)e.is(vd)&&(s=s&&s.setSelected(e.value,this.id));return n==this.active&&s==this.open?this:new dd(n,this.id,s)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:fd}}const fd={"aria-autocomplete":"list"};function pd(t,e){let i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(i["aria-activedescendant"]=t+"-"+e),i}const Od=[];function gd(t){return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null}class md{constructor(t,e,i=-1){this.source=t,this.state=e,this.explicitPos=i}hasResult(){return!1}update(t,e){let i=gd(t),n=this;i?n=n.handleUserEvent(t,i,e):t.docChanged?n=n.handleChange(t):t.selection&&0!=n.state&&(n=new md(n.source,0));for(let e of t.effects)if(e.is(Hu))n=new md(n.source,1,e.value?Bu(t.state):-1);else if(e.is(Ju))n=new md(n.source,0);else if(e.is(wd))for(let t of e.value)t.source==n.source&&(n=t);return n}handleUserEvent(t,e,i){return"delete"!=e&&i.activateOnTyping?new md(this.source,1):this.map(t.changes)}handleChange(t){return t.changes.touchesRange(Bu(t.startState))?new md(this.source,0):this.map(t.changes)}map(t){return t.empty||this.explicitPos<0?this:new md(this.source,this.state,t.mapPos(this.explicitPos))}}class bd extends md{constructor(t,e,i,n,s){super(t,2,e),this.result=i,this.from=n,this.to=s}hasResult(){return!0}handleUserEvent(t,e,i){var n;let s=t.changes.mapPos(this.from),r=t.changes.mapPos(this.to,1),o=Bu(t.state);if((this.explicitPos<0?o<=s:or||"delete"==e&&Bu(t.startState)==this.from)return new md(this.source,"input"==e&&i.activateOnTyping?1:0);let a,l=this.explicitPos<0?-1:t.changes.mapPos(this.explicitPos);return function(t,e,i,n){if(!t)return!1;let s=e.sliceDoc(i,n);return"function"==typeof t?t(s,i,n,e):ju(t,!0).test(s)}(this.result.validFor,t.state,s,r)?new bd(this.source,l,this.result,s,r):this.result.update&&(a=this.result.update(this.result,s,r,new qu(t.state,o,l>=0)))?new bd(this.source,l,a,a.from,null!==(n=a.to)&&void 0!==n?n:Bu(t.state)):new md(this.source,1,l)}handleChange(t){return t.changes.touchesRange(this.from,this.to)?new md(this.source,0):this.map(t.changes)}map(t){return t.empty?this:new bd(this.source,this.explicitPos<0?-1:t.mapPos(this.explicitPos),this.result,t.mapPos(this.from),t.mapPos(this.to,1))}}const wd=ut.define({map:(t,e)=>t.map((t=>t.map(e)))}),vd=ut.define(),yd=q.define({create:()=>dd.start(),update:(t,e)=>t.update(e),provide:t=>[Tr.from(t,(t=>t.tooltip)),Ts.contentAttributes.from(t,(t=>t.attrs))]}),Sd=Ts.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class xd{constructor(t,e,i,n){this.field=t,this.line=e,this.from=i,this.to=n}}class kd{constructor(t,e,i){this.field=t,this.from=e,this.to=i}map(t){let e=t.mapPos(this.from,-1,S.TrackDel),i=t.mapPos(this.to,1,S.TrackDel);return null==e||null==i?null:new kd(this.field,e,i)}}class Qd{constructor(t,e){this.lines=t,this.fieldPositions=e}instantiate(t,e){let i=[],n=[e],s=t.doc.lineAt(e),r=/^\s*/.exec(s.text)[0];for(let s of this.lines){if(i.length){let i=r,o=/^\t*/.exec(s)[0].length;for(let e=0;enew kd(t.field,n[t.line]+t.from,n[t.line]+t.to)));return{text:i,ranges:o}}static parse(t){let e,i=[],n=[],s=[];for(let r of t.split(/\r\n?|\n/)){for(;e=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(r);){let t=e[1]?+e[1]:null,o=e[2]||e[3]||"",a=-1;for(let e=0;e=a&&t.field++}s.push(new xd(a,n.length,e.index,e.index+o.length)),r=r.slice(0,e.index)+o+r.slice(e.index+e[0].length)}for(let t;t=/\\([{}])/.exec(r);){r=r.slice(0,t.index)+t[1]+r.slice(t.index+t[0].length);for(let e of s)e.line==n.length&&e.from>t.index&&(e.from--,e.to--)}n.push(r)}return new Qd(n,s)}}let $d=ni.widget({widget:new class extends ei{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),Pd=ni.mark({class:"cm-snippetField"});class Cd{constructor(t,e){this.ranges=t,this.active=e,this.deco=ni.set(t.map((t=>(t.from==t.to?$d:Pd).range(t.from,t.to))))}map(t){let e=[];for(let i of this.ranges){let n=i.map(t);if(!n)return null;e.push(n)}return new Cd(e,this.active)}selectionInsideField(t){return t.ranges.every((t=>this.ranges.some((e=>e.field==this.active&&e.from<=t.from&&e.to>=t.to))))}}const _d=ut.define({map:(t,e)=>t&&t.map(e)}),Xd=ut.define(),Zd=q.define({create:()=>null,update(t,e){for(let i of e.effects){if(i.is(_d))return i.value;if(i.is(Xd)&&t)return new Cd(t.ranges,i.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>Ts.decorations.from(t,(t=>t?t.deco:ni.none))});function Ad(t,e){return A.create(t.filter((t=>t.field==e)).map((t=>A.range(t.from,t.to))))}function Td(e){let i=Qd.parse(e);return(e,n,s,r)=>{let{text:o,ranges:a}=i.instantiate(e.state,s),l={changes:{from:s,to:r,insert:t.of(o)},scrollIntoView:!0,annotations:n?Nu.of(n):void 0};if(a.length&&(l.selection=Ad(a,0)),a.length>1){let t=new Cd(a,0),i=l.effects=[_d.of(t)];void 0===e.state.field(Zd,!1)&&i.push(ut.appendConfig.of([Zd,Md,Wd,Sd]))}e.dispatch(e.state.update(l))}}function Rd(t){return({state:e,dispatch:i})=>{let n=e.field(Zd,!1);if(!n||t<0&&0==n.active)return!1;let s=n.active+t,r=t>0&&!n.ranges.some((e=>e.field==s+t));return i(e.update({selection:Ad(n.ranges,s),effects:_d.of(r?null:new Cd(n.ranges,s))})),!0}}const Ed=[{key:"Tab",run:Rd(1),shift:Rd(-1)},{key:"Escape",run:({state:t,dispatch:e})=>!!t.field(Zd,!1)&&(e(t.update({effects:_d.of(null)})),!0)}],Vd=E.define({combine:t=>t.length?t[0]:Ed}),Md=N.highest(Ys.compute([Vd],(t=>t.facet(Vd))));function Dd(t,e){return Object.assign(Object.assign({},e),{apply:Td(t)})}const Wd=Ts.domEventHandlers({mousedown(t,e){let i,n=e.state.field(Zd,!1);if(!n||null==(i=e.posAtCoords({x:t.clientX,y:t.clientY})))return!1;let s=n.ranges.find((t=>t.from<=i&&t.to>=i));return!(!s||s.field==n.active)&&(e.dispatch({selection:Ad(n.ranges,s.field),effects:_d.of(n.ranges.some((t=>t.field>s.field))?new Cd(n.ranges,s.field):null)}),!0)}}),Ud=new class extends Qt{};function Yd(t={}){return[yd,td.of(t),od,Ld,Sd]}Ud.startSide=1,Ud.endSide=-1;const qd=[{key:"Ctrl-Space",run:t=>!!t.state.field(yd,!1)&&(t.dispatch({effects:Hu.of(!0)}),!0)},{key:"Escape",run:t=>{let e=t.state.field(yd,!1);return!(!e||!e.active.some((t=>0!=t.state)))&&(t.dispatch({effects:Ju.of(null)}),!0)}},{key:"ArrowDown",run:nd(!0)},{key:"ArrowUp",run:nd(!1)},{key:"PageDown",run:nd(!0,"page")},{key:"PageUp",run:nd(!1,"page")},{key:"Enter",run:sd}],Ld=N.highest(Ys.computeN([td],(t=>t.facet(td).defaultKeymap?[qd]:[]))),zd=(()=>[vr(),Sh(),ir(),$l(_l,{fallback:!0}),Ys.of([...Vc,...Wh])])();class Id{constructor(t,e,i,n,s,r,o,a,l,h=0,c){this.p=t,this.stack=e,this.state=i,this.reducePos=n,this.pos=s,this.score=r,this.buffer=o,this.bufferBase=a,this.curContext=l,this.lookAhead=h,this.parent=c}toString(){return`[${this.stack.filter(((t,e)=>e%3==0)).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,i=0){let n=t.parser.context;return new Id(t,[],e,i,i,0,[],0,n?new Bd(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let i=t>>19,n=65535&t,{parser:s}=this.p,r=s.dynamicPrecedence(n);if(r&&(this.score+=r),0==i)return this.pushState(s.getGoto(this.state,n,!0),this.reducePos),n=2e3&&!(null===(e=this.p.parser.nodeSet.types[n])||void 0===e?void 0:e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=l):this.p.lastBigReductionSizeo;)this.stack.pop();this.reduceContext(n,a)}storeNode(t,e,i,n=4,s=!1){if(0==t&&(!this.stack.length||this.stack[this.stack.length-1]0&&0==t.buffer[n-4]&&t.buffer[n-1]>-1){if(e==i)return;if(t.buffer[n-2]>=e)return void(t.buffer[n-2]=i)}}if(s&&this.pos!=i){let s=this.buffer.length;if(s>0&&0!=this.buffer[s-4])for(;s>0&&this.buffer[s-2]>i;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,n>4&&(n-=4);this.buffer[s]=t,this.buffer[s+1]=e,this.buffer[s+2]=i,this.buffer[s+3]=n}else this.buffer.push(t,e,i,n)}shift(t,e,i){let n=this.pos;if(131072&t)this.pushState(65535&t,this.pos);else if(0==(262144&t)){let s=t,{parser:r}=this.p;(i>this.pos||e<=r.maxNode)&&(this.pos=i,r.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,n),this.shiftContext(e,n),e<=r.maxNode&&this.buffer.push(e,n,i,4)}else this.pos=i,this.shiftContext(e,n),e<=this.p.parser.maxNode&&this.buffer.push(e,n,i,4)}apply(t,e,i){65536&t?this.reduce(t):this.shift(t,e,i)}useNode(t,e){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=t)&&(this.p.reused.push(t),i++);let n=this.pos;this.reducePos=this.pos=n+t.length,this.pushState(e,n),this.buffer.push(i,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let i=t.buffer.slice(e),n=t.bufferBase+e;for(;t&&n==t.bufferBase;)t=t.parent;return new Id(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,n,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let i=t<=this.p.parser.maxNode;i&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,i?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new Nd(this);;){let i=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(0==i)return!1;if(0==(65536&i))return!0;e.reduce(i)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let n,s=0;s1&e&&t==n))||i.push(e[t],n)}e=i}let i=[];for(let t=0;t>19,n=65535&t,s=this.stack.length-3*i;if(s<0||e.getGoto(this.stack[s],n,!1)<0)return!1;this.storeNode(0,this.reducePos,this.reducePos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:t}=this.p;return 65535==t.data[t.stateSlot(this.state,1)]&&!t.stateSlot(this.state,4)}restart(){this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;ethis.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Bd{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}var jd;!function(t){t[t.Insert=200]="Insert",t[t.Delete=190]="Delete",t[t.Reduce=100]="Reduce",t[t.MaxNext=4]="MaxNext",t[t.MaxInsertStackDepth=300]="MaxInsertStackDepth",t[t.DampenInsertStackDepth=120]="DampenInsertStackDepth",t[t.MinBigReduction=2e3]="MinBigReduction"}(jd||(jd={}));class Nd{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=65535&t,i=t>>19;0==i?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(i-1);let n=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=n}}class Gd{constructor(t,e,i){this.stack=t,this.pos=e,this.index=i,this.buffer=t.buffer,0==this.index&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new Gd(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;null!=t&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new Gd(this.stack,this.pos,this.index)}}function Fd(t,e=Uint16Array){if("string"!=typeof t)return t;let i=null;for(let n=0,s=0;n=92&&e--,e>=34&&e--;let s=e-32;if(s>=46&&(s-=46,i=!0),r+=s,i)break;r*=46}i?i[s++]=r:i=new e(r)}return i}class Hd{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Jd=new Hd;class Kd{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Jd,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let i=this.range,n=this.rangeIndex,s=this.pos+t;for(;si.to:s>=i.to;){if(n==this.ranges.length-1)return null;let t=this.ranges[++n];s+=t.from-i.to,i=t}return s}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,e.from);return this.end}peek(t){let e,i,n=this.chunkOff+t;if(n>=0&&n=this.chunk2Pos&&en.to&&(this.chunk2=this.chunk2.slice(0,n.to-e)),i=this.chunk2.charCodeAt(0)}}return e>=this.token.lookAhead&&(this.token.lookAhead=e+1),i}acceptToken(t,e=0){let i=e?this.resolveOffset(e,-1):this.pos;if(null==i||i=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=Jd,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let i="";for(let n of this.ranges){if(n.from>=e)break;n.to>t&&(i+=this.input.read(Math.max(n.from,t),Math.min(n.to,e)))}return i}}class tf{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:i}=e.p;sf(this.data,t,e,this.id,i.data,i.tokenPrecTable)}}tf.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class ef{constructor(t,e,i){this.precTable=e,this.elseToken=i,this.data="string"==typeof t?Fd(t):t}token(t,e){let i=t.pos,n=0;for(;sf(this.data,t,e,0,this.data,this.precTable),!(t.token.value>-1);){if(null==this.elseToken)return;if(t.next<0)break;t.advance(),t.reset(t.pos,t.token),n++}n&&(t.reset(i,t.token),t.acceptToken(this.elseToken,n))}}ef.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class nf{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function sf(t,e,i,n,s,r){let o=0,a=1<0){let i=t[n];if(l.allows(i)&&(-1==e.token.value||e.token.value==i||of(i,e.token.value,s,r))){e.acceptToken(i);break}}let n=e.next,h=0,c=t[o+2];if(!(e.next<0&&c>h&&65535==t[i+3*c-3]&&65535==t[i+3*c-3])){for(;h>1,r=i+s+(s<<1),a=t[r],l=t[r+1]||65536;if(n=l)){o=t[r+2],e.advance();continue t}h=s+1}}break}o=t[i+3*c-1]}}function rf(t,e,i){for(let n,s=e;65535!=(n=t[s]);s++)if(n==i)return s-e;return-1}function of(t,e,i,n){let s=rf(i,n,e);return s<0||rf(i,n,t)e)&&!n.type.isError)return i<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(t.length,Math.max(n.from+1,e+25));if(i<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return i<0?0:t.length}}!function(t){t[t.Margin=25]="Margin"}(hf||(hf={}));let uf=class{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?cf(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?cf(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=r,null;if(s instanceof bo){if(r==t){if(r=Math.max(this.safeFrom,t)&&(this.trees.push(s),this.start.push(r),this.index.push(0))}else this.index[e]++,this.nextStart=r+s.length}}};class df{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map((t=>new Hd))}getActions(t){let e=0,i=null,{parser:n}=t.p,{tokenizers:s}=n,r=n.stateSlot(t.state,3),o=t.curContext?t.curContext.hash:0,a=0;for(let n=0;nh.end+25&&(a=Math.max(h.lookAhead,a)),0!=h.value)){let n=e;if(h.extended>-1&&(e=this.addActions(t,h.extended,h.end,e)),e=this.addActions(t,h.value,h.end,e),!l.extend&&(i=h,e>n))break}}for(;this.actions.length>e;)this.actions.pop();return a&&t.setLookAhead(a),i||t.pos!=this.stream.end||(i=new Hd,i.value=t.p.parser.eofTerm,i.start=i.end=t.pos,e=this.addActions(t,i.value,i.end,e)),this.mainToken=i,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new Hd,{pos:i,p:n}=t;return e.start=i,e.end=Math.min(i+1,n.stream.end),e.value=i==n.stream.end?n.parser.eofTerm:0,e}updateCachedToken(t,e,i){let n=this.stream.clipPos(i.pos);if(e.token(this.stream.reset(n,t),i),t.value>-1){let{parser:e}=i.p;for(let n=0;n=0&&i.p.parser.dialect.allows(s>>1)){0==(1&s)?t.value=s>>1:t.extended=s>>1;break}}}else t.value=0,t.end=this.stream.clipPos(n+1)}putAction(t,e,i,n){for(let e=0;e4*t.bufferLength?new uf(i,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t,e,i=this.stacks,n=this.minStackPos,s=this.stacks=[];if(this.bigReductionCount>300&&1==i.length){let[t]=i;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;rn)s.push(o);else{if(this.advanceStack(o,s,i))continue;{t||(t=[],e=[]),t.push(o);let i=this.tokens.getMainToken(o);e.push(i.value,i.end)}}break}}if(!s.length){let e=t&&function(t){let e=null;for(let i of t){let t=i.p.stoppedAt;(i.pos==i.p.stream.end||null!=t&&i.pos>t)&&i.p.parser.stateFlag(i.state,2)&&(!e||e.scorethis.stoppedAt?t[0]:this.runRecovery(t,e,s);if(i)return this.stackToTree(i.forceAll())}if(this.recovering){let t=1==this.recovering?1:3*this.recovering;if(s.length>t)for(s.sort(((t,e)=>e.score-t.score));s.length>t;)s.pop();s.some((t=>t.reducePos>n))&&this.recovering--}else if(s.length>1){t:for(let t=0;t500&&n.buffer.length>500){if(!((e.score-n.score||e.buffer.length-n.buffer.length)>0)){s.splice(t--,1);continue t}s.splice(i--,1)}}}s.length>12&&s.splice(12,s.length-12)}this.minStackPos=s[0].pos;for(let t=1;t ":"";if(null!=this.stoppedAt&&n>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let e=t.curContext&&t.curContext.tracker.strict,i=e?t.curContext.hash:0;for(let o=this.fragments.nodeAt(n);o;){let n=this.parser.nodeSet.types[o.type.id]==o.type?s.getGoto(t.state,o.type.id):-1;if(n>-1&&o.length&&(!e||(o.prop(ho.contextHash)||0)==i))return t.useNode(o,n),af&&console.log(r+this.stackID(t)+` (via reuse of ${s.getName(o.type.id)})`),!0;if(!(o instanceof bo)||0==o.children.length||o.positions[0]>0)break;let a=o.children[0];if(!(a instanceof bo&&0==o.positions[0]))break;o=a}}let o=s.stateSlot(t.state,4);if(o>0)return t.reduce(o),af&&console.log(r+this.stackID(t)+` (via always-reduce ${s.getName(65535&o)})`),!0;if(t.stack.length>=15e3)for(;t.stack.length>9e3&&t.forceReduce(););let a=this.tokens.getActions(t);for(let o=0;on?e.push(d):i.push(d)}return!1}advanceFully(t,e){let i=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>i)return Of(t,e),!0}}runRecovery(t,e,i){let n=null,s=!1;for(let r=0;r ":"";if(o.deadEnd){if(s)continue;if(s=!0,o.restart(),af&&console.log(h+this.stackID(o)+" (restarted)"),this.advanceFully(o,i))continue}let c=o.split(),u=h;for(let t=0;c.forceReduce()&&t<10;t++){if(af&&console.log(u+this.stackID(c)+" (via force-reduce)"),this.advanceFully(c,i))break;af&&(u=this.stackID(c)+" -> ")}for(let t of o.recoverByInsert(a))af&&console.log(h+this.stackID(t)+" (via recover-insert)"),this.advanceFully(t,i);this.stream.end>o.pos?(l==o.pos&&(l++,a=0),o.recoverByDelete(a,l),af&&console.log(h+this.stackID(o)+` (via recover-delete ${this.parser.getName(a)})`),Of(o,i)):(!n||n.scoret;class bf{constructor(t){this.start=t.start,this.shift=t.shift||mf,this.reduce=t.reduce||mf,this.reuse=t.reuse||mf,this.hash=t.hash||(()=>0),this.strict=!1!==t.strict}}class wf extends Vo{constructor(t){if(super(),this.wrappers=[],14!=t.version)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let i=0;it.topRules[e][1])),n=[];for(let t=0;t=0)s(n,t,e[i++]);else{let r=e[i+-n];for(let o=-n;o>0;o--)s(e[i++],t,r);i++}}}this.nodeSet=new po(e.map(((e,s)=>fo.define({name:s>=this.minRepeatTerm?void 0:e,id:s,props:n[s],top:i.indexOf(s)>-1,error:0==s,skipped:t.skippedNodes&&t.skippedNodes.indexOf(s)>-1})))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=oo;let r=Fd(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let t=0;t"number"==typeof t?new tf(r,t):t)),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,i){let n=new pf(this,t,e,i);for(let s of this.wrappers)n=s(n,t,e,i);return n}getGoto(t,e,i=!1){let n=this.goto;if(e>=n[0])return-1;for(let s=n[e+1];;){let e=n[s++],r=1&e,o=n[s++];if(r&&i)return o;for(let i=s+(e>>1);s0}validAction(t,e){if(e==this.stateSlot(t,4))return!0;for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])return!1;i=vf(this.data,i+2)}if(e==vf(this.data,i+1))return!0}}nextStates(t){let e=[];for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])break;i=vf(this.data,i+2)}if(0==(1&this.data[i+2])){let t=this.data[i+1];e.some(((e,i)=>1&i&&e==t))||e.push(this.data[i],t)}}return e}configure(t){let e=Object.assign(Object.create(wf.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let i=this.topRules[t.top];if(!i)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=i}return t.tokenizers&&(e.tokenizers=this.tokenizers.map((e=>{let i=t.tokenizers.find((t=>t.from==e));return i?i.to:e}))),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map(((i,n)=>{let s=t.specializers.find((t=>t.from==i.external));if(!s)return i;let r=Object.assign(Object.assign({},i),{external:s.to});return e.specializers[n]=yf(r),r}))),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),null!=t.strict&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),null!=t.bufferLength&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return null==e?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),i=e.map((()=>!1));if(t)for(let n of t.split(" ")){let t=e.indexOf(n);t>=0&&(i[t]=!0)}let n=null;for(let t=0;tt.external(i,n)<<1|e}return t.get}const Sf=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],xf=new bf({start:!1,shift:(t,e)=>3==e||4==e||305==e?t:306==e,strict:!1}),kf=new nf(((t,e)=>{let{next:i}=t;(125==i||-1==i||e.context)&&e.canShift(303)&&t.acceptToken(303)}),{contextual:!0,fallback:!0}),Qf=new nf(((t,e)=>{let i,{next:n}=t;Sf.indexOf(n)>-1||(47!=n||47!=(i=t.peek(1))&&42!=i)&&125!=n&&59!=n&&-1!=n&&!e.context&&e.canShift(302)&&t.acceptToken(302)}),{contextual:!0}),$f=new nf(((t,e)=>{let{next:i}=t;if((43==i||45==i)&&(t.advance(),i==t.next)){t.advance();let i=!e.context&&e.canShift(1);t.acceptToken(i?1:2)}}),{contextual:!0}),Pf=ea({"get set async static":Sa.modifier,"for while do if else switch try catch finally return throw break continue default case":Sa.controlKeyword,"in of await yield void typeof delete instanceof":Sa.operatorKeyword,"let var const function class extends":Sa.definitionKeyword,"import export from":Sa.moduleKeyword,"with debugger as new":Sa.keyword,TemplateString:Sa.special(Sa.string),super:Sa.atom,BooleanLiteral:Sa.bool,this:Sa.self,null:Sa.null,Star:Sa.modifier,VariableName:Sa.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":Sa.function(Sa.variableName),VariableDefinition:Sa.definition(Sa.variableName),Label:Sa.labelName,PropertyName:Sa.propertyName,PrivatePropertyName:Sa.special(Sa.propertyName),"CallExpression/MemberExpression/PropertyName":Sa.function(Sa.propertyName),"FunctionDeclaration/VariableDefinition":Sa.function(Sa.definition(Sa.variableName)),"ClassDeclaration/VariableDefinition":Sa.definition(Sa.className),PropertyDefinition:Sa.definition(Sa.propertyName),PrivatePropertyDefinition:Sa.definition(Sa.special(Sa.propertyName)),UpdateOp:Sa.updateOperator,LineComment:Sa.lineComment,BlockComment:Sa.blockComment,Number:Sa.number,String:Sa.string,Escape:Sa.escape,ArithOp:Sa.arithmeticOperator,LogicOp:Sa.logicOperator,BitOp:Sa.bitwiseOperator,CompareOp:Sa.compareOperator,RegExp:Sa.regexp,Equals:Sa.definitionOperator,Arrow:Sa.function(Sa.punctuation),": Spread":Sa.punctuation,"( )":Sa.paren,"[ ]":Sa.squareBracket,"{ }":Sa.brace,"InterpolationStart InterpolationEnd":Sa.special(Sa.brace),".":Sa.derefOperator,", ;":Sa.separator,"@":Sa.meta,TypeName:Sa.typeName,TypeDefinition:Sa.definition(Sa.typeName),"type enum interface implements namespace module declare":Sa.definitionKeyword,"abstract global Privacy readonly override":Sa.modifier,"is keyof unique infer":Sa.operatorKeyword,JSXAttributeValue:Sa.attributeValue,JSXText:Sa.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":Sa.angleBracket,"JSXIdentifier JSXNameSpacedName":Sa.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":Sa.attributeName,"JSXBuiltin/JSXIdentifier":Sa.standard(Sa.tagName)}),Cf={__proto__:null,export:14,as:19,from:27,default:30,async:35,function:36,extends:46,this:50,true:58,false:58,null:70,void:74,typeof:78,super:96,new:130,delete:146,yield:155,await:159,class:164,public:221,private:221,protected:221,readonly:223,instanceof:242,satisfies:245,in:246,const:248,import:280,keyof:335,unique:339,infer:345,is:381,abstract:401,implements:403,type:405,let:408,var:410,interface:417,enum:421,namespace:427,module:429,declare:433,global:437,for:456,of:465,while:468,with:472,do:476,if:480,else:482,switch:486,case:492,try:498,catch:502,finally:506,return:510,throw:514,break:518,continue:522,debugger:526},_f={__proto__:null,async:117,get:119,set:121,declare:181,public:183,private:183,protected:183,static:185,abstract:187,override:189,readonly:195,accessor:197,new:385},Xf={__proto__:null,"<":137},Zf=wf.deserialize({version:14,states:"$6[O`QUOOO%QQUOOO'TQWOOP(bOSOOO*pQ(CjO'#CfO*wOpO'#CgO+VO!bO'#CgO+eO07`O'#DZO-vQUO'#DaO.WQUO'#DlO%QQUO'#DvO0[QUO'#EOOOQ(CY'#EW'#EWO0uQSO'#ETOOQO'#Ei'#EiOOQO'#Ib'#IbO0}QSO'#GkO1YQSO'#EhO1_QSO'#EhO3aQ(CjO'#JcO6QQ(CjO'#JdO6nQSO'#FWO6sQ#tO'#FoOOQ(CY'#F`'#F`O7OO&jO'#F`O7^Q,UO'#FvO8tQSO'#FuOOQ(CY'#Jd'#JdOOQ(CW'#Jc'#JcOOQQ'#KO'#KOO8yQSO'#IOO9OQ(C[O'#IPOOQQ'#JP'#JPOOQQ'#IT'#ITQ`QUOOO%QQUO'#DnO9WQUO'#DzO%QQUO'#D|O9_QSO'#GkO9dQ,UO'#ClO9rQSO'#EgO9}QSO'#ErO:SQ,UO'#F_O:qQSO'#GkO:vQSO'#GoO;RQSO'#GoO;aQSO'#GrO;aQSO'#GsO;aQSO'#GuO9_QSO'#GxOQQSO'#HnO>VQ(C]O'#HtO%QQUO'#HvO>bQ(C]O'#HxO>mQ(C]O'#HzO9OQ(C[O'#H|O>xQ(CjO'#CfO?zQWO'#DfQOQSOOO@bQSO'#EPO9dQ,UO'#EgO@mQSO'#EgO@xQ`O'#F_OOQQ'#Cd'#CdOOQ(CW'#Dk'#DkOOQ(CW'#Jg'#JgO%QQUO'#JgOOQO'#Jk'#JkOOQO'#I_'#I_OAxQWO'#E`OOQ(CW'#E_'#E_OBtQ(C`O'#E`OCOQWO'#ESOOQO'#Jj'#JjOCdQWO'#JkOD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{R2Z-_R(k#tR(n#uQ!dQT,|'Q,}]!nQ!o'Q,}0u4pQ#l]R'Z9mT#gZ%ZS#fZ%ZU%y|},ZU(W#d#e#hS-r(X(YQ-v(ZQ0h+hQ2`-sU2a-t-u-wS5v2b2cR7u5w`#YW#S#V%v't'}+e-mt#cZ|}#d#e#h%Z(X(Y(Z+h-s-t-u-w2b2c5wQ1_,ZQ1r,oQ5e1jQ7m5fT:x&y+fT#]W%vS#[W%vS'u#S'}S'z#V+eS,t&y+fT-h't-mT'O!c%wQ$hfR)j$mT)_$h)`R3Z.kT*O$u*QR*W$xQ/}*zQ2e.OQ4s0wQ5{2iQ7X4vQ7x5zQ8e7WQ8w7wQ9W8gQ9`8yQ9e9XR9h9alpOXr!X#`%]&d&f&g&i,],b1b1eQ&^!TR,Q&ZV%z|},ZR0q+qR,P&XQ%szR+c%tR+X%nT&b!U&eT&c!U&eT1d,b1e",nodeNames:"⚠ ArithOp ArithOp LineComment BlockComment Script ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXStartTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:364,context:xf,nodeProps:[["group",-26,6,14,16,62,199,203,206,207,209,212,215,225,227,233,235,237,239,242,248,254,256,258,260,262,264,265,"Statement",-32,10,11,25,28,29,35,45,48,49,51,56,64,72,76,78,80,81,103,104,113,114,131,134,136,137,138,139,141,142,162,163,165,"Expression",-23,24,26,30,34,36,38,166,168,170,171,173,174,175,177,178,179,181,182,183,193,195,197,198,"Type",-3,84,96,102,"ClassItem"],["openedBy",31,"InterpolationStart",50,"[",54,"{",69,"(",143,"JSXStartTag",155,"JSXStartTag JSXStartCloseTag"],["closedBy",33,"InterpolationEnd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i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(T~~",141,326),new ef("j~RQYZXz{^~^O'q~~aP!P!Qd~iO'r~~",25,308)],topRules:{Script:[0,5],SingleExpression:[1,266],SingleClassItem:[2,267]},dialects:{jsx:12686,ts:12688},dynamicPrecedences:{76:1,78:1,163:1,191:1},specialized:[{term:312,get:t=>Cf[t]||-1},{term:328,get:t=>_f[t]||-1},{term:67,get:t=>Xf[t]||-1}],tokenPrec:12712}),Af=[Dd("function ${name}(${params}) {\n\t${}\n}",{label:"function",detail:"definition",type:"keyword"}),Dd("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n\t${}\n}",{label:"for",detail:"loop",type:"keyword"}),Dd("for (let ${name} of ${collection}) {\n\t${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Dd("do {\n\t${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),Dd("while (${}) {\n\t${}\n}",{label:"while",detail:"loop",type:"keyword"}),Dd("try {\n\t${}\n} catch (${error}) {\n\t${}\n}",{label:"try",detail:"/ catch block",type:"keyword"}),Dd("if (${}) {\n\t${}\n}",{label:"if",detail:"block",type:"keyword"}),Dd("if (${}) {\n\t${}\n} else {\n\t${}\n}",{label:"if",detail:"/ else block",type:"keyword"}),Dd("class ${name} {\n\tconstructor(${params}) {\n\t\t${}\n\t}\n}",{label:"class",detail:"definition",type:"keyword"}),Dd('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Dd('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Tf=new Ro,Rf=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Ef(t){return(e,i)=>{let n=e.node.getChild("VariableDefinition");return n&&i(n,t),!0}}const Vf=["FunctionDeclaration"],Mf={FunctionDeclaration:Ef("function"),ClassDeclaration:Ef("class"),ClassExpression:()=>!0,EnumDeclaration:Ef("constant"),TypeAliasDeclaration:Ef("type"),NamespaceDeclaration:Ef("namespace"),VariableDefinition(t,e){t.matchContext(Vf)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function Df(t,e){let i=Tf.get(e);if(i)return i;let n=[],s=!0;function r(e,i){let s=t.sliceString(e.from,e.to);n.push({label:s,type:i})}return e.cursor(mo.IncludeAnonymous).iterate((e=>{if(s)s=!1;else if(e.name){let t=Mf[e.name];if(t&&t(e,r)||Rf.has(e.name))return!1}else if(e.to-e.from>8192){for(let i of Df(t,e.node))n.push(i);return!1}})),Tf.set(e,n),n}const Wf=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Uf=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName"];function Yf(t){let e=Xa(t.state).resolveInner(t.pos,-1);if(Uf.indexOf(e.name)>-1)return null;let i="VariableName"==e.name||e.to-e.from<20&&Wf.test(t.state.sliceDoc(e.from,e.to));if(!i&&!t.explicit)return null;let n=[];for(let i=e;i;i=i.parent)Rf.has(i.name)&&(n=n.concat(Df(t.state.doc,i)));return{options:n,from:i?e.from:t.pos,validFor:Wf}}const qf=_a.define({name:"javascript",parser:Zf.configure({props:[Na.add({IfStatement:il({except:/^\s*({|else\b)/}),TryStatement:il({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:t=>t.baseIndent,SwitchBody:t=>{let e=t.textAfter,i=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return t.baseIndent+(i?0:n?1:2)*t.unit},Block:tl({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":il({except:/^{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag":t=>t.column(t.node.from)+t.unit}),rl.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression":ol,BlockComment:t=>({from:t.from+2,to:t.to-2})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Lf={test:t=>/^JSX/.test(t.name),facet:Qa({commentTokens:{block:{open:"{/*",close:"*/}"}}})},zf=qf.configure({dialect:"ts"},"typescript"),If=qf.configure({dialect:"jsx",props:[$a.add((t=>t.isTop?[Lf]:void 0))]}),Bf=qf.configure({dialect:"jsx ts",props:[$a.add((t=>t.isTop?[Lf]:void 0))]},"typescript"),jf="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map((t=>({label:t,type:"keyword"})));function Nf(t={}){let e=t.jsx?t.typescript?Bf:If:t.typescript?zf:qf;return new Ua(e,[qf.data.of({autocomplete:(i=Uf,n=zu(Af.concat(jf)),t=>{for(let e=Xa(t.state).resolveInner(t.pos,-1);e;e=e.parent){if(i.indexOf(e.name)>-1)return null;if(e.type.isTop)break}return n(t)})}),qf.data.of({autocomplete:Yf}),t.jsx?Hf:[]]);var i,n}function Gf(t,e,i=t.length){for(let n=null==e?void 0:e.firstChild;n;n=n.nextSibling)if("JSXIdentifier"==n.name||"JSXBuiltin"==n.name||"JSXNamespacedName"==n.name||"JSXMemberExpression"==n.name)return t.sliceString(n.from,Math.min(n.to,i));return""}const Ff="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),Hf=Ts.inputHandler.of(((t,e,i,n)=>{if((Ff?t.composing:t.compositionStarted)||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!qf.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((t=>{var e,i;let r,{head:o}=t,a=Xa(s).resolveInner(o,-1);if("JSXStartTag"==a.name&&(a=a.parent),">"==n&&"JSXFragmentTag"==a.name)return{range:A.cursor(o+1),changes:{from:o,insert:">"}};if("/"==n&&"JSXFragmentTag"==a.name){let t=a.parent,i=null==t?void 0:t.parent;if(t.from==o-1&&"JSXEndTag"!=(null===(e=i.lastChild)||void 0===e?void 0:e.name)&&(r=Gf(s.doc,null==i?void 0:i.firstChild,o))){let t=`/${r}>`;return{range:A.cursor(o+t.length),changes:{from:o,insert:t}}}}else if(">"==n){let t=function(t){for(;;){if("JSXOpenTag"==t.name||"JSXSelfClosingTag"==t.name||"JSXFragmentTag"==t.name)return t;if(!t.parent)return null;t=t.parent}}(a);if(t&&"JSXEndTag"!=(null===(i=t.lastChild)||void 0===i?void 0:i.name)&&"`}}}return{range:t}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)}));class Jf{constructor(t,e,i,n,s,r,o){this.type=t,this.value=e,this.from=i,this.hash=n,this.end=s,this.children=r,this.positions=o,this.hashProp=[[ho.contextHash,n]]}static create(t,e,i,n,s){return new Jf(t,e,i,n+(n<<8)+t+(e<<4)|0,s,[],[])}addChild(t,e){t.prop(ho.contextHash)!=this.hash&&(t=new bo(t.type,t.children,t.positions,t.length,this.hashProp)),this.children.push(t),this.positions.push(e)}toTree(t,e=this.end){let i=this.children.length-1;return i>=0&&(e=Math.max(e,this.positions[i]+this.children[i].length+this.from)),new bo(t.types[this.type],this.children,this.positions,e-this.from).balance({makeTree:(t,e,i)=>new bo(fo.none,t,e,i,this.hashProp)})}}var Kf;!function(t){t[t.Document=1]="Document",t[t.CodeBlock=2]="CodeBlock",t[t.FencedCode=3]="FencedCode",t[t.Blockquote=4]="Blockquote",t[t.HorizontalRule=5]="HorizontalRule",t[t.BulletList=6]="BulletList",t[t.OrderedList=7]="OrderedList",t[t.ListItem=8]="ListItem",t[t.ATXHeading1=9]="ATXHeading1",t[t.ATXHeading2=10]="ATXHeading2",t[t.ATXHeading3=11]="ATXHeading3",t[t.ATXHeading4=12]="ATXHeading4",t[t.ATXHeading5=13]="ATXHeading5",t[t.ATXHeading6=14]="ATXHeading6",t[t.SetextHeading1=15]="SetextHeading1",t[t.SetextHeading2=16]="SetextHeading2",t[t.HTMLBlock=17]="HTMLBlock",t[t.LinkReference=18]="LinkReference",t[t.Paragraph=19]="Paragraph",t[t.CommentBlock=20]="CommentBlock",t[t.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",t[t.Escape=22]="Escape",t[t.Entity=23]="Entity",t[t.HardBreak=24]="HardBreak",t[t.Emphasis=25]="Emphasis",t[t.StrongEmphasis=26]="StrongEmphasis",t[t.Link=27]="Link",t[t.Image=28]="Image",t[t.InlineCode=29]="InlineCode",t[t.HTMLTag=30]="HTMLTag",t[t.Comment=31]="Comment",t[t.ProcessingInstruction=32]="ProcessingInstruction",t[t.URL=33]="URL",t[t.HeaderMark=34]="HeaderMark",t[t.QuoteMark=35]="QuoteMark",t[t.ListMark=36]="ListMark",t[t.LinkMark=37]="LinkMark",t[t.EmphasisMark=38]="EmphasisMark",t[t.CodeMark=39]="CodeMark",t[t.CodeText=40]="CodeText",t[t.CodeInfo=41]="CodeInfo",t[t.LinkTitle=42]="LinkTitle",t[t.LinkLabel=43]="LinkLabel"}(Kf||(Kf={}));class tp{constructor(t,e){this.start=t,this.content=e,this.marks=[],this.parsers=[]}}class ep{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let t=this.skipSpace(this.basePos);this.indent=this.countIndent(t,this.pos,this.indent),this.pos=t,this.next=t==this.text.length?-1:this.text.charCodeAt(t)}skipSpace(t){return rp(this.text,t)}reset(t){for(this.text=t,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(t){this.basePos=t,this.baseIndent=this.countIndent(t,this.pos,this.indent)}moveBaseColumn(t){this.baseIndent=t,this.basePos=this.findColumn(t)}addMarker(t){this.markers.push(t)}countIndent(t,e=0,i=0){for(let n=e;n=e.stack[i.depth+1].value+i.baseIndent)return!0;if(i.indent>=i.baseIndent+4)return!1;let n=(t.type==Kf.OrderedList?dp:up)(i,e,!1);return n>0&&(t.type!=Kf.BulletList||hp(i,e,!1)<0)&&i.text.charCodeAt(i.pos+n-1)==t.value}const np={[Kf.Blockquote]:(t,e,i)=>62==i.next&&(i.markers.push(Up(Kf.QuoteMark,e.lineStart+i.pos,e.lineStart+i.pos+1)),i.moveBase(i.pos+(sp(i.text.charCodeAt(i.pos+1))?2:1)),t.end=e.lineStart+i.text.length,!0),[Kf.ListItem]:(t,e,i)=>!(i.indent-1)&&(i.moveBaseColumn(i.baseIndent+t.value),!0),[Kf.OrderedList]:ip,[Kf.BulletList]:ip,[Kf.Document]:()=>!0};function sp(t){return 32==t||9==t||10==t||13==t}function rp(t,e=0){for(;ei&&sp(t.charCodeAt(e-1));)e--;return e}function ap(t){if(96!=t.next&&126!=t.next)return-1;let e=t.pos+1;for(;e-1&&t.depth==e.stack.length||n<3?-1:1}function cp(t,e){for(let i=t.stack.length-1;i>=0;i--)if(t.stack[i].type==e)return!0;return!1}function up(t,e,i){return 45!=t.next&&43!=t.next&&42!=t.next||t.pos!=t.text.length-1&&!sp(t.text.charCodeAt(t.pos+1))||!(!i||cp(e,Kf.BulletList)||t.skipSpace(t.pos+2)=48&&s<=57;){if(n++,n==t.text.length)return-1;s=t.text.charCodeAt(n)}return n==t.pos||n>t.pos+9||46!=s&&41!=s||nt.pos+1||49!=t.next)?-1:n+1-t.pos}function fp(t){if(35!=t.next)return-1;let e=t.pos+1;for(;e6?-1:i}function pp(t){if(45!=t.next&&61!=t.next||t.indent>=t.baseIndent+4)return-1;let e=t.pos+1;for(;e/,mp=/\?>/,bp=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*/i.exec(n);if(r)return t.append(Up(Kf.Comment,i,i+1+r[0].length));let o=/^\?[^]*?\?>/.exec(n);if(o)return t.append(Up(Kf.ProcessingInstruction,i,i+1+o[0].length));let a=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(n);return a?t.append(Up(Kf.HTMLTag,i,i+1+a[0].length)):-1},Emphasis(t,e,i){if(95!=e&&42!=e)return-1;let n=i+1;for(;t.char(n)==e;)n++;let s=t.slice(i-1,i),r=t.slice(n,n+1),o=jp.test(s),a=jp.test(r),l=/\s|^$/.test(s),h=/\s|^$/.test(r),c=!h&&(!a||l||o),u=!l&&(!o||h||a),d=c&&(42==e||!u||o),f=u&&(42==e||!c||a);return t.append(new Ip(95==e?Yp:qp,i,n,(d?1:0)|(f?2:0)))},HardBreak(t,e,i){if(92==e&&10==t.char(i+1))return t.append(Up(Kf.HardBreak,i,i+2));if(32==e){let e=i+1;for(;32==t.char(e);)e++;if(10==t.char(e)&&e>=i+2)return t.append(Up(Kf.HardBreak,i,e+1))}return-1},Link:(t,e,i)=>91==e?t.append(new Ip(Lp,i,i+1,1)):-1,Image:(t,e,i)=>33==e&&91==t.char(i+1)?t.append(new Ip(zp,i,i+2,1)):-1,LinkEnd(t,e,i){if(93!=e)return-1;for(let e=t.parts.length-1;e>=0;e--){let n=t.parts[e];if(n instanceof Ip&&(n.type==Lp||n.type==zp)){if(!n.side||t.skipSpace(n.to)==i&&!/[(\[]/.test(t.slice(i+1,i+2)))return t.parts[e]=null,-1;let s=t.takeContent(e),r=t.parts[e]=Gp(t,s,n.type==Lp?Kf.Link:Kf.Image,n.from,i+1);if(n.type==Lp)for(let i=0;ie?Up(Kf.URL,e+i,s+i):s==t.length&&null}}function Hp(t,e,i){let n=t.charCodeAt(e);if(39!=n&&34!=n&&40!=n)return!1;let s=40==n?41:n;for(let n=e+1,r=!1;n=this.end?-1:this.text.charCodeAt(t-this.offset)}get end(){return this.offset+this.text.length}slice(t,e){return this.text.slice(t-this.offset,e-this.offset)}append(t){return this.parts.push(t),t.to}addDelimiter(t,e,i,n,s){return this.append(new Ip(t,e,i,(n?1:0)|(s?2:0)))}addElement(t){return this.append(t)}resolveMarkers(t){for(let e=t;e=t;o--){let t=this.parts[o];if(t instanceof Ip&&1&t.side&&t.type==i.type&&!(s&&(1&i.side||2&t.side)&&(t.to-t.from+r)%3==0&&((t.to-t.from)%3||r%3))){n=t;break}}if(!n)continue;let a=i.type.resolve,l=[],h=n.from,c=i.to;if(s){let t=Math.min(2,n.to-n.from,r);h=n.to-t,c=i.from+t,a=1==t?"Emphasis":"StrongEmphasis"}n.type.mark&&l.push(this.elt(n.type.mark,h,n.to));for(let t=o+1;t=0;e--){let i=this.parts[e];if(i instanceof Ip&&i.type==t)return e}return null}takeContent(t){let e=this.resolveMarkers(t);return this.parts.length=t,e}skipSpace(t){return rp(this.text,t-this.offset)+this.offset}elt(t,e,i,n){return"string"==typeof t?Up(this.parser.getNodeType(t),e,i,n):new Wp(t,e)}}function tO(t,e){if(!e.length)return t;if(!t.length)return e;let i=t.slice(),n=0;for(let t of e){for(;n(t?t-1:0))return!1;if(this.fragmentEnd<0){let t=this.fragment.to;for(;t>0&&"\n"!=this.input.read(t-1,t);)t--;this.fragmentEnd=t?t-1:0}let i=this.cursor;i||(i=this.cursor=this.fragment.tree.cursor(),i.firstChild());let n=t+this.fragment.offset;for(;i.to<=n;)if(!i.parent())return!1;for(;;){if(i.from>=n)return this.fragment.from<=e;if(!i.childAfter(n))return!1}}matches(t){let e=this.cursor.tree;return e&&e.prop(ho.contextHash)==t}takeNodes(t){let e=this.cursor,i=this.fragment.offset,n=this.fragmentEnd-(this.fragment.openEnd?1:0),s=t.absoluteLineStart,r=s,o=t.block.children.length,a=r,l=o;for(;;){if(e.to-i>n){if(e.type.isAnonymous&&e.firstChild())continue;break}if(t.dontInject.add(e.tree),t.addNode(e.tree,e.from-i),e.type.is("Block")&&(eO.indexOf(e.type.id)<0?(r=e.to-i,o=t.block.children.length):(r=a,o=l,a=e.to-i,l=t.block.children.length)),!e.nextSibling())break}for(;t.block.children.length>o;)t.block.children.pop(),t.block.positions.pop();return r-s}}const nO=ea({"Blockquote/...":Sa.quote,HorizontalRule:Sa.contentSeparator,"ATXHeading1/... SetextHeading1/...":Sa.heading1,"ATXHeading2/... SetextHeading2/...":Sa.heading2,"ATXHeading3/...":Sa.heading3,"ATXHeading4/...":Sa.heading4,"ATXHeading5/...":Sa.heading5,"ATXHeading6/...":Sa.heading6,"Comment CommentBlock":Sa.comment,Escape:Sa.escape,Entity:Sa.character,"Emphasis/...":Sa.emphasis,"StrongEmphasis/...":Sa.strong,"Link/... Image/...":Sa.link,"OrderedList/... BulletList/...":Sa.list,"BlockQuote/...":Sa.quote,"InlineCode CodeText":Sa.monospace,URL:Sa.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":Sa.processingInstruction,"CodeInfo LinkLabel":Sa.labelName,LinkTitle:Sa.string,Paragraph:Sa.content}),sO=new Zp(new po(Ep).extend(nO),Object.keys(Sp).map((t=>Sp[t])),Object.keys(Sp).map((t=>$p[t])),Object.keys(Sp),Pp,np,Object.keys(Np).map((t=>Np[t])),Object.keys(Np),[]);function rO(t,e,i){let n=[];for(let s=t.firstChild,r=e;;s=s.nextSibling){let t=s?s.from:i;if(t>r&&n.push({from:r,to:t}),!s)break;r=s.to}return n}const oO={resolve:"Strikethrough",mark:"StrikethroughMark"},aO={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":Sa.strikethrough}},{name:"StrikethroughMark",style:Sa.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,i){if(126!=e||126!=t.char(i+1)||126==t.char(i+2))return-1;let n=t.slice(i-1,i),s=t.slice(i+2,i+3),r=/\s|^$/.test(n),o=/\s|^$/.test(s),a=jp.test(n),l=jp.test(s);return t.addDelimiter(oO,i,i+2,!o&&(!l||r||a),!r&&(!a||o||l))},after:"Emphasis"}]};function lO(t,e,i=0,n,s=0){let r=0,o=!0,a=-1,l=-1,h=!1,c=()=>{n.push(t.elt("TableCell",s+a,s+l,t.parser.parseInline(e.slice(a,l),s+a)))};for(let u=i;u-1)&&r++,o=!1,n&&(a>-1&&c(),n.push(t.elt("TableDelimiter",u+s,u+s+1))),a=l=-1),h=!h&&92==i}return a>-1&&(r++,n&&c()),r}function hO(t,e){for(let i=e;ihO(e.content,0)?new uO:null,endLeaf(t,e,i){if(i.parsers.some((t=>t instanceof uO))||!hO(e.text,e.basePos))return!1;let n=t.scanLine(t.absoluteLineEnd+1).text;return cO.test(n)&&lO(t,e.text,e.basePos)==lO(t,n,e.basePos)},before:"SetextHeading"}]};class fO{nextLine(){return!1}finish(t,e){return t.addLeafElement(e,t.elt("Task",e.start,e.start+e.content.length,[t.elt("TaskMarker",e.start,e.start+3),...t.parser.parseInline(e.content.slice(3),e.start+3)])),!0}}const pO=[dO,{defineNodes:[{name:"Task",block:!0,style:Sa.list},{name:"TaskMarker",style:Sa.atom}],parseBlock:[{name:"TaskList",leaf:(t,e)=>/^\[[ xX]\]/.test(e.content)&&"ListItem"==t.parentType().name?new fO:null,after:"SetextHeading"}]},aO];function OO(t,e,i){return(n,s,r)=>{if(s!=t||n.char(r+1)==t)return-1;let o=[n.elt(i,r,r+1)];for(let s=r+1;s=65&&r<=90||95==r||r>=97&&r<=122||r>=161;)s+=String.fromCharCode(n),n=t.peek(++e);var r;return RO=t,EO=i,TO=s?s.toLowerCase():n==MO||n==DO?void 0:null}const MO=63,DO=33;function WO(t,e){this.name=t,this.parent=e,this.hash=e?e.hash:0;for(let e=0;eUO.indexOf(e)>-1?new WO(VO(n,1)||"",t):t,reduce:(t,e)=>e==wO&&t?t.parent:t,reuse(t,e,i,n){let s=e.type.id;return 6==s||36==s?new WO(VO(n,1)||"",t):t},hash:t=>t?t.hash:0,strict:!1}),qO=new nf(((t,e)=>{if(60!=t.next)return void(t.next<0&&e.context&&t.acceptToken(57));t.advance();let i=47==t.next;i&&t.advance();let n=VO(t,0);if(void 0===n)return;if(!n)return t.acceptToken(i?14:6);let s=e.context?e.context.name:null;if(i){if(n==s)return t.acceptToken(11);if(s&&XO[s])return t.acceptToken(57,-2);if(e.dialectEnabled(0))return t.acceptToken(12);for(let t=e.context;t;t=t.parent)if(t.name==n)return;t.acceptToken(13)}else{if("script"==n)return t.acceptToken(7);if("style"==n)return t.acceptToken(8);if("textarea"==n)return t.acceptToken(9);if(_O.hasOwnProperty(n))return t.acceptToken(10);s&&ZO[s]&&ZO[s][n]?t.acceptToken(57,-1):t.acceptToken(6)}}),{contextual:!0}),LO=new nf((t=>{for(let e=0,i=0;;i++){if(t.next<0){i&&t.acceptToken(58);break}if(45==t.next)e++;else{if(62==t.next&&e>=2){i>3&&t.acceptToken(58,-2);break}e=0}t.advance()}}));const zO=new nf(((t,e)=>{if(47==t.next&&62==t.peek(1)){let i=e.dialectEnabled(1)||function(t){for(;t;t=t.parent)if("svg"==t.name||"math"==t.name)return!0;return!1}(e.context);t.acceptToken(i?5:4,2)}else 62==t.next&&t.acceptToken(4,1)}));function IO(t,e,i){let n=2+t.length;return new nf((s=>{for(let r=0,o=0,a=0;;a++){if(s.next<0){a&&s.acceptToken(e);break}if(0==r&&60==s.next||1==r&&47==s.next||r>=2&&ro?s.acceptToken(e,-o):s.acceptToken(i,-(o-2));break}if((10==s.next||13==s.next)&&a){s.acceptToken(e,1);break}r=o=0}else o++;s.advance()}}))}const BO=IO("script",54,1),jO=IO("style",55,2),NO=IO("textarea",56,3),GO=ea({"Text RawText":Sa.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":Sa.angleBracket,TagName:Sa.tagName,"MismatchedCloseTag/TagName":[Sa.tagName,Sa.invalid],AttributeName:Sa.attributeName,"AttributeValue UnquotedAttributeValue":Sa.attributeValue,Is:Sa.definitionOperator,"EntityReference CharacterReference":Sa.character,Comment:Sa.blockComment,ProcessingInst:Sa.processingInstruction,DoctypeDecl:Sa.documentMeta}),FO=wf.deserialize({version:14,states:",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OOOO-E7Z-E7Z",stateData:"+s~O!^OS~OUSOVPOWQOXROYTO[]O][O^^O`^Oa^Ob^Oc^Ox^O{_O!dZO~OfaO~OfbO~OfcO~OfdO~OfeO~O!WfOPlP!ZlP~O!XiOQoP!ZoP~O!YlORrP!ZrP~OUSOVPOWQOXROYTOZqO[]O][O^^O`^Oa^Ob^Oc^Ox^O!dZO~O!ZrO~P#dO![sO!euO~OfvO~OfwO~OS|OhyO~OS!OOhyO~OS!QOhyO~OS!SOT!TOhyO~OS!TOhyO~O!WfOPlX!ZlX~OP!WO!Z!XO~O!XiOQoX!ZoX~OQ!ZO!Z!XO~O!YlORrX!ZrX~OR!]O!Z!XO~O!Z!XO~P#dOf!_O~O![sO!e!aO~OS!bO~OS!cO~Oi!dOSgXhgXTgX~OS!fOhyO~OS!gOhyO~OS!hOhyO~OS!iOT!jOhyO~OS!jOhyO~Of!kO~Of!lO~Of!mO~OS!nO~Ok!qO!`!oO!b!pO~OS!rO~OS!sO~OS!tO~Oa!uOb!uOc!uO!`!wO!a!uO~Oa!xOb!xOc!xO!b!wO!c!xO~Oa!uOb!uOc!uO!`!{O!a!uO~Oa!xOb!xOc!xO!b!{O!c!xO~OT~bac!dx{!d~",goto:"%p!`PPPPPPPPPPPPPPPPPPPP!a!gP!mPP!yP!|#P#S#Y#]#`#f#i#l#r#x!aP!a!aP$O$U$l$r$x%O%U%[%bPPPPPPPP%hX^OX`pXUOX`pezabcde{}!P!R!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ}bQ!PcQ!RdQ!UeZ!e{}!P!R!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:67,context:YO,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,21,30,33,36,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,29,32,35,37,"OpenTag"],["group",-9,14,17,18,19,20,39,40,41,42,"Entity",16,"Entity TextContent",-3,28,31,34,"TextContent Entity"]],propSources:[GO],skippedNodes:[0],repeatNodeCount:9,tokenData:"#%g!aR!YOX$qXY,QYZ,QZ[$q[]&X]^,Q^p$qpq,Qqr-_rs4ysv-_vw5iwxJ^x}-_}!OKP!O!P-_!P!Q$q!Q![-_![!]!!O!]!^-_!^!_!&W!_!`#$o!`!a&X!a!c-_!c!}!!O!}#R-_#R#S!!O#S#T3V#T#o!!O#o#s-_#s$f$q$f%W-_%W%o!!O%o%p-_%p&a!!O&a&b-_&b1p!!O1p4U-_4U4d!!O4d4e-_4e$IS!!O$IS$I`-_$I`$Ib!!O$Ib$Kh-_$Kh%#t!!O%#t&/x-_&/x&Et!!O&Et&FV-_&FV;'S!!O;'S;:j!&Q;:j;=`4s<%l?&r-_?&r?Ah!!O?Ah?BY$q?BY?Mn!!O?MnO$q!Z$|c`PkW!a`!cpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr$qrs&}sv$qvw+Pwx(tx!^$q!^!_*V!_!a&X!a#S$q#S#T&X#T;'S$q;'S;=`+z<%lO$q!R&bX`P!a`!cpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&Xq'UV`P!cpOv&}wx'kx!^&}!^!_(V!_;'S&};'S;=`(n<%lO&}P'pT`POv'kw!^'k!_;'S'k;'S;=`(P<%lO'kP(SP;=`<%l'kp([S!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let i=t.getChild(vO);return i?e.read(i.from,i.to):" "}function KO(t,e,i){let n;for(let s of i)if(!s.attrs||s.attrs(n||(n=HO(t.node.parent.firstChild,e))))return{parser:s.parser};return null}function tg(t=[],e=[]){let i=[],n=[],s=[],r=[];for(let e of t){("script"==e.tag?i:"style"==e.tag?n:"textarea"==e.tag?s:r).push(e)}let o=e.length?Object.create(null):null;for(let t of e)(o[t.name]||(o[t.name]=[])).push(t);return Do(((t,e)=>{let a=t.type.id;if(a==QO)return KO(t,e,i);if(a==$O)return KO(t,e,n);if(a==PO)return KO(t,e,s);if(a==wO&&r.length){let i,n=t.node,s=n.firstChild,o=s&&JO(s,e);if(o)for(let t of r)if(t.tag==o&&(!t.attrs||t.attrs(i||(i=HO(n,e))))){let e=n.lastChild;return{parser:t.parser,overlay:[{from:s.to,to:e.type.id==CO?e.from:n.to}]}}}if(o&&a==yO){let i,n=t.node;if(i=n.firstChild){let t=o[e.read(i.from,i.to)];if(t)for(let i of t){if(i.tagName&&i.tagName!=JO(n.parent,e))continue;let t=n.lastChild;if(t.type.id==xO){let e=t.from+1,n=t.lastChild,s=t.to-(n&&n.isError?0:1);if(s>e)return{parser:i.parser,overlay:[{from:e,to:s}]}}else if(t.type.id==kO)return{parser:i.parser,overlay:[{from:t.from,to:t.to}]}}}}return null}))}const eg=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288];function ig(t){return t>=65&&t<=90||t>=97&&t<=122||t>=161}const ng=new nf(((t,e)=>{for(let n=!1,s=0,r=0;;r++){let{next:o}=t;if(!(ig(o)||45==o||95==o||n&&(i=o,i>=48&&i<=57))){n&&t.acceptToken(40==o?95:2==s&&e.canShift(2)?2:96);break}!n&&(45!=o||r>0)&&(n=!0),s===r&&45==o&&s++,t.advance()}var i})),sg=new nf((t=>{if(eg.includes(t.peek(-1))){let{next:e}=t;(ig(e)||95==e||35==e||46==e||91==e||58==e||45==e)&&t.acceptToken(94)}})),rg=new nf((t=>{if(!eg.includes(t.peek(-1))){let{next:e}=t;if(37==e&&(t.advance(),t.acceptToken(1)),ig(e)){do{t.advance()}while(ig(t.next));t.acceptToken(1)}}})),og=ea({"AtKeyword import charset namespace keyframes media supports":Sa.definitionKeyword,"from to selector":Sa.keyword,NamespaceName:Sa.namespace,KeyframeName:Sa.labelName,TagName:Sa.tagName,ClassName:Sa.className,PseudoClassName:Sa.constant(Sa.className),IdName:Sa.labelName,"FeatureName PropertyName":Sa.propertyName,AttributeName:Sa.attributeName,NumberLiteral:Sa.number,KeywordQuery:Sa.keyword,UnaryQueryOp:Sa.operatorKeyword,"CallTag ValueName":Sa.atom,VariableName:Sa.variableName,Callee:Sa.operatorKeyword,Unit:Sa.unit,"UniversalSelector NestingSelector":Sa.definitionOperator,MatchOp:Sa.compareOperator,"ChildOp SiblingOp, LogicOp":Sa.logicOperator,BinOp:Sa.arithmeticOperator,Important:Sa.modifier,Comment:Sa.blockComment,ParenthesizedContent:Sa.special(Sa.name),ColorLiteral:Sa.color,StringLiteral:Sa.string,":":Sa.punctuation,"PseudoOp #":Sa.derefOperator,"; ,":Sa.separator,"( )":Sa.paren,"[ ]":Sa.squareBracket,"{ }":Sa.brace}),ag={__proto__:null,lang:32,"nth-child":32,"nth-last-child":32,"nth-of-type":32,"nth-last-of-type":32,dir:32,"host-context":32,url:60,"url-prefix":60,domain:60,regexp:60,selector:134},lg={__proto__:null,"@import":114,"@media":138,"@charset":142,"@namespace":146,"@keyframes":152,"@supports":164},hg={__proto__:null,not:128,only:128,from:158,to:160},cg=wf.deserialize({version:14,states:"7WQYQ[OOO#_Q[OOOOQP'#Cd'#CdOOQP'#Cc'#CcO#fQ[O'#CfO$YQXO'#CaO$aQ[O'#ChO$lQ[O'#DPO$qQ[O'#DTOOQP'#Ed'#EdO$vQdO'#DeO%bQ[O'#DrO$vQdO'#DtO%sQ[O'#DvO&OQ[O'#DyO&TQ[O'#EPO&cQ[O'#EROOQS'#Ec'#EcOOQS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!Q![>T![!g%^!g!h<^!h#X%^#X#Y<^#Y;'S%^;'S;=`%o<%lO%^XDuU]POy%^z![%^![!]EX!];'S%^;'S;=`%o<%lO%^XE`S^PoWOy%^z;'S%^;'S;=`%o<%lO%^_EqS!WVOy%^z;'S%^;'S;=`%o<%lO%^YFSSzQOy%^z;'S%^;'S;=`%o<%lO%^XFeU|POy%^z!`%^!`!aFw!a;'S%^;'S;=`%o<%lO%^XGOS|PoWOy%^z;'S%^;'S;=`%o<%lO%^XG_WOy%^z!c%^!c!}Gw!}#T%^#T#oGw#o;'S%^;'S;=`%o<%lO%^XHO[!YPoWOy%^z}%^}!OGw!O!Q%^!Q![Gw![!c%^!c!}Gw!}#T%^#T#oGw#o;'S%^;'S;=`%o<%lO%^XHySxPOy%^z;'S%^;'S;=`%o<%lO%^^I[SvUOy%^z;'S%^;'S;=`%o<%lO%^XIkUOy%^z#b%^#b#cI}#c;'S%^;'S;=`%o<%lO%^XJSUoWOy%^z#W%^#W#XJf#X;'S%^;'S;=`%o<%lO%^XJmS!`PoWOy%^z;'S%^;'S;=`%o<%lO%^XJ|UOy%^z#f%^#f#gJf#g;'S%^;'S;=`%o<%lO%^XKeS!RPOy%^z;'S%^;'S;=`%o<%lO%^_KvS!QVOy%^z;'S%^;'S;=`%o<%lO%^ZLXU!PPOy%^z!_%^!_!`6y!`;'S%^;'S;=`%o<%lO%^WLnP;=`<%l$}",tokenizers:[sg,rg,ng,0,1,2,3],topRules:{StyleSheet:[0,4],Styles:[1,84]},specialized:[{term:95,get:t=>ag[t]||-1},{term:56,get:t=>lg[t]||-1},{term:96,get:t=>hg[t]||-1}],tokenPrec:1123});let ug=null;function dg(){if(!ug&&"object"==typeof document&&document.body){let{style:t}=document.body,e=[],i=new Set;for(let n in t)"cssText"!=n&&"cssFloat"!=n&&"string"==typeof t[n]&&(/[A-Z]/.test(n)&&(n=n.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))),i.has(n)||(e.push(n),i.add(n)));ug=e.sort().map((t=>({type:"property",label:t})))}return ug||[]}const fg=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map((t=>({type:"class",label:t}))),pg=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map((t=>({type:"keyword",label:t}))).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map((t=>({type:"constant",label:t})))),Og=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map((t=>({type:"type",label:t}))),gg=/^(\w[\w-]*|-\w[\w-]*|)$/,mg=/^-(-[\w-]*)?$/;const bg=new Ro,wg=["Declaration"];function vg(t){for(let e=t;;){if(e.type.isTop)return e;if(!(e=e.parent))return t}}function yg(t,e,i){if(e.to-e.from>4096){let n=bg.get(e);if(n)return n;let s=[],r=new Set,o=e.cursor(mo.IncludeAnonymous);if(o.firstChild())do{for(let e of yg(t,o.node,i))r.has(e.label)||(r.add(e.label),s.push(e))}while(o.nextSibling());return bg.set(e,s),s}{let n=[],s=new Set;return e.cursor().iterate((e=>{var r;if(i(e)&&e.matchContext(wg)&&":"==(null===(r=e.node.nextSibling)||void 0===r?void 0:r.name)){let i=t.sliceString(e.from,e.to);s.has(i)||(s.add(i),n.push({label:i,type:"variable"}))}})),n}}const Sg=t=>e=>{let{state:i,pos:n}=e,s=Xa(i).resolveInner(n,-1),r=s.type.isError&&s.from==s.to-1&&"-"==i.doc.sliceString(s.from,s.to);if("PropertyName"==s.name||(r||"TagName"==s.name)&&/^(Block|Styles)$/.test(s.resolve(s.to).name))return{from:s.from,options:dg(),validFor:gg};if("ValueName"==s.name)return{from:s.from,options:pg,validFor:gg};if("PseudoClassName"==s.name)return{from:s.from,options:fg,validFor:gg};if(t(s)||(e.explicit||r)&&function(t,e){var i;if(("("==t.name||t.type.isError)&&(t=t.parent||t),"ArgList"!=t.name)return!1;let n=null===(i=t.parent)||void 0===i?void 0:i.firstChild;return"Callee"==(null==n?void 0:n.name)&&"var"==e.sliceString(n.from,n.to)}(s,i.doc))return{from:t(s)||r?s.from:n,options:yg(i.doc,vg(s),t),validFor:mg};if("TagName"==s.name){for(let{parent:t}=s;t;t=t.parent)if("Block"==t.name)return{from:s.from,options:dg(),validFor:gg};return{from:s.from,options:Og,validFor:gg}}if(!e.explicit)return null;let o=s.resolve(n),a=o.childBefore(n);return a&&":"==a.name&&"PseudoClassSelector"==o.name?{from:n,options:fg,validFor:gg}:a&&":"==a.name&&"Declaration"==o.name||"ArgList"==o.name?{from:n,options:pg,validFor:gg}:"Block"==o.name||"Styles"==o.name?{from:n,options:dg(),validFor:gg}:null},xg=Sg((t=>"VariableName"==t.name)),kg=_a.define({name:"css",parser:cg.configure({props:[Na.add({Declaration:il()}),rl.add({"Block KeyframeList":ol})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function Qg(){return new Ua(kg,kg.data.of({autocomplete:xg}))}const $g=["_blank","_self","_top","_parent"],Pg=["ascii","utf-8","utf-16","latin1","latin1"],Cg=["get","post","put","delete"],_g=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Xg=["true","false"],Zg={},Ag={a:{attrs:{href:null,ping:null,type:null,media:null,target:$g,hreflang:null}},abbr:Zg,address:Zg,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Zg,aside:Zg,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Zg,base:{attrs:{href:null,target:$g}},bdi:Zg,bdo:Zg,blockquote:{attrs:{cite:null}},body:Zg,br:Zg,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Zg,center:Zg,cite:Zg,code:Zg,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:Zg,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Zg,div:Zg,dl:Zg,dt:Zg,em:Zg,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Zg,figure:Zg,footer:Zg,form:{attrs:{action:null,name:null,"accept-charset":Pg,autocomplete:["on","off"],enctype:_g,method:Cg,novalidate:["novalidate"],target:$g}},h1:Zg,h2:Zg,h3:Zg,h4:Zg,h5:Zg,h6:Zg,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Zg,hgroup:Zg,hr:Zg,html:{attrs:{manifest:null}},i:Zg,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:Zg,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Zg,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:Zg,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Pg,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:Zg,noscript:Zg,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:Zg,param:{attrs:{name:null,value:null}},pre:Zg,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Zg,rt:Zg,ruby:Zg,samp:Zg,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Pg}},section:Zg,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Zg,source:{attrs:{src:null,type:null,media:null}},span:Zg,strong:Zg,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Zg,summary:Zg,sup:Zg,table:Zg,tbody:Zg,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Zg,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:Zg,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Zg,time:{attrs:{datetime:null}},title:Zg,tr:Zg,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Zg,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:Zg},Tg={accesskey:null,class:null,contenteditable:Xg,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Xg,autocorrect:Xg,autocapitalize:Xg,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Xg,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Xg,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Xg,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Xg,"aria-hidden":Xg,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Xg,"aria-multiselectable":Xg,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Xg,"aria-relevant":null,"aria-required":Xg,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},Rg="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map((t=>"on"+t));for(let t of Rg)Tg[t]=null;class Eg{constructor(t,e){this.tags=Object.assign(Object.assign({},Ag),t),this.globalAttrs=Object.assign(Object.assign({},Tg),e),this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}function Vg(t,e,i=t.length){if(!e)return"";let n=e.firstChild,s=n&&n.getChild("TagName");return s?t.sliceString(s.from,Math.min(s.to,i)):""}function Mg(t,e=!1){for(let i=t.parent;i;i=i.parent)if("Element"==i.name){if(!e)return i;e=!1}return null}function Dg(t,e,i){let n=i.tags[Vg(t,Mg(e,!0))];return(null==n?void 0:n.children)||i.allTags}function Wg(t,e){let i=[];for(let n=e;n=Mg(n);){let s=Vg(t,n);if(s&&"CloseTag"==n.lastChild.name)break;s&&i.indexOf(s)<0&&("EndTag"==e.name||e.from>=n.firstChild.to)&&i.push(s)}return i}Eg.default=new Eg;const Ug=/^[:\-\.\w\u00b7-\uffff]*$/;function Yg(t,e,i,n,s){let r=/\s*>/.test(t.sliceDoc(s,s+5))?"":">";return{from:n,to:s,options:Dg(t.doc,i,e).map((t=>({label:t,type:"type"}))).concat(Wg(t.doc,i).map(((t,e)=>({label:"/"+t,apply:"/"+t+r,type:"type",boost:99-e})))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function qg(t,e,i,n){let s=/\s*>/.test(t.sliceDoc(n,n+5))?"":">";return{from:i,to:n,options:Wg(t.doc,e).map(((t,e)=>({label:t,apply:t+s,type:"type",boost:99-e}))),validFor:Ug}}function Lg(t,e){let{state:i,pos:n}=e,s=Xa(i).resolveInner(n),r=s.resolve(n,-1);for(let t,e=n;s==r&&(t=r.childBefore(e));){let i=t.lastChild;if(!i||!i.type.isError||i.from({label:t,type:"property"}))),validFor:Ug}}(i,t,r,"AttributeName"==r.name?r.from:n,n):"Is"==r.name||"AttributeValue"==r.name||"UnquotedAttributeValue"==r.name?function(t,e,i,n,s){var r;let o,a=null===(r=i.parent)||void 0===r?void 0:r.getChild("AttributeName"),l=[];if(a){let r=t.sliceDoc(a.from,a.to),h=e.globalAttrs[r];if(!h){let n=Mg(i),s=n?e.tags[Vg(t.doc,n)]:null;h=(null==s?void 0:s.attrs)&&s.attrs[r]}if(h){let e=t.sliceDoc(n,s).toLowerCase(),i='"',r='"';/^['"]/.test(e)?(o='"'==e[0]?/^[^"]*$/:/^[^']*$/,i="",r=t.sliceDoc(s,s+1)==e[0]?"":e[0],e=e.slice(1),n++):o=/^[^\s<>='"]*$/;for(let t of h)l.push({label:t,apply:i+t+r,type:"constant"})}}return{from:n,to:s,options:l,validFor:o}}(i,t,r,"Is"==r.name?n:r.from,n):!e.explicit||"Element"!=s.name&&"Text"!=s.name&&"Document"!=s.name?null:function(t,e,i,n){let s=[],r=0;for(let n of Dg(t.doc,i,e))s.push({label:"<"+n,type:"type"});for(let e of Wg(t.doc,i))s.push({label:"",type:"type",boost:99-r++});return{from:n,to:n,options:s,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}(i,t,r,n)}function zg(t){let{extraTags:e,extraGlobalAttributes:i}=t,n=i||e?new Eg(e,i):Eg.default;return t=>Lg(n,t)}const Ig=[{tag:"script",attrs:t=>"text/typescript"==t.type||"ts"==t.lang,parser:zf.parser},{tag:"script",attrs:t=>"text/babel"==t.type||"text/jsx"==t.type,parser:If.parser},{tag:"script",attrs:t=>"text/typescript-jsx"==t.type,parser:Bf.parser},{tag:"script",attrs:t=>!t.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(t.type),parser:qf.parser},{tag:"style",attrs:t=>(!t.lang||"css"==t.lang)&&(!t.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(t.type)),parser:kg.parser}],Bg=[{name:"style",parser:kg.parser.configure({top:"Styles"})}].concat(Rg.map((t=>({name:t,parser:qf.parser})))),jg=_a.define({name:"html",parser:FO.configure({props:[Na.add({Element(t){let e=/^(\s*)(<\/)?/.exec(t.textAfter);return t.node.to<=t.pos+e[0].length?t.continue():t.lineIndent(t.node.from)+(e[2]?0:t.unit)},"OpenTag CloseTag SelfClosingTag":t=>t.column(t.node.from)+t.unit,Document(t){if(t.pos+/\s*/.exec(t.textAfter)[0].lengtht.getChild("TagName")})],wrap:tg(Ig,Bg)}),languageData:{commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-._"}});function Ng(t={}){let e,i="";!1===t.matchClosingTags&&(i="noMatch"),!0===t.selfClosingTags&&(i=(i?i+" ":"")+"selfClosing"),(t.nestedLanguages&&t.nestedLanguages.length||t.nestedAttributes&&t.nestedAttributes.length)&&(e=tg((t.nestedLanguages||[]).concat(Ig),(t.nestedAttributes||[]).concat(Bg)));let n=e||i?jg.configure({dialect:i,wrap:e}):jg;return new Ua(n,[jg.data.of({autocomplete:zg(t)}),!1!==t.autoCloseTags?Fg:[],Nf().support,Qg().support])}const Gg=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),Fg=Ts.inputHandler.of(((t,e,i,n)=>{if(t.composing||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!jg.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((e=>{var i,r,o;let a,{head:l}=e,h=Xa(s).resolveInner(l,-1);if("TagName"!=h.name&&"StartTag"!=h.name||(h=h.parent),">"==n&&"OpenTag"==h.name){if("CloseTag"!=(null===(r=null===(i=h.parent)||void 0===i?void 0:i.lastChild)||void 0===r?void 0:r.name)&&(a=Vg(s.doc,h.parent,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`${e?"":">"}`;return{range:A.cursor(l+1),changes:{from:l+(e?1:0),insert:i}}}}else if("/"==n&&"OpenTag"==h.name){let e=h.parent,i=null==e?void 0:e.parent;if(e.from==l-1&&"CloseTag"!=(null===(o=i.lastChild)||void 0===o?void 0:o.name)&&(a=Vg(s.doc,i,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`/${a}${e?"":">"}`,n=l+i.length+(e?1:0);return{range:A.cursor(n),changes:{from:l,insert:i}}}}return{range:e}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)})),Hg=Qa({commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}}}),Jg=new ho,Kg=sO.configure({props:[rl.add((t=>!t.is("Block")||t.is("Document")||null!=tm(t)?void 0:(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to}))),Jg.add(tm),Na.add({Document:()=>null}),ka.add({Document:Hg})]});function tm(t){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(t.name);return e?+e[1]:void 0}function em(t,e){let i=t;for(;;){let t,n=i.nextSibling;if(!n||null!=(t=tm(n.type))&&t<=e)break;i=n}return i.to}const im=sl.of(((t,e,i)=>{for(let n=Xa(t).resolveInner(i,-1);n&&!(n.fromi)return{from:i,to:e}}return null}));function nm(t){return new Pa(Hg,t,[im],"markdown")}const sm=nm(Kg),rm=nm(Kg.configure([pO,mO,gO,bO]));class om{constructor(t,e,i,n,s,r,o){this.node=t,this.from=e,this.to=i,this.spaceBefore=n,this.spaceAfter=s,this.type=r,this.item=o}blank(t,e=!0){let i=this.spaceBefore+("Blockquote"==this.node.name?">":"");if(null!=t){for(;i.length0;t--)i+=" ";return i+(e?this.spaceAfter:"")}marker(t,e){let i="OrderedList"==this.node.name?String(+lm(this.item,t)[2]+e):"";return this.spaceBefore+i+this.type+this.spaceAfter}}function am(t,e){let i=[];for(let e=t;e&&"Document"!=e.name;e=e.parent)"ListItem"!=e.name&&"Blockquote"!=e.name&&"FencedCode"!=e.name||i.push(e);let n=[];for(let t=i.length-1;t>=0;t--){let s,r=i[t],o=e.lineAt(r.from),a=r.from-o.from;if("FencedCode"==r.name)n.push(new om(r,a,a,"","","",null));else if("Blockquote"==r.name&&(s=/^[ \t]*>( ?)/.exec(o.text.slice(a))))n.push(new om(r,a,a+s[0].length,"",s[1],">",null));else if("ListItem"==r.name&&"OrderedList"==r.parent.name&&(s=/^([ \t]*)\d+([.)])([ \t]*)/.exec(o.text.slice(a)))){let t=s[3],e=s[0].length;t.length>=4&&(t=t.slice(0,t.length-4),e-=4),n.push(new om(r.parent,a,a+e,s[1],t,s[2],r))}else if("ListItem"==r.name&&"BulletList"==r.parent.name&&(s=/^([ \t]*)([-+*])([ \t]{1,4}\[[ xX]\])?([ \t]+)/.exec(o.text.slice(a)))){let t=s[4],e=s[0].length;t.length>4&&(t=t.slice(0,t.length-4),e-=4);let i=s[2];s[3]&&(i+=s[3].replace(/[xX]/," ")),n.push(new om(r.parent,a,a+e,s[1],t,i,r))}}return n}function lm(t,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(t.from,t.from+10))}function hm(t,e,i,n=0){for(let s=-1,r=t;;){if("ListItem"==r.name){let t=lm(r,e),o=+t[2];if(s>=0){if(o!=s+1)return;i.push({from:r.from+t[1].length,to:r.from+t[0].length,insert:String(s+2+n)})}s=o}let t=r.nextSibling;if(!t)break;r=t}}function cm(t){return"QuoteMark"==t.name||"ListMark"==t.name}const um=[{key:"Enter",run:({state:t,dispatch:e})=>{let i=Xa(t),{doc:n}=t,s=null,r=t.changeByRange((e=>{if(!e.empty||!rm.isActiveAt(t,e.from))return s={range:e};let r=e.from,o=n.lineAt(r),a=am(i.resolveInner(r,-1),n);for(;a.length&&a[a.length-1].from>r-o.from;)a.pop();if(!a.length)return s={range:e};let l=a[a.length-1];if(l.to-l.spaceAfter.length>r-o.from)return s={range:e};let h=r>=l.to-l.spaceAfter.length&&!/\S/.test(o.text.slice(l.to));if(l.item&&h){if(l.node.firstChild.to>=r||o.from>0&&!/[^\s>]/.test(n.lineAt(o.from-1).text)){let t,e=a.length>1?a[a.length-2]:null,i="";e&&e.item?(t=o.from+e.from,i=e.marker(n,1)):t=o.from+(e?e.to:0);let s=[{from:t,to:r,insert:i}];return"OrderedList"==l.node.name&&hm(l.item,n,s,-2),e&&"OrderedList"==e.node.name&&hm(e.item,n,s),{range:A.cursor(t+i.length),changes:s}}{let e="";for(let t=0,i=a.length-2;t<=i;t++)e+=a[t].blank(t\s*$/.exec(i.text);if(s&&s.index==l.from){let n=t.changes([{from:i.from+s.index,to:i.to},{from:o.from+l.from,to:o.to}]);return{range:e.map(n),changes:n}}}let c=[];"OrderedList"==l.node.name&&hm(l.item,n,c);let u=l.item&&l.item.from]*/.exec(o.text)[0].length>=l.to)for(let t=0,e=a.length-1;t<=e;t++)d+=t!=e||u?a[t].blank(to.from&&/\s/.test(o.text.charAt(f-o.from-1));)f--;return d=t.lineBreak+d,c.push({from:f,to:r,insert:d}),{range:A.cursor(f+d.length),changes:c}}));return!s&&(e(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0)}},{key:"Backspace",run:({state:t,dispatch:e})=>{let i=Xa(t),n=null,s=t.changeByRange((e=>{let s=e.from,{doc:r}=t;if(e.empty&&rm.isActiveAt(t,e.from)){let t=r.lineAt(s),n=am(function(t,e){let i=t.resolveInner(e,-1),n=e;cm(i)&&(n=i.from,i=i.parent);for(let t;t=i.childBefore(n);)if(cm(t))n=t.from;else{if("OrderedList"!=t.name&&"BulletList"!=t.name)break;i=t.lastChild,n=i.to}return i}(i,s),r);if(n.length){let i=n[n.length-1],r=i.to-i.spaceAfter.length+(i.spaceAfter?1:0);if(s-t.from>r&&!/\S/.test(t.text.slice(r,s-t.from)))return{range:A.cursor(t.from+r),changes:{from:t.from+r,to:s}};if(s-t.from==r&&(!i.item||t.from<=i.item.from||!/\S/.test(t.text.slice(0,i.to)))){let n=t.from+i.from;if(i.item&&i.node.fromt.from-e.from||t.startSide-e.startSide)),ni.set(i)}getMatchingBracket(t){switch(t){case")":return"(";case"]":return"[";case"}":return"{";default:return null}}},{decorations:t=>t.decorations});var fm="[a-zA-Z\\$][a-zA-Z0-9\\$]*",pm="(?:\\.\\d+|\\d+\\.\\d*|\\d+)",Om="(?:`(?:`?"+pm+")?)",gm=new RegExp("(?:(?:\\d+)(?:\\^\\^(?:\\.\\w+|\\w+\\.\\w*|\\w+)"+Om+"?(?:\\*\\^[+-]?\\d+)?))"),mm=new RegExp("(?:"+pm+Om+"?(?:\\*\\^[+-]?\\d+)?)"),bm=new RegExp("(?:`?)(?:"+fm+")(?:`(?:"+fm+"))*(?:`?)");let wm=[];const vm=["True","False","All","None","Null","Full","$Failed","$Aborted"];function ym(t,e){var i;return'"'===(i=t.next())?(e.tokenize=Sm,e.tokenize(t,e)):"("===i&&t.eat("*")?(e.commentLevel++,e.tokenize=xm,e.tokenize(t,e)):(t.backUp(1),t.match(gm,!0,!1)||t.match(mm,!0,!1)?"number":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::usage)/,!0,!1)?"meta":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::[a-zA-Z\$][a-zA-Z0-9\$]*):?/,!0,!1)?"string.special":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*\s*:)(?:(?:[a-zA-Z\$][a-zA-Z0-9\$]*)|(?:[^:=>~@\^\&\*\)\[\]'\?,\|])).*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+/,!0,!1)||t.match(/_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)?"variableName.special":t.match(/\\\[[a-zA-Z\$][a-zA-Z0-9\$]*\]/,!0,!1)?"character":t.match(/(?:\[|\]|{|}|\(|\))/,!0,!1)?"bracket":t.match(/(?:#[a-zA-Z\$][a-zA-Z0-9\$]*|#+[0-9]?)/,!0,!1)?"variableName.constant":t.match(bm,!0,!1)?vm.indexOf(t.current())>-1?"number":wm.indexOf(t.current())>-1||0==wm.length?"keyword":t.current()in e.localVars?"atom":(e.localVars[t.current()]=!0,"function"):t.match(/(?:\\|\+|\-|\*|\/|,|;|\.|:|@|~|=|>|<|&|\||_|`|'|\^|\?|!|%)/,!0,!1)?"operator":(t.next(),"error"))}function Sm(t,e){for(var i,n=!1,s=!1;null!=(i=t.next());){if('"'===i&&!s){n=!0;break}s=!s&&"\\"===i}return n&&!s&&(e.tokenize=ym),"string"}function xm(t,e){for(var i,n;e.commentLevel>0&&null!=(n=t.next());)"("===i&&"*"===n&&e.commentLevel++,"*"===i&&")"===n&&e.commentLevel--,i=n;return e.commentLevel<=0&&(e.tokenize=ym),"comment"}const km={name:"mathematica",extendVariables:function(t){},startState:function(){return{tokenize:ym,commentLevel:0,localVars:{}}},token:function(t,e){return t.eatSpace()?null:e.tokenize(t,e)},languageData:{commentTokens:{block:{open:"(*",close:"*)"}}}};let Qm={of:t=>[Gl.define(km),Yd({override:[async e=>function(t,e){let i=t.matchBefore(/\w*/);return i.from!==i.to||t.explicit?{from:i.from,options:e.data}:null}(e,t)]}),Ys.of([{key:"Escape",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((t=>{let{from:e,to:i}=t;return{changes:{from:e,to:i,insert:"EC"},range:A.cursor(e+2)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])],reBuild:t=>{wm=t.map((t=>t.label))}};const $m=(t,e,i,n)=>{if(0==t.length)return;const s=(new Date).valueOf();let r=0;i.dom.loadingMark=!0;const o=i.dom.style.background;let a=0;console.log("Start animation");const l=setInterval((()=>{i.dom.style.setProperty("background","hsl("+a+"deg 100% 97%)","important"),a+=2,a>360&&(a=0)}),30);n.transaction(e,i,s,t.length);for(const a of t)Pm(a,((a,h)=>{n.file(e,i,s,a,h),r++,r>=t.length&&i.dom&&i.dom.loadingMark&&(i.dom.loadingMark=!1,setTimeout((()=>{i.dom.style.background=o,clearInterval(l),console.log("Stop animation")}),2e3))}),(()=>{console.warn("Fauilure");const t=i.dom.style.background;i.dom.style.background="rgb(255 189 189 / 97%)";let e=97;const n=setInterval((()=>{i.dom.style.background="rgb(255 189 189 / "+Math.round(e)+"%)",e*=.95}),30);clearInterval(l),setTimeout((()=>{clearInterval(n),i.dom.style.background=t}),3e3)}))};function Pm(t,e,i){const n=new FileReader;n.addEventListener("load",(n=>{const s=n.target.result;if(s.byteLength/1024/1024>100)return alert("Files > 100Mb are not supported for drag and drop"),void i();let r=base64ArrayBuffer(s);e(t.name,r)})),n.addEventListener("progress",(t=>{if(t.loaded&&t.total){const e=t.loaded/t.total*100;console.log(e)}})),n.readAsArrayBuffer(t)}const Cm=(t,e)=>Ts.domEventHandlers({drop(e,i){e.preventDefault();const n=[];e.dataTransfer.items?[...e.dataTransfer.items].forEach(((t,e)=>{if("file"===t.kind){const i=t.getAsFile();console.log(`… file[${e}].name = ${i.name}`),n.push(i)}})):[...e.dataTransfer.files].forEach(((t,e)=>{console.log(`… file[${e}].name = ${t.name}`),n.push(t)})),$m(n,e,i,t)},paste(t,i){let n=t.clipboardData||window.clipboardData;for(const s of n.items)if("string"===s.kind)switch(s.type){case"text/plain":break;case"image/png":t.preventDefault(),$m([s.getAsFile()],t,i,e)}else t.preventDefault(),$m([s.getAsFile()],t,i,e)}}),_m=new pr({regexp:/\\\[(\w+)\]/g,decoration:t=>ni.replace({widget:new Zm(t[1])})}),Xm=_i.fromClass(class{constructor(t){this.Greekholder=_m.createDeco(t)}update(t){this.Greekholder=_m.updateDeco(t,this.Greekholder)}},{decorations:t=>t.Greekholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Greekholder||ni.none))});class Zm extends ei{constructor(t){super(),this.name=t}eq(t){return this.name===t.name}toDOM(){let t=document.createElement("span");return t.innerHTML="&"+this.name.toLowerCase().replace("sqrt","radic").replace("undirectededge","harr").replace("directededge","rarr").replace(/capital(.*)/,((t,e)=>e.charAt(0).toUpperCase()+e.slice(1))).replace(/curly(.*)/,((t,e)=>e)).replace(/script(.*)/,((t,e)=>"el"+e.toLowerCase())).replace("transpose","#7488").replace("degree","deg")+";",t}ignoreEvent(){return!1}}const Am=new pr({regexp:/(->|<-)/g,decoration:t=>ni.replace({widget:new Tm(t[1])})});_i.fromClass(class{constructor(t){this.Arrowholder=Am.createDeco(t)}update(t){this.Arrowholder=Am.updateDeco(t,this.Arrowholder)}},{decorations:t=>t.Arrowholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Arrowholder||ni.none))});class Tm extends ei{constructor(t){super(),this.dir=t}eq(t){return this.dir===t.dir}toDOM(){let t=document.createElement("span");return"->"===this.dir?t.innerText="→":t.innerText="←",t}ignoreEvent(){return!1}}function Rm(t){if(!(t=t||{}).open)throw new Error('Balanced: please provide a "open" property');if(!t.close)throw new Error('Balanced: please provide a "close" property');if(this.balance=t.balance||!1,this.exceptions=t.exceptions||!1,this.caseInsensitive=t.caseInsensitive,this.head=t.head||t.open,this.head=Array.isArray(this.head)?this.head:[this.head],this.open=Array.isArray(t.open)?t.open:[t.open],this.close=Array.isArray(t.close)?t.close:[t.close],!Array.isArray(this.head)||!Array.isArray(this.open)||!Array.isArray(this.close)||this.head.length!==this.open.length||this.open.length!==this.close.length)throw new Error('Balanced: if you use arrays for a "head,open,close" you must use matching arrays for all options');var e=Dm(this.head.map(this.regExpFromArrayGroupedMap,this)),i=Dm(this.open.map(this.regExpFromArrayGroupedMap,this)),n=Dm(this.close.map(this.regExpFromArrayGroupedMap,this));this.regExp=Dm([e,i,n],"g"+(this.caseInsensitive?"i":"")),this.regExpGroupLength=this.head.length}function Em(t,e,i){for(var n=Mm(e.substr(0,i+1),/^.*\n?$/gim),s=Mm(e,/^.*\n?$/gim),r=n.length-1,o=i+1-(n.length?n[n.length-1].index:0),a="",l=2;l>=0;l--)r-l>=0&&s[r-l]&&(a+=e.substr(s[r-l].index,s[r-l].length)+"\n");for(l=0;l=0&&s[r+l]&&(a+=e.substr(s[r+l].index,s[r+l].length)+"\n");a=a.replace(/\t/g," ").replace(/\n$/,"");var h=new Error(t+" at "+(r+1)+":"+o+"\n\n"+a);return h.line=r+1,h.column=o,h.index=i,h}function Vm(t,e){return t>=e.index&&t<=e.index+e.length-1}function Mm(t,e){var i,n=new RegExp(e),s=[];if(t)for(;i=n.exec(t);)s.push({index:i.index,length:i[0].length,match:i[0]}),i[0].length||n.lastIndex++;return s}function Dm(t,e,i){var n=t.map((function(t){return t instanceof RegExp?t.source:function(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}(t)}),this).join("|");return n=i?"("+n+")":"(?:"+n+")",new RegExp(n,e||void 0)}Rm.prototype={regExpFromArrayGroupedMap:function(t){return Dm([t],null,!0)},matchContentsInBetweenBrackets:function(t,e){for(var i,n=new RegExp(this.regExp),s=[],r=[],o=null,a=!0;i=n.exec(t);){if(e){for(var l=!1,h=0;h{const i=((t,e,i)=>{var n,s=new RegExp(t),r=[];if(e)for(;n=s.exec(e);){if(i){for(var o=!1,a=0;a{new qm({open:"(*"+t+"[*)",close:"(*]"+t+"*)",balance:!1}).matchContentsInBetweenBrackets(e.value,[]).forEach((function(t){const s=e.value.slice(t.index+t.head.length,t.index+t.length-t.tail.length);n(i+t.index,{length:t.length,pos:i+t.index,argsPos:i+t.index+t.head.length,str:s})}))})(e,t,i,s)},o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)r(o,a)}var Im,Bm=function(){function t(t){var e=t.tag,i=t.decoration,n=t.decorate,s=t.boundary,r=t.maxLength,o=void 0===r?1e3:r;if(this.tag=e,n)this.addMatch=function(t,e,i,s){return n(s,i,i+t.length,t,e)};else if("function"==typeof i)this.addMatch=function(t,e,n,s){var r=i(t,e,n);r&&s(n,n+t.length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=function(t,e,n,s){return s(n,n+t.length,i)}}this.boundary=s,this.maxLength=o}return t.prototype.createDeco=function(t){for(var e=this,i=new Xt,n=i.add.bind(i),s=0,r=function(t,e){var i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;for(var n=[],s=0,r=i;s=a?n[n.length-1].to=l:n.push({from:a,to:l})}return n}(t,this.maxLength);st.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e},t.prototype.updateRange=function(t,e,i,n){for(var s=this,r=function(r){var a=Math.max(r.from,i),l=Math.min(r.to,n);if(l>a){var h=t.state.doc.lineAt(a),c=h.toh.from;a--)if(o.boundary.test(h.text[a-1-h.from])){u=a;break}for(;ld},add:f})}},o=this,a=0,l=t.visibleRanges;a{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*FB[*)((_)(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*FB[*)(("+s+")(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let Nm=class{constructor(t,e,i,n,s,r){this.view=e,this.visibleValue=t,this.placeholder=r,console.log(r),this.args=Lm(t.str,/\(\*,\*\)/gm);const o=this;let a,l;console.log("creating InstanceWidget"),a=Im({doc:o.args[0].body.slice(2,-1),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(o.visibleValue.pos),e.dispatch({selection:{anchor:o.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return l.dispatch({selection:{anchor:0}}),l.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){l.focus(),t.editorLastCursor=void 0}}])]}),l=Im({doc:o.args[2].body.slice(1,-2),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:a.state.doc.length}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:o.visibleValue.pos+o.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus(),t.editorLastCursor=void 0}}])]}),o.args[0].length=o.args[0].body.length,o.args[2].length=o.args[2].body.length,delete o.args[2].body,delete o.args[1].body,delete o.args[0].body,this.topEditor=a,this.bottomEditor=l}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="(("+t+")",s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length));const r=e.length-i[0].length;i[0].to=i[0].to+r,i[2].from=i[2].from+r,i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e="("+t+"))",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length));const r=e.length-i[2].length;i[2].to=i[2].to+r,i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t,e){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm),console.log("recreating InstanceWidget"),n=Im.state({doc:e.args[0].body.slice(2,-1),update:t=>e.applyChanges(t,0),eval:()=>{i.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(e.visibleValue.pos),i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus(),t.editorLastCursor=void 0}}])]}),s=Im.state({doc:e.args[2].body.slice(1,-2),update:t=>e.applyChanges(t,2),eval:()=>{e.view.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus(),t.editorLastCursor=void 0}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),console.log(e),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.placeholder=e,this.visibleValue.argsPos=t.argsPos}destroy(){this.topEditor.destroy(),this.bottomEditor.destroy()}},Gm=class extends ei{constructor(t,e,i,n){super(),this.view=i,this.visibleValue=t,this.reference=e,this.placeholder=n}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue,this),!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("fraction");const i=document.createElement("table");i.classList.add("container"),e.appendChild(i);const n=document.createElement("tbody");i.appendChild(n);const s=document.createElement("tr"),r=document.createElement("tr");n.appendChild(s),n.appendChild(r);const o=document.createElement("td");o.classList.add("enumenator"),s.appendChild(o);const a=document.createElement("td");r.appendChild(a);const l=this;return e.EditorWidget=new Nm(this.visibleValue,t,o,a,[],this),this.DOMElement=e,this.reference.push({destroy:()=>{l.destroy(e)}}),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const Fm=(t,e,i)=>new Bm({tag:"FB",decoration:n=>ni.replace({widget:new Gm(n,t,e,i)})}),Hm=t=>_i.fromClass(class{constructor(e){this.disposable=[],this.placeholder=Fm(this.disposable,e,this).createDeco(e),t.placeholder=this}update(t){this.placeholder=Fm(this.disposable,t,this).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var Jm;function Km(t){return Jm=t,[nb,Ys.of([{key:"Ctrl-2",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt[_](*]SqB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt["+s+"](*]SqB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let tb=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;this.sliceRanges=n,this.length=t.str.length,console.log("creating InstanceWidget"),this.editor=Jm({doc:t.str.slice(...n),parent:i,update:t=>r.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]})}applyChanges(t){const e=t,i={from:this.visibleValue.argsPos+5,to:this.visibleValue.argsPos+this.length-1,insert:e};console.log(this.visibleValue);const n=e.length+6-this.length;this.length=this.length+n,this.visibleValue.length=this.visibleValue.length+n,this.visibleValue.str="Sqrt["+e+"]",this.view.dispatch({changes:i})}update(t){if(this.visibleValue.str==t.str)this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos;else{console.warn("Out of sync"),this.visibleValue=t;const e=this.sliceRanges,i=this.editor,n=this,s=this.view;this.length=t.str.length;const r=Jm.state({doc:t.str.slice(...e),update:t=>n.applyChanges(t),eval:()=>{s.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos+n.visibleValue.length}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]});i.setState(r)}}destroy(){console.warn("destroy Instance of Widget!"),this.editor.destroy()}},eb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("sqroot");const i=this,n=document.createElement("span");return n.classList.add("radicand"),e.EditorWidget=new tb(this.visibleValue,t,n,[5,-1],[]),e.appendChild(n),this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const ib=(t,e)=>new Bm({tag:"SqB",decoration:i=>ni.replace({widget:new eb(i,t,e)})}),nb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=ib(this.disposable,t).createDeco(t)}update(t){this.placeholder=ib(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var sb;function rb(t){return sb=t,[hb,Ys.of([{key:"Ctrl--",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SbB[*)Subscript[_(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SbB[*)Subscript["+s+"(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let ob=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),console.log(r.visibleValue),o=sb({doc:r.args[0].body.slice(10),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){a.focus()}}])]}),a=sb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Subscript["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),console.log(e.visibleValue),n=sb.state({doc:e.args[0].body.slice(10),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus()}}])]}),s=sb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},ab=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sub");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new ob(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const lb=(t,e)=>new Bm({tag:"SbB",decoration:i=>ni.replace({widget:new ab(i,t,e)})}),hb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=lb(this.disposable,t).createDeco(t)}update(t){this.placeholder=lb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var cb;function ub(t){return cb=t,[Ob,Ys.of([{key:"Ctrl-6",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SpB[*)Power[_(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SpB[*)Power["+s+"(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let db=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),o=cb({doc:r.args[0].body.slice(6),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus()}}])]}),a=cb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Power["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),n=cb.state({doc:e.args[0].body.slice(6),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.bottomEditor.focus()}}])]}),s=cb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},fb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sup");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new db(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}destroy(t){t.EditorWidget.destroy()}};const pb=(t,e)=>new Bm({tag:"SpB",decoration:i=>ni.replace({widget:new fb(i,t,e)})}),Ob=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=pb(this.disposable,t).createDeco(t)}update(t){this.placeholder=pb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var gb={},mb={},bb={},wb={};function vb(t){let e=t.length;for(;--e>=0;)t[e]=0}const yb=256,Sb=286,xb=30,kb=15,Qb=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),$b=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Pb=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Cb=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_b=new Array(576);vb(_b);const Xb=new Array(60);vb(Xb);const Zb=new Array(512);vb(Zb);const Ab=new Array(256);vb(Ab);const Tb=new Array(29);vb(Tb);const Rb=new Array(xb);function Eb(t,e,i,n,s){this.static_tree=t,this.extra_bits=e,this.extra_base=i,this.elems=n,this.max_length=s,this.has_stree=t&&t.length}let Vb,Mb,Db;function Wb(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}vb(Rb);const Ub=t=>t<256?Zb[t]:Zb[256+(t>>>7)],Yb=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},qb=(t,e,i)=>{t.bi_valid>16-i?(t.bi_buf|=e<>16-t.bi_valid,t.bi_valid+=i-16):(t.bi_buf|=e<{qb(t,i[2*e],i[2*e+1])},zb=(t,e)=>{let i=0;do{i|=1&t,t>>>=1,i<<=1}while(--e>0);return i>>>1},Ib=(t,e,i)=>{const n=new Array(16);let s,r,o=0;for(s=1;s<=kb;s++)o=o+i[s-1]<<1,n[s]=o;for(r=0;r<=e;r++){let e=t[2*r+1];0!==e&&(t[2*r]=zb(n[e]++,e))}},Bb=t=>{let e;for(e=0;e{t.bi_valid>8?Yb(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},Nb=(t,e,i,n)=>{const s=2*e,r=2*i;return t[s]{const n=t.heap[i];let s=i<<1;for(;s<=t.heap_len&&(s{let n,s,r,o,a=0;if(0!==t.sym_next)do{n=255&t.pending_buf[t.sym_buf+a++],n+=(255&t.pending_buf[t.sym_buf+a++])<<8,s=t.pending_buf[t.sym_buf+a++],0===n?Lb(t,s,e):(r=Ab[s],Lb(t,r+yb+1,e),o=Qb[r],0!==o&&(s-=Tb[r],qb(t,s,o)),n--,r=Ub(n),Lb(t,r,i),o=$b[r],0!==o&&(n-=Rb[r],qb(t,n,o)))}while(a{const i=e.dyn_tree,n=e.stat_desc.static_tree,s=e.stat_desc.has_stree,r=e.stat_desc.elems;let o,a,l,h=-1;for(t.heap_len=0,t.heap_max=573,o=0;o>1;o>=1;o--)Gb(t,i,o);l=r;do{o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Gb(t,i,1),a=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=a,i[2*l]=i[2*o]+i[2*a],t.depth[l]=(t.depth[o]>=t.depth[a]?t.depth[o]:t.depth[a])+1,i[2*o+1]=i[2*a+1]=l,t.heap[1]=l++,Gb(t,i,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const i=e.dyn_tree,n=e.max_code,s=e.stat_desc.static_tree,r=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,l=e.stat_desc.max_length;let h,c,u,d,f,p,O=0;for(d=0;d<=kb;d++)t.bl_count[d]=0;for(i[2*t.heap[t.heap_max]+1]=0,h=t.heap_max+1;h<573;h++)c=t.heap[h],d=i[2*i[2*c+1]+1]+1,d>l&&(d=l,O++),i[2*c+1]=d,c>n||(t.bl_count[d]++,f=0,c>=a&&(f=o[c-a]),p=i[2*c],t.opt_len+=p*(d+f),r&&(t.static_len+=p*(s[2*c+1]+f)));if(0!==O){do{for(d=l-1;0===t.bl_count[d];)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[l]--,O-=2}while(O>0);for(d=l;0!==d;d--)for(c=t.bl_count[d];0!==c;)u=t.heap[--h],u>n||(i[2*u+1]!==d&&(t.opt_len+=(d-i[2*u+1])*i[2*u],i[2*u+1]=d),c--)}})(t,e),Ib(i,h,t.bl_count)},Jb=(t,e,i)=>{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),e[2*(i+1)+1]=65535,n=0;n<=i;n++)s=o,o=e[2*(n+1)+1],++a{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),n=0;n<=i;n++)if(s=o,o=e[2*(n+1)+1],!(++a{qb(t,0+(n?1:0),3),jb(t),Yb(t,i),Yb(t,~i),i&&t.pending_buf.set(t.window.subarray(e,e+i),t.pending),t.pending+=i};wb._tr_init=t=>{tw||((()=>{let t,e,i,n,s;const r=new Array(16);for(i=0,n=0;n<28;n++)for(Tb[n]=i,t=0;t<1<>=7;n{let s,r,o=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e{let e;for(Jb(t,t.dyn_ltree,t.l_desc.max_code),Jb(t,t.dyn_dtree,t.d_desc.max_code),Hb(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*Cb[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=i+5,i+4<=s&&-1!==e?ew(t,e,i,n):4===t.strategy||r===s?(qb(t,2+(n?1:0),3),Fb(t,_b,Xb)):(qb(t,4+(n?1:0),3),((t,e,i,n)=>{let s;for(qb(t,e-257,5),qb(t,i-1,5),qb(t,n-4,4),s=0;s(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=i,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(Ab[i]+yb+1)]++,t.dyn_dtree[2*Ub(e)]++),t.sym_next===t.sym_end),wb._tr_align=t=>{qb(t,2,3),Lb(t,256,_b),(t=>{16===t.bi_valid?(Yb(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)};var iw=(t,e,i,n)=>{let s=65535&t|0,r=t>>>16&65535|0,o=0;for(;0!==i;){o=i>2e3?2e3:i,i-=o;do{s=s+e[n++]|0,r=r+s|0}while(--o);s%=65521,r%=65521}return s|r<<16|0};const nw=new Uint32Array((()=>{let t,e=[];for(var i=0;i<256;i++){t=i;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e})());var sw=(t,e,i,n)=>{const s=nw,r=n+i;t^=-1;for(let i=n;i>>8^s[255&(t^e[i])];return-1^t},rw={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},ow={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:aw,_tr_stored_block:lw,_tr_flush_block:hw,_tr_tally:cw,_tr_align:uw}=wb,dw=iw,fw=sw,pw=rw,{Z_NO_FLUSH:Ow,Z_PARTIAL_FLUSH:gw,Z_FULL_FLUSH:mw,Z_FINISH:bw,Z_BLOCK:ww,Z_OK:vw,Z_STREAM_END:yw,Z_STREAM_ERROR:Sw,Z_DATA_ERROR:xw,Z_BUF_ERROR:kw,Z_DEFAULT_COMPRESSION:Qw,Z_FILTERED:$w,Z_HUFFMAN_ONLY:Pw,Z_RLE:Cw,Z_FIXED:_w,Z_DEFAULT_STRATEGY:Xw,Z_UNKNOWN:Zw,Z_DEFLATED:Aw}=ow,Tw=258,Rw=262,Ew=42,Vw=113,Mw=666,Dw=(t,e)=>(t.msg=pw[e],e),Ww=t=>2*t-(t>4?9:0),Uw=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Yw=t=>{let e,i,n,s=t.w_size;e=t.hash_size,n=e;do{i=t.head[--n],t.head[n]=i>=s?i-s:0}while(--e);e=s,n=e;do{i=t.prev[--n],t.prev[n]=i>=s?i-s:0}while(--e)};let qw=(t,e,i)=>(e<{const e=t.state;let i=e.pending;i>t.avail_out&&(i=t.avail_out),0!==i&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+i),t.next_out),t.next_out+=i,e.pending_out+=i,t.total_out+=i,t.avail_out-=i,e.pending-=i,0===e.pending&&(e.pending_out=0))},zw=(t,e)=>{hw(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Lw(t.strm)},Iw=(t,e)=>{t.pending_buf[t.pending++]=e},Bw=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},jw=(t,e,i,n)=>{let s=t.avail_in;return s>n&&(s=n),0===s?0:(t.avail_in-=s,e.set(t.input.subarray(t.next_in,t.next_in+s),i),1===t.state.wrap?t.adler=dw(t.adler,e,s,i):2===t.state.wrap&&(t.adler=fw(t.adler,e,s,i)),t.next_in+=s,t.total_in+=s,s)},Nw=(t,e)=>{let i,n,s=t.max_chain_length,r=t.strstart,o=t.prev_length,a=t.nice_match;const l=t.strstart>t.w_size-Rw?t.strstart-(t.w_size-Rw):0,h=t.window,c=t.w_mask,u=t.prev,d=t.strstart+Tw;let f=h[r+o-1],p=h[r+o];t.prev_length>=t.good_match&&(s>>=2),a>t.lookahead&&(a=t.lookahead);do{if(i=e,h[i+o]===p&&h[i+o-1]===f&&h[i]===h[r]&&h[++i]===h[r+1]){r+=2,i++;do{}while(h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&ro){if(t.match_start=e,o=n,n>=a)break;f=h[r+o-1],p=h[r+o]}}}while((e=u[e&c])>l&&0!=--s);return o<=t.lookahead?o:t.lookahead},Gw=t=>{const e=t.w_size;let i,n,s;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Rw)&&(t.window.set(t.window.subarray(e,e+e-n),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Yw(t),n+=e),0===t.strm.avail_in)break;if(i=jw(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=i,t.lookahead+t.insert>=3)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=qw(t,t.ins_h,t.window[s+1]);t.insert&&(t.ins_h=qw(t,t.ins_h,t.window[s+3-1]),t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead{let i,n,s,r=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,o=0,a=t.strm.avail_in;do{if(i=65535,s=t.bi_valid+42>>3,t.strm.avail_outn+t.strm.avail_in&&(i=n+t.strm.avail_in),i>s&&(i=s),i>8,t.pending_buf[t.pending-2]=~i,t.pending_buf[t.pending-1]=~i>>8,Lw(t.strm),n&&(n>i&&(n=i),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+n),t.strm.next_out),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n,t.block_start+=n,i-=n),i&&(jw(t.strm,t.strm.output,t.strm.next_out,i),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i)}while(0===o);return a-=t.strm.avail_in,a&&(a>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=a&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-a,t.strm.next_in),t.strstart),t.strstart+=a,t.insert+=a>t.w_size-t.insert?t.w_size-t.insert:a),t.block_start=t.strstart),t.high_waters&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,s+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),s>t.strm.avail_in&&(s=t.strm.avail_in),s&&(jw(t.strm,t.window,t.strstart,s),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.high_water>3,s=t.pending_buf_size-s>65535?65535:t.pending_buf_size-s,r=s>t.w_size?t.w_size:s,n=t.strstart-t.block_start,(n>=r||(n||e===bw)&&e!==Ow&&0===t.strm.avail_in&&n<=s)&&(i=n>s?s:n,o=e===bw&&0===t.strm.avail_in&&i===n?1:0,lw(t,t.block_start,i,o),t.block_start+=i,Lw(t.strm)),o?3:1)},Hw=(t,e)=>{let i,n;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==i&&t.strstart-i<=t.w_size-Rw&&(t.match_length=Nw(t,i)),t.match_length>=3)if(n=cw(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=qw(t,t.ins_h,t.window[t.strstart+1]);else n=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2},Jw=(t,e)=>{let i,n,s;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==i&&t.prev_length4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){s=t.strstart+t.lookahead-3,n=cw(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=s&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(zw(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(n=cw(t,0,t.window[t.strstart-1]),n&&zw(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=cw(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2};function Kw(t,e,i,n,s){this.good_length=t,this.max_lazy=e,this.nice_length=i,this.max_chain=n,this.func=s}const tv=[new Kw(0,0,0,0,Fw),new Kw(4,4,8,4,Hw),new Kw(4,5,16,8,Hw),new Kw(4,6,32,32,Hw),new Kw(4,4,16,16,Jw),new Kw(8,16,32,32,Jw),new Kw(8,16,128,128,Jw),new Kw(8,32,128,256,Jw),new Kw(32,128,258,1024,Jw),new Kw(32,258,258,4096,Jw)];function ev(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Aw,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Uw(this.dyn_ltree),Uw(this.dyn_dtree),Uw(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Uw(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Uw(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const iv=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==Ew&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==Vw&&e.status!==Mw?1:0},nv=t=>{if(iv(t))return Dw(t,Sw);t.total_in=t.total_out=0,t.data_type=Zw;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?Ew:Vw,t.adler=2===e.wrap?0:1,e.last_flush=-2,aw(e),vw},sv=t=>{const e=nv(t);var i;return e===vw&&((i=t.state).window_size=2*i.w_size,Uw(i.head),i.max_lazy_match=tv[i.level].max_lazy,i.good_match=tv[i.level].good_length,i.nice_match=tv[i.level].nice_length,i.max_chain_length=tv[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=2,i.match_available=0,i.ins_h=0),e},rv=(t,e,i,n,s,r)=>{if(!t)return Sw;let o=1;if(e===Qw&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),s<1||s>9||i!==Aw||n<8||n>15||e<0||e>9||r<0||r>_w||8===n&&1!==o)return Dw(t,Sw);8===n&&(n=9);const a=new ev;return t.state=a,a.strm=t,a.status=Ew,a.wrap=o,a.gzhead=null,a.w_bits=n,a.w_size=1<rv(t,e,Aw,15,8,Xw),bb.deflateInit2=rv,bb.deflateReset=sv,bb.deflateResetKeep=nv,bb.deflateSetHeader=(t,e)=>iv(t)||2!==t.state.wrap?Sw:(t.state.gzhead=e,vw),bb.deflate=(t,e)=>{if(iv(t)||e>ww||e<0)return t?Dw(t,Sw):Sw;const i=t.state;if(!t.output||0!==t.avail_in&&!t.input||i.status===Mw&&e!==bw)return Dw(t,0===t.avail_out?kw:Sw);const n=i.last_flush;if(i.last_flush=e,0!==i.pending){if(Lw(t),0===t.avail_out)return i.last_flush=-1,vw}else if(0===t.avail_in&&Ww(e)<=Ww(n)&&e!==bw)return Dw(t,kw);if(i.status===Mw&&0!==t.avail_in)return Dw(t,kw);if(i.status===Ew&&0===i.wrap&&(i.status=Vw),i.status===Ew){let e=Aw+(i.w_bits-8<<4)<<8,n=-1;if(n=i.strategy>=Pw||i.level<2?0:i.level<6?1:6===i.level?2:3,e|=n<<6,0!==i.strstart&&(e|=32),e+=31-e%31,Bw(i,e),0!==i.strstart&&(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),t.adler=1,i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(57===i.status)if(t.adler=0,Iw(i,31),Iw(i,139),Iw(i,8),i.gzhead)Iw(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),Iw(i,255&i.gzhead.time),Iw(i,i.gzhead.time>>8&255),Iw(i,i.gzhead.time>>16&255),Iw(i,i.gzhead.time>>24&255),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(Iw(i,255&i.gzhead.extra.length),Iw(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=fw(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if(Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,3),i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw;if(69===i.status){if(i.gzhead.extra){let e=i.pending,n=(65535&i.gzhead.extra.length)-i.gzindex;for(;i.pending+n>i.pending_buf_size;){let s=i.pending_buf_size-i.pending;if(i.pending_buf.set(i.gzhead.extra.subarray(i.gzindex,i.gzindex+s),i.pending),i.pending=i.pending_buf_size,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex+=s,Lw(t),0!==i.pending)return i.last_flush=-1,vw;e=0,n-=s}let s=new Uint8Array(i.gzhead.extra);i.pending_buf.set(s.subarray(i.gzindex,i.gzindex+n),i.pending),i.pending+=n,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex=0}i.status=73}if(73===i.status){if(i.gzhead.name){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),i.gzindex=0}i.status=91}if(91===i.status){if(i.gzhead.comment){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n))}i.status=103}if(103===i.status){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size&&(Lw(t),0!==i.pending))return i.last_flush=-1,vw;Iw(i,255&t.adler),Iw(i,t.adler>>8&255),t.adler=0}if(i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(0!==t.avail_in||0!==i.lookahead||e!==Ow&&i.status!==Mw){let n=0===i.level?Fw(i,e):i.strategy===Pw?((t,e)=>{let i;for(;;){if(0===t.lookahead&&(Gw(t),0===t.lookahead)){if(e===Ow)return 1;break}if(t.match_length=0,i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):i.strategy===Cw?((t,e)=>{let i,n,s,r;const o=t.window;for(;;){if(t.lookahead<=Tw){if(Gw(t),t.lookahead<=Tw&&e===Ow)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(s=t.strstart-1,n=o[s],n===o[++s]&&n===o[++s]&&n===o[++s])){r=t.strstart+Tw;do{}while(n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&st.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(i=cw(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):tv[i.level].func(i,e);if(3!==n&&4!==n||(i.status=Mw),1===n||3===n)return 0===t.avail_out&&(i.last_flush=-1),vw;if(2===n&&(e===gw?uw(i):e!==ww&&(lw(i,0,0,!1),e===mw&&(Uw(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),Lw(t),0===t.avail_out))return i.last_flush=-1,vw}return e!==bw?vw:i.wrap<=0?yw:(2===i.wrap?(Iw(i,255&t.adler),Iw(i,t.adler>>8&255),Iw(i,t.adler>>16&255),Iw(i,t.adler>>24&255),Iw(i,255&t.total_in),Iw(i,t.total_in>>8&255),Iw(i,t.total_in>>16&255),Iw(i,t.total_in>>24&255)):(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),Lw(t),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?vw:yw)},bb.deflateEnd=t=>{if(iv(t))return Sw;const e=t.state.status;return t.state=null,e===Vw?Dw(t,xw):vw},bb.deflateSetDictionary=(t,e)=>{let i=e.length;if(iv(t))return Sw;const n=t.state,s=n.wrap;if(2===s||1===s&&n.status!==Ew||n.lookahead)return Sw;if(1===s&&(t.adler=dw(t.adler,e,i,0)),n.wrap=0,i>=n.w_size){0===s&&(Uw(n.head),n.strstart=0,n.block_start=0,n.insert=0);let t=new Uint8Array(n.w_size);t.set(e.subarray(i-n.w_size,i),0),e=t,i=n.w_size}const r=t.avail_in,o=t.next_in,a=t.input;for(t.avail_in=i,t.next_in=0,t.input=e,Gw(n);n.lookahead>=3;){let t=n.strstart,e=n.lookahead-2;do{n.ins_h=qw(n,n.ins_h,n.window[t+3-1]),n.prev[t&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=t,t++}while(--e);n.strstart=t,n.lookahead=2,Gw(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,t.next_in=o,t.input=a,t.avail_in=r,n.wrap=s,vw},bb.deflateInfo="pako deflate (from Nodeca project)";var ov={};const av=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);ov.assign=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const e in i)av(i,e)&&(t[e]=i[e])}}return t},ov.flattenChunks=t=>{let e=0;for(let i=0,n=t.length;i=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;cv[254]=cv[254]=1,lv.string2buf=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,i,n,s,r,o=t.length,a=0;for(s=0;s>>6,e[r++]=128|63&i):i<65536?(e[r++]=224|i>>>12,e[r++]=128|i>>>6&63,e[r++]=128|63&i):(e[r++]=240|i>>>18,e[r++]=128|i>>>12&63,e[r++]=128|i>>>6&63,e[r++]=128|63&i);return e};lv.buf2string=(t,e)=>{const i=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let n,s;const r=new Array(2*i);for(s=0,n=0;n4)r[s++]=65533,n+=o-1;else{for(e&=2===o?31:3===o?15:7;o>1&&n1?r[s++]=65533:e<65536?r[s++]=e:(e-=65536,r[s++]=55296|e>>10&1023,r[s++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&hv)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let i="";for(let n=0;n{(e=e||t.length)>t.length&&(e=t.length);let i=e-1;for(;i>=0&&128==(192&t[i]);)i--;return i<0||0===i?e:i+cv[t[i]]>e?i:e};var uv=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const dv=bb,fv=ov,pv=lv,Ov=rw,gv=uv,mv=Object.prototype.toString,{Z_NO_FLUSH:bv,Z_SYNC_FLUSH:wv,Z_FULL_FLUSH:vv,Z_FINISH:yv,Z_OK:Sv,Z_STREAM_END:xv,Z_DEFAULT_COMPRESSION:kv,Z_DEFAULT_STRATEGY:Qv,Z_DEFLATED:$v}=ow;function Pv(t){this.options=fv.assign({level:kv,method:$v,chunkSize:16384,windowBits:15,memLevel:8,strategy:Qv},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new gv,this.strm.avail_out=0;let i=dv.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(i!==Sv)throw new Error(Ov[i]);if(e.header&&dv.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?pv.string2buf(e.dictionary):"[object ArrayBuffer]"===mv.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,i=dv.deflateSetDictionary(this.strm,t),i!==Sv)throw new Error(Ov[i]);this._dict_set=!0}}function Cv(t,e){const i=new Pv(e);if(i.push(t,!0),i.err)throw i.msg||Ov[i.err];return i.result}Pv.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize;let s,r;if(this.ended)return!1;for(r=e===~~e?e:!0===e?yv:bv,"string"==typeof t?i.input=pv.string2buf(t):"[object ArrayBuffer]"===mv.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),(r===wv||r===vv)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(s=dv.deflate(i,r),s===xv)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),s=dv.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===Sv;if(0!==i.avail_out){if(r>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},Pv.prototype.onData=function(t){this.chunks.push(t)},Pv.prototype.onEnd=function(t){t===Sv&&(this.result=fv.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},mb.Deflate=Pv,mb.deflate=Cv,mb.deflateRaw=function(t,e){return(e=e||{}).raw=!0,Cv(t,e)},mb.gzip=function(t,e){return(e=e||{}).gzip=!0,Cv(t,e)},mb.constants=ow;var _v={},Xv={};const Zv=16209;const Av=15,Tv=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Rv=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Ev=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Vv=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Mv=(t,e,i,n,s,r,o,a)=>{const l=a.bits;let h,c,u,d,f,p,O=0,g=0,m=0,b=0,w=0,v=0,y=0,S=0,x=0,k=0,Q=null;const $=new Uint16Array(16),P=new Uint16Array(16);let C,_,X,Z=null;for(O=0;O<=Av;O++)$[O]=0;for(g=0;g=1&&0===$[b];b--);if(w>b&&(w=b),0===b)return s[r++]=20971520,s[r++]=20971520,a.bits=1,0;for(m=1;m0&&(0===t||1!==b))return-1;for(P[1]=0,O=1;O852||2===t&&x>592)return 1;for(;;){C=O-y,o[g]+1=p?(_=Z[o[g]-p],X=Q[o[g]-p]):(_=96,X=0),h=1<>y)+c]=C<<24|_<<16|X|0}while(0!==c);for(h=1<>=1;if(0!==h?(k&=h-1,k+=h):k=0,g++,0==--$[O]){if(O===b)break;O=e[i+o[g]]}if(O>w&&(k&d)!==u){for(0===y&&(y=w),f+=m,v=O-y,S=1<852||2===t&&x>592)return 1;u=k&d,s[u]=w<<24|v<<16|f-r|0}}return 0!==k&&(s[f+k]=O-y<<24|64<<16|0),a.bits=w,0};const Dv=iw,Wv=sw,Uv=function(t,e){let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,y,S,x,k,Q;const $=t.state;i=t.next_in,k=t.input,n=i+(t.avail_in-5),s=t.next_out,Q=t.output,r=s-(e-t.avail_out),o=s+(t.avail_out-257),a=$.dmax,l=$.wsize,h=$.whave,c=$.wnext,u=$.window,d=$.hold,f=$.bits,p=$.lencode,O=$.distcode,g=(1<<$.lenbits)-1,m=(1<<$.distbits)-1;t:do{f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,0===w)Q[s++]=65535&b;else{if(!(16&w)){if(0==(64&w)){b=p[(65535&b)+(d&(1<>>=w,f-=w),f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,!(16&w)){if(0==(64&w)){b=O[(65535&b)+(d&(1<a){t.msg="invalid distance too far back",$.mode=Zv;break t}if(d>>>=w,f-=w,w=s-r,y>w){if(w=y-w,w>h&&$.sane){t.msg="invalid distance too far back",$.mode=Zv;break t}if(S=0,x=u,0===c){if(S+=l-w,w2;)Q[s++]=x[S++],Q[s++]=x[S++],Q[s++]=x[S++],v-=3;v&&(Q[s++]=x[S++],v>1&&(Q[s++]=x[S++]))}else{S=s-y;do{Q[s++]=Q[S++],Q[s++]=Q[S++],Q[s++]=Q[S++],v-=3}while(v>2);v&&(Q[s++]=Q[S++],v>1&&(Q[s++]=Q[S++]))}break}}break}}while(i>3,i-=v,f-=v<<3,d&=(1<(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function hy(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const cy=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode16211?1:0},uy=t=>{if(cy(t))return Nv;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Kv,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,Iv},dy=t=>{if(cy(t))return Nv;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,uy(t)},fy=(t,e)=>{let i;if(cy(t))return Nv;const n=t.state;return e<0?(i=0,e=-e):(i=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?Nv:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=i,n.wbits=e,dy(t))},py=(t,e)=>{if(!t)return Nv;const i=new hy;t.state=i,i.strm=t,i.window=null,i.mode=Kv;const n=fy(t,e);return n!==Iv&&(t.state=null),n};let Oy,gy,my=!0;const by=t=>{if(my){Oy=new Int32Array(512),gy=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Yv(1,t.lens,0,288,Oy,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Yv(2,t.lens,0,32,gy,0,t.work,{bits:5}),my=!1}t.lencode=Oy,t.lenbits=9,t.distcode=gy,t.distbits=5},wy=(t,e,i,n)=>{let s;const r=t.state;return null===r.window&&(r.wsize=1<=r.wsize?(r.window.set(e.subarray(i-r.wsize,i),0),r.wnext=0,r.whave=r.wsize):(s=r.wsize-r.wnext,s>n&&(s=n),r.window.set(e.subarray(i-n,i-n+s),r.wnext),(n-=s)?(r.window.set(e.subarray(i-n,i),0),r.wnext=n,r.whave=r.wsize):(r.wnext+=s,r.wnext===r.wsize&&(r.wnext=0),r.whavepy(t,15),Xv.inflateInit2=py,Xv.inflate=(t,e)=>{let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,y,S,x,k=0;const Q=new Uint8Array(4);let $,P;const C=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(cy(t)||!t.output||!t.input&&0!==t.avail_in)return Nv;i=t.state,i.mode===ey&&(i.mode=iy),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,u=a,d=l,x=Iv;t:for(;;)switch(i.mode){case Kv:if(0===i.wrap){i.mode=iy;break}for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0),h=0,c=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",i.mode=ay;break}if((15&h)!==Jv){t.msg="unknown compression method",i.mode=ay;break}if(h>>>=4,c-=4,S=8+(15&h),0===i.wbits&&(i.wbits=S),S>15||S>i.wbits){t.msg="invalid window size",i.mode=ay;break}i.dmax=1<>8&1),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16182;case 16182:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>8&255,Q[2]=h>>>16&255,Q[3]=h>>>24&255,i.check=Wv(i.check,Q,4,0)),h=0,c=0,i.mode=16183;case 16183:for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>8),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16184;case 16184:if(1024&i.flags){for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(f=i.length,f>a&&(f=a),f&&(i.head&&(S=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(n.subarray(r,r+f),S)),512&i.flags&&4&i.wrap&&(i.check=Wv(i.check,n,f,r)),a-=f,r+=f,i.length-=f),i.length))break t;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===a)break t;f=0;do{S=n[r+f++],i.head&&S&&i.length<65536&&(i.head.name+=String.fromCharCode(S))}while(S&&f>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=ey;break;case 16189:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>=7&c,c-=7&c,i.mode=oy;break}for(;c<3;){if(0===a)break t;a--,h+=n[r++]<>>=1,c-=1,3&h){case 0:i.mode=16193;break;case 1:if(by(i),i.mode=sy,e===zv){h>>>=2,c-=2;break t}break;case 2:i.mode=16196;break;case 3:t.msg="invalid block type",i.mode=ay}h>>>=2,c-=2;break;case 16193:for(h>>>=7&c,c-=7&c;c<32;){if(0===a)break t;a--,h+=n[r++]<>>16^65535)){t.msg="invalid stored block lengths",i.mode=ay;break}if(i.length=65535&h,h=0,c=0,i.mode=ny,e===zv)break t;case ny:i.mode=16195;case 16195:if(f=i.length,f){if(f>a&&(f=a),f>l&&(f=l),0===f)break t;s.set(n.subarray(r,r+f),o),a-=f,r+=f,l-=f,o+=f,i.length-=f;break}i.mode=ey;break;case 16196:for(;c<14;){if(0===a)break t;a--,h+=n[r++]<>>=5,c-=5,i.ndist=1+(31&h),h>>>=5,c-=5,i.ncode=4+(15&h),h>>>=4,c-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=ay;break}i.have=0,i.mode=16197;case 16197:for(;i.have>>=3,c-=3}for(;i.have<19;)i.lens[C[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,$={bits:i.lenbits},x=Yv(0,i.lens,0,19,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid code lengths set",i.mode=ay;break}i.have=0,i.mode=16198;case 16198:for(;i.have>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=g,c-=g,i.lens[i.have++]=b;else{if(16===b){for(P=g+2;c>>=g,c-=g,0===i.have){t.msg="invalid bit length repeat",i.mode=ay;break}S=i.lens[i.have-1],f=3+(3&h),h>>>=2,c-=2}else if(17===b){for(P=g+3;c>>=g,c-=g,S=0,f=3+(7&h),h>>>=3,c-=3}else{for(P=g+7;c>>=g,c-=g,S=0,f=11+(127&h),h>>>=7,c-=7}if(i.have+f>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=ay;break}for(;f--;)i.lens[i.have++]=S}}if(i.mode===ay)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=ay;break}if(i.lenbits=9,$={bits:i.lenbits},x=Yv(1,i.lens,0,i.nlen,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid literal/lengths set",i.mode=ay;break}if(i.distbits=6,i.distcode=i.distdyn,$={bits:i.distbits},x=Yv(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,$),i.distbits=$.bits,x){t.msg="invalid distances set",i.mode=ay;break}if(i.mode=sy,e===zv)break t;case sy:i.mode=ry;case ry:if(a>=6&&l>=258){t.next_out=o,t.avail_out=l,t.next_in=r,t.avail_in=a,i.hold=h,i.bits=c,Uv(t,d),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,i.mode===ey&&(i.back=-1);break}for(i.back=0;k=i.lencode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,i.length=b,0===m){i.mode=16205;break}if(32&m){i.back=-1,i.mode=ey;break}if(64&m){t.msg="invalid literal/length code",i.mode=ay;break}i.extra=15&m,i.mode=16201;case 16201:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;k=i.distcode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,64&m){t.msg="invalid distance code",i.mode=ay;break}i.offset=b,i.extra=15&m,i.mode=16203;case 16203:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=ay;break}i.mode=16204;case 16204:if(0===l)break t;if(f=d-l,i.offset>f){if(f=i.offset-f,f>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=ay;break}f>i.wnext?(f-=i.wnext,p=i.wsize-f):p=i.wnext-f,f>i.length&&(f=i.length),O=i.window}else O=s,p=o-i.offset,f=i.length;f>l&&(f=l),l-=f,i.length-=f;do{s[o++]=O[p++]}while(--f);0===i.length&&(i.mode=ry);break;case 16205:if(0===l)break t;s[o++]=i.length,l--,i.mode=ry;break;case oy:if(i.wrap){for(;c<32;){if(0===a)break t;a--,h|=n[r++]<{if(cy(t))return Nv;let e=t.state;return e.window&&(e.window=null),t.state=null,Iv},Xv.inflateGetHeader=(t,e)=>{if(cy(t))return Nv;const i=t.state;return 0==(2&i.wrap)?Nv:(i.head=e,e.done=!1,Iv)},Xv.inflateSetDictionary=(t,e)=>{const i=e.length;let n,s,r;return cy(t)?Nv:(n=t.state,0!==n.wrap&&n.mode!==ty?Nv:n.mode===ty&&(s=1,s=Dv(s,e,i,0),s!==n.check)?Gv:(r=wy(t,e,i,i),r?(n.mode=16210,Fv):(n.havedict=1,Iv)))},Xv.inflateInfo="pako inflate (from Nodeca project)";const vy=Xv,yy=ov,Sy=lv,xy=rw,ky=uv,Qy=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},$y=Object.prototype.toString,{Z_NO_FLUSH:Py,Z_FINISH:Cy,Z_OK:_y,Z_STREAM_END:Xy,Z_NEED_DICT:Zy,Z_STREAM_ERROR:Ay,Z_DATA_ERROR:Ty,Z_MEM_ERROR:Ry}=ow;function Ey(t){this.options=yy.assign({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ky,this.strm.avail_out=0;let i=vy.inflateInit2(this.strm,e.windowBits);if(i!==_y)throw new Error(xy[i]);if(this.header=new Qy,vy.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=Sy.string2buf(e.dictionary):"[object ArrayBuffer]"===$y.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(i=vy.inflateSetDictionary(this.strm,e.dictionary),i!==_y)))throw new Error(xy[i])}function Vy(t,e){const i=new Ey(e);if(i.push(t),i.err)throw i.msg||xy[i.err];return i.result}Ey.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize,s=this.options.dictionary;let r,o,a;if(this.ended)return!1;for(o=e===~~e?e:!0===e?Cy:Py,"[object ArrayBuffer]"===$y.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),r=vy.inflate(i,o),r===Zy&&s&&(r=vy.inflateSetDictionary(i,s),r===_y?r=vy.inflate(i,o):r===Ty&&(r=Zy));i.avail_in>0&&r===Xy&&i.state.wrap>0&&0!==t[i.next_in];)vy.inflateReset(i),r=vy.inflate(i,o);switch(r){case Ay:case Ty:case Zy:case Ry:return this.onEnd(r),this.ended=!0,!1}if(a=i.avail_out,i.next_out&&(0===i.avail_out||r===Xy))if("string"===this.options.to){let t=Sy.utf8border(i.output,i.next_out),e=i.next_out-t,s=Sy.buf2string(i.output,t);i.next_out=e,i.avail_out=n-e,e&&i.output.set(i.output.subarray(t,t+e),0),this.onData(s)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(r!==_y||0!==a){if(r===Xy)return r=vy.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},Ey.prototype.onData=function(t){this.chunks.push(t)},Ey.prototype.onEnd=function(t){t===_y&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=yy.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},_v.Inflate=Ey,_v.inflate=Vy,_v.inflateRaw=function(t,e){return(e=e||{}).raw=!0,Vy(t,e)},_v.ungzip=Vy,_v.constants=ow;const{Deflate:My,deflate:Dy,deflateRaw:Wy,gzip:Uy}=mb,{Inflate:Yy,inflate:qy,inflateRaw:Ly,ungzip:zy}=_v,Iy=ow;gb.Deflate=My,gb.deflate=Dy,gb.deflateRaw=Wy,gb.gzip=Uy,gb.Inflate=Yy,gb.inflate=qy,gb.inflateRaw=Ly,gb.ungzip=zy,gb.constants=Iy;const By=gb;let jy={};var Ny;function Gy(t){return Ny=t,[tS]}jy.Util={},jy.Decode={},jy.Messages=[],jy.Log=function(t){jy.Messages.push(["I",t]),console.log("Mma.js INFO: ",t)},jy.Warn=function(t){jy.Messages.push(["W",t]),console.log("Mma.js WARNING: ",t)},jy.Fail=function(t){throw jy.Messages.push(["E",t]),"Mma.js ERROR: "+t},jy.Util.Base64Decode=function(t){for(var e=atob(t),i=e.length>>>0,n=new Uint8Array(i),s=0;s1&&0===t[0]&&jy.Fail("IntegerAP: input starts with 0: "+String(t)),this.nstring=t}else void 0===t?this.nstring=void 0:jy.Fail("Integer: invalid input: "+String(t))},jy.RealMP=function(t){"number"==typeof t?this.n=t:void 0===t?this.n=void 0:jy.Fail("RealMP: invalid input")},jy.RealAP=function(t){"string"==typeof t?(t.length>1&&0===t[0]&&jy.Fail("RealAP: input starts with 0: "+String(t)),this.nstring=t):void 0===t?this.nstring=void 0:jy.Fail("RealAP: invalid input: "+String(t))},jy.Symbol=function(t){"string"==typeof t?this.name=t:void 0===t?this.name=void 0:jy.Fail("Symbol: invalid input: "+String(t))},jy.String=function(t){"string"==typeof t?this.str=t:void 0===t?this.str=void 0:jy.Fail("String: invalid input: "+String(t))},jy.Expression=function(t,e){t instanceof jy.Symbol||jy.Fail("Expression: head must be an Mma.Symbol"),e instanceof Array||jy.Fail("Expression: parts must be an Array"),this.head=t,this.parts=e},jy.Decode.Int32=function(t,e){try{return new DataView(t.buffer).getInt32(e,!0)}catch(t){return 0}},jy.Decode.Float64=function(t,e){try{return new DataView(t.buffer).getFloat64(e,!0)}catch(t){return 0}},jy.Decode.String=function(t,e,i){return void 0===e&&(e=0),void 0===i&&(i=t.length),jy.Util.U8ArrayToString(t.slice(e,e+i))},jy.Decode.StringEntry=function(t,e){void 0===e&&(e=0);var i=jy.Decode.Int32(t,e);return{length:i,string:jy.Decode.String(t,e+4,i),bytesRead:i+4}},jy.Decode.Any=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=1/0);var n=e;for(var s=0,r=[];ee%2!=0?t:{...t,body:Lm(t.body,/\(\*\|\*\)/gm)})),Array.isArray(this.args[this.args.length-1].body)||(this.decorator=this.args.pop());const r=this.args;console.log("creating InstanceWidget");for(let t=0;t{e.viewState.state.config.eval()},update:e=>this.applyChanges(e,t,i),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to&&!t.stringOnly)return i-2>=0?(o[i-2].editor.dispatch({selection:{anchor:o[i-2].editor.state.doc.length}}),o[i-2].editor.focus(),void(t.editorLastCursor=void 0)):(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0));t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to&&!t.stringOnly)return i+2=0)return r[t-2].body[i].editor.focus(),void(e.editorLastCursor=void 0)}},{key:"ArrowDown",run:function(e,n){if(t+2{},focus:()=>{},dispatch:()=>{},stringOnly:!0};const t=l.match(Fy);if(t){a.innerHTML=t[1];const e=jy.DecompressDecode(t[2]),i=jy.toArray(e.parts[0]),n=uuidv4();interpretate(i,{global:{call:n},element:a})}else a.innerHTML=l.slice(1,-1)}delete o[i].body,n.appendChild(a)}i.appendChild(n)}if(this.decorator){const t=jy.DecompressDecode(this.decorator.body.slice(2,-2)),e=jy.toArray(t.parts[0]);let n={global:{call:uuidv4(),EditorWidget:s},element:i};this.interpretated=interpretate(e,n)}}applyChanges(t,e,i){const n=this.args,s=this.args[e].body,r=this.visibleValue.argsPos,o=this.args[e].from;let a=t;0==i&&0==e&&(a="{{"+a),0==i&&0!=e&&(a="{"+a),i==s.length-1&&e==n.length-1&&(a+="}}"),i==s.length-1&&e!=n.length-1&&(a+="}");const l=s[i].length,h={from:r+o+s[i].from,to:r+o+s[i].from+l,insert:a},c=a.length-l;for(let t=i+1;t{s.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.args[0].body[0].editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.args[0].body[0].editor.focus();else{const t=this.DOMElement.EditorWidget.args,e=t[t.length-1].body[t[t.length-1].body.length-1].editor;e.dispatch({selection:{anchor:e.state.doc.length}}),e.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const Ky=(t,e)=>new Bm({tag:"GB",decoration:i=>ni.replace({widget:new Jy(i,t,e)})}),tS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=Ky(this.disposable,t).createDeco(t)}update(t){this.placeholder=Ky(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});function eS(t){return[rS]}let iS=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.span=i,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this,r=this.args[1].body.slice(3,-3),o=jy.DecompressDecode(r),a=jy.toArray(o.parts[0]);this.data=a;const l="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}));this.cuid=l;let h={call:l,EditorWidget:s},c={global:h,element:i};this.expression=a,this.env=c,this.interpretated=interpretate(a,c),this.interpretated.then((()=>{if(c.options?.Event){console.warn("Event listeners are enabled!"),s.events=c.options.Event;let t=c;if(h.stack){const e=Object.values(h.stack);e.length>0&&(console.log("Attaching first found instance..."),t=e[0].env)}interpretate(["MetaMarker","'"+l+"'"],t).then((()=>{server.kernel.emitt(s.events,'"'+l+'"',"Mounted")}))}}))}getDoc(){return this.args[0].body.slice(1,-1)}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+t+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].length=s.length,this.view.dispatch({changes:r})}applyOuterChanges(t){const e=this.visibleValue,i=t,n={from:e.pos,to:e.pos+e.length,insert:i};this.view.dispatch({changes:n})}update(t){if(!this.deactivated){if(t.str!=this.visibleValue.str){console.warn("Out of sync"),console.log("recreate..."),this.destroy();const e=this.span;return e.replaceChildren(),void this._construct(t,this.view,e)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}}destroy(t){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.events&&server.kernel.emitt(this.events,'"'+this.cuid+'"',"Destroy"),delete this.data}},nS=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=this;let i=document.createElement("span");return i.classList.add("frontend-view"),i.EditorWidget=new iS(this.visibleValue,t,i),this.reference.push({destroy:()=>{e.destroy(i)}}),i}ignoreEvent(){return!0}destroy(t){console.log("destroy in general*"),t.EditorWidget.destroy()}};const sS=(t,e)=>new Bm({tag:"VB",decoration:i=>ni.replace({widget:new nS(i,t,e)})}),rS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=sS(this.disposable,t).createDeco(t)}update(t){this.placeholder=sS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var oS;function aS(t){return oS=t,[uS]}let lS=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.span=i,this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this;this.epilog={offset:0,string:""},this.prolog={offset:0,string:""};const r=this.args[1].body.slice(3,-3),o=jy.DecompressDecode(r),a=jy.toArray(o.parts[0]);this.data=a;let l={global:{call:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)})),element:i,origin:s},element:i};this.env=l,interpretate(a,l).then((()=>{if(l.options?.Head&&(s.prolog.offset=l.options.Head.length+1,s.prolog.string=l.options.Head+"[",s.epilog.offset=1,s.epilog.string="]"),l.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=l.options.Event),l.options?.String){s.prolog.offset=1,s.prolog.string='"',s.epilog.offset=1,s.epilog.string='"',l.options?.HeadString&&(s.prolog.string=l.options.HeadString,s.prolog.offset=s.prolog.string.length),l.options?.TailString&&(s.epilog.string=l.options.TailString,s.epilog.offset=s.epilog.string.length),s.editor={destroy:()=>{console.log("Nothing to destroy, this is just a text field.")}};const t=document.createElement("span");return this.aa,t.onkeydown=function(t){13===t.keyCode&&t.preventDefault()},t.contentEditable="plaintext-only",t.innerText=s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),t.addEventListener("input",console.log),t.addEventListener("input",(()=>{console.log("Update"),console.log(t.innerText),this.applyChanges(t.innerText)})),l.global.element.appendChild(t),void(s.events&&server.kernel.emitt(s.events,"Null","Mounted"))}s.editor=oS({doc:s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),parent:l.global.element,update:t=>this.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos+s.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]}),s.events&&server.kernel.emitt(s.events,"Null","Mounted")}))}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+this.prolog.string+t+this.epilog.string+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length));const o=s.length-i[0].length;i[0].length=s.length,this.visibleValue.length=this.visibleValue.length+o,this.view.dispatch({changes:r})}update(t){if(this.visibleValue.str!=t.str)return console.warn("Out of sync"),console.log("recreating InstanceWidget"),this.destroy(),this.span.replaceChildren(),void this._construct(t,this.view,this.span);this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.editor.destroy(),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}},hS=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("subscript-tail"),e.EditorWidget=new lS(this.visibleValue,t,e,[]);const i=this;return this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const cS=(t,e)=>new Bm({tag:"BB",decoration:i=>ni.replace({widget:new hS(i,t,e)})}),uS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=cS(this.disposable,t).createDeco(t)}update(t){this.placeholder=cS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var dS;function fS(t){return dS=t,[mS]}class pS{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm);const s=this,r=Array.from({length:Math.ceil((s.args.length-3)/2)},((t,e)=>2*e+1));s.indexes=r;const o=[];this.span=i,this.spans=o;for(let t=0;t{c.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=c.options.Event),s.editors=r.map(((t,i)=>dS({doc:s.args[t].body,parent:o[i],update:e=>this.applyChanges(e,t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i>0?s.editors[i-1].focus():(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus()),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return it.destroy())),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}}class OS extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("inline-flex"),e.EditorWidget=new pS(this.visibleValue,t,e,[]);const i=this;return this.DOMElement=e,this.reference.push({destroy:()=>{i.destroy(e)}}),e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;const n=this.DOMElement.EditorWidget.editors;return t.from-e.from<0?(n[n.length-1].dispatch({selection:{anchor:n[n.length-1].state.doc.length}}),n[n.length-1].focus()):(n[0].dispatch({selection:{anchor:0}}),n[0].focus()),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}}const gS=(t,e)=>new Bm({tag:"TB",decoration:i=>ni.replace({widget:new OS(i,t,e)})}),mS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=gS(this.disposable,t).createDeco(t)}update(t){this.placeholder=gS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});const bS=_i.fromClass(class{decorations=ni.none;constructor(t){this.view=t,this.recompute()}recompute(t){let e,i,n=[];for(let{from:t,to:e}of this.view.visibleRanges)this.getDecorationsFor(t,e,n);this.decorations=ni.set(n,!0),this.decorations=this.decorations.update({filter:(n,s)=>!(n>e&&s=e&&s.selection.main.head<=i)return!0;if(!n&&s.selection.main.head>e&&s.selection.main.headt.decorations});class wS extends ei{constructor(t,e){super(),this.rawValue=t,this.visibleValue=e}eq(t){return this.rawValue===t.rawValue}toDOM(){let t=document.createElement("div");t.classList.add("cell-type-widget");const e=this.rawValue.split(" "),i=e[0].split(".");if(console.log(i),t.classList.add("cell-type-"+i[1].trim()),t.innerText=e[0].trim(),e.length>1){const n=e.slice(1),s=document.createElement("span");return s.appendChild(t),n.forEach((t=>{const e=document.createElement("span");e.innerText=t,e.classList.add("cell-type-"+i[1].trim()+"-"+t.split("=")[0]),s.appendChild(e)})),s}return t}ignoreEvent(){return!1}}const vS=new F,yS=new F,SS=[],xS=Sl.define([{tag:Sa.meta,color:"var(--editor-key-meta)"},{tag:Sa.link,textDecoration:"underline"},{tag:Sa.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Sa.emphasis,fontStyle:"italic"},{tag:Sa.strong,fontWeight:"bold"},{tag:Sa.strikethrough,textDecoration:"line-through"},{tag:Sa.keyword,color:"var(--editor-key-keyword)"},{tag:[Sa.atom,Sa.bool,Sa.url,Sa.contentSeparator,Sa.labelName],color:"var(--editor-key-atom)"},{tag:[Sa.literal,Sa.inserted],color:"var(--editor-key-literal)"},{tag:[Sa.string,Sa.deleted],color:"var(--editor-key-string)"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],color:"var(--editor-key-escape)"},{tag:Sa.definition(Sa.variableName),color:"var(--editor-key-variable)"},{tag:Sa.local(Sa.variableName),color:"var(--editor-local-variable)"},{tag:[Sa.typeName,Sa.namespace],color:"var(--editor-key-type)"},{tag:Sa.className,color:"var(--editor-key-class)"},{tag:[Sa.special(Sa.variableName),Sa.macroName],color:"var(--editor-special-variable)"},{tag:Sa.definition(Sa.propertyName),color:"var(--editor-key-property)"},{tag:Sa.comment,color:"var(--editor-key-comment)"},{tag:Sa.invalid,color:"var(--editor-key-invalid)"}]),kS={data:[],extend:t=>{kS.data.push(...t),Qm.reBuild(kS.data)},replaceAll:t=>{kS.data=t,Qm.reBuild(kS.data)}},QS=Gl.define({name:"spreadsheet",startState:function(){return{stringType:null,stack:[]}},token:function(t,e){if(t){switch(0===e.stack.length&&('"'!=t.peek()&&"'"!=t.peek()||(e.stringType=t.peek(),t.next(),e.stack.unshift("string"))),e.stack[0]){case"string":for(;"string"===e.stack[0]&&!t.eol();)t.peek()===e.stringType?(t.next(),e.stack.shift()):"\\"===t.peek()?(t.next(),t.next()):t.match(/^.[^\\\"\']*/);return"string";case"characterClass":for(;"characterClass"===e.stack[0]&&!t.eol();)t.match(/^[^\]\\]+/)||t.match(/^\\./)||e.stack.shift();return"operator"}var i=t.peek();switch(i){case"[":return t.next(),e.stack.unshift("characterClass"),"bracket";case":":return t.next(),"operator";case"\\":return t.match(/\\[a-z]+/)?"string.special":(t.next(),"atom");case".":case",":case";":case"*":case"-":case"+":case"^":case"<":case"/":case"=":return t.next(),"atom";case"$":return t.next(),"builtin"}return t.match(/\d+/)?t.match(/^\w+/)?"error":"number":t.match(/^[a-zA-Z_]\w*/)?t.match(/(?=[\(.])/,!1)?"keyword":"variable":-1!=["[","]","(",")","{","}"].indexOf(i)?(t.next(),"bracket"):(t.eatSpace()||t.next(),null)}}}),$S=new RegExp(/^[\w]*\.[\w]+/);function PS(t){const e=$S.exec(t),i=Object.values(window.SupportedLanguages);for(let t=0;t{if(!t.docChanged)return null;let e=PS(t.newDoc.line(1).text);if(e.legacy){const i=t.startState.facet(Wa);if(i){if(i.name==e.name)return null}else if(t.startState.facet(CS)==e.name)return null;return console.log("switching... to "+e.name),{effects:vS.reconfigure(e.plugins)}}return e.name===t.startState.facet(Wa).name?null:(console.log("switching... to "+e.name),{effects:vS.reconfigure(e.plugins)})}));let XS,ZS=null;const AS=t=>{const e=t||XS;return e&&e.viewState?(console.log(),PS(e.state.doc.line(1).text).name):""},TS=t=>{const e=t||XS;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return!1;const n=i[0];return[n.from,n.to]},RS=t=>{const e=t||XS;return e&&e.viewState?e.state.doc.toString():""},ES=t=>{const e=t||XS;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return"";const n=i[0];return console.log("yoko"),console.log(n),console.log(e.state.doc.toString().slice(n.from,n.to)),console.log("processing"),e.state.doc.toString().slice(n.from,n.to)},VS=(t,e)=>{const i=e||XS;if(!i)return;if(!i.viewState)return;const n=i.viewState.state.selection.ranges;if(!n.length)return;const s=n[0];console.log("result"),console.log(t),i.dispatch({changes:{...s,insert:t}})},MS=()=>XS,DS=(t,e)=>{const i=e||XS;i&&i.viewState&&(console.log("result"),console.log(t),i.dispatch({changes:{from:0,to:i.viewState.state.doc.length,insert:t}}))};ZS=t=>{let e=new Ts({doc:t.doc,extensions:[Ys.of([{key:"Tab",run:function(t,e){return sd(t)}},{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,zS,Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(XS=e.view)}))],parent:t.parent});return e.viewState.state.config.eval=t.eval,e},ZS.state=t=>{let e=xt.create({doc:t.doc,extensions:[Ys.of([{key:"Tab",run:function(t,e){return sd(t)}},{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,zS,Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(XS=e.view)}))]});return e.config.eval=t.eval,e};const WS=(t,e)=>{if(!t||e<=0)return[];const i=[];for(let n=0;n{if(console.log(e.dom.ocellref),XS=e,e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:DropEvent"]')}},file:(t,e,i,n,s)=>{if(e.dom.ocellref)if(s.length>5242880){const t=WS(s,5242880);t.forEach(((e,s)=>{server.emitt(i,`<|"Data"->"${e}", "Name"->"${n}", "Chunk"->${s+1}, "Chunks"->${t.length}|>`,"Chunk")}))}else server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},YS={transaction:(t,e,i,n)=>{if(console.log(e.dom.ocellref),e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:PasteEvent"]')}},file:(t,e,i,n,s)=>{if(console.log(e.dom.ocellref),e.dom.ocellref)if(s.length>5242880){const t=WS(s,5242880);t.forEach(((e,s)=>{server.emitt(i,`<|"Data"->"${e}", "Name"->"${n}", "Chunk"->${s+1}, "Chunks"->${t.length}|>`,"Chunk")}))}else server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},qS=[Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Cm(US,YS)];let LS=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"}}),zS=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"},".cm-scroller":{"line-height":"inherit","overflow-x":"overlay","overflow-y":"overlay","align-items":"initial"},".cm-content":{padding:"0px 0"},".rainbow-bracket-red":{color:"var(--editor-bracket-1)"},".rainbow-bracket-orange":{color:"var(--editor-bracket-2)"},".rainbow-bracket-yellow":{color:"var(--editor-bracket-3)"},".rainbow-bracket-green":{color:"var(--editor-bracket-4)"},".rainbow-bracket-blue":{color:"var(--editor-bracket-5)"},".rainbow-bracket-indigo":{color:"var(--editor-bracket-6)"},".rainbow-bracket-violet":{color:"var(--editor-bracket-7)"},".rainbow-bracket-red > span":{color:"var(--editor-bracket-1-a)"},".rainbow-bracket-orange > span":{color:"var(--editor-bracket-2-a)"},".rainbow-bracket-yellow > span":{color:"var(--editor-bracket-3-a)"},".rainbow-bracket-green > span":{color:"var(--editor-bracket-4-a)"},".rainbow-bracket-blue > span":{color:"var(--editor-bracket-5-a)"},".rainbow-bracket-indigo > span":{color:"var(--editor-bracket-6-a)"},".rainbow-bracket-violet > span":{color:"var(--editor-bracket-7-a)"}}),IS=!1;const BS=[()=>vr(),()=>Sh(),()=>ir(),()=>dr(),()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xS,{fallback:!1}),()=>tu()],jS={},NS=[()=>vr(),()=>Sh(),()=>ir(),()=>dr(),t=>GS.of(t),()=>jS.gutter?function(t={}){return[eo.of(t),jr(),so]}():[],()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xS,{fallback:!1}),()=>tu(),()=>bS,()=>function(t){return _i.fromClass(class{constructor(e){this.view=e,this.placeholder=ni.set([ni.widget({widget:new kr(t),side:1}).range(0)])}get decorations(){return this.view.state.doc.length?ni.none:this.placeholder}},{decorations:t=>t.decorations})}("Type WL Expression / .md / .js"),()=>xt.allowMultipleSelections.of(!0),(t,e)=>vS.of(e),()=>yS.of(xt.readOnly.of(!1)),()=>_S,()=>{return t?[ou.of(t),Yu]:Yu;var t},(t,e)=>Ys.of([{key:"Tab",run:function(t,e){const i=sd(t);return i||Rc(t)},shift:Ec},{key:"Backspace",run:function(e,i){if(0===e.state.doc.length)return t.origin.remove(),!0}},{key:"ArrowLeft",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus prev"),t.origin.focusPrev(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus next"),t.origin.focusNext(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"Shift-Enter",preventDefault:!0,run:function(e,i){console.log(e.state.doc.toString()),t.origin.eval(e.state.doc.toString())}},...Vc,...Wh,...Ru]),(t,e)=>Ts.updateListener.of((e=>{e.docChanged&&t.origin.save(encodeURIComponent(e.state.doc.toString())),e.selectionSet&&(XS=e.view)})),()=>LS];const GS=E.define();function FS(t){return t.replace(/\\\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\\\:/g,""),16))})).replaceAll("\\:F74E","I").replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))}function HS(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(t=>(+t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+t/4).toString(16)))}core.ReadOnly=()=>"ReadOnly",core.EditorView=async(t,e)=>{let i=await interpretate(t[0],e);i=FS(i),console.log("UNICODE Disaster");const n=await core._getRules(t,e);let s=()=>{},r=()=>{},o=i;const a=[];n.ReadOnly&&a.push(xt.readOnly.of(!0)),n.ForceUpdate&&(e.local.forceUpdate=n.ForceUpdate),n.Event&&(r=t=>{o=t,console.log("editor view emitt data: "+t),server.kernel.emitt(n.Event,'"'+t.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Input")},s=()=>{server.kernel.emitt(n.Event,'"'+o.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Evaluate")}),e.local?e.local.editor=ZS({doc:i,parent:e.element,eval:s,update:r,extensions:a}):ZS({doc:i,parent:e.element,eval:s,update:r,extensions:a}),e.element.style.verticalAlign="inherit"},core.StripOnInput=async()=>{},core.EditorView.update=async(t,e)=>{if(!e.local.editor)return;const i=FS(await interpretate(t[0],e));console.log("editor view: dispatch"),e.local.forceUpdate,e.local.editor.dispatch({changes:{from:0,to:e.local.editor.state.doc.length,insert:i}})},core.EditorView.destroy=async(t,e)=>{await interpretate(t[0],e),e.local&&e.local.editor&&e.local.editor.destroy()},core.EditorView.virtual=!0,core.PreviewCell=(t,e)=>{},window.SupportedLanguages.push({check:t=>null===t,legacy:!0,plugins:qS,name:"mathematica"}),window.SupportedLanguages.push({check:t=>null!=t[0].match(/\w+\.(wl|wls)$/),plugins:qS,legacy:!0,name:"mathematica"}),window.SupportedCells.codemirror={view:class{origin={};editor={};trash=[];forceFocusNext(){IS=!0}focus(t){t>0?this.editor.dispatch({selection:{anchor:0}}):t<0&&this.editor.dispatch({selection:{anchor:this.editor.state.doc.length}}),this.editor.focus()}setContent(t){if(console.warn("content mutation!"),!this.editor.viewState)return;const e=this.editor;console.log("result"),console.log(t),this.editor.dispatch({changes:{from:0,to:e.viewState.state.doc.length,insert:t}})}addDisposable(t){this.trash.push(t)}dispose(){this.editor.destroy()}readOnly(t){this.editor.dispatch({effects:yS.reconfigure(xt.readOnly.of(t))})}constructor(t,e){this.origin=t;const i=this.origin,n=PS(e).plugins,s=this;this.origin.element.ocellref=s;const r=new Ts({doc:(o=e,o.replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))),extensions:NS.map((t=>t(s,n))),parent:this.origin.element});var o;return this.editor=r,this.editor.dom.ocellref=s,this.editor.viewState.state.config.eval=()=>{i.eval(this.editor.state.doc.toString())},IS&&r.focus(),IS=!1,this}},context:{EditorAutocomplete:kS,javascriptLanguage:qf,javascript:Nf,markdownLanguage:rm,markdown:function(t={}){let{codeLanguages:e,defaultCodeLanguage:i,addKeymap:n=!0,base:{parser:s}=sm}=t;if(!(s instanceof Zp))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let r,o=t.extensions?[t.extensions]:[],a=[dm.support];i instanceof Ua?(a.push(i.support),r=i.language):i&&(r=i);let l=e||r?(h=e,c=r,t=>{if(t&&h){let e=null;if(t=/\S*/.exec(t)[0],e="function"==typeof h?h(t):Ya.matchLanguageName(h,t,!0),e instanceof Ya)return e.support?e.support.language.parser:Ta.getSkippingParser(e.load());if(e)return e.parser}return c?c.parser:null}):void 0;var h,c;return o.push(function(t){let{codeParser:e,htmlParser:i}=t,n=Do(((t,n)=>{let s=t.type.id;if(!e||s!=Kf.CodeBlock&&s!=Kf.FencedCode){if(i&&(s==Kf.HTMLBlock||s==Kf.HTMLTag))return{parser:i,overlay:rO(t.node,t.from,t.to)}}else{let i="";if(s==Kf.FencedCode){let e=t.node.getChild(Kf.CodeInfo);e&&(i=n.read(e.from,e.to))}let r=e(i);if(r)return{parser:r,overlay:t=>t.type.id==Kf.CodeText}}return null}));return{wrap:n}}({codeParser:l,htmlParser:dm.language.parser})),n&&a.push(N.high(Ys.of(um))),new Ua(nm(s.configure(o)),a)},htmlLanguage:jg,html:Ng,cssLanguage:kg,css:Qg,EditorView:Ts,EditorState:xt,highlightSpecialChars:vr,syntaxHighlighting:$l,defaultHighlightStyle:xS,editorCustomTheme:LS,foldGutter:function(t={}){let e=Object.assign(Object.assign({},wl),t),i=new vl(e,!0),n=new vl(e,!1),s=_i.fromClass(class{constructor(t){this.from=t.viewport.from,this.markers=this.buildMarkers(t)}update(t){(t.docChanged||t.viewportChanged||t.startState.facet(Wa)!=t.state.facet(Wa)||t.startState.field(dl,!1)!=t.state.field(dl,!1)||Xa(t.startState)!=Xa(t.state)||e.foldingChanged(t))&&(this.markers=this.buildMarkers(t.view))}buildMarkers(t){let e=new Xt;for(let s of t.viewportLineBlocks){let r=fl(t.state,s.from,s.to)?n:ll(t.state,s.from,s.to)?i:null;r&&e.add(s.from,s.from,r)}return e.finish()}}),{domEventHandlers:r}=e;return[s,Ir({class:"cm-foldGutter",markers(t){var e;return(null===(e=t.plugin(s))||void 0===e?void 0:e.markers)||_t.empty},initialSpacer:()=>new vl(e,!1),domEventHandlers:Object.assign(Object.assign({},r),{click:(t,e,i)=>{if(r.click&&r.click(t,e,i))return!0;let n=fl(t.state,e.from,e.to);if(n)return t.dispatch({effects:ul.of(n)}),!0;let s=ll(t.state,e.from,e.to);return!!s&&(t.dispatch({effects:cl.of(s)}),!0)}})}),ml()]},Facet:E,Compartment:F,mathematicaPlugins:qS,legacyLangNameFacet:CS,DropPasteHandlers:Cm,EditorExtensionsMinimal:BS,EditorParameters:jS,EditorExtensions:NS,StateField:q,Decoration:ni,ViewPlugin:_i,WidgetType:ei,originFacet:GS,MatchDecorator:pr}},window.OfflineMode&&SS.push(xt.readOnly.of(!0)),core.CellView=async(t,e)=>{const i=await core._getRules(t,e);i.Display||(i.Display="codemirror");const n=await interpretate(t[0],e),s={element:e.element,uid:HS()};i.Style&&(e.element.style=i.Style),i.Class&&e.element.classList.add(...i.Class.split(" ")),i.ImageSize&&(Array.isArray(i.ImageSize)?(e.element.style.width=i.ImageSize[0]+"px",e.element.style.height=i.ImageSize[1]+"px"):e.element.style.width=i.ImageSize+"px"),new window.SupportedCells[i.Display].view(s,n)};const JS={};core.FrontEditorSelected=async(t,e)=>{console.log("check");const i=await interpretate(t[0],e),n=await core._getRules(t,e);let s;switch(n.Editor&&(s=JS[n.Editor],console.log("Editor"),console.log(n.Editor),console.log(s)),i){case"Get":return ES(s);case"Set":let i=await interpretate(t[1],e);VS(i,s);break;case"GetDoc":return RS(s);case"SetDoc":let n=await interpretate(t[1],e);DS(n,s);break;case"Cursor":return TS(s);case"Type":return AS(s);case"Editor":const r=HS();return JS[r]=MS(),r}};window.SupportedCells.shell={view:class{dispose(){}constructor(t,e){this.origin=t;const i=document.createElement("div");return i.classList.add(..."flex sc-b max-h-60 text-sm overflow-y-scroll".split(" ")),i.style.overflowAnchor="auto",i.style.flexDirection="column-reverse",i.innerText=e,this.origin.element.appendChild(i),this}}}; +class t{constructor(){}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 a(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}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 l(n,o,i,r);n=o+1,i++}}decompose(t,i,r,o){let a=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(a.text,t.text.slice(),0,a.length);if(i.length<=32)r.push(new e(i,t.length+a.length));else{let t=i.length>>1;r.push(new e(i.slice(0,t)),new e(i.slice(t)))}}else r.push(a)}replace(t,r,o){if(!(o instanceof e))return super.replace(t,r,o);let a=n(this.text,n(o.text,s(this.text,0,t)),r),l=this.length+o.length-(r-t);return a.length<=32?new e(a,l):i.from(e.split(a,[]),l)}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=a+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,a=i+r.lines-1;if((e?a:o)>=t)return r.lineInner(t,e,i,n);n=o+1,i=a+1}}decompose(t,e,i,n){for(let s=0,r=0;r<=e&&s=r){let s=n&((r<=t?1:0)|(a>=e?2:0));r>=t&&a<=e&&!s?i.push(o):o.decompose(t-r,e-r,i,s)}r=a+1}}replace(t,e,n){if(n.lines=r&&e<=a){let l=o.replace(t-r,e-r,n),h=this.lines-o.lines+l.lines;if(l.lines>4&&l.lines>h>>6){let r=this.children.slice();return r[s]=l,new i(r,this.length-(e-t)+n.length)}return super.replace(r,a,l)}r=a+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=a+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,a]=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==a)return n;let i=this.children[s],l=t.children[r];if(i!=l)return n+i.scanIdentical(l,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,a=r>>1,l=[],h=0,c=-1,u=[];function d(t){let n;if(t.lines>o&&t instanceof i)for(let e of t.children)d(e);else t.lines>a&&(h>a||!h)?(f(),l.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&&f(),h+=t.lines,c+=t.length+1,u.push(t))}function f(){0!=h&&(l.push(1==u.length?u[0]:i.from(u,c)),c=-1,h=u.length=0)}for(let e of t)d(e);return f(),1==l.length?l[0]:new i(l,n)}}function n(t,e,i=0,n=1e9){for(let s=0,r=0,o=!0;r=i&&(l>n&&(a=a.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,a=s instanceof e?s.text.length:s.children.length;if(o==(i>0?a: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 a{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]=a.prototype[Symbol.iterator]=function(){return this});let l=class{constructor(t,e,i,n){this.from=t,this.to=e,this.number=i,this.text=n}get length(){return this.to-this.from}},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 d=8205;function f(t,e,i=!0,n=!0){return(i?p:O)(t,e,n)}function p(t,e,i){if(e==t.length)return e;e&&g(t.charCodeAt(e))&&m(t.charCodeAt(e-1))&&e--;let n=b(t,e);for(e+=v(n);e=0&&u(b(t,n));)i++,n-=2;if(i%2==0)break;e+=2}}}return e}function O(t,e,i){for(;e>0;){let n=p(t,e-2,i);if(n=56320&&t<57344}function m(t){return t>=55296&&t<56320}function b(t,e){let i=t.charCodeAt(e);if(!m(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return g(n)?n-56320+(i-55296<<10)+65536:i}function w(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function v(t){return t<65536?1:2}const y=/\r\n?|\n/;var S=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(S||(S={}));class x{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;et)return s+(t-n);s+=o}else{if(i!=S.Simple&&l>=t&&(i==S.TrackDel&&nt||i==S.TrackBefore&&nt))return null;if(l>t||l==t&&e<0&&!o)return t==n||e<0?s:s+a;s+=a}n=l}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 x(t)}static create(t){return new x(t)}}class k extends x{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 P(this,((e,i,n,s,r)=>t=t.replace(n,n+(i-e),r)),!1),t}mapDesc(t,e=!1){return C(this,t,e,!0)}invert(e){let i=this.sections.slice(),n=[];for(let s=0,r=0;s=0){i[s]=a,i[s+1]=o;let l=s>>1;for(;n.length0&&$(i,e,s.text),s.forward(t),o+=t}let l=t[r++];for(;o>1].toJSON()))}return t}static of(e,i,n){let s=[],r=[],o=0,a=null;function l(t=!1){if(!t&&!s.length)return;oa||e<0||a>i)throw new RangeError(`Invalid change range ${e} to ${a} (in doc of length ${i})`);let u=c?"string"==typeof c?t.of(c.split(n||y)):c:t.empty,d=u.length;if(e==a&&0==d)return;eo&&Q(s,e-o,-1),Q(s,a-e,d),$(r,s,u),o=a}}(e),l(!a),a}static empty(t){return new k(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 $(e,i,n){if(0==n.length)return;let s=i.length-2>>1;if(s>1])),!(n||a==e.sections.length||e.sections[a+1]<0);)l=e.sections[a++],h=e.sections[a++];i(r,c,o,u,d),r=c,o=u}}}function C(t,e,i,n=!1){let s=[],r=n?[]:null,o=new X(t),a=new X(e);for(let t=-1;;)if(-1==o.ins&&-1==a.ins){let t=Math.min(o.len,a.len);Q(s,t,-1),o.forward(t),a.forward(t)}else if(a.ins>=0&&(o.ins<0||t==o.i||0==o.off&&(a.len=0&&t=0)){if(o.done&&a.done)return r?k.createSet(s,r):x.create(s);throw new Error("Mismatched change set lengths")}{let e=0,i=o.len;for(;i;)if(-1==a.ins){let t=Math.min(i,a.len);e+=t,i-=t,a.forward(t)}else{if(!(0==a.ins&&a.lene||o.ins>=0&&o.len>e)&&(t||n.length>i),r.forward2(e),o.forward(e)}}else Q(n,0,o.ins,t),s&&$(s,n,o.text),o.next()}}class X{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 Z{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 Z(i,n,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return A.range(t,e);let i=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return A.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 A.range(t.anchor,t.head)}static create(t,e,i){return new Z(t,e,i)}}class A{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:A.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 A(t.ranges.map((t=>Z.fromJSON(t))),t.main)}static single(t,e=t){return new A([A.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?A.range(o,r):A.range(r,o))}}return new A(t,e)}}function T(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let R=0;class E{constructor(t,e,i,n,s){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=n,this.id=R++,this.default=t([]),this.extensions="function"==typeof s?s(this):s}static define(t={}){return new E(t.combine||(t=>t),t.compareInput||((t,e)=>t===e),t.compare||(t.combine?(t,e)=>t===e:V),!!t.static,t.enables)}of(t){return new M([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,2,e)}from(t,e){return e||(e=t=>t),this.compute([t],(i=>e(i.field(t))))}}function V(t,e){return t==e||t.length==e.length&&t.every(((t,i)=>t===e[i]))}class M{constructor(t,e,i,n){this.dependencies=t,this.facet=e,this.type=i,this.value=n,this.id=R++}dynamicSlot(t){var e;let i=this.value,n=this.facet.compareInput,s=this.id,r=t[s]>>1,o=2==this.type,a=!1,l=!1,h=[];for(let i of this.dependencies)"doc"==i?a=!0:"selection"==i?l=!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(a&&e.docChanged||l&&(e.docChanged||e.selection)||W(t,h)){let e=i(t);if(o?!D(e,t.values[r],n):!n(e,t.values[r]))return t.values[r]=e,1}return 0},reconfigure:(t,e)=>{let a,l=e.config.address[s];if(null!=l){let s=tt(e,l);if(this.dependencies.every((i=>i instanceof E?e.facet(i)===t.facet(i):!(i instanceof q)||e.field(i,!1)==t.field(i,!1)))||(o?D(a=i(t),s,n):n(a=i(t),s)))return t.values[r]=s,0}else a=i(t);return t.values[r]=a,1}}}}function D(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 a(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(Y).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,Y.of({field:this,create:t})]}get extension(){return this}}const L=4,z=3,I=2,B=1;function j(t){return e=>new G(e,t)}const N={highest:j(0),high:j(B),default:j(I),low:j(z),lowest:j(L)};class G{constructor(t,e){this.inner=t,this.prec=e}}class F{of(t){return new H(this,t)}reconfigure(t){return F.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class H{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;function r(t,o){let a=s.get(t);if(null!=a){if(a<=o)return;let e=n[a].indexOf(t);e>-1&&n[a].splice(e,1),t instanceof H&&i.delete(t.compartment)}if(s.set(t,o),Array.isArray(t))for(let e of t)r(e,o);else if(t instanceof H){if(i.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");let n=e.get(t.compartment)||t.inner;i.set(t.compartment,n),r(n,o)}else if(t instanceof G)r(t.inner,t.prec);else if(t instanceof q)n[o].push(t),t.provides&&r(t.provides,o);else if(t instanceof M)n[o].push(t),t.facet.extensions&&r(t.facet.extensions,I);else{let e=t.extension;if(!e)throw new Error(`Unrecognized extension value in extension set (${t}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(e,o)}}return r(t,I),n.reduce(((t,e)=>t.concat(e)))}(t,e,r))i instanceof q?n.push(i):(s[i.facet.id]||(s[i.facet.id]=[])).push(i);let o=Object.create(null),a=[],l=[];for(let t of n)o[t.id]=l.length<<1,l.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]=a.length<<1|1,V(r,e))a.push(i.facet(n));else{let t=n.combine(e.map((t=>t.value)));a.push(i&&n.compare(t,i.facet(n))?i.facet(n):t)}else{for(let t of e)0==t.type?(o[t.id]=a.length<<1|1,a.push(t.value)):(o[t.id]=l.length<<1,l.push((e=>t.dynamicSlot(e))));o[n.id]=l.length<<1,l.push((t=>U(t,n,e)))}}let c=l.map((t=>t(o)));return new J(t,r,c,o,a,s)}}function K(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 tt(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}const et=E.define(),it=E.define({combine:t=>t.some((t=>t)),static:!0}),nt=E.define({combine:t=>t.length?t[0]:void 0,static:!0}),st=E.define(),rt=E.define(),ot=E.define(),at=E.define({combine:t=>!!t.length&&t[0]});class lt{constructor(t,e){this.type=t,this.value=e}static define(){return new ht}}class ht{of(t){return new lt(this,t)}}class ct{constructor(t){this.map=t}of(t){return new ut(this,t)}}class ut{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 ut(this.type,e)}is(t){return this.type==t}static define(t={}){return new ct(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}}ut.reconfigure=ut.define(),ut.appendConfig=ut.define();class dt{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&&T(i,e.newLength),s.some((t=>t.type==dt.time))||(this.annotations=s.concat(dt.time.of(Date.now())))}static create(t,e,i,n,s,r){return new dt(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(dt.userEvent);return!(!e||!(e==t||e.length>t.length&&e.slice(0,t.length)==t&&"."==e[t.length]))}}function ft(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=pt(n,Ot(e,r,t.changes.newLength),!0))}return n==t?t:dt.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(st)){let e=n(t);if(!1===e){i=!1;break}Array.isArray(e)&&(i=!0===i?e:ft(i,e))}if(!0!==i){let n,s;if(!1===i)s=t.changes.invertedDesc,n=k.empty(e.doc.length);else{let e=t.changes.filter(i);n=e.changes,s=e.filtered.mapDesc(e.changes).invertedDesc}t=dt.create(e,n,t.selection&&t.selection.map(s),ut.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let n=e.facet(rt);for(let i=n.length-1;i>=0;i--){let s=n[i](t);t=s instanceof dt?s:Array.isArray(s)&&1==s.length&&s[0]instanceof dt?s[0]:gt(e,bt(s),!1)}return t}(s):s)}dt.time=lt.define(),dt.userEvent=lt.define(),dt.addToHistory=lt.define(),dt.remote=lt.define();const mt=[];function bt(t){return null==t?mt:Array.isArray(t)?t:[t]}var wt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(wt||(wt={}));const vt=/[\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){}function St(t){return e=>{if(!/\S/.test(e))return wt.Space;if(function(t){if(yt)return yt.test(t);for(let e=0;e"€"&&(i.toUpperCase()!=i.toLowerCase()||vt.test(i)))return!0}return!1}(e))return wt.Word;for(let i=0;i-1)return wt.Word;return wt.Other}}class xt{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(ut.reconfigure)?(i=null,n=e.value):e.is(ut.appendConfig)&&(i=null,n=bt(n).concat(e.value));if(i)e=t.startState.values.slice();else{i=J.resolve(n,s,this),e=new xt(i,this.doc,this.selection,i.dynamicSlots.map((()=>null)),((t,e)=>e.reconfigure(t,this)),null).values}new xt(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:A.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=bt(i.effects);for(let i=1;is.spec.fromJSON(r,t))))}return xt.create({doc:t.doc,selection:A.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(xt.lineSeparator)||y)),s=e.selection?e.selection instanceof A?e.selection:A.single(e.selection.anchor,e.selection.head):A.single(0);return T(s,n.length),i.staticFacet(it)||(s=s.asSingle()),new xt(i,n,s,i.dynamicSlots.map((()=>null)),((t,e)=>e.create(t)),null)}get tabSize(){return this.facet(xt.tabSize)}get lineBreak(){return this.facet(xt.lineSeparator)||"\n"}get readOnly(){return this.facet(at)}phrase(t,...e){for(let e of this.facet(xt.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(et))for(let r of s(this,e,i))Object.prototype.hasOwnProperty.call(r,t)&&n.push(r[t]);return n}charCategorizer(t){return St(this.languageDataAt("wordChars",t).join(""))}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=f(e,r,!1);if(s(e.slice(t,r))!=wt.Word)break;r=t}for(;ot.length?t[0]:4}),xt.lineSeparator=nt,xt.readOnly=at,xt.phrases=E.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]))}}),xt.languageData=et,xt.changeFilter=st,xt.transactionFilter=rt,xt.transactionExtender=ot,F.reconfigure=ut.define();class Qt{eq(t){return this==t}range(t,e=t){return $t.create(t,e,this)}}Qt.prototype.startSide=Qt.prototype.endSide=0,Qt.prototype.point=!1,Qt.prototype.mapMode=S.TrackDel;let $t=class t{constructor(t,e,i){this.from=t,this.to=e,this.value=i}static create(e,i,n){return new t(e,i,n)}};function Pt(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Ct{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,a=s[n]-t||(i?this.value[n].endSide:this.value[n].startSide)-e;if(n==r)return a>=0?r:o;a>=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||l==h&&c.startSide>0&&c.endSide<=0)continue;(h-l||c.endSide-c.startSide)<0||(r<0&&(r=l),c.point&&(o=Math.max(o,h-l)),i.push(c),n.push(l-r),s.push(h-r))}return{mapped:i.length?new Ct(n,s,i,o):null,pos:r}}}class _t{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 _t(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(Pt)),this.isEmpty)return e.length?_t.of(e):this;let o=new At(this,null,-1).goto(0),a=0,l=[],h=new Xt;for(;o.value||a=0){let t=e[a++];h.addInner(t.from,t.to,t.value)||l.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 Tt.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return Tt.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)),a=Zt(r,o,i),l=new Et(r,a,s),h=new Et(o,a,s);i.iterGaps(((t,e,i)=>Vt(l,t,h,e,i,n))),i.empty&&0==i.length&&Vt(l,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=Zt(s,r),a=new Et(s,o,0).goto(i),l=new Et(r,o,0).goto(i);for(;;){if(a.to!=l.to||!Mt(a.active,l.active)||a.point&&(!l.point||!a.point.eq(l.point)))return!1;if(a.to>n)return!0;a.next(),l.next()}}static spans(t,e,i,n,s=-1){let r=new Et(t,null,s).goto(e),o=e,a=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,a),a=r.openEnd(t));if(r.to>i)return a+(r.point&&r.to>i?1:0);o=r.to,r.next()}}static of(t,e=!1){let i=new Xt;for(let n of t instanceof $t?[t]:e?function(t){if(t.length>1)for(let e=t[0],i=1;i0)return t.slice().sort(Pt);e=n}return t}(t):t)i.add(n.from,n.to,n.value);return i.finish()}}_t.empty=new _t([],[],null,-1),_t.empty.nextLayer=_t.empty;class Xt{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}finishChunk(t){this.chunks.push(new Ct(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=[])}add(t,e,i){this.addInner(t,e,i)||(this.nextLayer||(this.nextLayer=new Xt)).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(_t.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;let e=_t.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function Zt(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 At(r,e,i,s));return 1==n.length?n[0]:new Tt(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--)Rt(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--)Rt(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(),Rt(this.heap,0)}}}function Rt(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 Et{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=Tt.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){Dt(this.active,t),Dt(this.activeTo,t),Dt(this.activeRank,t),this.minActive=Ut(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&&Dt(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 Vt(t,e,i,n,s,r){t.goto(e),i.goto(n);let o=n+s,a=n,l=n-e;for(;;){let e=t.to+l-i.to||t.endSide-i.endSide,n=e<0?t.to+l: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))&&Mt(t.activeForPoint(t.to+l),i.activeForPoint(i.to))||r.comparePoint(a,s,t.point,i.point):s>a&&!Mt(t.active,i.active)&&r.compareRange(a,s,t.active,i.active),n>o)break;a=n,e<=0&&t.next(),e>=0&&i.next()}}function Mt(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 Ut(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(!l)throw new RangeError("The value of a property ("+i+") should be a primitive value.");s(n(i),o,a,h)}else null!=o&&a.push(i.replace(/_.*/,"").replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))+": "+o+";")}(a.length||h)&&r.push((!i||l||o?t:t.map(i)).join(", ")+" {"+a.join(" ")+"}")}for(let e in t)s(n(e),t[e],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let t=zt[qt]||1;return zt[qt]=t+1,"ͼ"+t.toString(36)}static mount(t,e){(t[Lt]||new jt(t)).mount(Array.isArray(e)?e:[e])}}let Bt=new Map;class jt{constructor(t){let e=t.ownerDocument||t,i=e.defaultView;if(!t.head&&t.adoptedStyleSheets&&i.CSSStyleSheet){let n=Bt.get(e);if(n)return t.adoptedStyleSheets=[n.sheet,...t.adoptedStyleSheets],t[Lt]=n;this.sheet=new i.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets],Bt.set(e,this)}else{this.styleTag=e.createElement("style");let i=t.head||t;i.insertBefore(this.styleTag,i.firstChild)}this.modules=[],t[Lt]=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:'"'},Ft="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),Ht="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Jt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Kt=Ht||Ft&&+Ft[1]<57,te=0;te<10;te++)Nt[48+te]=Nt[96+te]=String(te);for(te=1;te<=24;te++)Nt[te+111]="F"+te;for(te=65;te<=90;te++)Nt[te]=String.fromCharCode(te+32),Gt[te]=String.fromCharCode(te);for(var ee in Nt)Gt.hasOwnProperty(ee)||(Gt[ee]=Nt[ee]);function ie(t){let e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection()}function ne(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function se(t,e){if(!e.anchorNode)return!1;try{return ne(t,e.anchorNode)}catch(t){return!1}}function re(t){return 3==t.nodeType?me(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function oe(t,e,i,n){return!!i&&(le(t,e,i,n,-1)||le(t,e,i,n,1))}function ae(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function le(t,e,i,n,s){for(;;){if(t==i&&e==n)return!0;if(e==(s<0?0:he(t))){if("DIV"==t.nodeName)return!1;let i=t.parentNode;if(!i||1!=i.nodeType)return!1;e=ae(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?he(t):0}}}function he(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}const ce={left:0,right:0,top:0,bottom:0};function ue(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function de(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}class fe{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){this.set(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset)}set(t,e,i,n){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=n}}let pe,Oe=null;function ge(t){if(t.setActive)return t.setActive();if(Oe)return t.focus(Oe);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==Oe?{get preventScroll(){return Oe={preventScroll:!0},!0}}:void 0),!Oe){Oe=!1;for(let t=0;te)return i.domBoundsAround(t,e,l);if(c>=t&&-1==n&&(n=a,s=l),l>e&&i.dom.parentNode==this.dom){r=a,o=h;break}h=c,l=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.dirty|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.dirty|=2),1&e.dirty)return;e.dirty|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,this.dirty&&this.markParentsDirty(!0))}setDOM(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=ye){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 Qe(t,e,i,n,s,r,o,a,l){let{children:h}=t,c=h.length?h[e]:null,u=r.length?r[r.length-1]:null,d=u?u.breakAfter:o;if(!(e==n&&c&&!o&&!d&&r.length<2&&c.merge(i,s,r.length?u:null,0==i,a,l))){if(n0&&(!o&&r.length&&c.merge(i,c.length,r[0],!1,a,0)?c.breakAfter=r.shift().breakAfter:(i2);var De={mac:Me||/Mac/.test(Pe.platform),windows:/Win/.test(Pe.platform),linux:/Linux|X11/.test(Pe.platform),ie:Ae,ie_version:Xe?Ce.documentMode||6:Ze?+Ze[1]:_e?+_e[1]:0,gecko:Te,gecko_version:Te?+(/Firefox\/(\d+)/.exec(Pe.userAgent)||[0,0])[1]:0,chrome:!!Re,chrome_version:Re?+Re[1]:0,ios:Me,android:/Android\b/.test(Pe.userAgent),webkit:Ee,safari:Ve,webkit_version:Ee?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Ce.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class We extends Se{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(!i||i instanceof We&&!(this.length-(e-t)+i.length>256))&&(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),!0)}split(t){let e=new We(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new ve(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 Ye(this.dom,t,e)}}class Ue extends Se{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(we(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}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.dirty|=6)}sync(t,e){this.dom?4&this.dirty&&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 Ue&&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 Ue(this.mark,e,r)}domAtPos(t){return Ge(this,t)}coordsAt(t,e){return He(this,t,e)}}function Ye(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?De.chrome||De.gecko||(e?(s--,o=1):r=0)?0:a.length-1];return De.safari&&!o&&0==l.width&&(l=Array.prototype.find.call(a,(t=>t.width))||l),o?ue(l,o<0):l||null}class qe extends Se{constructor(t,e,i){super(),this.widget=t,this.length=e,this.side=i,this.prevWidget=null}static create(t,e,i){return new(t.customView||qe)(t,e,i)}split(t){let e=qe.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 qe&&this.widget.compare(i.widget))||t>0&&s<=0||e0)?ve.before(this.dom):ve.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let i=this.dom.getClientRects(),n=null;if(!i.length)return ce;for(let e=t>0?i.length-1:0;n=i[e],!(t>0?0==e:e==i.length-1||n.top0?-1:1);return this.length?n:ue(n,this.side>0)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class Le extends qe{domAtPos(t){let{topView:e,text:i}=this.widget;return e?ze(t,0,e,i,this.length-e.length,((t,e)=>t.domAtPos(e)),((t,e)=>new ve(t,Math.min(e,t.nodeValue.length)))):new ve(i,Math.min(t,i.nodeValue.length))}sync(){this.setDOM(this.widget.toDOM())}localPosFromDOM(t,e){let{topView:i,text:n}=this.widget;return i?Be(t,e,i,n,this.length-i.length):Math.min(e,this.length)}ignoreMutation(){return!1}get overrideDOMText(){return null}coordsAt(t,e){let{topView:i,text:n}=this.widget;return i?ze(t,e,i,n,this.length-i.length,((t,e,i)=>t.coordsAt(e,i)),((t,e,i)=>Ye(t,e,i))):Ye(n,t,e)}destroy(){var t;super.destroy(),null===(t=this.widget.topView)||void 0===t||t.destroy()}get isEditable(){return!0}canReuseDOM(){return!0}}function ze(t,e,i,n,s,r,o){if(i instanceof Ue){for(let a=i.dom.firstChild;a;a=a.nextSibling){let i=Se.get(a);if(i){let l=ne(a,n),h=i.length+(l?s:0);if(t0?ve.before(this.dom):ve.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){let e=this.dom.getBoundingClientRect(),i=function(t,e){let i=t.parent,n=i?i.children.indexOf(t):-1;for(;i&&n>=0;)if(e<0?n>0:n0?-1:1);return i&&i.tope.top?{left:e.left,right:e.right,top:i.top,bottom:i.bottom}:e}get overrideDOMText(){return t.empty}get isHidden(){return!0}}function Ge(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 Ue&&s.length&&(n=s[s.length-1])instanceof Ue&&n.mark.eq(e.mark)?Fe(n,e.children[0],i-1):(s.push(e),e.setParent(t)),t.length+=e.length}function He(t,e,i){let n=null,s=-1,r=null,o=-1;!function t(e,a){for(let l=0,h=0;l=a&&(c.children.length?t(c,a-h):(!r||r instanceof Ne&&i>0)&&(u>a||h==u&&c.getSide()>0)?(r=c,o=a-h):(h0?3e8:-4e8:e>0?1e8:-1e8,new oi(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}=ai(t,n);e=(s?n?-3e8:-1:5e8)-1,i=1+(r?n?2e8:1:-6e8)}return new oi(t,e,i,n,t.widget||null,!0)}static line(t){return new ri(t)}static set(t,e=!1){return _t.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}ni.none=_t.empty;class si extends ni{constructor(t){let{start:e,end:i}=ai(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){return this==t||t instanceof si&&this.tagName==t.tagName&&this.class==t.class&&Ke(this.attrs,t.attrs)}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}si.prototype.point=!1;class ri extends ni{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof ri&&this.spec.class==t.spec.class&&Ke(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)}}ri.prototype.mapMode=S.TrackBefore,ri.prototype.point=!0;class oi extends ni{constructor(t,e,i,n,s,r){super(e,i,s,t),this.block=n,this.isReplace=r,this.mapMode=n?e<=0?S.TrackBefore:S.TrackAfter:S.TrackDel}get type(){return this.startSide=5}eq(t){return t instanceof oi&&(e=this.widget,i=t.widget,e==i||!!(e&&i&&e.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var e,i}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 ai(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 li(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)}oi.prototype.point=!0;class hi extends Se{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 hi))return!1;this.dom||i.transferDOM(this)}return n&&this.setDeco(i?i.attrs:null),$e(this,t,e,i?i.children:[],s,r),!0}split(t){let e=new hi;if(e.breakAfter=this.breakAfter,0==this.length)return e;let{i: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){Ke(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){Fe(this,t,e)}addLineDeco(t){let e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=Je(e,this.attrs||{})),i&&(this.attrs=Je({class:i},this.attrs||{}))}domAtPos(t){return Ge(this,t)}reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.dirty|=6)}sync(t,e){var i;this.dom?4&this.dirty&&(we(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&&(ti(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&&Se.get(n)instanceof Ue;)n=n.lastChild;if(!(n&&this.length&&("BR"==n.nodeName||0!=(null===(i=Se.get(n))||void 0===i?void 0:i.isEditable)||De.ios&&this.children.some((t=>t instanceof We))))){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 We)||/[^ -~]/.test(i.text))return null;let n=re(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=He(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 hi)return s;if(r>e)break}n=r+s.breakAfter}return null}}class ci extends Se{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 ci&&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(di(new We(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 oi){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let o=e-t;if(i instanceof oi)if(i.block){let{type:t}=i;t!=ii.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new ci(i.widget||new fi("div"),o,t))}else{let r=qe.create(i.widget||new fi("span"),o,o?0:i.startSide),a=this.atCursorPos&&!r.isEditable&&s<=n.length&&(t0),l=!r.isEditable&&(tn.length||i.startSide<=0),h=this.getLine();2!=this.pendingBuffer||a||r.isEditable||(this.pendingBuffer=0),this.flushBuffer(n),a&&(h.append(di(new Ne(1),n),s),s=n.length+Math.max(0,s-n.length)),h.append(di(r,n),s),this.atCursorPos=l,this.pendingBuffer=l?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 ui(t,e,i,s);return r.openEnd=_t.spans(n,e,i,r),r.openStart<0&&(r.openStart=r.openEnd),r.finish(r.openEnd),r}}function di(t,e){for(let i of e)t=new Ue(i,[t],t.length);return t}class fi extends ei{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 pi=E.define(),Oi=E.define(),gi=E.define(),mi=E.define(),bi=E.define(),wi=E.define(),vi=E.define(),yi=E.define({combine:t=>t.some((t=>t))}),Si=E.define({combine:t=>t.some((t=>t))});class xi{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 xi(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin)}}const ki=ut.define({map:(t,e)=>t.map(e)});function Qi(t,e,i){let n=t.facet(mi);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 $i=E.define({combine:t=>!t.length||t[0]});let Pi=0;const Ci=E.define();class _i{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 _i(Pi++,t,i,(t=>{let e=[Ci.of(t)];return s&&e.push(Ti.of((e=>{let i=e.plugin(t);return i?s(i):ni.none}))),n&&e.push(n(t)),e}))}static fromClass(t,e){return _i.define((e=>new t(e)),e)}}class Xi{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(Qi(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){Qi(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){Qi(t.state,e,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Zi=E.define(),Ai=E.define(),Ti=E.define(),Ri=E.define(),Ei=E.define(),Vi=E.define();class Mi{constructor(t,e,i,n){this.fromA=t,this.toA=e,this.fromB=i,this.toB=n}join(t){return new Mi(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(!a)return i;new Mi(a.fromA,a.toA,a.fromB,a.toB).addToSet(i),r=a.toA,o=a.toB}}}class Di{constructor(t,e,i){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=k.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 Mi(t,e,i,s)))),this.changedRanges=n}static create(t,e,i){return new Di(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 Wi=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Wi||(Wi={}));const Ui=Wi.LTR,Yi=Wi.RTL;function qi(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}}const Gi=[];function Fi(t){return[new Ni(0,t,0)]}let Hi="";function Ji(t,e,i,n,s){var r;let o=n.head-t.from,a=-1;if(0==o){if(!s||!t.length)return null;e[0].level!=i&&(o=e[0].side(!1,i),a=0)}else if(o==t.length){if(s)return null;let t=e[e.length-1];t.level!=i&&(o=t.side(!0,i),a=e.length-1)}a<0&&(a=Ni.find(e,o,null!==(r=n.bidiLevel)&&void 0!==r?r:-1,n.assoc));let l=e[a];o==l.side(s,i)&&(l=e[a+=s?1:-1],o=l.side(!s,i));let h=s==(l.dir==i),c=f(t.text,o,h);if(Hi=t.text.slice(Math.min(o,c),Math.max(o,c)),c!=l.side(s,i))return A.cursor(c+t.from,h?-1:1,l.level);let u=a==(s?e.length-1:0)?null:e[a+(s?1:-1)];return u||l.level==i?u&&u.level1)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=Se.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 en(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}class nn{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class sn extends Se{constructor(t){super(),this.view=t,this.compositionDeco=ni.none,this.decorations=[],this.dynamicDecorationMap=[],this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(t.contentDOM),this.children=[new hi],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Mi(0,0,0,t.state.doc.length)],0)}get length(){return this.view.state.doc.length}update(t){let e=t.changedRanges;this.minWidth>0&&e.length&&(e.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),this.view.inputState.composing<0?this.compositionDeco=ni.none:(t.transactions.length||this.dirty)&&(this.compositionDeco=function(t,e){let i=on(t);if(!i)return ni.none;let{from:n,to:s,node:r,text:o}=i,a=e.mapPos(n,1),l=Math.max(a,e.mapPos(s,-1)),{state:h}=t,c=3==r.nodeType?r.nodeValue:new tn([],h).readRange(r.firstChild,null).text;if(l-a{this.dom.style.height=this.view.viewState.contentHeight+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let t=De.chrome||De.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,t),this.dirty=0,t&&(t.written||i.selectionRange.focusNode!=t.node)&&(this.forceSelection=!0),this.dom.style.height=""}));let n=[];if(this.view.viewport.from||this.view.viewport.to=0?t[e]:null;if(!n)break;let{fromA:s,toA:r,fromB:o,toB:a}=n,{content:l,breakAtStart:h,openStart:c,openEnd:u}=ui.build(this.view.state.doc,o,a,this.decorations,this.dynamicDecorationMap),{i:d,off:f}=i.findPos(r,1),{i:p,off:O}=i.findPos(s,-1);Qe(this,p,O,d,f,l,h,c,u)}}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&&se(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,a=this.domAtPos(o.anchor),l=o.empty?a:this.domAtPos(o.head);if(De.gecko&&o.empty&&!this.compositionDeco.size&&(1==(h=a).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((()=>a.node.insertBefore(t,a.node.childNodes[a.offset]||null))),a=l=new ve(t,0),r=!0}var h;let c=this.view.observer.selectionRange;!r&&c.focusNode&&oe(a.node,a.offset,c.anchorNode,c.anchorOffset)&&oe(l.node,l.offset,c.focusNode,c.focusOffset)||(this.view.observer.ignore((()=>{De.android&&De.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=ie(this.view.root);if(t)if(o.empty){if(De.gecko){let t=(e=a.node,n=a.offset,1!=e.nodeType?0:(n&&"false"==e.childNodes[n-1].contentEditable?1:0)|(no.head&&([a,l]=[l,a]),e.setEnd(l.node,l.offset),e.setStart(a.node,a.offset),t.removeAllRanges(),t.addRange(e)}else;var e,n;s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())})),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new ve(c.anchorNode,c.anchorOffset),this.impreciseHead=l.precise?null:new ve(c.focusNode,c.focusOffset)}enforceCursorAssoc(){if(this.compositionDeco.size)return;let{view:t}=this,e=t.state.selection.main,i=ie(t.root),{anchorNode:n,anchorOffset:s}=t.observer.selectionRange;if(!(i&&e.empty&&e.assoc&&i.modify))return;let r=hi.find(this,e.head);if(!r)return;let o=r.posAtStart;if(e.head==o||e.head==o+r.length)return;let a=this.coordsAt(e.head,-1),l=this.coordsAt(e.head,1);if(!a||!l||a.bottom>l.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)}nearest(t){for(let e=t;e;){let t=Se.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!=ii.WidgetBefore&&s.type!=ii.WidgetAfter&&(!n||2==e||this.children[n-1].breakAfter||this.children[n-1].type==ii.WidgetBefore&&e>-2))return s.coordsAt(t-r,e);i=r}}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,a=this.view.textDirection==Wi.LTR;for(let t=0,l=0;ln)break;if(t>=i){let i=h.dom.getBoundingClientRect();if(e.push(i.height),r){let e=h.dom.lastChild,n=e?re(e):[];if(n.length){let e=n[n.length-1],r=a?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?Wi.RTL:Wi.LTR}measureTextSize(){for(let t of this.children)if(t instanceof hi){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.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(n);let s=re(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 ke(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;t.push(ni.replace({widget:new rn(n),block:!0,inclusive:!0,isBlockGap:!0}).range(i,r))}if(!s)break;i=s.to+1}return ni.set(t)}updateDeco(){let t=this.view.state.facet(Ti).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=0,r=0,o=0,a=0;for(let t of this.view.state.facet(Ei).map((t=>t(this.view))))if(t){let{left:e,right:i,top:n,bottom:l}=t;null!=e&&(s=Math.max(s,e)),null!=i&&(r=Math.max(r,i)),null!=n&&(o=Math.max(o,n)),null!=l&&(a=Math.max(a,l))}let l={left:n.left-s,top:n.top-o,right:n.right+r,bottom:n.bottom+a};!function(t,e,i,n,s,r,o,a){let l=t.ownerDocument,h=l.defaultView||window;for(let c=t;c;)if(1==c.nodeType){let t,u=c==l.body;if(u)t=de(h);else{if(c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let e=c.getBoundingClientRect();t={left:e.left,right:e.left+c.clientWidth,top:e.top,bottom:e.top+c.clientHeight}}let d=0,f=0;if("nearest"==s)e.top0&&e.bottom>t.bottom+f&&(f=e.bottom-t.bottom+f+o)):e.bottom>t.bottom&&(f=e.bottom-t.bottom+o,i<0&&e.top-f0&&e.right>t.right+d&&(d=e.right-t.right+d+r)):e.right>t.right&&(d=e.right-t.right+r,i<0&&e.left0))break;i=i.childNodes[n-1],n=he(i)}if(i>=0)for(let n=t,s=e;;){if(3==n.nodeType)return n;if(!(1==n.nodeType&&s=0))break;n=n.childNodes[s],s=0}return null}class hn{constructor(){this.changes=[]}compareRange(t,e){li(t,e,this.changes)}comparePoint(t,e){li(t,e,this.changes)}}function cn(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function un(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function dn(t,e){return t.tope.top+1}function fn(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,a,l,h,c,u=!1;for(let d=t.firstChild;d;d=d.nextSibling){let t=re(d);for(let f=0;fg||o==g&&r>O){n=d,s=p,r=O,o=g;let a=g?i0?f0)}0==O?i>p.bottom&&(!h||h.bottomp.top)&&(l=d,c=p):h&&dn(h,p)?h=pn(h,p.bottom):c&&dn(c,p)&&(c=fn(c,p.top))}}if(h&&h.bottom>=i?(n=a,s=h):c&&c.top<=i&&(n=l,s=c),!n)return{node:t,offset:0};let d=Math.max(s.left,Math.min(s.right,e));return 3==n.nodeType?gn(n,d,i):u&&"false"!=n.contentEditable?On(n,d,i):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,n)+(e>=(s.left+s.right)/2?1:0)}}function gn(t,e,i){let n=t.nodeValue.length,s=-1,r=1e9,o=0;for(let a=0;ai?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(De.chrome||De.gecko){me(t,a).getBoundingClientRect().left==h.right&&(n=!i)}if(c<=0)return{node:t,offset:a+(n?1:0)};s=a+(n?1:0),r=c}}}return{node:t,offset:s>-1?s:o>0?t.nodeValue.length:0}}function mn(t,e,i,n=-1){var s,r;let o,a=t.contentDOM.getBoundingClientRect(),l=a.top+t.viewState.paddingTop,{docHeight:h}=t.viewState,{x:c,y:u}=e,d=u-l;if(d<0)return 0;if(d>h)return t.state.doc.length;for(let e=t.defaultLineHeight/2,s=!1;o=t.elementAtHeight(d),o.type!=ii.Text;)for(;d=n>0?o.bottom+e:o.top-e,!(d>=0&&d<=h);){if(s)return i?null:0;s=!0,n=-n}u=l+d;let f=o.from;if(ft.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:bn(t,a,o,c,u);let p=t.dom.ownerDocument,O=t.root.elementFromPoint?t.root:p,g=O.elementFromPoint(c,u);g&&!t.contentDOM.contains(g)&&(g=null),g||(c=Math.max(a.left+1,Math.min(a.right-1,c)),g=O.elementFromPoint(c,u),g&&!t.contentDOM.contains(g)&&(g=null));let m,b=-1;if(g&&0!=(null===(s=t.docView.nearest(g))||void 0===s?void 0:s.isEditable))if(p.caretPositionFromPoint){let t=p.caretPositionFromPoint(c,u);t&&({offsetNode:m,offset:b}=t)}else if(p.caretRangeFromPoint){let e=p.caretRangeFromPoint(c,u);e&&(({startContainer:m,startOffset:b}=e),(!t.contentDOM.contains(m)||De.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 me(t,n-1,n).getBoundingClientRect().left>i}(m,b,c)||De.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}let n=1==t.nodeType?t.getBoundingClientRect():me(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return i-n.left>5}(m,b,c))&&(m=void 0))}if(!m||!t.docView.dom.contains(m)){let e=hi.find(t.docView,f);if(!e)return d>o.top+o.height/2?o.to:o.from;({node:m,offset:b}=On(e.dom,c,u))}let w=t.docView.nearest(m);if(!w)return null;if(w.isWidget&&1==(null===(r=w.dom)||void 0===r?void 0:r.nodeType)){let t=w.dom.getBoundingClientRect();return e.y1.5*t.defaultLineHeight){r+=Math.floor((s-i.top)/t.defaultLineHeight)*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=f(t,n)}return!0===n?-1:t.length}(o,r,t.state.tabSize)}function wn(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=t.bidiSpans(s),o=t.textDirectionAt(s.from);for(let a=e,l=null;;){let e=Ji(s,r,o,a,i),h=Hi;if(!e){if(s.number==(i?t.state.doc.lines:1))return a;h="\n",s=t.state.doc.line(s.number+(i?1:-1)),r=t.bidiSpans(s),e=A.cursor(i?s.from:s.to)}if(l){if(!l(h))return a}else{if(!n)return e;l=n(h)}a=e}}function vn(t,e,i,n){let s=t.state.facet(Ri).map((e=>e(t)));for(;;){let t=!1;for(let r of s)r.between(i.from-1,i.from+1,((s,r,o)=>{i.from>s&&i.fromi.from?A.cursor(s,1):A.cursor(r,-1),t=!0,o.widget.skipPosition&&(i=o.widget.skipPosition(i,e,n)))}));if(!t)return i}}class yn{constructor(t){this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null;let e=(e,i)=>{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 Cn){let n=Cn[i];t.contentDOM.addEventListener(i,(i=>{Pn(t,i)&&e(n,i)}),_n[i]),this.registeredEvents.push(i)}t.scrollDOM.addEventListener("mousedown",(i=>{if(i.target==t.scrollDOM&&i.clientY>t.contentDOM.getBoundingClientRect().bottom&&(e(Cn.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)}})),De.chrome&&102==De.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,De.safari&&t.contentDOM.addEventListener("input",(()=>null))}setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}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=>{Pn(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){Qi(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){Qi(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||xn.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,be(t.contentDOM,e.key,e.keyCode))}ignoreDuringComposition(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(De.safari&&!De.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 Sn=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],xn="dthko",kn=[16,17,18,20,91,92,224,225];function Qn(t){return.7*Math.max(0,t)+8}class $n{constructor(t,e,i,n){this.view=t,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);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(xt.allowMultipleSelections)&&function(t,e){let i=t.state.facet(pi);return i.length?i[0](e):(De.mac,e.altKey)}(t,e),this.dragMove=function(t,e){let i=t.state.facet(Oi);return i.length?i[0](e):De.mac?!e.altKey:!e.ctrlKey}(t,e),this.dragging=!(!function(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let n=ie(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!=Yn(e))&&null}start(t){!1===this.dragging&&(t.preventDefault(),this.select(t))}move(t){var e;if(0==t.buttons)return this.destroy();if(!1!==this.dragging)return;this.select(this.lastEvent=t);let i=0,n=0,s=(null===(e=this.scrollParent)||void 0===e?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight};t.clientX<=s.left+6?i=-Qn(s.left-t.clientX):t.clientX>=s.right-6&&(i=Qn(t.clientX-s.right)),t.clientY<=s.top+6?n=-Qn(s.top-t.clientY):t.clientY>=s.bottom-6&&(n=Qn(t.clientY-s.bottom)),this.setScrollSpeed(i,n)}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)}select(t){let e=this.style.get(t,this.extend,this.multiple);!this.mustSelect&&e.eq(this.view.state.selection)&&e.main.assoc==this.view.state.selection.main.assoc||this.view.dispatch({selection:e,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.docChanged&&this.dragging&&(this.dragging=this.dragging.map(t.changes)),this.style.update(t)&&setTimeout((()=>this.select(this.lastEvent)),20)}}function Pn(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=Se.get(n))&&i.ignoreEvent(e))return!1;return!0}const Cn=Object.create(null),_n=Object.create(null),Xn=De.ie&&De.ie_version<15||De.ios&&De.webkit_version<604;function Zn(t,e){let i,{state:n}=t,s=1,r=n.toText(e),o=r.lines==n.selection.ranges.length;if(null!=Ln&&n.selection.ranges.every((t=>t.empty))&&Ln==r.toString()){let t=-1;i=n.changeByRange((i=>{let a=n.doc.lineAt(i.from);if(a.from==t)return{range:i};t=a.from;let l=n.toText((o?r.line(s++).text:e)+n.lineBreak);return{changes:{from:a.from,insert:l},range:A.cursor(i.from+l.length)}}))}else i=o?n.changeByRange((t=>{let e=r.line(s++);return{changes:{from:t.from,to:t.to,insert:e.text},range:A.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 A.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 A.cursor(e);0==r?i=1:r==s.length&&(i=-1);let o=r,a=r;i<0?o=f(s.text,r,!1):a=f(s.text,r);let l=n(s.text.slice(o,a));for(;o>0;){let t=f(s.text,o,!1);if(n(s.text.slice(t,o))!=l)break;o=t}for(;a{t.inputState.setSelectionOrigin("select"),27==e.keyCode&&(t.inputState.lastEscPress=Date.now())},Cn.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},Cn.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},_n.touchstart=_n.touchmove={passive:!0},Cn.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return;let i=null;for(let n of t.state.facet(gi))if(i=n(t,e),i)break;if(i||0!=e.button||(i=function(t,e){let i=Vn(t,e),n=Yn(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 a,l=Vn(t,e),h=An(t,l.pos,l.bias,n);if(i.pos!=l.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&&(a=function(t,e){for(let i=0;i=e)return A.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,l.pos))?a:o?s.addRange(h):A.create([h])}}}(t,e)),i){let n=t.root.activeElement!=t.contentDOM;t.inputState.startMouseSelection(new $n(t,e,i,n)),n&&t.observer.ignore((()=>ge(t.contentDOM))),t.inputState.mouseSelection&&t.inputState.mouseSelection.start(e)}};let Tn=(t,e)=>t>=e.top&&t<=e.bottom,Rn=(t,e,i)=>Tn(e,i)&&t>=i.left&&t<=i.right;function En(t,e,i,n){let s=hi.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&&Rn(i,n,o))return-1;let a=s.coordsAt(r,1);return a&&Rn(i,n,a)?1:o&&Tn(n,o)?-1:1}function Vn(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:En(t,i,e.clientX,e.clientY)}}const Mn=De.ie&&De.ie_version<=11;let Dn=null,Wn=0,Un=0;function Yn(t){if(!Mn)return t.detail;let e=Dn,i=Un;return Dn=t,Un=Date.now(),Wn=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Wn+1)%3:1}function qn(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&&r.dragMove?{from:r.dragging.from,to:r.dragging.to}:null,a={from:s,insert:i},l=t.state.changes(o?[o,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(s,-1),head:l.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"})}Cn.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")},Cn.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&&qn(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 qn(t,e,e.dataTransfer.getData("Text"),!0)},Cn.paste=(t,e)=>{if(t.state.readOnly)return e.preventDefault();t.observer.flush();let i=Xn?null:e.clipboardData;i?(Zn(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(),Zn(t,i.value)}),50)}(t)};let Ln=null;Cn.copy=Cn.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;Ln=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 zn=lt.define();function In(t,e){let i=[];for(let n of t.facet(vi)){let s=n(t,e);s&&i.push(s)}return i?t.update({effects:i,annotations:zn.of(!0)}):null}function Bn(t){setTimeout((()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=In(t.state,e);i?t.dispatch(i):t.update([])}}),10)}Cn.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),Bn(t)},Cn.blur=t=>{t.observer.clearSelectionRange(),Bn(t)},Cn.compositionstart=Cn.compositionupdate=t=>{null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},Cn.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,De.chrome&&De.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then((()=>t.observer.flush())):setTimeout((()=>{t.inputState.composing<0&&t.docView.compositionDeco.size&&t.update([])}),50)},Cn.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},Cn.beforeinput=(t,e)=>{var i;let n;if(De.chrome&&De.android&&(n=Sn.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 jn=["pre-wrap","normal","pre-line","break-spaces"];class Nn{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){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return jn.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i-1,a=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,a){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)>Jn&&(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:a,toA:l,fromB:h,toB:c}=n[o],u=s.lineAt(a,Hn.ByPosNoHeight,i.setDoc(e),0,0),d=u.to>=l?u:s.lineAt(l,Hn.ByPosNoHeight,i,0,0);for(c+=d.to-l,l=d.to;o>0&&u.from<=n[o-1].toA;)a=n[o-1].fromA,h=n[o-1].fromB,o--,a2*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 es extends ts{constructor(t,e){super(t,e,ii.Text),this.collapsed=0,this.widgetHeight=0}replace(t,e,i){let n=i[0];return 1==i.length&&(n instanceof es||n instanceof is&&4&n.flags)&&Math.abs(this.length-n.length)<10?(n instanceof is?n=new es(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.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class is 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:a}=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),l=o+r.length*a,h=Math.max(i,t-l/2);return new Fn(r.from,r.length,h,l,ii.Text)}{let n=Math.max(0,Math.min(r-s,Math.floor((t-i)/o))),{from:a,length:l}=e.doc.line(s+n);return new Fn(a,l,i+o*n,o,ii.Text)}}lineAt(t,e,i,n,s){if(e==Hn.ByHeight)return this.blockAt(t,i,n,s);if(e==Hn.ByPosNoHeight){let{from:e,to:n}=i.doc.lineAt(t);return new Fn(e,n-e,0,0,ii.Text)}let{firstLine:r,perLine:o,perChar:a}=this.heightMetrics(i,s),l=i.doc.lineAt(t),h=o+l.length*a,c=l.number-r,u=n+o*c+a*(l.from-s-c);return new Fn(l.from,l.length,Math.max(n,Math.min(u,n+this.height-h)),h,ii.Text)}forEachLine(t,e,i,n,s,r){t=Math.max(t,s),e=Math.min(e,s+this.length);let{firstLine:o,perLine:a,perChar:l}=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+=a*i+l*(t-s-i)}let n=a+l*e.length;r(new Fn(e.from,e.length,c,n,ii.Text)),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 is?i[i.length-1]=new is(t.length+n):i.push(null,new is(n-1))}if(t>0){let e=i[0];e instanceof is?i[0]=new is(t+e.length):i.unshift(new is(t-1),null)}return Kn.of(i)}decomposeLeft(t,e){e.push(new is(t-1),null)}decomposeRight(t,e){e.push(null,new is(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 is(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)>=Jn&&(o=-2);let a=new es(e,s);a.outdated=!1,i.push(a),r+=e+1}r<=s&&i.push(null,new is(s-r).updateHeight(t,r));let a=Kn.of(i);return(o<0||Math.abs(a.height-this.height)>=Jn||Math.abs(o-this.heightMetrics(t,e).perLine)>=Jn)&&(t.heightChanged=!0),a}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class ns 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 l;let h=e==Hn.ByPosNoHeight?Hn.ByPosNoHeight:Hn.ByPos;return a?l.join(this.right.lineAt(o,h,i,r,o)):this.left.lineAt(o,h,i,n,s).join(l)}forEachLine(t,e,i,n,s,r){let o=n+this.left.height,a=s+this.left.length+this.break;if(this.break)t=a&&this.right.forEachLine(t,e,i,o,a,r);else{let l=this.lineAt(a,Hn.ByPos,i,n,s);t=t&&l.from<=e&&r(l),e>l.to&&this.right.forEachLine(l.to+1,e,i,o,a,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&&ss(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,a=null;return n&&n.from<=e+s.length&&n.more?a=s=s.updateHeight(t,e,i,n):s.updateHeight(t,e,i),n&&n.from<=o+r.length&&n.more?a=r=r.updateHeight(t,o,i,n):r.updateHeight(t,o,i),a?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 ss(t,e){let i,n;null==t[e]&&(i=t[e-1])instanceof is&&(n=t[e+1])instanceof is&&t.splice(e-1,3,new is(i.length+1+n.length))}class rs{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 es?i.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new es(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)}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 es(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let i=new is(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 es)return t;let e=new es(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine(),t.type!=ii.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,t.type!=ii.WidgetBefore&&(this.covering=t)}addLineDeco(t,e){let i=this.ensureLine();i.length+=e,i.collapsed+=e,i.widgetHeight=Math.max(i.widgetHeight,t),this.writtenTo=this.pos=this.pos+e}finish(t){let e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof es||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),a=Math.max(a,n.top),l=e==t.parentNode?n.bottom:Math.min(l,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:a-(i.top+e),bottom:Math.max(a,l)-(i.top+e)}}function ls(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class hs{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 Nn(i),this.stateDeco=e.facet(Ti).filter((t=>"function"!=typeof t)),this.heightMap=Kn.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle.setDoc(e.doc),[new Mi(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ni.set(this.lineGaps.map((t=>t.draw(!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 ds(e,i))}}this.viewports=t.sort(((t,e)=>t.from-e.from)),this.scaler=this.heightMap.height<=7e6?gs:new ms(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:bs(t,this.scaler))}))}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=this.state.facet(Ti).filter((t=>"function"!=typeof t));let n=t.changedRanges,s=Mi.extendWithRanges(n,function(t,e,i){let n=new os;return _t.compare(t,e,i,n,0),n.changes}(i,this.stateDeco,t?t.changes:k.empty(this.state.doc.length))),r=this.heightMap.height;this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),s),this.heightMap.height!=r&&(t.flags|=2);let o=s.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.heado.to)||!this.viewportIsAppropriate(o))&&(o=this.getViewport(0,e));let a=!t.changes.empty||2&t.flags||o.from!=this.viewport.from||o.to!=this.viewport.to;this.viewport=o,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(Si)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let i=e.contentDOM,n=window.getComputedStyle(i),s=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Wi.RTL:Wi.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),a=i.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let h=0,c=0,u=parseInt(n.paddingTop)||0,d=parseInt(n.paddingBottom)||0;this.paddingTop==u&&this.paddingBottom==d||(this.paddingTop=u,this.paddingBottom=d,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let f=(this.printing?ls:as)(i,this.paddingTop),p=f.top-this.pixelViewport.top,O=f.bottom-this.pixelViewport.bottom;this.pixelViewport=f;let g=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(g!=this.inView&&(this.inView=g,g&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let m=a.width;if(this.contentDOMWidth==m&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,h|=8),l){let i=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(i)&&(o=!0),o||s.lineWrapping&&Math.abs(m-this.contentDOMWidth)>s.charWidth){let{lineHeight:t,charWidth:n,textHeight:a}=e.docView.measureTextSize();o=t>0&&s.refresh(r,t,n,a,m/n,i),o&&(e.docView.minWidth=0,h|=8)}p>0&&O>0?c=Math.max(p,O):p<0&&O<0&&(c=Math.min(p,O)),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 Mi(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new Gn(n.from,r))}s.heightChanged&&(h|=2)}let b=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return b&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(2&h||b)&&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,a=new ds(n.lineAt(r-1e3*i,Hn.ByHeight,s,0,0).from,n.lineAt(o+1e3*(1-i),Hn.ByHeight,s,0,0).to);if(e){let{head:t}=e.range;if(ta.to){let i,r=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=n.lineAt(t,Hn.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!=Wi.LTR&&!i)return[];let o=[],a=(n,r,l,h)=>{if(r-nn&&tt.from>=l.from&&t.to<=l.to&&Math.abs(t.from-n)t.frome))));if(!d){if(rt.from<=r&&t.to>=r))){let t=e.moveToLineBoundary(A.cursor(r),!1,!0).head;t>n&&(r=t)}d=new hs(n,r,this.gapSize(l,n,r,h))}o.push(d)};for(let t of this.viewportLines){if(t.lengtht.from&&a(t.from,s,t,e),ot.draw(this.heightOracle.lineWrapping)))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];_t.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))||bs(this.heightMap.lineAt(t,Hn.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return bs(this.heightMap.lineAt(this.scaler.fromDOM(t),Hn.ByHeight,this.heightOracle,0,0),this.scaler)}elementAtHeight(t){return bs(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 ds{constructor(t,e){this.from=t,this.to=e}}function fs(t,e,i){let n=[],s=t,r=0;return _t.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 Os(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 gs={toDOM:t=>t,fromDOM:t=>t,scale:1};class ms{constructor(t,e,i){let n=0,s=0,r=0;this.viewports=i.map((({from:i,to:s})=>{let r=e.lineAt(i,Hn.ByPos,t,0,0).top,o=e.lineAt(s,Hn.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=ebs(t,e))):t.type)}const ws=E.define({combine:t=>t.join(" ")}),vs=E.define({combine:t=>t.indexOf(!0)>-1}),ys=It.newName(),Ss=It.newName(),xs=It.newName(),ks={"&light":"."+Ss,"&dark":"."+xs};function Qs(t,e,i){return new It(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 $s=Qs("."+ys,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",borderRadius:"4px",marginTop:"0.5rem",width:"30%",minWidth:"190px",marginLeft:"auto",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&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:"#333338",fontSize:"70%",padding:".2em 1em",borderRadius:"4px"},"&light .cm-button":{background:"#eee"},"&dark .cm-button":{background:"#eee"},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",borderRadius:"0.25rem",border:"1px solid silver",padding:".0em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},ks);class Ps{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;i&&(e.push(new nn(i,n)),s==i&&r==n||e.push(new nn(s,r)));return e}(t),i=new tn(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?A.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||!ne(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||!ne(t.contentDOM,e.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(e.anchorNode,e.anchorOffset);this.newSel=A.single(n,i)}}}function Cs(e,i){let n,{newSel:s}=i,r=e.state.selection.main;if(i.bounds){let{from:s,to:o}=i.bounds,a=r.from,l=null;(8===e.inputState.lastKeyCode&&e.inputState.lastKeyTime>Date.now()-100||De.android&&i.text.length0&&a>0&&t.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if("end"==n){i-=o+Math.max(0,r-Math.min(o,a))-r}if(o=o?r-i:0,a=r+(a-o),o=r}else if(a=a?r-i:0,o=r+(o-a),a=r}return{from:r,toA:o,toB:a}}(e.state.doc.sliceString(s,o,Ki),i.text,a-s,l);h&&(De.chrome&&13==e.inputState.lastKeyCode&&h.toB==h.from+2&&i.text.slice(h.from,h.toB)==Ki+Ki&&h.toB--,n={from:s+h.from,to:s+h.toA,insert:t.of(i.text.slice(h.from,h.toB).split(Ki))})}else s&&(!e.hasFocus&&e.state.facet($i)||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))}:(De.mac||De.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=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}):De.chrome&&n&&n.from==n.to&&n.from==r.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(s&&(s=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}),n){let t=e.state;if(De.ios&&e.inputState.flushIOSKey(e))return!0;if(De.android&&(n.from==r.from&&n.to==r.to&&1==n.insert.length&&2==n.insert.lines&&be(e.contentDOM,"Enter",13)||n.from==r.from-1&&n.to==r.to&&0==n.insert.length&&be(e.contentDOM,"Backspace",8)||n.from==r.from&&n.to==r.to+1&&0==n.insert.length&&be(e.contentDOM,"Delete",46)))return!0;let i,o=n.insert.toString();if(e.state.facet(wi).some((t=>t(e,n.from,n.to,o))))return!0;if(e.inputState.composing>=0&&e.inputState.composing++,n.from>=r.from&&n.to<=r.to&&n.to-n.from>=(r.to-r.from)/3&&(!s||s.main.empty&&s.main.from==n.from+n.insert.length)&&e.inputState.composing<0){let s=r.fromn.to?t.sliceDoc(n.to,r.to):"";i=t.replaceSelection(e.state.toText(s+n.insert.sliceString(0,void 0,e.state.lineBreak)+o))}else{let o=t.changes(n),a=s&&s.main.to<=o.newLength?s.main:void 0;if(t.selection.ranges.length>1&&e.inputState.composing>=0&&n.to<=r.to&&n.to>=r.to-10){let s=e.state.sliceDoc(n.from,n.to),l=on(e)||e.state.doc.lineAt(r.head),h=r.to-n.to,c=r.to-r.from;i=t.changeByRange((i=>{if(i.from==r.from&&i.to==r.to)return{changes:o,range:a||i.map(o)};let u=i.to-h,d=u-s.length;if(i.to-i.from!=c||e.state.sliceDoc(d,u)!=s||l&&i.to>=l.from&&i.from<=l.to)return{range:i};let f=t.changes({from:d,to:u,insert:n.insert}),p=i.to-r.to;return{changes:f,range:a?A.range(Math.max(0,a.anchor+p),Math.max(0,a.head+p)):i.map(f)}}))}else i={changes:o,selection:a&&t.selection.replaceRange(a)}}let a="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,a+=".compose",e.inputState.compositionFirstChange&&(a+=".start",e.inputState.compositionFirstChange=!1)),e.dispatch(i,{scrollIntoView:!0,userEvent:a}),!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 _s={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Xs=De.ie&&De.ie_version<=11;class Zs{constructor(t){this.view=t,this.active=!1,this.selectionRange=new fe,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);(De.ie&&De.ie_version<=11||De.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()})),Xs&&(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")))}),{}),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($i)?i.root.activeElement!=this.dom:!se(i.dom,n))return;let s=n.anchorNode&&i.docView.nearest(n.anchorNode);s&&s.ignoreEvent(t)?e||(this.selectionChanged=!1):(De.ie&&De.ie_version<=11||De.android&&De.chrome)&&!i.state.selection.main.empty&&n.focusNode&&oe(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=De.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,a=t.docView.domAtPos(t.state.selection.main.anchor);oe(a.node,a.offset,r,o)&&([n,s,r,o]=[r,o,n,s]);return{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:o}}(this.view)||ie(t.root);if(!e||this.selectionRange.eq(e))return!1;let i=se(this.dom,e);return i&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let t=this.delayedAndroidKey;t&&(this.clearDelayedAndroidKey(),!this.flush()&&t.force&&be(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&&se(this.dom,this.selectionRange);return t<0&&!n?null:(t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new Ps(this.view,t,e,i))}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=Cs(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.dirty|=4),"childList"==t.type){let i=As(e,t.previousSibling||t.target.previousSibling,-1),n=As(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 As(t,e,i){for(;e;){let n=Se.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 Ts{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),this._dispatch=t.dispatch||(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 us(t.state||xt.create(t)),this.plugins=this.state.facet(Ci).map((t=>new Xi(t)));for(let t of this.plugins)t.update(this);this.observer=new Zs(this),this.inputState=new yn(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new sn(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),t.parent&&t.parent.appendChild(this.dom)}get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}dispatch(...t){this._dispatch(1==t.length&&t[0]instanceof dt?t[0]:this.state.update(...t))}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,a=null;t.some((t=>t.annotation(zn)))?(this.inputState.notifiedFocused=r,o=1):r!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=r,a=In(s,r),a||(o=1));let l=this.observer.delayedAndroidKey,h=null;if(l?(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(xt.phrases)!=this.state.facet(xt.phrases))return this.setState(s);e=Di.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 xi(t.empty?t:A.cursor(t.head,t.head>t.anchor?-1:1))}for(let t of e.effects)t.is(ki)&&(c=t.value)}this.viewState.update(e,c),this.bidiCache=Vs.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),i=this.docView.update(e),this.state.facet(Vi)!=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(ws)!=e.state.facet(ws)&&(this.viewState.mustMeasureContent=!0),(i||n||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!e.empty)for(let t of this.state.facet(bi))t(e);(a||h)&&Promise.resolve().then((()=>{a&&this.state==a.startState&&this.dispatch(a),h&&!Cs(this,h)&&l.force&&be(this.contentDOM,l.key,l.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 us(t),this.plugins=t.facet(Ci).map((t=>new Xi(t))),this.pluginMap.clear();for(let t of this.plugins)t.update(this);this.docView=new sn(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(Ci),i=t.state.facet(Ci);if(e!=i){let n=[];for(let s of i){let i=e.indexOf(s);if(i<0)n.push(new Xi(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.measureScheduled=0,t&&this.observer.forceFlush();let e=null,{scrollHeight:i,scrollTop:n,clientHeight:s}=this.scrollDOM,r=n>i-s-4?i:n;try{for(let t=0;;t++){this.updateState=1;let i=this.viewport,n=this.viewState.lineBlockAtHeight(r),s=this.viewState.measure(this);if(!s&&!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 o=[];4&s||([this.measureRequests,o]=[o,this.measureRequests]);let a=o.map((t=>{try{return t.read(this)}catch(t){return Qi(this.state,t),Es}})),l=Di.create(this,this.state,[]),h=!1,c=!1;l.flags|=s,e?e.flags|=s:e=l,this.updateState=2,l.empty||(this.updatePlugins(l),this.inputState.update(l),this.updateAttrs(),h=this.docView.update(l));for(let t=0;t1||t<-1)&&(this.scrollDOM.scrollTop+=t,c=!0)}if(h&&this.docView.updateSelection(!0),this.viewport.from==i.from&&this.viewport.to==i.to&&!c&&0==this.measureRequests.length)break}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let t of this.state.facet(bi))t(e)}get themeClasses(){return ys+" "+(this.state.facet(vs)?xs:Ss)+" "+this.state.facet(ws)}updateAttrs(){let t=Ms(this,Zi,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet($i)?"true":"false",class:"cm-content",style:`${De.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Ms(this,Ai,e);let i=this.observer.ignore((()=>{let i=ti(this.contentDOM,this.contentAttrs,e),n=ti(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)if(t.is(Ts.announce)){e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(Vi),It.mount(this.root,this.styleModules.concat($s).reverse())}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}}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 vn(this,t,wn(this,t,e,i))}moveByCharSelected(t,e,i){return vn(this,t,wn(this,t,e,i),!0)}moveByGroup(t,e){return vn(this,t,wn(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==wt.Space&&(s=e),s==e}}(this,t.head,e))))}moveToLineBoundary(t,e,i=!0){return function(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=n&&t.lineWrapping?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==Wi.LTR)?e.right-1:e.left+1,y:(r.top+r.bottom)/2});if(null!=o)return A.cursor(o,i?-1:1)}let o=hi.find(t.docView,e.head),a=o?i?o.posAtEnd:o.posAtStart:i?s.to:s.from;return A.cursor(a,i?-1:1)}(this,t,e,i)}moveVertically(t,e,i){return vn(this,t,function(t,e,i,n){let s=e.head,r=i?1:-1;if(s==(i?t.state.doc.length:0))return A.cursor(s,e.assoc);let o,a=e.goalColumn,l=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s),c=t.documentTop;if(h)null==a&&(a=h.left-l.left),o=r<0?h.top:h.bottom;else{let e=t.viewState.lineBlockAt(s);null==a&&(a=Math.min(l.right-l.left,t.defaultCharacterWidth*(s-e.from))),o=(r<0?e.top:e.bottom)+c}let u=l.left+a,d=null!=n?n:t.defaultLineHeight>>1;for(let i=0;;i+=10){let n=o+(d+i)*r,h=mn(t,{x:u,y:n},!1,r);if(nl.bottom||(r<0?hs))return A.cursor(h,e.assoc,void 0,a)}}(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(),mn(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 ue(i,s[Ni.find(s,t-n.from,-1,e)].dir==Wi.LTR==e>0)}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(yi)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Rs)return Fi(t.length);let e=this.textDirectionAt(t.from);for(let i of this.bidiCache)if(i.from==t.from&&i.dir==e)return i.order;let i=function(t,e){let i=t.length,n=e==Ui?1:2,s=e==Ui?2:1;if(!t||1==n&&!ji.test(t))return Fi(i);for(let e=0,s=n,o=n;e=0;t-=3)if(Bi[t+1]==-r){let e=Bi[t+2],i=2&e?n:4&e?1&e?s:n:0;i&&(Gi[a]=Gi[Bi[t]]=i),l=t;break}}else{if(189==Bi.length)break;Bi[l++]=a,Bi[l++]=e,Bi[l++]=h}else if(2==(o=Gi[a])||1==o){let t=o==n;h=t?0:1;for(let e=l-3;e>=0;e-=3){let i=Bi[e+2];if(2&i)break;if(t)Bi[e+2]|=2;else{if(4&i)break;Bi[e+2]|=4}}}for(let t=0;te;){let t=i,n=2!=Gi[--i];for(;i>e&&n==(2!=Gi[i-1]);)i--;o.push(new Ni(i,t,n?2:1))}else o.push(new Ni(e,t,0))}else for(let t=0;tDate.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{ge(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 ki.of(new xi("number"==typeof t?A.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}static domEventHandlers(t){return _i.define((()=>({})),{eventHandlers:t})}static theme(t,e){let i=It.newName(),n=[ws.of(i),Vi.of(Qs(`.${i}`,t))];return e&&e.dark&&n.push(vs.of(!0)),n}static baseTheme(t){return N.lowest(Vi.of(Qs("."+ys,t,ks)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),n=i&&Se.get(i)||Se.get(t);return(null===(e=null==n?void 0:n.rootView)||void 0===e?void 0:e.view)||null}}Ts.styleModule=Vi,Ts.inputHandler=wi,Ts.focusChangeEffect=vi,Ts.perLineTextDirection=yi,Ts.exceptionSink=mi,Ts.updateListener=bi,Ts.editable=$i,Ts.mouseSelectionStyle=gi,Ts.dragMovesSelection=Oi,Ts.clickAddsSelectionRange=pi,Ts.decorations=Ti,Ts.atomicRanges=Ri,Ts.scrollMargins=Ei,Ts.darkTheme=vs,Ts.contentAttributes=Ai,Ts.editorAttributes=Zi,Ts.lineWrapping=Ts.contentAttributes.of({class:"cm-lineWrapping"}),Ts.announce=ut.define();const Rs=4096,Es={};class Vs{constructor(t,e,i,n){this.from=t,this.to=e,this.dir=i,this.order=n}static update(t,e){if(e.empty)return t;let i=[],n=t.length?t[t.length-1].dir:Wi.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&&Je(r,i)}return i}const Ds=De.mac?"mac":De.windows?"win":De.linux?"linux":"key";function Ws(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 Us=N.default(Ts.domEventHandlers({keydown:(t,e)=>Bs(Ls(e.state),t,e,"editor")})),Ys=E.define({enables:Us}),qs=new WeakMap;function Ls(t){let e=t.facet(Ys),i=qs.get(e);return i||qs.set(e,i=function(t,e=Ds){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)=>{var a,l;let h=i[t]||(i[t]=Object.create(null)),c=n.split(/ (?!$)/).map((t=>function(t,e){const i=t.split(/-(?!$)/);let n,s,r,o,a=i[i.length-1];"Space"==a&&(a=" ");for(let t=0;t{let n=zs={view:e,prefix:i,scope:t};return setTimeout((()=>{zs==n&&(zs=null)}),Is),!0}]})}let u=c.join(" ");s(u,!1);let d=h[u]||(h[u]={preventDefault:!1,run:(null===(l=null===(a=h._any)||void 0===a?void 0:a.run)||void 0===l?void 0:l.slice())||[]});r&&d.run.push(r),o&&(d.preventDefault=!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,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.shift&&r(e,"Shift-"+s,n.shift,n.preventDefault)}return i}(e.reduce(((t,e)=>t.concat(e)),[]))),i}let zs=null;const Is=4e3;function Bs(t,e,i,n){let s=function(t){var e=!(Kt&&(t.ctrlKey||t.altKey||t.metaKey)||Jt&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?Gt:Nt)[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=v(b(s,0))==s.length&&" "!=s,o="",a=!1;zs&&zs.view==i&&zs.scope==n&&(o=zs.prefix+" ",(a=kn.indexOf(e.keyCode)<0)&&(zs=null));let l,h,c=new Set,u=t=>{if(t){for(let n of t.run)if(!c.has(n)&&(c.add(n),n(i,e)))return!0;t.preventDefault&&(a=!0)}return!1},d=t[n];if(d){if(u(d[o+Ws(s,e,!r)]))return!0;if(r&&(e.altKey||e.metaKey||e.ctrlKey)&&!(De.windows&&e.ctrlKey&&e.altKey)&&(l=Nt[e.keyCode])&&l!=s){if(u(d[o+Ws(l,e,!0)]))return!0;if(e.shiftKey&&(h=Gt[e.keyCode])!=s&&h!=l&&u(d[o+Ws(h,e,!1)]))return!0}else if(r&&e.shiftKey&&u(d[o+Ws(s,e,!0)]))return!0;if(u(d._any))return!0}return a}class js{constructor(t,e,i,n,s){this.className=t,this.left=e,this.top=i,this.width=n,this.height=s}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className==this.className&&(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",null!=this.width&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,i){if(i.empty){let n=t.coordsAtPos(i.head,i.assoc||1);if(!n)return[];let s=Ns(t);return[new js(e,n.left-s.left,n.top-s.top,null,n.bottom-n.top)]}return function(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];let n=Math.max(i.from,t.viewport.from),s=Math.min(i.to,t.viewport.to),r=t.textDirection==Wi.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=Ns(t),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),u=a.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),d=a.right-(c?parseInt(c.paddingRight):0),f=Fs(t,n),p=Fs(t,s),O=f.type==ii.Text?f:null,g=p.type==ii.Text?p:null;t.lineWrapping&&(O&&(O=Gs(t,n,O)),g&&(g=Gs(t,s,g)));if(O&&g&&O.from==g.from)return b(w(i.from,i.to,O));{let e=O?w(i.from,null,O):v(f,!1),n=g?w(null,i.to,g):v(p,!0),s=[];return(O||f).to<(g||p).from-1?s.push(m(u,e.bottom,d,n.top)):e.bottomh&&n.from=r)break;a>s&&l(Math.max(t,s),null==e&&t<=h,Math.min(a,r),null==i&&a>=c,o.dir)}if(s=n.to+1,s>=r)break}return 0==a.length&&l(h,null==e,c,null==i,t.textDirection),{top:s,bottom:o,horizontal:a}}function v(t,e){let i=a.top+(e?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]}}}(t,e,i)}}function Ns(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Wi.LTR?e.left:e.right-t.scrollDOM.clientWidth)-t.scrollDOM.scrollLeft,top:e.top-t.scrollDOM.scrollTop}}function Gs(t,e,i){let n=A.cursor(e);return{from:Math.max(i.from,t.moveToLineBoundary(n,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(n,!0,!0).from),type:ii.Text}}function Fs(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==ii.Text))return t;return i}class Hs{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),e.above&&this.dom.classList.add("cm-layer-above"),e.class&&this.dom.classList.add(e.class),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(Js)!=t.state.facet(Js)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&t.view.requestMeasure(this.measureReq)}setOrder(t){let e=0,i=t.facet(Js);for(;e{return i=t,n=this.drawn[e],!(i.constructor==n.constructor&&i.eq(n));var i,n}))){let e=this.dom.firstChild,i=0;for(let n of t)n.update&&e&&n.constructor&&this.drawn[i].constructor&&n.update(e,this.drawn[i])?(e=e.nextSibling,i++):this.dom.insertBefore(n.draw(),e);for(;e;){let t=e.nextSibling;e.remove(),e=t}this.drawn=t}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Js=E.define();function Ks(t){return[_i.define((e=>new Hs(e,t))),Js.of(t)]}const tr=!De.ios,er=E.define({combine:t=>kt(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})});function ir(t={}){return[er.of(t),sr,or,lr,Si.of(!0)]}function nr(t){return t.startState.facet(er)!=t.state.facet(er)}const sr=Ks({above:!0,markers(t){let{state:e}=t,i=e.facet(er),n=[];for(let s of e.selection.ranges){let r=s==e.selection.main;if(s.empty?!r||tr:i.drawRangeCursor){let e=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",i=s.empty?s:A.cursor(s.head,s.head>s.anchor?-1:1);for(let s of js.forRange(t,e,i))n.push(s)}}return n},update(t,e){t.transactions.some((t=>t.selection))&&(e.style.animationName="cm-blink"==e.style.animationName?"cm-blink2":"cm-blink");let i=nr(t);return i&&rr(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){rr(e.state,t)},class:"cm-cursorLayer"});function rr(t,e){e.style.animationDuration=t.facet(er).cursorBlinkRate+"ms"}const or=Ks({above:!1,markers:t=>t.state.selection.ranges.map((e=>e.empty?[]:js.forRange(t,"cm-selectionBackground",e))).reduce(((t,e)=>t.concat(e))),update:(t,e)=>t.docChanged||t.selectionSet||t.viewportChanged||nr(t),class:"cm-selectionLayer"}),ar={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};tr&&(ar[".cm-line"].caretColor="transparent !important");const lr=N.highest(Ts.theme(ar)),hr=ut.define({map:(t,e)=>null==t?null:e.mapPos(t)}),cr=q.define({create:()=>null,update:(t,e)=>(null!=t&&(t=e.changes.mapPos(t)),e.effects.reduce(((t,e)=>e.is(hr)?e.value:t),t))}),ur=_i.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let i=t.state.field(cr);null==i?null!=this.cursor&&(null===(e=this.cursor)||void 0===e||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(cr)!=i||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let t=this.view.state.field(cr),e=null!=t&&this.view.coordsAtPos(t);if(!e)return null;let i=this.view.scrollDOM.getBoundingClientRect();return{left:e.left-i.left+this.view.scrollDOM.scrollLeft,top:e.top-i.top+this.view.scrollDOM.scrollTop,height:e.bottom-e.top}}drawCursor(t){this.cursor&&(t?(this.cursor.style.left=t.left+"px",this.cursor.style.top=t.top+"px",this.cursor.style.height=t.height+"px"):this.cursor.style.left="-100000px")}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(cr)!=t&&this.view.dispatch({effects:hr.of(t)})}},{eventHandlers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){t.target!=this.view.contentDOM&&this.view.contentDOM.contains(t.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function dr(){return[cr,ur]}function fr(t,e,i,n,s){e.lastIndex=0;for(let r,o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)if(!o.lineBreak)for(;r=e.exec(o.value);)s(a+r.index,r)}class pr{constructor(t){const{regexp:e,decoration:i,decorate:n,boundary:s,maxLength:r=1e3}=t;if(!e.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=e,n)this.addMatch=(t,e,i,s)=>n(s,i,i+t[0].length,t,e);else if("function"==typeof i)this.addMatch=(t,e,n,s)=>{let r=i(t,e,n);r&&s(n,n+t[0].length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(t,e,n,s)=>s(n,n+t[0].length,i)}this.boundary=s,this.maxLength=r}createDeco(t){let e=new Xt,i=e.add.bind(e);for(let{from:e,to:n}of function(t,e){let i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;let n=[];for(let{from:s,to:r}of i)s=Math.max(t.state.doc.lineAt(s).from,s-e),r=Math.min(t.state.doc.lineAt(r).to,r+e),n.length&&n[n.length-1].to>=s?n[n.length-1].to=r:n.push({from:s,to:r});return n}(t,this.maxLength))fr(t.state.doc,this.regexp,e,n,((e,n)=>this.addMatch(n,t,e,i)));return e.finish()}updateDeco(t,e){let i=1e9,n=-1;return t.docChanged&&t.changes.iterChanges(((e,s,r,o)=>{o>t.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e}updateRange(t,e,i,n){for(let s of t.visibleRanges){let r=Math.max(s.from,i),o=Math.min(s.to,n);if(o>r){let i=t.state.doc.lineAt(r),n=i.toi.from;r--)if(this.boundary.test(i.text[r-1-i.from])){a=r;break}for(;oc.push(i.range(t,e));if(i==n)for(this.regexp.lastIndex=a-i.from;(h=this.regexp.exec(i.text))&&h.indexthis.addMatch(i,t,e,u)));e=e.update({filterFrom:a,filterTo:l,filter:(t,e)=>tl,add:c})}}return e}}const Or=null!=/x/.unicode?"gu":"g",gr=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",Or),mr={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let br=null;const wr=E.define({combine(t){let e=kt(t,{render:null,specialChars:gr,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==br&&"undefined"!=typeof document&&document.body){let e=document.body.style;br=null!=(null!==(t=e.tabSize)&&void 0!==t?t:e.MozTabSize)}return br||!1}())&&(e.specialChars=new RegExp("\t|"+e.specialChars.source,Or)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Or)),e}});function vr(t={}){return[wr.of(t),yr||(yr=_i.fromClass(class{constructor(t){this.view=t,this.decorations=ni.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(wr)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new pr({regexp:t.specialChars,decoration:(e,i,n)=>{let{doc:s}=i.state,r=b(e[0],0);if(9==r){let t=s.lineAt(n),e=i.state.tabSize,r=Yt(t.text,e,n-t.from);return ni.replace({widget:new xr((e-r%e)*this.view.defaultCharacterWidth)})}return this.decorationCache[r]||(this.decorationCache[r]=ni.replace({widget:new Sr(t,r)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(wr);t.startState.facet(wr)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))]}let yr=null;class Sr extends ei{constructor(t,e){super(),this.options=t,this.code=e}eq(t){return t.code==this.code}toDOM(t){let e=function(t){return t>=32?"•":10==t?"␤":String.fromCharCode(9216+t)}(this.code),i=t.state.phrase("Control character")+" "+(mr[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,i,e);if(n)return n;let s=document.createElement("span");return s.textContent=e,s.title=i,s.setAttribute("aria-label",i),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class xr extends ei{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent="\t",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}class kr extends ei{constructor(t){super(),this.content=t}toDOM(){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):this.content),"string"==typeof this.content?t.setAttribute("aria-label","placeholder "+this.content):t.setAttribute("aria-hidden","true"),t}ignoreEvent(){return!1}}const Qr="-10000px";class $r{constructor(t,e,i){this.facet=e,this.createTooltipView=i,this.input=t.state.facet(e),this.tooltips=this.input.filter((t=>t)),this.tooltipViews=this.tooltips.map(i)}update(t){var e;let i=t.state.facet(this.facet),n=i.filter((t=>t));if(i===this.input){for(let e of this.tooltipViews)e.update&&e.update(t);return!1}let s=[];for(let e=0;e{var e,i,n;return{position:De.ios?"absolute":(null===(e=t.find((t=>t.position)))||void 0===e?void 0:e.position)||"fixed",parent:(null===(i=t.find((t=>t.parent)))||void 0===i?void 0:i.parent)||null,tooltipSpace:(null===(n=t.find((t=>t.tooltipSpace)))||void 0===n?void 0:n.tooltipSpace)||Pr}}}),_r=new WeakMap,Xr=_i.fromClass(class{constructor(t){this.view=t,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(Cr);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new $r(t,Tr,(t=>this.createTooltip(t))),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout((()=>{this.measureTimeout=-1,this.maybeMeasure()}),50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t);e&&this.observeIntersection();let i=e||t.geometryChanged,n=t.state.facet(Cr);if(n.position!=this.position){this.position=n.position;for(let t of this.manager.tooltipViews)t.dom.style.position=this.position;i=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let t of this.manager.tooltipViews)this.container.appendChild(t.dom);i=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure()}createTooltip(t){let e=t.create(this.view);if(e.dom.classList.add("cm-tooltip"),t.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",e.dom.appendChild(t)}return e.dom.style.position=this.position,e.dom.style.top=Qr,this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var t,e;this.view.win.removeEventListener("resize",this.measureSoon);for(let e of this.manager.tooltipViews)e.dom.remove(),null===(t=e.destroy)||void 0===t||t.call(e);null===(e=this.intersectionObserver)||void 0===e||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=this.view.dom.getBoundingClientRect();return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map(((t,e)=>{let i=this.manager.tooltipViews[e];return i.getCoords?i.getCoords(t.pos):this.view.coordsAtPos(t.pos)})),size:this.manager.tooltipViews.map((({dom:t})=>t.getBoundingClientRect())),space:this.view.state.facet(Cr).tooltipSpace(this.view)}}writeMeasure(t){var e;let{editor:i,space:n}=t,s=[];for(let r=0;r=Math.min(i.bottom,n.bottom)||h.rightMath.min(i.right,n.right)+.1){l.style.top=Qr;continue}let u=o.arrow?a.dom.querySelector(".cm-tooltip-arrow"):null,d=u?7:0,f=c.right-c.left,p=null!==(e=_r.get(a))&&void 0!==e?e:c.bottom-c.top,O=a.offset||Ar,g=this.view.textDirection==Wi.LTR,m=c.width>n.right-n.left?g?n.left:n.right-c.width:g?Math.min(h.left-(u?14:0)+O.x,n.right-f):Math.max(n.left,h.left-f+(u?14:0)-O.x),b=!!o.above;!o.strictSide&&(b?h.top-(c.bottom-c.top)-O.yn.bottom)&&b==n.bottom-h.bottom>h.top-n.top&&(b=!b);let w=(b?h.top-n.top:n.bottom-h.bottom)-d;if(wm&&t.topv&&(v=b?t.top-p-2-d:t.bottom+d+2);"absolute"==this.position?(l.style.top=v-t.parent.top+"px",l.style.left=m-t.parent.left+"px"):(l.style.top=v+"px",l.style.left=m+"px"),u&&(u.style.left=h.left+(g?O.x:-O.x)-(m+14-7)+"px"),!0!==a.overlap&&s.push({left:m,top:v,right:y,bottom:v+p}),l.classList.toggle("cm-tooltip-above",b),l.classList.toggle("cm-tooltip-below",!b),a.positioned&&a.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=Qr}},{eventHandlers:{scroll(){this.maybeMeasure()}}}),Zr=Ts.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Ar={x:0,y:0},Tr=E.define({enables:[Xr,Zr]});function Rr(t,e){let i=t.plugin(Xr);if(!i)return null;let n=i.manager.tooltips.indexOf(e);return n<0?null:i.manager.tooltipViews[n]}const Er=E.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 Vr(t,e){let i=t.plugin(Mr),n=i?i.specs.indexOf(e):-1;return n>-1?i.panels[n]:null}const Mr=_i.fromClass(class{constructor(t){this.input=t.state.facet(Ur),this.specs=this.input.filter((t=>t)),this.panels=this.specs.map((e=>e(t)));let e=t.state.facet(Er);this.top=new Dr(t,!0,e.topContainer),this.bottom=new Dr(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(Er);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Dr(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Dr(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(Ur);if(i!=this.input){let e=i.filter((t=>t)),n=[],s=[],r=[],o=[];for(let i of e){let e,a=this.specs.indexOf(i);a<0?(e=i(t.view),o.push(e)):(e=this.panels[a],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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}}))});class Dr{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=Wr(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=Wr(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 Wr(t){let e=t.nextSibling;return t.remove(),e}const Ur=E.define({enables:Mr});class Yr extends Qt{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Yr.prototype.elementClass="",Yr.prototype.toDOM=void 0,Yr.prototype.mapMode=S.TrackBefore,Yr.prototype.startSide=Yr.prototype.endSide=-1,Yr.prototype.point=!0;const qr=E.define(),Lr={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>_t.empty,lineMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},zr=E.define();function Ir(t){return[jr(),zr.of(Object.assign(Object.assign({},Lr),t))]}const Br=E.define({combine:t=>t.some((t=>t))});function jr(t){let e=[Nr];return t&&!1===t.fixed&&e.push(Br.of(!0)),e}const Nr=_i.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+"px",this.gutters=t.state.facet(zr).map((e=>new Jr(t,e)));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!t.state.facet(Br),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(Br)!=!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=_t.iter(this.view.state.facet(qr),this.view.viewport.from),n=[],s=this.gutters.map((t=>new Hr(t,this.view.viewport,-this.view.documentPadding.top)));for(let t of this.view.viewportLineBlocks){let e;if(Array.isArray(t.type)){for(let i of t.type)if(i.type==ii.Text){e=i;break}}else e=t.type==ii.Text?t:void 0;if(e){n.length&&(n=[]),Fr(i,n,t.from);for(let t of s)t.line(this.view,e,n)}}for(let t of s)t.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(zr),i=t.state.facet(zr),n=t.docChanged||t.heightChanged||t.viewportChanged||!_t.eq(t.startState.facet(qr),t.state.facet(qr),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 Jr(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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&0!=i.gutters.length&&i.fixed?e.textDirection==Wi.LTR?{left:i.dom.offsetWidth}:{right:i.dom.offsetWidth}:null}))});function Gr(t){return Array.isArray(t)?t:[t]}function Fr(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class Hr{constructor(t,e,i){this.gutter=t,this.height=i,this.i=0,this.cursor=_t.iter(t.markers,e.from)}line(t,e,i){let n=[];Fr(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;if(0==n.length&&!r.config.renderEmptyElements)return;let o=e.top-this.height;if(this.i==r.elements.length){let i=new Kr(t,e.height,o,n);r.elements.push(i),r.dom.appendChild(i.dom)}else r.elements[this.i].update(t,e.height,o,n);this.height=e.bottom,this.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 Jr{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=Gr(e.markers(t)),e.initialSpacer&&(this.spacer=new Kr(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=Gr(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!_t.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 Kr{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.dom.style.height=(this.height=e)+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),function(t,e){if(t.length!=e.length)return!1;for(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 io extends Yr{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function no(t,e){return t.state.facet(eo).formatNumber(e,t.state)}const so=zr.compute([eo],(t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:t=>t.state.facet(to),lineMarker:(t,e,i)=>i.some((t=>t.toDOM))?null:new io(no(t,t.state.doc.lineAt(e.from).number)),lineMarkerChange:t=>t.startState.facet(eo)!=t.state.facet(eo),initialSpacer:t=>new io(no(t,ro(t.state.doc.lines))),updateSpacer(t,e){let i=no(e.view,ro(e.view.state.doc.lines));return i==t.number?t:new io(i)},domEventHandlers:t.facet(eo).domEventHandlers})));function ro(t){let e=9;for(;e{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=fo.match(t)),e=>{let i=t(e);return void 0===i?null:[this,i]}}}ho.closedBy=new ho({deserialize:t=>t.split(" ")}),ho.openedBy=new ho({deserialize:t=>t.split(" ")}),ho.group=new ho({deserialize:t=>t.split(" ")}),ho.contextHash=new ho({perNode:!0}),ho.lookAhead=new ho({perNode:!0}),ho.mounted=new ho({perNode:!0});class co{constructor(t,e,i){this.tree=t,this.overlay=e,this.parser=i}}const uo=Object.create(null);class fo{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):uo,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),n=new fo(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(ho.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(ho.group),n=-1;n<(i?i.length:0);n++){let s=e[n<0?t.name:i[n]];if(s)return s}}}}fo.none=new fo("",Object.create(null),0,8);class po{constructor(t){this.types=t;for(let e=0;e=n&&(r.type.isAnonymous||!1!==e(r))){if(r.firstChild())continue;t=!0}for(;t&&i&&!r.type.isAnonymous&&i(r),!r.nextSibling();){if(!r.parent())return;t=!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:To(fo.none,this.children,this.positions,0,this.children.length,0,this.length,((t,e,i)=>new bo(this.type,t,e,i,this.propValues)),t.makeTree||((t,e,i)=>new bo(fo.none,t,e,i)))}static build(t){return function(t){var e;let{buffer:i,nodeSet:n,maxBufferLength:s=oo,reused:r=[],minRepeatType:o=n.types.length}=t,a=Array.isArray(i)?new wo(i,i.length):i,l=n.types,h=0,c=0;function u(t,e,i,m,b){let{id:w,start:v,end:y,size:S}=a,x=c;for(;S<0;){if(a.next(),-1==S){let e=r[w];return i.push(e),void m.push(v-t)}if(-3==S)return void(h=w);if(-4==S)return void(c=w);throw new RangeError(`Unrecognized record size: ${S}`)}let k,Q,$=l[w],P=v-t;if(y-v<=s&&(Q=O(a.pos-e,b))){let e=new Uint16Array(Q.size-Q.skip),i=a.pos-Q.size,s=e.length;for(;a.pos>i;)s=g(Q.start,e,s);k=new vo(e,y-Q.start,n),P=Q.start-t}else{let t=a.pos-S;a.next();let e=[],i=[],n=w>=o?w:-1,r=0,l=y;for(;a.pos>t;)n>=0&&a.id==n&&a.size>=0?(a.end<=l-s&&(f(e,i,v,r,a.end,l,n,x),r=e.length,l=a.end),a.next()):u(v,t,e,i,n);if(n>=0&&r>0&&r-1&&r>0){let t=d($);k=To($,e,i,0,e.length,0,y-v,t,t)}else k=p($,e,i,y-v,x-y)}i.push(k),m.push(P)}function d(t){return(e,i,n)=>{let s,r,o=0,a=e.length-1;if(a>=0&&(s=e[a])instanceof bo){if(!a&&s.type==t&&s.length==n)return s;(r=s.prop(ho.lookAhead))&&(o=i[a]+s.length+r)}return p(t,e,i,n,o)}}function f(t,e,i,s,r,o,a,l){let h=[],c=[];for(;t.length>s;)h.push(t.pop()),c.push(e.pop()+i-r);t.push(p(n.types[a],h,c,o-r,l-o)),e.push(r-i)}function p(t,e,i,n,s=0,r){if(h){let t=[ho.contextHash,h];r=r?[t].concat(r):[t]}if(s>25){let t=[ho.lookAhead,s];r=r?[t].concat(r):[t]}return new bo(t,e,i,n,r)}function O(t,e){let i=a.fork(),n=0,r=0,l=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=l,l+=4,n+=4,i.next();continue}let a=i.pos-t;if(t<0||a=o?4:0,d=i.start;for(i.next();i.pos>a;){if(i.size<0){if(-3!=i.size)break t;u+=4}else i.id>=o&&(u+=4);i.next()}r=d,n+=t,l+=u}return(e<0||n==t)&&(c.size=n,c.start=r,c.skip=l),c.size>4?c:void 0}function g(t,e,i){let{id:n,start:s,end:r,size:l}=a;if(a.next(),l>=0&&n4){let n=a.pos-(l-4);for(;a.pos>n;)i=g(t,e,i)}e[--i]=o,e[--i]=r-t,e[--i]=s-t,e[--i]=n}else-3==l?h=n:-4==l&&(c=n);return i}let m=[],b=[];for(;a.pos>0;)u(t.start||0,t.bufferStart||0,m,b,-1);let w=null!==(e=t.length)&&void 0!==e?e:m.length?b[0]+m[0].length:0;return new bo(l[t.topID],m.reverse(),b.reverse(),w)}(t)}}bo.empty=new bo(fo.none,[],[],0);class wo{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 wo(this.buffer,this.index)}}class vo{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return fo.none}toString(){let t=[];for(let e=0;e0));a=r[a+3]);return o}slice(t,e,i){let n=this.buffer,s=new Uint16Array(e-t),r=0;for(let o=t,a=0;o=e&&ie;case 1:return i<=e&&n>e;case 2:return n>e;case 4:return!0}}function So(t,e){let i=t.childBefore(e);for(;i;){let e=i.lastChild;if(!e||e.to!=i.to)break;e.type.isError&&e.from==e.to?(t=i,i=e.prevSibling):i=e}return t}function xo(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!=l;t+=e){let l=o[t],h=a[t]+r.from;if(yo(n,i,h,h+l.length))if(l instanceof vo){if(s&mo.ExcludeBuffers)continue;let o=l.findChild(0,l.buffer.length,e,i-h,n);if(o>-1)return new Co(new Po(r,l,t,h),null,o)}else if(s&mo.IncludeAnonymous||!l.type.isAnonymous||Xo(l)){let o;if(!(s&mo.IgnoreMounts)&&l.props&&(o=l.prop(ho.mounted))&&!o.overlay)return new ko(o.tree,h,t,r);let a=new ko(l,h,t,r);return s&mo.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(e<0?l.children.length-1:0,e,i,n)}}if(s&mo.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&mo.IgnoreOverlays)&&(n=this._tree.prop(ho.mounted))&&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 ko(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}cursor(t=0){return new _o(this,t)}get tree(){return this._tree}toTree(){return this._tree}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return So(this,t)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}toString(){return this._tree.toString()}get node(){return this}matchContext(t){return $o(this,t)}}function Qo(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 $o(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 Po{constructor(t,e,i,n){this.parent=t,this.buffer=e,this.index=i,this.start=n}}class Co{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){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 Co(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&mo.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 Co(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 Co(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 Co(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}cursor(t=0){return new _o(this,t)}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 bo(this.type,t,e,this.to-this.from)}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return So(this,t)}toString(){return this.context.buffer.childString(this.index)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}get node(){return this}matchContext(t){return $o(this,t)}}class _o{get name(){return this.type.name}constructor(t,e=0){if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof ko)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let e=t._parent;e;e=e._parent)this.stack.unshift(e.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return!!t&&(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0)}yieldBuf(t,e){this.index=t;let{start:i,buffer:n}=this.buffer;return this.type=e||n.set.types[n.buffer[t]],this.from=i+n.buffer[t+1],this.to=i+n.buffer[t+2],!0}yield(t){return!!t&&(t instanceof ko?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,i){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,i,this.mode));let{buffer:n}=this.buffer,s=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.buffer.start,i);return!(s<0)&&(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,i=this.mode){return this.buffer?!(i&mo.ExcludeBuffers)&&this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&mo.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&mo.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode));let{buffer:e}=this.buffer,i=this.stack.length-1;if(t<0){let t=i<0?0:this.stack[i]+4;if(this.index!=t)return this.yieldBuf(e.findChild(t,this.index,-1,0,4))}else{let t=e.buffer[this.index+3];if(t<(i<0?e.buffer.length:e.buffer[this.stack[i]+3]))return this.yieldBuf(t)}return i<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,i,{buffer:n}=this;if(n){if(t>0){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&mo.IncludeAnonymous||t instanceof vo||!t.type.isAnonymous||Xo(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 $o(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 Xo(t){return t.children.some((t=>t instanceof vo||!t.type.isAnonymous||Xo(t)))}const Zo=new WeakMap;function Ao(t,e){if(!t.isAnonymous||e instanceof vo||e.type!=t)return 1;let i=Zo.get(e);if(null==i){i=1;for(let n of e.children){if(n.type!=t||!(n instanceof bo)){i=1;break}i+=Ao(t,n)}Zo.set(e,i)}return i}function To(t,e,i,n,s,r,o,a,l){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]+a);continue}u.push(i[s])}else{let e=n[h-1]+i[h-1].length-f;u.push(To(t,i,n,s,h,f,e,null,l))}d.push(f+a-r)}}(e,i,n,s,0),(a||l)(u,d,o)}class Ro{constructor(){this.map=new WeakMap}setBuffer(t,e,i){let n=this.map.get(t);n||this.map.set(t,n=new Map),n.set(e,i)}getBuffer(t,e){let i=this.map.get(t);return i&&i.get(e)}set(t,e){t instanceof Co?this.setBuffer(t.context.buffer,t.index,e):t instanceof ko&&this.map.set(t.tree,e)}get(t){return t instanceof Co?this.getBuffer(t.context.buffer,t.index):t instanceof ko?this.map.get(t.tree):void 0}cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}}class Eo{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 Eo(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,a=0,l=0;;o++){let h=o=i)for(;r&&r.from=e.from||c<=e.to||l){let t=Math.max(e.from,a)-l,i=Math.min(e.to,c)-l;e=t>=i?null:new Eo(t,i,e.tree,e.offset+l,o>0,!!h)}if(e&&n.push(e),r.to>c)break;r=snew lo(t.from,t.to))):[new lo(0,0)]:[new lo(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 Mo{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)}}function Do(t){return(e,i,n,s)=>new qo(e,t,i,n,s)}class Wo{constructor(t,e,i,n,s){this.parser=t,this.parse=e,this.overlay=i,this.target=n,this.ranges=s}}class Uo{constructor(t,e,i,n,s,r,o){this.parser=t,this.predicate=e,this.mounts=i,this.index=n,this.start=s,this.target=r,this.prev=o,this.depth=0,this.ranges=[]}}const Yo=new ho({perNode:!0});class qo{constructor(t,e,i,n,s){this.nest=e,this.input=i,this.fragments=n,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=t}advance(){if(this.baseParse){let t=this.baseParse.advance();if(!t)return null;if(this.baseParse=null,this.baseTree=t,this.startInner(),null!=this.stoppedAt)for(let t of this.inner)t.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let t=this.baseTree;return null!=this.stoppedAt&&(t=new bo(t.type,t.children,t.positions,t.length,t.propValues.concat([[Yo,this.stoppedAt]]))),t}let t=this.inner[this.innerDone],e=t.parse.advance();if(e){this.innerDone++;let i=Object.assign(Object.create(null),t.target.props);i[ho.mounted.id]=new co(e,t.overlay,t.parser),t.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let t=this.input.length;for(let e=this.innerDone;et.frag.from<=n.from&&t.frag.to>=n.to&&t.mount.overlay));if(t)for(let i of t.mount.overlay){let s=i.from+t.pos,r=i.to+t.pos;s>=n.from&&r<=n.to&&!e.ranges.some((t=>t.froms))&&e.ranges.push({from:s,to:r})}}a=!1}else if(i&&(r=Lo(i.ranges,n.from,n.to)))a=2!=r;else if(!n.type.isAnonymous&&n.fromnew lo(t.from-n.from,t.to-n.from))):null,n.tree,t)),s.overlay?t.length&&(i={ranges:t,depth:0,prev:i}):a=!1}}else e&&(o=e.predicate(n))&&(!0===o&&(o=new lo(n.from,n.to)),o.fromnew lo(t.from-e.start,t.to-e.start))),e.target,t)),e=e.prev}i&&! --i.depth&&(i=i.prev)}}}}function Lo(t,e,i){for(let n of t){if(n.from>=i)break;if(n.to>e)return n.from<=e&&n.to>=i?2:1}return 0}function zo(t,e,i,n,s,r){if(e=e.to);n++);let o=s.children[n],a=o.buffer;s.children[n]=function t(i,n,s,l,h){let c=i;for(;a[c+2]+r<=e.from;)c=a[c+3];let u=[],d=[];zo(o,i,c,u,d,l);let f=a[c+1],p=a[c+2],O=f+r==e.from&&p+r==e.to&&a[c]==e.type.id;return u.push(O?e.toTree():t(c+4,a[c+3],o.set.types[a[c]],f,p-f)),d.push(f-l),zo(o,a[c+3],n,u,d,l),new bo(s,u,d,h)}(0,a.length,fo.none,0,o.length);for(let n=0;n<=i;n++)t.childAfter(e.from)}class Bo{constructor(t,e){this.offset=e,this.done=!1,this.cursor=t.cursor(mo.IncludeAnonymous|mo.IgnoreMounts)}moveTo(t){let{cursor:e}=this,i=t-this.offset;for(;!this.done&&e.from=t&&e.enter(i,1,mo.IgnoreOverlays|mo.ExcludeBuffers)||e.next(!1)||(this.done=!0)}hasNode(t){if(this.moveTo(t.from),!this.done&&this.cursor.from+this.offset==t.from&&this.cursor.tree)for(let e=this.cursor.tree;;){if(e==t.tree)return!0;if(!(e.children.length&&0==e.positions[0]&&e.children[0]instanceof bo))break;e=e.children[0]}return!1}}let jo=class{constructor(t){var e;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){let i=this.curFrag=t[0];this.curTo=null!==(e=i.tree.prop(Yo))&&void 0!==e?e:i.to,this.inner=new Bo(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t)}nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=null!==(t=e.tree.prop(Yo))&&void 0!==t?t:e.to,this.inner=new Bo(e.tree,-e.offset)}}findMounts(t,e){var i;let n=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let t=this.inner.cursor.node;t;t=t.parent){let s=null===(i=t.tree)||void 0===i?void 0:i.prop(ho.mounted);if(s&&s.parser==e)for(let e=this.fragI;e=t.to)break;i.tree==this.curFrag.tree&&n.push({frag:i,pos:t.from-i.offset,mount:s})}}}return n}};function No(t,e){let i=null,n=e;for(let s=1,r=0;s=a)break;t.to<=o||(i||(n=i=e.slice()),t.froma&&i.splice(r+1,0,new lo(a,t.to))):t.to>a?i[r--]=new lo(a,t.to):i.splice(r--,1))}}return n}function Go(t,e,i,n){let s=0,r=0,o=!1,a=!1,l=-1e9,h=[];for(;;){let c=s==t.length?1e9:o?t[s].to:t[s].from,u=r==e.length?1e9:a?e[r].to:e[r].from;if(o!=a){let t=Math.max(l,i),e=Math.min(c,u,n);tnew lo(t.from+n,t.to+n))),a,l);for(let e=0,n=a;;e++){let a=e==o.length,h=a?l:o[e].from;if(h>n&&i.push(new Eo(n,h,s.tree,-t,r.from>=n||r.openStart,r.to<=h||r.openEnd)),a)break;n=o[e].to}}else i.push(new Eo(a,l,s.tree,-t,r.from>=t||r.openStart,r.to<=o||r.openEnd))}return i}let Ho=0;class Jo{constructor(t,e,i){this.set=t,this.base=e,this.modified=i,this.id=Ho++}static define(t){if(null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let e=new Jo([],null,[]);if(e.set.push(e),t)for(let i of t.set)e.set.push(i);return e}static defineModifier(){let t=new ta;return e=>e.modified.indexOf(t)>-1?e:ta.get(e.base||e,e.modified.concat(t).sort(((t,e)=>t.id-e.id)))}}let Ko=0;class ta{constructor(){this.instances=[],this.id=Ko++}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 Jo(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(ta.get(e,t));return s}}function ea(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,a=i[o];if(!a)throw new RangeError("Invalid path: "+t);let l=new na(n,s,o>0?i.slice(0,o):null);e[a]=l.sort(e[a])}}return ia.add(e)}const ia=new ho;class na{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 ra(t,e,i,n=0,s=t.length){let r=new oa(n,Array.isArray(e)?e:[e],i);r.highlightRange(t.cursor(),n,s,"",r.highlighters),r.flush(s)}na.empty=new na([],2,null);class oa{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:a}=t;if(o>=i||a<=e)return;r.isTop&&(s=this.highlighters.filter((t=>!t.scope||t.scope(r))));let l=n,h=function(t){let e=t.type.prop(ia);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}(t)||na.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&&(l&&(l+=" "),l+=c,1==h.mode&&(n+=(n?" ":"")+c)),this.startSpan(t.from,l),h.opaque)return;let u=t.tree&&t.tree.prop(ho.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 d=0,f=o;;d++){let p=d=O)&&t.nextSibling()););if(!p||O>i)break;f=p.to+o,f>e&&(this.highlightRange(r.cursor(),Math.max(e,p.from+o),Math.min(i,f),n,h),this.startSpan(f,l))}c&&t.parent()}else if(t.firstChild()){do{if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,n,s),this.startSpan(Math.min(i,t.to),l)}}while(t.nextSibling());t.parent()}}}const aa=Jo.define,la=aa(),ha=aa(),ca=aa(ha),ua=aa(ha),da=aa(),fa=aa(da),pa=aa(da),Oa=aa(),ga=aa(Oa),ma=aa(),ba=aa(),wa=aa(),va=aa(wa),ya=aa(),Sa={comment:la,lineComment:aa(la),blockComment:aa(la),docComment:aa(la),name:ha,variableName:aa(ha),typeName:ca,tagName:aa(ca),propertyName:ua,attributeName:aa(ua),className:aa(ha),labelName:aa(ha),namespace:aa(ha),macroName:aa(ha),literal:da,string:fa,docString:aa(fa),character:aa(fa),attributeValue:aa(fa),number:pa,integer:aa(pa),float:aa(pa),bool:aa(da),regexp:aa(da),escape:aa(da),color:aa(da),url:aa(da),keyword:ma,self:aa(ma),null:aa(ma),atom:aa(ma),unit:aa(ma),modifier:aa(ma),operatorKeyword:aa(ma),controlKeyword:aa(ma),definitionKeyword:aa(ma),moduleKeyword:aa(ma),operator:ba,derefOperator:aa(ba),arithmeticOperator:aa(ba),logicOperator:aa(ba),bitwiseOperator:aa(ba),compareOperator:aa(ba),updateOperator:aa(ba),definitionOperator:aa(ba),typeOperator:aa(ba),controlOperator:aa(ba),punctuation:wa,separator:aa(wa),bracket:va,angleBracket:aa(va),squareBracket:aa(va),paren:aa(va),brace:aa(va),content:Oa,heading:ga,heading1:aa(ga),heading2:aa(ga),heading3:aa(ga),heading4:aa(ga),heading5:aa(ga),heading6:aa(ga),contentSeparator:aa(Oa),list:aa(Oa),quote:aa(Oa),emphasis:aa(Oa),strong:aa(Oa),link:aa(Oa),monospace:aa(Oa),strikethrough:aa(Oa),inserted:aa(),deleted:aa(),changed:aa(),invalid:aa(),meta:ya,documentMeta:aa(ya),annotation:aa(ya),processingInstruction:aa(ya),definition:Jo.defineModifier(),constant:Jo.defineModifier(),function:Jo.defineModifier(),standard:Jo.defineModifier(),local:Jo.defineModifier(),special:Jo.defineModifier()};var xa;sa([{tag:Sa.link,class:"tok-link"},{tag:Sa.heading,class:"tok-heading"},{tag:Sa.emphasis,class:"tok-emphasis"},{tag:Sa.strong,class:"tok-strong"},{tag:Sa.keyword,class:"tok-keyword"},{tag:Sa.atom,class:"tok-atom"},{tag:Sa.bool,class:"tok-bool"},{tag:Sa.url,class:"tok-url"},{tag:Sa.labelName,class:"tok-labelName"},{tag:Sa.inserted,class:"tok-inserted"},{tag:Sa.deleted,class:"tok-deleted"},{tag:Sa.literal,class:"tok-literal"},{tag:Sa.string,class:"tok-string"},{tag:Sa.number,class:"tok-number"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],class:"tok-string2"},{tag:Sa.variableName,class:"tok-variableName"},{tag:Sa.local(Sa.variableName),class:"tok-variableName tok-local"},{tag:Sa.definition(Sa.variableName),class:"tok-variableName tok-definition"},{tag:Sa.special(Sa.variableName),class:"tok-variableName2"},{tag:Sa.definition(Sa.propertyName),class:"tok-propertyName tok-definition"},{tag:Sa.typeName,class:"tok-typeName"},{tag:Sa.namespace,class:"tok-namespace"},{tag:Sa.className,class:"tok-className"},{tag:Sa.macroName,class:"tok-macroName"},{tag:Sa.propertyName,class:"tok-propertyName"},{tag:Sa.operator,class:"tok-operator"},{tag:Sa.comment,class:"tok-comment"},{tag:Sa.meta,class:"tok-meta"},{tag:Sa.invalid,class:"tok-invalid"},{tag:Sa.punctuation,class:"tok-punctuation"}]);const ka=new ho;function Qa(t){return E.define({combine:t?e=>e.concat(t):void 0})}const $a=new ho;class Pa{constructor(t,e,i=[],n=""){this.data=t,this.name=n,xt.prototype.hasOwnProperty("tree")||Object.defineProperty(xt.prototype,"tree",{get(){return Xa(this)}}),this.parser=e,this.extension=[Wa.of(this),xt.languageData.of(((t,e,i)=>{let n=Ca(t,e,i),s=n.type.prop(ka);if(!s)return[];let r=t.facet(s),o=n.type.prop($a);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 Ca(t,e,i).type.prop(ka)==this.data}findRegions(t){let e=t.facet(Wa);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(ka)==this.data)return void i.push({from:e,to:e+t.length});let s=t.prop(ho.mounted);if(s){if(s.tree.prop(ka)==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;it.isTop?e:void 0))]}),t.name)}configure(t,e){return new _a(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Xa(t){let e=t.field(Pa.state,!1);return e?e.tree:bo.empty}class Za{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let i=this.cursorPos-this.string.length;return t=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i)}}let Aa=null;class Ta{constructor(t,e,i=[],n,s,r,o,a){this.parser=t,this.state=e,this.fragments=i,this.tree=n,this.treeLen=s,this.viewport=r,this.skipped=o,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(t,e,i){return new Ta(t,e,[],bo.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Za(this.state.doc),this.fragments)}work(t,e){return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=bo.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(Eo.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Aa;Aa=this;try{return t()}finally{Aa=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=Ra(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=Eo.applyChanges(i,e),n=bo.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=Ra(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 Vo{createParse(e,i,n){let s=n[0].from,r=n[n.length-1].to;return{parsedPos:s,advance(){let e=Aa;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 bo(fo.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 Aa}}function Ra(t,e,i){return Eo.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class Ea{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 Ea(e)}static init(t){let e=Math.min(3e3,t.doc.length),i=Ta.create(t.facet(Wa).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new Ea(i)}}Pa.state=q.define({create:Ea.init,update(t,e){for(let t of e.effects)if(t.is(Pa.setState))return t.value;return e.startState.facet(Wa)!=e.state.facet(Wa)?Ea.init(e.state):t.apply(e)}});let Va=t=>{let e=setTimeout((()=>t()),500);return()=>clearTimeout(e)};"undefined"!=typeof requestIdleCallback&&(Va=t=>{let e=-1,i=setTimeout((()=>{e=requestIdleCallback(t,{timeout:400})}),100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const Ma="undefined"!=typeof navigator&&(null===(xa=navigator.scheduling)||void 0===xa?void 0:xa.isInputPending)?()=>navigator.scheduling.isInputPending():null,Da=_i.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(Pa.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),t.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(Pa.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=Va(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEndn+1e3,a=s.context.work((()=>Ma&&Ma()||Date.now()>r),n+(o?0:1e5));this.chunkBudget-=Date.now()-e,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Pa.setState.of(new Ea(s.context))})),this.chunkBudget>0&&(!a||o)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then((()=>this.scheduleWork())).catch((t=>Qi(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()}}}),Wa=E.define({combine:t=>t.length?t[0]:null,enables:t=>[Pa.state,Da,Ts.contentAttributes.compute([t],(e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}}))]});class Ua{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}class Ya{constructor(t,e,i,n,s,r=void 0){this.name=t,this.alias=e,this.extensions=i,this.filename=n,this.loadFunc=s,this.support=r,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then((t=>this.support=t),(t=>{throw this.loading=null,t})))}static of(t){let{load:e,support:i}=t;if(!e){if(!i)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");e=()=>Promise.resolve(i)}return new Ya(t.name,(t.alias||[]).concat(t.name).map((t=>t.toLowerCase())),t.extensions||[],t.filename,e,i)}static matchFilename(t,e){for(let i of t)if(i.filename&&i.filename.test(e))return i;let i=/\.([^.]+)$/.exec(e);if(i)for(let e of t)if(e.extensions.indexOf(i[1])>-1)return e;return null}static matchLanguageName(t,e,i=!0){e=e.toLowerCase();for(let i of t)if(i.alias.some((t=>t==e)))return i;if(i)for(let i of t)for(let t of i.alias){let n=e.indexOf(t);if(n>-1&&(t.length>2||!/\w/.test(e[n-1])&&!/\w/.test(e[n+t.length])))return i}return null}}const qa=E.define(),La=E.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 za(t){let e=t.facet(La);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function Ia(t,e){let i="",n=t.tabSize,s=t.facet(La)[0];if("\t"==s){for(;e>=n;)i+="\t",e-=n;s=" "}for(let t=0;t=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 Yt(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 Na=new ho;function Ga(t){let e=t.type.prop(Na);if(e)return e;let i,n=t.firstChild;if(n&&(i=n.type.prop(ho.closedBy))){let e=t.lastChild,n=e&&i.indexOf(e.name)>-1;return t=>el(t,!0,1,void 0,n&&!function(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}(t)?e.from:void 0)}return null==t.parent?Ha:null}function Fa(t,e,i){for(;t;t=t.parent){let n=Ga(t);if(n)return n(Ja.create(i,e,t))}return null}function Ha(){return 0}class Ja extends ja{constructor(t,e,i){super(t.state,t.options),this.base=t,this.pos=e,this.node=i}static create(t,e,i){return new Ja(t,e,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){let t=this.state.doc.lineAt(this.node.from);for(;;){let e=this.node.resolve(t.from);for(;e.parent&&e.parent.from==e.from;)e=e.parent;if(Ka(e,this.node))break;t=this.state.doc.lineAt(e.from)}return this.lineIndent(t.from)}continue(){let t=this.node.parent;return t?Fa(t,this.pos,this.base):0}}function Ka(t,e){for(let i=e;i;i=i.parent)if(t==i)return!0;return!1}function tl({closing:t,align:e=!0,units:i=1}){return n=>el(n,e,i,t)}function el(t,e,i,n,s){let r=t.textAfter,o=r.match(/^\s*/)[0].length,a=n&&r.slice(o,o+n.length)==n||s==t.pos+o,l=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.from{let n=t&&t.test(i.textAfter);return i.baseIndent+(n?0:e*i.unit)}}function nl(){return xt.transactionFilter.of((t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let i=t.newDoc,{head:n}=t.newSelection.main,s=i.lineAt(n);if(n>s.from+200)return t;let r=i.sliceString(s.from,n);if(!e.some((t=>t.test(r))))return t;let{state:o}=t,a=-1,l=[];for(let{head:t}of o.selection.ranges){let e=o.doc.lineAt(t);if(e.from==a)continue;a=e.from;let i=Ba(o,e.from);if(null==i)continue;let n=/^\s*/.exec(e.text)[0],s=Ia(o,i);n!=s&&l.push({from:e.from,to:e.from+n.length,insert:s})}return l.length?[t,{changes:l,sequential:!0}]:t}))}const sl=E.define(),rl=new ho;function ol(t){let e=t.firstChild,i=t.lastChild;return e&&e.toi)continue;if(s&&r.from=e&&n.to>i&&(s=n)}}return s}(t,e,i)}function hl(t,e){let i=e.mapPos(t.from,1),n=e.mapPos(t.to,-1);return i>=n?void 0:{from:i,to:n}}const cl=ut.define({map:hl}),ul=ut.define({map:hl}),dl=q.define({create:()=>ni.none,update(t,e){t=t.map(e.changes);for(let i of e.effects)i.is(cl)&&!pl(t,i.value.from,i.value.to)?t=t.update({add:[bl.range(i.value.from,i.value.to)]}):i.is(ul)&&(t=t.update({filter:(t,e)=>i.value.from!=t||i.value.to!=e,filterFrom:i.value.from,filterTo:i.value.to}));if(e.selection){let i=!1,{head:n}=e.selection.main;t.between(n,n,((t,e)=>{tn&&(i=!0)})),i&&(t=t.update({filterFrom:n,filterTo:n,filter:(t,e)=>e<=n||t>=n}))}return t},provide:t=>Ts.decorations.from(t),toJSON(t,e){let i=[];return t.between(0,e.doc.length,((t,e)=>{i.push(t,e)})),i},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let i=0;i{(!s||s.from>t)&&(s={from:t,to:e})})),s}function pl(t,e,i){let n=!1;return t.between(e,e,((t,s)=>{t==e&&s==i&&(n=!0)})),n}const Ol={placeholderDOM:null,placeholderText:"…"},gl=E.define({combine:t=>kt(t,Ol)});function ml(t){let e=[dl,yl];return t&&e.push(gl.of(t)),e}const bl=ni.replace({widget:new class extends ei{toDOM(t){let{state:e}=t,i=e.facet(gl),n=e=>{let i=t.lineBlockAt(t.posAtDOM(e.target)),n=fl(t.state,i.from,i.to);n&&t.dispatch({effects:ul.of(n)}),e.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(t,n);let s=document.createElement("span");return s.textContent=i.placeholderText,s.setAttribute("aria-label",e.phrase("folded code")),s.title=e.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=n,s}}}),wl={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class vl extends Yr{constructor(t,e){super(),this.config=t,this.open=e}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let e=document.createElement("span");return e.textContent=this.open?this.config.openText:this.config.closedText,e.title=t.state.phrase(this.open?"Fold line":"Unfold line"),e}}const yl=Ts.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Sl{constructor(t,e){let i;function n(t){let e=It.newName();return(i||(i=Object.create(null)))["."+e]=t,e}this.specs=t;const s="string"==typeof e.all?e.all:e.all?n(e.all):void 0,r=e.scope;this.scope=r instanceof Pa?t=>t.prop(ka)==r.data:r?t=>t==r:void 0,this.style=sa(t.map((t=>({tag:t.tag,class:t.class||n(Object.assign({},t,{tag:null}))}))),{all:s}).style,this.module=i?new It(i):null,this.themeType=e.themeType}static define(t,e){return new Sl(t,e||{})}}const xl=E.define(),kl=E.define({combine:t=>t.length?[t[0]]:null});function Ql(t){let e=t.facet(xl);return e.length?e:t.facet(kl)}function $l(t,e){let i,n=[Cl];return t instanceof Sl&&(t.module&&n.push(Ts.styleModule.of(t.module)),i=t.themeType),(null==e?void 0:e.fallback)?n.push(kl.of(t)):i?n.push(xl.computeN([Ts.darkTheme],(e=>e.facet(Ts.darkTheme)==("dark"==i)?[t]:[]))):n.push(xl.of(t)),n}class Pl{constructor(t){this.markCache=Object.create(null),this.tree=Xa(t.state),this.decorations=this.buildDeco(t,Ql(t.state))}update(t){let e=Xa(t.state),i=Ql(t.state),n=i!=Ql(t.startState);e.length{i.add(t,e,this.markCache[n]||(this.markCache[n]=ni.mark({class:n})))}),n,s);return i.finish()}}const Cl=N.high(_i.fromClass(Pl,{decorations:t=>t.decorations})),_l=Sl.define([{tag:Sa.meta,color:"#404740"},{tag:Sa.link,textDecoration:"underline"},{tag:Sa.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Sa.emphasis,fontStyle:"italic"},{tag:Sa.strong,fontWeight:"bold"},{tag:Sa.strikethrough,textDecoration:"line-through"},{tag:Sa.keyword,color:"#708"},{tag:[Sa.atom,Sa.bool,Sa.url,Sa.contentSeparator,Sa.labelName],color:"#219"},{tag:[Sa.literal,Sa.inserted],color:"#164"},{tag:[Sa.string,Sa.deleted],color:"#a11"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],color:"#e40"},{tag:Sa.definition(Sa.variableName),color:"#00f"},{tag:Sa.local(Sa.variableName),color:"#30a"},{tag:[Sa.typeName,Sa.namespace],color:"#085"},{tag:Sa.className,color:"#167"},{tag:[Sa.special(Sa.variableName),Sa.macroName],color:"#256"},{tag:Sa.definition(Sa.propertyName),color:"#00c"},{tag:Sa.comment,color:"#940"},{tag:Sa.invalid,color:"#f00"}]),Xl=Ts.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Zl=1e4,Al="()[]{}",Tl=E.define({combine:t=>kt(t,{afterCursor:!0,brackets:Al,maxScanDistance:Zl,renderMatch:Vl})}),Rl=ni.mark({class:"cm-matchingBracket"}),El=ni.mark({class:"cm-nonmatchingBracket"});function Vl(t){let e=[],i=t.matched?Rl:El;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 Ml=q.define({create:()=>ni.none,update(t,e){if(!e.docChanged&&!e.selection)return t;let i=[],n=e.state.facet(Tl);for(let t of e.state.selection.ranges){if(!t.empty)continue;let s=Ll(e.state,t.head,-1,n)||t.head>0&&Ll(e.state,t.head-1,1,n)||n.afterCursor&&(Ll(e.state,t.head,1,n)||t.headTs.decorations.from(t)}),Dl=[Ml,Xl];function Wl(t={}){return[Tl.of(t),Dl]}const Ul=new ho;function Yl(t,e,i){let n=t.prop(e<0?ho.openedBy:ho.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 ql(t){let e=t.type.prop(Ul);return e?e(t.node):t}function Ll(t,e,i,n={}){let s=n.maxScanDistance||Zl,r=n.brackets||Al,o=Xa(t),a=o.resolveInner(e,i);for(let n=a;n;n=n.parent){let s=Yl(n.type,i,r);if(s&&n.from0?e>=o.from&&eo.from&&e<=o.to))return zl(t,e,i,n,o,s,r)}}return function(t,e,i,n,s,r,o){let a=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%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 a=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(a+t,1).type!=s))if(e%2==0==i>0)u++;else{if(1==u)return{start:h,end:{from:a+t,to:a+t+1},matched:e>>1==l>>1};u--}}i>0&&(t+=r.length)}return c.done?{start:h,matched:!1}:null}(t,e,i,o,a.type,s,r)}function zl(t,e,i,n,s,r,o){let a=n.parent,l={from:s.from,to:s.to},h=0,c=null==a?void 0:a.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 jl(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 Nl=new WeakMap;class Gl extends Pa{constructor(t){let e,i=Qa(t.languageData),n={name:(s=t).name||"",token:s.token,blankLine:s.blankLine||(()=>{}),startState:s.startState||(()=>!0),copyState:s.copyState||jl,indent:s.indent||(()=>null),languageData:s.languageData||{},tokenTable:s.tokenTable||th};var s;super(i,new class extends Vo{createParse(t,i,n){return new Jl(e,t,i,n)}},[qa.of(((t,e)=>this.getIndent(t,e)))],t.name),this.topNode=function(t){let e=fo.define({id:eh.length,name:"Document",props:[ka.add((()=>t))]});return eh.push(e),e}(i),e=this,this.streamParser=n,this.stateAfter=new ho({perNode:!0}),this.tokenTable=t.tokenTable?new rh(n.tokenTable):oh}static define(t){return new Gl(t)}getIndent(t,e){let i,n=Xa(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=Nl.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],a=i+e.positions[r],l=o instanceof bo&&a=e.length)return e;s||e.type!=t.topNode||(s=!0);for(let r=e.children.length-1;r>=0;r--){let o,a=e.positions[r],l=e.children[r];if(ai&&Fl(t,n.tree,0-n.offset,i,r);if(o&&(e=Hl(t,n.tree,i+n.offset,o.pos+n.offset,!1)))return{state:o.state,tree:e}}return{state:t.streamParser.startState(n?za(n):4),tree:bo.empty}}(t,i,r,null==s?void 0:s.state);this.state=o,this.parsedPos=this.chunkStart=r+a.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 Bl(e,t?t.state.tabSize:4,t?za(t.state):2);if(r.eol())s.blankLine(this.state,r.indentUnit);else for(;!r.eol();){let t=Kl(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 th=Object.create(null),eh=[fo.none],ih=new po(eh),nh=[],sh=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"]])sh[t]=lh(th,e);class rh{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),sh)}resolve(t){return t?this.table[t]||(this.table[t]=lh(this.extra,t)):0}}const oh=new rh(th);function ah(t,e){nh.indexOf(t)>-1||(nh.push(t),console.warn(e))}function lh(t,e){let i=null;for(let n of e.split(".")){let e=t[n]||Sa[n];e?"function"==typeof e?i?i=e(i):ah(n,`Modifier ${n} used at start of tag`):i?ah(n,`Tag ${n} used as modifier`):i=e:ah(n,`Unknown highlighting tag ${n}`)}if(!i)return 0;let n=e.replace(/ /g,"_"),s=fo.define({id:eh.length,name:n,props:[ea({[n]:i})]});return eh.push(s),s.id}function hh(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 ch=hh(gh,0),uh=hh(Oh,0),dh=hh(((t,e)=>Oh(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 fh(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}const ph=50;function Oh(t,e,i=e.selection.ranges){let n=i.map((t=>fh(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,a=t.sliceDoc(n-ph,n),l=t.sliceDoc(s,s+ph),h=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(l)[0].length,u=a.length-h;if(a.slice(u-e.length,u)==e&&l.slice(c,c+i.length)==i)return{open:{pos:n-h,margin:h&&1},close:{pos:s+c,margin:c&&1}};s-n<=2*ph?r=o=t.sliceDoc(n,s):(r=t.sliceDoc(n,n+ph),o=t.sliceDoc(s-ph,s));let d=/^\s*/.exec(r)[0].length,f=/\s*$/.exec(o)[0].length,p=o.length-f-i.length;return r.slice(d,d+e.length)==e&&o.slice(p,p+i.length)==i?{open:{pos:n+d+e.length,margin:/\s/.test(r.charAt(d+e.length))?1:0},close:{pos:s-f-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>l.from)){s=l.from;let t=/^\s*/.exec(l.text)[0].length,e=t==l.length,i=l.text.slice(t,t+a.length)==a?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 mh=lt.define(),bh=lt.define(),wh=E.define(),vh=E.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)})});const yh=q.define({create:()=>Dh.empty,update(t,e){let i=e.state.facet(vh),n=e.annotation(mh);if(n){let s=e.docChanged?A.single(function(t){let e=0;return t.iterChangedRanges(((t,i)=>e=i)),e}(e.changes)):void 0,r=Ch.fromTransaction(e,s),o=n.side,a=0==o?t.undone:t.done;return a=r?_h(a,a.length,i.minDepth,r):Th(a,e.startState.selection),new Dh(0==o?n.rest:a,0==o?a:n.rest)}let s=e.annotation(bh);if("full"!=s&&"before"!=s||(t=t.isolate()),!1===e.annotation(dt.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);let r=Ch.fromTransaction(e),o=e.annotation(dt.time),a=e.annotation(dt.userEvent);return r?t=t.addChanges(r,o,a,i,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,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 Dh(t.done.map(Ch.fromJSON),t.undone.map(Ch.fromJSON))});function Sh(t={}){return[yh,vh.of(t),Ts.domEventHandlers({beforeinput(t,e){let i="historyUndo"==t.inputType?kh:"historyRedo"==t.inputType?Qh:null;return!!i&&(t.preventDefault(),i(e))}})]}function xh(t,e){return function({state:i,dispatch:n}){if(!e&&i.readOnly)return!1;let s=i.field(yh,!1);if(!s)return!1;let r=s.pop(t,i,e);return!!r&&(n(r),!0)}}const kh=xh(0,!1),Qh=xh(1,!1),$h=xh(0,!0),Ph=xh(1,!0);class Ch{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 Ch(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 Ch(t.changes&&k.fromJSON(t.changes),[],t.mapped&&x.fromJSON(t.mapped),t.startSelection&&A.fromJSON(t.startSelection),t.selectionsAfter.map(A.fromJSON))}static fromTransaction(t,e){let i=Zh;for(let e of t.startState.facet(wh)){let n=e(t);n.length&&(i=i.concat(n))}return!i.length&&t.changes.empty?null:new Ch(t.changes.invert(t.startState.doc),i,void 0,e||t.startState.selection,Zh)}static selection(t){return new Ch(void 0,Zh,void 0,void 0,t)}}function _h(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 Xh(t,e){return t.length?e.length?t.concat(e):t:e}const Zh=[],Ah=200;function Th(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-Ah));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),_h(t,t.length-1,1e9,i.setSelAfter(n)))}return[Ch.selection([e])]}function Rh(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 Eh(t,e){if(!t.length)return t;let i=t.length,n=Zh;for(;i;){let s=Vh(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?[Ch.selection(n)]:Zh}function Vh(t,e,i){let n=Xh(t.selectionsAfter.length?t.selectionsAfter.map((t=>t.map(e))):Zh,i);if(!t.changes)return Ch.selection(n);let s=t.changes.map(e),r=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(r):r;return new Ch(s,ut.mapEffects(t.effects,e),o,t.startSelection.map(r),n)}const Mh=/^(input\.type|delete)($|\.)/;class Dh{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 Dh(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||Mh.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)?_h(r,r.length-1,n.minDepth,new Ch(t.changes.compose(o.changes),Xh(t.effects,o.effects),o.mapped,o.startSelection,Zh)):_h(r,r.length,n.minDepth,t),new Dh(r,Zh,e,i)}addSelection(t,e,i,n){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Zh;return s.length>0&&e-this.prevTimet.empty!=o.ranges[e].empty)).length)?this:new Dh(Th(this.done,t),this.undone,e,i);var r,o}addMapping(t){return new Dh(Eh(this.done,t),Eh(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:mh.of({side:t,rest:Rh(n)}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let i=1==n.length?Zh:n.slice(0,n.length-1);return s.mapped&&(i=Eh(i,s.mapped)),e.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:mh.of({side:t,rest:i}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}}Dh.empty=new Dh(Zh,Zh);const Wh=[{key:"Mod-z",run:kh,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Qh,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Qh,preventDefault:!0},{key:"Mod-u",run:$h,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Ph,preventDefault:!0}];function Uh(t,e){return A.create(t.ranges.map(e),t.mainIndex)}function Yh(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function qh({state:t,dispatch:e},i){let n=Uh(t.selection,i);return!n.eq(t.selection)&&(e(Yh(t,n)),!0)}function Lh(t,e){return A.cursor(e?t.to:t.from)}function zh(t,e){return qh(t,(i=>i.empty?t.moveByChar(i,e):Lh(i,e)))}function Ih(t){return t.textDirectionAt(t.state.selection.main.head)==Wi.LTR}const Bh=t=>zh(t,!Ih(t)),jh=t=>zh(t,Ih(t));function Nh(t,e){return qh(t,(i=>i.empty?t.moveByGroup(i,e):Lh(i,e)))}function Gh(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 Fh(t,e,i){let n,s,r=Xa(t).resolveInner(e.head),o=i?ho.closedBy:ho.openedBy;for(let n=e.head;;){let e=i?r.childAfter(n):r.childBefore(n);if(!e)break;Gh(t,e,o)?r=e:n=i?e.to:e.from}return s=r.type.prop(o)&&(n=i?Ll(t,r.from,1):Ll(t,r.to,-1))&&n.matched?i?n.end.to:n.end.from:i?r.to:r.from,A.cursor(s,i?-1:1)}function Hh(t,e){return qh(t,(i=>{if(!i.empty)return Lh(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)}))}const Jh=t=>Hh(t,!1),Kh=t=>Hh(t,!0);function tc(t){let e,i=t.scrollDOM.clientHeighti.empty?t.moveVertically(i,e,n.height):Lh(i,e)));if(r.eq(s.selection))return!1;if(n.selfScroll){let e=t.coordsAtPos(s.selection.main.head),o=t.scrollDOM.getBoundingClientRect(),a=o.top+n.marginTop,l=o.bottom-n.marginBottom;e&&e.top>a&&e.bottomec(t,!1),nc=t=>ec(t,!0);function sc(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=A.cursor(n.from+i))}return s}function rc(t,e){let i=Uh(t.state.selection,(t=>{let i=e(t);return A.range(t.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)}));return!i.eq(t.state.selection)&&(t.dispatch(Yh(t.state,i)),!0)}function oc(t,e){return console.log("Select!"),rc(t,(i=>t.moveByCharSelected(i,e)))}const ac=t=>oc(t,!Ih(t)),lc=t=>oc(t,Ih(t));function hc(t,e){return rc(t,(i=>t.moveByGroup(i,e)))}function cc(t,e){return rc(t,(i=>t.moveVertically(i,e)))}const uc=t=>cc(t,!1),dc=t=>cc(t,!0);function fc(t,e){return rc(t,(i=>t.moveVertically(i,e,tc(t).height)))}const pc=t=>fc(t,!1),Oc=t=>fc(t,!0),gc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:0})),!0),mc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.doc.length})),!0),bc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:0})),!0),wc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0);function vc(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=yc(t,n,!0)),s=Math.min(s,n),r=Math.max(r,n)}else s=yc(t,s,!1),r=yc(t,r,!0);return s==r?{range:n}:{changes:{from:s,to:r},range:A.cursor(s)}}));return!s.changes.empty&&(t.dispatch(n.update(s,{scrollIntoView:!0,userEvent:i,effects:"delete.selection"==i?Ts.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function yc(t,e,i){if(t instanceof Ts)for(let n of t.state.facet(Ts.atomicRanges).map((e=>e(t))))n.between(e,e,((t,n)=>{te&&(e=i?n:t)}));return e}const Sc=(t,e)=>vc(t,(i=>{let n,s,{state:r}=t,o=r.doc.lineAt(i);if(!e&&i>o.from&&iSc(t,!1),kc=t=>Sc(t,!0),Qc=(t,e)=>vc(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 a=f(r.text,n-r.from,e)+r.from,l=r.text.slice(Math.min(n,a)-r.from,Math.max(n,a)-r.from),h=o(l);if(null!=t&&h!=t)break;" "==l&&n==i||(t=h),n=a}return n})),$c=t=>Qc(t,!1),Pc=t=>vc(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 _c(t,e,i){if(t.readOnly)return!1;let n=[],s=[];for(let e of Cc(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(A.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(A.range(t.anchor-o,t.head-o))}}return!!n.length&&(e(t.update({changes:n,scrollIntoView:!0,selection:A.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0)}function Xc(t,e,i){if(t.readOnly)return!1;let n=[];for(let e of Cc(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 Zc=Ac(!1);function Ac(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),a=!e&&s==r&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i,n=Xa(t).resolveInner(e),s=n.childBefore(e),r=n.childAfter(e);return s&&r&&s.to<=e&&r.from>=e&&(i=s.type.prop(ho.closedBy))&&i.indexOf(r.name)>-1&&t.doc.lineAt(s.to).from==t.doc.lineAt(r.from).from?{from:s.to,to:r.from}:null}(i,s);e&&(s=r=(r<=o.to?o:i.doc.lineAt(r)).to);let l=new ja(i,{simulateBreak:s,simulateDoubleBreak:!!a}),h=Ba(l,s);for(null==h&&(h=/^\s*/.exec(i.doc.lineAt(s).text)[0].length);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:A.range(r.mapPos(n.anchor,1),r.mapPos(n.head,1))}}))}const Rc=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{i.push({from:e.from,insert:t.facet(La)})})),{userEvent:"input.indent"})),!0),Ec=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{let n=/^\s*/.exec(e.text)[0];if(!n)return;let s=Yt(n,t.tabSize),r=0,o=Ia(t,Math.max(0,s-za(t)));for(;rqh(t,(e=>Fh(t.state,e,!Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,!Ih(t))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:t=>qh(t,(e=>Fh(t.state,e,Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,Ih(t))))},{key:"Alt-ArrowUp",run:({state:t,dispatch:e})=>_c(t,e,!1)},{key:"Shift-Alt-ArrowUp",run:({state:t,dispatch:e})=>Xc(t,e,!1)},{key:"Alt-ArrowDown",run:({state:t,dispatch:e})=>_c(t,e,!0)},{key:"Shift-Alt-ArrowDown",run:({state:t,dispatch:e})=>Xc(t,e,!0)},{key:"Escape",run:({state:t,dispatch:e})=>{let i=t.selection,n=null;return i.ranges.length>1?n=A.create([i.main]):i.main.empty||(n=A.create([A.cursor(i.main.head)])),!!n&&(e(Yh(t,n)),!0)}},{key:"Mod-Enter",run:Ac(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:t,dispatch:e})=>{let i=Cc(t).map((({from:e,to:i})=>A.range(e,Math.min(i+1,t.doc.length))));return e(t.update({selection:A.create(i),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:t,dispatch:e})=>{let i=Uh(t.selection,(e=>{var i;let n=Xa(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 A.range(n.to,n.from)}));return e(Yh(t,i)),!0},preventDefault:!0},{key:"Mod-[",run:Ec},{key:"Mod-]",run:Rc},{key:"Mod-Alt-\\",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new ja(t,{overrideIndentation:t=>{let e=i[t];return null==e?-1:e}}),s=Tc(t,((e,s,r)=>{let o=Ba(n,e.from);if(null==o)return;/\S/.test(e.text)||(o=0);let a=/^\s*/.exec(e.text)[0],l=Ia(t,o);(a!=l||r.from{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(Cc(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=Uh(t.selection,(e=>{let s=Ll(t,e.head,-1)||Ll(t,e.head,1)||e.head>0&&Ll(t,e.head-1,1)||e.head{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=fh(t.state,i.from);return n.line?ch(t):!!n.block&&dh(t)}},{key:"Alt-A",run:uh}].concat([{key:"ArrowLeft",run:Bh,shift:ac,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:t=>Nh(t,!Ih(t)),shift:t=>hc(t,!Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:t=>qh(t,(e=>sc(t,e,!Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,!Ih(t)))),preventDefault:!0},{key:"ArrowRight",run:jh,shift:lc,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:t=>Nh(t,Ih(t)),shift:t=>hc(t,Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:t=>qh(t,(e=>sc(t,e,Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,Ih(t)))),preventDefault:!0},{key:"ArrowUp",run:Jh,shift:uc,preventDefault:!0},{mac:"Cmd-ArrowUp",run:gc,shift:bc},{mac:"Ctrl-ArrowUp",run:ic,shift:pc},{key:"ArrowDown",run:Kh,shift:dc,preventDefault:!0},{mac:"Cmd-ArrowDown",run:mc,shift:wc},{mac:"Ctrl-ArrowDown",run:nc,shift:Oc},{key:"PageUp",run:ic,shift:pc},{key:"PageDown",run:nc,shift:Oc},{key:"Home",run:t=>qh(t,(e=>sc(t,e,!1))),shift:t=>rc(t,(e=>sc(t,e,!1))),preventDefault:!0},{key:"Mod-Home",run:gc,shift:bc},{key:"End",run:t=>qh(t,(e=>sc(t,e,!0))),shift:t=>rc(t,(e=>sc(t,e,!0))),preventDefault:!0},{key:"Mod-End",run:mc,shift:wc},{key:"Enter",run:Zc},{key:"Mod-a",run:({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:xc,shift:xc},{key:"Delete",run:kc},{key:"Mod-Backspace",mac:"Alt-Backspace",run:$c},{key:"Mod-Delete",mac:"Alt-Delete",run:t=>Qc(t,!0)},{mac:"Mod-Backspace",run:t=>vc(t,(e=>{let i=t.lineBlockAt(e).from;return e>i?i:Math.max(0,e-1)}))},{mac:"Mod-Delete",run:Pc}].concat([{key:"Ctrl-b",run:Bh,shift:ac,preventDefault:!0},{key:"Ctrl-f",run:jh,shift:lc},{key:"Ctrl-p",run:Jh,shift:uc},{key:"Ctrl-n",run:Kh,shift:dc},{key:"Ctrl-a",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).from,1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).from)))},{key:"Ctrl-e",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).to,-1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).to)))},{key:"Ctrl-d",run:kc},{key:"Ctrl-h",run:xc},{key:"Ctrl-k",run:Pc},{key:"Ctrl-Alt-h",run:$c},{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:A.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:f(n.text,i-n.from,!1)+n.from,r=i==n.to?i+1:f(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:A.cursor(r)}}));return!i.changes.empty&&(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:nc}].map((t=>({mac:t.key,run:t.run,shift:t.shift})))));function Mc(){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 Uc{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(Wc(t)):Wc,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 b(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=w(t),i=this.bufferStart+this.bufferPos;this.bufferPos+=v(t);let n=this.normalize(e);for(let t=0,s=i;;t++){let r=n.charCodeAt(t),o=this.match(r,s);if(o)return this.value=o,this;if(t==n.length-1)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=jc(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 Ic(e,t.sliceString(e,i));return zc.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=jc(this.text,i+(t==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ic.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function jc(t,e){if(e>=t.length)return e;let i,n=t.lineAt(e);for(;e=56320&&i<57344;)e++;return e}function Nc(t){let e=Mc("input",{class:"cm-textfield",name:"line"});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,a,l]=i,h=a?+a.slice(1):0,c=o?+o:s.number;if(o&&l){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)));t.dispatch({effects:Gc.of(!1),selection:A.cursor(u.from+Math.max(0,Math.min(h,u.length))),scrollIntoView:!0}),t.focus()}return{dom:Mc("form",{class:"cm-gotoLine",onkeydown:e=>{27==e.keyCode?(e.preventDefault(),t.dispatch({effects:Gc.of(!1)}),t.focus()):13==e.keyCode&&(e.preventDefault(),i())},onsubmit:t=>{t.preventDefault(),i()}},Mc("label",t.state.phrase("Go to line"),": ",e)," ",Mc("button",{class:"cm-button",type:"submit"},t.state.phrase("go")))}}"undefined"!=typeof Symbol&&(Lc.prototype[Symbol.iterator]=Bc.prototype[Symbol.iterator]=function(){return this});const Gc=ut.define(),Fc=q.define({create:()=>!0,update(t,e){for(let i of e.effects)i.is(Gc)&&(t=i.value);return t},provide:t=>Ur.from(t,(t=>t?Nc:null))}),Hc=Ts.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),Jc={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Kc=E.define({combine:t=>kt(t,Jc,{highlightWordAroundCursor:(t,e)=>t||e,minSelectionLength:Math.min,maxMatches:Math.min})});function tu(t){let e=[ru,su];return t&&e.push(Kc.of(t)),e}const eu=ni.mark({class:"cm-selectionMatch"}),iu=ni.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function nu(t,e,i,n){return!(0!=i&&t(e.sliceDoc(i-1,i))==wt.Word||n!=e.doc.length&&t(e.sliceDoc(n,n+1))==wt.Word)}const su=_i.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(Kc),{state:i}=t,n=i.selection;if(n.ranges.length>1)return ni.none;let s,r=n.main,o=null;if(r.empty){if(!e.highlightWordAroundCursor)return ni.none;let t=i.wordAt(r.head);if(!t)return ni.none;o=i.charCategorizer(r.head),s=i.sliceDoc(t.from,t.to)}else{let t=r.to-r.from;if(t200)return ni.none;if(e.wholeWords){if(s=i.sliceDoc(r.from,r.to),o=i.charCategorizer(r.head),!nu(o,i,r.from,r.to)||!function(t,e,i,n){return t(e.sliceDoc(i,i+1))==wt.Word&&t(e.sliceDoc(n-1,n))==wt.Word}(o,i,r.from,r.to))return ni.none}else if(s=i.sliceDoc(r.from,r.to).trim(),!s)return ni.none}let a=[];for(let n of t.visibleRanges){let t=new Uc(i.doc,s,n.from,n.to);for(;!t.next().done;){let{from:n,to:s}=t.value;if((!o||nu(o,i,n,s))&&(r.empty&&n<=r.from&&s>=r.to?a.push(iu.range(n,s)):(n>=r.to||s<=r.from)&&a.push(eu.range(n,s)),a.length>e.maxMatches))return ni.none}}return ni.set(a)}},{decorations:t=>t.decorations}),ru=Ts.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});const ou=E.define({combine:t=>kt(t,{top:!1,caseSensitive:!1,literal:!1,wholeWord:!1,createPanel:t=>new Eu(t),scrollToMatch:t=>Ts.scrollIntoView(t)})});class au{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,qc),!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 pu(this):new cu(this)}getCursor(t,e=0,i){let n=t.doc?t:xt.create({doc:t});return null==i&&(i=n.doc.length),this.regexp?uu(this,n,e,i):hu(this,n,e,i)}}class lu{constructor(t){this.spec=t}}function hu(t,e,i,n){return new Uc(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=hu(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 uu(t,e,i,n){return new Lc(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?(s=e.charCategorizer(e.selection.main.head),(t,e,i)=>!i[0].length||(s(du(i.input,i.index))!=wt.Word||s(fu(i.input,i.index))!=wt.Word)&&(s(fu(i.input,i.index+i[0].length))!=wt.Word||s(du(i.input,i.index+i[0].length))!=wt.Word)):void 0},i,n);var s}function du(t,e){return t.slice(f(t,e,!1),e)}function fu(t,e){return t.slice(e,f(t,e))}class pu extends lu{nextMatch(t,e,i){let n=uu(this.spec,t,i,t.doc.length).next();return n.done&&(n=uu(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=uu(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=uu(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 Ou=ut.define(),gu=ut.define(),mu=q.define({create:t=>new bu(_u(t).create(),null),update(t,e){for(let i of e.effects)i.is(Ou)?t=new bu(i.value.create(),t.panel):i.is(gu)&&(t=new bu(t.query,i.value?Cu:null));return t},provide:t=>Ur.from(t,(t=>t.panel))});class bu{constructor(t,e){this.query=t,this.panel=e}}const wu=ni.mark({class:"cm-searchMatch"}),vu=ni.mark({class:"cm-searchMatch cm-searchMatch-selected"}),yu=_i.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(mu))}update(t){let e=t.state.field(mu);(e!=t.startState.field(mu)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ni.none;let{view:i}=this,n=new Xt;for(let e=0,s=i.visibleRanges,r=s.length;es[e+1].from-500;)a=s[++e].to;t.highlight(i.state,o,a,((t,e)=>{let s=i.state.selection.ranges.some((i=>i.from==t&&i.to==e));n.add(t,e,s?vu:wu)}))}return n.finish()}},{decorations:t=>t.decorations});function Su(t){return e=>{let i=e.state.field(mu,!1);return i&&i.query.spec.valid?t(e,i):Au(e)}}const xu=Su(((t,{query:e})=>{let{to:i}=t.state.selection.main,n=e.nextMatch(t.state,i,i);if(!n)return!1;let s=A.single(n.from,n.to),r=t.state.facet(ou);return t.dispatch({selection:s,effects:[Wu(t,n),r.scrollToMatch(s.main,t)],userEvent:"select.search"}),Zu(t),!0})),ku=Su(((t,{query:e})=>{let{state:i}=t,{from:n}=i.selection.main,s=e.prevMatch(i,n,n);if(!s)return!1;let r=A.single(s.from,s.to),o=t.state.facet(ou);return t.dispatch({selection:r,effects:[Wu(t,s),o.scrollToMatch(r.main,t)],userEvent:"select.search"}),Zu(t),!0})),Qu=Su(((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!(!i||!i.length)&&(t.dispatch({selection:A.create(i.map((t=>A.range(t.from,t.to)))),userEvent:"select.search.matches"}),!0)})),$u=Su(((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,a,l=[],h=[];if(r.from==n&&r.to==s&&(a=i.toText(e.getReplacement(r)),l.push({from:r.from,to:r.to,insert:a}),r=e.nextMatch(i,r.from,r.to),h.push(Ts.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(n).number)+"."))),r){let e=0==l.length||l[0].from>=r.to?0:r.to-r.from-a.length;o=A.single(r.from-e,r.to-e),h.push(Wu(t,r)),h.push(i.facet(ou).scrollToMatch(o.main,t))}return t.dispatch({changes:l,selection:o,effects:h,userEvent:"input.replace"}),!0})),Pu=Su(((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:Ts.announce.of(n),userEvent:"input.replace.all"}),!0}));function Cu(t){return t.state.facet(ou).createPanel(t)}function _u(t,e){var i,n,s,r;let o=t.selection.main,a=o.empty||o.to>o.from+100?"":t.sliceDoc(o.from,o.to);if(e&&!a)return e;let l=t.facet(ou);return new au({search:(null!==(i=null==e?void 0:e.literal)&&void 0!==i?i:l.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:null!==(n=null==e?void 0:e.caseSensitive)&&void 0!==n?n:l.caseSensitive,literal:null!==(s=null==e?void 0:e.literal)&&void 0!==s?s:l.literal,wholeWord:null!==(r=null==e?void 0:e.wholeWord)&&void 0!==r?r:l.wholeWord})}function Xu(t){let e=Vr(t,Cu);return e&&e.dom.querySelector("[main-field]")}function Zu(t){let e=Xu(t);e&&e==t.root.activeElement&&e.select()}const Au=t=>{let e=t.state.field(mu,!1);if(e&&e.panel){let i=Xu(t);if(i&&i!=t.root.activeElement){let n=_u(t.state,e.query.spec);n.valid&&t.dispatch({effects:Ou.of(n)}),i.focus(),i.select()}}else t.dispatch({effects:[gu.of(!0),e?Ou.of(_u(t.state,e.query.spec)):ut.appendConfig.of(Yu)]});return!0},Tu=t=>{let e=t.state.field(mu,!1);if(!e||!e.panel)return!1;let i=Vr(t,Cu);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:gu.of(!1)}),!0},Ru=[{key:"Mod-f",run:Au,scope:"editor search-panel"},{key:"F3",run:xu,shift:ku,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:xu,shift:ku,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Tu,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 Uc(t.doc,t.sliceDoc(n,s));!e.next().done;){if(r.length>1e3)return!1;e.value.from==n&&(o=r.length),r.push(A.range(e.value.from,e.value.to))}return e(t.update({selection:A.create(r,o),userEvent:"select.search.matches"})),!0}},{key:"Alt-g",run:t=>{let e=Vr(t,Nc);if(!e){let i=[Gc.of(!0)];null==t.state.field(Fc,!1)&&i.push(ut.appendConfig.of([Fc,Hc])),t.dispatch({effects:i}),e=Vr(t,Nc)}return e&&e.dom.querySelector("input").focus(),!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=A.create(i.ranges.map((e=>t.wordAt(e.head)||A.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 Uc(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 Uc(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(A.range(s.from,s.to),!1),effects:Ts.scrollIntoView(s.to)})),!0)},preventDefault:!0}];class Eu{constructor(t){this.view=t;let e=this.query=t.state.field(mu).query.spec;function i(t,e,i){return Mc("button",{class:"cm-button",name:t,onclick:e,type:"button"},i)}this.commit=this.commit.bind(this),this.searchField=Mc("input",{value:e.search,placeholder:Vu(t,"Find"),"aria-label":Vu(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Mc("input",{value:e.replace,placeholder:Vu(t,"Replace"),"aria-label":Vu(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Mc("input",{type:"checkbox",name:"case",form:"",checked:e.caseSensitive,onchange:this.commit}),this.reField=Mc("input",{type:"checkbox",name:"re",form:"",checked:e.regexp,onchange:this.commit}),this.wordField=Mc("input",{type:"checkbox",name:"word",form:"",checked:e.wholeWord,onchange:this.commit}),this.dom=Mc("div",{onkeydown:t=>this.keydown(t),class:"cm-search"},[this.searchField,i("next",(()=>xu(t)),[Vu(t,"next")]),i("prev",(()=>ku(t)),[Vu(t,"previous")]),i("select",(()=>Qu(t)),[Vu(t,"all")]),...t.state.readOnly?[]:[Mc("br"),this.replaceField,i("replace",(()=>$u(t)),[Vu(t,"replace")]),i("replaceAll",(()=>Pu(t)),[Vu(t,"replace all")])],Mc("button",{name:"close",onclick:()=>Tu(t),"aria-label":Vu(t,"close"),type:"button"},["×"])])}commit(){let t=new au({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:Ou.of(t)}))}keydown(t){var e,i,n;e=this.view,i=t,n="search-panel",Bs(Ls(e.state),i,e,n)?t.preventDefault():13==t.keyCode&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?ku:xu)(this.view)):13==t.keyCode&&t.target==this.replaceField&&(t.preventDefault(),$u(this.view))}update(t){for(let e of t.transactions)for(let t of e.effects)t.is(Ou)&&!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(ou).top}}function Vu(t,e){return t.state.phrase(e)}const Mu=30,Du=/[\s\.,:;?!]/;function Wu(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-Mu),o=Math.min(s,i+Mu),a=t.state.sliceDoc(r,o);if(r!=n.from)for(let t=0;ta.length-Mu;t--)if(!Du.test(a[t-1])&&Du.test(a[t])){a=a.slice(0,t);break}return Ts.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${n.number}.`)}const Uu=Ts.baseTheme({".cm-panel.cm-search":{padding:"0.25rem 0.5rem 0.25rem 0.5rem",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"0.5rem",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"}}),Yu=[mu,N.lowest(yu),Uu];class qu{constructor(t,e,i){this.state=t,this.pos=e,this.explicit=i,this.abortListeners=[]}tokenBefore(t){let e=Xa(this.state).resolveInner(this.pos,-1);for(;e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null}matchBefore(t){let e=this.state.doc.lineAt(this.pos),i=Math.max(e.from,this.pos-250),n=e.text.slice(i-e.from,this.pos-e.from),s=n.search(ju(t,!1));return s<0?null:{from:i+s,to:this.pos,text:n.slice(s)}}get aborted(){return null==this.abortListeners}addEventListener(t,e){"abort"==t&&this.abortListeners&&this.abortListeners.push(e)}}function Lu(t){let e=Object.keys(t).join(""),i=/\w/.test(e);return i&&(e=e.replace(/\w/g,"")),`[${i?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function zu(t){let e=t.map((t=>"string"==typeof t?{label:t}:t)),[i,n]=e.every((t=>/^\w+$/.test(t.label)))?[/\w*$/,/\w+$/]:function(t){let e=Object.create(null),i=Object.create(null);for(let{label:n}of t){e[n[0]]=!0;for(let t=1;t{let s=t.matchBefore(n);return s||t.explicit?{from:s?s.from:t.pos,options:e,validFor:i}:null}}class Iu{constructor(t,e,i,n){this.completion=t,this.source=e,this.match=i,this.score=n}}function Bu(t){return t.selection.main.from}function ju(t,e){var i;let{source:n}=t,s=e&&"^"!=n[0],r="$"!=n[n.length-1];return s||r?new RegExp(`${s?"^":""}(?:${n})${r?"$":""}`,null!==(i=t.flags)&&void 0!==i?i:t.ignoreCase?"i":""):t}const Nu=lt.define();const Gu=new WeakMap;function Fu(t){if(!Array.isArray(t))return t;let e=Gu.get(t);return e||Gu.set(t,e=zu(t)),e}const Hu=ut.define(),Ju=ut.define();class Ku{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[];for(let e=0;e=48&&l<=57||l>=97&&l<=122?2:l>=65&&l<=90?1:0:(y=w(l))!=y.toLowerCase()?1:y!=y.toUpperCase()?2:0;(!n||1==S&&O||0==m&&0!=S)&&(e[c]==l||i[c]==l&&(u=!0)?r[c++]=n:r.length&&(g=!1)),m=S,n+=v(l)}return c==a&&0==r[0]&&g?this.result((u?-200:0)-100,r,t):d==a&&0==f?[-200-t.length+(p==t.length?0:-100),0,p]:o>-1?[-700-t.length,o,o+this.pattern.length]:d==a?[-900-t.length,f,p]:c==a?this.result((u?-200:0)-100-700+(g?0:-1100),r,t):2==e.length?null:this.result((n[0]?-700:0)-200-1100,n,t)}result(t,e,i){let n=[t-i.length],s=1;for(let t of e){let e=t+(this.astral?v(b(i,t)):1);s>1&&n[s-1]==t?n[s-1]=e:(n[s++]=t,n[s++]=e)}return n}}const td=E.define({combine:t=>kt(t,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:id,compareCompletions:(t,e)=>t.label.localeCompare(e.label),interactionDelay:75},{defaultKeymap:(t,e)=>t&&e,closeOnBlur:(t,e)=>t&&e,icons:(t,e)=>t&&e,tooltipClass:(t,e)=>i=>ed(t(i),e(i)),optionClass:(t,e)=>i=>ed(t(i),e(i)),addToOptions:(t,e)=>t.concat(e)})});function ed(t,e){return t?e?t+" "+e:t:e}function id(t,e,i,n,s){let r,o,a=t.textDirection==Wi.RTL,l=a,h=!1,c="top",u=e.left-s.left,d=s.right-e.right,f=n.right-n.left,p=n.bottom-n.top;if(l&&u=p||t>e.top?r=i.bottom-e.top:(c="bottom",r=e.bottom-i.top)}return{style:`${c}: ${r}px; max-width: ${o}px`,class:"cm-completionInfo-"+(h?a?"left-narrow":"right-narrow":l?"left":"right")}}function nd(t,e="option"){return i=>{let n=i.state.field(yd,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp-1?n.open.selected+r*(t?1:-1):t?0:o-1;return a<0?a="page"==e?0:o-1:a>=o&&(a="page"==e?o-1:0),i.dispatch({effects:vd.of(a)}),!0}}const sd=t=>{let e=t.state.field(yd,!1);return!(t.state.readOnly||!e||!e.open||e.open.selected<0||Date.now()-e.open.timestamp(t.selection||t.docChanged)&&!gd(t)));for(let e=0;e50&&Date.now()-n.time>1e3){for(let t of n.context.abortListeners)try{t()}catch(t){Qi(this.view.state,t)}n.context.abortListeners=null,this.running.splice(e--,1)}else n.updates.push(...t.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some((t=>1==t.state&&!this.running.some((e=>e.active.source==t.source))))?setTimeout((()=>this.startUpdate()),50):-1,0!=this.composing)for(let e of t.transactions)"input"==gd(e)?this.composing=2:2==this.composing&&e.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:t}=this.view,e=t.field(yd);for(let t of e.active)1!=t.state||this.running.some((e=>e.active.source==t.source))||this.startQuery(t)}startQuery(t){let{state:e}=this.view,i=Bu(e),n=new qu(e,i,t.explicitPos==i),s=new rd(t,n);this.running.push(s),Promise.resolve(t.source(n)).then((t=>{s.context.aborted||(s.done=t||null,this.scheduleAccept())}),(t=>{this.view.dispatch({effects:Ju.of(null)}),Qi(this.view.state,t)}))}scheduleAccept(){this.running.every((t=>void 0!==t.done))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((()=>this.accept()),50))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],i=this.view.state.facet(td);for(let n=0;nt.source==s.active.source));if(r&&1==r.state)if(null==s.done){let t=new md(s.active.source,0);for(let e of s.updates)t=t.update(e,i);1!=t.state&&e.push(t)}else this.startQuery(r)}e.length&&this.view.dispatch({effects:wd.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(yd,!1);if(e&&e.tooltip&&this.view.state.facet(td).closeOnBlur){let i=e.open&&Rr(this.view,e.open.tooltip);i&&i.dom.contains(t.relatedTarget)||this.view.dispatch({effects:Ju.of(null)})}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout((()=>this.view.dispatch({effects:Hu.of(!1)})),20),this.composing=0}}});function ad(t,e){const i=e.completion.apply||e.completion.label;let n=t.state.field(yd).active.find((t=>t.source==e.source));return n instanceof bd&&("string"==typeof i?t.dispatch(Object.assign(Object.assign({},function(t,e,i,n){let{main:s}=t.selection,r=i-s.from,o=n-s.from;return Object.assign(Object.assign({},t.changeByRange((a=>a!=s&&i!=n&&t.sliceDoc(a.from+r,a.from+o)!=t.sliceDoc(i,n)?{range:a}:{changes:{from:a.from+r,to:n==s.from?a.to:a.from+o,insert:e},range:A.cursor(a.from+r+e.length)}))),{userEvent:"input.complete"})}(t.state,i,n.from,n.to)),{annotations:Nu.of(e.completion)})):i(t,e.completion,n.from,n.to),!0)}function ld(t,e,i){if(t<=i)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let t=Math.floor(e/i);return{from:t*i,to:(t+1)*i}}let n=Math.floor((t-e)/i);return{from:t-(n+1)*i,to:t-n*i}}class hd{constructor(t,e){this.view=t,this.stateField=e,this.info=null,this.placeInfoReq={read:()=>this.measureInfo(),write:t=>this.placeInfo(t),key:this},this.space=null,this.currentClass="";let i=t.state.field(e),{options:n,selected:s}=i.open,r=t.state.facet(td);this.optionContent=function(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(t){let e=document.createElement("div");return e.classList.add("cm-completionIcon"),t.type&&e.classList.add(...t.type.split(/\s+/g).map((t=>"cm-completionIcon-"+t))),e.setAttribute("aria-hidden","true"),e},position:20}),e.push({render(t,e,i){let n=document.createElement("span");n.className="cm-completionLabel";let{label:s}=t,r=0;for(let t=1;tr&&n.appendChild(document.createTextNode(s.slice(r,e)));let a=n.appendChild(document.createElement("span"));a.appendChild(document.createTextNode(s.slice(e,o))),a.className="cm-completionMatchedText",r=o}return rt.position-e.position)).map((t=>t.render))}(r),this.optionClass=r.optionClass,this.tooltipClass=r.tooltipClass,this.range=ld(n.length,s,r.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",(e=>{for(let i,s=e.target;s&&s!=this.dom;s=s.parentNode)if("LI"==s.nodeName&&(i=/-(\d+)$/.exec(s.id))&&+i[1]{let i=t.state.field(this.stateField,!1);i&&i.tooltip&&t.state.facet(td).closeOnBlur&&e.relatedTarget!=t.contentDOM&&t.dispatch({effects:Ju.of(null)})})),this.list=this.dom.appendChild(this.createListBox(n,i.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))}mount(){this.updateSel()}update(t){var e,i,n;let s=t.state.field(this.stateField),r=t.startState.field(this.stateField);this.updateTooltipClass(t.state),s!=r&&(this.updateSel(),(null===(e=s.open)||void 0===e?void 0:e.disabled)!=(null===(i=r.open)||void 0===i?void 0:i.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!(null===(n=s.open)||void 0===n?void 0:n.disabled)))}updateTooltipClass(t){let e=this.tooltipClass(t);if(e!=this.currentClass){for(let t of this.currentClass.split(" "))t&&this.dom.classList.remove(t);for(let t of e.split(" "))t&&this.dom.classList.add(t);this.currentClass=e}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),e=t.open;if((e.selected>-1&&e.selected=this.range.to)&&(this.range=ld(e.options.length,e.selected,this.view.state.facet(td).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e.options,t.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))),this.updateSelectedOption(e.selected)){this.info&&(this.info.remove(),this.info=null);let{completion:i}=e.options[e.selected],{info:n,label:s,c:r}=i;if(!n)return;let o="string"==typeof n?document.createTextNode(n+" "):n(i);if(!o)return;if(!r){const t=document.createElement("span");t.appendChild(o),o=t;const e=document.createElement("a");e.innerText="🔎",e.href="/docFind/"+s,e.target="blank",o.appendChild(e)}if(!o)return;"then"in o?o.then((e=>{e&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(e)})).catch((t=>Qi(this.view.state,t,"completion info"))):this.addInfoPane(o)}}addInfoPane(t){let e=this.info=document.createElement("div");e.className="cm-tooltip cm-completionInfo",e.appendChild(t),this.dom.appendChild(e),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let e=null;for(let i=this.list.firstChild,n=this.range.from;i;i=i.nextSibling,n++)"LI"==i.nodeName&&i.id?n==t?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),e=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected"):n--;return e&&function(t,e){let i=t.getBoundingClientRect(),n=e.getBoundingClientRect();n.topi.bottom&&(t.scrollTop+=n.bottom-i.bottom)}(this.list,e),e}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let e=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),n=t.getBoundingClientRect(),s=this.space;if(!s){let t=this.dom.ownerDocument.defaultView||window;s={left:0,top:0,right:t.innerWidth,bottom:t.innerHeight}}return n.top>Math.min(s.bottom,e.bottom)-10||n.bottomi.from||0==i.from))if(s=t,"string"!=typeof l&&l.header)n.appendChild(l.header(l));else{n.appendChild(document.createElement("completion-section")).textContent=t}}const h=n.appendChild(document.createElement("li"));h.id=e+"-"+r,h.setAttribute("role","option");let c=this.optionClass(o);c&&(h.className=c);for(let t of this.optionContent){let e=t(o,this.view.state,a);e&&h.appendChild(e)}}return i.from&&n.classList.add("cm-completionListIncompleteTop"),i.to=this.options.length?this:new ud(this.options,pd(e,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,e,i,n,s){let r=function(t,e){let i=[],n=null,s=t=>{i.push(t);let{section:e}=t.completion;if(e){n||(n=[]);let t="string"==typeof e?e:e.name;n.some((e=>e.name==t))||n.push("string"==typeof e?{name:t}:e)}};for(let n of t)if(n.hasResult())if(!1===n.result.filter){let t=n.result.getMatch;for(let e of n.result.options){let r=[1e9-i.length];if(t)for(let i of t(e))r.push(i);s(new Iu(e,n.source,r,r[0]))}}else{let t,i=new Ku(e.sliceDoc(n.from,n.to));for(let e of n.result.options)(t=i.match(e.label))&&s(new Iu(e,n.source,t,t[0]+(e.boost||0)))}if(n){let t=Object.create(null),e=0,s=(t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:1e9)-(null!==(n=e.rank)&&void 0!==n?n:1e9)||(t.namee.score-t.score||a(t.completion,e.completion))))!o||o.label!=t.completion.label||o.detail!=t.completion.detail||null!=o.type&&null!=t.completion.type&&o.type!=t.completion.type||o.apply!=t.completion.apply?r.push(t):cd(t.completion)>cd(o)&&(r[r.length-1]=t),o=t.completion;return r}(t,e);if(!r.length)return n&&t.some((t=>1==t.state))?new ud(n.options,n.attrs,n.tooltip,n.timestamp,n.selected,!0):null;let o=e.facet(td).selectOnOpen?0:-1;if(n&&n.selected!=o&&-1!=n.selected){let t=n.options[n.selected].completion;for(let e=0;ee.hasResult()?Math.min(t,e.from):t),1e8),create:(a=yd,t=>new hd(t,a)),above:s.aboveCursor},n?n.timestamp:Date.now(),o,!1);var a}map(t){return new ud(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class dd{constructor(t,e,i){this.active=t,this.id=e,this.open=i}static start(){return new dd(Od,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(t){let{state:e}=t,i=e.facet(td),n=(i.override||e.languageDataAt("autocomplete",Bu(e)).map(Fu)).map((e=>(this.active.find((t=>t.source==e))||new md(e,this.active.some((t=>0!=t.state))?1:0)).update(t,i)));n.length==this.active.length&&n.every(((t,e)=>t==this.active[e]))&&(n=this.active);let s=this.open;s&&t.docChanged&&(s=s.map(t.changes)),t.selection||n.some((e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to)))||!function(t,e){if(t==e)return!0;for(let i=0,n=0;;){for(;i1==t.state))&&(s=null),!s&&n.every((t=>1!=t.state))&&n.some((t=>t.hasResult()))&&(n=n.map((t=>t.hasResult()?new md(t.source,0):t)));for(let e of t.effects)e.is(vd)&&(s=s&&s.setSelected(e.value,this.id));return n==this.active&&s==this.open?this:new dd(n,this.id,s)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:fd}}const fd={"aria-autocomplete":"list"};function pd(t,e){let i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(i["aria-activedescendant"]=t+"-"+e),i}const Od=[];function gd(t){return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null}class md{constructor(t,e,i=-1){this.source=t,this.state=e,this.explicitPos=i}hasResult(){return!1}update(t,e){let i=gd(t),n=this;i?n=n.handleUserEvent(t,i,e):t.docChanged?n=n.handleChange(t):t.selection&&0!=n.state&&(n=new md(n.source,0));for(let e of t.effects)if(e.is(Hu))n=new md(n.source,1,e.value?Bu(t.state):-1);else if(e.is(Ju))n=new md(n.source,0);else if(e.is(wd))for(let t of e.value)t.source==n.source&&(n=t);return n}handleUserEvent(t,e,i){return"delete"!=e&&i.activateOnTyping?new md(this.source,1):this.map(t.changes)}handleChange(t){return t.changes.touchesRange(Bu(t.startState))?new md(this.source,0):this.map(t.changes)}map(t){return t.empty||this.explicitPos<0?this:new md(this.source,this.state,t.mapPos(this.explicitPos))}}class bd extends md{constructor(t,e,i,n,s){super(t,2,e),this.result=i,this.from=n,this.to=s}hasResult(){return!0}handleUserEvent(t,e,i){var n;let s=t.changes.mapPos(this.from),r=t.changes.mapPos(this.to,1),o=Bu(t.state);if((this.explicitPos<0?o<=s:or||"delete"==e&&Bu(t.startState)==this.from)return new md(this.source,"input"==e&&i.activateOnTyping?1:0);let a,l=this.explicitPos<0?-1:t.changes.mapPos(this.explicitPos);return function(t,e,i,n){if(!t)return!1;let s=e.sliceDoc(i,n);return"function"==typeof t?t(s,i,n,e):ju(t,!0).test(s)}(this.result.validFor,t.state,s,r)?new bd(this.source,l,this.result,s,r):this.result.update&&(a=this.result.update(this.result,s,r,new qu(t.state,o,l>=0)))?new bd(this.source,l,a,a.from,null!==(n=a.to)&&void 0!==n?n:Bu(t.state)):new md(this.source,1,l)}handleChange(t){return t.changes.touchesRange(this.from,this.to)?new md(this.source,0):this.map(t.changes)}map(t){return t.empty?this:new bd(this.source,this.explicitPos<0?-1:t.mapPos(this.explicitPos),this.result,t.mapPos(this.from),t.mapPos(this.to,1))}}const wd=ut.define({map:(t,e)=>t.map((t=>t.map(e)))}),vd=ut.define(),yd=q.define({create:()=>dd.start(),update:(t,e)=>t.update(e),provide:t=>[Tr.from(t,(t=>t.tooltip)),Ts.contentAttributes.from(t,(t=>t.attrs))]}),Sd=Ts.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class xd{constructor(t,e,i,n){this.field=t,this.line=e,this.from=i,this.to=n}}class kd{constructor(t,e,i){this.field=t,this.from=e,this.to=i}map(t){let e=t.mapPos(this.from,-1,S.TrackDel),i=t.mapPos(this.to,1,S.TrackDel);return null==e||null==i?null:new kd(this.field,e,i)}}class Qd{constructor(t,e){this.lines=t,this.fieldPositions=e}instantiate(t,e){let i=[],n=[e],s=t.doc.lineAt(e),r=/^\s*/.exec(s.text)[0];for(let s of this.lines){if(i.length){let i=r,o=/^\t*/.exec(s)[0].length;for(let e=0;enew kd(t.field,n[t.line]+t.from,n[t.line]+t.to)));return{text:i,ranges:o}}static parse(t){let e,i=[],n=[],s=[];for(let r of t.split(/\r\n?|\n/)){for(;e=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(r);){let t=e[1]?+e[1]:null,o=e[2]||e[3]||"",a=-1;for(let e=0;e=a&&t.field++}s.push(new xd(a,n.length,e.index,e.index+o.length)),r=r.slice(0,e.index)+o+r.slice(e.index+e[0].length)}for(let t;t=/\\([{}])/.exec(r);){r=r.slice(0,t.index)+t[1]+r.slice(t.index+t[0].length);for(let e of s)e.line==n.length&&e.from>t.index&&(e.from--,e.to--)}n.push(r)}return new Qd(n,s)}}let $d=ni.widget({widget:new class extends ei{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),Pd=ni.mark({class:"cm-snippetField"});class Cd{constructor(t,e){this.ranges=t,this.active=e,this.deco=ni.set(t.map((t=>(t.from==t.to?$d:Pd).range(t.from,t.to))))}map(t){let e=[];for(let i of this.ranges){let n=i.map(t);if(!n)return null;e.push(n)}return new Cd(e,this.active)}selectionInsideField(t){return t.ranges.every((t=>this.ranges.some((e=>e.field==this.active&&e.from<=t.from&&e.to>=t.to))))}}const _d=ut.define({map:(t,e)=>t&&t.map(e)}),Xd=ut.define(),Zd=q.define({create:()=>null,update(t,e){for(let i of e.effects){if(i.is(_d))return i.value;if(i.is(Xd)&&t)return new Cd(t.ranges,i.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>Ts.decorations.from(t,(t=>t?t.deco:ni.none))});function Ad(t,e){return A.create(t.filter((t=>t.field==e)).map((t=>A.range(t.from,t.to))))}function Td(e){let i=Qd.parse(e);return(e,n,s,r)=>{let{text:o,ranges:a}=i.instantiate(e.state,s),l={changes:{from:s,to:r,insert:t.of(o)},scrollIntoView:!0,annotations:n?Nu.of(n):void 0};if(a.length&&(l.selection=Ad(a,0)),a.length>1){let t=new Cd(a,0),i=l.effects=[_d.of(t)];void 0===e.state.field(Zd,!1)&&i.push(ut.appendConfig.of([Zd,Md,Wd,Sd]))}e.dispatch(e.state.update(l))}}function Rd(t){return({state:e,dispatch:i})=>{let n=e.field(Zd,!1);if(!n||t<0&&0==n.active)return!1;let s=n.active+t,r=t>0&&!n.ranges.some((e=>e.field==s+t));return i(e.update({selection:Ad(n.ranges,s),effects:_d.of(r?null:new Cd(n.ranges,s))})),!0}}const Ed=[{key:"Tab",run:Rd(1),shift:Rd(-1)},{key:"Escape",run:({state:t,dispatch:e})=>!!t.field(Zd,!1)&&(e(t.update({effects:_d.of(null)})),!0)}],Vd=E.define({combine:t=>t.length?t[0]:Ed}),Md=N.highest(Ys.compute([Vd],(t=>t.facet(Vd))));function Dd(t,e){return Object.assign(Object.assign({},e),{apply:Td(t)})}const Wd=Ts.domEventHandlers({mousedown(t,e){let i,n=e.state.field(Zd,!1);if(!n||null==(i=e.posAtCoords({x:t.clientX,y:t.clientY})))return!1;let s=n.ranges.find((t=>t.from<=i&&t.to>=i));return!(!s||s.field==n.active)&&(e.dispatch({selection:Ad(n.ranges,s.field),effects:_d.of(n.ranges.some((t=>t.field>s.field))?new Cd(n.ranges,s.field):null)}),!0)}}),Ud=new class extends Qt{};function Yd(t={}){return[yd,td.of(t),od,Ld,Sd]}Ud.startSide=1,Ud.endSide=-1;const qd=[{key:"Ctrl-Space",run:t=>!!t.state.field(yd,!1)&&(t.dispatch({effects:Hu.of(!0)}),!0)},{key:"Escape",run:t=>{let e=t.state.field(yd,!1);return!(!e||!e.active.some((t=>0!=t.state)))&&(t.dispatch({effects:Ju.of(null)}),!0)}},{key:"ArrowDown",run:nd(!0)},{key:"ArrowUp",run:nd(!1)},{key:"PageDown",run:nd(!0,"page")},{key:"PageUp",run:nd(!1,"page")},{key:"Enter",run:sd}],Ld=N.highest(Ys.computeN([td],(t=>t.facet(td).defaultKeymap?[qd]:[]))),zd=(()=>[vr(),Sh(),ir(),$l(_l,{fallback:!0}),Ys.of([...Vc,...Wh])])();class Id{constructor(t,e,i,n,s,r,o,a,l,h=0,c){this.p=t,this.stack=e,this.state=i,this.reducePos=n,this.pos=s,this.score=r,this.buffer=o,this.bufferBase=a,this.curContext=l,this.lookAhead=h,this.parent=c}toString(){return`[${this.stack.filter(((t,e)=>e%3==0)).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,i=0){let n=t.parser.context;return new Id(t,[],e,i,i,0,[],0,n?new Bd(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let i=t>>19,n=65535&t,{parser:s}=this.p,r=s.dynamicPrecedence(n);if(r&&(this.score+=r),0==i)return this.pushState(s.getGoto(this.state,n,!0),this.reducePos),n=2e3&&!(null===(e=this.p.parser.nodeSet.types[n])||void 0===e?void 0:e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=l):this.p.lastBigReductionSizeo;)this.stack.pop();this.reduceContext(n,a)}storeNode(t,e,i,n=4,s=!1){if(0==t&&(!this.stack.length||this.stack[this.stack.length-1]0&&0==t.buffer[n-4]&&t.buffer[n-1]>-1){if(e==i)return;if(t.buffer[n-2]>=e)return void(t.buffer[n-2]=i)}}if(s&&this.pos!=i){let s=this.buffer.length;if(s>0&&0!=this.buffer[s-4])for(;s>0&&this.buffer[s-2]>i;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,n>4&&(n-=4);this.buffer[s]=t,this.buffer[s+1]=e,this.buffer[s+2]=i,this.buffer[s+3]=n}else this.buffer.push(t,e,i,n)}shift(t,e,i){let n=this.pos;if(131072&t)this.pushState(65535&t,this.pos);else if(0==(262144&t)){let s=t,{parser:r}=this.p;(i>this.pos||e<=r.maxNode)&&(this.pos=i,r.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,n),this.shiftContext(e,n),e<=r.maxNode&&this.buffer.push(e,n,i,4)}else this.pos=i,this.shiftContext(e,n),e<=this.p.parser.maxNode&&this.buffer.push(e,n,i,4)}apply(t,e,i){65536&t?this.reduce(t):this.shift(t,e,i)}useNode(t,e){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=t)&&(this.p.reused.push(t),i++);let n=this.pos;this.reducePos=this.pos=n+t.length,this.pushState(e,n),this.buffer.push(i,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let i=t.buffer.slice(e),n=t.bufferBase+e;for(;t&&n==t.bufferBase;)t=t.parent;return new Id(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,n,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let i=t<=this.p.parser.maxNode;i&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,i?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new Nd(this);;){let i=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(0==i)return!1;if(0==(65536&i))return!0;e.reduce(i)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let n,s=0;s1&e&&t==n))||i.push(e[t],n)}e=i}let i=[];for(let t=0;t>19,n=65535&t,s=this.stack.length-3*i;if(s<0||e.getGoto(this.stack[s],n,!1)<0)return!1;this.storeNode(0,this.reducePos,this.reducePos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:t}=this.p;return 65535==t.data[t.stateSlot(this.state,1)]&&!t.stateSlot(this.state,4)}restart(){this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;ethis.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Bd{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}var jd;!function(t){t[t.Insert=200]="Insert",t[t.Delete=190]="Delete",t[t.Reduce=100]="Reduce",t[t.MaxNext=4]="MaxNext",t[t.MaxInsertStackDepth=300]="MaxInsertStackDepth",t[t.DampenInsertStackDepth=120]="DampenInsertStackDepth",t[t.MinBigReduction=2e3]="MinBigReduction"}(jd||(jd={}));class Nd{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=65535&t,i=t>>19;0==i?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(i-1);let n=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=n}}class Gd{constructor(t,e,i){this.stack=t,this.pos=e,this.index=i,this.buffer=t.buffer,0==this.index&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new Gd(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;null!=t&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new Gd(this.stack,this.pos,this.index)}}function Fd(t,e=Uint16Array){if("string"!=typeof t)return t;let i=null;for(let n=0,s=0;n=92&&e--,e>=34&&e--;let s=e-32;if(s>=46&&(s-=46,i=!0),r+=s,i)break;r*=46}i?i[s++]=r:i=new e(r)}return i}class Hd{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Jd=new Hd;class Kd{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Jd,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let i=this.range,n=this.rangeIndex,s=this.pos+t;for(;si.to:s>=i.to;){if(n==this.ranges.length-1)return null;let t=this.ranges[++n];s+=t.from-i.to,i=t}return s}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,e.from);return this.end}peek(t){let e,i,n=this.chunkOff+t;if(n>=0&&n=this.chunk2Pos&&en.to&&(this.chunk2=this.chunk2.slice(0,n.to-e)),i=this.chunk2.charCodeAt(0)}}return e>=this.token.lookAhead&&(this.token.lookAhead=e+1),i}acceptToken(t,e=0){let i=e?this.resolveOffset(e,-1):this.pos;if(null==i||i=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=Jd,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let i="";for(let n of this.ranges){if(n.from>=e)break;n.to>t&&(i+=this.input.read(Math.max(n.from,t),Math.min(n.to,e)))}return i}}class tf{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:i}=e.p;sf(this.data,t,e,this.id,i.data,i.tokenPrecTable)}}tf.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class ef{constructor(t,e,i){this.precTable=e,this.elseToken=i,this.data="string"==typeof t?Fd(t):t}token(t,e){let i=t.pos,n=0;for(;sf(this.data,t,e,0,this.data,this.precTable),!(t.token.value>-1);){if(null==this.elseToken)return;if(t.next<0)break;t.advance(),t.reset(t.pos,t.token),n++}n&&(t.reset(i,t.token),t.acceptToken(this.elseToken,n))}}ef.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class nf{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function sf(t,e,i,n,s,r){let o=0,a=1<0){let i=t[n];if(l.allows(i)&&(-1==e.token.value||e.token.value==i||of(i,e.token.value,s,r))){e.acceptToken(i);break}}let n=e.next,h=0,c=t[o+2];if(!(e.next<0&&c>h&&65535==t[i+3*c-3]&&65535==t[i+3*c-3])){for(;h>1,r=i+s+(s<<1),a=t[r],l=t[r+1]||65536;if(n=l)){o=t[r+2],e.advance();continue t}h=s+1}}break}o=t[i+3*c-1]}}function rf(t,e,i){for(let n,s=e;65535!=(n=t[s]);s++)if(n==i)return s-e;return-1}function of(t,e,i,n){let s=rf(i,n,e);return s<0||rf(i,n,t)e)&&!n.type.isError)return i<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(t.length,Math.max(n.from+1,e+25));if(i<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return i<0?0:t.length}}!function(t){t[t.Margin=25]="Margin"}(hf||(hf={}));let uf=class{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?cf(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?cf(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=r,null;if(s instanceof bo){if(r==t){if(r=Math.max(this.safeFrom,t)&&(this.trees.push(s),this.start.push(r),this.index.push(0))}else this.index[e]++,this.nextStart=r+s.length}}};class df{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map((t=>new Hd))}getActions(t){let e=0,i=null,{parser:n}=t.p,{tokenizers:s}=n,r=n.stateSlot(t.state,3),o=t.curContext?t.curContext.hash:0,a=0;for(let n=0;nh.end+25&&(a=Math.max(h.lookAhead,a)),0!=h.value)){let n=e;if(h.extended>-1&&(e=this.addActions(t,h.extended,h.end,e)),e=this.addActions(t,h.value,h.end,e),!l.extend&&(i=h,e>n))break}}for(;this.actions.length>e;)this.actions.pop();return a&&t.setLookAhead(a),i||t.pos!=this.stream.end||(i=new Hd,i.value=t.p.parser.eofTerm,i.start=i.end=t.pos,e=this.addActions(t,i.value,i.end,e)),this.mainToken=i,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new Hd,{pos:i,p:n}=t;return e.start=i,e.end=Math.min(i+1,n.stream.end),e.value=i==n.stream.end?n.parser.eofTerm:0,e}updateCachedToken(t,e,i){let n=this.stream.clipPos(i.pos);if(e.token(this.stream.reset(n,t),i),t.value>-1){let{parser:e}=i.p;for(let n=0;n=0&&i.p.parser.dialect.allows(s>>1)){0==(1&s)?t.value=s>>1:t.extended=s>>1;break}}}else t.value=0,t.end=this.stream.clipPos(n+1)}putAction(t,e,i,n){for(let e=0;e4*t.bufferLength?new uf(i,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t,e,i=this.stacks,n=this.minStackPos,s=this.stacks=[];if(this.bigReductionCount>300&&1==i.length){let[t]=i;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;rn)s.push(o);else{if(this.advanceStack(o,s,i))continue;{t||(t=[],e=[]),t.push(o);let i=this.tokens.getMainToken(o);e.push(i.value,i.end)}}break}}if(!s.length){let e=t&&function(t){let e=null;for(let i of t){let t=i.p.stoppedAt;(i.pos==i.p.stream.end||null!=t&&i.pos>t)&&i.p.parser.stateFlag(i.state,2)&&(!e||e.scorethis.stoppedAt?t[0]:this.runRecovery(t,e,s);if(i)return this.stackToTree(i.forceAll())}if(this.recovering){let t=1==this.recovering?1:3*this.recovering;if(s.length>t)for(s.sort(((t,e)=>e.score-t.score));s.length>t;)s.pop();s.some((t=>t.reducePos>n))&&this.recovering--}else if(s.length>1){t:for(let t=0;t500&&n.buffer.length>500){if(!((e.score-n.score||e.buffer.length-n.buffer.length)>0)){s.splice(t--,1);continue t}s.splice(i--,1)}}}s.length>12&&s.splice(12,s.length-12)}this.minStackPos=s[0].pos;for(let t=1;t ":"";if(null!=this.stoppedAt&&n>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let e=t.curContext&&t.curContext.tracker.strict,i=e?t.curContext.hash:0;for(let o=this.fragments.nodeAt(n);o;){let n=this.parser.nodeSet.types[o.type.id]==o.type?s.getGoto(t.state,o.type.id):-1;if(n>-1&&o.length&&(!e||(o.prop(ho.contextHash)||0)==i))return t.useNode(o,n),af&&console.log(r+this.stackID(t)+` (via reuse of ${s.getName(o.type.id)})`),!0;if(!(o instanceof bo)||0==o.children.length||o.positions[0]>0)break;let a=o.children[0];if(!(a instanceof bo&&0==o.positions[0]))break;o=a}}let o=s.stateSlot(t.state,4);if(o>0)return t.reduce(o),af&&console.log(r+this.stackID(t)+` (via always-reduce ${s.getName(65535&o)})`),!0;if(t.stack.length>=15e3)for(;t.stack.length>9e3&&t.forceReduce(););let a=this.tokens.getActions(t);for(let o=0;on?e.push(d):i.push(d)}return!1}advanceFully(t,e){let i=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>i)return Of(t,e),!0}}runRecovery(t,e,i){let n=null,s=!1;for(let r=0;r ":"";if(o.deadEnd){if(s)continue;if(s=!0,o.restart(),af&&console.log(h+this.stackID(o)+" (restarted)"),this.advanceFully(o,i))continue}let c=o.split(),u=h;for(let t=0;c.forceReduce()&&t<10;t++){if(af&&console.log(u+this.stackID(c)+" (via force-reduce)"),this.advanceFully(c,i))break;af&&(u=this.stackID(c)+" -> ")}for(let t of o.recoverByInsert(a))af&&console.log(h+this.stackID(t)+" (via recover-insert)"),this.advanceFully(t,i);this.stream.end>o.pos?(l==o.pos&&(l++,a=0),o.recoverByDelete(a,l),af&&console.log(h+this.stackID(o)+` (via recover-delete ${this.parser.getName(a)})`),Of(o,i)):(!n||n.scoret;class bf{constructor(t){this.start=t.start,this.shift=t.shift||mf,this.reduce=t.reduce||mf,this.reuse=t.reuse||mf,this.hash=t.hash||(()=>0),this.strict=!1!==t.strict}}class wf extends Vo{constructor(t){if(super(),this.wrappers=[],14!=t.version)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let i=0;it.topRules[e][1])),n=[];for(let t=0;t=0)s(n,t,e[i++]);else{let r=e[i+-n];for(let o=-n;o>0;o--)s(e[i++],t,r);i++}}}this.nodeSet=new po(e.map(((e,s)=>fo.define({name:s>=this.minRepeatTerm?void 0:e,id:s,props:n[s],top:i.indexOf(s)>-1,error:0==s,skipped:t.skippedNodes&&t.skippedNodes.indexOf(s)>-1})))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=oo;let r=Fd(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let t=0;t"number"==typeof t?new tf(r,t):t)),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,i){let n=new pf(this,t,e,i);for(let s of this.wrappers)n=s(n,t,e,i);return n}getGoto(t,e,i=!1){let n=this.goto;if(e>=n[0])return-1;for(let s=n[e+1];;){let e=n[s++],r=1&e,o=n[s++];if(r&&i)return o;for(let i=s+(e>>1);s0}validAction(t,e){if(e==this.stateSlot(t,4))return!0;for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])return!1;i=vf(this.data,i+2)}if(e==vf(this.data,i+1))return!0}}nextStates(t){let e=[];for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])break;i=vf(this.data,i+2)}if(0==(1&this.data[i+2])){let t=this.data[i+1];e.some(((e,i)=>1&i&&e==t))||e.push(this.data[i],t)}}return e}configure(t){let e=Object.assign(Object.create(wf.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let i=this.topRules[t.top];if(!i)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=i}return t.tokenizers&&(e.tokenizers=this.tokenizers.map((e=>{let i=t.tokenizers.find((t=>t.from==e));return i?i.to:e}))),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map(((i,n)=>{let s=t.specializers.find((t=>t.from==i.external));if(!s)return i;let r=Object.assign(Object.assign({},i),{external:s.to});return e.specializers[n]=yf(r),r}))),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),null!=t.strict&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),null!=t.bufferLength&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return null==e?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),i=e.map((()=>!1));if(t)for(let n of t.split(" ")){let t=e.indexOf(n);t>=0&&(i[t]=!0)}let n=null;for(let t=0;tt.external(i,n)<<1|e}return t.get}const Sf=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],xf=new bf({start:!1,shift:(t,e)=>3==e||4==e||305==e?t:306==e,strict:!1}),kf=new nf(((t,e)=>{let{next:i}=t;(125==i||-1==i||e.context)&&e.canShift(303)&&t.acceptToken(303)}),{contextual:!0,fallback:!0}),Qf=new nf(((t,e)=>{let i,{next:n}=t;Sf.indexOf(n)>-1||(47!=n||47!=(i=t.peek(1))&&42!=i)&&125!=n&&59!=n&&-1!=n&&!e.context&&e.canShift(302)&&t.acceptToken(302)}),{contextual:!0}),$f=new nf(((t,e)=>{let{next:i}=t;if((43==i||45==i)&&(t.advance(),i==t.next)){t.advance();let i=!e.context&&e.canShift(1);t.acceptToken(i?1:2)}}),{contextual:!0}),Pf=ea({"get set async static":Sa.modifier,"for while do if else switch try catch finally return throw break continue default case":Sa.controlKeyword,"in of await yield void typeof delete instanceof":Sa.operatorKeyword,"let var const function class extends":Sa.definitionKeyword,"import export from":Sa.moduleKeyword,"with debugger as new":Sa.keyword,TemplateString:Sa.special(Sa.string),super:Sa.atom,BooleanLiteral:Sa.bool,this:Sa.self,null:Sa.null,Star:Sa.modifier,VariableName:Sa.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":Sa.function(Sa.variableName),VariableDefinition:Sa.definition(Sa.variableName),Label:Sa.labelName,PropertyName:Sa.propertyName,PrivatePropertyName:Sa.special(Sa.propertyName),"CallExpression/MemberExpression/PropertyName":Sa.function(Sa.propertyName),"FunctionDeclaration/VariableDefinition":Sa.function(Sa.definition(Sa.variableName)),"ClassDeclaration/VariableDefinition":Sa.definition(Sa.className),PropertyDefinition:Sa.definition(Sa.propertyName),PrivatePropertyDefinition:Sa.definition(Sa.special(Sa.propertyName)),UpdateOp:Sa.updateOperator,LineComment:Sa.lineComment,BlockComment:Sa.blockComment,Number:Sa.number,String:Sa.string,Escape:Sa.escape,ArithOp:Sa.arithmeticOperator,LogicOp:Sa.logicOperator,BitOp:Sa.bitwiseOperator,CompareOp:Sa.compareOperator,RegExp:Sa.regexp,Equals:Sa.definitionOperator,Arrow:Sa.function(Sa.punctuation),": Spread":Sa.punctuation,"( )":Sa.paren,"[ ]":Sa.squareBracket,"{ }":Sa.brace,"InterpolationStart InterpolationEnd":Sa.special(Sa.brace),".":Sa.derefOperator,", ;":Sa.separator,"@":Sa.meta,TypeName:Sa.typeName,TypeDefinition:Sa.definition(Sa.typeName),"type enum interface implements namespace module declare":Sa.definitionKeyword,"abstract global Privacy readonly override":Sa.modifier,"is keyof unique infer":Sa.operatorKeyword,JSXAttributeValue:Sa.attributeValue,JSXText:Sa.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":Sa.angleBracket,"JSXIdentifier JSXNameSpacedName":Sa.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":Sa.attributeName,"JSXBuiltin/JSXIdentifier":Sa.standard(Sa.tagName)}),Cf={__proto__:null,export:14,as:19,from:27,default:30,async:35,function:36,extends:46,this:50,true:58,false:58,null:70,void:74,typeof:78,super:96,new:130,delete:146,yield:155,await:159,class:164,public:221,private:221,protected:221,readonly:223,instanceof:242,satisfies:245,in:246,const:248,import:280,keyof:335,unique:339,infer:345,is:381,abstract:401,implements:403,type:405,let:408,var:410,interface:417,enum:421,namespace:427,module:429,declare:433,global:437,for:456,of:465,while:468,with:472,do:476,if:480,else:482,switch:486,case:492,try:498,catch:502,finally:506,return:510,throw:514,break:518,continue:522,debugger:526},_f={__proto__:null,async:117,get:119,set:121,declare:181,public:183,private:183,protected:183,static:185,abstract:187,override:189,readonly:195,accessor:197,new:385},Xf={__proto__:null,"<":137},Zf=wf.deserialize({version:14,states:"$6[O`QUOOO%QQUOOO'TQWOOP(bOSOOO*pQ(CjO'#CfO*wOpO'#CgO+VO!bO'#CgO+eO07`O'#DZO-vQUO'#DaO.WQUO'#DlO%QQUO'#DvO0[QUO'#EOOOQ(CY'#EW'#EWO0uQSO'#ETOOQO'#Ei'#EiOOQO'#Ib'#IbO0}QSO'#GkO1YQSO'#EhO1_QSO'#EhO3aQ(CjO'#JcO6QQ(CjO'#JdO6nQSO'#FWO6sQ#tO'#FoOOQ(CY'#F`'#F`O7OO&jO'#F`O7^Q,UO'#FvO8tQSO'#FuOOQ(CY'#Jd'#JdOOQ(CW'#Jc'#JcOOQQ'#KO'#KOO8yQSO'#IOO9OQ(C[O'#IPOOQQ'#JP'#JPOOQQ'#IT'#ITQ`QUOOO%QQUO'#DnO9WQUO'#DzO%QQUO'#D|O9_QSO'#GkO9dQ,UO'#ClO9rQSO'#EgO9}QSO'#ErO:SQ,UO'#F_O:qQSO'#GkO:vQSO'#GoO;RQSO'#GoO;aQSO'#GrO;aQSO'#GsO;aQSO'#GuO9_QSO'#GxOQQSO'#HnO>VQ(C]O'#HtO%QQUO'#HvO>bQ(C]O'#HxO>mQ(C]O'#HzO9OQ(C[O'#H|O>xQ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PQ3S.dQ3V:UQ3W:_Q3]:QQ4O/zQ4V0XQ5i:`Q5o2WQ5t2^Q6Q2rQ6R:aQ6W:cQ6X:jQ7P4kQ7n5gQ7r5pQ7{:kQ8P:pQ8Q:qQ8v7tQ9U8cQ9]8tQ9n#OR;Q;^R#WWR&{!cY!qQ'Q,}0u4pS&w!c,uQ']!oS'g!r!uS'i!v4rS,r&x'PS-^'^'_Q-`'`Q1{,{R2Z-_R(k#tR(n#uQ!dQT,|'Q,}]!nQ!o'Q,}0u4pQ#l]R'Z9mT#gZ%ZS#fZ%ZU%y|},ZU(W#d#e#hS-r(X(YQ-v(ZQ0h+hQ2`-sU2a-t-u-wS5v2b2cR7u5w`#YW#S#V%v't'}+e-mt#cZ|}#d#e#h%Z(X(Y(Z+h-s-t-u-w2b2c5wQ1_,ZQ1r,oQ5e1jQ7m5fT:x&y+fT#]W%vS#[W%vS'u#S'}S'z#V+eS,t&y+fT-h't-mT'O!c%wQ$hfR)j$mT)_$h)`R3Z.kT*O$u*QR*W$xQ/}*zQ2e.OQ4s0wQ5{2iQ7X4vQ7x5zQ8e7WQ8w7wQ9W8gQ9`8yQ9e9XR9h9alpOXr!X#`%]&d&f&g&i,],b1b1eQ&^!TR,Q&ZV%z|},ZR0q+qR,P&XQ%szR+c%tR+X%nT&b!U&eT&c!U&eT1d,b1e",nodeNames:"⚠ ArithOp ArithOp LineComment BlockComment Script ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXStartTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:364,context:xf,nodeProps:[["group",-26,6,14,16,62,199,203,206,207,209,212,215,225,227,233,235,237,239,242,248,254,256,258,260,262,264,265,"Statement",-32,10,11,25,28,29,35,45,48,49,51,56,64,72,76,78,80,81,103,104,113,114,131,134,136,137,138,139,141,142,162,163,165,"Expression",-23,24,26,30,34,36,38,166,168,170,171,173,174,175,177,178,179,181,182,183,193,195,197,198,"Type",-3,84,96,102,"ClassItem"],["openedBy",31,"InterpolationStart",50,"[",54,"{",69,"(",143,"JSXStartTag",155,"JSXStartTag JSXStartCloseTag"],["closedBy",33,"InterpolationEnd",44,"]",55,"}",70,")",144,"JSXSelfCloseEndTag JSXEndTag",160,"JSXEndTag"]],propSources:[Pf],skippedNodes:[0,3,4,268],repeatNodeCount:33,tokenData:"$>y(CSR!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tu>PuvBavwDxwxGgxyMvyz! Qz{!![{|!%O|}!&]}!O!%O!O!P!'g!P!Q!1w!Q!R#0t!R![#3T![!]#@T!]!^#Aa!^!_#Bk!_!`#GS!`!a#In!a!b#N{!b!c$$z!c!}>P!}#O$&U#O#P$'`#P#Q$,w#Q#R$.R#R#S>P#S#T$/`#T#o$0j#o#p$4z#p#q$5p#q#r$7Q#r#s$8^#s$f%Z$f$g+g$g#BY>P#BY#BZ$9h#BZ$IS>P$IS$I_$9h$I_$I|>P$I|$I}$P$JT$JU$9h$JU$KV>P$KV$KW$9h$KW&FU>P&FU&FV$9h&FV;'S>P;'S;=`BZ<%l?HT>P?HT?HU$9h?HUO>P(n%d_$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$d&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$d&j'z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU'z!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!b(iP;=`<%l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S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOq~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!O~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(T~~",141,326),new ef("j~RQYZXz{^~^O'q~~aP!P!Qd~iO'r~~",25,308)],topRules:{Script:[0,5],SingleExpression:[1,266],SingleClassItem:[2,267]},dialects:{jsx:12686,ts:12688},dynamicPrecedences:{76:1,78:1,163:1,191:1},specialized:[{term:312,get:t=>Cf[t]||-1},{term:328,get:t=>_f[t]||-1},{term:67,get:t=>Xf[t]||-1}],tokenPrec:12712}),Af=[Dd("function ${name}(${params}) {\n\t${}\n}",{label:"function",detail:"definition",type:"keyword"}),Dd("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n\t${}\n}",{label:"for",detail:"loop",type:"keyword"}),Dd("for (let ${name} of ${collection}) {\n\t${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Dd("do {\n\t${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),Dd("while (${}) {\n\t${}\n}",{label:"while",detail:"loop",type:"keyword"}),Dd("try {\n\t${}\n} catch (${error}) {\n\t${}\n}",{label:"try",detail:"/ catch block",type:"keyword"}),Dd("if (${}) {\n\t${}\n}",{label:"if",detail:"block",type:"keyword"}),Dd("if (${}) {\n\t${}\n} else {\n\t${}\n}",{label:"if",detail:"/ else block",type:"keyword"}),Dd("class ${name} {\n\tconstructor(${params}) {\n\t\t${}\n\t}\n}",{label:"class",detail:"definition",type:"keyword"}),Dd('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Dd('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Tf=new Ro,Rf=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Ef(t){return(e,i)=>{let n=e.node.getChild("VariableDefinition");return n&&i(n,t),!0}}const Vf=["FunctionDeclaration"],Mf={FunctionDeclaration:Ef("function"),ClassDeclaration:Ef("class"),ClassExpression:()=>!0,EnumDeclaration:Ef("constant"),TypeAliasDeclaration:Ef("type"),NamespaceDeclaration:Ef("namespace"),VariableDefinition(t,e){t.matchContext(Vf)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function Df(t,e){let i=Tf.get(e);if(i)return i;let n=[],s=!0;function r(e,i){let s=t.sliceString(e.from,e.to);n.push({label:s,type:i})}return e.cursor(mo.IncludeAnonymous).iterate((e=>{if(s)s=!1;else if(e.name){let t=Mf[e.name];if(t&&t(e,r)||Rf.has(e.name))return!1}else if(e.to-e.from>8192){for(let i of Df(t,e.node))n.push(i);return!1}})),Tf.set(e,n),n}const Wf=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Uf=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName"];function Yf(t){let e=Xa(t.state).resolveInner(t.pos,-1);if(Uf.indexOf(e.name)>-1)return null;let i="VariableName"==e.name||e.to-e.from<20&&Wf.test(t.state.sliceDoc(e.from,e.to));if(!i&&!t.explicit)return null;let n=[];for(let i=e;i;i=i.parent)Rf.has(i.name)&&(n=n.concat(Df(t.state.doc,i)));return{options:n,from:i?e.from:t.pos,validFor:Wf}}const qf=_a.define({name:"javascript",parser:Zf.configure({props:[Na.add({IfStatement:il({except:/^\s*({|else\b)/}),TryStatement:il({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:t=>t.baseIndent,SwitchBody:t=>{let e=t.textAfter,i=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return t.baseIndent+(i?0:n?1:2)*t.unit},Block:tl({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":il({except:/^{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag":t=>t.column(t.node.from)+t.unit}),rl.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression":ol,BlockComment:t=>({from:t.from+2,to:t.to-2})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Lf={test:t=>/^JSX/.test(t.name),facet:Qa({commentTokens:{block:{open:"{/*",close:"*/}"}}})},zf=qf.configure({dialect:"ts"},"typescript"),If=qf.configure({dialect:"jsx",props:[$a.add((t=>t.isTop?[Lf]:void 0))]}),Bf=qf.configure({dialect:"jsx ts",props:[$a.add((t=>t.isTop?[Lf]:void 0))]},"typescript"),jf="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map((t=>({label:t,type:"keyword"})));function Nf(t={}){let e=t.jsx?t.typescript?Bf:If:t.typescript?zf:qf;return new Ua(e,[qf.data.of({autocomplete:(i=Uf,n=zu(Af.concat(jf)),t=>{for(let e=Xa(t.state).resolveInner(t.pos,-1);e;e=e.parent){if(i.indexOf(e.name)>-1)return null;if(e.type.isTop)break}return n(t)})}),qf.data.of({autocomplete:Yf}),t.jsx?Hf:[]]);var i,n}function Gf(t,e,i=t.length){for(let n=null==e?void 0:e.firstChild;n;n=n.nextSibling)if("JSXIdentifier"==n.name||"JSXBuiltin"==n.name||"JSXNamespacedName"==n.name||"JSXMemberExpression"==n.name)return t.sliceString(n.from,Math.min(n.to,i));return""}const Ff="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),Hf=Ts.inputHandler.of(((t,e,i,n)=>{if((Ff?t.composing:t.compositionStarted)||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!qf.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((t=>{var e,i;let r,{head:o}=t,a=Xa(s).resolveInner(o,-1);if("JSXStartTag"==a.name&&(a=a.parent),">"==n&&"JSXFragmentTag"==a.name)return{range:A.cursor(o+1),changes:{from:o,insert:">"}};if("/"==n&&"JSXFragmentTag"==a.name){let t=a.parent,i=null==t?void 0:t.parent;if(t.from==o-1&&"JSXEndTag"!=(null===(e=i.lastChild)||void 0===e?void 0:e.name)&&(r=Gf(s.doc,null==i?void 0:i.firstChild,o))){let t=`/${r}>`;return{range:A.cursor(o+t.length),changes:{from:o,insert:t}}}}else if(">"==n){let t=function(t){for(;;){if("JSXOpenTag"==t.name||"JSXSelfClosingTag"==t.name||"JSXFragmentTag"==t.name)return t;if(!t.parent)return null;t=t.parent}}(a);if(t&&"JSXEndTag"!=(null===(i=t.lastChild)||void 0===i?void 0:i.name)&&"`}}}return{range:t}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)}));class Jf{constructor(t,e,i,n,s,r,o){this.type=t,this.value=e,this.from=i,this.hash=n,this.end=s,this.children=r,this.positions=o,this.hashProp=[[ho.contextHash,n]]}static create(t,e,i,n,s){return new Jf(t,e,i,n+(n<<8)+t+(e<<4)|0,s,[],[])}addChild(t,e){t.prop(ho.contextHash)!=this.hash&&(t=new bo(t.type,t.children,t.positions,t.length,this.hashProp)),this.children.push(t),this.positions.push(e)}toTree(t,e=this.end){let i=this.children.length-1;return i>=0&&(e=Math.max(e,this.positions[i]+this.children[i].length+this.from)),new bo(t.types[this.type],this.children,this.positions,e-this.from).balance({makeTree:(t,e,i)=>new bo(fo.none,t,e,i,this.hashProp)})}}var Kf;!function(t){t[t.Document=1]="Document",t[t.CodeBlock=2]="CodeBlock",t[t.FencedCode=3]="FencedCode",t[t.Blockquote=4]="Blockquote",t[t.HorizontalRule=5]="HorizontalRule",t[t.BulletList=6]="BulletList",t[t.OrderedList=7]="OrderedList",t[t.ListItem=8]="ListItem",t[t.ATXHeading1=9]="ATXHeading1",t[t.ATXHeading2=10]="ATXHeading2",t[t.ATXHeading3=11]="ATXHeading3",t[t.ATXHeading4=12]="ATXHeading4",t[t.ATXHeading5=13]="ATXHeading5",t[t.ATXHeading6=14]="ATXHeading6",t[t.SetextHeading1=15]="SetextHeading1",t[t.SetextHeading2=16]="SetextHeading2",t[t.HTMLBlock=17]="HTMLBlock",t[t.LinkReference=18]="LinkReference",t[t.Paragraph=19]="Paragraph",t[t.CommentBlock=20]="CommentBlock",t[t.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",t[t.Escape=22]="Escape",t[t.Entity=23]="Entity",t[t.HardBreak=24]="HardBreak",t[t.Emphasis=25]="Emphasis",t[t.StrongEmphasis=26]="StrongEmphasis",t[t.Link=27]="Link",t[t.Image=28]="Image",t[t.InlineCode=29]="InlineCode",t[t.HTMLTag=30]="HTMLTag",t[t.Comment=31]="Comment",t[t.ProcessingInstruction=32]="ProcessingInstruction",t[t.URL=33]="URL",t[t.HeaderMark=34]="HeaderMark",t[t.QuoteMark=35]="QuoteMark",t[t.ListMark=36]="ListMark",t[t.LinkMark=37]="LinkMark",t[t.EmphasisMark=38]="EmphasisMark",t[t.CodeMark=39]="CodeMark",t[t.CodeText=40]="CodeText",t[t.CodeInfo=41]="CodeInfo",t[t.LinkTitle=42]="LinkTitle",t[t.LinkLabel=43]="LinkLabel"}(Kf||(Kf={}));class tp{constructor(t,e){this.start=t,this.content=e,this.marks=[],this.parsers=[]}}class ep{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let t=this.skipSpace(this.basePos);this.indent=this.countIndent(t,this.pos,this.indent),this.pos=t,this.next=t==this.text.length?-1:this.text.charCodeAt(t)}skipSpace(t){return rp(this.text,t)}reset(t){for(this.text=t,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(t){this.basePos=t,this.baseIndent=this.countIndent(t,this.pos,this.indent)}moveBaseColumn(t){this.baseIndent=t,this.basePos=this.findColumn(t)}addMarker(t){this.markers.push(t)}countIndent(t,e=0,i=0){for(let n=e;n=e.stack[i.depth+1].value+i.baseIndent)return!0;if(i.indent>=i.baseIndent+4)return!1;let n=(t.type==Kf.OrderedList?dp:up)(i,e,!1);return n>0&&(t.type!=Kf.BulletList||hp(i,e,!1)<0)&&i.text.charCodeAt(i.pos+n-1)==t.value}const np={[Kf.Blockquote]:(t,e,i)=>62==i.next&&(i.markers.push(Up(Kf.QuoteMark,e.lineStart+i.pos,e.lineStart+i.pos+1)),i.moveBase(i.pos+(sp(i.text.charCodeAt(i.pos+1))?2:1)),t.end=e.lineStart+i.text.length,!0),[Kf.ListItem]:(t,e,i)=>!(i.indent-1)&&(i.moveBaseColumn(i.baseIndent+t.value),!0),[Kf.OrderedList]:ip,[Kf.BulletList]:ip,[Kf.Document]:()=>!0};function sp(t){return 32==t||9==t||10==t||13==t}function rp(t,e=0){for(;ei&&sp(t.charCodeAt(e-1));)e--;return e}function ap(t){if(96!=t.next&&126!=t.next)return-1;let e=t.pos+1;for(;e-1&&t.depth==e.stack.length||n<3?-1:1}function cp(t,e){for(let i=t.stack.length-1;i>=0;i--)if(t.stack[i].type==e)return!0;return!1}function up(t,e,i){return 45!=t.next&&43!=t.next&&42!=t.next||t.pos!=t.text.length-1&&!sp(t.text.charCodeAt(t.pos+1))||!(!i||cp(e,Kf.BulletList)||t.skipSpace(t.pos+2)=48&&s<=57;){if(n++,n==t.text.length)return-1;s=t.text.charCodeAt(n)}return n==t.pos||n>t.pos+9||46!=s&&41!=s||nt.pos+1||49!=t.next)?-1:n+1-t.pos}function fp(t){if(35!=t.next)return-1;let e=t.pos+1;for(;e6?-1:i}function pp(t){if(45!=t.next&&61!=t.next||t.indent>=t.baseIndent+4)return-1;let e=t.pos+1;for(;e/,mp=/\?>/,bp=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*/i.exec(n);if(r)return t.append(Up(Kf.Comment,i,i+1+r[0].length));let o=/^\?[^]*?\?>/.exec(n);if(o)return t.append(Up(Kf.ProcessingInstruction,i,i+1+o[0].length));let a=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(n);return a?t.append(Up(Kf.HTMLTag,i,i+1+a[0].length)):-1},Emphasis(t,e,i){if(95!=e&&42!=e)return-1;let n=i+1;for(;t.char(n)==e;)n++;let s=t.slice(i-1,i),r=t.slice(n,n+1),o=jp.test(s),a=jp.test(r),l=/\s|^$/.test(s),h=/\s|^$/.test(r),c=!h&&(!a||l||o),u=!l&&(!o||h||a),d=c&&(42==e||!u||o),f=u&&(42==e||!c||a);return t.append(new Ip(95==e?Yp:qp,i,n,(d?1:0)|(f?2:0)))},HardBreak(t,e,i){if(92==e&&10==t.char(i+1))return t.append(Up(Kf.HardBreak,i,i+2));if(32==e){let e=i+1;for(;32==t.char(e);)e++;if(10==t.char(e)&&e>=i+2)return t.append(Up(Kf.HardBreak,i,e+1))}return-1},Link:(t,e,i)=>91==e?t.append(new Ip(Lp,i,i+1,1)):-1,Image:(t,e,i)=>33==e&&91==t.char(i+1)?t.append(new Ip(zp,i,i+2,1)):-1,LinkEnd(t,e,i){if(93!=e)return-1;for(let e=t.parts.length-1;e>=0;e--){let n=t.parts[e];if(n instanceof Ip&&(n.type==Lp||n.type==zp)){if(!n.side||t.skipSpace(n.to)==i&&!/[(\[]/.test(t.slice(i+1,i+2)))return t.parts[e]=null,-1;let s=t.takeContent(e),r=t.parts[e]=Gp(t,s,n.type==Lp?Kf.Link:Kf.Image,n.from,i+1);if(n.type==Lp)for(let i=0;ie?Up(Kf.URL,e+i,s+i):s==t.length&&null}}function Hp(t,e,i){let n=t.charCodeAt(e);if(39!=n&&34!=n&&40!=n)return!1;let s=40==n?41:n;for(let n=e+1,r=!1;n=this.end?-1:this.text.charCodeAt(t-this.offset)}get end(){return this.offset+this.text.length}slice(t,e){return this.text.slice(t-this.offset,e-this.offset)}append(t){return this.parts.push(t),t.to}addDelimiter(t,e,i,n,s){return this.append(new Ip(t,e,i,(n?1:0)|(s?2:0)))}addElement(t){return this.append(t)}resolveMarkers(t){for(let e=t;e=t;o--){let t=this.parts[o];if(t instanceof Ip&&1&t.side&&t.type==i.type&&!(s&&(1&i.side||2&t.side)&&(t.to-t.from+r)%3==0&&((t.to-t.from)%3||r%3))){n=t;break}}if(!n)continue;let a=i.type.resolve,l=[],h=n.from,c=i.to;if(s){let t=Math.min(2,n.to-n.from,r);h=n.to-t,c=i.from+t,a=1==t?"Emphasis":"StrongEmphasis"}n.type.mark&&l.push(this.elt(n.type.mark,h,n.to));for(let t=o+1;t=0;e--){let i=this.parts[e];if(i instanceof Ip&&i.type==t)return e}return null}takeContent(t){let e=this.resolveMarkers(t);return this.parts.length=t,e}skipSpace(t){return rp(this.text,t-this.offset)+this.offset}elt(t,e,i,n){return"string"==typeof t?Up(this.parser.getNodeType(t),e,i,n):new Wp(t,e)}}function tO(t,e){if(!e.length)return t;if(!t.length)return e;let i=t.slice(),n=0;for(let t of e){for(;n(t?t-1:0))return!1;if(this.fragmentEnd<0){let t=this.fragment.to;for(;t>0&&"\n"!=this.input.read(t-1,t);)t--;this.fragmentEnd=t?t-1:0}let i=this.cursor;i||(i=this.cursor=this.fragment.tree.cursor(),i.firstChild());let n=t+this.fragment.offset;for(;i.to<=n;)if(!i.parent())return!1;for(;;){if(i.from>=n)return this.fragment.from<=e;if(!i.childAfter(n))return!1}}matches(t){let e=this.cursor.tree;return e&&e.prop(ho.contextHash)==t}takeNodes(t){let e=this.cursor,i=this.fragment.offset,n=this.fragmentEnd-(this.fragment.openEnd?1:0),s=t.absoluteLineStart,r=s,o=t.block.children.length,a=r,l=o;for(;;){if(e.to-i>n){if(e.type.isAnonymous&&e.firstChild())continue;break}if(t.dontInject.add(e.tree),t.addNode(e.tree,e.from-i),e.type.is("Block")&&(eO.indexOf(e.type.id)<0?(r=e.to-i,o=t.block.children.length):(r=a,o=l,a=e.to-i,l=t.block.children.length)),!e.nextSibling())break}for(;t.block.children.length>o;)t.block.children.pop(),t.block.positions.pop();return r-s}}const nO=ea({"Blockquote/...":Sa.quote,HorizontalRule:Sa.contentSeparator,"ATXHeading1/... SetextHeading1/...":Sa.heading1,"ATXHeading2/... SetextHeading2/...":Sa.heading2,"ATXHeading3/...":Sa.heading3,"ATXHeading4/...":Sa.heading4,"ATXHeading5/...":Sa.heading5,"ATXHeading6/...":Sa.heading6,"Comment CommentBlock":Sa.comment,Escape:Sa.escape,Entity:Sa.character,"Emphasis/...":Sa.emphasis,"StrongEmphasis/...":Sa.strong,"Link/... Image/...":Sa.link,"OrderedList/... BulletList/...":Sa.list,"BlockQuote/...":Sa.quote,"InlineCode CodeText":Sa.monospace,URL:Sa.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":Sa.processingInstruction,"CodeInfo LinkLabel":Sa.labelName,LinkTitle:Sa.string,Paragraph:Sa.content}),sO=new Zp(new po(Ep).extend(nO),Object.keys(Sp).map((t=>Sp[t])),Object.keys(Sp).map((t=>$p[t])),Object.keys(Sp),Pp,np,Object.keys(Np).map((t=>Np[t])),Object.keys(Np),[]);function rO(t,e,i){let n=[];for(let s=t.firstChild,r=e;;s=s.nextSibling){let t=s?s.from:i;if(t>r&&n.push({from:r,to:t}),!s)break;r=s.to}return n}const oO={resolve:"Strikethrough",mark:"StrikethroughMark"},aO={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":Sa.strikethrough}},{name:"StrikethroughMark",style:Sa.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,i){if(126!=e||126!=t.char(i+1)||126==t.char(i+2))return-1;let n=t.slice(i-1,i),s=t.slice(i+2,i+3),r=/\s|^$/.test(n),o=/\s|^$/.test(s),a=jp.test(n),l=jp.test(s);return t.addDelimiter(oO,i,i+2,!o&&(!l||r||a),!r&&(!a||o||l))},after:"Emphasis"}]};function lO(t,e,i=0,n,s=0){let r=0,o=!0,a=-1,l=-1,h=!1,c=()=>{n.push(t.elt("TableCell",s+a,s+l,t.parser.parseInline(e.slice(a,l),s+a)))};for(let u=i;u-1)&&r++,o=!1,n&&(a>-1&&c(),n.push(t.elt("TableDelimiter",u+s,u+s+1))),a=l=-1),h=!h&&92==i}return a>-1&&(r++,n&&c()),r}function hO(t,e){for(let i=e;ihO(e.content,0)?new uO:null,endLeaf(t,e,i){if(i.parsers.some((t=>t instanceof uO))||!hO(e.text,e.basePos))return!1;let n=t.scanLine(t.absoluteLineEnd+1).text;return cO.test(n)&&lO(t,e.text,e.basePos)==lO(t,n,e.basePos)},before:"SetextHeading"}]};class fO{nextLine(){return!1}finish(t,e){return t.addLeafElement(e,t.elt("Task",e.start,e.start+e.content.length,[t.elt("TaskMarker",e.start,e.start+3),...t.parser.parseInline(e.content.slice(3),e.start+3)])),!0}}const pO=[dO,{defineNodes:[{name:"Task",block:!0,style:Sa.list},{name:"TaskMarker",style:Sa.atom}],parseBlock:[{name:"TaskList",leaf:(t,e)=>/^\[[ xX]\]/.test(e.content)&&"ListItem"==t.parentType().name?new fO:null,after:"SetextHeading"}]},aO];function OO(t,e,i){return(n,s,r)=>{if(s!=t||n.char(r+1)==t)return-1;let o=[n.elt(i,r,r+1)];for(let s=r+1;s=65&&r<=90||95==r||r>=97&&r<=122||r>=161;)s+=String.fromCharCode(n),n=t.peek(++e);var r;return RO=t,EO=i,TO=s?s.toLowerCase():n==MO||n==DO?void 0:null}const MO=63,DO=33;function WO(t,e){this.name=t,this.parent=e,this.hash=e?e.hash:0;for(let e=0;eUO.indexOf(e)>-1?new WO(VO(n,1)||"",t):t,reduce:(t,e)=>e==wO&&t?t.parent:t,reuse(t,e,i,n){let s=e.type.id;return 6==s||36==s?new WO(VO(n,1)||"",t):t},hash:t=>t?t.hash:0,strict:!1}),qO=new nf(((t,e)=>{if(60!=t.next)return void(t.next<0&&e.context&&t.acceptToken(57));t.advance();let i=47==t.next;i&&t.advance();let n=VO(t,0);if(void 0===n)return;if(!n)return t.acceptToken(i?14:6);let s=e.context?e.context.name:null;if(i){if(n==s)return t.acceptToken(11);if(s&&XO[s])return t.acceptToken(57,-2);if(e.dialectEnabled(0))return t.acceptToken(12);for(let t=e.context;t;t=t.parent)if(t.name==n)return;t.acceptToken(13)}else{if("script"==n)return t.acceptToken(7);if("style"==n)return t.acceptToken(8);if("textarea"==n)return t.acceptToken(9);if(_O.hasOwnProperty(n))return t.acceptToken(10);s&&ZO[s]&&ZO[s][n]?t.acceptToken(57,-1):t.acceptToken(6)}}),{contextual:!0}),LO=new nf((t=>{for(let e=0,i=0;;i++){if(t.next<0){i&&t.acceptToken(58);break}if(45==t.next)e++;else{if(62==t.next&&e>=2){i>3&&t.acceptToken(58,-2);break}e=0}t.advance()}}));const zO=new nf(((t,e)=>{if(47==t.next&&62==t.peek(1)){let i=e.dialectEnabled(1)||function(t){for(;t;t=t.parent)if("svg"==t.name||"math"==t.name)return!0;return!1}(e.context);t.acceptToken(i?5:4,2)}else 62==t.next&&t.acceptToken(4,1)}));function IO(t,e,i){let n=2+t.length;return new nf((s=>{for(let r=0,o=0,a=0;;a++){if(s.next<0){a&&s.acceptToken(e);break}if(0==r&&60==s.next||1==r&&47==s.next||r>=2&&ro?s.acceptToken(e,-o):s.acceptToken(i,-(o-2));break}if((10==s.next||13==s.next)&&a){s.acceptToken(e,1);break}r=o=0}else o++;s.advance()}}))}const BO=IO("script",54,1),jO=IO("style",55,2),NO=IO("textarea",56,3),GO=ea({"Text RawText":Sa.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":Sa.angleBracket,TagName:Sa.tagName,"MismatchedCloseTag/TagName":[Sa.tagName,Sa.invalid],AttributeName:Sa.attributeName,"AttributeValue UnquotedAttributeValue":Sa.attributeValue,Is:Sa.definitionOperator,"EntityReference CharacterReference":Sa.character,Comment:Sa.blockComment,ProcessingInst:Sa.processingInstruction,DoctypeDecl:Sa.documentMeta}),FO=wf.deserialize({version:14,states:",xOVO!rOOO!WQ#tO'#CqO!]Q#tO'#CzO!bQ#tO'#C}O!gQ#tO'#DQO!lQ#tO'#DSO!qOaO'#CpO!|ObO'#CpO#XOdO'#CpO$eO!rO'#CpOOO`'#Cp'#CpO$lO$fO'#DTO$tQ#tO'#DVO$yQ#tO'#DWOOO`'#Dk'#DkOOO`'#DY'#DYQVO!rOOO%OQ&rO,59]O%WQ&rO,59fO%`Q&rO,59iO%hQ&rO,59lO%sQ&rO,59nOOOa'#D^'#D^O%{OaO'#CxO&WOaO,59[OOOb'#D_'#D_O&`ObO'#C{O&kObO,59[OOOd'#D`'#D`O&sOdO'#DOO'OOdO,59[OOO`'#Da'#DaO'WO!rO,59[O'_Q#tO'#DROOO`,59[,59[OOOp'#Db'#DbO'dO$fO,59oOOO`,59o,59oO'lQ#|O,59qO'qQ#|O,59rOOO`-E7W-E7WO'vQ&rO'#CsOOQW'#DZ'#DZO(UQ&rO1G.wOOOa1G.w1G.wO(^Q&rO1G/QOOOb1G/Q1G/QO(fQ&rO1G/TOOOd1G/T1G/TO(nQ&rO1G/WOOO`1G/W1G/WOOO`1G/Y1G/YO(yQ&rO1G/YOOOa-E7[-E7[O)RQ#tO'#CyOOO`1G.v1G.vOOOb-E7]-E7]O)WQ#tO'#C|OOOd-E7^-E7^O)]Q#tO'#DPOOO`-E7_-E7_O)bQ#|O,59mOOOp-E7`-E7`OOO`1G/Z1G/ZOOO`1G/]1G/]OOO`1G/^1G/^O)gQ,UO,59_OOQW-E7X-E7XOOOa7+$c7+$cOOOb7+$l7+$lOOOd7+$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X`pQ`ORx`Q{aQ}bQ!PcQ!RdQ!UeZ!e{}!P!R!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:67,context:YO,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,21,30,33,36,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,29,32,35,37,"OpenTag"],["group",-9,14,17,18,19,20,39,40,41,42,"Entity",16,"Entity TextContent",-3,28,31,34,"TextContent Entity"]],propSources:[GO],skippedNodes:[0],repeatNodeCount:9,tokenData:"#%g!aR!YOX$qXY,QYZ,QZ[$q[]&X]^,Q^p$qpq,Qqr-_rs4ysv-_vw5iwxJ^x}-_}!OKP!O!P-_!P!Q$q!Q![-_![!]!!O!]!^-_!^!_!&W!_!`#$o!`!a&X!a!c-_!c!}!!O!}#R-_#R#S!!O#S#T3V#T#o!!O#o#s-_#s$f$q$f%W-_%W%o!!O%o%p-_%p&a!!O&a&b-_&b1p!!O1p4U-_4U4d!!O4d4e-_4e$IS!!O$IS$I`-_$I`$Ib!!O$Ib$Kh-_$Kh%#t!!O%#t&/x-_&/x&Et!!O&Et&FV-_&FV;'S!!O;'S;:j!&Q;:j;=`4s<%l?&r-_?&r?Ah!!O?Ah?BY$q?BY?Mn!!O?MnO$q!Z$|c`PkW!a`!cpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr$qrs&}sv$qv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",tokenizers:[BO,jO,NO,zO,qO,LO,0,1,2,3,4,5],topRules:{Document:[0,15]},dialects:{noMatch:0,selfClosing:485},tokenPrec:487});function HO(t,e){let i=Object.create(null);for(let n of t.getChildren(yO)){let t=n.getChild(SO),s=n.getChild(xO)||n.getChild(kO);t&&(i[e.read(t.from,t.to)]=s?s.type.id==xO?e.read(s.from+1,s.to-1):e.read(s.from,s.to):"")}return i}function JO(t,e){let i=t.getChild(vO);return i?e.read(i.from,i.to):" "}function KO(t,e,i){let n;for(let s of i)if(!s.attrs||s.attrs(n||(n=HO(t.node.parent.firstChild,e))))return{parser:s.parser};return null}function tg(t=[],e=[]){let i=[],n=[],s=[],r=[];for(let e of t){("script"==e.tag?i:"style"==e.tag?n:"textarea"==e.tag?s:r).push(e)}let o=e.length?Object.create(null):null;for(let t of e)(o[t.name]||(o[t.name]=[])).push(t);return Do(((t,e)=>{let a=t.type.id;if(a==QO)return KO(t,e,i);if(a==$O)return KO(t,e,n);if(a==PO)return KO(t,e,s);if(a==wO&&r.length){let i,n=t.node,s=n.firstChild,o=s&&JO(s,e);if(o)for(let t of r)if(t.tag==o&&(!t.attrs||t.attrs(i||(i=HO(n,e))))){let e=n.lastChild;return{parser:t.parser,overlay:[{from:s.to,to:e.type.id==CO?e.from:n.to}]}}}if(o&&a==yO){let i,n=t.node;if(i=n.firstChild){let t=o[e.read(i.from,i.to)];if(t)for(let i of t){if(i.tagName&&i.tagName!=JO(n.parent,e))continue;let t=n.lastChild;if(t.type.id==xO){let e=t.from+1,n=t.lastChild,s=t.to-(n&&n.isError?0:1);if(s>e)return{parser:i.parser,overlay:[{from:e,to:s}]}}else if(t.type.id==kO)return{parser:i.parser,overlay:[{from:t.from,to:t.to}]}}}}return null}))}const eg=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288];function ig(t){return t>=65&&t<=90||t>=97&&t<=122||t>=161}const ng=new nf(((t,e)=>{for(let n=!1,s=0,r=0;;r++){let{next:o}=t;if(!(ig(o)||45==o||95==o||n&&(i=o,i>=48&&i<=57))){n&&t.acceptToken(40==o?95:2==s&&e.canShift(2)?2:96);break}!n&&(45!=o||r>0)&&(n=!0),s===r&&45==o&&s++,t.advance()}var i})),sg=new nf((t=>{if(eg.includes(t.peek(-1))){let{next:e}=t;(ig(e)||95==e||35==e||46==e||91==e||58==e||45==e)&&t.acceptToken(94)}})),rg=new nf((t=>{if(!eg.includes(t.peek(-1))){let{next:e}=t;if(37==e&&(t.advance(),t.acceptToken(1)),ig(e)){do{t.advance()}while(ig(t.next));t.acceptToken(1)}}})),og=ea({"AtKeyword import charset namespace keyframes media supports":Sa.definitionKeyword,"from to selector":Sa.keyword,NamespaceName:Sa.namespace,KeyframeName:Sa.labelName,TagName:Sa.tagName,ClassName:Sa.className,PseudoClassName:Sa.constant(Sa.className),IdName:Sa.labelName,"FeatureName PropertyName":Sa.propertyName,AttributeName:Sa.attributeName,NumberLiteral:Sa.number,KeywordQuery:Sa.keyword,UnaryQueryOp:Sa.operatorKeyword,"CallTag ValueName":Sa.atom,VariableName:Sa.variableName,Callee:Sa.operatorKeyword,Unit:Sa.unit,"UniversalSelector NestingSelector":Sa.definitionOperator,MatchOp:Sa.compareOperator,"ChildOp SiblingOp, LogicOp":Sa.logicOperator,BinOp:Sa.arithmeticOperator,Important:Sa.modifier,Comment:Sa.blockComment,ParenthesizedContent:Sa.special(Sa.name),ColorLiteral:Sa.color,StringLiteral:Sa.string,":":Sa.punctuation,"PseudoOp #":Sa.derefOperator,"; ,":Sa.separator,"( )":Sa.paren,"[ ]":Sa.squareBracket,"{ }":Sa.brace}),ag={__proto__:null,lang:32,"nth-child":32,"nth-last-child":32,"nth-of-type":32,"nth-last-of-type":32,dir:32,"host-context":32,url:60,"url-prefix":60,domain:60,regexp:60,selector:134},lg={__proto__:null,"@import":114,"@media":138,"@charset":142,"@namespace":146,"@keyframes":152,"@supports":164},hg={__proto__:null,not:128,only:128,from:158,to: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,get:t=>lg[t]||-1},{term:96,get:t=>hg[t]||-1}],tokenPrec:1123});let ug=null;function dg(){if(!ug&&"object"==typeof document&&document.body){let{style:t}=document.body,e=[],i=new Set;for(let n in t)"cssText"!=n&&"cssFloat"!=n&&"string"==typeof t[n]&&(/[A-Z]/.test(n)&&(n=n.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))),i.has(n)||(e.push(n),i.add(n)));ug=e.sort().map((t=>({type:"property",label:t})))}return ug||[]}const fg=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map((t=>({type:"class",label:t}))),pg=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map((t=>({type:"keyword",label:t}))).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map((t=>({type:"constant",label:t})))),Og=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map((t=>({type:"type",label:t}))),gg=/^(\w[\w-]*|-\w[\w-]*|)$/,mg=/^-(-[\w-]*)?$/;const bg=new Ro,wg=["Declaration"];function vg(t){for(let e=t;;){if(e.type.isTop)return e;if(!(e=e.parent))return t}}function yg(t,e,i){if(e.to-e.from>4096){let n=bg.get(e);if(n)return n;let s=[],r=new Set,o=e.cursor(mo.IncludeAnonymous);if(o.firstChild())do{for(let e of yg(t,o.node,i))r.has(e.label)||(r.add(e.label),s.push(e))}while(o.nextSibling());return bg.set(e,s),s}{let n=[],s=new Set;return e.cursor().iterate((e=>{var r;if(i(e)&&e.matchContext(wg)&&":"==(null===(r=e.node.nextSibling)||void 0===r?void 0:r.name)){let i=t.sliceString(e.from,e.to);s.has(i)||(s.add(i),n.push({label:i,type:"variable"}))}})),n}}const Sg=t=>e=>{let{state:i,pos:n}=e,s=Xa(i).resolveInner(n,-1),r=s.type.isError&&s.from==s.to-1&&"-"==i.doc.sliceString(s.from,s.to);if("PropertyName"==s.name||(r||"TagName"==s.name)&&/^(Block|Styles)$/.test(s.resolve(s.to).name))return{from:s.from,options:dg(),validFor:gg};if("ValueName"==s.name)return{from:s.from,options:pg,validFor:gg};if("PseudoClassName"==s.name)return{from:s.from,options:fg,validFor:gg};if(t(s)||(e.explicit||r)&&function(t,e){var i;if(("("==t.name||t.type.isError)&&(t=t.parent||t),"ArgList"!=t.name)return!1;let n=null===(i=t.parent)||void 0===i?void 0:i.firstChild;return"Callee"==(null==n?void 0:n.name)&&"var"==e.sliceString(n.from,n.to)}(s,i.doc))return{from:t(s)||r?s.from:n,options:yg(i.doc,vg(s),t),validFor:mg};if("TagName"==s.name){for(let{parent:t}=s;t;t=t.parent)if("Block"==t.name)return{from:s.from,options:dg(),validFor:gg};return{from:s.from,options:Og,validFor:gg}}if(!e.explicit)return null;let o=s.resolve(n),a=o.childBefore(n);return a&&":"==a.name&&"PseudoClassSelector"==o.name?{from:n,options:fg,validFor:gg}:a&&":"==a.name&&"Declaration"==o.name||"ArgList"==o.name?{from:n,options:pg,validFor:gg}:"Block"==o.name||"Styles"==o.name?{from:n,options:dg(),validFor:gg}:null},xg=Sg((t=>"VariableName"==t.name)),kg=_a.define({name:"css",parser:cg.configure({props:[Na.add({Declaration:il()}),rl.add({"Block KeyframeList":ol})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function Qg(){return new Ua(kg,kg.data.of({autocomplete:xg}))}const $g=["_blank","_self","_top","_parent"],Pg=["ascii","utf-8","utf-16","latin1","latin1"],Cg=["get","post","put","delete"],_g=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Xg=["true","false"],Zg={},Ag={a:{attrs:{href:null,ping:null,type:null,media:null,target:$g,hreflang:null}},abbr:Zg,address:Zg,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Zg,aside:Zg,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Zg,base:{attrs:{href:null,target:$g}},bdi:Zg,bdo:Zg,blockquote:{attrs:{cite:null}},body:Zg,br:Zg,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Zg,center:Zg,cite:Zg,code:Zg,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:Zg,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Zg,div:Zg,dl:Zg,dt:Zg,em:Zg,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Zg,figure:Zg,footer:Zg,form:{attrs:{action:null,name:null,"accept-charset":Pg,autocomplete:["on","off"],enctype:_g,method:Cg,novalidate:["novalidate"],target:$g}},h1:Zg,h2:Zg,h3:Zg,h4:Zg,h5:Zg,h6:Zg,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Zg,hgroup:Zg,hr:Zg,html:{attrs:{manifest:null}},i:Zg,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:Zg,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Zg,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:Zg,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Pg,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:Zg,noscript:Zg,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:Zg,param:{attrs:{name:null,value:null}},pre:Zg,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Zg,rt:Zg,ruby:Zg,samp:Zg,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Pg}},section:Zg,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Zg,source:{attrs:{src:null,type:null,media:null}},span:Zg,strong:Zg,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Zg,summary:Zg,sup:Zg,table:Zg,tbody:Zg,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Zg,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:Zg,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Zg,time:{attrs:{datetime:null}},title:Zg,tr:Zg,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Zg,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:Zg},Tg={accesskey:null,class:null,contenteditable:Xg,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Xg,autocorrect:Xg,autocapitalize:Xg,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Xg,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Xg,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Xg,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Xg,"aria-hidden":Xg,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Xg,"aria-multiselectable":Xg,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Xg,"aria-relevant":null,"aria-required":Xg,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},Rg="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map((t=>"on"+t));for(let t of Rg)Tg[t]=null;class Eg{constructor(t,e){this.tags=Object.assign(Object.assign({},Ag),t),this.globalAttrs=Object.assign(Object.assign({},Tg),e),this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}function Vg(t,e,i=t.length){if(!e)return"";let n=e.firstChild,s=n&&n.getChild("TagName");return s?t.sliceString(s.from,Math.min(s.to,i)):""}function Mg(t,e=!1){for(let i=t.parent;i;i=i.parent)if("Element"==i.name){if(!e)return i;e=!1}return null}function Dg(t,e,i){let n=i.tags[Vg(t,Mg(e,!0))];return(null==n?void 0:n.children)||i.allTags}function Wg(t,e){let i=[];for(let n=e;n=Mg(n);){let s=Vg(t,n);if(s&&"CloseTag"==n.lastChild.name)break;s&&i.indexOf(s)<0&&("EndTag"==e.name||e.from>=n.firstChild.to)&&i.push(s)}return i}Eg.default=new Eg;const Ug=/^[:\-\.\w\u00b7-\uffff]*$/;function Yg(t,e,i,n,s){let r=/\s*>/.test(t.sliceDoc(s,s+5))?"":">";return{from:n,to:s,options:Dg(t.doc,i,e).map((t=>({label:t,type:"type"}))).concat(Wg(t.doc,i).map(((t,e)=>({label:"/"+t,apply:"/"+t+r,type:"type",boost:99-e})))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function qg(t,e,i,n){let s=/\s*>/.test(t.sliceDoc(n,n+5))?"":">";return{from:i,to:n,options:Wg(t.doc,e).map(((t,e)=>({label:t,apply:t+s,type:"type",boost:99-e}))),validFor:Ug}}function Lg(t,e){let{state:i,pos:n}=e,s=Xa(i).resolveInner(n),r=s.resolve(n,-1);for(let t,e=n;s==r&&(t=r.childBefore(e));){let i=t.lastChild;if(!i||!i.type.isError||i.from({label:t,type:"property"}))),validFor:Ug}}(i,t,r,"AttributeName"==r.name?r.from:n,n):"Is"==r.name||"AttributeValue"==r.name||"UnquotedAttributeValue"==r.name?function(t,e,i,n,s){var r;let o,a=null===(r=i.parent)||void 0===r?void 0:r.getChild("AttributeName"),l=[];if(a){let r=t.sliceDoc(a.from,a.to),h=e.globalAttrs[r];if(!h){let n=Mg(i),s=n?e.tags[Vg(t.doc,n)]:null;h=(null==s?void 0:s.attrs)&&s.attrs[r]}if(h){let e=t.sliceDoc(n,s).toLowerCase(),i='"',r='"';/^['"]/.test(e)?(o='"'==e[0]?/^[^"]*$/:/^[^']*$/,i="",r=t.sliceDoc(s,s+1)==e[0]?"":e[0],e=e.slice(1),n++):o=/^[^\s<>='"]*$/;for(let t of h)l.push({label:t,apply:i+t+r,type:"constant"})}}return{from:n,to:s,options:l,validFor:o}}(i,t,r,"Is"==r.name?n:r.from,n):!e.explicit||"Element"!=s.name&&"Text"!=s.name&&"Document"!=s.name?null:function(t,e,i,n){let s=[],r=0;for(let n of Dg(t.doc,i,e))s.push({label:"<"+n,type:"type"});for(let e of Wg(t.doc,i))s.push({label:"",type:"type",boost:99-r++});return{from:n,to:n,options:s,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}(i,t,r,n)}function zg(t){let{extraTags:e,extraGlobalAttributes:i}=t,n=i||e?new Eg(e,i):Eg.default;return t=>Lg(n,t)}const Ig=[{tag:"script",attrs:t=>"text/typescript"==t.type||"ts"==t.lang,parser:zf.parser},{tag:"script",attrs:t=>"text/babel"==t.type||"text/jsx"==t.type,parser:If.parser},{tag:"script",attrs:t=>"text/typescript-jsx"==t.type,parser:Bf.parser},{tag:"script",attrs:t=>!t.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(t.type),parser:qf.parser},{tag:"style",attrs:t=>(!t.lang||"css"==t.lang)&&(!t.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(t.type)),parser:kg.parser}],Bg=[{name:"style",parser:kg.parser.configure({top:"Styles"})}].concat(Rg.map((t=>({name:t,parser:qf.parser})))),jg=_a.define({name:"html",parser:FO.configure({props:[Na.add({Element(t){let e=/^(\s*)(<\/)?/.exec(t.textAfter);return t.node.to<=t.pos+e[0].length?t.continue():t.lineIndent(t.node.from)+(e[2]?0:t.unit)},"OpenTag CloseTag SelfClosingTag":t=>t.column(t.node.from)+t.unit,Document(t){if(t.pos+/\s*/.exec(t.textAfter)[0].lengtht.getChild("TagName")})],wrap:tg(Ig,Bg)}),languageData:{commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-._"}});function Ng(t={}){let e,i="";!1===t.matchClosingTags&&(i="noMatch"),!0===t.selfClosingTags&&(i=(i?i+" ":"")+"selfClosing"),(t.nestedLanguages&&t.nestedLanguages.length||t.nestedAttributes&&t.nestedAttributes.length)&&(e=tg((t.nestedLanguages||[]).concat(Ig),(t.nestedAttributes||[]).concat(Bg)));let n=e||i?jg.configure({dialect:i,wrap:e}):jg;return new Ua(n,[jg.data.of({autocomplete:zg(t)}),!1!==t.autoCloseTags?Fg:[],Nf().support,Qg().support])}const Gg=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),Fg=Ts.inputHandler.of(((t,e,i,n)=>{if(t.composing||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!jg.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((e=>{var i,r,o;let a,{head:l}=e,h=Xa(s).resolveInner(l,-1);if("TagName"!=h.name&&"StartTag"!=h.name||(h=h.parent),">"==n&&"OpenTag"==h.name){if("CloseTag"!=(null===(r=null===(i=h.parent)||void 0===i?void 0:i.lastChild)||void 0===r?void 0:r.name)&&(a=Vg(s.doc,h.parent,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`${e?"":">"}`;return{range:A.cursor(l+1),changes:{from:l+(e?1:0),insert:i}}}}else if("/"==n&&"OpenTag"==h.name){let e=h.parent,i=null==e?void 0:e.parent;if(e.from==l-1&&"CloseTag"!=(null===(o=i.lastChild)||void 0===o?void 0:o.name)&&(a=Vg(s.doc,i,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`/${a}${e?"":">"}`,n=l+i.length+(e?1:0);return{range:A.cursor(n),changes:{from:l,insert:i}}}}return{range:e}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)})),Hg=Qa({commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}}}),Jg=new ho,Kg=sO.configure({props:[rl.add((t=>!t.is("Block")||t.is("Document")||null!=tm(t)?void 0:(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to}))),Jg.add(tm),Na.add({Document:()=>null}),ka.add({Document:Hg})]});function tm(t){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(t.name);return e?+e[1]:void 0}function em(t,e){let i=t;for(;;){let t,n=i.nextSibling;if(!n||null!=(t=tm(n.type))&&t<=e)break;i=n}return i.to}const im=sl.of(((t,e,i)=>{for(let n=Xa(t).resolveInner(i,-1);n&&!(n.fromi)return{from:i,to:e}}return null}));function nm(t){return new Pa(Hg,t,[im],"markdown")}const sm=nm(Kg),rm=nm(Kg.configure([pO,mO,gO,bO]));class om{constructor(t,e,i,n,s,r,o){this.node=t,this.from=e,this.to=i,this.spaceBefore=n,this.spaceAfter=s,this.type=r,this.item=o}blank(t,e=!0){let i=this.spaceBefore+("Blockquote"==this.node.name?">":"");if(null!=t){for(;i.length0;t--)i+=" ";return i+(e?this.spaceAfter:"")}marker(t,e){let i="OrderedList"==this.node.name?String(+lm(this.item,t)[2]+e):"";return this.spaceBefore+i+this.type+this.spaceAfter}}function am(t,e){let i=[];for(let e=t;e&&"Document"!=e.name;e=e.parent)"ListItem"!=e.name&&"Blockquote"!=e.name&&"FencedCode"!=e.name||i.push(e);let n=[];for(let t=i.length-1;t>=0;t--){let s,r=i[t],o=e.lineAt(r.from),a=r.from-o.from;if("FencedCode"==r.name)n.push(new om(r,a,a,"","","",null));else if("Blockquote"==r.name&&(s=/^[ \t]*>( ?)/.exec(o.text.slice(a))))n.push(new om(r,a,a+s[0].length,"",s[1],">",null));else if("ListItem"==r.name&&"OrderedList"==r.parent.name&&(s=/^([ \t]*)\d+([.)])([ \t]*)/.exec(o.text.slice(a)))){let t=s[3],e=s[0].length;t.length>=4&&(t=t.slice(0,t.length-4),e-=4),n.push(new om(r.parent,a,a+e,s[1],t,s[2],r))}else if("ListItem"==r.name&&"BulletList"==r.parent.name&&(s=/^([ \t]*)([-+*])([ \t]{1,4}\[[ xX]\])?([ \t]+)/.exec(o.text.slice(a)))){let t=s[4],e=s[0].length;t.length>4&&(t=t.slice(0,t.length-4),e-=4);let i=s[2];s[3]&&(i+=s[3].replace(/[xX]/," ")),n.push(new om(r.parent,a,a+e,s[1],t,i,r))}}return n}function lm(t,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(t.from,t.from+10))}function hm(t,e,i,n=0){for(let s=-1,r=t;;){if("ListItem"==r.name){let t=lm(r,e),o=+t[2];if(s>=0){if(o!=s+1)return;i.push({from:r.from+t[1].length,to:r.from+t[0].length,insert:String(s+2+n)})}s=o}let t=r.nextSibling;if(!t)break;r=t}}function cm(t){return"QuoteMark"==t.name||"ListMark"==t.name}const um=[{key:"Enter",run:({state:t,dispatch:e})=>{let i=Xa(t),{doc:n}=t,s=null,r=t.changeByRange((e=>{if(!e.empty||!rm.isActiveAt(t,e.from))return s={range:e};let r=e.from,o=n.lineAt(r),a=am(i.resolveInner(r,-1),n);for(;a.length&&a[a.length-1].from>r-o.from;)a.pop();if(!a.length)return s={range:e};let l=a[a.length-1];if(l.to-l.spaceAfter.length>r-o.from)return s={range:e};let h=r>=l.to-l.spaceAfter.length&&!/\S/.test(o.text.slice(l.to));if(l.item&&h){if(l.node.firstChild.to>=r||o.from>0&&!/[^\s>]/.test(n.lineAt(o.from-1).text)){let t,e=a.length>1?a[a.length-2]:null,i="";e&&e.item?(t=o.from+e.from,i=e.marker(n,1)):t=o.from+(e?e.to:0);let s=[{from:t,to:r,insert:i}];return"OrderedList"==l.node.name&&hm(l.item,n,s,-2),e&&"OrderedList"==e.node.name&&hm(e.item,n,s),{range:A.cursor(t+i.length),changes:s}}{let e="";for(let t=0,i=a.length-2;t<=i;t++)e+=a[t].blank(t\s*$/.exec(i.text);if(s&&s.index==l.from){let n=t.changes([{from:i.from+s.index,to:i.to},{from:o.from+l.from,to:o.to}]);return{range:e.map(n),changes:n}}}let c=[];"OrderedList"==l.node.name&&hm(l.item,n,c);let u=l.item&&l.item.from]*/.exec(o.text)[0].length>=l.to)for(let t=0,e=a.length-1;t<=e;t++)d+=t!=e||u?a[t].blank(to.from&&/\s/.test(o.text.charAt(f-o.from-1));)f--;return d=t.lineBreak+d,c.push({from:f,to:r,insert:d}),{range:A.cursor(f+d.length),changes:c}}));return!s&&(e(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0)}},{key:"Backspace",run:({state:t,dispatch:e})=>{let i=Xa(t),n=null,s=t.changeByRange((e=>{let s=e.from,{doc:r}=t;if(e.empty&&rm.isActiveAt(t,e.from)){let t=r.lineAt(s),n=am(function(t,e){let i=t.resolveInner(e,-1),n=e;cm(i)&&(n=i.from,i=i.parent);for(let t;t=i.childBefore(n);)if(cm(t))n=t.from;else{if("OrderedList"!=t.name&&"BulletList"!=t.name)break;i=t.lastChild,n=i.to}return i}(i,s),r);if(n.length){let i=n[n.length-1],r=i.to-i.spaceAfter.length+(i.spaceAfter?1:0);if(s-t.from>r&&!/\S/.test(t.text.slice(r,s-t.from)))return{range:A.cursor(t.from+r),changes:{from:t.from+r,to:s}};if(s-t.from==r&&(!i.item||t.from<=i.item.from||!/\S/.test(t.text.slice(0,i.to)))){let n=t.from+i.from;if(i.item&&i.node.fromt.from-e.from||t.startSide-e.startSide)),ni.set(i)}getMatchingBracket(t){switch(t){case")":return"(";case"]":return"[";case"}":return"{";default:return null}}},{decorations:t=>t.decorations});var fm="[a-zA-Z\\$][a-zA-Z0-9\\$]*",pm="(?:\\.\\d+|\\d+\\.\\d*|\\d+)",Om="(?:`(?:`?"+pm+")?)",gm=new RegExp("(?:(?:\\d+)(?:\\^\\^(?:\\.\\w+|\\w+\\.\\w*|\\w+)"+Om+"?(?:\\*\\^[+-]?\\d+)?))"),mm=new RegExp("(?:"+pm+Om+"?(?:\\*\\^[+-]?\\d+)?)"),bm=new RegExp("(?:`?)(?:"+fm+")(?:`(?:"+fm+"))*(?:`?)");let wm=[];const vm=["True","False","All","None","Null","Full","$Failed","$Aborted"];function ym(t,e){var i;return'"'===(i=t.next())?(e.tokenize=Sm,e.tokenize(t,e)):"("===i&&t.eat("*")?(e.commentLevel++,e.tokenize=xm,e.tokenize(t,e)):(t.backUp(1),t.match(gm,!0,!1)||t.match(mm,!0,!1)?"number":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::usage)/,!0,!1)?"meta":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::[a-zA-Z\$][a-zA-Z0-9\$]*):?/,!0,!1)?"string.special":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*\s*:)(?:(?:[a-zA-Z\$][a-zA-Z0-9\$]*)|(?:[^:=>~@\^\&\*\)\[\]'\?,\|])).*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+/,!0,!1)||t.match(/_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)?"variableName.special":t.match(/\\\[[a-zA-Z\$][a-zA-Z0-9\$]*\]/,!0,!1)?"character":t.match(/(?:\[|\]|{|}|\(|\))/,!0,!1)?"bracket":t.match(/(?:#[a-zA-Z\$][a-zA-Z0-9\$]*|#+[0-9]?)/,!0,!1)?"variableName.constant":t.match(bm,!0,!1)?vm.indexOf(t.current())>-1?"number":wm.indexOf(t.current())>-1||0==wm.length?"keyword":t.current()in e.localVars?"atom":(e.localVars[t.current()]=!0,"function"):t.match(/(?:\\|\+|\-|\*|\/|,|;|\.|:|@|~|=|>|<|&|\||_|`|'|\^|\?|!|%)/,!0,!1)?"operator":(t.next(),"error"))}function Sm(t,e){for(var i,n=!1,s=!1;null!=(i=t.next());){if('"'===i&&!s){n=!0;break}s=!s&&"\\"===i}return n&&!s&&(e.tokenize=ym),"string"}function xm(t,e){for(var i,n;e.commentLevel>0&&null!=(n=t.next());)"("===i&&"*"===n&&e.commentLevel++,"*"===i&&")"===n&&e.commentLevel--,i=n;return e.commentLevel<=0&&(e.tokenize=ym),"comment"}const km={name:"mathematica",extendVariables:function(t){},startState:function(){return{tokenize:ym,commentLevel:0,localVars:{}}},token:function(t,e){return t.eatSpace()?null:e.tokenize(t,e)},languageData:{commentTokens:{block:{open:"(*",close:"*)"}}}};let Qm={of:t=>[Gl.define(km),Yd({override:[async e=>function(t,e){let i=t.matchBefore(/\w*/);return i.from!==i.to||t.explicit?{from:i.from,options:e.data}:null}(e,t)]}),Ys.of([{key:"Escape",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((t=>{let{from:e,to:i}=t;return{changes:{from:e,to:i,insert:"EC"},range:A.cursor(e+2)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])],reBuild:t=>{wm=t.map((t=>t.label))}};const $m=(t,e,i,n)=>{if(0==t.length)return;const s=(new Date).valueOf();let r=0;i.dom.loadingMark=!0;const o=i.dom.style.background;let a=0;console.log("Start animation");const l=setInterval((()=>{i.dom.style.setProperty("background","hsl("+a+"deg 100% 97%)","important"),a+=2,a>360&&(a=0)}),30);n.transaction(e,i,s,t.length);for(const a of t)Pm(a,((a,h)=>{n.file(e,i,s,a,h),r++,r>=t.length&&i.dom&&i.dom.loadingMark&&(i.dom.loadingMark=!1,setTimeout((()=>{i.dom.style.background=o,clearInterval(l),console.log("Stop animation")}),2e3))}),(()=>{console.warn("Fauilure");const t=i.dom.style.background;i.dom.style.background="rgb(255 189 189 / 97%)";let e=97;const n=setInterval((()=>{i.dom.style.background="rgb(255 189 189 / "+Math.round(e)+"%)",e*=.95}),30);clearInterval(l),setTimeout((()=>{clearInterval(n),i.dom.style.background=t}),3e3)}))};function Pm(t,e,i){const n=new FileReader;n.addEventListener("load",(n=>{const s=n.target.result;if(s.byteLength/1024/1024>100)return alert("Files > 100Mb are not supported for drag and drop"),void i();let r=base64ArrayBuffer(s);e(t.name,r)})),n.addEventListener("progress",(t=>{if(t.loaded&&t.total){const e=t.loaded/t.total*100;console.log(e)}})),n.readAsArrayBuffer(t)}const Cm=(t,e)=>Ts.domEventHandlers({drop(e,i){e.preventDefault();const n=[];e.dataTransfer.items?[...e.dataTransfer.items].forEach(((t,e)=>{if("file"===t.kind){const i=t.getAsFile();console.log(`… file[${e}].name = ${i.name}`),n.push(i)}})):[...e.dataTransfer.files].forEach(((t,e)=>{console.log(`… file[${e}].name = ${t.name}`),n.push(t)})),$m(n,e,i,t)},paste(t,i){let n=t.clipboardData||window.clipboardData;for(const s of n.items)if("string"===s.kind)switch(s.type){case"text/plain":break;case"image/png":t.preventDefault(),$m([s.getAsFile()],t,i,e)}else t.preventDefault(),$m([s.getAsFile()],t,i,e)}}),_m=new pr({regexp:/\\\[(\w+)\]/g,decoration:t=>ni.replace({widget:new Zm(t[1])})}),Xm=_i.fromClass(class{constructor(t){this.Greekholder=_m.createDeco(t)}update(t){this.Greekholder=_m.updateDeco(t,this.Greekholder)}},{decorations:t=>t.Greekholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Greekholder||ni.none))});class Zm extends ei{constructor(t){super(),this.name=t}eq(t){return this.name===t.name}toDOM(){let t=document.createElement("span");return t.innerHTML="&"+this.name.toLowerCase().replace("sqrt","radic").replace("undirectededge","harr").replace("directededge","rarr").replace(/capital(.*)/,((t,e)=>e.charAt(0).toUpperCase()+e.slice(1))).replace(/curly(.*)/,((t,e)=>e)).replace(/script(.*)/,((t,e)=>"el"+e.toLowerCase())).replace("transpose","#7488").replace("degree","deg")+";",t}ignoreEvent(){return!1}}const Am=new pr({regexp:/(->|<-)/g,decoration:t=>ni.replace({widget:new Tm(t[1])})});_i.fromClass(class{constructor(t){this.Arrowholder=Am.createDeco(t)}update(t){this.Arrowholder=Am.updateDeco(t,this.Arrowholder)}},{decorations:t=>t.Arrowholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Arrowholder||ni.none))});class Tm extends ei{constructor(t){super(),this.dir=t}eq(t){return this.dir===t.dir}toDOM(){let t=document.createElement("span");return"->"===this.dir?t.innerText="→":t.innerText="←",t}ignoreEvent(){return!1}}function Rm(t){if(!(t=t||{}).open)throw new Error('Balanced: please provide a "open" property');if(!t.close)throw new Error('Balanced: please provide a "close" property');if(this.balance=t.balance||!1,this.exceptions=t.exceptions||!1,this.caseInsensitive=t.caseInsensitive,this.head=t.head||t.open,this.head=Array.isArray(this.head)?this.head:[this.head],this.open=Array.isArray(t.open)?t.open:[t.open],this.close=Array.isArray(t.close)?t.close:[t.close],!Array.isArray(this.head)||!Array.isArray(this.open)||!Array.isArray(this.close)||this.head.length!==this.open.length||this.open.length!==this.close.length)throw new Error('Balanced: if you use arrays for a "head,open,close" you must use matching arrays for all options');var e=Dm(this.head.map(this.regExpFromArrayGroupedMap,this)),i=Dm(this.open.map(this.regExpFromArrayGroupedMap,this)),n=Dm(this.close.map(this.regExpFromArrayGroupedMap,this));this.regExp=Dm([e,i,n],"g"+(this.caseInsensitive?"i":"")),this.regExpGroupLength=this.head.length}function Em(t,e,i){for(var n=Mm(e.substr(0,i+1),/^.*\n?$/gim),s=Mm(e,/^.*\n?$/gim),r=n.length-1,o=i+1-(n.length?n[n.length-1].index:0),a="",l=2;l>=0;l--)r-l>=0&&s[r-l]&&(a+=e.substr(s[r-l].index,s[r-l].length)+"\n");for(l=0;l=0&&s[r+l]&&(a+=e.substr(s[r+l].index,s[r+l].length)+"\n");a=a.replace(/\t/g," ").replace(/\n$/,"");var h=new Error(t+" at "+(r+1)+":"+o+"\n\n"+a);return h.line=r+1,h.column=o,h.index=i,h}function Vm(t,e){return t>=e.index&&t<=e.index+e.length-1}function Mm(t,e){var i,n=new RegExp(e),s=[];if(t)for(;i=n.exec(t);)s.push({index:i.index,length:i[0].length,match:i[0]}),i[0].length||n.lastIndex++;return s}function Dm(t,e,i){var n=t.map((function(t){return t instanceof RegExp?t.source:function(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}(t)}),this).join("|");return n=i?"("+n+")":"(?:"+n+")",new RegExp(n,e||void 0)}Rm.prototype={regExpFromArrayGroupedMap:function(t){return Dm([t],null,!0)},matchContentsInBetweenBrackets:function(t,e){for(var i,n=new RegExp(this.regExp),s=[],r=[],o=null,a=!0;i=n.exec(t);){if(e){for(var l=!1,h=0;h{const i=((t,e,i)=>{var n,s=new RegExp(t),r=[];if(e)for(;n=s.exec(e);){if(i){for(var o=!1,a=0;a{new qm({open:"(*"+t+"[*)",close:"(*]"+t+"*)",balance:!1}).matchContentsInBetweenBrackets(e.value,[]).forEach((function(t){const s=e.value.slice(t.index+t.head.length,t.index+t.length-t.tail.length);n(i+t.index,{length:t.length,pos:i+t.index,argsPos:i+t.index+t.head.length,str:s})}))})(e,t,i,s)},o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)r(o,a)}var Im,Bm=function(){function t(t){var e=t.tag,i=t.decoration,n=t.decorate,s=t.boundary,r=t.maxLength,o=void 0===r?1e3:r;if(this.tag=e,n)this.addMatch=function(t,e,i,s){return n(s,i,i+t.length,t,e)};else if("function"==typeof i)this.addMatch=function(t,e,n,s){var r=i(t,e,n);r&&s(n,n+t.length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=function(t,e,n,s){return s(n,n+t.length,i)}}this.boundary=s,this.maxLength=o}return t.prototype.createDeco=function(t){for(var e=this,i=new Xt,n=i.add.bind(i),s=0,r=function(t,e){var i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;for(var n=[],s=0,r=i;s=a?n[n.length-1].to=l:n.push({from:a,to:l})}return n}(t,this.maxLength);st.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e},t.prototype.updateRange=function(t,e,i,n){for(var s=this,r=function(r){var a=Math.max(r.from,i),l=Math.min(r.to,n);if(l>a){var h=t.state.doc.lineAt(a),c=h.toh.from;a--)if(o.boundary.test(h.text[a-1-h.from])){u=a;break}for(;ld},add:f})}},o=this,a=0,l=t.visibleRanges;a{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*FB[*)((_)(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*FB[*)(("+s+")(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let Nm=class{constructor(t,e,i,n,s,r){this.view=e,this.visibleValue=t,this.placeholder=r,console.log(r),this.args=Lm(t.str,/\(\*,\*\)/gm);const o=this;let a,l;console.log("creating InstanceWidget"),a=Im({doc:o.args[0].body.slice(2,-1),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(o.visibleValue.pos),e.dispatch({selection:{anchor:o.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return l.dispatch({selection:{anchor:0}}),l.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){l.focus(),t.editorLastCursor=void 0}}])]}),l=Im({doc:o.args[2].body.slice(1,-2),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:a.state.doc.length}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:o.visibleValue.pos+o.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus(),t.editorLastCursor=void 0}}])]}),o.args[0].length=o.args[0].body.length,o.args[2].length=o.args[2].body.length,delete o.args[2].body,delete o.args[1].body,delete o.args[0].body,this.topEditor=a,this.bottomEditor=l}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="(("+t+")",s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length));const r=e.length-i[0].length;i[0].to=i[0].to+r,i[2].from=i[2].from+r,i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e="("+t+"))",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length));const r=e.length-i[2].length;i[2].to=i[2].to+r,i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t,e){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm),console.log("recreating InstanceWidget"),n=Im.state({doc:e.args[0].body.slice(2,-1),update:t=>e.applyChanges(t,0),eval:()=>{i.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(e.visibleValue.pos),i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus(),t.editorLastCursor=void 0}}])]}),s=Im.state({doc:e.args[2].body.slice(1,-2),update:t=>e.applyChanges(t,2),eval:()=>{e.view.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus(),t.editorLastCursor=void 0}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),console.log(e),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.placeholder=e,this.visibleValue.argsPos=t.argsPos}destroy(){this.topEditor.destroy(),this.bottomEditor.destroy()}},Gm=class extends ei{constructor(t,e,i,n){super(),this.view=i,this.visibleValue=t,this.reference=e,this.placeholder=n}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue,this),!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("fraction");const i=document.createElement("table");i.classList.add("container"),e.appendChild(i);const n=document.createElement("tbody");i.appendChild(n);const s=document.createElement("tr"),r=document.createElement("tr");n.appendChild(s),n.appendChild(r);const o=document.createElement("td");o.classList.add("enumenator"),s.appendChild(o);const a=document.createElement("td");r.appendChild(a);const l=this;return e.EditorWidget=new Nm(this.visibleValue,t,o,a,[],this),this.DOMElement=e,this.reference.push({destroy:()=>{l.destroy(e)}}),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const Fm=(t,e,i)=>new Bm({tag:"FB",decoration:n=>ni.replace({widget:new Gm(n,t,e,i)})}),Hm=t=>_i.fromClass(class{constructor(e){this.disposable=[],this.placeholder=Fm(this.disposable,e,this).createDeco(e),t.placeholder=this}update(t){this.placeholder=Fm(this.disposable,t,this).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var Jm;function Km(t){return Jm=t,[nb,Ys.of([{key:"Ctrl-2",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt[_](*]SqB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt["+s+"](*]SqB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let tb=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;this.sliceRanges=n,this.length=t.str.length,console.log("creating InstanceWidget"),this.editor=Jm({doc:t.str.slice(...n),parent:i,update:t=>r.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]})}applyChanges(t){const e=t,i={from:this.visibleValue.argsPos+5,to:this.visibleValue.argsPos+this.length-1,insert:e};console.log(this.visibleValue);const n=e.length+6-this.length;this.length=this.length+n,this.visibleValue.length=this.visibleValue.length+n,this.visibleValue.str="Sqrt["+e+"]",this.view.dispatch({changes:i})}update(t){if(this.visibleValue.str==t.str)this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos;else{console.warn("Out of sync"),this.visibleValue=t;const e=this.sliceRanges,i=this.editor,n=this,s=this.view;this.length=t.str.length;const r=Jm.state({doc:t.str.slice(...e),update:t=>n.applyChanges(t),eval:()=>{s.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos+n.visibleValue.length}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]});i.setState(r)}}destroy(){console.warn("destroy Instance of Widget!"),this.editor.destroy()}},eb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("sqroot");const i=this,n=document.createElement("span");return n.classList.add("radicand"),e.EditorWidget=new tb(this.visibleValue,t,n,[5,-1],[]),e.appendChild(n),this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const ib=(t,e)=>new Bm({tag:"SqB",decoration:i=>ni.replace({widget:new eb(i,t,e)})}),nb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=ib(this.disposable,t).createDeco(t)}update(t){this.placeholder=ib(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var sb;function rb(t){return sb=t,[hb,Ys.of([{key:"Ctrl--",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SbB[*)Subscript[_(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SbB[*)Subscript["+s+"(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let ob=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),console.log(r.visibleValue),o=sb({doc:r.args[0].body.slice(10),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){a.focus()}}])]}),a=sb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Subscript["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),console.log(e.visibleValue),n=sb.state({doc:e.args[0].body.slice(10),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus()}}])]}),s=sb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},ab=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sub");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new ob(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const lb=(t,e)=>new Bm({tag:"SbB",decoration:i=>ni.replace({widget:new ab(i,t,e)})}),hb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=lb(this.disposable,t).createDeco(t)}update(t){this.placeholder=lb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var cb;function ub(t){return cb=t,[Ob,Ys.of([{key:"Ctrl-6",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SpB[*)Power[_(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SpB[*)Power["+s+"(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let db=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),o=cb({doc:r.args[0].body.slice(6),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus()}}])]}),a=cb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Power["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),n=cb.state({doc:e.args[0].body.slice(6),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.bottomEditor.focus()}}])]}),s=cb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},fb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sup");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new db(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}destroy(t){t.EditorWidget.destroy()}};const pb=(t,e)=>new Bm({tag:"SpB",decoration:i=>ni.replace({widget:new fb(i,t,e)})}),Ob=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=pb(this.disposable,t).createDeco(t)}update(t){this.placeholder=pb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var gb={},mb={},bb={},wb={};function vb(t){let e=t.length;for(;--e>=0;)t[e]=0}const yb=256,Sb=286,xb=30,kb=15,Qb=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),$b=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Pb=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Cb=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_b=new Array(576);vb(_b);const Xb=new Array(60);vb(Xb);const Zb=new Array(512);vb(Zb);const Ab=new Array(256);vb(Ab);const Tb=new Array(29);vb(Tb);const Rb=new Array(xb);function Eb(t,e,i,n,s){this.static_tree=t,this.extra_bits=e,this.extra_base=i,this.elems=n,this.max_length=s,this.has_stree=t&&t.length}let Vb,Mb,Db;function Wb(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}vb(Rb);const Ub=t=>t<256?Zb[t]:Zb[256+(t>>>7)],Yb=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},qb=(t,e,i)=>{t.bi_valid>16-i?(t.bi_buf|=e<>16-t.bi_valid,t.bi_valid+=i-16):(t.bi_buf|=e<{qb(t,i[2*e],i[2*e+1])},zb=(t,e)=>{let i=0;do{i|=1&t,t>>>=1,i<<=1}while(--e>0);return i>>>1},Ib=(t,e,i)=>{const n=new Array(16);let s,r,o=0;for(s=1;s<=kb;s++)o=o+i[s-1]<<1,n[s]=o;for(r=0;r<=e;r++){let e=t[2*r+1];0!==e&&(t[2*r]=zb(n[e]++,e))}},Bb=t=>{let e;for(e=0;e{t.bi_valid>8?Yb(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},Nb=(t,e,i,n)=>{const s=2*e,r=2*i;return t[s]{const n=t.heap[i];let s=i<<1;for(;s<=t.heap_len&&(s{let n,s,r,o,a=0;if(0!==t.sym_next)do{n=255&t.pending_buf[t.sym_buf+a++],n+=(255&t.pending_buf[t.sym_buf+a++])<<8,s=t.pending_buf[t.sym_buf+a++],0===n?Lb(t,s,e):(r=Ab[s],Lb(t,r+yb+1,e),o=Qb[r],0!==o&&(s-=Tb[r],qb(t,s,o)),n--,r=Ub(n),Lb(t,r,i),o=$b[r],0!==o&&(n-=Rb[r],qb(t,n,o)))}while(a{const i=e.dyn_tree,n=e.stat_desc.static_tree,s=e.stat_desc.has_stree,r=e.stat_desc.elems;let o,a,l,h=-1;for(t.heap_len=0,t.heap_max=573,o=0;o>1;o>=1;o--)Gb(t,i,o);l=r;do{o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Gb(t,i,1),a=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=a,i[2*l]=i[2*o]+i[2*a],t.depth[l]=(t.depth[o]>=t.depth[a]?t.depth[o]:t.depth[a])+1,i[2*o+1]=i[2*a+1]=l,t.heap[1]=l++,Gb(t,i,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const i=e.dyn_tree,n=e.max_code,s=e.stat_desc.static_tree,r=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,l=e.stat_desc.max_length;let h,c,u,d,f,p,O=0;for(d=0;d<=kb;d++)t.bl_count[d]=0;for(i[2*t.heap[t.heap_max]+1]=0,h=t.heap_max+1;h<573;h++)c=t.heap[h],d=i[2*i[2*c+1]+1]+1,d>l&&(d=l,O++),i[2*c+1]=d,c>n||(t.bl_count[d]++,f=0,c>=a&&(f=o[c-a]),p=i[2*c],t.opt_len+=p*(d+f),r&&(t.static_len+=p*(s[2*c+1]+f)));if(0!==O){do{for(d=l-1;0===t.bl_count[d];)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[l]--,O-=2}while(O>0);for(d=l;0!==d;d--)for(c=t.bl_count[d];0!==c;)u=t.heap[--h],u>n||(i[2*u+1]!==d&&(t.opt_len+=(d-i[2*u+1])*i[2*u],i[2*u+1]=d),c--)}})(t,e),Ib(i,h,t.bl_count)},Jb=(t,e,i)=>{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),e[2*(i+1)+1]=65535,n=0;n<=i;n++)s=o,o=e[2*(n+1)+1],++a{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),n=0;n<=i;n++)if(s=o,o=e[2*(n+1)+1],!(++a{qb(t,0+(n?1:0),3),jb(t),Yb(t,i),Yb(t,~i),i&&t.pending_buf.set(t.window.subarray(e,e+i),t.pending),t.pending+=i};wb._tr_init=t=>{tw||((()=>{let t,e,i,n,s;const r=new Array(16);for(i=0,n=0;n<28;n++)for(Tb[n]=i,t=0;t<1<>=7;n{let s,r,o=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e{let e;for(Jb(t,t.dyn_ltree,t.l_desc.max_code),Jb(t,t.dyn_dtree,t.d_desc.max_code),Hb(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*Cb[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=i+5,i+4<=s&&-1!==e?ew(t,e,i,n):4===t.strategy||r===s?(qb(t,2+(n?1:0),3),Fb(t,_b,Xb)):(qb(t,4+(n?1:0),3),((t,e,i,n)=>{let s;for(qb(t,e-257,5),qb(t,i-1,5),qb(t,n-4,4),s=0;s(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=i,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(Ab[i]+yb+1)]++,t.dyn_dtree[2*Ub(e)]++),t.sym_next===t.sym_end),wb._tr_align=t=>{qb(t,2,3),Lb(t,256,_b),(t=>{16===t.bi_valid?(Yb(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)};var iw=(t,e,i,n)=>{let s=65535&t|0,r=t>>>16&65535|0,o=0;for(;0!==i;){o=i>2e3?2e3:i,i-=o;do{s=s+e[n++]|0,r=r+s|0}while(--o);s%=65521,r%=65521}return s|r<<16|0};const nw=new Uint32Array((()=>{let t,e=[];for(var i=0;i<256;i++){t=i;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e})());var sw=(t,e,i,n)=>{const s=nw,r=n+i;t^=-1;for(let i=n;i>>8^s[255&(t^e[i])];return-1^t},rw={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},ow={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:aw,_tr_stored_block:lw,_tr_flush_block:hw,_tr_tally:cw,_tr_align:uw}=wb,dw=iw,fw=sw,pw=rw,{Z_NO_FLUSH:Ow,Z_PARTIAL_FLUSH:gw,Z_FULL_FLUSH:mw,Z_FINISH:bw,Z_BLOCK:ww,Z_OK:vw,Z_STREAM_END:yw,Z_STREAM_ERROR:Sw,Z_DATA_ERROR:xw,Z_BUF_ERROR:kw,Z_DEFAULT_COMPRESSION:Qw,Z_FILTERED:$w,Z_HUFFMAN_ONLY:Pw,Z_RLE:Cw,Z_FIXED:_w,Z_DEFAULT_STRATEGY:Xw,Z_UNKNOWN:Zw,Z_DEFLATED:Aw}=ow,Tw=258,Rw=262,Ew=42,Vw=113,Mw=666,Dw=(t,e)=>(t.msg=pw[e],e),Ww=t=>2*t-(t>4?9:0),Uw=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Yw=t=>{let e,i,n,s=t.w_size;e=t.hash_size,n=e;do{i=t.head[--n],t.head[n]=i>=s?i-s:0}while(--e);e=s,n=e;do{i=t.prev[--n],t.prev[n]=i>=s?i-s:0}while(--e)};let qw=(t,e,i)=>(e<{const e=t.state;let i=e.pending;i>t.avail_out&&(i=t.avail_out),0!==i&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+i),t.next_out),t.next_out+=i,e.pending_out+=i,t.total_out+=i,t.avail_out-=i,e.pending-=i,0===e.pending&&(e.pending_out=0))},zw=(t,e)=>{hw(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Lw(t.strm)},Iw=(t,e)=>{t.pending_buf[t.pending++]=e},Bw=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},jw=(t,e,i,n)=>{let s=t.avail_in;return s>n&&(s=n),0===s?0:(t.avail_in-=s,e.set(t.input.subarray(t.next_in,t.next_in+s),i),1===t.state.wrap?t.adler=dw(t.adler,e,s,i):2===t.state.wrap&&(t.adler=fw(t.adler,e,s,i)),t.next_in+=s,t.total_in+=s,s)},Nw=(t,e)=>{let i,n,s=t.max_chain_length,r=t.strstart,o=t.prev_length,a=t.nice_match;const l=t.strstart>t.w_size-Rw?t.strstart-(t.w_size-Rw):0,h=t.window,c=t.w_mask,u=t.prev,d=t.strstart+Tw;let f=h[r+o-1],p=h[r+o];t.prev_length>=t.good_match&&(s>>=2),a>t.lookahead&&(a=t.lookahead);do{if(i=e,h[i+o]===p&&h[i+o-1]===f&&h[i]===h[r]&&h[++i]===h[r+1]){r+=2,i++;do{}while(h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&ro){if(t.match_start=e,o=n,n>=a)break;f=h[r+o-1],p=h[r+o]}}}while((e=u[e&c])>l&&0!=--s);return o<=t.lookahead?o:t.lookahead},Gw=t=>{const e=t.w_size;let i,n,s;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Rw)&&(t.window.set(t.window.subarray(e,e+e-n),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Yw(t),n+=e),0===t.strm.avail_in)break;if(i=jw(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=i,t.lookahead+t.insert>=3)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=qw(t,t.ins_h,t.window[s+1]);t.insert&&(t.ins_h=qw(t,t.ins_h,t.window[s+3-1]),t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead{let i,n,s,r=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,o=0,a=t.strm.avail_in;do{if(i=65535,s=t.bi_valid+42>>3,t.strm.avail_outn+t.strm.avail_in&&(i=n+t.strm.avail_in),i>s&&(i=s),i>8,t.pending_buf[t.pending-2]=~i,t.pending_buf[t.pending-1]=~i>>8,Lw(t.strm),n&&(n>i&&(n=i),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+n),t.strm.next_out),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n,t.block_start+=n,i-=n),i&&(jw(t.strm,t.strm.output,t.strm.next_out,i),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i)}while(0===o);return a-=t.strm.avail_in,a&&(a>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=a&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-a,t.strm.next_in),t.strstart),t.strstart+=a,t.insert+=a>t.w_size-t.insert?t.w_size-t.insert:a),t.block_start=t.strstart),t.high_waters&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,s+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),s>t.strm.avail_in&&(s=t.strm.avail_in),s&&(jw(t.strm,t.window,t.strstart,s),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.high_water>3,s=t.pending_buf_size-s>65535?65535:t.pending_buf_size-s,r=s>t.w_size?t.w_size:s,n=t.strstart-t.block_start,(n>=r||(n||e===bw)&&e!==Ow&&0===t.strm.avail_in&&n<=s)&&(i=n>s?s:n,o=e===bw&&0===t.strm.avail_in&&i===n?1:0,lw(t,t.block_start,i,o),t.block_start+=i,Lw(t.strm)),o?3:1)},Hw=(t,e)=>{let i,n;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==i&&t.strstart-i<=t.w_size-Rw&&(t.match_length=Nw(t,i)),t.match_length>=3)if(n=cw(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=qw(t,t.ins_h,t.window[t.strstart+1]);else n=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2},Jw=(t,e)=>{let i,n,s;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==i&&t.prev_length4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){s=t.strstart+t.lookahead-3,n=cw(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=s&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(zw(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(n=cw(t,0,t.window[t.strstart-1]),n&&zw(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=cw(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2};function Kw(t,e,i,n,s){this.good_length=t,this.max_lazy=e,this.nice_length=i,this.max_chain=n,this.func=s}const tv=[new Kw(0,0,0,0,Fw),new Kw(4,4,8,4,Hw),new Kw(4,5,16,8,Hw),new Kw(4,6,32,32,Hw),new Kw(4,4,16,16,Jw),new Kw(8,16,32,32,Jw),new Kw(8,16,128,128,Jw),new Kw(8,32,128,256,Jw),new Kw(32,128,258,1024,Jw),new Kw(32,258,258,4096,Jw)];function ev(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Aw,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Uw(this.dyn_ltree),Uw(this.dyn_dtree),Uw(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Uw(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Uw(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const iv=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==Ew&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==Vw&&e.status!==Mw?1:0},nv=t=>{if(iv(t))return Dw(t,Sw);t.total_in=t.total_out=0,t.data_type=Zw;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?Ew:Vw,t.adler=2===e.wrap?0:1,e.last_flush=-2,aw(e),vw},sv=t=>{const e=nv(t);var i;return e===vw&&((i=t.state).window_size=2*i.w_size,Uw(i.head),i.max_lazy_match=tv[i.level].max_lazy,i.good_match=tv[i.level].good_length,i.nice_match=tv[i.level].nice_length,i.max_chain_length=tv[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=2,i.match_available=0,i.ins_h=0),e},rv=(t,e,i,n,s,r)=>{if(!t)return Sw;let o=1;if(e===Qw&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),s<1||s>9||i!==Aw||n<8||n>15||e<0||e>9||r<0||r>_w||8===n&&1!==o)return Dw(t,Sw);8===n&&(n=9);const a=new ev;return t.state=a,a.strm=t,a.status=Ew,a.wrap=o,a.gzhead=null,a.w_bits=n,a.w_size=1<rv(t,e,Aw,15,8,Xw),bb.deflateInit2=rv,bb.deflateReset=sv,bb.deflateResetKeep=nv,bb.deflateSetHeader=(t,e)=>iv(t)||2!==t.state.wrap?Sw:(t.state.gzhead=e,vw),bb.deflate=(t,e)=>{if(iv(t)||e>ww||e<0)return t?Dw(t,Sw):Sw;const i=t.state;if(!t.output||0!==t.avail_in&&!t.input||i.status===Mw&&e!==bw)return Dw(t,0===t.avail_out?kw:Sw);const n=i.last_flush;if(i.last_flush=e,0!==i.pending){if(Lw(t),0===t.avail_out)return i.last_flush=-1,vw}else if(0===t.avail_in&&Ww(e)<=Ww(n)&&e!==bw)return Dw(t,kw);if(i.status===Mw&&0!==t.avail_in)return Dw(t,kw);if(i.status===Ew&&0===i.wrap&&(i.status=Vw),i.status===Ew){let e=Aw+(i.w_bits-8<<4)<<8,n=-1;if(n=i.strategy>=Pw||i.level<2?0:i.level<6?1:6===i.level?2:3,e|=n<<6,0!==i.strstart&&(e|=32),e+=31-e%31,Bw(i,e),0!==i.strstart&&(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),t.adler=1,i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(57===i.status)if(t.adler=0,Iw(i,31),Iw(i,139),Iw(i,8),i.gzhead)Iw(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),Iw(i,255&i.gzhead.time),Iw(i,i.gzhead.time>>8&255),Iw(i,i.gzhead.time>>16&255),Iw(i,i.gzhead.time>>24&255),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(Iw(i,255&i.gzhead.extra.length),Iw(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=fw(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if(Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,3),i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw;if(69===i.status){if(i.gzhead.extra){let e=i.pending,n=(65535&i.gzhead.extra.length)-i.gzindex;for(;i.pending+n>i.pending_buf_size;){let s=i.pending_buf_size-i.pending;if(i.pending_buf.set(i.gzhead.extra.subarray(i.gzindex,i.gzindex+s),i.pending),i.pending=i.pending_buf_size,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex+=s,Lw(t),0!==i.pending)return i.last_flush=-1,vw;e=0,n-=s}let s=new Uint8Array(i.gzhead.extra);i.pending_buf.set(s.subarray(i.gzindex,i.gzindex+n),i.pending),i.pending+=n,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex=0}i.status=73}if(73===i.status){if(i.gzhead.name){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),i.gzindex=0}i.status=91}if(91===i.status){if(i.gzhead.comment){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n))}i.status=103}if(103===i.status){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size&&(Lw(t),0!==i.pending))return i.last_flush=-1,vw;Iw(i,255&t.adler),Iw(i,t.adler>>8&255),t.adler=0}if(i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(0!==t.avail_in||0!==i.lookahead||e!==Ow&&i.status!==Mw){let n=0===i.level?Fw(i,e):i.strategy===Pw?((t,e)=>{let i;for(;;){if(0===t.lookahead&&(Gw(t),0===t.lookahead)){if(e===Ow)return 1;break}if(t.match_length=0,i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):i.strategy===Cw?((t,e)=>{let i,n,s,r;const o=t.window;for(;;){if(t.lookahead<=Tw){if(Gw(t),t.lookahead<=Tw&&e===Ow)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(s=t.strstart-1,n=o[s],n===o[++s]&&n===o[++s]&&n===o[++s])){r=t.strstart+Tw;do{}while(n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&st.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(i=cw(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):tv[i.level].func(i,e);if(3!==n&&4!==n||(i.status=Mw),1===n||3===n)return 0===t.avail_out&&(i.last_flush=-1),vw;if(2===n&&(e===gw?uw(i):e!==ww&&(lw(i,0,0,!1),e===mw&&(Uw(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),Lw(t),0===t.avail_out))return i.last_flush=-1,vw}return e!==bw?vw:i.wrap<=0?yw:(2===i.wrap?(Iw(i,255&t.adler),Iw(i,t.adler>>8&255),Iw(i,t.adler>>16&255),Iw(i,t.adler>>24&255),Iw(i,255&t.total_in),Iw(i,t.total_in>>8&255),Iw(i,t.total_in>>16&255),Iw(i,t.total_in>>24&255)):(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),Lw(t),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?vw:yw)},bb.deflateEnd=t=>{if(iv(t))return Sw;const e=t.state.status;return t.state=null,e===Vw?Dw(t,xw):vw},bb.deflateSetDictionary=(t,e)=>{let i=e.length;if(iv(t))return Sw;const n=t.state,s=n.wrap;if(2===s||1===s&&n.status!==Ew||n.lookahead)return Sw;if(1===s&&(t.adler=dw(t.adler,e,i,0)),n.wrap=0,i>=n.w_size){0===s&&(Uw(n.head),n.strstart=0,n.block_start=0,n.insert=0);let t=new Uint8Array(n.w_size);t.set(e.subarray(i-n.w_size,i),0),e=t,i=n.w_size}const r=t.avail_in,o=t.next_in,a=t.input;for(t.avail_in=i,t.next_in=0,t.input=e,Gw(n);n.lookahead>=3;){let t=n.strstart,e=n.lookahead-2;do{n.ins_h=qw(n,n.ins_h,n.window[t+3-1]),n.prev[t&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=t,t++}while(--e);n.strstart=t,n.lookahead=2,Gw(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,t.next_in=o,t.input=a,t.avail_in=r,n.wrap=s,vw},bb.deflateInfo="pako deflate (from Nodeca project)";var ov={};const av=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);ov.assign=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const e in i)av(i,e)&&(t[e]=i[e])}}return t},ov.flattenChunks=t=>{let e=0;for(let i=0,n=t.length;i=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;cv[254]=cv[254]=1,lv.string2buf=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,i,n,s,r,o=t.length,a=0;for(s=0;s>>6,e[r++]=128|63&i):i<65536?(e[r++]=224|i>>>12,e[r++]=128|i>>>6&63,e[r++]=128|63&i):(e[r++]=240|i>>>18,e[r++]=128|i>>>12&63,e[r++]=128|i>>>6&63,e[r++]=128|63&i);return e};lv.buf2string=(t,e)=>{const i=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let n,s;const r=new Array(2*i);for(s=0,n=0;n4)r[s++]=65533,n+=o-1;else{for(e&=2===o?31:3===o?15:7;o>1&&n1?r[s++]=65533:e<65536?r[s++]=e:(e-=65536,r[s++]=55296|e>>10&1023,r[s++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&hv)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let i="";for(let n=0;n{(e=e||t.length)>t.length&&(e=t.length);let i=e-1;for(;i>=0&&128==(192&t[i]);)i--;return i<0||0===i?e:i+cv[t[i]]>e?i:e};var uv=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const dv=bb,fv=ov,pv=lv,Ov=rw,gv=uv,mv=Object.prototype.toString,{Z_NO_FLUSH:bv,Z_SYNC_FLUSH:wv,Z_FULL_FLUSH:vv,Z_FINISH:yv,Z_OK:Sv,Z_STREAM_END:xv,Z_DEFAULT_COMPRESSION:kv,Z_DEFAULT_STRATEGY:Qv,Z_DEFLATED:$v}=ow;function Pv(t){this.options=fv.assign({level:kv,method:$v,chunkSize:16384,windowBits:15,memLevel:8,strategy:Qv},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new gv,this.strm.avail_out=0;let i=dv.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(i!==Sv)throw new Error(Ov[i]);if(e.header&&dv.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?pv.string2buf(e.dictionary):"[object ArrayBuffer]"===mv.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,i=dv.deflateSetDictionary(this.strm,t),i!==Sv)throw new Error(Ov[i]);this._dict_set=!0}}function Cv(t,e){const i=new Pv(e);if(i.push(t,!0),i.err)throw i.msg||Ov[i.err];return i.result}Pv.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize;let s,r;if(this.ended)return!1;for(r=e===~~e?e:!0===e?yv:bv,"string"==typeof t?i.input=pv.string2buf(t):"[object ArrayBuffer]"===mv.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),(r===wv||r===vv)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(s=dv.deflate(i,r),s===xv)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),s=dv.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===Sv;if(0!==i.avail_out){if(r>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},Pv.prototype.onData=function(t){this.chunks.push(t)},Pv.prototype.onEnd=function(t){t===Sv&&(this.result=fv.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},mb.Deflate=Pv,mb.deflate=Cv,mb.deflateRaw=function(t,e){return(e=e||{}).raw=!0,Cv(t,e)},mb.gzip=function(t,e){return(e=e||{}).gzip=!0,Cv(t,e)},mb.constants=ow;var _v={},Xv={};const Zv=16209;const Av=15,Tv=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Rv=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Ev=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Vv=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Mv=(t,e,i,n,s,r,o,a)=>{const l=a.bits;let h,c,u,d,f,p,O=0,g=0,m=0,b=0,w=0,v=0,y=0,S=0,x=0,k=0,Q=null;const $=new Uint16Array(16),P=new Uint16Array(16);let C,_,X,Z=null;for(O=0;O<=Av;O++)$[O]=0;for(g=0;g=1&&0===$[b];b--);if(w>b&&(w=b),0===b)return s[r++]=20971520,s[r++]=20971520,a.bits=1,0;for(m=1;m0&&(0===t||1!==b))return-1;for(P[1]=0,O=1;O852||2===t&&x>592)return 1;for(;;){C=O-y,o[g]+1=p?(_=Z[o[g]-p],X=Q[o[g]-p]):(_=96,X=0),h=1<>y)+c]=C<<24|_<<16|X|0}while(0!==c);for(h=1<>=1;if(0!==h?(k&=h-1,k+=h):k=0,g++,0==--$[O]){if(O===b)break;O=e[i+o[g]]}if(O>w&&(k&d)!==u){for(0===y&&(y=w),f+=m,v=O-y,S=1<852||2===t&&x>592)return 1;u=k&d,s[u]=w<<24|v<<16|f-r|0}}return 0!==k&&(s[f+k]=O-y<<24|64<<16|0),a.bits=w,0};const Dv=iw,Wv=sw,Uv=function(t,e){let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,y,S,x,k,Q;const $=t.state;i=t.next_in,k=t.input,n=i+(t.avail_in-5),s=t.next_out,Q=t.output,r=s-(e-t.avail_out),o=s+(t.avail_out-257),a=$.dmax,l=$.wsize,h=$.whave,c=$.wnext,u=$.window,d=$.hold,f=$.bits,p=$.lencode,O=$.distcode,g=(1<<$.lenbits)-1,m=(1<<$.distbits)-1;t:do{f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,0===w)Q[s++]=65535&b;else{if(!(16&w)){if(0==(64&w)){b=p[(65535&b)+(d&(1<>>=w,f-=w),f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,!(16&w)){if(0==(64&w)){b=O[(65535&b)+(d&(1<a){t.msg="invalid distance too far back",$.mode=Zv;break t}if(d>>>=w,f-=w,w=s-r,y>w){if(w=y-w,w>h&&$.sane){t.msg="invalid distance too far back",$.mode=Zv;break t}if(S=0,x=u,0===c){if(S+=l-w,w2;)Q[s++]=x[S++],Q[s++]=x[S++],Q[s++]=x[S++],v-=3;v&&(Q[s++]=x[S++],v>1&&(Q[s++]=x[S++]))}else{S=s-y;do{Q[s++]=Q[S++],Q[s++]=Q[S++],Q[s++]=Q[S++],v-=3}while(v>2);v&&(Q[s++]=Q[S++],v>1&&(Q[s++]=Q[S++]))}break}}break}}while(i>3,i-=v,f-=v<<3,d&=(1<(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function hy(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const cy=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode16211?1:0},uy=t=>{if(cy(t))return Nv;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Kv,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,Iv},dy=t=>{if(cy(t))return Nv;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,uy(t)},fy=(t,e)=>{let i;if(cy(t))return Nv;const n=t.state;return e<0?(i=0,e=-e):(i=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?Nv:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=i,n.wbits=e,dy(t))},py=(t,e)=>{if(!t)return Nv;const i=new hy;t.state=i,i.strm=t,i.window=null,i.mode=Kv;const n=fy(t,e);return n!==Iv&&(t.state=null),n};let Oy,gy,my=!0;const by=t=>{if(my){Oy=new Int32Array(512),gy=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Yv(1,t.lens,0,288,Oy,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Yv(2,t.lens,0,32,gy,0,t.work,{bits:5}),my=!1}t.lencode=Oy,t.lenbits=9,t.distcode=gy,t.distbits=5},wy=(t,e,i,n)=>{let s;const r=t.state;return null===r.window&&(r.wsize=1<=r.wsize?(r.window.set(e.subarray(i-r.wsize,i),0),r.wnext=0,r.whave=r.wsize):(s=r.wsize-r.wnext,s>n&&(s=n),r.window.set(e.subarray(i-n,i-n+s),r.wnext),(n-=s)?(r.window.set(e.subarray(i-n,i),0),r.wnext=n,r.whave=r.wsize):(r.wnext+=s,r.wnext===r.wsize&&(r.wnext=0),r.whavepy(t,15),Xv.inflateInit2=py,Xv.inflate=(t,e)=>{let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,y,S,x,k=0;const Q=new Uint8Array(4);let $,P;const C=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(cy(t)||!t.output||!t.input&&0!==t.avail_in)return Nv;i=t.state,i.mode===ey&&(i.mode=iy),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,u=a,d=l,x=Iv;t:for(;;)switch(i.mode){case Kv:if(0===i.wrap){i.mode=iy;break}for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0),h=0,c=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",i.mode=ay;break}if((15&h)!==Jv){t.msg="unknown compression method",i.mode=ay;break}if(h>>>=4,c-=4,S=8+(15&h),0===i.wbits&&(i.wbits=S),S>15||S>i.wbits){t.msg="invalid window size",i.mode=ay;break}i.dmax=1<>8&1),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16182;case 16182:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>8&255,Q[2]=h>>>16&255,Q[3]=h>>>24&255,i.check=Wv(i.check,Q,4,0)),h=0,c=0,i.mode=16183;case 16183:for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>8),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16184;case 16184:if(1024&i.flags){for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(f=i.length,f>a&&(f=a),f&&(i.head&&(S=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(n.subarray(r,r+f),S)),512&i.flags&&4&i.wrap&&(i.check=Wv(i.check,n,f,r)),a-=f,r+=f,i.length-=f),i.length))break t;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===a)break t;f=0;do{S=n[r+f++],i.head&&S&&i.length<65536&&(i.head.name+=String.fromCharCode(S))}while(S&&f>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=ey;break;case 16189:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>=7&c,c-=7&c,i.mode=oy;break}for(;c<3;){if(0===a)break t;a--,h+=n[r++]<>>=1,c-=1,3&h){case 0:i.mode=16193;break;case 1:if(by(i),i.mode=sy,e===zv){h>>>=2,c-=2;break t}break;case 2:i.mode=16196;break;case 3:t.msg="invalid block type",i.mode=ay}h>>>=2,c-=2;break;case 16193:for(h>>>=7&c,c-=7&c;c<32;){if(0===a)break t;a--,h+=n[r++]<>>16^65535)){t.msg="invalid stored block lengths",i.mode=ay;break}if(i.length=65535&h,h=0,c=0,i.mode=ny,e===zv)break t;case ny:i.mode=16195;case 16195:if(f=i.length,f){if(f>a&&(f=a),f>l&&(f=l),0===f)break t;s.set(n.subarray(r,r+f),o),a-=f,r+=f,l-=f,o+=f,i.length-=f;break}i.mode=ey;break;case 16196:for(;c<14;){if(0===a)break t;a--,h+=n[r++]<>>=5,c-=5,i.ndist=1+(31&h),h>>>=5,c-=5,i.ncode=4+(15&h),h>>>=4,c-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=ay;break}i.have=0,i.mode=16197;case 16197:for(;i.have>>=3,c-=3}for(;i.have<19;)i.lens[C[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,$={bits:i.lenbits},x=Yv(0,i.lens,0,19,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid code lengths set",i.mode=ay;break}i.have=0,i.mode=16198;case 16198:for(;i.have>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=g,c-=g,i.lens[i.have++]=b;else{if(16===b){for(P=g+2;c>>=g,c-=g,0===i.have){t.msg="invalid bit length repeat",i.mode=ay;break}S=i.lens[i.have-1],f=3+(3&h),h>>>=2,c-=2}else if(17===b){for(P=g+3;c>>=g,c-=g,S=0,f=3+(7&h),h>>>=3,c-=3}else{for(P=g+7;c>>=g,c-=g,S=0,f=11+(127&h),h>>>=7,c-=7}if(i.have+f>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=ay;break}for(;f--;)i.lens[i.have++]=S}}if(i.mode===ay)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=ay;break}if(i.lenbits=9,$={bits:i.lenbits},x=Yv(1,i.lens,0,i.nlen,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid literal/lengths set",i.mode=ay;break}if(i.distbits=6,i.distcode=i.distdyn,$={bits:i.distbits},x=Yv(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,$),i.distbits=$.bits,x){t.msg="invalid distances set",i.mode=ay;break}if(i.mode=sy,e===zv)break t;case sy:i.mode=ry;case ry:if(a>=6&&l>=258){t.next_out=o,t.avail_out=l,t.next_in=r,t.avail_in=a,i.hold=h,i.bits=c,Uv(t,d),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,i.mode===ey&&(i.back=-1);break}for(i.back=0;k=i.lencode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,i.length=b,0===m){i.mode=16205;break}if(32&m){i.back=-1,i.mode=ey;break}if(64&m){t.msg="invalid literal/length code",i.mode=ay;break}i.extra=15&m,i.mode=16201;case 16201:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;k=i.distcode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,64&m){t.msg="invalid distance code",i.mode=ay;break}i.offset=b,i.extra=15&m,i.mode=16203;case 16203:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=ay;break}i.mode=16204;case 16204:if(0===l)break t;if(f=d-l,i.offset>f){if(f=i.offset-f,f>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=ay;break}f>i.wnext?(f-=i.wnext,p=i.wsize-f):p=i.wnext-f,f>i.length&&(f=i.length),O=i.window}else O=s,p=o-i.offset,f=i.length;f>l&&(f=l),l-=f,i.length-=f;do{s[o++]=O[p++]}while(--f);0===i.length&&(i.mode=ry);break;case 16205:if(0===l)break t;s[o++]=i.length,l--,i.mode=ry;break;case oy:if(i.wrap){for(;c<32;){if(0===a)break t;a--,h|=n[r++]<{if(cy(t))return Nv;let e=t.state;return e.window&&(e.window=null),t.state=null,Iv},Xv.inflateGetHeader=(t,e)=>{if(cy(t))return Nv;const i=t.state;return 0==(2&i.wrap)?Nv:(i.head=e,e.done=!1,Iv)},Xv.inflateSetDictionary=(t,e)=>{const i=e.length;let n,s,r;return cy(t)?Nv:(n=t.state,0!==n.wrap&&n.mode!==ty?Nv:n.mode===ty&&(s=1,s=Dv(s,e,i,0),s!==n.check)?Gv:(r=wy(t,e,i,i),r?(n.mode=16210,Fv):(n.havedict=1,Iv)))},Xv.inflateInfo="pako inflate (from Nodeca project)";const vy=Xv,yy=ov,Sy=lv,xy=rw,ky=uv,Qy=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},$y=Object.prototype.toString,{Z_NO_FLUSH:Py,Z_FINISH:Cy,Z_OK:_y,Z_STREAM_END:Xy,Z_NEED_DICT:Zy,Z_STREAM_ERROR:Ay,Z_DATA_ERROR:Ty,Z_MEM_ERROR:Ry}=ow;function Ey(t){this.options=yy.assign({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ky,this.strm.avail_out=0;let i=vy.inflateInit2(this.strm,e.windowBits);if(i!==_y)throw new Error(xy[i]);if(this.header=new Qy,vy.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=Sy.string2buf(e.dictionary):"[object ArrayBuffer]"===$y.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(i=vy.inflateSetDictionary(this.strm,e.dictionary),i!==_y)))throw new Error(xy[i])}function Vy(t,e){const i=new Ey(e);if(i.push(t),i.err)throw i.msg||xy[i.err];return i.result}Ey.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize,s=this.options.dictionary;let r,o,a;if(this.ended)return!1;for(o=e===~~e?e:!0===e?Cy:Py,"[object ArrayBuffer]"===$y.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),r=vy.inflate(i,o),r===Zy&&s&&(r=vy.inflateSetDictionary(i,s),r===_y?r=vy.inflate(i,o):r===Ty&&(r=Zy));i.avail_in>0&&r===Xy&&i.state.wrap>0&&0!==t[i.next_in];)vy.inflateReset(i),r=vy.inflate(i,o);switch(r){case Ay:case Ty:case Zy:case Ry:return this.onEnd(r),this.ended=!0,!1}if(a=i.avail_out,i.next_out&&(0===i.avail_out||r===Xy))if("string"===this.options.to){let t=Sy.utf8border(i.output,i.next_out),e=i.next_out-t,s=Sy.buf2string(i.output,t);i.next_out=e,i.avail_out=n-e,e&&i.output.set(i.output.subarray(t,t+e),0),this.onData(s)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(r!==_y||0!==a){if(r===Xy)return r=vy.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},Ey.prototype.onData=function(t){this.chunks.push(t)},Ey.prototype.onEnd=function(t){t===_y&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=yy.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},_v.Inflate=Ey,_v.inflate=Vy,_v.inflateRaw=function(t,e){return(e=e||{}).raw=!0,Vy(t,e)},_v.ungzip=Vy,_v.constants=ow;const{Deflate:My,deflate:Dy,deflateRaw:Wy,gzip:Uy}=mb,{Inflate:Yy,inflate:qy,inflateRaw:Ly,ungzip:zy}=_v,Iy=ow;gb.Deflate=My,gb.deflate=Dy,gb.deflateRaw=Wy,gb.gzip=Uy,gb.Inflate=Yy,gb.inflate=qy,gb.inflateRaw=Ly,gb.ungzip=zy,gb.constants=Iy;const By=gb;let jy={};var Ny;function Gy(t){return Ny=t,[tS]}jy.Util={},jy.Decode={},jy.Messages=[],jy.Log=function(t){jy.Messages.push(["I",t]),console.log("Mma.js INFO: ",t)},jy.Warn=function(t){jy.Messages.push(["W",t]),console.log("Mma.js WARNING: ",t)},jy.Fail=function(t){throw jy.Messages.push(["E",t]),"Mma.js ERROR: "+t},jy.Util.Base64Decode=function(t){for(var e=atob(t),i=e.length>>>0,n=new Uint8Array(i),s=0;s1&&0===t[0]&&jy.Fail("IntegerAP: input starts with 0: "+String(t)),this.nstring=t}else void 0===t?this.nstring=void 0:jy.Fail("Integer: invalid input: "+String(t))},jy.RealMP=function(t){"number"==typeof t?this.n=t:void 0===t?this.n=void 0:jy.Fail("RealMP: invalid input")},jy.RealAP=function(t){"string"==typeof t?(t.length>1&&0===t[0]&&jy.Fail("RealAP: input starts with 0: "+String(t)),this.nstring=t):void 0===t?this.nstring=void 0:jy.Fail("RealAP: invalid input: "+String(t))},jy.Symbol=function(t){"string"==typeof t?this.name=t:void 0===t?this.name=void 0:jy.Fail("Symbol: invalid input: "+String(t))},jy.String=function(t){"string"==typeof t?this.str=t:void 0===t?this.str=void 0:jy.Fail("String: invalid input: "+String(t))},jy.Expression=function(t,e){t instanceof jy.Symbol||jy.Fail("Expression: head must be an Mma.Symbol"),e instanceof Array||jy.Fail("Expression: parts must be an Array"),this.head=t,this.parts=e},jy.Decode.Int32=function(t,e){try{return new DataView(t.buffer).getInt32(e,!0)}catch(t){return 0}},jy.Decode.Float64=function(t,e){try{return new DataView(t.buffer).getFloat64(e,!0)}catch(t){return 0}},jy.Decode.String=function(t,e,i){return void 0===e&&(e=0),void 0===i&&(i=t.length),jy.Util.U8ArrayToString(t.slice(e,e+i))},jy.Decode.StringEntry=function(t,e){void 0===e&&(e=0);var i=jy.Decode.Int32(t,e);return{length:i,string:jy.Decode.String(t,e+4,i),bytesRead:i+4}},jy.Decode.Any=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=1/0);var n=e;for(var s=0,r=[];ee%2!=0?t:{...t,body:Lm(t.body,/\(\*\|\*\)/gm)})),Array.isArray(this.args[this.args.length-1].body)||(this.decorator=this.args.pop());const r=this.args;console.log("creating InstanceWidget");for(let t=0;t{e.viewState.state.config.eval()},update:e=>this.applyChanges(e,t,i),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to&&!t.stringOnly)return i-2>=0?(o[i-2].editor.dispatch({selection:{anchor:o[i-2].editor.state.doc.length}}),o[i-2].editor.focus(),void(t.editorLastCursor=void 0)):(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0));t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to&&!t.stringOnly)return i+2=0)return r[t-2].body[i].editor.focus(),void(e.editorLastCursor=void 0)}},{key:"ArrowDown",run:function(e,n){if(t+2{},focus:()=>{},dispatch:()=>{},stringOnly:!0};const t=l.match(Fy);if(t){a.innerHTML=t[1];const e=jy.DecompressDecode(t[2]),i=jy.toArray(e.parts[0]),n=uuidv4();interpretate(i,{global:{call:n},element:a})}else a.innerHTML=l.slice(1,-1)}delete o[i].body,n.appendChild(a)}i.appendChild(n)}if(this.decorator){const t=jy.DecompressDecode(this.decorator.body.slice(2,-2)),e=jy.toArray(t.parts[0]);let n={global:{call:uuidv4(),EditorWidget:s},element:i};this.interpretated=interpretate(e,n)}}applyChanges(t,e,i){const n=this.args,s=this.args[e].body,r=this.visibleValue.argsPos,o=this.args[e].from;let a=t;0==i&&0==e&&(a="{{"+a),0==i&&0!=e&&(a="{"+a),i==s.length-1&&e==n.length-1&&(a+="}}"),i==s.length-1&&e!=n.length-1&&(a+="}");const l=s[i].length,h={from:r+o+s[i].from,to:r+o+s[i].from+l,insert:a},c=a.length-l;for(let t=i+1;t{s.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.args[0].body[0].editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.args[0].body[0].editor.focus();else{const t=this.DOMElement.EditorWidget.args,e=t[t.length-1].body[t[t.length-1].body.length-1].editor;e.dispatch({selection:{anchor:e.state.doc.length}}),e.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const Ky=(t,e)=>new Bm({tag:"GB",decoration:i=>ni.replace({widget:new Jy(i,t,e)})}),tS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=Ky(this.disposable,t).createDeco(t)}update(t){this.placeholder=Ky(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});function eS(t){return[rS]}let iS=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.span=i,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this,r=this.args[1].body.slice(3,-3),o=jy.DecompressDecode(r),a=jy.toArray(o.parts[0]);this.data=a;const l="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}));this.cuid=l;let h={call:l,EditorWidget:s},c={global:h,element:i};this.expression=a,this.env=c,this.interpretated=interpretate(a,c),this.interpretated.then((()=>{if(c.options?.Event){console.warn("Event listeners are enabled!"),s.events=c.options.Event;let t=c;if(h.stack){const e=Object.values(h.stack);e.length>0&&(console.log("Attaching first found instance..."),t=e[0].env)}interpretate(["MetaMarker","'"+l+"'"],t).then((()=>{server.kernel.emitt(s.events,'"'+l+'"',"Mounted")}))}}))}getDoc(){return this.args[0].body.slice(1,-1)}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+t+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].length=s.length,this.view.dispatch({changes:r})}applyOuterChanges(t){const e=this.visibleValue,i=t,n={from:e.pos,to:e.pos+e.length,insert:i};this.view.dispatch({changes:n})}update(t){if(!this.deactivated){if(t.str!=this.visibleValue.str){console.warn("Out of sync"),console.log("recreate..."),this.destroy();const e=this.span;return e.replaceChildren(),void this._construct(t,this.view,e)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}}destroy(t){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.events&&server.kernel.emitt(this.events,'"'+this.cuid+'"',"Destroy"),delete this.data}},nS=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=this;let i=document.createElement("span");return i.classList.add("frontend-view"),i.EditorWidget=new iS(this.visibleValue,t,i),this.reference.push({destroy:()=>{e.destroy(i)}}),i}ignoreEvent(){return!0}destroy(t){console.log("destroy in general*"),t.EditorWidget.destroy()}};const sS=(t,e)=>new Bm({tag:"VB",decoration:i=>ni.replace({widget:new nS(i,t,e)})}),rS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=sS(this.disposable,t).createDeco(t)}update(t){this.placeholder=sS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var oS;function aS(t){return oS=t,[uS]}let lS=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.span=i,this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this;this.epilog={offset:0,string:""},this.prolog={offset:0,string:""};const r=this.args[1].body.slice(3,-3),o=jy.DecompressDecode(r),a=jy.toArray(o.parts[0]);this.data=a;let l={global:{call:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)})),element:i,origin:s},element:i};this.env=l,interpretate(a,l).then((()=>{if(l.options?.Head&&(s.prolog.offset=l.options.Head.length+1,s.prolog.string=l.options.Head+"[",s.epilog.offset=1,s.epilog.string="]"),l.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=l.options.Event),l.options?.String){s.prolog.offset=1,s.prolog.string='"',s.epilog.offset=1,s.epilog.string='"',l.options?.HeadString&&(s.prolog.string=l.options.HeadString,s.prolog.offset=s.prolog.string.length),l.options?.TailString&&(s.epilog.string=l.options.TailString,s.epilog.offset=s.epilog.string.length),s.editor={destroy:()=>{console.log("Nothing to destroy, this is just a text field.")}};const t=document.createElement("span");return this.aa,t.onkeydown=function(t){13===t.keyCode&&t.preventDefault()},t.contentEditable="plaintext-only",t.innerText=s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),t.addEventListener("input",console.log),t.addEventListener("input",(()=>{console.log("Update"),console.log(t.innerText),this.applyChanges(t.innerText)})),l.global.element.appendChild(t),void(s.events&&server.kernel.emitt(s.events,"Null","Mounted"))}s.editor=oS({doc:s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),parent:l.global.element,update:t=>this.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos+s.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]}),s.events&&server.kernel.emitt(s.events,"Null","Mounted")}))}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+this.prolog.string+t+this.epilog.string+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length));const o=s.length-i[0].length;i[0].length=s.length,this.visibleValue.length=this.visibleValue.length+o,this.view.dispatch({changes:r})}update(t){if(this.visibleValue.str!=t.str)return console.warn("Out of sync"),console.log("recreating InstanceWidget"),this.destroy(),this.span.replaceChildren(),void this._construct(t,this.view,this.span);this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.editor.destroy(),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}},hS=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("subscript-tail"),e.EditorWidget=new lS(this.visibleValue,t,e,[]);const i=this;return this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const cS=(t,e)=>new Bm({tag:"BB",decoration:i=>ni.replace({widget:new hS(i,t,e)})}),uS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=cS(this.disposable,t).createDeco(t)}update(t){this.placeholder=cS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var dS;function fS(t){return dS=t,[mS]}class pS{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm);const s=this,r=Array.from({length:Math.ceil((s.args.length-3)/2)},((t,e)=>2*e+1));s.indexes=r;const o=[];this.span=i,this.spans=o;for(let t=0;t{c.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=c.options.Event),s.editors=r.map(((t,i)=>dS({doc:s.args[t].body,parent:o[i],update:e=>this.applyChanges(e,t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i>0?s.editors[i-1].focus():(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus()),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return it.destroy())),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}}class OS extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("inline-flex"),e.EditorWidget=new pS(this.visibleValue,t,e,[]);const i=this;return this.DOMElement=e,this.reference.push({destroy:()=>{i.destroy(e)}}),e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;const n=this.DOMElement.EditorWidget.editors;return t.from-e.from<0?(n[n.length-1].dispatch({selection:{anchor:n[n.length-1].state.doc.length}}),n[n.length-1].focus()):(n[0].dispatch({selection:{anchor:0}}),n[0].focus()),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}}const gS=(t,e)=>new Bm({tag:"TB",decoration:i=>ni.replace({widget:new OS(i,t,e)})}),mS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=gS(this.disposable,t).createDeco(t)}update(t){this.placeholder=gS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});const bS=_i.fromClass(class{decorations=ni.none;constructor(t){this.view=t,this.recompute()}recompute(t){let e,i,n=[];for(let{from:t,to:e}of this.view.visibleRanges)this.getDecorationsFor(t,e,n);this.decorations=ni.set(n,!0),this.decorations=this.decorations.update({filter:(n,s)=>!(n>e&&s=e&&s.selection.main.head<=i)return!0;if(!n&&s.selection.main.head>e&&s.selection.main.headt.decorations});class wS extends ei{constructor(t,e){super(),this.rawValue=t,this.visibleValue=e}eq(t){return this.rawValue===t.rawValue}toDOM(){let t=document.createElement("div");t.classList.add("cell-type-widget");const e=this.rawValue.split(" "),i=e[0].split(".");if(console.log(i),t.classList.add("cell-type-"+i[1].trim()),t.innerText=e[0].trim(),e.length>1){const n=e.slice(1),s=document.createElement("span");return s.appendChild(t),n.forEach((t=>{const e=document.createElement("span");e.innerText=t,e.classList.add("cell-type-"+i[1].trim()+"-"+t.split("=")[0]),s.appendChild(e)})),s}return t}ignoreEvent(){return!1}}const vS=new F,yS=new F,SS=[],xS=Sl.define([{tag:Sa.meta,color:"var(--editor-key-meta)"},{tag:Sa.link,textDecoration:"underline"},{tag:Sa.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Sa.emphasis,fontStyle:"italic"},{tag:Sa.strong,fontWeight:"bold"},{tag:Sa.strikethrough,textDecoration:"line-through"},{tag:Sa.keyword,color:"var(--editor-key-keyword)"},{tag:[Sa.atom,Sa.bool,Sa.url,Sa.contentSeparator,Sa.labelName],color:"var(--editor-key-atom)"},{tag:[Sa.literal,Sa.inserted],color:"var(--editor-key-literal)"},{tag:[Sa.string,Sa.deleted],color:"var(--editor-key-string)"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],color:"var(--editor-key-escape)"},{tag:Sa.definition(Sa.variableName),color:"var(--editor-key-variable)"},{tag:Sa.local(Sa.variableName),color:"var(--editor-local-variable)"},{tag:[Sa.typeName,Sa.namespace],color:"var(--editor-key-type)"},{tag:Sa.className,color:"var(--editor-key-class)"},{tag:[Sa.special(Sa.variableName),Sa.macroName],color:"var(--editor-special-variable)"},{tag:Sa.definition(Sa.propertyName),color:"var(--editor-key-property)"},{tag:Sa.comment,color:"var(--editor-key-comment)"},{tag:Sa.invalid,color:"var(--editor-key-invalid)"}]),kS={data:[],extend:t=>{kS.data.push(...t),Qm.reBuild(kS.data)},replaceAll:t=>{kS.data=t,Qm.reBuild(kS.data)}},QS=Gl.define({name:"spreadsheet",startState:function(){return{stringType:null,stack:[]}},token:function(t,e){if(t){switch(0===e.stack.length&&('"'!=t.peek()&&"'"!=t.peek()||(e.stringType=t.peek(),t.next(),e.stack.unshift("string"))),e.stack[0]){case"string":for(;"string"===e.stack[0]&&!t.eol();)t.peek()===e.stringType?(t.next(),e.stack.shift()):"\\"===t.peek()?(t.next(),t.next()):t.match(/^.[^\\\"\']*/);return"string";case"characterClass":for(;"characterClass"===e.stack[0]&&!t.eol();)t.match(/^[^\]\\]+/)||t.match(/^\\./)||e.stack.shift();return"operator"}var i=t.peek();switch(i){case"[":return t.next(),e.stack.unshift("characterClass"),"bracket";case":":return t.next(),"operator";case"\\":return t.match(/\\[a-z]+/)?"string.special":(t.next(),"atom");case".":case",":case";":case"*":case"-":case"+":case"^":case"<":case"/":case"=":return t.next(),"atom";case"$":return t.next(),"builtin"}return t.match(/\d+/)?t.match(/^\w+/)?"error":"number":t.match(/^[a-zA-Z_]\w*/)?t.match(/(?=[\(.])/,!1)?"keyword":"variable":-1!=["[","]","(",")","{","}"].indexOf(i)?(t.next(),"bracket"):(t.eatSpace()||t.next(),null)}}}),$S=new RegExp(/^[\w]*\.[\w]+/);function PS(t){const e=$S.exec(t),i=Object.values(window.SupportedLanguages);for(let t=0;t{if(!t.docChanged)return null;let e=PS(t.newDoc.line(1).text);if(e.legacy){const i=t.startState.facet(Wa);if(i){if(i.name==e.name)return null}else if(t.startState.facet(CS)==e.name)return null;return console.log("switching... to "+e.name),{effects:vS.reconfigure(e.plugins)}}return e.name===t.startState.facet(Wa).name?null:(console.log("switching... to "+e.name),{effects:vS.reconfigure(e.plugins)})}));let XS,ZS=null;const AS=t=>{const e=t||XS;return e&&e.viewState?(console.log(),PS(e.state.doc.line(1).text).name):""},TS=t=>{const e=t||XS;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return!1;const n=i[0];return[n.from,n.to]},RS=t=>{const e=t||XS;return e&&e.viewState?e.state.doc.toString():""},ES=t=>{const e=t||XS;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return"";const n=i[0];return console.log("yoko"),console.log(n),console.log(e.state.doc.toString().slice(n.from,n.to)),console.log("processing"),e.state.doc.toString().slice(n.from,n.to)},VS=(t,e)=>{const i=e||XS;if(!i)return;if(!i.viewState)return;const n=i.viewState.state.selection.ranges;if(!n.length)return;const s=n[0];console.log("result"),console.log(t),i.dispatch({changes:{...s,insert:t}})},MS=()=>XS,DS=(t,e)=>{const i=e||XS;i&&i.viewState&&(console.log("result"),console.log(t),i.dispatch({changes:{from:0,to:i.viewState.state.doc.length,insert:t}}))};ZS=t=>{let e=new Ts({doc:t.doc,extensions:[Ys.of([{key:"Tab",run:function(t,e){return sd(t)}},{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,zS,Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(XS=e.view)}))],parent:t.parent});return e.viewState.state.config.eval=t.eval,e},ZS.state=t=>{let e=xt.create({doc:t.doc,extensions:[Ys.of([{key:"Tab",run:function(t,e){return sd(t)}},{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,zS,Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(XS=e.view)}))]});return e.config.eval=t.eval,e};const WS=(t,e)=>{if(!t||e<=0)return[];const i=[];for(let n=0;n{if(console.log(e.dom.ocellref),XS=e,e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:DropEvent"]')}},file:(t,e,i,n,s)=>{if(e.dom.ocellref)if(s.length>5242880){const t=WS(s,5242880);t.forEach(((e,s)=>{server.emitt(i,`<|"Data"->"${e}", "Name"->"${n}", "Chunk"->${s+1}, "Chunks"->${t.length}|>`,"Chunk")}))}else server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},YS={transaction:(t,e,i,n)=>{if(console.log(e.dom.ocellref),e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:PasteEvent"]')}},file:(t,e,i,n,s)=>{if(console.log(e.dom.ocellref),e.dom.ocellref)if(s.length>5242880){const t=WS(s,5242880);t.forEach(((e,s)=>{server.emitt(i,`<|"Data"->"${e}", "Name"->"${n}", "Chunk"->${s+1}, "Chunks"->${t.length}|>`,"Chunk")}))}else server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},qS=[Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Cm(US,YS)];let LS=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"}}),zS=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"},".cm-scroller":{"line-height":"inherit","overflow-x":"overlay","overflow-y":"overlay","align-items":"initial"},".cm-content":{padding:"0px 0"},".rainbow-bracket-red":{color:"var(--editor-bracket-1)"},".rainbow-bracket-orange":{color:"var(--editor-bracket-2)"},".rainbow-bracket-yellow":{color:"var(--editor-bracket-3)"},".rainbow-bracket-green":{color:"var(--editor-bracket-4)"},".rainbow-bracket-blue":{color:"var(--editor-bracket-5)"},".rainbow-bracket-indigo":{color:"var(--editor-bracket-6)"},".rainbow-bracket-violet":{color:"var(--editor-bracket-7)"},".rainbow-bracket-red > span":{color:"var(--editor-bracket-1-a)"},".rainbow-bracket-orange > span":{color:"var(--editor-bracket-2-a)"},".rainbow-bracket-yellow > span":{color:"var(--editor-bracket-3-a)"},".rainbow-bracket-green > span":{color:"var(--editor-bracket-4-a)"},".rainbow-bracket-blue > span":{color:"var(--editor-bracket-5-a)"},".rainbow-bracket-indigo > span":{color:"var(--editor-bracket-6-a)"},".rainbow-bracket-violet > span":{color:"var(--editor-bracket-7-a)"}}),IS=!1;const BS=[()=>vr(),()=>Sh(),()=>ir(),()=>dr(),()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xS,{fallback:!1}),()=>tu()],jS={},NS=[()=>vr(),()=>Sh(),()=>ir(),()=>dr(),t=>GS.of(t),()=>jS.gutter?function(t={}){return[eo.of(t),jr(),so]}():[],()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xS,{fallback:!1}),()=>tu(),()=>bS,()=>function(t){return _i.fromClass(class{constructor(e){this.view=e,this.placeholder=ni.set([ni.widget({widget:new kr(t),side:1}).range(0)])}get decorations(){return this.view.state.doc.length?ni.none:this.placeholder}},{decorations:t=>t.decorations})}("Type WL Expression / .md / .js"),()=>xt.allowMultipleSelections.of(!0),(t,e)=>vS.of(e),()=>yS.of(xt.readOnly.of(!1)),()=>_S,()=>{return t?[ou.of(t),Yu]:Yu;var t},(t,e)=>Ys.of([{key:"Tab",run:function(t,e){const i=sd(t);return i||Rc(t)},shift:Ec},{key:"Backspace",run:function(e,i){if(0===e.state.doc.length)return t.origin.remove(),!0}},{key:"ArrowLeft",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus prev"),t.origin.focusPrev(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus next"),t.origin.focusNext(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"Shift-Enter",preventDefault:!0,run:function(e,i){console.log(e.state.doc.toString()),t.origin.eval(e.state.doc.toString())}},...Vc,...Wh,...Ru]),(t,e)=>Ts.updateListener.of((e=>{e.docChanged&&t.origin.save(encodeURIComponent(e.state.doc.toString())),e.selectionSet&&(XS=e.view)})),()=>LS];const GS=E.define();function FS(t){return t.replace(/\\\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\\\:/g,""),16))})).replaceAll("\\:F74E","I").replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))}function HS(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(t=>(+t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+t/4).toString(16)))}core.ReadOnly=()=>"ReadOnly",core.EditorView=async(t,e)=>{let i=await interpretate(t[0],e);i=FS(i),console.log("UNICODE Disaster");const n=await core._getRules(t,e);let s=()=>{},r=()=>{},o=i;const a=[];n.ReadOnly&&a.push(xt.readOnly.of(!0)),n.ForceUpdate&&(e.local.forceUpdate=n.ForceUpdate),n.Event&&(r=t=>{o=t,console.log("editor view emitt data: "+t),server.kernel.emitt(n.Event,'"'+t.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Input")},s=()=>{server.kernel.emitt(n.Event,'"'+o.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Evaluate")}),e.local?e.local.editor=ZS({doc:i,parent:e.element,eval:s,update:r,extensions:a}):ZS({doc:i,parent:e.element,eval:s,update:r,extensions:a}),e.element.style.verticalAlign="inherit"},core.StripOnInput=async()=>{},core.EditorView.update=async(t,e)=>{if(!e.local.editor)return;const i=FS(await interpretate(t[0],e));console.log("editor view: dispatch"),e.local.forceUpdate,e.local.editor.dispatch({changes:{from:0,to:e.local.editor.state.doc.length,insert:i}})},core.EditorView.destroy=async(t,e)=>{await interpretate(t[0],e),e.local&&e.local.editor&&e.local.editor.destroy()},core.EditorView.virtual=!0,core.PreviewCell=(t,e)=>{},window.SupportedLanguages.push({check:t=>null===t,legacy:!0,plugins:qS,name:"mathematica"}),window.SupportedLanguages.push({check:t=>null!=t[0].match(/\w+\.(wl|wls)$/),plugins:qS,legacy:!0,name:"mathematica"}),window.SupportedCells.codemirror={view:class{origin={};editor={};trash=[];forceFocusNext(){IS=!0}focus(t){t>0?this.editor.dispatch({selection:{anchor:0}}):t<0&&this.editor.dispatch({selection:{anchor:this.editor.state.doc.length}}),this.editor.focus()}setContent(t){if(console.warn("content mutation!"),!this.editor.viewState)return;const e=this.editor;console.log("result"),console.log(t),this.editor.dispatch({changes:{from:0,to:e.viewState.state.doc.length,insert:t}})}addDisposable(t){this.trash.push(t)}dispose(){this.editor.destroy()}readOnly(t){this.editor.dispatch({effects:yS.reconfigure(xt.readOnly.of(t))})}constructor(t,e){this.origin=t;const i=this.origin,n=PS(e).plugins,s=this;this.origin.element.ocellref=s;const r=new Ts({doc:(o=e,o.replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))),extensions:NS.map((t=>t(s,n))),parent:this.origin.element});var o;return this.editor=r,this.editor.dom.ocellref=s,this.editor.viewState.state.config.eval=()=>{i.eval(this.editor.state.doc.toString())},IS&&r.focus(),IS=!1,this}},context:{EditorAutocomplete:kS,javascriptLanguage:qf,javascript:Nf,markdownLanguage:rm,markdown:function(t={}){let{codeLanguages:e,defaultCodeLanguage:i,addKeymap:n=!0,base:{parser:s}=sm}=t;if(!(s instanceof Zp))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let r,o=t.extensions?[t.extensions]:[],a=[dm.support];i instanceof Ua?(a.push(i.support),r=i.language):i&&(r=i);let l=e||r?(h=e,c=r,t=>{if(t&&h){let e=null;if(t=/\S*/.exec(t)[0],e="function"==typeof h?h(t):Ya.matchLanguageName(h,t,!0),e instanceof Ya)return e.support?e.support.language.parser:Ta.getSkippingParser(e.load());if(e)return e.parser}return c?c.parser:null}):void 0;var h,c;return o.push(function(t){let{codeParser:e,htmlParser:i}=t,n=Do(((t,n)=>{let s=t.type.id;if(!e||s!=Kf.CodeBlock&&s!=Kf.FencedCode){if(i&&(s==Kf.HTMLBlock||s==Kf.HTMLTag))return{parser:i,overlay:rO(t.node,t.from,t.to)}}else{let i="";if(s==Kf.FencedCode){let e=t.node.getChild(Kf.CodeInfo);e&&(i=n.read(e.from,e.to))}let r=e(i);if(r)return{parser:r,overlay:t=>t.type.id==Kf.CodeText}}return null}));return{wrap:n}}({codeParser:l,htmlParser:dm.language.parser})),n&&a.push(N.high(Ys.of(um))),new Ua(nm(s.configure(o)),a)},htmlLanguage:jg,html:Ng,cssLanguage:kg,css:Qg,EditorView:Ts,EditorState:xt,highlightSpecialChars:vr,syntaxHighlighting:$l,defaultHighlightStyle:xS,editorCustomTheme:LS,foldGutter:function(t={}){let e=Object.assign(Object.assign({},wl),t),i=new vl(e,!0),n=new vl(e,!1),s=_i.fromClass(class{constructor(t){this.from=t.viewport.from,this.markers=this.buildMarkers(t)}update(t){(t.docChanged||t.viewportChanged||t.startState.facet(Wa)!=t.state.facet(Wa)||t.startState.field(dl,!1)!=t.state.field(dl,!1)||Xa(t.startState)!=Xa(t.state)||e.foldingChanged(t))&&(this.markers=this.buildMarkers(t.view))}buildMarkers(t){let e=new Xt;for(let s of t.viewportLineBlocks){let r=fl(t.state,s.from,s.to)?n:ll(t.state,s.from,s.to)?i:null;r&&e.add(s.from,s.from,r)}return e.finish()}}),{domEventHandlers:r}=e;return[s,Ir({class:"cm-foldGutter",markers(t){var e;return(null===(e=t.plugin(s))||void 0===e?void 0:e.markers)||_t.empty},initialSpacer:()=>new vl(e,!1),domEventHandlers:Object.assign(Object.assign({},r),{click:(t,e,i)=>{if(r.click&&r.click(t,e,i))return!0;let n=fl(t.state,e.from,e.to);if(n)return t.dispatch({effects:ul.of(n)}),!0;let s=ll(t.state,e.from,e.to);return!!s&&(t.dispatch({effects:cl.of(s)}),!0)}})}),ml()]},Facet:E,Compartment:F,mathematicaPlugins:qS,legacyLangNameFacet:CS,DropPasteHandlers:Cm,EditorExtensionsMinimal:BS,EditorParameters:jS,EditorExtensions:NS,StateField:q,StateEffect:ut,Decoration:ni,Prec:N,EditorSelection:A,keymap:Ys,ViewPlugin:_i,WidgetType:ei,originFacet:GS,MatchDecorator:pr}},window.OfflineMode&&SS.push(xt.readOnly.of(!0)),core.CellView=async(t,e)=>{const i=await core._getRules(t,e);i.Display||(i.Display="codemirror");const n=await interpretate(t[0],e),s={element:e.element,uid:HS()};i.Style&&(e.element.style=i.Style),i.Class&&e.element.classList.add(...i.Class.split(" ")),i.ImageSize&&(Array.isArray(i.ImageSize)?(e.element.style.width=i.ImageSize[0]+"px",e.element.style.height=i.ImageSize[1]+"px"):e.element.style.width=i.ImageSize+"px"),new window.SupportedCells[i.Display].view(s,n)};const JS={};core.FrontEditorSelected=async(t,e)=>{console.log("check");const i=await interpretate(t[0],e),n=await core._getRules(t,e);let s;switch(n.Editor&&(s=JS[n.Editor],console.log("Editor"),console.log(n.Editor),console.log(s)),i){case"Get":return ES(s);case"Set":let i=await interpretate(t[1],e);VS(i,s);break;case"GetDoc":return RS(s);case"SetDoc":let n=await interpretate(t[1],e);DS(n,s);break;case"Cursor":return TS(s);case"Type":return AS(s);case"Editor":const r=HS();return JS[r]=MS(),r}};window.SupportedCells.shell={view:class{dispose(){}constructor(t,e){this.origin=t;const i=document.createElement("div");return i.classList.add(..."flex sc-b max-h-60 text-sm overflow-y-scroll".split(" ")),i.style.overflowAnchor="auto",i.style.flexDirection="column-reverse",i.innerText=e,this.origin.element.appendChild(i),this}}}; diff --git a/package-lock.json b/package-lock.json index 92284e9..5c7f21a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "wljs-editor", - "version": "0.9.2", + "version": "1.2.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "wljs-editor", - "version": "0.9.2", + "version": "1.2.6", "dependencies": { "@codemirror/lang-css": "^6.2.1", "@codemirror/lang-html": "6.4.2", @@ -28,7 +28,7 @@ "parsel": "^0.3.0", "priceless-mathematica": "^1.2.1", "rainbowbrackets": "^2.0.2", - "rollup": "^3.21.6" + "rollup": "^3.29.5" } }, "node_modules/@ampproject/remapping": { @@ -8328,9 +8328,10 @@ } }, "node_modules/rollup": { - "version": "3.21.6", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.21.6.tgz", - "integrity": "sha512-SXIICxvxQxR3D4dp/3LDHZIJPC8a4anKMHd4E3Jiz2/JnY+2bEjqrOokAauc5ShGVNFHlEFjBXAXlaxkJqIqSg==", + "version": "3.29.5", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.5.tgz", + "integrity": "sha512-GVsDdsbJzzy4S/v3dqWPJ7EfvZJfCHiDqe80IyrF59LYuP+e6U1LJoUqeuqRbwAWoMNoXivMNeNAOf5E22VA1w==", + "license": "MIT", "bin": { "rollup": "dist/bin/rollup" }, diff --git a/package.json b/package.json index 0a3dc4d..ce82276 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wljs-editor", - "version": "1.2.6", + "version": "1.2.7", "description": "WLJS Code editor", "scripts": { "build": "node --max-old-space-size=8192 ./node_modules/.bin/rollup --config rollup.config.mjs", @@ -80,7 +80,7 @@ "label": "Store in notebook", "event": "store_selected", "visible": "selection" - }, + }, { "label": "Simplify", "event": "simplify_selected", @@ -123,7 +123,7 @@ "parsel": "^0.3.0", "priceless-mathematica": "^1.2.1", "rainbowbrackets": "^2.0.2", - "rollup": "^3.21.6" + "rollup": "^3.29.5" }, "resolutions": { "@babel/preset-env": "7.13.8" diff --git a/src/.DS_Store b/src/.DS_Store new file mode 100644 index 0000000000000000000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8&4Fv-7Q=h%1b zNA?Sm{4dl%#sb7}CstxTHe(CXx(nUdi9S3? Date: Thu, 28 Nov 2024 14:44:15 +0100 Subject: [PATCH 23/26] boxitem fix --- src/BoxesWorkarounds.wl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/BoxesWorkarounds.wl b/src/BoxesWorkarounds.wl index 57c2871..5a88f4b 100644 --- a/src/BoxesWorkarounds.wl +++ b/src/BoxesWorkarounds.wl @@ -592,6 +592,9 @@ Unprotect[BoxForm`SummaryItem] BoxForm`SummaryItem[{label_String, view_}] := BoxForm`SummaryItemView[label, EditorView[ToString[view, StandardForm], "ReadyOnly"->True]] +BoxForm`SummaryItem[{label_String}] := BoxForm`SummaryItemView[label, ""] + + BoxForm`IconsStore = <||>; BoxForm`temporal = {}; From fa8420a58ea843231df22a9e02021e4c1af7795f Mon Sep 17 00:00:00 2001 From: Kirill Vasin Date: Thu, 28 Nov 2024 21:56:58 +0100 Subject: [PATCH 24/26] fixed autocompete --- package.json | 2 +- src/Autocomplete.wl | 2 +- src/AutocompleteKernel.wl | 11 ++++++++++- src/autocomplete.js | 6 +++++- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index ce82276..43cb173 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wljs-editor", - "version": "1.2.7", + "version": "1.2.8", "description": "WLJS Code editor", "scripts": { "build": "node --max-old-space-size=8192 ./node_modules/.bin/rollup --config rollup.config.mjs", diff --git a/src/Autocomplete.wl b/src/Autocomplete.wl index f5c61ee..aedda11 100644 --- a/src/Autocomplete.wl +++ b/src/Autocomplete.wl @@ -32,7 +32,7 @@ attachListeners[notebook_Notebook] := With[{}, EventHandler[notebook // EventClone, { "OnWebSocketConnected" -> Function[payload, Kernel`Init[notebook["Evaluator"]["Kernel"], Unevaluated[ - Notebook`Autocomplete`Private`BuildVocabular; + Notebook`Autocomplete`Private`BuildVocabularAsync; Notebook`Autocomplete`Private`StartTracking; ], "Once"->True]; diff --git a/src/AutocompleteKernel.wl b/src/AutocompleteKernel.wl index aaee583..2c5c9b3 100644 --- a/src/AutocompleteKernel.wl +++ b/src/AutocompleteKernel.wl @@ -22,12 +22,16 @@ shareDefinitions[cli_, set_List] := With[{ EventHandler["autocomplete", { "Connect" -> Function[Null, With[{client = Global`$Client}, + + clients = Append[clients, client]; If[Internal`Kernel`Type =!= "LocalKernel", Echo["Error. Autocomplete package can only for on LocalKernel. MasterKernel is not allowed!"]; EventRemove["autocomplete"]; Return[$Failed]; ]; BuildVocabular; + If[Length[definitions] != 0, + shareDefinitions[client, definitions]; ]; ] @@ -41,12 +45,17 @@ skip = -1; blacklist = {"CodeParser`", "Notebook`Autocomplete`", "KirillBelov`LTP`JerryI`Events`","KirillBelov`CSockets`EventsExtension`","JerryI`Misc`WLJS`Transport`","KirillBelov`WebSocketHandler`","KirillBelov`TCPServer`","KirillBelov`LTP`","KirillBelov`Internal`","KirillBelov`CSockets`","HighlightingCompatibility`","System`","Global`"}; +BuildVocabularAsync := With[{}, + BuildVocabularAsync = Null; + SessionSubmit[BuildVocabular]; +] + BuildVocabular := With[{}, BuildVocabular = Null; If[Internal`Kernel`Type =!= "LocalKernel", Echo["Error. Autocomplete package can only for on LocalKernel. MasterKernel is not allowed!"]; Return[$Failed]; ]; - Echo["Buildind vocabular for autocomplete..."]; + (* Echo["Buildind vocabular for autocomplete..."]; *) With[{r = Flatten[( ((*Echo[#]; *){#, Information[#, "Usage"]}) &/@ Names[#<>"*"] ) &/@ Complement[$ContextPath, blacklist], 1]}, definitions = Join[definitions, r] // DeleteDuplicates; ]; diff --git a/src/autocomplete.js b/src/autocomplete.js index 70e58dc..39932ea 100644 --- a/src/autocomplete.js +++ b/src/autocomplete.js @@ -1,5 +1,7 @@ const codemirror = window.SupportedCells['codemirror'].context; +let timeout = false; + core.UIAutocompleteConnect = async (args, env) => { console.log('Autocomplete connected to a server'); const hash = await interpretate(args[0], env); @@ -17,11 +19,13 @@ core.UIAutocompleteConnect = async (args, env) => { } else { codemirror.EditorAutocomplete.replaceAll(JSON.parse(localStorage.getItem("codemirror-autocomplete"))); } - + server.kernel.emitt('autocomplete', 'True', 'Connect'); } core.UIAutocompleteExtend = async (args, env) => { + + const data = await interpretate(args[0], env); console.log('Autocomplete populate with ' + data.length + ' symbols'); From 9418a618174001c116faa0cedf4f4ab16f556ef0 Mon Sep 17 00:00:00 2001 From: Kirill Vasin Date: Fri, 29 Nov 2024 13:13:39 +0100 Subject: [PATCH 25/26] nonselectable EditorView + Autocomplete rebuild --- .DS_Store | Bin 8196 -> 10244 bytes dist/kernel.js | 8 +++++ dist/kernel.min.js | 2 +- package.json | 2 +- src/AutocompleteDefaults.wl | 2 ++ src/AutocompleteKernel.wl | 58 ++++++++++++++++++++++++++++++++++-- src/BoxesWorkarounds.wl | 4 +-- src/Notifications.wl | 18 +++++++++++ src/NotificationsKernel.wl | 24 +++++++++++++-- src/kernel.js | 8 +++++ 10 files changed, 118 insertions(+), 8 deletions(-) diff --git a/.DS_Store b/.DS_Store index 066b5f24cc03a73b8fd6e84beee1585174c29335..25c975cd61e5e876e9989d80d2d4b1b9e971767a 100644 GIT binary patch literal 10244 zcmeGhTWl0n^qlDeGY;5kDFRE2D^-e6%NE+&qQLfLg#xX8(3V%(-I=x{vom#PwgoF% z{RH(>jYdUH)M$bq0zRVt7@{V|L~M)@jePiH#3(-|V1k}IcXsJ+TYezY#JQWf=iYlB z_nvdlxpVF;0ANE(tpo@GfJhI6%6zJ(DGbk^DMj!`f&`KHVT)nKV}=!@zA}Z{AMh>U zTfnz~Zvo!|z6EB31?Zj4iYRmF*S-aO3-}huSb&`mA$k~$cyOFU_voO?y#f#n(6C#m z?WX<&Lu`Ox#Dn7;(g+pgtOPkLdRGkeZVt%V2_Nz3$2sKefbPsB$D0|w8wz?C4-C2F zfDsP;+P8pjfvFZ?clQ9Opo0xg&i%cfa25Z!#bwOU#YXL6@1Fl*Y}n9kCmjABg}lI= zx%0$%qAc$19I{3`ov4$t8=}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^Sflh0%?3=(14devT*TevYRO r`y9WD9!BfkqTP1H8yn})WhWY!o#21;XMlhIXXd|J{QLj^?*9KTXfXVf delta 97 zcmZn(XmOBWU|?W$DortDU;r^WfEYvza8E20o2aMAD7rCVH$S83W*&jfjGH+nJ=g@9 lfzm)A!3`u_K`J*EerKM{uM)_?2+_|lIi6?gW_KBOW&jsG5Oe?l diff --git a/dist/kernel.js b/dist/kernel.js index dfd2151..52601b4 100644 --- a/dist/kernel.js +++ b/dist/kernel.js @@ -40636,6 +40636,14 @@ class CodeMirrorCell { if (options.ReadOnly) { ext.push(EditorState.readOnly.of(true)); } + //console.warn(options); + if ('Selectable' in options) { + if (!options.Selectable) + ext.push(EditorState.transactionFilter.of((tr) => { + //console.log(tr); + return false; + })); + } if (options.ForceUpdate) { env.local.forceUpdate = options.ForceUpdate; diff --git a/dist/kernel.min.js b/dist/kernel.min.js index 215cc43..cec27cf 100644 --- a/dist/kernel.min.js +++ b/dist/kernel.min.js @@ -1 +1 @@ -class t{constructor(){}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 a(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}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 l(n,o,i,r);n=o+1,i++}}decompose(t,i,r,o){let a=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(a.text,t.text.slice(),0,a.length);if(i.length<=32)r.push(new e(i,t.length+a.length));else{let t=i.length>>1;r.push(new e(i.slice(0,t)),new e(i.slice(t)))}}else r.push(a)}replace(t,r,o){if(!(o instanceof e))return super.replace(t,r,o);let a=n(this.text,n(o.text,s(this.text,0,t)),r),l=this.length+o.length-(r-t);return a.length<=32?new e(a,l):i.from(e.split(a,[]),l)}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=a+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,a=i+r.lines-1;if((e?a:o)>=t)return r.lineInner(t,e,i,n);n=o+1,i=a+1}}decompose(t,e,i,n){for(let s=0,r=0;r<=e&&s=r){let s=n&((r<=t?1:0)|(a>=e?2:0));r>=t&&a<=e&&!s?i.push(o):o.decompose(t-r,e-r,i,s)}r=a+1}}replace(t,e,n){if(n.lines=r&&e<=a){let l=o.replace(t-r,e-r,n),h=this.lines-o.lines+l.lines;if(l.lines>4&&l.lines>h>>6){let r=this.children.slice();return r[s]=l,new i(r,this.length-(e-t)+n.length)}return super.replace(r,a,l)}r=a+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=a+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,a]=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==a)return n;let i=this.children[s],l=t.children[r];if(i!=l)return n+i.scanIdentical(l,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,a=r>>1,l=[],h=0,c=-1,u=[];function d(t){let n;if(t.lines>o&&t instanceof i)for(let e of t.children)d(e);else t.lines>a&&(h>a||!h)?(f(),l.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&&f(),h+=t.lines,c+=t.length+1,u.push(t))}function f(){0!=h&&(l.push(1==u.length?u[0]:i.from(u,c)),c=-1,h=u.length=0)}for(let e of t)d(e);return f(),1==l.length?l[0]:new i(l,n)}}function n(t,e,i=0,n=1e9){for(let s=0,r=0,o=!0;r=i&&(l>n&&(a=a.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,a=s instanceof e?s.text.length:s.children.length;if(o==(i>0?a: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 a{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]=a.prototype[Symbol.iterator]=function(){return this});let l=class{constructor(t,e,i,n){this.from=t,this.to=e,this.number=i,this.text=n}get length(){return this.to-this.from}},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 d=8205;function f(t,e,i=!0,n=!0){return(i?p:O)(t,e,n)}function p(t,e,i){if(e==t.length)return e;e&&g(t.charCodeAt(e))&&m(t.charCodeAt(e-1))&&e--;let n=b(t,e);for(e+=v(n);e=0&&u(b(t,n));)i++,n-=2;if(i%2==0)break;e+=2}}}return e}function O(t,e,i){for(;e>0;){let n=p(t,e-2,i);if(n=56320&&t<57344}function m(t){return t>=55296&&t<56320}function b(t,e){let i=t.charCodeAt(e);if(!m(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return g(n)?n-56320+(i-55296<<10)+65536:i}function w(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function v(t){return t<65536?1:2}const y=/\r\n?|\n/;var S=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(S||(S={}));class x{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;et)return s+(t-n);s+=o}else{if(i!=S.Simple&&l>=t&&(i==S.TrackDel&&nt||i==S.TrackBefore&&nt))return null;if(l>t||l==t&&e<0&&!o)return t==n||e<0?s:s+a;s+=a}n=l}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 x(t)}static create(t){return new x(t)}}class k extends x{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 P(this,((e,i,n,s,r)=>t=t.replace(n,n+(i-e),r)),!1),t}mapDesc(t,e=!1){return C(this,t,e,!0)}invert(e){let i=this.sections.slice(),n=[];for(let s=0,r=0;s=0){i[s]=a,i[s+1]=o;let l=s>>1;for(;n.length0&&$(i,e,s.text),s.forward(t),o+=t}let l=t[r++];for(;o>1].toJSON()))}return t}static of(e,i,n){let s=[],r=[],o=0,a=null;function l(t=!1){if(!t&&!s.length)return;oa||e<0||a>i)throw new RangeError(`Invalid change range ${e} to ${a} (in doc of length ${i})`);let u=c?"string"==typeof c?t.of(c.split(n||y)):c:t.empty,d=u.length;if(e==a&&0==d)return;eo&&Q(s,e-o,-1),Q(s,a-e,d),$(r,s,u),o=a}}(e),l(!a),a}static empty(t){return new k(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 $(e,i,n){if(0==n.length)return;let s=i.length-2>>1;if(s>1])),!(n||a==e.sections.length||e.sections[a+1]<0);)l=e.sections[a++],h=e.sections[a++];i(r,c,o,u,d),r=c,o=u}}}function C(t,e,i,n=!1){let s=[],r=n?[]:null,o=new X(t),a=new X(e);for(let t=-1;;)if(-1==o.ins&&-1==a.ins){let t=Math.min(o.len,a.len);Q(s,t,-1),o.forward(t),a.forward(t)}else if(a.ins>=0&&(o.ins<0||t==o.i||0==o.off&&(a.len=0&&t=0)){if(o.done&&a.done)return r?k.createSet(s,r):x.create(s);throw new Error("Mismatched change set lengths")}{let e=0,i=o.len;for(;i;)if(-1==a.ins){let t=Math.min(i,a.len);e+=t,i-=t,a.forward(t)}else{if(!(0==a.ins&&a.lene||o.ins>=0&&o.len>e)&&(t||n.length>i),r.forward2(e),o.forward(e)}}else Q(n,0,o.ins,t),s&&$(s,n,o.text),o.next()}}class X{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 Z{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 Z(i,n,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return A.range(t,e);let i=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return A.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 A.range(t.anchor,t.head)}static create(t,e,i){return new Z(t,e,i)}}class A{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:A.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 A(t.ranges.map((t=>Z.fromJSON(t))),t.main)}static single(t,e=t){return new A([A.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?A.range(o,r):A.range(r,o))}}return new A(t,e)}}function T(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let R=0;class E{constructor(t,e,i,n,s){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=n,this.id=R++,this.default=t([]),this.extensions="function"==typeof s?s(this):s}static define(t={}){return new E(t.combine||(t=>t),t.compareInput||((t,e)=>t===e),t.compare||(t.combine?(t,e)=>t===e:V),!!t.static,t.enables)}of(t){return new M([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,2,e)}from(t,e){return e||(e=t=>t),this.compute([t],(i=>e(i.field(t))))}}function V(t,e){return t==e||t.length==e.length&&t.every(((t,i)=>t===e[i]))}class M{constructor(t,e,i,n){this.dependencies=t,this.facet=e,this.type=i,this.value=n,this.id=R++}dynamicSlot(t){var e;let i=this.value,n=this.facet.compareInput,s=this.id,r=t[s]>>1,o=2==this.type,a=!1,l=!1,h=[];for(let i of this.dependencies)"doc"==i?a=!0:"selection"==i?l=!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(a&&e.docChanged||l&&(e.docChanged||e.selection)||W(t,h)){let e=i(t);if(o?!D(e,t.values[r],n):!n(e,t.values[r]))return t.values[r]=e,1}return 0},reconfigure:(t,e)=>{let a,l=e.config.address[s];if(null!=l){let s=tt(e,l);if(this.dependencies.every((i=>i instanceof E?e.facet(i)===t.facet(i):!(i instanceof q)||e.field(i,!1)==t.field(i,!1)))||(o?D(a=i(t),s,n):n(a=i(t),s)))return t.values[r]=s,0}else a=i(t);return t.values[r]=a,1}}}}function D(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 a(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(Y).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,Y.of({field:this,create:t})]}get extension(){return this}}const L=4,z=3,I=2,B=1;function j(t){return e=>new G(e,t)}const N={highest:j(0),high:j(B),default:j(I),low:j(z),lowest:j(L)};class G{constructor(t,e){this.inner=t,this.prec=e}}class F{of(t){return new H(this,t)}reconfigure(t){return F.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class H{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;function r(t,o){let a=s.get(t);if(null!=a){if(a<=o)return;let e=n[a].indexOf(t);e>-1&&n[a].splice(e,1),t instanceof H&&i.delete(t.compartment)}if(s.set(t,o),Array.isArray(t))for(let e of t)r(e,o);else if(t instanceof H){if(i.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");let n=e.get(t.compartment)||t.inner;i.set(t.compartment,n),r(n,o)}else if(t instanceof G)r(t.inner,t.prec);else if(t instanceof q)n[o].push(t),t.provides&&r(t.provides,o);else if(t instanceof M)n[o].push(t),t.facet.extensions&&r(t.facet.extensions,I);else{let e=t.extension;if(!e)throw new Error(`Unrecognized extension value in extension set (${t}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(e,o)}}return r(t,I),n.reduce(((t,e)=>t.concat(e)))}(t,e,r))i instanceof q?n.push(i):(s[i.facet.id]||(s[i.facet.id]=[])).push(i);let o=Object.create(null),a=[],l=[];for(let t of n)o[t.id]=l.length<<1,l.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]=a.length<<1|1,V(r,e))a.push(i.facet(n));else{let t=n.combine(e.map((t=>t.value)));a.push(i&&n.compare(t,i.facet(n))?i.facet(n):t)}else{for(let t of e)0==t.type?(o[t.id]=a.length<<1|1,a.push(t.value)):(o[t.id]=l.length<<1,l.push((e=>t.dynamicSlot(e))));o[n.id]=l.length<<1,l.push((t=>U(t,n,e)))}}let c=l.map((t=>t(o)));return new J(t,r,c,o,a,s)}}function K(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 tt(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}const et=E.define(),it=E.define({combine:t=>t.some((t=>t)),static:!0}),nt=E.define({combine:t=>t.length?t[0]:void 0,static:!0}),st=E.define(),rt=E.define(),ot=E.define(),at=E.define({combine:t=>!!t.length&&t[0]});class lt{constructor(t,e){this.type=t,this.value=e}static define(){return new ht}}class ht{of(t){return new lt(this,t)}}class ct{constructor(t){this.map=t}of(t){return new ut(this,t)}}class ut{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 ut(this.type,e)}is(t){return this.type==t}static define(t={}){return new ct(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}}ut.reconfigure=ut.define(),ut.appendConfig=ut.define();class dt{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&&T(i,e.newLength),s.some((t=>t.type==dt.time))||(this.annotations=s.concat(dt.time.of(Date.now())))}static create(t,e,i,n,s,r){return new dt(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(dt.userEvent);return!(!e||!(e==t||e.length>t.length&&e.slice(0,t.length)==t&&"."==e[t.length]))}}function ft(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=pt(n,Ot(e,r,t.changes.newLength),!0))}return n==t?t:dt.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(st)){let e=n(t);if(!1===e){i=!1;break}Array.isArray(e)&&(i=!0===i?e:ft(i,e))}if(!0!==i){let n,s;if(!1===i)s=t.changes.invertedDesc,n=k.empty(e.doc.length);else{let e=t.changes.filter(i);n=e.changes,s=e.filtered.mapDesc(e.changes).invertedDesc}t=dt.create(e,n,t.selection&&t.selection.map(s),ut.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let n=e.facet(rt);for(let i=n.length-1;i>=0;i--){let s=n[i](t);t=s instanceof dt?s:Array.isArray(s)&&1==s.length&&s[0]instanceof dt?s[0]:gt(e,bt(s),!1)}return t}(s):s)}dt.time=lt.define(),dt.userEvent=lt.define(),dt.addToHistory=lt.define(),dt.remote=lt.define();const mt=[];function bt(t){return null==t?mt:Array.isArray(t)?t:[t]}var wt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(wt||(wt={}));const vt=/[\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){}function St(t){return e=>{if(!/\S/.test(e))return wt.Space;if(function(t){if(yt)return yt.test(t);for(let e=0;e"€"&&(i.toUpperCase()!=i.toLowerCase()||vt.test(i)))return!0}return!1}(e))return wt.Word;for(let i=0;i-1)return wt.Word;return wt.Other}}class xt{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(ut.reconfigure)?(i=null,n=e.value):e.is(ut.appendConfig)&&(i=null,n=bt(n).concat(e.value));if(i)e=t.startState.values.slice();else{i=J.resolve(n,s,this),e=new xt(i,this.doc,this.selection,i.dynamicSlots.map((()=>null)),((t,e)=>e.reconfigure(t,this)),null).values}new xt(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:A.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=bt(i.effects);for(let i=1;is.spec.fromJSON(r,t))))}return xt.create({doc:t.doc,selection:A.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(xt.lineSeparator)||y)),s=e.selection?e.selection instanceof A?e.selection:A.single(e.selection.anchor,e.selection.head):A.single(0);return T(s,n.length),i.staticFacet(it)||(s=s.asSingle()),new xt(i,n,s,i.dynamicSlots.map((()=>null)),((t,e)=>e.create(t)),null)}get tabSize(){return this.facet(xt.tabSize)}get lineBreak(){return this.facet(xt.lineSeparator)||"\n"}get readOnly(){return this.facet(at)}phrase(t,...e){for(let e of this.facet(xt.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(et))for(let r of s(this,e,i))Object.prototype.hasOwnProperty.call(r,t)&&n.push(r[t]);return n}charCategorizer(t){return St(this.languageDataAt("wordChars",t).join(""))}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=f(e,r,!1);if(s(e.slice(t,r))!=wt.Word)break;r=t}for(;ot.length?t[0]:4}),xt.lineSeparator=nt,xt.readOnly=at,xt.phrases=E.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]))}}),xt.languageData=et,xt.changeFilter=st,xt.transactionFilter=rt,xt.transactionExtender=ot,F.reconfigure=ut.define();class Qt{eq(t){return this==t}range(t,e=t){return $t.create(t,e,this)}}Qt.prototype.startSide=Qt.prototype.endSide=0,Qt.prototype.point=!1,Qt.prototype.mapMode=S.TrackDel;let $t=class t{constructor(t,e,i){this.from=t,this.to=e,this.value=i}static create(e,i,n){return new t(e,i,n)}};function Pt(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Ct{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,a=s[n]-t||(i?this.value[n].endSide:this.value[n].startSide)-e;if(n==r)return a>=0?r:o;a>=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||l==h&&c.startSide>0&&c.endSide<=0)continue;(h-l||c.endSide-c.startSide)<0||(r<0&&(r=l),c.point&&(o=Math.max(o,h-l)),i.push(c),n.push(l-r),s.push(h-r))}return{mapped:i.length?new Ct(n,s,i,o):null,pos:r}}}class _t{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 _t(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(Pt)),this.isEmpty)return e.length?_t.of(e):this;let o=new At(this,null,-1).goto(0),a=0,l=[],h=new Xt;for(;o.value||a=0){let t=e[a++];h.addInner(t.from,t.to,t.value)||l.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 Tt.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return Tt.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)),a=Zt(r,o,i),l=new Et(r,a,s),h=new Et(o,a,s);i.iterGaps(((t,e,i)=>Vt(l,t,h,e,i,n))),i.empty&&0==i.length&&Vt(l,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=Zt(s,r),a=new Et(s,o,0).goto(i),l=new Et(r,o,0).goto(i);for(;;){if(a.to!=l.to||!Mt(a.active,l.active)||a.point&&(!l.point||!a.point.eq(l.point)))return!1;if(a.to>n)return!0;a.next(),l.next()}}static spans(t,e,i,n,s=-1){let r=new Et(t,null,s).goto(e),o=e,a=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,a),a=r.openEnd(t));if(r.to>i)return a+(r.point&&r.to>i?1:0);o=r.to,r.next()}}static of(t,e=!1){let i=new Xt;for(let n of t instanceof $t?[t]:e?function(t){if(t.length>1)for(let e=t[0],i=1;i0)return t.slice().sort(Pt);e=n}return t}(t):t)i.add(n.from,n.to,n.value);return i.finish()}}_t.empty=new _t([],[],null,-1),_t.empty.nextLayer=_t.empty;class Xt{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}finishChunk(t){this.chunks.push(new Ct(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=[])}add(t,e,i){this.addInner(t,e,i)||(this.nextLayer||(this.nextLayer=new Xt)).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(_t.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;let e=_t.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function Zt(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 At(r,e,i,s));return 1==n.length?n[0]:new Tt(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--)Rt(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--)Rt(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(),Rt(this.heap,0)}}}function Rt(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 Et{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=Tt.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){Dt(this.active,t),Dt(this.activeTo,t),Dt(this.activeRank,t),this.minActive=Ut(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&&Dt(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 Vt(t,e,i,n,s,r){t.goto(e),i.goto(n);let o=n+s,a=n,l=n-e;for(;;){let e=t.to+l-i.to||t.endSide-i.endSide,n=e<0?t.to+l: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))&&Mt(t.activeForPoint(t.to+l),i.activeForPoint(i.to))||r.comparePoint(a,s,t.point,i.point):s>a&&!Mt(t.active,i.active)&&r.compareRange(a,s,t.active,i.active),n>o)break;a=n,e<=0&&t.next(),e>=0&&i.next()}}function Mt(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 Ut(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(!l)throw new RangeError("The value of a property ("+i+") should be a primitive value.");s(n(i),o,a,h)}else null!=o&&a.push(i.replace(/_.*/,"").replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))+": "+o+";")}(a.length||h)&&r.push((!i||l||o?t:t.map(i)).join(", ")+" {"+a.join(" ")+"}")}for(let e in t)s(n(e),t[e],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let t=zt[qt]||1;return zt[qt]=t+1,"ͼ"+t.toString(36)}static mount(t,e){(t[Lt]||new jt(t)).mount(Array.isArray(e)?e:[e])}}let Bt=new Map;class jt{constructor(t){let e=t.ownerDocument||t,i=e.defaultView;if(!t.head&&t.adoptedStyleSheets&&i.CSSStyleSheet){let n=Bt.get(e);if(n)return t.adoptedStyleSheets=[n.sheet,...t.adoptedStyleSheets],t[Lt]=n;this.sheet=new i.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets],Bt.set(e,this)}else{this.styleTag=e.createElement("style");let i=t.head||t;i.insertBefore(this.styleTag,i.firstChild)}this.modules=[],t[Lt]=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:'"'},Ft="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),Ht="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Jt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Kt=Ht||Ft&&+Ft[1]<57,te=0;te<10;te++)Nt[48+te]=Nt[96+te]=String(te);for(te=1;te<=24;te++)Nt[te+111]="F"+te;for(te=65;te<=90;te++)Nt[te]=String.fromCharCode(te+32),Gt[te]=String.fromCharCode(te);for(var ee in Nt)Gt.hasOwnProperty(ee)||(Gt[ee]=Nt[ee]);function ie(t){let e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection()}function ne(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function se(t,e){if(!e.anchorNode)return!1;try{return ne(t,e.anchorNode)}catch(t){return!1}}function re(t){return 3==t.nodeType?me(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function oe(t,e,i,n){return!!i&&(le(t,e,i,n,-1)||le(t,e,i,n,1))}function ae(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function le(t,e,i,n,s){for(;;){if(t==i&&e==n)return!0;if(e==(s<0?0:he(t))){if("DIV"==t.nodeName)return!1;let i=t.parentNode;if(!i||1!=i.nodeType)return!1;e=ae(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?he(t):0}}}function he(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}const ce={left:0,right:0,top:0,bottom:0};function ue(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function de(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}class fe{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){this.set(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset)}set(t,e,i,n){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=n}}let pe,Oe=null;function ge(t){if(t.setActive)return t.setActive();if(Oe)return t.focus(Oe);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==Oe?{get preventScroll(){return Oe={preventScroll:!0},!0}}:void 0),!Oe){Oe=!1;for(let t=0;te)return i.domBoundsAround(t,e,l);if(c>=t&&-1==n&&(n=a,s=l),l>e&&i.dom.parentNode==this.dom){r=a,o=h;break}h=c,l=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.dirty|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.dirty|=2),1&e.dirty)return;e.dirty|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,this.dirty&&this.markParentsDirty(!0))}setDOM(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=ye){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 Qe(t,e,i,n,s,r,o,a,l){let{children:h}=t,c=h.length?h[e]:null,u=r.length?r[r.length-1]:null,d=u?u.breakAfter:o;if(!(e==n&&c&&!o&&!d&&r.length<2&&c.merge(i,s,r.length?u:null,0==i,a,l))){if(n0&&(!o&&r.length&&c.merge(i,c.length,r[0],!1,a,0)?c.breakAfter=r.shift().breakAfter:(i2);var De={mac:Me||/Mac/.test(Pe.platform),windows:/Win/.test(Pe.platform),linux:/Linux|X11/.test(Pe.platform),ie:Ae,ie_version:Xe?Ce.documentMode||6:Ze?+Ze[1]:_e?+_e[1]:0,gecko:Te,gecko_version:Te?+(/Firefox\/(\d+)/.exec(Pe.userAgent)||[0,0])[1]:0,chrome:!!Re,chrome_version:Re?+Re[1]:0,ios:Me,android:/Android\b/.test(Pe.userAgent),webkit:Ee,safari:Ve,webkit_version:Ee?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Ce.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class We extends Se{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(!i||i instanceof We&&!(this.length-(e-t)+i.length>256))&&(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),!0)}split(t){let e=new We(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new ve(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 Ye(this.dom,t,e)}}class Ue extends Se{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(we(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}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.dirty|=6)}sync(t,e){this.dom?4&this.dirty&&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 Ue&&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 Ue(this.mark,e,r)}domAtPos(t){return Ge(this,t)}coordsAt(t,e){return He(this,t,e)}}function Ye(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?De.chrome||De.gecko||(e?(s--,o=1):r=0)?0:a.length-1];return De.safari&&!o&&0==l.width&&(l=Array.prototype.find.call(a,(t=>t.width))||l),o?ue(l,o<0):l||null}class qe extends Se{constructor(t,e,i){super(),this.widget=t,this.length=e,this.side=i,this.prevWidget=null}static create(t,e,i){return new(t.customView||qe)(t,e,i)}split(t){let e=qe.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 qe&&this.widget.compare(i.widget))||t>0&&s<=0||e0)?ve.before(this.dom):ve.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let i=this.dom.getClientRects(),n=null;if(!i.length)return ce;for(let e=t>0?i.length-1:0;n=i[e],!(t>0?0==e:e==i.length-1||n.top0?-1:1);return this.length?n:ue(n,this.side>0)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class Le extends qe{domAtPos(t){let{topView:e,text:i}=this.widget;return e?ze(t,0,e,i,this.length-e.length,((t,e)=>t.domAtPos(e)),((t,e)=>new ve(t,Math.min(e,t.nodeValue.length)))):new ve(i,Math.min(t,i.nodeValue.length))}sync(){this.setDOM(this.widget.toDOM())}localPosFromDOM(t,e){let{topView:i,text:n}=this.widget;return i?Be(t,e,i,n,this.length-i.length):Math.min(e,this.length)}ignoreMutation(){return!1}get overrideDOMText(){return null}coordsAt(t,e){let{topView:i,text:n}=this.widget;return i?ze(t,e,i,n,this.length-i.length,((t,e,i)=>t.coordsAt(e,i)),((t,e,i)=>Ye(t,e,i))):Ye(n,t,e)}destroy(){var t;super.destroy(),null===(t=this.widget.topView)||void 0===t||t.destroy()}get isEditable(){return!0}canReuseDOM(){return!0}}function ze(t,e,i,n,s,r,o){if(i instanceof Ue){for(let a=i.dom.firstChild;a;a=a.nextSibling){let i=Se.get(a);if(i){let l=ne(a,n),h=i.length+(l?s:0);if(t0?ve.before(this.dom):ve.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){let e=this.dom.getBoundingClientRect(),i=function(t,e){let i=t.parent,n=i?i.children.indexOf(t):-1;for(;i&&n>=0;)if(e<0?n>0:n0?-1:1);return i&&i.tope.top?{left:e.left,right:e.right,top:i.top,bottom:i.bottom}:e}get overrideDOMText(){return t.empty}get isHidden(){return!0}}function Ge(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 Ue&&s.length&&(n=s[s.length-1])instanceof Ue&&n.mark.eq(e.mark)?Fe(n,e.children[0],i-1):(s.push(e),e.setParent(t)),t.length+=e.length}function He(t,e,i){let n=null,s=-1,r=null,o=-1;!function t(e,a){for(let l=0,h=0;l=a&&(c.children.length?t(c,a-h):(!r||r instanceof Ne&&i>0)&&(u>a||h==u&&c.getSide()>0)?(r=c,o=a-h):(h0?3e8:-4e8:e>0?1e8:-1e8,new oi(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}=ai(t,n);e=(s?n?-3e8:-1:5e8)-1,i=1+(r?n?2e8:1:-6e8)}return new oi(t,e,i,n,t.widget||null,!0)}static line(t){return new ri(t)}static set(t,e=!1){return _t.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}ni.none=_t.empty;class si extends ni{constructor(t){let{start:e,end:i}=ai(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){return this==t||t instanceof si&&this.tagName==t.tagName&&this.class==t.class&&Ke(this.attrs,t.attrs)}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}si.prototype.point=!1;class ri extends ni{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof ri&&this.spec.class==t.spec.class&&Ke(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)}}ri.prototype.mapMode=S.TrackBefore,ri.prototype.point=!0;class oi extends ni{constructor(t,e,i,n,s,r){super(e,i,s,t),this.block=n,this.isReplace=r,this.mapMode=n?e<=0?S.TrackBefore:S.TrackAfter:S.TrackDel}get type(){return this.startSide=5}eq(t){return t instanceof oi&&(e=this.widget,i=t.widget,e==i||!!(e&&i&&e.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var e,i}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 ai(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 li(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)}oi.prototype.point=!0;class hi extends Se{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 hi))return!1;this.dom||i.transferDOM(this)}return n&&this.setDeco(i?i.attrs:null),$e(this,t,e,i?i.children:[],s,r),!0}split(t){let e=new hi;if(e.breakAfter=this.breakAfter,0==this.length)return e;let{i: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){Ke(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){Fe(this,t,e)}addLineDeco(t){let e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=Je(e,this.attrs||{})),i&&(this.attrs=Je({class:i},this.attrs||{}))}domAtPos(t){return Ge(this,t)}reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.dirty|=6)}sync(t,e){var i;this.dom?4&this.dirty&&(we(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&&(ti(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&&Se.get(n)instanceof Ue;)n=n.lastChild;if(!(n&&this.length&&("BR"==n.nodeName||0!=(null===(i=Se.get(n))||void 0===i?void 0:i.isEditable)||De.ios&&this.children.some((t=>t instanceof We))))){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 We)||/[^ -~]/.test(i.text))return null;let n=re(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=He(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 hi)return s;if(r>e)break}n=r+s.breakAfter}return null}}class ci extends Se{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 ci&&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(di(new We(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 oi){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let o=e-t;if(i instanceof oi)if(i.block){let{type:t}=i;t!=ii.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new ci(i.widget||new fi("div"),o,t))}else{let r=qe.create(i.widget||new fi("span"),o,o?0:i.startSide),a=this.atCursorPos&&!r.isEditable&&s<=n.length&&(t0),l=!r.isEditable&&(tn.length||i.startSide<=0),h=this.getLine();2!=this.pendingBuffer||a||r.isEditable||(this.pendingBuffer=0),this.flushBuffer(n),a&&(h.append(di(new Ne(1),n),s),s=n.length+Math.max(0,s-n.length)),h.append(di(r,n),s),this.atCursorPos=l,this.pendingBuffer=l?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 ui(t,e,i,s);return r.openEnd=_t.spans(n,e,i,r),r.openStart<0&&(r.openStart=r.openEnd),r.finish(r.openEnd),r}}function di(t,e){for(let i of e)t=new Ue(i,[t],t.length);return t}class fi extends ei{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 pi=E.define(),Oi=E.define(),gi=E.define(),mi=E.define(),bi=E.define(),wi=E.define(),vi=E.define(),yi=E.define({combine:t=>t.some((t=>t))}),Si=E.define({combine:t=>t.some((t=>t))});class xi{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 xi(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin)}}const ki=ut.define({map:(t,e)=>t.map(e)});function Qi(t,e,i){let n=t.facet(mi);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 $i=E.define({combine:t=>!t.length||t[0]});let Pi=0;const Ci=E.define();class _i{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 _i(Pi++,t,i,(t=>{let e=[Ci.of(t)];return s&&e.push(Ti.of((e=>{let i=e.plugin(t);return i?s(i):ni.none}))),n&&e.push(n(t)),e}))}static fromClass(t,e){return _i.define((e=>new t(e)),e)}}class Xi{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(Qi(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){Qi(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){Qi(t.state,e,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Zi=E.define(),Ai=E.define(),Ti=E.define(),Ri=E.define(),Ei=E.define(),Vi=E.define();class Mi{constructor(t,e,i,n){this.fromA=t,this.toA=e,this.fromB=i,this.toB=n}join(t){return new Mi(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(!a)return i;new Mi(a.fromA,a.toA,a.fromB,a.toB).addToSet(i),r=a.toA,o=a.toB}}}class Di{constructor(t,e,i){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=k.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 Mi(t,e,i,s)))),this.changedRanges=n}static create(t,e,i){return new Di(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 Wi=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Wi||(Wi={}));const Ui=Wi.LTR,Yi=Wi.RTL;function qi(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}}const Gi=[];function Fi(t){return[new Ni(0,t,0)]}let Hi="";function Ji(t,e,i,n,s){var r;let o=n.head-t.from,a=-1;if(0==o){if(!s||!t.length)return null;e[0].level!=i&&(o=e[0].side(!1,i),a=0)}else if(o==t.length){if(s)return null;let t=e[e.length-1];t.level!=i&&(o=t.side(!0,i),a=e.length-1)}a<0&&(a=Ni.find(e,o,null!==(r=n.bidiLevel)&&void 0!==r?r:-1,n.assoc));let l=e[a];o==l.side(s,i)&&(l=e[a+=s?1:-1],o=l.side(!s,i));let h=s==(l.dir==i),c=f(t.text,o,h);if(Hi=t.text.slice(Math.min(o,c),Math.max(o,c)),c!=l.side(s,i))return A.cursor(c+t.from,h?-1:1,l.level);let u=a==(s?e.length-1:0)?null:e[a+(s?1:-1)];return u||l.level==i?u&&u.level1)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=Se.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 en(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}class nn{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class sn extends Se{constructor(t){super(),this.view=t,this.compositionDeco=ni.none,this.decorations=[],this.dynamicDecorationMap=[],this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(t.contentDOM),this.children=[new hi],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Mi(0,0,0,t.state.doc.length)],0)}get length(){return this.view.state.doc.length}update(t){let e=t.changedRanges;this.minWidth>0&&e.length&&(e.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),this.view.inputState.composing<0?this.compositionDeco=ni.none:(t.transactions.length||this.dirty)&&(this.compositionDeco=function(t,e){let i=on(t);if(!i)return ni.none;let{from:n,to:s,node:r,text:o}=i,a=e.mapPos(n,1),l=Math.max(a,e.mapPos(s,-1)),{state:h}=t,c=3==r.nodeType?r.nodeValue:new tn([],h).readRange(r.firstChild,null).text;if(l-a{this.dom.style.height=this.view.viewState.contentHeight+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let t=De.chrome||De.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,t),this.dirty=0,t&&(t.written||i.selectionRange.focusNode!=t.node)&&(this.forceSelection=!0),this.dom.style.height=""}));let n=[];if(this.view.viewport.from||this.view.viewport.to=0?t[e]:null;if(!n)break;let{fromA:s,toA:r,fromB:o,toB:a}=n,{content:l,breakAtStart:h,openStart:c,openEnd:u}=ui.build(this.view.state.doc,o,a,this.decorations,this.dynamicDecorationMap),{i:d,off:f}=i.findPos(r,1),{i:p,off:O}=i.findPos(s,-1);Qe(this,p,O,d,f,l,h,c,u)}}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&&se(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,a=this.domAtPos(o.anchor),l=o.empty?a:this.domAtPos(o.head);if(De.gecko&&o.empty&&!this.compositionDeco.size&&(1==(h=a).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((()=>a.node.insertBefore(t,a.node.childNodes[a.offset]||null))),a=l=new ve(t,0),r=!0}var h;let c=this.view.observer.selectionRange;!r&&c.focusNode&&oe(a.node,a.offset,c.anchorNode,c.anchorOffset)&&oe(l.node,l.offset,c.focusNode,c.focusOffset)||(this.view.observer.ignore((()=>{De.android&&De.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=ie(this.view.root);if(t)if(o.empty){if(De.gecko){let t=(e=a.node,n=a.offset,1!=e.nodeType?0:(n&&"false"==e.childNodes[n-1].contentEditable?1:0)|(no.head&&([a,l]=[l,a]),e.setEnd(l.node,l.offset),e.setStart(a.node,a.offset),t.removeAllRanges(),t.addRange(e)}else;var e,n;s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())})),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new ve(c.anchorNode,c.anchorOffset),this.impreciseHead=l.precise?null:new ve(c.focusNode,c.focusOffset)}enforceCursorAssoc(){if(this.compositionDeco.size)return;let{view:t}=this,e=t.state.selection.main,i=ie(t.root),{anchorNode:n,anchorOffset:s}=t.observer.selectionRange;if(!(i&&e.empty&&e.assoc&&i.modify))return;let r=hi.find(this,e.head);if(!r)return;let o=r.posAtStart;if(e.head==o||e.head==o+r.length)return;let a=this.coordsAt(e.head,-1),l=this.coordsAt(e.head,1);if(!a||!l||a.bottom>l.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)}nearest(t){for(let e=t;e;){let t=Se.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!=ii.WidgetBefore&&s.type!=ii.WidgetAfter&&(!n||2==e||this.children[n-1].breakAfter||this.children[n-1].type==ii.WidgetBefore&&e>-2))return s.coordsAt(t-r,e);i=r}}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,a=this.view.textDirection==Wi.LTR;for(let t=0,l=0;ln)break;if(t>=i){let i=h.dom.getBoundingClientRect();if(e.push(i.height),r){let e=h.dom.lastChild,n=e?re(e):[];if(n.length){let e=n[n.length-1],r=a?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?Wi.RTL:Wi.LTR}measureTextSize(){for(let t of this.children)if(t instanceof hi){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.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(n);let s=re(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 ke(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;t.push(ni.replace({widget:new rn(n),block:!0,inclusive:!0,isBlockGap:!0}).range(i,r))}if(!s)break;i=s.to+1}return ni.set(t)}updateDeco(){let t=this.view.state.facet(Ti).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=0,r=0,o=0,a=0;for(let t of this.view.state.facet(Ei).map((t=>t(this.view))))if(t){let{left:e,right:i,top:n,bottom:l}=t;null!=e&&(s=Math.max(s,e)),null!=i&&(r=Math.max(r,i)),null!=n&&(o=Math.max(o,n)),null!=l&&(a=Math.max(a,l))}let l={left:n.left-s,top:n.top-o,right:n.right+r,bottom:n.bottom+a};!function(t,e,i,n,s,r,o,a){let l=t.ownerDocument,h=l.defaultView||window;for(let c=t;c;)if(1==c.nodeType){let t,u=c==l.body;if(u)t=de(h);else{if(c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let e=c.getBoundingClientRect();t={left:e.left,right:e.left+c.clientWidth,top:e.top,bottom:e.top+c.clientHeight}}let d=0,f=0;if("nearest"==s)e.top0&&e.bottom>t.bottom+f&&(f=e.bottom-t.bottom+f+o)):e.bottom>t.bottom&&(f=e.bottom-t.bottom+o,i<0&&e.top-f0&&e.right>t.right+d&&(d=e.right-t.right+d+r)):e.right>t.right&&(d=e.right-t.right+r,i<0&&e.left0))break;i=i.childNodes[n-1],n=he(i)}if(i>=0)for(let n=t,s=e;;){if(3==n.nodeType)return n;if(!(1==n.nodeType&&s=0))break;n=n.childNodes[s],s=0}return null}class hn{constructor(){this.changes=[]}compareRange(t,e){li(t,e,this.changes)}comparePoint(t,e){li(t,e,this.changes)}}function cn(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function un(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function dn(t,e){return t.tope.top+1}function fn(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,a,l,h,c,u=!1;for(let d=t.firstChild;d;d=d.nextSibling){let t=re(d);for(let f=0;fg||o==g&&r>O){n=d,s=p,r=O,o=g;let a=g?i0?f0)}0==O?i>p.bottom&&(!h||h.bottomp.top)&&(l=d,c=p):h&&dn(h,p)?h=pn(h,p.bottom):c&&dn(c,p)&&(c=fn(c,p.top))}}if(h&&h.bottom>=i?(n=a,s=h):c&&c.top<=i&&(n=l,s=c),!n)return{node:t,offset:0};let d=Math.max(s.left,Math.min(s.right,e));return 3==n.nodeType?gn(n,d,i):u&&"false"!=n.contentEditable?On(n,d,i):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,n)+(e>=(s.left+s.right)/2?1:0)}}function gn(t,e,i){let n=t.nodeValue.length,s=-1,r=1e9,o=0;for(let a=0;ai?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(De.chrome||De.gecko){me(t,a).getBoundingClientRect().left==h.right&&(n=!i)}if(c<=0)return{node:t,offset:a+(n?1:0)};s=a+(n?1:0),r=c}}}return{node:t,offset:s>-1?s:o>0?t.nodeValue.length:0}}function mn(t,e,i,n=-1){var s,r;let o,a=t.contentDOM.getBoundingClientRect(),l=a.top+t.viewState.paddingTop,{docHeight:h}=t.viewState,{x:c,y:u}=e,d=u-l;if(d<0)return 0;if(d>h)return t.state.doc.length;for(let e=t.defaultLineHeight/2,s=!1;o=t.elementAtHeight(d),o.type!=ii.Text;)for(;d=n>0?o.bottom+e:o.top-e,!(d>=0&&d<=h);){if(s)return i?null:0;s=!0,n=-n}u=l+d;let f=o.from;if(ft.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:bn(t,a,o,c,u);let p=t.dom.ownerDocument,O=t.root.elementFromPoint?t.root:p,g=O.elementFromPoint(c,u);g&&!t.contentDOM.contains(g)&&(g=null),g||(c=Math.max(a.left+1,Math.min(a.right-1,c)),g=O.elementFromPoint(c,u),g&&!t.contentDOM.contains(g)&&(g=null));let m,b=-1;if(g&&0!=(null===(s=t.docView.nearest(g))||void 0===s?void 0:s.isEditable))if(p.caretPositionFromPoint){let t=p.caretPositionFromPoint(c,u);t&&({offsetNode:m,offset:b}=t)}else if(p.caretRangeFromPoint){let e=p.caretRangeFromPoint(c,u);e&&(({startContainer:m,startOffset:b}=e),(!t.contentDOM.contains(m)||De.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 me(t,n-1,n).getBoundingClientRect().left>i}(m,b,c)||De.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}let n=1==t.nodeType?t.getBoundingClientRect():me(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return i-n.left>5}(m,b,c))&&(m=void 0))}if(!m||!t.docView.dom.contains(m)){let e=hi.find(t.docView,f);if(!e)return d>o.top+o.height/2?o.to:o.from;({node:m,offset:b}=On(e.dom,c,u))}let w=t.docView.nearest(m);if(!w)return null;if(w.isWidget&&1==(null===(r=w.dom)||void 0===r?void 0:r.nodeType)){let t=w.dom.getBoundingClientRect();return e.y1.5*t.defaultLineHeight){r+=Math.floor((s-i.top)/t.defaultLineHeight)*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=f(t,n)}return!0===n?-1:t.length}(o,r,t.state.tabSize)}function wn(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=t.bidiSpans(s),o=t.textDirectionAt(s.from);for(let a=e,l=null;;){let e=Ji(s,r,o,a,i),h=Hi;if(!e){if(s.number==(i?t.state.doc.lines:1))return a;h="\n",s=t.state.doc.line(s.number+(i?1:-1)),r=t.bidiSpans(s),e=A.cursor(i?s.from:s.to)}if(l){if(!l(h))return a}else{if(!n)return e;l=n(h)}a=e}}function vn(t,e,i,n){let s=t.state.facet(Ri).map((e=>e(t)));for(;;){let t=!1;for(let r of s)r.between(i.from-1,i.from+1,((s,r,o)=>{i.from>s&&i.fromi.from?A.cursor(s,1):A.cursor(r,-1),t=!0,o.widget.skipPosition&&(i=o.widget.skipPosition(i,e,n)))}));if(!t)return i}}class yn{constructor(t){this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null;let e=(e,i)=>{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 Cn){let n=Cn[i];t.contentDOM.addEventListener(i,(i=>{Pn(t,i)&&e(n,i)}),_n[i]),this.registeredEvents.push(i)}t.scrollDOM.addEventListener("mousedown",(i=>{if(i.target==t.scrollDOM&&i.clientY>t.contentDOM.getBoundingClientRect().bottom&&(e(Cn.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)}})),De.chrome&&102==De.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,De.safari&&t.contentDOM.addEventListener("input",(()=>null))}setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}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=>{Pn(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){Qi(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){Qi(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||xn.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,be(t.contentDOM,e.key,e.keyCode))}ignoreDuringComposition(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(De.safari&&!De.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 Sn=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],xn="dthko",kn=[16,17,18,20,91,92,224,225];function Qn(t){return.7*Math.max(0,t)+8}class $n{constructor(t,e,i,n){this.view=t,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);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(xt.allowMultipleSelections)&&function(t,e){let i=t.state.facet(pi);return i.length?i[0](e):(De.mac,e.altKey)}(t,e),this.dragMove=function(t,e){let i=t.state.facet(Oi);return i.length?i[0](e):De.mac?!e.altKey:!e.ctrlKey}(t,e),this.dragging=!(!function(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let n=ie(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!=Yn(e))&&null}start(t){!1===this.dragging&&(t.preventDefault(),this.select(t))}move(t){var e;if(0==t.buttons)return this.destroy();if(!1!==this.dragging)return;this.select(this.lastEvent=t);let i=0,n=0,s=(null===(e=this.scrollParent)||void 0===e?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight};t.clientX<=s.left+6?i=-Qn(s.left-t.clientX):t.clientX>=s.right-6&&(i=Qn(t.clientX-s.right)),t.clientY<=s.top+6?n=-Qn(s.top-t.clientY):t.clientY>=s.bottom-6&&(n=Qn(t.clientY-s.bottom)),this.setScrollSpeed(i,n)}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)}select(t){let e=this.style.get(t,this.extend,this.multiple);!this.mustSelect&&e.eq(this.view.state.selection)&&e.main.assoc==this.view.state.selection.main.assoc||this.view.dispatch({selection:e,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.docChanged&&this.dragging&&(this.dragging=this.dragging.map(t.changes)),this.style.update(t)&&setTimeout((()=>this.select(this.lastEvent)),20)}}function Pn(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=Se.get(n))&&i.ignoreEvent(e))return!1;return!0}const Cn=Object.create(null),_n=Object.create(null),Xn=De.ie&&De.ie_version<15||De.ios&&De.webkit_version<604;function Zn(t,e){let i,{state:n}=t,s=1,r=n.toText(e),o=r.lines==n.selection.ranges.length;if(null!=Ln&&n.selection.ranges.every((t=>t.empty))&&Ln==r.toString()){let t=-1;i=n.changeByRange((i=>{let a=n.doc.lineAt(i.from);if(a.from==t)return{range:i};t=a.from;let l=n.toText((o?r.line(s++).text:e)+n.lineBreak);return{changes:{from:a.from,insert:l},range:A.cursor(i.from+l.length)}}))}else i=o?n.changeByRange((t=>{let e=r.line(s++);return{changes:{from:t.from,to:t.to,insert:e.text},range:A.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 A.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 A.cursor(e);0==r?i=1:r==s.length&&(i=-1);let o=r,a=r;i<0?o=f(s.text,r,!1):a=f(s.text,r);let l=n(s.text.slice(o,a));for(;o>0;){let t=f(s.text,o,!1);if(n(s.text.slice(t,o))!=l)break;o=t}for(;a{t.inputState.setSelectionOrigin("select"),27==e.keyCode&&(t.inputState.lastEscPress=Date.now())},Cn.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},Cn.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},_n.touchstart=_n.touchmove={passive:!0},Cn.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return;let i=null;for(let n of t.state.facet(gi))if(i=n(t,e),i)break;if(i||0!=e.button||(i=function(t,e){let i=Vn(t,e),n=Yn(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 a,l=Vn(t,e),h=An(t,l.pos,l.bias,n);if(i.pos!=l.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&&(a=function(t,e){for(let i=0;i=e)return A.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,l.pos))?a:o?s.addRange(h):A.create([h])}}}(t,e)),i){let n=t.root.activeElement!=t.contentDOM;t.inputState.startMouseSelection(new $n(t,e,i,n)),n&&t.observer.ignore((()=>ge(t.contentDOM))),t.inputState.mouseSelection&&t.inputState.mouseSelection.start(e)}};let Tn=(t,e)=>t>=e.top&&t<=e.bottom,Rn=(t,e,i)=>Tn(e,i)&&t>=i.left&&t<=i.right;function En(t,e,i,n){let s=hi.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&&Rn(i,n,o))return-1;let a=s.coordsAt(r,1);return a&&Rn(i,n,a)?1:o&&Tn(n,o)?-1:1}function Vn(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:En(t,i,e.clientX,e.clientY)}}const Mn=De.ie&&De.ie_version<=11;let Dn=null,Wn=0,Un=0;function Yn(t){if(!Mn)return t.detail;let e=Dn,i=Un;return Dn=t,Un=Date.now(),Wn=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Wn+1)%3:1}function qn(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&&r.dragMove?{from:r.dragging.from,to:r.dragging.to}:null,a={from:s,insert:i},l=t.state.changes(o?[o,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(s,-1),head:l.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"})}Cn.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")},Cn.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&&qn(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 qn(t,e,e.dataTransfer.getData("Text"),!0)},Cn.paste=(t,e)=>{if(t.state.readOnly)return e.preventDefault();t.observer.flush();let i=Xn?null:e.clipboardData;i?(Zn(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(),Zn(t,i.value)}),50)}(t)};let Ln=null;Cn.copy=Cn.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;Ln=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 zn=lt.define();function In(t,e){let i=[];for(let n of t.facet(vi)){let s=n(t,e);s&&i.push(s)}return i?t.update({effects:i,annotations:zn.of(!0)}):null}function Bn(t){setTimeout((()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=In(t.state,e);i?t.dispatch(i):t.update([])}}),10)}Cn.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),Bn(t)},Cn.blur=t=>{t.observer.clearSelectionRange(),Bn(t)},Cn.compositionstart=Cn.compositionupdate=t=>{null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},Cn.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,De.chrome&&De.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then((()=>t.observer.flush())):setTimeout((()=>{t.inputState.composing<0&&t.docView.compositionDeco.size&&t.update([])}),50)},Cn.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},Cn.beforeinput=(t,e)=>{var i;let n;if(De.chrome&&De.android&&(n=Sn.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 jn=["pre-wrap","normal","pre-line","break-spaces"];class Nn{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){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return jn.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i-1,a=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,a){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)>Jn&&(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:a,toA:l,fromB:h,toB:c}=n[o],u=s.lineAt(a,Hn.ByPosNoHeight,i.setDoc(e),0,0),d=u.to>=l?u:s.lineAt(l,Hn.ByPosNoHeight,i,0,0);for(c+=d.to-l,l=d.to;o>0&&u.from<=n[o-1].toA;)a=n[o-1].fromA,h=n[o-1].fromB,o--,a2*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 es extends ts{constructor(t,e){super(t,e,ii.Text),this.collapsed=0,this.widgetHeight=0}replace(t,e,i){let n=i[0];return 1==i.length&&(n instanceof es||n instanceof is&&4&n.flags)&&Math.abs(this.length-n.length)<10?(n instanceof is?n=new es(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.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class is 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:a}=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),l=o+r.length*a,h=Math.max(i,t-l/2);return new Fn(r.from,r.length,h,l,ii.Text)}{let n=Math.max(0,Math.min(r-s,Math.floor((t-i)/o))),{from:a,length:l}=e.doc.line(s+n);return new Fn(a,l,i+o*n,o,ii.Text)}}lineAt(t,e,i,n,s){if(e==Hn.ByHeight)return this.blockAt(t,i,n,s);if(e==Hn.ByPosNoHeight){let{from:e,to:n}=i.doc.lineAt(t);return new Fn(e,n-e,0,0,ii.Text)}let{firstLine:r,perLine:o,perChar:a}=this.heightMetrics(i,s),l=i.doc.lineAt(t),h=o+l.length*a,c=l.number-r,u=n+o*c+a*(l.from-s-c);return new Fn(l.from,l.length,Math.max(n,Math.min(u,n+this.height-h)),h,ii.Text)}forEachLine(t,e,i,n,s,r){t=Math.max(t,s),e=Math.min(e,s+this.length);let{firstLine:o,perLine:a,perChar:l}=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+=a*i+l*(t-s-i)}let n=a+l*e.length;r(new Fn(e.from,e.length,c,n,ii.Text)),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 is?i[i.length-1]=new is(t.length+n):i.push(null,new is(n-1))}if(t>0){let e=i[0];e instanceof is?i[0]=new is(t+e.length):i.unshift(new is(t-1),null)}return Kn.of(i)}decomposeLeft(t,e){e.push(new is(t-1),null)}decomposeRight(t,e){e.push(null,new is(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 is(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)>=Jn&&(o=-2);let a=new es(e,s);a.outdated=!1,i.push(a),r+=e+1}r<=s&&i.push(null,new is(s-r).updateHeight(t,r));let a=Kn.of(i);return(o<0||Math.abs(a.height-this.height)>=Jn||Math.abs(o-this.heightMetrics(t,e).perLine)>=Jn)&&(t.heightChanged=!0),a}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class ns 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 l;let h=e==Hn.ByPosNoHeight?Hn.ByPosNoHeight:Hn.ByPos;return a?l.join(this.right.lineAt(o,h,i,r,o)):this.left.lineAt(o,h,i,n,s).join(l)}forEachLine(t,e,i,n,s,r){let o=n+this.left.height,a=s+this.left.length+this.break;if(this.break)t=a&&this.right.forEachLine(t,e,i,o,a,r);else{let l=this.lineAt(a,Hn.ByPos,i,n,s);t=t&&l.from<=e&&r(l),e>l.to&&this.right.forEachLine(l.to+1,e,i,o,a,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&&ss(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,a=null;return n&&n.from<=e+s.length&&n.more?a=s=s.updateHeight(t,e,i,n):s.updateHeight(t,e,i),n&&n.from<=o+r.length&&n.more?a=r=r.updateHeight(t,o,i,n):r.updateHeight(t,o,i),a?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 ss(t,e){let i,n;null==t[e]&&(i=t[e-1])instanceof is&&(n=t[e+1])instanceof is&&t.splice(e-1,3,new is(i.length+1+n.length))}class rs{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 es?i.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new es(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)}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 es(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let i=new is(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 es)return t;let e=new es(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine(),t.type!=ii.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,t.type!=ii.WidgetBefore&&(this.covering=t)}addLineDeco(t,e){let i=this.ensureLine();i.length+=e,i.collapsed+=e,i.widgetHeight=Math.max(i.widgetHeight,t),this.writtenTo=this.pos=this.pos+e}finish(t){let e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof es||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),a=Math.max(a,n.top),l=e==t.parentNode?n.bottom:Math.min(l,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:a-(i.top+e),bottom:Math.max(a,l)-(i.top+e)}}function ls(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class hs{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 Nn(i),this.stateDeco=e.facet(Ti).filter((t=>"function"!=typeof t)),this.heightMap=Kn.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle.setDoc(e.doc),[new Mi(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ni.set(this.lineGaps.map((t=>t.draw(!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 ds(e,i))}}this.viewports=t.sort(((t,e)=>t.from-e.from)),this.scaler=this.heightMap.height<=7e6?gs:new ms(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:bs(t,this.scaler))}))}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=this.state.facet(Ti).filter((t=>"function"!=typeof t));let n=t.changedRanges,s=Mi.extendWithRanges(n,function(t,e,i){let n=new os;return _t.compare(t,e,i,n,0),n.changes}(i,this.stateDeco,t?t.changes:k.empty(this.state.doc.length))),r=this.heightMap.height;this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),s),this.heightMap.height!=r&&(t.flags|=2);let o=s.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.heado.to)||!this.viewportIsAppropriate(o))&&(o=this.getViewport(0,e));let a=!t.changes.empty||2&t.flags||o.from!=this.viewport.from||o.to!=this.viewport.to;this.viewport=o,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(Si)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let i=e.contentDOM,n=window.getComputedStyle(i),s=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Wi.RTL:Wi.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),a=i.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let h=0,c=0,u=parseInt(n.paddingTop)||0,d=parseInt(n.paddingBottom)||0;this.paddingTop==u&&this.paddingBottom==d||(this.paddingTop=u,this.paddingBottom=d,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let f=(this.printing?ls:as)(i,this.paddingTop),p=f.top-this.pixelViewport.top,O=f.bottom-this.pixelViewport.bottom;this.pixelViewport=f;let g=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(g!=this.inView&&(this.inView=g,g&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let m=a.width;if(this.contentDOMWidth==m&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,h|=8),l){let i=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(i)&&(o=!0),o||s.lineWrapping&&Math.abs(m-this.contentDOMWidth)>s.charWidth){let{lineHeight:t,charWidth:n,textHeight:a}=e.docView.measureTextSize();o=t>0&&s.refresh(r,t,n,a,m/n,i),o&&(e.docView.minWidth=0,h|=8)}p>0&&O>0?c=Math.max(p,O):p<0&&O<0&&(c=Math.min(p,O)),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 Mi(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new Gn(n.from,r))}s.heightChanged&&(h|=2)}let b=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return b&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(2&h||b)&&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,a=new ds(n.lineAt(r-1e3*i,Hn.ByHeight,s,0,0).from,n.lineAt(o+1e3*(1-i),Hn.ByHeight,s,0,0).to);if(e){let{head:t}=e.range;if(ta.to){let i,r=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=n.lineAt(t,Hn.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!=Wi.LTR&&!i)return[];let o=[],a=(n,r,l,h)=>{if(r-nn&&tt.from>=l.from&&t.to<=l.to&&Math.abs(t.from-n)t.frome))));if(!d){if(rt.from<=r&&t.to>=r))){let t=e.moveToLineBoundary(A.cursor(r),!1,!0).head;t>n&&(r=t)}d=new hs(n,r,this.gapSize(l,n,r,h))}o.push(d)};for(let t of this.viewportLines){if(t.lengtht.from&&a(t.from,s,t,e),ot.draw(this.heightOracle.lineWrapping)))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];_t.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))||bs(this.heightMap.lineAt(t,Hn.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return bs(this.heightMap.lineAt(this.scaler.fromDOM(t),Hn.ByHeight,this.heightOracle,0,0),this.scaler)}elementAtHeight(t){return bs(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 ds{constructor(t,e){this.from=t,this.to=e}}function fs(t,e,i){let n=[],s=t,r=0;return _t.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 Os(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 gs={toDOM:t=>t,fromDOM:t=>t,scale:1};class ms{constructor(t,e,i){let n=0,s=0,r=0;this.viewports=i.map((({from:i,to:s})=>{let r=e.lineAt(i,Hn.ByPos,t,0,0).top,o=e.lineAt(s,Hn.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=ebs(t,e))):t.type)}const ws=E.define({combine:t=>t.join(" ")}),vs=E.define({combine:t=>t.indexOf(!0)>-1}),ys=It.newName(),Ss=It.newName(),xs=It.newName(),ks={"&light":"."+Ss,"&dark":"."+xs};function Qs(t,e,i){return new It(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 $s=Qs("."+ys,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",borderRadius:"4px",marginTop:"0.5rem",width:"30%",minWidth:"190px",marginLeft:"auto",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&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:"#333338",fontSize:"70%",padding:".2em 1em",borderRadius:"4px"},"&light .cm-button":{background:"#eee"},"&dark .cm-button":{background:"#eee"},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",borderRadius:"0.25rem",border:"1px solid silver",padding:".0em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},ks);class Ps{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;i&&(e.push(new nn(i,n)),s==i&&r==n||e.push(new nn(s,r)));return e}(t),i=new tn(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?A.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||!ne(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||!ne(t.contentDOM,e.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(e.anchorNode,e.anchorOffset);this.newSel=A.single(n,i)}}}function Cs(e,i){let n,{newSel:s}=i,r=e.state.selection.main;if(i.bounds){let{from:s,to:o}=i.bounds,a=r.from,l=null;(8===e.inputState.lastKeyCode&&e.inputState.lastKeyTime>Date.now()-100||De.android&&i.text.length0&&a>0&&t.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if("end"==n){i-=o+Math.max(0,r-Math.min(o,a))-r}if(o=o?r-i:0,a=r+(a-o),o=r}else if(a=a?r-i:0,o=r+(o-a),a=r}return{from:r,toA:o,toB:a}}(e.state.doc.sliceString(s,o,Ki),i.text,a-s,l);h&&(De.chrome&&13==e.inputState.lastKeyCode&&h.toB==h.from+2&&i.text.slice(h.from,h.toB)==Ki+Ki&&h.toB--,n={from:s+h.from,to:s+h.toA,insert:t.of(i.text.slice(h.from,h.toB).split(Ki))})}else s&&(!e.hasFocus&&e.state.facet($i)||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))}:(De.mac||De.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=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}):De.chrome&&n&&n.from==n.to&&n.from==r.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(s&&(s=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}),n){let t=e.state;if(De.ios&&e.inputState.flushIOSKey(e))return!0;if(De.android&&(n.from==r.from&&n.to==r.to&&1==n.insert.length&&2==n.insert.lines&&be(e.contentDOM,"Enter",13)||n.from==r.from-1&&n.to==r.to&&0==n.insert.length&&be(e.contentDOM,"Backspace",8)||n.from==r.from&&n.to==r.to+1&&0==n.insert.length&&be(e.contentDOM,"Delete",46)))return!0;let i,o=n.insert.toString();if(e.state.facet(wi).some((t=>t(e,n.from,n.to,o))))return!0;if(e.inputState.composing>=0&&e.inputState.composing++,n.from>=r.from&&n.to<=r.to&&n.to-n.from>=(r.to-r.from)/3&&(!s||s.main.empty&&s.main.from==n.from+n.insert.length)&&e.inputState.composing<0){let s=r.fromn.to?t.sliceDoc(n.to,r.to):"";i=t.replaceSelection(e.state.toText(s+n.insert.sliceString(0,void 0,e.state.lineBreak)+o))}else{let o=t.changes(n),a=s&&s.main.to<=o.newLength?s.main:void 0;if(t.selection.ranges.length>1&&e.inputState.composing>=0&&n.to<=r.to&&n.to>=r.to-10){let s=e.state.sliceDoc(n.from,n.to),l=on(e)||e.state.doc.lineAt(r.head),h=r.to-n.to,c=r.to-r.from;i=t.changeByRange((i=>{if(i.from==r.from&&i.to==r.to)return{changes:o,range:a||i.map(o)};let u=i.to-h,d=u-s.length;if(i.to-i.from!=c||e.state.sliceDoc(d,u)!=s||l&&i.to>=l.from&&i.from<=l.to)return{range:i};let f=t.changes({from:d,to:u,insert:n.insert}),p=i.to-r.to;return{changes:f,range:a?A.range(Math.max(0,a.anchor+p),Math.max(0,a.head+p)):i.map(f)}}))}else i={changes:o,selection:a&&t.selection.replaceRange(a)}}let a="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,a+=".compose",e.inputState.compositionFirstChange&&(a+=".start",e.inputState.compositionFirstChange=!1)),e.dispatch(i,{scrollIntoView:!0,userEvent:a}),!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 _s={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Xs=De.ie&&De.ie_version<=11;class Zs{constructor(t){this.view=t,this.active=!1,this.selectionRange=new fe,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);(De.ie&&De.ie_version<=11||De.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()})),Xs&&(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")))}),{}),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($i)?i.root.activeElement!=this.dom:!se(i.dom,n))return;let s=n.anchorNode&&i.docView.nearest(n.anchorNode);s&&s.ignoreEvent(t)?e||(this.selectionChanged=!1):(De.ie&&De.ie_version<=11||De.android&&De.chrome)&&!i.state.selection.main.empty&&n.focusNode&&oe(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=De.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,a=t.docView.domAtPos(t.state.selection.main.anchor);oe(a.node,a.offset,r,o)&&([n,s,r,o]=[r,o,n,s]);return{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:o}}(this.view)||ie(t.root);if(!e||this.selectionRange.eq(e))return!1;let i=se(this.dom,e);return i&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let t=this.delayedAndroidKey;t&&(this.clearDelayedAndroidKey(),!this.flush()&&t.force&&be(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&&se(this.dom,this.selectionRange);return t<0&&!n?null:(t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new Ps(this.view,t,e,i))}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=Cs(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.dirty|=4),"childList"==t.type){let i=As(e,t.previousSibling||t.target.previousSibling,-1),n=As(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 As(t,e,i){for(;e;){let n=Se.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 Ts{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),this._dispatch=t.dispatch||(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 us(t.state||xt.create(t)),this.plugins=this.state.facet(Ci).map((t=>new Xi(t)));for(let t of this.plugins)t.update(this);this.observer=new Zs(this),this.inputState=new yn(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new sn(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),t.parent&&t.parent.appendChild(this.dom)}get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}dispatch(...t){this._dispatch(1==t.length&&t[0]instanceof dt?t[0]:this.state.update(...t))}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,a=null;t.some((t=>t.annotation(zn)))?(this.inputState.notifiedFocused=r,o=1):r!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=r,a=In(s,r),a||(o=1));let l=this.observer.delayedAndroidKey,h=null;if(l?(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(xt.phrases)!=this.state.facet(xt.phrases))return this.setState(s);e=Di.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 xi(t.empty?t:A.cursor(t.head,t.head>t.anchor?-1:1))}for(let t of e.effects)t.is(ki)&&(c=t.value)}this.viewState.update(e,c),this.bidiCache=Vs.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),i=this.docView.update(e),this.state.facet(Vi)!=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(ws)!=e.state.facet(ws)&&(this.viewState.mustMeasureContent=!0),(i||n||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!e.empty)for(let t of this.state.facet(bi))t(e);(a||h)&&Promise.resolve().then((()=>{a&&this.state==a.startState&&this.dispatch(a),h&&!Cs(this,h)&&l.force&&be(this.contentDOM,l.key,l.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 us(t),this.plugins=t.facet(Ci).map((t=>new Xi(t))),this.pluginMap.clear();for(let t of this.plugins)t.update(this);this.docView=new sn(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(Ci),i=t.state.facet(Ci);if(e!=i){let n=[];for(let s of i){let i=e.indexOf(s);if(i<0)n.push(new Xi(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.measureScheduled=0,t&&this.observer.forceFlush();let e=null,{scrollHeight:i,scrollTop:n,clientHeight:s}=this.scrollDOM,r=n>i-s-4?i:n;try{for(let t=0;;t++){this.updateState=1;let i=this.viewport,n=this.viewState.lineBlockAtHeight(r),s=this.viewState.measure(this);if(!s&&!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 o=[];4&s||([this.measureRequests,o]=[o,this.measureRequests]);let a=o.map((t=>{try{return t.read(this)}catch(t){return Qi(this.state,t),Es}})),l=Di.create(this,this.state,[]),h=!1,c=!1;l.flags|=s,e?e.flags|=s:e=l,this.updateState=2,l.empty||(this.updatePlugins(l),this.inputState.update(l),this.updateAttrs(),h=this.docView.update(l));for(let t=0;t1||t<-1)&&(this.scrollDOM.scrollTop+=t,c=!0)}if(h&&this.docView.updateSelection(!0),this.viewport.from==i.from&&this.viewport.to==i.to&&!c&&0==this.measureRequests.length)break}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let t of this.state.facet(bi))t(e)}get themeClasses(){return ys+" "+(this.state.facet(vs)?xs:Ss)+" "+this.state.facet(ws)}updateAttrs(){let t=Ms(this,Zi,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet($i)?"true":"false",class:"cm-content",style:`${De.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Ms(this,Ai,e);let i=this.observer.ignore((()=>{let i=ti(this.contentDOM,this.contentAttrs,e),n=ti(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)if(t.is(Ts.announce)){e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(Vi),It.mount(this.root,this.styleModules.concat($s).reverse())}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}}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 vn(this,t,wn(this,t,e,i))}moveByCharSelected(t,e,i){return vn(this,t,wn(this,t,e,i),!0)}moveByGroup(t,e){return vn(this,t,wn(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==wt.Space&&(s=e),s==e}}(this,t.head,e))))}moveToLineBoundary(t,e,i=!0){return function(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=n&&t.lineWrapping?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==Wi.LTR)?e.right-1:e.left+1,y:(r.top+r.bottom)/2});if(null!=o)return A.cursor(o,i?-1:1)}let o=hi.find(t.docView,e.head),a=o?i?o.posAtEnd:o.posAtStart:i?s.to:s.from;return A.cursor(a,i?-1:1)}(this,t,e,i)}moveVertically(t,e,i){return vn(this,t,function(t,e,i,n){let s=e.head,r=i?1:-1;if(s==(i?t.state.doc.length:0))return A.cursor(s,e.assoc);let o,a=e.goalColumn,l=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s),c=t.documentTop;if(h)null==a&&(a=h.left-l.left),o=r<0?h.top:h.bottom;else{let e=t.viewState.lineBlockAt(s);null==a&&(a=Math.min(l.right-l.left,t.defaultCharacterWidth*(s-e.from))),o=(r<0?e.top:e.bottom)+c}let u=l.left+a,d=null!=n?n:t.defaultLineHeight>>1;for(let i=0;;i+=10){let n=o+(d+i)*r,h=mn(t,{x:u,y:n},!1,r);if(nl.bottom||(r<0?hs))return A.cursor(h,e.assoc,void 0,a)}}(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(),mn(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 ue(i,s[Ni.find(s,t-n.from,-1,e)].dir==Wi.LTR==e>0)}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(yi)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Rs)return Fi(t.length);let e=this.textDirectionAt(t.from);for(let i of this.bidiCache)if(i.from==t.from&&i.dir==e)return i.order;let i=function(t,e){let i=t.length,n=e==Ui?1:2,s=e==Ui?2:1;if(!t||1==n&&!ji.test(t))return Fi(i);for(let e=0,s=n,o=n;e=0;t-=3)if(Bi[t+1]==-r){let e=Bi[t+2],i=2&e?n:4&e?1&e?s:n:0;i&&(Gi[a]=Gi[Bi[t]]=i),l=t;break}}else{if(189==Bi.length)break;Bi[l++]=a,Bi[l++]=e,Bi[l++]=h}else if(2==(o=Gi[a])||1==o){let t=o==n;h=t?0:1;for(let e=l-3;e>=0;e-=3){let i=Bi[e+2];if(2&i)break;if(t)Bi[e+2]|=2;else{if(4&i)break;Bi[e+2]|=4}}}for(let t=0;te;){let t=i,n=2!=Gi[--i];for(;i>e&&n==(2!=Gi[i-1]);)i--;o.push(new Ni(i,t,n?2:1))}else o.push(new Ni(e,t,0))}else for(let t=0;tDate.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{ge(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 ki.of(new xi("number"==typeof t?A.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}static domEventHandlers(t){return _i.define((()=>({})),{eventHandlers:t})}static theme(t,e){let i=It.newName(),n=[ws.of(i),Vi.of(Qs(`.${i}`,t))];return e&&e.dark&&n.push(vs.of(!0)),n}static baseTheme(t){return N.lowest(Vi.of(Qs("."+ys,t,ks)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),n=i&&Se.get(i)||Se.get(t);return(null===(e=null==n?void 0:n.rootView)||void 0===e?void 0:e.view)||null}}Ts.styleModule=Vi,Ts.inputHandler=wi,Ts.focusChangeEffect=vi,Ts.perLineTextDirection=yi,Ts.exceptionSink=mi,Ts.updateListener=bi,Ts.editable=$i,Ts.mouseSelectionStyle=gi,Ts.dragMovesSelection=Oi,Ts.clickAddsSelectionRange=pi,Ts.decorations=Ti,Ts.atomicRanges=Ri,Ts.scrollMargins=Ei,Ts.darkTheme=vs,Ts.contentAttributes=Ai,Ts.editorAttributes=Zi,Ts.lineWrapping=Ts.contentAttributes.of({class:"cm-lineWrapping"}),Ts.announce=ut.define();const Rs=4096,Es={};class Vs{constructor(t,e,i,n){this.from=t,this.to=e,this.dir=i,this.order=n}static update(t,e){if(e.empty)return t;let i=[],n=t.length?t[t.length-1].dir:Wi.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&&Je(r,i)}return i}const Ds=De.mac?"mac":De.windows?"win":De.linux?"linux":"key";function Ws(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 Us=N.default(Ts.domEventHandlers({keydown:(t,e)=>Bs(Ls(e.state),t,e,"editor")})),Ys=E.define({enables:Us}),qs=new WeakMap;function Ls(t){let e=t.facet(Ys),i=qs.get(e);return i||qs.set(e,i=function(t,e=Ds){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)=>{var a,l;let h=i[t]||(i[t]=Object.create(null)),c=n.split(/ (?!$)/).map((t=>function(t,e){const i=t.split(/-(?!$)/);let n,s,r,o,a=i[i.length-1];"Space"==a&&(a=" ");for(let t=0;t{let n=zs={view:e,prefix:i,scope:t};return setTimeout((()=>{zs==n&&(zs=null)}),Is),!0}]})}let u=c.join(" ");s(u,!1);let d=h[u]||(h[u]={preventDefault:!1,run:(null===(l=null===(a=h._any)||void 0===a?void 0:a.run)||void 0===l?void 0:l.slice())||[]});r&&d.run.push(r),o&&(d.preventDefault=!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,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.shift&&r(e,"Shift-"+s,n.shift,n.preventDefault)}return i}(e.reduce(((t,e)=>t.concat(e)),[]))),i}let zs=null;const Is=4e3;function Bs(t,e,i,n){let s=function(t){var e=!(Kt&&(t.ctrlKey||t.altKey||t.metaKey)||Jt&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?Gt:Nt)[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=v(b(s,0))==s.length&&" "!=s,o="",a=!1;zs&&zs.view==i&&zs.scope==n&&(o=zs.prefix+" ",(a=kn.indexOf(e.keyCode)<0)&&(zs=null));let l,h,c=new Set,u=t=>{if(t){for(let n of t.run)if(!c.has(n)&&(c.add(n),n(i,e)))return!0;t.preventDefault&&(a=!0)}return!1},d=t[n];if(d){if(u(d[o+Ws(s,e,!r)]))return!0;if(r&&(e.altKey||e.metaKey||e.ctrlKey)&&!(De.windows&&e.ctrlKey&&e.altKey)&&(l=Nt[e.keyCode])&&l!=s){if(u(d[o+Ws(l,e,!0)]))return!0;if(e.shiftKey&&(h=Gt[e.keyCode])!=s&&h!=l&&u(d[o+Ws(h,e,!1)]))return!0}else if(r&&e.shiftKey&&u(d[o+Ws(s,e,!0)]))return!0;if(u(d._any))return!0}return a}class js{constructor(t,e,i,n,s){this.className=t,this.left=e,this.top=i,this.width=n,this.height=s}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className==this.className&&(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",null!=this.width&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,i){if(i.empty){let n=t.coordsAtPos(i.head,i.assoc||1);if(!n)return[];let s=Ns(t);return[new js(e,n.left-s.left,n.top-s.top,null,n.bottom-n.top)]}return function(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];let n=Math.max(i.from,t.viewport.from),s=Math.min(i.to,t.viewport.to),r=t.textDirection==Wi.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=Ns(t),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),u=a.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),d=a.right-(c?parseInt(c.paddingRight):0),f=Fs(t,n),p=Fs(t,s),O=f.type==ii.Text?f:null,g=p.type==ii.Text?p:null;t.lineWrapping&&(O&&(O=Gs(t,n,O)),g&&(g=Gs(t,s,g)));if(O&&g&&O.from==g.from)return b(w(i.from,i.to,O));{let e=O?w(i.from,null,O):v(f,!1),n=g?w(null,i.to,g):v(p,!0),s=[];return(O||f).to<(g||p).from-1?s.push(m(u,e.bottom,d,n.top)):e.bottomh&&n.from=r)break;a>s&&l(Math.max(t,s),null==e&&t<=h,Math.min(a,r),null==i&&a>=c,o.dir)}if(s=n.to+1,s>=r)break}return 0==a.length&&l(h,null==e,c,null==i,t.textDirection),{top:s,bottom:o,horizontal:a}}function v(t,e){let i=a.top+(e?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]}}}(t,e,i)}}function Ns(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Wi.LTR?e.left:e.right-t.scrollDOM.clientWidth)-t.scrollDOM.scrollLeft,top:e.top-t.scrollDOM.scrollTop}}function Gs(t,e,i){let n=A.cursor(e);return{from:Math.max(i.from,t.moveToLineBoundary(n,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(n,!0,!0).from),type:ii.Text}}function Fs(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==ii.Text))return t;return i}class Hs{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),e.above&&this.dom.classList.add("cm-layer-above"),e.class&&this.dom.classList.add(e.class),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(Js)!=t.state.facet(Js)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&t.view.requestMeasure(this.measureReq)}setOrder(t){let e=0,i=t.facet(Js);for(;e{return i=t,n=this.drawn[e],!(i.constructor==n.constructor&&i.eq(n));var i,n}))){let e=this.dom.firstChild,i=0;for(let n of t)n.update&&e&&n.constructor&&this.drawn[i].constructor&&n.update(e,this.drawn[i])?(e=e.nextSibling,i++):this.dom.insertBefore(n.draw(),e);for(;e;){let t=e.nextSibling;e.remove(),e=t}this.drawn=t}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Js=E.define();function Ks(t){return[_i.define((e=>new Hs(e,t))),Js.of(t)]}const tr=!De.ios,er=E.define({combine:t=>kt(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})});function ir(t={}){return[er.of(t),sr,or,lr,Si.of(!0)]}function nr(t){return t.startState.facet(er)!=t.state.facet(er)}const sr=Ks({above:!0,markers(t){let{state:e}=t,i=e.facet(er),n=[];for(let s of e.selection.ranges){let r=s==e.selection.main;if(s.empty?!r||tr:i.drawRangeCursor){let e=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",i=s.empty?s:A.cursor(s.head,s.head>s.anchor?-1:1);for(let s of js.forRange(t,e,i))n.push(s)}}return n},update(t,e){t.transactions.some((t=>t.selection))&&(e.style.animationName="cm-blink"==e.style.animationName?"cm-blink2":"cm-blink");let i=nr(t);return i&&rr(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){rr(e.state,t)},class:"cm-cursorLayer"});function rr(t,e){e.style.animationDuration=t.facet(er).cursorBlinkRate+"ms"}const or=Ks({above:!1,markers:t=>t.state.selection.ranges.map((e=>e.empty?[]:js.forRange(t,"cm-selectionBackground",e))).reduce(((t,e)=>t.concat(e))),update:(t,e)=>t.docChanged||t.selectionSet||t.viewportChanged||nr(t),class:"cm-selectionLayer"}),ar={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};tr&&(ar[".cm-line"].caretColor="transparent !important");const lr=N.highest(Ts.theme(ar)),hr=ut.define({map:(t,e)=>null==t?null:e.mapPos(t)}),cr=q.define({create:()=>null,update:(t,e)=>(null!=t&&(t=e.changes.mapPos(t)),e.effects.reduce(((t,e)=>e.is(hr)?e.value:t),t))}),ur=_i.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let i=t.state.field(cr);null==i?null!=this.cursor&&(null===(e=this.cursor)||void 0===e||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(cr)!=i||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let t=this.view.state.field(cr),e=null!=t&&this.view.coordsAtPos(t);if(!e)return null;let i=this.view.scrollDOM.getBoundingClientRect();return{left:e.left-i.left+this.view.scrollDOM.scrollLeft,top:e.top-i.top+this.view.scrollDOM.scrollTop,height:e.bottom-e.top}}drawCursor(t){this.cursor&&(t?(this.cursor.style.left=t.left+"px",this.cursor.style.top=t.top+"px",this.cursor.style.height=t.height+"px"):this.cursor.style.left="-100000px")}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(cr)!=t&&this.view.dispatch({effects:hr.of(t)})}},{eventHandlers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){t.target!=this.view.contentDOM&&this.view.contentDOM.contains(t.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function dr(){return[cr,ur]}function fr(t,e,i,n,s){e.lastIndex=0;for(let r,o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)if(!o.lineBreak)for(;r=e.exec(o.value);)s(a+r.index,r)}class pr{constructor(t){const{regexp:e,decoration:i,decorate:n,boundary:s,maxLength:r=1e3}=t;if(!e.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=e,n)this.addMatch=(t,e,i,s)=>n(s,i,i+t[0].length,t,e);else if("function"==typeof i)this.addMatch=(t,e,n,s)=>{let r=i(t,e,n);r&&s(n,n+t[0].length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(t,e,n,s)=>s(n,n+t[0].length,i)}this.boundary=s,this.maxLength=r}createDeco(t){let e=new Xt,i=e.add.bind(e);for(let{from:e,to:n}of function(t,e){let i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;let n=[];for(let{from:s,to:r}of i)s=Math.max(t.state.doc.lineAt(s).from,s-e),r=Math.min(t.state.doc.lineAt(r).to,r+e),n.length&&n[n.length-1].to>=s?n[n.length-1].to=r:n.push({from:s,to:r});return n}(t,this.maxLength))fr(t.state.doc,this.regexp,e,n,((e,n)=>this.addMatch(n,t,e,i)));return e.finish()}updateDeco(t,e){let i=1e9,n=-1;return t.docChanged&&t.changes.iterChanges(((e,s,r,o)=>{o>t.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e}updateRange(t,e,i,n){for(let s of t.visibleRanges){let r=Math.max(s.from,i),o=Math.min(s.to,n);if(o>r){let i=t.state.doc.lineAt(r),n=i.toi.from;r--)if(this.boundary.test(i.text[r-1-i.from])){a=r;break}for(;oc.push(i.range(t,e));if(i==n)for(this.regexp.lastIndex=a-i.from;(h=this.regexp.exec(i.text))&&h.indexthis.addMatch(i,t,e,u)));e=e.update({filterFrom:a,filterTo:l,filter:(t,e)=>tl,add:c})}}return e}}const Or=null!=/x/.unicode?"gu":"g",gr=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",Or),mr={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let br=null;const wr=E.define({combine(t){let e=kt(t,{render:null,specialChars:gr,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==br&&"undefined"!=typeof document&&document.body){let e=document.body.style;br=null!=(null!==(t=e.tabSize)&&void 0!==t?t:e.MozTabSize)}return br||!1}())&&(e.specialChars=new RegExp("\t|"+e.specialChars.source,Or)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Or)),e}});function vr(t={}){return[wr.of(t),yr||(yr=_i.fromClass(class{constructor(t){this.view=t,this.decorations=ni.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(wr)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new pr({regexp:t.specialChars,decoration:(e,i,n)=>{let{doc:s}=i.state,r=b(e[0],0);if(9==r){let t=s.lineAt(n),e=i.state.tabSize,r=Yt(t.text,e,n-t.from);return ni.replace({widget:new xr((e-r%e)*this.view.defaultCharacterWidth)})}return this.decorationCache[r]||(this.decorationCache[r]=ni.replace({widget:new Sr(t,r)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(wr);t.startState.facet(wr)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))]}let yr=null;class Sr extends ei{constructor(t,e){super(),this.options=t,this.code=e}eq(t){return t.code==this.code}toDOM(t){let e=function(t){return t>=32?"•":10==t?"␤":String.fromCharCode(9216+t)}(this.code),i=t.state.phrase("Control character")+" "+(mr[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,i,e);if(n)return n;let s=document.createElement("span");return s.textContent=e,s.title=i,s.setAttribute("aria-label",i),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class xr extends ei{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent="\t",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}class kr extends ei{constructor(t){super(),this.content=t}toDOM(){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):this.content),"string"==typeof this.content?t.setAttribute("aria-label","placeholder "+this.content):t.setAttribute("aria-hidden","true"),t}ignoreEvent(){return!1}}const Qr="-10000px";class $r{constructor(t,e,i){this.facet=e,this.createTooltipView=i,this.input=t.state.facet(e),this.tooltips=this.input.filter((t=>t)),this.tooltipViews=this.tooltips.map(i)}update(t){var e;let i=t.state.facet(this.facet),n=i.filter((t=>t));if(i===this.input){for(let e of this.tooltipViews)e.update&&e.update(t);return!1}let s=[];for(let e=0;e{var e,i,n;return{position:De.ios?"absolute":(null===(e=t.find((t=>t.position)))||void 0===e?void 0:e.position)||"fixed",parent:(null===(i=t.find((t=>t.parent)))||void 0===i?void 0:i.parent)||null,tooltipSpace:(null===(n=t.find((t=>t.tooltipSpace)))||void 0===n?void 0:n.tooltipSpace)||Pr}}}),_r=new WeakMap,Xr=_i.fromClass(class{constructor(t){this.view=t,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(Cr);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new $r(t,Tr,(t=>this.createTooltip(t))),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout((()=>{this.measureTimeout=-1,this.maybeMeasure()}),50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t);e&&this.observeIntersection();let i=e||t.geometryChanged,n=t.state.facet(Cr);if(n.position!=this.position){this.position=n.position;for(let t of this.manager.tooltipViews)t.dom.style.position=this.position;i=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let t of this.manager.tooltipViews)this.container.appendChild(t.dom);i=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure()}createTooltip(t){let e=t.create(this.view);if(e.dom.classList.add("cm-tooltip"),t.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",e.dom.appendChild(t)}return e.dom.style.position=this.position,e.dom.style.top=Qr,this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var t,e;this.view.win.removeEventListener("resize",this.measureSoon);for(let e of this.manager.tooltipViews)e.dom.remove(),null===(t=e.destroy)||void 0===t||t.call(e);null===(e=this.intersectionObserver)||void 0===e||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=this.view.dom.getBoundingClientRect();return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map(((t,e)=>{let i=this.manager.tooltipViews[e];return i.getCoords?i.getCoords(t.pos):this.view.coordsAtPos(t.pos)})),size:this.manager.tooltipViews.map((({dom:t})=>t.getBoundingClientRect())),space:this.view.state.facet(Cr).tooltipSpace(this.view)}}writeMeasure(t){var e;let{editor:i,space:n}=t,s=[];for(let r=0;r=Math.min(i.bottom,n.bottom)||h.rightMath.min(i.right,n.right)+.1){l.style.top=Qr;continue}let u=o.arrow?a.dom.querySelector(".cm-tooltip-arrow"):null,d=u?7:0,f=c.right-c.left,p=null!==(e=_r.get(a))&&void 0!==e?e:c.bottom-c.top,O=a.offset||Ar,g=this.view.textDirection==Wi.LTR,m=c.width>n.right-n.left?g?n.left:n.right-c.width:g?Math.min(h.left-(u?14:0)+O.x,n.right-f):Math.max(n.left,h.left-f+(u?14:0)-O.x),b=!!o.above;!o.strictSide&&(b?h.top-(c.bottom-c.top)-O.yn.bottom)&&b==n.bottom-h.bottom>h.top-n.top&&(b=!b);let w=(b?h.top-n.top:n.bottom-h.bottom)-d;if(wm&&t.topv&&(v=b?t.top-p-2-d:t.bottom+d+2);"absolute"==this.position?(l.style.top=v-t.parent.top+"px",l.style.left=m-t.parent.left+"px"):(l.style.top=v+"px",l.style.left=m+"px"),u&&(u.style.left=h.left+(g?O.x:-O.x)-(m+14-7)+"px"),!0!==a.overlap&&s.push({left:m,top:v,right:y,bottom:v+p}),l.classList.toggle("cm-tooltip-above",b),l.classList.toggle("cm-tooltip-below",!b),a.positioned&&a.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=Qr}},{eventHandlers:{scroll(){this.maybeMeasure()}}}),Zr=Ts.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Ar={x:0,y:0},Tr=E.define({enables:[Xr,Zr]});function Rr(t,e){let i=t.plugin(Xr);if(!i)return null;let n=i.manager.tooltips.indexOf(e);return n<0?null:i.manager.tooltipViews[n]}const Er=E.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 Vr(t,e){let i=t.plugin(Mr),n=i?i.specs.indexOf(e):-1;return n>-1?i.panels[n]:null}const Mr=_i.fromClass(class{constructor(t){this.input=t.state.facet(Ur),this.specs=this.input.filter((t=>t)),this.panels=this.specs.map((e=>e(t)));let e=t.state.facet(Er);this.top=new Dr(t,!0,e.topContainer),this.bottom=new Dr(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(Er);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Dr(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Dr(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(Ur);if(i!=this.input){let e=i.filter((t=>t)),n=[],s=[],r=[],o=[];for(let i of e){let e,a=this.specs.indexOf(i);a<0?(e=i(t.view),o.push(e)):(e=this.panels[a],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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}}))});class Dr{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=Wr(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=Wr(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 Wr(t){let e=t.nextSibling;return t.remove(),e}const Ur=E.define({enables:Mr});class Yr extends Qt{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Yr.prototype.elementClass="",Yr.prototype.toDOM=void 0,Yr.prototype.mapMode=S.TrackBefore,Yr.prototype.startSide=Yr.prototype.endSide=-1,Yr.prototype.point=!0;const qr=E.define(),Lr={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>_t.empty,lineMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},zr=E.define();function Ir(t){return[jr(),zr.of(Object.assign(Object.assign({},Lr),t))]}const Br=E.define({combine:t=>t.some((t=>t))});function jr(t){let e=[Nr];return t&&!1===t.fixed&&e.push(Br.of(!0)),e}const Nr=_i.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+"px",this.gutters=t.state.facet(zr).map((e=>new Jr(t,e)));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!t.state.facet(Br),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(Br)!=!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=_t.iter(this.view.state.facet(qr),this.view.viewport.from),n=[],s=this.gutters.map((t=>new Hr(t,this.view.viewport,-this.view.documentPadding.top)));for(let t of this.view.viewportLineBlocks){let e;if(Array.isArray(t.type)){for(let i of t.type)if(i.type==ii.Text){e=i;break}}else e=t.type==ii.Text?t:void 0;if(e){n.length&&(n=[]),Fr(i,n,t.from);for(let t of s)t.line(this.view,e,n)}}for(let t of s)t.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(zr),i=t.state.facet(zr),n=t.docChanged||t.heightChanged||t.viewportChanged||!_t.eq(t.startState.facet(qr),t.state.facet(qr),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 Jr(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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&0!=i.gutters.length&&i.fixed?e.textDirection==Wi.LTR?{left:i.dom.offsetWidth}:{right:i.dom.offsetWidth}:null}))});function Gr(t){return Array.isArray(t)?t:[t]}function Fr(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class Hr{constructor(t,e,i){this.gutter=t,this.height=i,this.i=0,this.cursor=_t.iter(t.markers,e.from)}line(t,e,i){let n=[];Fr(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;if(0==n.length&&!r.config.renderEmptyElements)return;let o=e.top-this.height;if(this.i==r.elements.length){let i=new Kr(t,e.height,o,n);r.elements.push(i),r.dom.appendChild(i.dom)}else r.elements[this.i].update(t,e.height,o,n);this.height=e.bottom,this.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 Jr{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=Gr(e.markers(t)),e.initialSpacer&&(this.spacer=new Kr(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=Gr(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!_t.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 Kr{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.dom.style.height=(this.height=e)+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),function(t,e){if(t.length!=e.length)return!1;for(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 io extends Yr{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function no(t,e){return t.state.facet(eo).formatNumber(e,t.state)}const so=zr.compute([eo],(t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:t=>t.state.facet(to),lineMarker:(t,e,i)=>i.some((t=>t.toDOM))?null:new io(no(t,t.state.doc.lineAt(e.from).number)),lineMarkerChange:t=>t.startState.facet(eo)!=t.state.facet(eo),initialSpacer:t=>new io(no(t,ro(t.state.doc.lines))),updateSpacer(t,e){let i=no(e.view,ro(e.view.state.doc.lines));return i==t.number?t:new io(i)},domEventHandlers:t.facet(eo).domEventHandlers})));function ro(t){let e=9;for(;e{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=fo.match(t)),e=>{let i=t(e);return void 0===i?null:[this,i]}}}ho.closedBy=new ho({deserialize:t=>t.split(" ")}),ho.openedBy=new ho({deserialize:t=>t.split(" ")}),ho.group=new ho({deserialize:t=>t.split(" ")}),ho.contextHash=new ho({perNode:!0}),ho.lookAhead=new ho({perNode:!0}),ho.mounted=new ho({perNode:!0});class co{constructor(t,e,i){this.tree=t,this.overlay=e,this.parser=i}}const uo=Object.create(null);class fo{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):uo,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),n=new fo(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(ho.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(ho.group),n=-1;n<(i?i.length:0);n++){let s=e[n<0?t.name:i[n]];if(s)return s}}}}fo.none=new fo("",Object.create(null),0,8);class po{constructor(t){this.types=t;for(let e=0;e=n&&(r.type.isAnonymous||!1!==e(r))){if(r.firstChild())continue;t=!0}for(;t&&i&&!r.type.isAnonymous&&i(r),!r.nextSibling();){if(!r.parent())return;t=!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:To(fo.none,this.children,this.positions,0,this.children.length,0,this.length,((t,e,i)=>new bo(this.type,t,e,i,this.propValues)),t.makeTree||((t,e,i)=>new bo(fo.none,t,e,i)))}static build(t){return function(t){var e;let{buffer:i,nodeSet:n,maxBufferLength:s=oo,reused:r=[],minRepeatType:o=n.types.length}=t,a=Array.isArray(i)?new wo(i,i.length):i,l=n.types,h=0,c=0;function u(t,e,i,m,b){let{id:w,start:v,end:y,size:S}=a,x=c;for(;S<0;){if(a.next(),-1==S){let e=r[w];return i.push(e),void m.push(v-t)}if(-3==S)return void(h=w);if(-4==S)return void(c=w);throw new RangeError(`Unrecognized record size: ${S}`)}let k,Q,$=l[w],P=v-t;if(y-v<=s&&(Q=O(a.pos-e,b))){let e=new Uint16Array(Q.size-Q.skip),i=a.pos-Q.size,s=e.length;for(;a.pos>i;)s=g(Q.start,e,s);k=new vo(e,y-Q.start,n),P=Q.start-t}else{let t=a.pos-S;a.next();let e=[],i=[],n=w>=o?w:-1,r=0,l=y;for(;a.pos>t;)n>=0&&a.id==n&&a.size>=0?(a.end<=l-s&&(f(e,i,v,r,a.end,l,n,x),r=e.length,l=a.end),a.next()):u(v,t,e,i,n);if(n>=0&&r>0&&r-1&&r>0){let t=d($);k=To($,e,i,0,e.length,0,y-v,t,t)}else k=p($,e,i,y-v,x-y)}i.push(k),m.push(P)}function d(t){return(e,i,n)=>{let s,r,o=0,a=e.length-1;if(a>=0&&(s=e[a])instanceof bo){if(!a&&s.type==t&&s.length==n)return s;(r=s.prop(ho.lookAhead))&&(o=i[a]+s.length+r)}return p(t,e,i,n,o)}}function f(t,e,i,s,r,o,a,l){let h=[],c=[];for(;t.length>s;)h.push(t.pop()),c.push(e.pop()+i-r);t.push(p(n.types[a],h,c,o-r,l-o)),e.push(r-i)}function p(t,e,i,n,s=0,r){if(h){let t=[ho.contextHash,h];r=r?[t].concat(r):[t]}if(s>25){let t=[ho.lookAhead,s];r=r?[t].concat(r):[t]}return new bo(t,e,i,n,r)}function O(t,e){let i=a.fork(),n=0,r=0,l=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=l,l+=4,n+=4,i.next();continue}let a=i.pos-t;if(t<0||a=o?4:0,d=i.start;for(i.next();i.pos>a;){if(i.size<0){if(-3!=i.size)break t;u+=4}else i.id>=o&&(u+=4);i.next()}r=d,n+=t,l+=u}return(e<0||n==t)&&(c.size=n,c.start=r,c.skip=l),c.size>4?c:void 0}function g(t,e,i){let{id:n,start:s,end:r,size:l}=a;if(a.next(),l>=0&&n4){let n=a.pos-(l-4);for(;a.pos>n;)i=g(t,e,i)}e[--i]=o,e[--i]=r-t,e[--i]=s-t,e[--i]=n}else-3==l?h=n:-4==l&&(c=n);return i}let m=[],b=[];for(;a.pos>0;)u(t.start||0,t.bufferStart||0,m,b,-1);let w=null!==(e=t.length)&&void 0!==e?e:m.length?b[0]+m[0].length:0;return new bo(l[t.topID],m.reverse(),b.reverse(),w)}(t)}}bo.empty=new bo(fo.none,[],[],0);class wo{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 wo(this.buffer,this.index)}}class vo{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return fo.none}toString(){let t=[];for(let e=0;e0));a=r[a+3]);return o}slice(t,e,i){let n=this.buffer,s=new Uint16Array(e-t),r=0;for(let o=t,a=0;o=e&&ie;case 1:return i<=e&&n>e;case 2:return n>e;case 4:return!0}}function So(t,e){let i=t.childBefore(e);for(;i;){let e=i.lastChild;if(!e||e.to!=i.to)break;e.type.isError&&e.from==e.to?(t=i,i=e.prevSibling):i=e}return t}function xo(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!=l;t+=e){let l=o[t],h=a[t]+r.from;if(yo(n,i,h,h+l.length))if(l instanceof vo){if(s&mo.ExcludeBuffers)continue;let o=l.findChild(0,l.buffer.length,e,i-h,n);if(o>-1)return new Co(new Po(r,l,t,h),null,o)}else if(s&mo.IncludeAnonymous||!l.type.isAnonymous||Xo(l)){let o;if(!(s&mo.IgnoreMounts)&&l.props&&(o=l.prop(ho.mounted))&&!o.overlay)return new ko(o.tree,h,t,r);let a=new ko(l,h,t,r);return s&mo.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(e<0?l.children.length-1:0,e,i,n)}}if(s&mo.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&mo.IgnoreOverlays)&&(n=this._tree.prop(ho.mounted))&&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 ko(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}cursor(t=0){return new _o(this,t)}get tree(){return this._tree}toTree(){return this._tree}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return So(this,t)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}toString(){return this._tree.toString()}get node(){return this}matchContext(t){return $o(this,t)}}function Qo(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 $o(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 Po{constructor(t,e,i,n){this.parent=t,this.buffer=e,this.index=i,this.start=n}}class Co{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){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 Co(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&mo.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 Co(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 Co(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 Co(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}cursor(t=0){return new _o(this,t)}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 bo(this.type,t,e,this.to-this.from)}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return So(this,t)}toString(){return this.context.buffer.childString(this.index)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}get node(){return this}matchContext(t){return $o(this,t)}}class _o{get name(){return this.type.name}constructor(t,e=0){if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof ko)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let e=t._parent;e;e=e._parent)this.stack.unshift(e.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return!!t&&(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0)}yieldBuf(t,e){this.index=t;let{start:i,buffer:n}=this.buffer;return this.type=e||n.set.types[n.buffer[t]],this.from=i+n.buffer[t+1],this.to=i+n.buffer[t+2],!0}yield(t){return!!t&&(t instanceof ko?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,i){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,i,this.mode));let{buffer:n}=this.buffer,s=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.buffer.start,i);return!(s<0)&&(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,i=this.mode){return this.buffer?!(i&mo.ExcludeBuffers)&&this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&mo.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&mo.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode));let{buffer:e}=this.buffer,i=this.stack.length-1;if(t<0){let t=i<0?0:this.stack[i]+4;if(this.index!=t)return this.yieldBuf(e.findChild(t,this.index,-1,0,4))}else{let t=e.buffer[this.index+3];if(t<(i<0?e.buffer.length:e.buffer[this.stack[i]+3]))return this.yieldBuf(t)}return i<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,i,{buffer:n}=this;if(n){if(t>0){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&mo.IncludeAnonymous||t instanceof vo||!t.type.isAnonymous||Xo(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 $o(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 Xo(t){return t.children.some((t=>t instanceof vo||!t.type.isAnonymous||Xo(t)))}const Zo=new WeakMap;function Ao(t,e){if(!t.isAnonymous||e instanceof vo||e.type!=t)return 1;let i=Zo.get(e);if(null==i){i=1;for(let n of e.children){if(n.type!=t||!(n instanceof bo)){i=1;break}i+=Ao(t,n)}Zo.set(e,i)}return i}function To(t,e,i,n,s,r,o,a,l){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]+a);continue}u.push(i[s])}else{let e=n[h-1]+i[h-1].length-f;u.push(To(t,i,n,s,h,f,e,null,l))}d.push(f+a-r)}}(e,i,n,s,0),(a||l)(u,d,o)}class Ro{constructor(){this.map=new WeakMap}setBuffer(t,e,i){let n=this.map.get(t);n||this.map.set(t,n=new Map),n.set(e,i)}getBuffer(t,e){let i=this.map.get(t);return i&&i.get(e)}set(t,e){t instanceof Co?this.setBuffer(t.context.buffer,t.index,e):t instanceof ko&&this.map.set(t.tree,e)}get(t){return t instanceof Co?this.getBuffer(t.context.buffer,t.index):t instanceof ko?this.map.get(t.tree):void 0}cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}}class Eo{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 Eo(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,a=0,l=0;;o++){let h=o=i)for(;r&&r.from=e.from||c<=e.to||l){let t=Math.max(e.from,a)-l,i=Math.min(e.to,c)-l;e=t>=i?null:new Eo(t,i,e.tree,e.offset+l,o>0,!!h)}if(e&&n.push(e),r.to>c)break;r=snew lo(t.from,t.to))):[new lo(0,0)]:[new lo(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 Mo{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)}}function Do(t){return(e,i,n,s)=>new qo(e,t,i,n,s)}class Wo{constructor(t,e,i,n,s){this.parser=t,this.parse=e,this.overlay=i,this.target=n,this.ranges=s}}class Uo{constructor(t,e,i,n,s,r,o){this.parser=t,this.predicate=e,this.mounts=i,this.index=n,this.start=s,this.target=r,this.prev=o,this.depth=0,this.ranges=[]}}const Yo=new ho({perNode:!0});class qo{constructor(t,e,i,n,s){this.nest=e,this.input=i,this.fragments=n,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=t}advance(){if(this.baseParse){let t=this.baseParse.advance();if(!t)return null;if(this.baseParse=null,this.baseTree=t,this.startInner(),null!=this.stoppedAt)for(let t of this.inner)t.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let t=this.baseTree;return null!=this.stoppedAt&&(t=new bo(t.type,t.children,t.positions,t.length,t.propValues.concat([[Yo,this.stoppedAt]]))),t}let t=this.inner[this.innerDone],e=t.parse.advance();if(e){this.innerDone++;let i=Object.assign(Object.create(null),t.target.props);i[ho.mounted.id]=new co(e,t.overlay,t.parser),t.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let t=this.input.length;for(let e=this.innerDone;et.frag.from<=n.from&&t.frag.to>=n.to&&t.mount.overlay));if(t)for(let i of t.mount.overlay){let s=i.from+t.pos,r=i.to+t.pos;s>=n.from&&r<=n.to&&!e.ranges.some((t=>t.froms))&&e.ranges.push({from:s,to:r})}}a=!1}else if(i&&(r=Lo(i.ranges,n.from,n.to)))a=2!=r;else if(!n.type.isAnonymous&&n.fromnew lo(t.from-n.from,t.to-n.from))):null,n.tree,t)),s.overlay?t.length&&(i={ranges:t,depth:0,prev:i}):a=!1}}else e&&(o=e.predicate(n))&&(!0===o&&(o=new lo(n.from,n.to)),o.fromnew lo(t.from-e.start,t.to-e.start))),e.target,t)),e=e.prev}i&&! --i.depth&&(i=i.prev)}}}}function Lo(t,e,i){for(let n of t){if(n.from>=i)break;if(n.to>e)return n.from<=e&&n.to>=i?2:1}return 0}function zo(t,e,i,n,s,r){if(e=e.to);n++);let o=s.children[n],a=o.buffer;s.children[n]=function t(i,n,s,l,h){let c=i;for(;a[c+2]+r<=e.from;)c=a[c+3];let u=[],d=[];zo(o,i,c,u,d,l);let f=a[c+1],p=a[c+2],O=f+r==e.from&&p+r==e.to&&a[c]==e.type.id;return u.push(O?e.toTree():t(c+4,a[c+3],o.set.types[a[c]],f,p-f)),d.push(f-l),zo(o,a[c+3],n,u,d,l),new bo(s,u,d,h)}(0,a.length,fo.none,0,o.length);for(let n=0;n<=i;n++)t.childAfter(e.from)}class Bo{constructor(t,e){this.offset=e,this.done=!1,this.cursor=t.cursor(mo.IncludeAnonymous|mo.IgnoreMounts)}moveTo(t){let{cursor:e}=this,i=t-this.offset;for(;!this.done&&e.from=t&&e.enter(i,1,mo.IgnoreOverlays|mo.ExcludeBuffers)||e.next(!1)||(this.done=!0)}hasNode(t){if(this.moveTo(t.from),!this.done&&this.cursor.from+this.offset==t.from&&this.cursor.tree)for(let e=this.cursor.tree;;){if(e==t.tree)return!0;if(!(e.children.length&&0==e.positions[0]&&e.children[0]instanceof bo))break;e=e.children[0]}return!1}}let jo=class{constructor(t){var e;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){let i=this.curFrag=t[0];this.curTo=null!==(e=i.tree.prop(Yo))&&void 0!==e?e:i.to,this.inner=new Bo(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t)}nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=null!==(t=e.tree.prop(Yo))&&void 0!==t?t:e.to,this.inner=new Bo(e.tree,-e.offset)}}findMounts(t,e){var i;let n=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let t=this.inner.cursor.node;t;t=t.parent){let s=null===(i=t.tree)||void 0===i?void 0:i.prop(ho.mounted);if(s&&s.parser==e)for(let e=this.fragI;e=t.to)break;i.tree==this.curFrag.tree&&n.push({frag:i,pos:t.from-i.offset,mount:s})}}}return n}};function No(t,e){let i=null,n=e;for(let s=1,r=0;s=a)break;t.to<=o||(i||(n=i=e.slice()),t.froma&&i.splice(r+1,0,new lo(a,t.to))):t.to>a?i[r--]=new lo(a,t.to):i.splice(r--,1))}}return n}function Go(t,e,i,n){let s=0,r=0,o=!1,a=!1,l=-1e9,h=[];for(;;){let c=s==t.length?1e9:o?t[s].to:t[s].from,u=r==e.length?1e9:a?e[r].to:e[r].from;if(o!=a){let t=Math.max(l,i),e=Math.min(c,u,n);tnew lo(t.from+n,t.to+n))),a,l);for(let e=0,n=a;;e++){let a=e==o.length,h=a?l:o[e].from;if(h>n&&i.push(new Eo(n,h,s.tree,-t,r.from>=n||r.openStart,r.to<=h||r.openEnd)),a)break;n=o[e].to}}else i.push(new Eo(a,l,s.tree,-t,r.from>=t||r.openStart,r.to<=o||r.openEnd))}return i}let Ho=0;class Jo{constructor(t,e,i){this.set=t,this.base=e,this.modified=i,this.id=Ho++}static define(t){if(null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let e=new Jo([],null,[]);if(e.set.push(e),t)for(let i of t.set)e.set.push(i);return e}static defineModifier(){let t=new ta;return e=>e.modified.indexOf(t)>-1?e:ta.get(e.base||e,e.modified.concat(t).sort(((t,e)=>t.id-e.id)))}}let Ko=0;class ta{constructor(){this.instances=[],this.id=Ko++}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 Jo(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(ta.get(e,t));return s}}function ea(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,a=i[o];if(!a)throw new RangeError("Invalid path: "+t);let l=new na(n,s,o>0?i.slice(0,o):null);e[a]=l.sort(e[a])}}return ia.add(e)}const ia=new ho;class na{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 ra(t,e,i,n=0,s=t.length){let r=new oa(n,Array.isArray(e)?e:[e],i);r.highlightRange(t.cursor(),n,s,"",r.highlighters),r.flush(s)}na.empty=new na([],2,null);class oa{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:a}=t;if(o>=i||a<=e)return;r.isTop&&(s=this.highlighters.filter((t=>!t.scope||t.scope(r))));let l=n,h=function(t){let e=t.type.prop(ia);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}(t)||na.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&&(l&&(l+=" "),l+=c,1==h.mode&&(n+=(n?" ":"")+c)),this.startSpan(t.from,l),h.opaque)return;let u=t.tree&&t.tree.prop(ho.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 d=0,f=o;;d++){let p=d=O)&&t.nextSibling()););if(!p||O>i)break;f=p.to+o,f>e&&(this.highlightRange(r.cursor(),Math.max(e,p.from+o),Math.min(i,f),n,h),this.startSpan(f,l))}c&&t.parent()}else if(t.firstChild()){do{if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,n,s),this.startSpan(Math.min(i,t.to),l)}}while(t.nextSibling());t.parent()}}}const aa=Jo.define,la=aa(),ha=aa(),ca=aa(ha),ua=aa(ha),da=aa(),fa=aa(da),pa=aa(da),Oa=aa(),ga=aa(Oa),ma=aa(),ba=aa(),wa=aa(),va=aa(wa),ya=aa(),Sa={comment:la,lineComment:aa(la),blockComment:aa(la),docComment:aa(la),name:ha,variableName:aa(ha),typeName:ca,tagName:aa(ca),propertyName:ua,attributeName:aa(ua),className:aa(ha),labelName:aa(ha),namespace:aa(ha),macroName:aa(ha),literal:da,string:fa,docString:aa(fa),character:aa(fa),attributeValue:aa(fa),number:pa,integer:aa(pa),float:aa(pa),bool:aa(da),regexp:aa(da),escape:aa(da),color:aa(da),url:aa(da),keyword:ma,self:aa(ma),null:aa(ma),atom:aa(ma),unit:aa(ma),modifier:aa(ma),operatorKeyword:aa(ma),controlKeyword:aa(ma),definitionKeyword:aa(ma),moduleKeyword:aa(ma),operator:ba,derefOperator:aa(ba),arithmeticOperator:aa(ba),logicOperator:aa(ba),bitwiseOperator:aa(ba),compareOperator:aa(ba),updateOperator:aa(ba),definitionOperator:aa(ba),typeOperator:aa(ba),controlOperator:aa(ba),punctuation:wa,separator:aa(wa),bracket:va,angleBracket:aa(va),squareBracket:aa(va),paren:aa(va),brace:aa(va),content:Oa,heading:ga,heading1:aa(ga),heading2:aa(ga),heading3:aa(ga),heading4:aa(ga),heading5:aa(ga),heading6:aa(ga),contentSeparator:aa(Oa),list:aa(Oa),quote:aa(Oa),emphasis:aa(Oa),strong:aa(Oa),link:aa(Oa),monospace:aa(Oa),strikethrough:aa(Oa),inserted:aa(),deleted:aa(),changed:aa(),invalid:aa(),meta:ya,documentMeta:aa(ya),annotation:aa(ya),processingInstruction:aa(ya),definition:Jo.defineModifier(),constant:Jo.defineModifier(),function:Jo.defineModifier(),standard:Jo.defineModifier(),local:Jo.defineModifier(),special:Jo.defineModifier()};var xa;sa([{tag:Sa.link,class:"tok-link"},{tag:Sa.heading,class:"tok-heading"},{tag:Sa.emphasis,class:"tok-emphasis"},{tag:Sa.strong,class:"tok-strong"},{tag:Sa.keyword,class:"tok-keyword"},{tag:Sa.atom,class:"tok-atom"},{tag:Sa.bool,class:"tok-bool"},{tag:Sa.url,class:"tok-url"},{tag:Sa.labelName,class:"tok-labelName"},{tag:Sa.inserted,class:"tok-inserted"},{tag:Sa.deleted,class:"tok-deleted"},{tag:Sa.literal,class:"tok-literal"},{tag:Sa.string,class:"tok-string"},{tag:Sa.number,class:"tok-number"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],class:"tok-string2"},{tag:Sa.variableName,class:"tok-variableName"},{tag:Sa.local(Sa.variableName),class:"tok-variableName tok-local"},{tag:Sa.definition(Sa.variableName),class:"tok-variableName tok-definition"},{tag:Sa.special(Sa.variableName),class:"tok-variableName2"},{tag:Sa.definition(Sa.propertyName),class:"tok-propertyName tok-definition"},{tag:Sa.typeName,class:"tok-typeName"},{tag:Sa.namespace,class:"tok-namespace"},{tag:Sa.className,class:"tok-className"},{tag:Sa.macroName,class:"tok-macroName"},{tag:Sa.propertyName,class:"tok-propertyName"},{tag:Sa.operator,class:"tok-operator"},{tag:Sa.comment,class:"tok-comment"},{tag:Sa.meta,class:"tok-meta"},{tag:Sa.invalid,class:"tok-invalid"},{tag:Sa.punctuation,class:"tok-punctuation"}]);const ka=new ho;function Qa(t){return E.define({combine:t?e=>e.concat(t):void 0})}const $a=new ho;class Pa{constructor(t,e,i=[],n=""){this.data=t,this.name=n,xt.prototype.hasOwnProperty("tree")||Object.defineProperty(xt.prototype,"tree",{get(){return Xa(this)}}),this.parser=e,this.extension=[Wa.of(this),xt.languageData.of(((t,e,i)=>{let n=Ca(t,e,i),s=n.type.prop(ka);if(!s)return[];let r=t.facet(s),o=n.type.prop($a);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 Ca(t,e,i).type.prop(ka)==this.data}findRegions(t){let e=t.facet(Wa);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(ka)==this.data)return void i.push({from:e,to:e+t.length});let s=t.prop(ho.mounted);if(s){if(s.tree.prop(ka)==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;it.isTop?e:void 0))]}),t.name)}configure(t,e){return new _a(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Xa(t){let e=t.field(Pa.state,!1);return e?e.tree:bo.empty}class Za{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let i=this.cursorPos-this.string.length;return t=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i)}}let Aa=null;class Ta{constructor(t,e,i=[],n,s,r,o,a){this.parser=t,this.state=e,this.fragments=i,this.tree=n,this.treeLen=s,this.viewport=r,this.skipped=o,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(t,e,i){return new Ta(t,e,[],bo.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Za(this.state.doc),this.fragments)}work(t,e){return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=bo.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(Eo.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Aa;Aa=this;try{return t()}finally{Aa=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=Ra(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=Eo.applyChanges(i,e),n=bo.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=Ra(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 Vo{createParse(e,i,n){let s=n[0].from,r=n[n.length-1].to;return{parsedPos:s,advance(){let e=Aa;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 bo(fo.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 Aa}}function Ra(t,e,i){return Eo.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class Ea{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 Ea(e)}static init(t){let e=Math.min(3e3,t.doc.length),i=Ta.create(t.facet(Wa).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new Ea(i)}}Pa.state=q.define({create:Ea.init,update(t,e){for(let t of e.effects)if(t.is(Pa.setState))return t.value;return e.startState.facet(Wa)!=e.state.facet(Wa)?Ea.init(e.state):t.apply(e)}});let Va=t=>{let e=setTimeout((()=>t()),500);return()=>clearTimeout(e)};"undefined"!=typeof requestIdleCallback&&(Va=t=>{let e=-1,i=setTimeout((()=>{e=requestIdleCallback(t,{timeout:400})}),100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const Ma="undefined"!=typeof navigator&&(null===(xa=navigator.scheduling)||void 0===xa?void 0:xa.isInputPending)?()=>navigator.scheduling.isInputPending():null,Da=_i.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(Pa.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),t.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(Pa.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=Va(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEndn+1e3,a=s.context.work((()=>Ma&&Ma()||Date.now()>r),n+(o?0:1e5));this.chunkBudget-=Date.now()-e,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Pa.setState.of(new Ea(s.context))})),this.chunkBudget>0&&(!a||o)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then((()=>this.scheduleWork())).catch((t=>Qi(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()}}}),Wa=E.define({combine:t=>t.length?t[0]:null,enables:t=>[Pa.state,Da,Ts.contentAttributes.compute([t],(e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}}))]});class Ua{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}class Ya{constructor(t,e,i,n,s,r=void 0){this.name=t,this.alias=e,this.extensions=i,this.filename=n,this.loadFunc=s,this.support=r,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then((t=>this.support=t),(t=>{throw this.loading=null,t})))}static of(t){let{load:e,support:i}=t;if(!e){if(!i)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");e=()=>Promise.resolve(i)}return new Ya(t.name,(t.alias||[]).concat(t.name).map((t=>t.toLowerCase())),t.extensions||[],t.filename,e,i)}static matchFilename(t,e){for(let i of t)if(i.filename&&i.filename.test(e))return i;let i=/\.([^.]+)$/.exec(e);if(i)for(let e of t)if(e.extensions.indexOf(i[1])>-1)return e;return null}static matchLanguageName(t,e,i=!0){e=e.toLowerCase();for(let i of t)if(i.alias.some((t=>t==e)))return i;if(i)for(let i of t)for(let t of i.alias){let n=e.indexOf(t);if(n>-1&&(t.length>2||!/\w/.test(e[n-1])&&!/\w/.test(e[n+t.length])))return i}return null}}const qa=E.define(),La=E.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 za(t){let e=t.facet(La);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function Ia(t,e){let i="",n=t.tabSize,s=t.facet(La)[0];if("\t"==s){for(;e>=n;)i+="\t",e-=n;s=" "}for(let t=0;t=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 Yt(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 Na=new ho;function Ga(t){let e=t.type.prop(Na);if(e)return e;let i,n=t.firstChild;if(n&&(i=n.type.prop(ho.closedBy))){let e=t.lastChild,n=e&&i.indexOf(e.name)>-1;return t=>el(t,!0,1,void 0,n&&!function(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}(t)?e.from:void 0)}return null==t.parent?Ha:null}function Fa(t,e,i){for(;t;t=t.parent){let n=Ga(t);if(n)return n(Ja.create(i,e,t))}return null}function Ha(){return 0}class Ja extends ja{constructor(t,e,i){super(t.state,t.options),this.base=t,this.pos=e,this.node=i}static create(t,e,i){return new Ja(t,e,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){let t=this.state.doc.lineAt(this.node.from);for(;;){let e=this.node.resolve(t.from);for(;e.parent&&e.parent.from==e.from;)e=e.parent;if(Ka(e,this.node))break;t=this.state.doc.lineAt(e.from)}return this.lineIndent(t.from)}continue(){let t=this.node.parent;return t?Fa(t,this.pos,this.base):0}}function Ka(t,e){for(let i=e;i;i=i.parent)if(t==i)return!0;return!1}function tl({closing:t,align:e=!0,units:i=1}){return n=>el(n,e,i,t)}function el(t,e,i,n,s){let r=t.textAfter,o=r.match(/^\s*/)[0].length,a=n&&r.slice(o,o+n.length)==n||s==t.pos+o,l=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.from{let n=t&&t.test(i.textAfter);return i.baseIndent+(n?0:e*i.unit)}}function nl(){return xt.transactionFilter.of((t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let i=t.newDoc,{head:n}=t.newSelection.main,s=i.lineAt(n);if(n>s.from+200)return t;let r=i.sliceString(s.from,n);if(!e.some((t=>t.test(r))))return t;let{state:o}=t,a=-1,l=[];for(let{head:t}of o.selection.ranges){let e=o.doc.lineAt(t);if(e.from==a)continue;a=e.from;let i=Ba(o,e.from);if(null==i)continue;let n=/^\s*/.exec(e.text)[0],s=Ia(o,i);n!=s&&l.push({from:e.from,to:e.from+n.length,insert:s})}return l.length?[t,{changes:l,sequential:!0}]:t}))}const sl=E.define(),rl=new ho;function ol(t){let e=t.firstChild,i=t.lastChild;return e&&e.toi)continue;if(s&&r.from=e&&n.to>i&&(s=n)}}return s}(t,e,i)}function hl(t,e){let i=e.mapPos(t.from,1),n=e.mapPos(t.to,-1);return i>=n?void 0:{from:i,to:n}}const cl=ut.define({map:hl}),ul=ut.define({map:hl}),dl=q.define({create:()=>ni.none,update(t,e){t=t.map(e.changes);for(let i of e.effects)i.is(cl)&&!pl(t,i.value.from,i.value.to)?t=t.update({add:[bl.range(i.value.from,i.value.to)]}):i.is(ul)&&(t=t.update({filter:(t,e)=>i.value.from!=t||i.value.to!=e,filterFrom:i.value.from,filterTo:i.value.to}));if(e.selection){let i=!1,{head:n}=e.selection.main;t.between(n,n,((t,e)=>{tn&&(i=!0)})),i&&(t=t.update({filterFrom:n,filterTo:n,filter:(t,e)=>e<=n||t>=n}))}return t},provide:t=>Ts.decorations.from(t),toJSON(t,e){let i=[];return t.between(0,e.doc.length,((t,e)=>{i.push(t,e)})),i},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let i=0;i{(!s||s.from>t)&&(s={from:t,to:e})})),s}function pl(t,e,i){let n=!1;return t.between(e,e,((t,s)=>{t==e&&s==i&&(n=!0)})),n}const Ol={placeholderDOM:null,placeholderText:"…"},gl=E.define({combine:t=>kt(t,Ol)});function ml(t){let e=[dl,yl];return t&&e.push(gl.of(t)),e}const bl=ni.replace({widget:new class extends ei{toDOM(t){let{state:e}=t,i=e.facet(gl),n=e=>{let i=t.lineBlockAt(t.posAtDOM(e.target)),n=fl(t.state,i.from,i.to);n&&t.dispatch({effects:ul.of(n)}),e.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(t,n);let s=document.createElement("span");return s.textContent=i.placeholderText,s.setAttribute("aria-label",e.phrase("folded code")),s.title=e.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=n,s}}}),wl={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class vl extends Yr{constructor(t,e){super(),this.config=t,this.open=e}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let e=document.createElement("span");return e.textContent=this.open?this.config.openText:this.config.closedText,e.title=t.state.phrase(this.open?"Fold line":"Unfold line"),e}}const yl=Ts.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Sl{constructor(t,e){let i;function n(t){let e=It.newName();return(i||(i=Object.create(null)))["."+e]=t,e}this.specs=t;const s="string"==typeof e.all?e.all:e.all?n(e.all):void 0,r=e.scope;this.scope=r instanceof Pa?t=>t.prop(ka)==r.data:r?t=>t==r:void 0,this.style=sa(t.map((t=>({tag:t.tag,class:t.class||n(Object.assign({},t,{tag:null}))}))),{all:s}).style,this.module=i?new It(i):null,this.themeType=e.themeType}static define(t,e){return new Sl(t,e||{})}}const xl=E.define(),kl=E.define({combine:t=>t.length?[t[0]]:null});function Ql(t){let e=t.facet(xl);return e.length?e:t.facet(kl)}function $l(t,e){let i,n=[Cl];return t instanceof Sl&&(t.module&&n.push(Ts.styleModule.of(t.module)),i=t.themeType),(null==e?void 0:e.fallback)?n.push(kl.of(t)):i?n.push(xl.computeN([Ts.darkTheme],(e=>e.facet(Ts.darkTheme)==("dark"==i)?[t]:[]))):n.push(xl.of(t)),n}class Pl{constructor(t){this.markCache=Object.create(null),this.tree=Xa(t.state),this.decorations=this.buildDeco(t,Ql(t.state))}update(t){let e=Xa(t.state),i=Ql(t.state),n=i!=Ql(t.startState);e.length{i.add(t,e,this.markCache[n]||(this.markCache[n]=ni.mark({class:n})))}),n,s);return i.finish()}}const Cl=N.high(_i.fromClass(Pl,{decorations:t=>t.decorations})),_l=Sl.define([{tag:Sa.meta,color:"#404740"},{tag:Sa.link,textDecoration:"underline"},{tag:Sa.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Sa.emphasis,fontStyle:"italic"},{tag:Sa.strong,fontWeight:"bold"},{tag:Sa.strikethrough,textDecoration:"line-through"},{tag:Sa.keyword,color:"#708"},{tag:[Sa.atom,Sa.bool,Sa.url,Sa.contentSeparator,Sa.labelName],color:"#219"},{tag:[Sa.literal,Sa.inserted],color:"#164"},{tag:[Sa.string,Sa.deleted],color:"#a11"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],color:"#e40"},{tag:Sa.definition(Sa.variableName),color:"#00f"},{tag:Sa.local(Sa.variableName),color:"#30a"},{tag:[Sa.typeName,Sa.namespace],color:"#085"},{tag:Sa.className,color:"#167"},{tag:[Sa.special(Sa.variableName),Sa.macroName],color:"#256"},{tag:Sa.definition(Sa.propertyName),color:"#00c"},{tag:Sa.comment,color:"#940"},{tag:Sa.invalid,color:"#f00"}]),Xl=Ts.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Zl=1e4,Al="()[]{}",Tl=E.define({combine:t=>kt(t,{afterCursor:!0,brackets:Al,maxScanDistance:Zl,renderMatch:Vl})}),Rl=ni.mark({class:"cm-matchingBracket"}),El=ni.mark({class:"cm-nonmatchingBracket"});function Vl(t){let e=[],i=t.matched?Rl:El;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 Ml=q.define({create:()=>ni.none,update(t,e){if(!e.docChanged&&!e.selection)return t;let i=[],n=e.state.facet(Tl);for(let t of e.state.selection.ranges){if(!t.empty)continue;let s=Ll(e.state,t.head,-1,n)||t.head>0&&Ll(e.state,t.head-1,1,n)||n.afterCursor&&(Ll(e.state,t.head,1,n)||t.headTs.decorations.from(t)}),Dl=[Ml,Xl];function Wl(t={}){return[Tl.of(t),Dl]}const Ul=new ho;function Yl(t,e,i){let n=t.prop(e<0?ho.openedBy:ho.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 ql(t){let e=t.type.prop(Ul);return e?e(t.node):t}function Ll(t,e,i,n={}){let s=n.maxScanDistance||Zl,r=n.brackets||Al,o=Xa(t),a=o.resolveInner(e,i);for(let n=a;n;n=n.parent){let s=Yl(n.type,i,r);if(s&&n.from0?e>=o.from&&eo.from&&e<=o.to))return zl(t,e,i,n,o,s,r)}}return function(t,e,i,n,s,r,o){let a=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%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 a=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(a+t,1).type!=s))if(e%2==0==i>0)u++;else{if(1==u)return{start:h,end:{from:a+t,to:a+t+1},matched:e>>1==l>>1};u--}}i>0&&(t+=r.length)}return c.done?{start:h,matched:!1}:null}(t,e,i,o,a.type,s,r)}function zl(t,e,i,n,s,r,o){let a=n.parent,l={from:s.from,to:s.to},h=0,c=null==a?void 0:a.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 jl(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 Nl=new WeakMap;class Gl extends Pa{constructor(t){let e,i=Qa(t.languageData),n={name:(s=t).name||"",token:s.token,blankLine:s.blankLine||(()=>{}),startState:s.startState||(()=>!0),copyState:s.copyState||jl,indent:s.indent||(()=>null),languageData:s.languageData||{},tokenTable:s.tokenTable||th};var s;super(i,new class extends Vo{createParse(t,i,n){return new Jl(e,t,i,n)}},[qa.of(((t,e)=>this.getIndent(t,e)))],t.name),this.topNode=function(t){let e=fo.define({id:eh.length,name:"Document",props:[ka.add((()=>t))]});return eh.push(e),e}(i),e=this,this.streamParser=n,this.stateAfter=new ho({perNode:!0}),this.tokenTable=t.tokenTable?new rh(n.tokenTable):oh}static define(t){return new Gl(t)}getIndent(t,e){let i,n=Xa(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=Nl.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],a=i+e.positions[r],l=o instanceof bo&&a=e.length)return e;s||e.type!=t.topNode||(s=!0);for(let r=e.children.length-1;r>=0;r--){let o,a=e.positions[r],l=e.children[r];if(ai&&Fl(t,n.tree,0-n.offset,i,r);if(o&&(e=Hl(t,n.tree,i+n.offset,o.pos+n.offset,!1)))return{state:o.state,tree:e}}return{state:t.streamParser.startState(n?za(n):4),tree:bo.empty}}(t,i,r,null==s?void 0:s.state);this.state=o,this.parsedPos=this.chunkStart=r+a.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 Bl(e,t?t.state.tabSize:4,t?za(t.state):2);if(r.eol())s.blankLine(this.state,r.indentUnit);else for(;!r.eol();){let t=Kl(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 th=Object.create(null),eh=[fo.none],ih=new po(eh),nh=[],sh=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"]])sh[t]=lh(th,e);class rh{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),sh)}resolve(t){return t?this.table[t]||(this.table[t]=lh(this.extra,t)):0}}const oh=new rh(th);function ah(t,e){nh.indexOf(t)>-1||(nh.push(t),console.warn(e))}function lh(t,e){let i=null;for(let n of e.split(".")){let e=t[n]||Sa[n];e?"function"==typeof e?i?i=e(i):ah(n,`Modifier ${n} used at start of tag`):i?ah(n,`Tag ${n} used as modifier`):i=e:ah(n,`Unknown highlighting tag ${n}`)}if(!i)return 0;let n=e.replace(/ /g,"_"),s=fo.define({id:eh.length,name:n,props:[ea({[n]:i})]});return eh.push(s),s.id}function hh(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 ch=hh(gh,0),uh=hh(Oh,0),dh=hh(((t,e)=>Oh(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 fh(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}const ph=50;function Oh(t,e,i=e.selection.ranges){let n=i.map((t=>fh(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,a=t.sliceDoc(n-ph,n),l=t.sliceDoc(s,s+ph),h=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(l)[0].length,u=a.length-h;if(a.slice(u-e.length,u)==e&&l.slice(c,c+i.length)==i)return{open:{pos:n-h,margin:h&&1},close:{pos:s+c,margin:c&&1}};s-n<=2*ph?r=o=t.sliceDoc(n,s):(r=t.sliceDoc(n,n+ph),o=t.sliceDoc(s-ph,s));let d=/^\s*/.exec(r)[0].length,f=/\s*$/.exec(o)[0].length,p=o.length-f-i.length;return r.slice(d,d+e.length)==e&&o.slice(p,p+i.length)==i?{open:{pos:n+d+e.length,margin:/\s/.test(r.charAt(d+e.length))?1:0},close:{pos:s-f-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>l.from)){s=l.from;let t=/^\s*/.exec(l.text)[0].length,e=t==l.length,i=l.text.slice(t,t+a.length)==a?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 mh=lt.define(),bh=lt.define(),wh=E.define(),vh=E.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)})});const yh=q.define({create:()=>Dh.empty,update(t,e){let i=e.state.facet(vh),n=e.annotation(mh);if(n){let s=e.docChanged?A.single(function(t){let e=0;return t.iterChangedRanges(((t,i)=>e=i)),e}(e.changes)):void 0,r=Ch.fromTransaction(e,s),o=n.side,a=0==o?t.undone:t.done;return a=r?_h(a,a.length,i.minDepth,r):Th(a,e.startState.selection),new Dh(0==o?n.rest:a,0==o?a:n.rest)}let s=e.annotation(bh);if("full"!=s&&"before"!=s||(t=t.isolate()),!1===e.annotation(dt.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);let r=Ch.fromTransaction(e),o=e.annotation(dt.time),a=e.annotation(dt.userEvent);return r?t=t.addChanges(r,o,a,i,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,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 Dh(t.done.map(Ch.fromJSON),t.undone.map(Ch.fromJSON))});function Sh(t={}){return[yh,vh.of(t),Ts.domEventHandlers({beforeinput(t,e){let i="historyUndo"==t.inputType?kh:"historyRedo"==t.inputType?Qh:null;return!!i&&(t.preventDefault(),i(e))}})]}function xh(t,e){return function({state:i,dispatch:n}){if(!e&&i.readOnly)return!1;let s=i.field(yh,!1);if(!s)return!1;let r=s.pop(t,i,e);return!!r&&(n(r),!0)}}const kh=xh(0,!1),Qh=xh(1,!1),$h=xh(0,!0),Ph=xh(1,!0);class Ch{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 Ch(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 Ch(t.changes&&k.fromJSON(t.changes),[],t.mapped&&x.fromJSON(t.mapped),t.startSelection&&A.fromJSON(t.startSelection),t.selectionsAfter.map(A.fromJSON))}static fromTransaction(t,e){let i=Zh;for(let e of t.startState.facet(wh)){let n=e(t);n.length&&(i=i.concat(n))}return!i.length&&t.changes.empty?null:new Ch(t.changes.invert(t.startState.doc),i,void 0,e||t.startState.selection,Zh)}static selection(t){return new Ch(void 0,Zh,void 0,void 0,t)}}function _h(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 Xh(t,e){return t.length?e.length?t.concat(e):t:e}const Zh=[],Ah=200;function Th(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-Ah));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),_h(t,t.length-1,1e9,i.setSelAfter(n)))}return[Ch.selection([e])]}function Rh(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 Eh(t,e){if(!t.length)return t;let i=t.length,n=Zh;for(;i;){let s=Vh(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?[Ch.selection(n)]:Zh}function Vh(t,e,i){let n=Xh(t.selectionsAfter.length?t.selectionsAfter.map((t=>t.map(e))):Zh,i);if(!t.changes)return Ch.selection(n);let s=t.changes.map(e),r=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(r):r;return new Ch(s,ut.mapEffects(t.effects,e),o,t.startSelection.map(r),n)}const Mh=/^(input\.type|delete)($|\.)/;class Dh{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 Dh(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||Mh.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)?_h(r,r.length-1,n.minDepth,new Ch(t.changes.compose(o.changes),Xh(t.effects,o.effects),o.mapped,o.startSelection,Zh)):_h(r,r.length,n.minDepth,t),new Dh(r,Zh,e,i)}addSelection(t,e,i,n){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Zh;return s.length>0&&e-this.prevTimet.empty!=o.ranges[e].empty)).length)?this:new Dh(Th(this.done,t),this.undone,e,i);var r,o}addMapping(t){return new Dh(Eh(this.done,t),Eh(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:mh.of({side:t,rest:Rh(n)}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let i=1==n.length?Zh:n.slice(0,n.length-1);return s.mapped&&(i=Eh(i,s.mapped)),e.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:mh.of({side:t,rest:i}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}}Dh.empty=new Dh(Zh,Zh);const Wh=[{key:"Mod-z",run:kh,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Qh,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Qh,preventDefault:!0},{key:"Mod-u",run:$h,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Ph,preventDefault:!0}];function Uh(t,e){return A.create(t.ranges.map(e),t.mainIndex)}function Yh(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function qh({state:t,dispatch:e},i){let n=Uh(t.selection,i);return!n.eq(t.selection)&&(e(Yh(t,n)),!0)}function Lh(t,e){return A.cursor(e?t.to:t.from)}function zh(t,e){return qh(t,(i=>i.empty?t.moveByChar(i,e):Lh(i,e)))}function Ih(t){return t.textDirectionAt(t.state.selection.main.head)==Wi.LTR}const Bh=t=>zh(t,!Ih(t)),jh=t=>zh(t,Ih(t));function Nh(t,e){return qh(t,(i=>i.empty?t.moveByGroup(i,e):Lh(i,e)))}function Gh(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 Fh(t,e,i){let n,s,r=Xa(t).resolveInner(e.head),o=i?ho.closedBy:ho.openedBy;for(let n=e.head;;){let e=i?r.childAfter(n):r.childBefore(n);if(!e)break;Gh(t,e,o)?r=e:n=i?e.to:e.from}return s=r.type.prop(o)&&(n=i?Ll(t,r.from,1):Ll(t,r.to,-1))&&n.matched?i?n.end.to:n.end.from:i?r.to:r.from,A.cursor(s,i?-1:1)}function Hh(t,e){return qh(t,(i=>{if(!i.empty)return Lh(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)}))}const Jh=t=>Hh(t,!1),Kh=t=>Hh(t,!0);function tc(t){let e,i=t.scrollDOM.clientHeighti.empty?t.moveVertically(i,e,n.height):Lh(i,e)));if(r.eq(s.selection))return!1;if(n.selfScroll){let e=t.coordsAtPos(s.selection.main.head),o=t.scrollDOM.getBoundingClientRect(),a=o.top+n.marginTop,l=o.bottom-n.marginBottom;e&&e.top>a&&e.bottomec(t,!1),nc=t=>ec(t,!0);function sc(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=A.cursor(n.from+i))}return s}function rc(t,e){let i=Uh(t.state.selection,(t=>{let i=e(t);return A.range(t.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)}));return!i.eq(t.state.selection)&&(t.dispatch(Yh(t.state,i)),!0)}function oc(t,e){return console.log("Select!"),rc(t,(i=>t.moveByCharSelected(i,e)))}const ac=t=>oc(t,!Ih(t)),lc=t=>oc(t,Ih(t));function hc(t,e){return rc(t,(i=>t.moveByGroup(i,e)))}function cc(t,e){return rc(t,(i=>t.moveVertically(i,e)))}const uc=t=>cc(t,!1),dc=t=>cc(t,!0);function fc(t,e){return rc(t,(i=>t.moveVertically(i,e,tc(t).height)))}const pc=t=>fc(t,!1),Oc=t=>fc(t,!0),gc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:0})),!0),mc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.doc.length})),!0),bc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:0})),!0),wc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0);function vc(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=yc(t,n,!0)),s=Math.min(s,n),r=Math.max(r,n)}else s=yc(t,s,!1),r=yc(t,r,!0);return s==r?{range:n}:{changes:{from:s,to:r},range:A.cursor(s)}}));return!s.changes.empty&&(t.dispatch(n.update(s,{scrollIntoView:!0,userEvent:i,effects:"delete.selection"==i?Ts.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function yc(t,e,i){if(t instanceof Ts)for(let n of t.state.facet(Ts.atomicRanges).map((e=>e(t))))n.between(e,e,((t,n)=>{te&&(e=i?n:t)}));return e}const Sc=(t,e)=>vc(t,(i=>{let n,s,{state:r}=t,o=r.doc.lineAt(i);if(!e&&i>o.from&&iSc(t,!1),kc=t=>Sc(t,!0),Qc=(t,e)=>vc(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 a=f(r.text,n-r.from,e)+r.from,l=r.text.slice(Math.min(n,a)-r.from,Math.max(n,a)-r.from),h=o(l);if(null!=t&&h!=t)break;" "==l&&n==i||(t=h),n=a}return n})),$c=t=>Qc(t,!1),Pc=t=>vc(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 _c(t,e,i){if(t.readOnly)return!1;let n=[],s=[];for(let e of Cc(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(A.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(A.range(t.anchor-o,t.head-o))}}return!!n.length&&(e(t.update({changes:n,scrollIntoView:!0,selection:A.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0)}function Xc(t,e,i){if(t.readOnly)return!1;let n=[];for(let e of Cc(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 Zc=Ac(!1);function Ac(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),a=!e&&s==r&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i,n=Xa(t).resolveInner(e),s=n.childBefore(e),r=n.childAfter(e);return s&&r&&s.to<=e&&r.from>=e&&(i=s.type.prop(ho.closedBy))&&i.indexOf(r.name)>-1&&t.doc.lineAt(s.to).from==t.doc.lineAt(r.from).from?{from:s.to,to:r.from}:null}(i,s);e&&(s=r=(r<=o.to?o:i.doc.lineAt(r)).to);let l=new ja(i,{simulateBreak:s,simulateDoubleBreak:!!a}),h=Ba(l,s);for(null==h&&(h=/^\s*/.exec(i.doc.lineAt(s).text)[0].length);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:A.range(r.mapPos(n.anchor,1),r.mapPos(n.head,1))}}))}const Rc=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{i.push({from:e.from,insert:t.facet(La)})})),{userEvent:"input.indent"})),!0),Ec=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{let n=/^\s*/.exec(e.text)[0];if(!n)return;let s=Yt(n,t.tabSize),r=0,o=Ia(t,Math.max(0,s-za(t)));for(;rqh(t,(e=>Fh(t.state,e,!Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,!Ih(t))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:t=>qh(t,(e=>Fh(t.state,e,Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,Ih(t))))},{key:"Alt-ArrowUp",run:({state:t,dispatch:e})=>_c(t,e,!1)},{key:"Shift-Alt-ArrowUp",run:({state:t,dispatch:e})=>Xc(t,e,!1)},{key:"Alt-ArrowDown",run:({state:t,dispatch:e})=>_c(t,e,!0)},{key:"Shift-Alt-ArrowDown",run:({state:t,dispatch:e})=>Xc(t,e,!0)},{key:"Escape",run:({state:t,dispatch:e})=>{let i=t.selection,n=null;return i.ranges.length>1?n=A.create([i.main]):i.main.empty||(n=A.create([A.cursor(i.main.head)])),!!n&&(e(Yh(t,n)),!0)}},{key:"Mod-Enter",run:Ac(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:t,dispatch:e})=>{let i=Cc(t).map((({from:e,to:i})=>A.range(e,Math.min(i+1,t.doc.length))));return e(t.update({selection:A.create(i),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:t,dispatch:e})=>{let i=Uh(t.selection,(e=>{var i;let n=Xa(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 A.range(n.to,n.from)}));return e(Yh(t,i)),!0},preventDefault:!0},{key:"Mod-[",run:Ec},{key:"Mod-]",run:Rc},{key:"Mod-Alt-\\",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new ja(t,{overrideIndentation:t=>{let e=i[t];return null==e?-1:e}}),s=Tc(t,((e,s,r)=>{let o=Ba(n,e.from);if(null==o)return;/\S/.test(e.text)||(o=0);let a=/^\s*/.exec(e.text)[0],l=Ia(t,o);(a!=l||r.from{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(Cc(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=Uh(t.selection,(e=>{let s=Ll(t,e.head,-1)||Ll(t,e.head,1)||e.head>0&&Ll(t,e.head-1,1)||e.head{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=fh(t.state,i.from);return n.line?ch(t):!!n.block&&dh(t)}},{key:"Alt-A",run:uh}].concat([{key:"ArrowLeft",run:Bh,shift:ac,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:t=>Nh(t,!Ih(t)),shift:t=>hc(t,!Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:t=>qh(t,(e=>sc(t,e,!Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,!Ih(t)))),preventDefault:!0},{key:"ArrowRight",run:jh,shift:lc,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:t=>Nh(t,Ih(t)),shift:t=>hc(t,Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:t=>qh(t,(e=>sc(t,e,Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,Ih(t)))),preventDefault:!0},{key:"ArrowUp",run:Jh,shift:uc,preventDefault:!0},{mac:"Cmd-ArrowUp",run:gc,shift:bc},{mac:"Ctrl-ArrowUp",run:ic,shift:pc},{key:"ArrowDown",run:Kh,shift:dc,preventDefault:!0},{mac:"Cmd-ArrowDown",run:mc,shift:wc},{mac:"Ctrl-ArrowDown",run:nc,shift:Oc},{key:"PageUp",run:ic,shift:pc},{key:"PageDown",run:nc,shift:Oc},{key:"Home",run:t=>qh(t,(e=>sc(t,e,!1))),shift:t=>rc(t,(e=>sc(t,e,!1))),preventDefault:!0},{key:"Mod-Home",run:gc,shift:bc},{key:"End",run:t=>qh(t,(e=>sc(t,e,!0))),shift:t=>rc(t,(e=>sc(t,e,!0))),preventDefault:!0},{key:"Mod-End",run:mc,shift:wc},{key:"Enter",run:Zc},{key:"Mod-a",run:({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:xc,shift:xc},{key:"Delete",run:kc},{key:"Mod-Backspace",mac:"Alt-Backspace",run:$c},{key:"Mod-Delete",mac:"Alt-Delete",run:t=>Qc(t,!0)},{mac:"Mod-Backspace",run:t=>vc(t,(e=>{let i=t.lineBlockAt(e).from;return e>i?i:Math.max(0,e-1)}))},{mac:"Mod-Delete",run:Pc}].concat([{key:"Ctrl-b",run:Bh,shift:ac,preventDefault:!0},{key:"Ctrl-f",run:jh,shift:lc},{key:"Ctrl-p",run:Jh,shift:uc},{key:"Ctrl-n",run:Kh,shift:dc},{key:"Ctrl-a",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).from,1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).from)))},{key:"Ctrl-e",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).to,-1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).to)))},{key:"Ctrl-d",run:kc},{key:"Ctrl-h",run:xc},{key:"Ctrl-k",run:Pc},{key:"Ctrl-Alt-h",run:$c},{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:A.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:f(n.text,i-n.from,!1)+n.from,r=i==n.to?i+1:f(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:A.cursor(r)}}));return!i.changes.empty&&(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:nc}].map((t=>({mac:t.key,run:t.run,shift:t.shift})))));function Mc(){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 Uc{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(Wc(t)):Wc,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 b(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=w(t),i=this.bufferStart+this.bufferPos;this.bufferPos+=v(t);let n=this.normalize(e);for(let t=0,s=i;;t++){let r=n.charCodeAt(t),o=this.match(r,s);if(o)return this.value=o,this;if(t==n.length-1)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=jc(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 Ic(e,t.sliceString(e,i));return zc.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=jc(this.text,i+(t==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ic.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function jc(t,e){if(e>=t.length)return e;let i,n=t.lineAt(e);for(;e=56320&&i<57344;)e++;return e}function Nc(t){let e=Mc("input",{class:"cm-textfield",name:"line"});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,a,l]=i,h=a?+a.slice(1):0,c=o?+o:s.number;if(o&&l){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)));t.dispatch({effects:Gc.of(!1),selection:A.cursor(u.from+Math.max(0,Math.min(h,u.length))),scrollIntoView:!0}),t.focus()}return{dom:Mc("form",{class:"cm-gotoLine",onkeydown:e=>{27==e.keyCode?(e.preventDefault(),t.dispatch({effects:Gc.of(!1)}),t.focus()):13==e.keyCode&&(e.preventDefault(),i())},onsubmit:t=>{t.preventDefault(),i()}},Mc("label",t.state.phrase("Go to line"),": ",e)," ",Mc("button",{class:"cm-button",type:"submit"},t.state.phrase("go")))}}"undefined"!=typeof Symbol&&(Lc.prototype[Symbol.iterator]=Bc.prototype[Symbol.iterator]=function(){return this});const Gc=ut.define(),Fc=q.define({create:()=>!0,update(t,e){for(let i of e.effects)i.is(Gc)&&(t=i.value);return t},provide:t=>Ur.from(t,(t=>t?Nc:null))}),Hc=Ts.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),Jc={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Kc=E.define({combine:t=>kt(t,Jc,{highlightWordAroundCursor:(t,e)=>t||e,minSelectionLength:Math.min,maxMatches:Math.min})});function tu(t){let e=[ru,su];return t&&e.push(Kc.of(t)),e}const eu=ni.mark({class:"cm-selectionMatch"}),iu=ni.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function nu(t,e,i,n){return!(0!=i&&t(e.sliceDoc(i-1,i))==wt.Word||n!=e.doc.length&&t(e.sliceDoc(n,n+1))==wt.Word)}const su=_i.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(Kc),{state:i}=t,n=i.selection;if(n.ranges.length>1)return ni.none;let s,r=n.main,o=null;if(r.empty){if(!e.highlightWordAroundCursor)return ni.none;let t=i.wordAt(r.head);if(!t)return ni.none;o=i.charCategorizer(r.head),s=i.sliceDoc(t.from,t.to)}else{let t=r.to-r.from;if(t200)return ni.none;if(e.wholeWords){if(s=i.sliceDoc(r.from,r.to),o=i.charCategorizer(r.head),!nu(o,i,r.from,r.to)||!function(t,e,i,n){return t(e.sliceDoc(i,i+1))==wt.Word&&t(e.sliceDoc(n-1,n))==wt.Word}(o,i,r.from,r.to))return ni.none}else if(s=i.sliceDoc(r.from,r.to).trim(),!s)return ni.none}let a=[];for(let n of t.visibleRanges){let t=new Uc(i.doc,s,n.from,n.to);for(;!t.next().done;){let{from:n,to:s}=t.value;if((!o||nu(o,i,n,s))&&(r.empty&&n<=r.from&&s>=r.to?a.push(iu.range(n,s)):(n>=r.to||s<=r.from)&&a.push(eu.range(n,s)),a.length>e.maxMatches))return ni.none}}return ni.set(a)}},{decorations:t=>t.decorations}),ru=Ts.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});const ou=E.define({combine:t=>kt(t,{top:!1,caseSensitive:!1,literal:!1,wholeWord:!1,createPanel:t=>new Eu(t),scrollToMatch:t=>Ts.scrollIntoView(t)})});class au{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,qc),!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 pu(this):new cu(this)}getCursor(t,e=0,i){let n=t.doc?t:xt.create({doc:t});return null==i&&(i=n.doc.length),this.regexp?uu(this,n,e,i):hu(this,n,e,i)}}class lu{constructor(t){this.spec=t}}function hu(t,e,i,n){return new Uc(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=hu(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 uu(t,e,i,n){return new Lc(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?(s=e.charCategorizer(e.selection.main.head),(t,e,i)=>!i[0].length||(s(du(i.input,i.index))!=wt.Word||s(fu(i.input,i.index))!=wt.Word)&&(s(fu(i.input,i.index+i[0].length))!=wt.Word||s(du(i.input,i.index+i[0].length))!=wt.Word)):void 0},i,n);var s}function du(t,e){return t.slice(f(t,e,!1),e)}function fu(t,e){return t.slice(e,f(t,e))}class pu extends lu{nextMatch(t,e,i){let n=uu(this.spec,t,i,t.doc.length).next();return n.done&&(n=uu(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=uu(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=uu(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 Ou=ut.define(),gu=ut.define(),mu=q.define({create:t=>new bu(_u(t).create(),null),update(t,e){for(let i of e.effects)i.is(Ou)?t=new bu(i.value.create(),t.panel):i.is(gu)&&(t=new bu(t.query,i.value?Cu:null));return t},provide:t=>Ur.from(t,(t=>t.panel))});class bu{constructor(t,e){this.query=t,this.panel=e}}const wu=ni.mark({class:"cm-searchMatch"}),vu=ni.mark({class:"cm-searchMatch cm-searchMatch-selected"}),yu=_i.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(mu))}update(t){let e=t.state.field(mu);(e!=t.startState.field(mu)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ni.none;let{view:i}=this,n=new Xt;for(let e=0,s=i.visibleRanges,r=s.length;es[e+1].from-500;)a=s[++e].to;t.highlight(i.state,o,a,((t,e)=>{let s=i.state.selection.ranges.some((i=>i.from==t&&i.to==e));n.add(t,e,s?vu:wu)}))}return n.finish()}},{decorations:t=>t.decorations});function Su(t){return e=>{let i=e.state.field(mu,!1);return i&&i.query.spec.valid?t(e,i):Au(e)}}const xu=Su(((t,{query:e})=>{let{to:i}=t.state.selection.main,n=e.nextMatch(t.state,i,i);if(!n)return!1;let s=A.single(n.from,n.to),r=t.state.facet(ou);return t.dispatch({selection:s,effects:[Wu(t,n),r.scrollToMatch(s.main,t)],userEvent:"select.search"}),Zu(t),!0})),ku=Su(((t,{query:e})=>{let{state:i}=t,{from:n}=i.selection.main,s=e.prevMatch(i,n,n);if(!s)return!1;let r=A.single(s.from,s.to),o=t.state.facet(ou);return t.dispatch({selection:r,effects:[Wu(t,s),o.scrollToMatch(r.main,t)],userEvent:"select.search"}),Zu(t),!0})),Qu=Su(((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!(!i||!i.length)&&(t.dispatch({selection:A.create(i.map((t=>A.range(t.from,t.to)))),userEvent:"select.search.matches"}),!0)})),$u=Su(((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,a,l=[],h=[];if(r.from==n&&r.to==s&&(a=i.toText(e.getReplacement(r)),l.push({from:r.from,to:r.to,insert:a}),r=e.nextMatch(i,r.from,r.to),h.push(Ts.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(n).number)+"."))),r){let e=0==l.length||l[0].from>=r.to?0:r.to-r.from-a.length;o=A.single(r.from-e,r.to-e),h.push(Wu(t,r)),h.push(i.facet(ou).scrollToMatch(o.main,t))}return t.dispatch({changes:l,selection:o,effects:h,userEvent:"input.replace"}),!0})),Pu=Su(((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:Ts.announce.of(n),userEvent:"input.replace.all"}),!0}));function Cu(t){return t.state.facet(ou).createPanel(t)}function _u(t,e){var i,n,s,r;let o=t.selection.main,a=o.empty||o.to>o.from+100?"":t.sliceDoc(o.from,o.to);if(e&&!a)return e;let l=t.facet(ou);return new au({search:(null!==(i=null==e?void 0:e.literal)&&void 0!==i?i:l.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:null!==(n=null==e?void 0:e.caseSensitive)&&void 0!==n?n:l.caseSensitive,literal:null!==(s=null==e?void 0:e.literal)&&void 0!==s?s:l.literal,wholeWord:null!==(r=null==e?void 0:e.wholeWord)&&void 0!==r?r:l.wholeWord})}function Xu(t){let e=Vr(t,Cu);return e&&e.dom.querySelector("[main-field]")}function Zu(t){let e=Xu(t);e&&e==t.root.activeElement&&e.select()}const Au=t=>{let e=t.state.field(mu,!1);if(e&&e.panel){let i=Xu(t);if(i&&i!=t.root.activeElement){let n=_u(t.state,e.query.spec);n.valid&&t.dispatch({effects:Ou.of(n)}),i.focus(),i.select()}}else t.dispatch({effects:[gu.of(!0),e?Ou.of(_u(t.state,e.query.spec)):ut.appendConfig.of(Yu)]});return!0},Tu=t=>{let e=t.state.field(mu,!1);if(!e||!e.panel)return!1;let i=Vr(t,Cu);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:gu.of(!1)}),!0},Ru=[{key:"Mod-f",run:Au,scope:"editor search-panel"},{key:"F3",run:xu,shift:ku,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:xu,shift:ku,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Tu,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 Uc(t.doc,t.sliceDoc(n,s));!e.next().done;){if(r.length>1e3)return!1;e.value.from==n&&(o=r.length),r.push(A.range(e.value.from,e.value.to))}return e(t.update({selection:A.create(r,o),userEvent:"select.search.matches"})),!0}},{key:"Alt-g",run:t=>{let e=Vr(t,Nc);if(!e){let i=[Gc.of(!0)];null==t.state.field(Fc,!1)&&i.push(ut.appendConfig.of([Fc,Hc])),t.dispatch({effects:i}),e=Vr(t,Nc)}return e&&e.dom.querySelector("input").focus(),!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=A.create(i.ranges.map((e=>t.wordAt(e.head)||A.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 Uc(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 Uc(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(A.range(s.from,s.to),!1),effects:Ts.scrollIntoView(s.to)})),!0)},preventDefault:!0}];class Eu{constructor(t){this.view=t;let e=this.query=t.state.field(mu).query.spec;function i(t,e,i){return Mc("button",{class:"cm-button",name:t,onclick:e,type:"button"},i)}this.commit=this.commit.bind(this),this.searchField=Mc("input",{value:e.search,placeholder:Vu(t,"Find"),"aria-label":Vu(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Mc("input",{value:e.replace,placeholder:Vu(t,"Replace"),"aria-label":Vu(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Mc("input",{type:"checkbox",name:"case",form:"",checked:e.caseSensitive,onchange:this.commit}),this.reField=Mc("input",{type:"checkbox",name:"re",form:"",checked:e.regexp,onchange:this.commit}),this.wordField=Mc("input",{type:"checkbox",name:"word",form:"",checked:e.wholeWord,onchange:this.commit}),this.dom=Mc("div",{onkeydown:t=>this.keydown(t),class:"cm-search"},[this.searchField,i("next",(()=>xu(t)),[Vu(t,"next")]),i("prev",(()=>ku(t)),[Vu(t,"previous")]),i("select",(()=>Qu(t)),[Vu(t,"all")]),...t.state.readOnly?[]:[Mc("br"),this.replaceField,i("replace",(()=>$u(t)),[Vu(t,"replace")]),i("replaceAll",(()=>Pu(t)),[Vu(t,"replace all")])],Mc("button",{name:"close",onclick:()=>Tu(t),"aria-label":Vu(t,"close"),type:"button"},["×"])])}commit(){let t=new au({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:Ou.of(t)}))}keydown(t){var e,i,n;e=this.view,i=t,n="search-panel",Bs(Ls(e.state),i,e,n)?t.preventDefault():13==t.keyCode&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?ku:xu)(this.view)):13==t.keyCode&&t.target==this.replaceField&&(t.preventDefault(),$u(this.view))}update(t){for(let e of t.transactions)for(let t of e.effects)t.is(Ou)&&!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(ou).top}}function Vu(t,e){return t.state.phrase(e)}const Mu=30,Du=/[\s\.,:;?!]/;function Wu(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-Mu),o=Math.min(s,i+Mu),a=t.state.sliceDoc(r,o);if(r!=n.from)for(let t=0;ta.length-Mu;t--)if(!Du.test(a[t-1])&&Du.test(a[t])){a=a.slice(0,t);break}return Ts.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${n.number}.`)}const Uu=Ts.baseTheme({".cm-panel.cm-search":{padding:"0.25rem 0.5rem 0.25rem 0.5rem",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"0.5rem",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"}}),Yu=[mu,N.lowest(yu),Uu];class qu{constructor(t,e,i){this.state=t,this.pos=e,this.explicit=i,this.abortListeners=[]}tokenBefore(t){let e=Xa(this.state).resolveInner(this.pos,-1);for(;e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null}matchBefore(t){let e=this.state.doc.lineAt(this.pos),i=Math.max(e.from,this.pos-250),n=e.text.slice(i-e.from,this.pos-e.from),s=n.search(ju(t,!1));return s<0?null:{from:i+s,to:this.pos,text:n.slice(s)}}get aborted(){return null==this.abortListeners}addEventListener(t,e){"abort"==t&&this.abortListeners&&this.abortListeners.push(e)}}function Lu(t){let e=Object.keys(t).join(""),i=/\w/.test(e);return i&&(e=e.replace(/\w/g,"")),`[${i?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function zu(t){let e=t.map((t=>"string"==typeof t?{label:t}:t)),[i,n]=e.every((t=>/^\w+$/.test(t.label)))?[/\w*$/,/\w+$/]:function(t){let e=Object.create(null),i=Object.create(null);for(let{label:n}of t){e[n[0]]=!0;for(let t=1;t{let s=t.matchBefore(n);return s||t.explicit?{from:s?s.from:t.pos,options:e,validFor:i}:null}}class Iu{constructor(t,e,i,n){this.completion=t,this.source=e,this.match=i,this.score=n}}function Bu(t){return t.selection.main.from}function ju(t,e){var i;let{source:n}=t,s=e&&"^"!=n[0],r="$"!=n[n.length-1];return s||r?new RegExp(`${s?"^":""}(?:${n})${r?"$":""}`,null!==(i=t.flags)&&void 0!==i?i:t.ignoreCase?"i":""):t}const Nu=lt.define();const Gu=new WeakMap;function Fu(t){if(!Array.isArray(t))return t;let e=Gu.get(t);return e||Gu.set(t,e=zu(t)),e}const Hu=ut.define(),Ju=ut.define();class Ku{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[];for(let e=0;e=48&&l<=57||l>=97&&l<=122?2:l>=65&&l<=90?1:0:(y=w(l))!=y.toLowerCase()?1:y!=y.toUpperCase()?2:0;(!n||1==S&&O||0==m&&0!=S)&&(e[c]==l||i[c]==l&&(u=!0)?r[c++]=n:r.length&&(g=!1)),m=S,n+=v(l)}return c==a&&0==r[0]&&g?this.result((u?-200:0)-100,r,t):d==a&&0==f?[-200-t.length+(p==t.length?0:-100),0,p]:o>-1?[-700-t.length,o,o+this.pattern.length]:d==a?[-900-t.length,f,p]:c==a?this.result((u?-200:0)-100-700+(g?0:-1100),r,t):2==e.length?null:this.result((n[0]?-700:0)-200-1100,n,t)}result(t,e,i){let n=[t-i.length],s=1;for(let t of e){let e=t+(this.astral?v(b(i,t)):1);s>1&&n[s-1]==t?n[s-1]=e:(n[s++]=t,n[s++]=e)}return n}}const td=E.define({combine:t=>kt(t,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:id,compareCompletions:(t,e)=>t.label.localeCompare(e.label),interactionDelay:75},{defaultKeymap:(t,e)=>t&&e,closeOnBlur:(t,e)=>t&&e,icons:(t,e)=>t&&e,tooltipClass:(t,e)=>i=>ed(t(i),e(i)),optionClass:(t,e)=>i=>ed(t(i),e(i)),addToOptions:(t,e)=>t.concat(e)})});function ed(t,e){return t?e?t+" "+e:t:e}function id(t,e,i,n,s){let r,o,a=t.textDirection==Wi.RTL,l=a,h=!1,c="top",u=e.left-s.left,d=s.right-e.right,f=n.right-n.left,p=n.bottom-n.top;if(l&&u=p||t>e.top?r=i.bottom-e.top:(c="bottom",r=e.bottom-i.top)}return{style:`${c}: ${r}px; max-width: ${o}px`,class:"cm-completionInfo-"+(h?a?"left-narrow":"right-narrow":l?"left":"right")}}function nd(t,e="option"){return i=>{let n=i.state.field(yd,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp-1?n.open.selected+r*(t?1:-1):t?0:o-1;return a<0?a="page"==e?0:o-1:a>=o&&(a="page"==e?o-1:0),i.dispatch({effects:vd.of(a)}),!0}}const sd=t=>{let e=t.state.field(yd,!1);return!(t.state.readOnly||!e||!e.open||e.open.selected<0||Date.now()-e.open.timestamp(t.selection||t.docChanged)&&!gd(t)));for(let e=0;e50&&Date.now()-n.time>1e3){for(let t of n.context.abortListeners)try{t()}catch(t){Qi(this.view.state,t)}n.context.abortListeners=null,this.running.splice(e--,1)}else n.updates.push(...t.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some((t=>1==t.state&&!this.running.some((e=>e.active.source==t.source))))?setTimeout((()=>this.startUpdate()),50):-1,0!=this.composing)for(let e of t.transactions)"input"==gd(e)?this.composing=2:2==this.composing&&e.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:t}=this.view,e=t.field(yd);for(let t of e.active)1!=t.state||this.running.some((e=>e.active.source==t.source))||this.startQuery(t)}startQuery(t){let{state:e}=this.view,i=Bu(e),n=new qu(e,i,t.explicitPos==i),s=new rd(t,n);this.running.push(s),Promise.resolve(t.source(n)).then((t=>{s.context.aborted||(s.done=t||null,this.scheduleAccept())}),(t=>{this.view.dispatch({effects:Ju.of(null)}),Qi(this.view.state,t)}))}scheduleAccept(){this.running.every((t=>void 0!==t.done))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((()=>this.accept()),50))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],i=this.view.state.facet(td);for(let n=0;nt.source==s.active.source));if(r&&1==r.state)if(null==s.done){let t=new md(s.active.source,0);for(let e of s.updates)t=t.update(e,i);1!=t.state&&e.push(t)}else this.startQuery(r)}e.length&&this.view.dispatch({effects:wd.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(yd,!1);if(e&&e.tooltip&&this.view.state.facet(td).closeOnBlur){let i=e.open&&Rr(this.view,e.open.tooltip);i&&i.dom.contains(t.relatedTarget)||this.view.dispatch({effects:Ju.of(null)})}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout((()=>this.view.dispatch({effects:Hu.of(!1)})),20),this.composing=0}}});function ad(t,e){const i=e.completion.apply||e.completion.label;let n=t.state.field(yd).active.find((t=>t.source==e.source));return n instanceof bd&&("string"==typeof i?t.dispatch(Object.assign(Object.assign({},function(t,e,i,n){let{main:s}=t.selection,r=i-s.from,o=n-s.from;return Object.assign(Object.assign({},t.changeByRange((a=>a!=s&&i!=n&&t.sliceDoc(a.from+r,a.from+o)!=t.sliceDoc(i,n)?{range:a}:{changes:{from:a.from+r,to:n==s.from?a.to:a.from+o,insert:e},range:A.cursor(a.from+r+e.length)}))),{userEvent:"input.complete"})}(t.state,i,n.from,n.to)),{annotations:Nu.of(e.completion)})):i(t,e.completion,n.from,n.to),!0)}function ld(t,e,i){if(t<=i)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let t=Math.floor(e/i);return{from:t*i,to:(t+1)*i}}let n=Math.floor((t-e)/i);return{from:t-(n+1)*i,to:t-n*i}}class hd{constructor(t,e){this.view=t,this.stateField=e,this.info=null,this.placeInfoReq={read:()=>this.measureInfo(),write:t=>this.placeInfo(t),key:this},this.space=null,this.currentClass="";let i=t.state.field(e),{options:n,selected:s}=i.open,r=t.state.facet(td);this.optionContent=function(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(t){let e=document.createElement("div");return e.classList.add("cm-completionIcon"),t.type&&e.classList.add(...t.type.split(/\s+/g).map((t=>"cm-completionIcon-"+t))),e.setAttribute("aria-hidden","true"),e},position:20}),e.push({render(t,e,i){let n=document.createElement("span");n.className="cm-completionLabel";let{label:s}=t,r=0;for(let t=1;tr&&n.appendChild(document.createTextNode(s.slice(r,e)));let a=n.appendChild(document.createElement("span"));a.appendChild(document.createTextNode(s.slice(e,o))),a.className="cm-completionMatchedText",r=o}return rt.position-e.position)).map((t=>t.render))}(r),this.optionClass=r.optionClass,this.tooltipClass=r.tooltipClass,this.range=ld(n.length,s,r.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",(e=>{for(let i,s=e.target;s&&s!=this.dom;s=s.parentNode)if("LI"==s.nodeName&&(i=/-(\d+)$/.exec(s.id))&&+i[1]{let i=t.state.field(this.stateField,!1);i&&i.tooltip&&t.state.facet(td).closeOnBlur&&e.relatedTarget!=t.contentDOM&&t.dispatch({effects:Ju.of(null)})})),this.list=this.dom.appendChild(this.createListBox(n,i.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))}mount(){this.updateSel()}update(t){var e,i,n;let s=t.state.field(this.stateField),r=t.startState.field(this.stateField);this.updateTooltipClass(t.state),s!=r&&(this.updateSel(),(null===(e=s.open)||void 0===e?void 0:e.disabled)!=(null===(i=r.open)||void 0===i?void 0:i.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!(null===(n=s.open)||void 0===n?void 0:n.disabled)))}updateTooltipClass(t){let e=this.tooltipClass(t);if(e!=this.currentClass){for(let t of this.currentClass.split(" "))t&&this.dom.classList.remove(t);for(let t of e.split(" "))t&&this.dom.classList.add(t);this.currentClass=e}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),e=t.open;if((e.selected>-1&&e.selected=this.range.to)&&(this.range=ld(e.options.length,e.selected,this.view.state.facet(td).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e.options,t.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))),this.updateSelectedOption(e.selected)){this.info&&(this.info.remove(),this.info=null);let{completion:i}=e.options[e.selected],{info:n,label:s,c:r}=i;if(!n)return;let o="string"==typeof n?document.createTextNode(n+" "):n(i);if(!o)return;if(!r){const t=document.createElement("span");t.appendChild(o),o=t;const e=document.createElement("a");e.innerText="🔎",e.href="/docFind/"+s,e.target="blank",o.appendChild(e)}if(!o)return;"then"in o?o.then((e=>{e&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(e)})).catch((t=>Qi(this.view.state,t,"completion info"))):this.addInfoPane(o)}}addInfoPane(t){let e=this.info=document.createElement("div");e.className="cm-tooltip cm-completionInfo",e.appendChild(t),this.dom.appendChild(e),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let e=null;for(let i=this.list.firstChild,n=this.range.from;i;i=i.nextSibling,n++)"LI"==i.nodeName&&i.id?n==t?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),e=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected"):n--;return e&&function(t,e){let i=t.getBoundingClientRect(),n=e.getBoundingClientRect();n.topi.bottom&&(t.scrollTop+=n.bottom-i.bottom)}(this.list,e),e}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let e=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),n=t.getBoundingClientRect(),s=this.space;if(!s){let t=this.dom.ownerDocument.defaultView||window;s={left:0,top:0,right:t.innerWidth,bottom:t.innerHeight}}return n.top>Math.min(s.bottom,e.bottom)-10||n.bottomi.from||0==i.from))if(s=t,"string"!=typeof l&&l.header)n.appendChild(l.header(l));else{n.appendChild(document.createElement("completion-section")).textContent=t}}const h=n.appendChild(document.createElement("li"));h.id=e+"-"+r,h.setAttribute("role","option");let c=this.optionClass(o);c&&(h.className=c);for(let t of this.optionContent){let e=t(o,this.view.state,a);e&&h.appendChild(e)}}return i.from&&n.classList.add("cm-completionListIncompleteTop"),i.to=this.options.length?this:new ud(this.options,pd(e,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,e,i,n,s){let r=function(t,e){let i=[],n=null,s=t=>{i.push(t);let{section:e}=t.completion;if(e){n||(n=[]);let t="string"==typeof e?e:e.name;n.some((e=>e.name==t))||n.push("string"==typeof e?{name:t}:e)}};for(let n of t)if(n.hasResult())if(!1===n.result.filter){let t=n.result.getMatch;for(let e of n.result.options){let r=[1e9-i.length];if(t)for(let i of t(e))r.push(i);s(new Iu(e,n.source,r,r[0]))}}else{let t,i=new Ku(e.sliceDoc(n.from,n.to));for(let e of n.result.options)(t=i.match(e.label))&&s(new Iu(e,n.source,t,t[0]+(e.boost||0)))}if(n){let t=Object.create(null),e=0,s=(t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:1e9)-(null!==(n=e.rank)&&void 0!==n?n:1e9)||(t.namee.score-t.score||a(t.completion,e.completion))))!o||o.label!=t.completion.label||o.detail!=t.completion.detail||null!=o.type&&null!=t.completion.type&&o.type!=t.completion.type||o.apply!=t.completion.apply?r.push(t):cd(t.completion)>cd(o)&&(r[r.length-1]=t),o=t.completion;return r}(t,e);if(!r.length)return n&&t.some((t=>1==t.state))?new ud(n.options,n.attrs,n.tooltip,n.timestamp,n.selected,!0):null;let o=e.facet(td).selectOnOpen?0:-1;if(n&&n.selected!=o&&-1!=n.selected){let t=n.options[n.selected].completion;for(let e=0;ee.hasResult()?Math.min(t,e.from):t),1e8),create:(a=yd,t=>new hd(t,a)),above:s.aboveCursor},n?n.timestamp:Date.now(),o,!1);var a}map(t){return new ud(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class dd{constructor(t,e,i){this.active=t,this.id=e,this.open=i}static start(){return new dd(Od,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(t){let{state:e}=t,i=e.facet(td),n=(i.override||e.languageDataAt("autocomplete",Bu(e)).map(Fu)).map((e=>(this.active.find((t=>t.source==e))||new md(e,this.active.some((t=>0!=t.state))?1:0)).update(t,i)));n.length==this.active.length&&n.every(((t,e)=>t==this.active[e]))&&(n=this.active);let s=this.open;s&&t.docChanged&&(s=s.map(t.changes)),t.selection||n.some((e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to)))||!function(t,e){if(t==e)return!0;for(let i=0,n=0;;){for(;i1==t.state))&&(s=null),!s&&n.every((t=>1!=t.state))&&n.some((t=>t.hasResult()))&&(n=n.map((t=>t.hasResult()?new md(t.source,0):t)));for(let e of t.effects)e.is(vd)&&(s=s&&s.setSelected(e.value,this.id));return n==this.active&&s==this.open?this:new dd(n,this.id,s)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:fd}}const fd={"aria-autocomplete":"list"};function pd(t,e){let i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(i["aria-activedescendant"]=t+"-"+e),i}const Od=[];function gd(t){return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null}class md{constructor(t,e,i=-1){this.source=t,this.state=e,this.explicitPos=i}hasResult(){return!1}update(t,e){let i=gd(t),n=this;i?n=n.handleUserEvent(t,i,e):t.docChanged?n=n.handleChange(t):t.selection&&0!=n.state&&(n=new md(n.source,0));for(let e of t.effects)if(e.is(Hu))n=new md(n.source,1,e.value?Bu(t.state):-1);else if(e.is(Ju))n=new md(n.source,0);else if(e.is(wd))for(let t of e.value)t.source==n.source&&(n=t);return n}handleUserEvent(t,e,i){return"delete"!=e&&i.activateOnTyping?new md(this.source,1):this.map(t.changes)}handleChange(t){return t.changes.touchesRange(Bu(t.startState))?new md(this.source,0):this.map(t.changes)}map(t){return t.empty||this.explicitPos<0?this:new md(this.source,this.state,t.mapPos(this.explicitPos))}}class bd extends md{constructor(t,e,i,n,s){super(t,2,e),this.result=i,this.from=n,this.to=s}hasResult(){return!0}handleUserEvent(t,e,i){var n;let s=t.changes.mapPos(this.from),r=t.changes.mapPos(this.to,1),o=Bu(t.state);if((this.explicitPos<0?o<=s:or||"delete"==e&&Bu(t.startState)==this.from)return new md(this.source,"input"==e&&i.activateOnTyping?1:0);let a,l=this.explicitPos<0?-1:t.changes.mapPos(this.explicitPos);return function(t,e,i,n){if(!t)return!1;let s=e.sliceDoc(i,n);return"function"==typeof t?t(s,i,n,e):ju(t,!0).test(s)}(this.result.validFor,t.state,s,r)?new bd(this.source,l,this.result,s,r):this.result.update&&(a=this.result.update(this.result,s,r,new qu(t.state,o,l>=0)))?new bd(this.source,l,a,a.from,null!==(n=a.to)&&void 0!==n?n:Bu(t.state)):new md(this.source,1,l)}handleChange(t){return t.changes.touchesRange(this.from,this.to)?new md(this.source,0):this.map(t.changes)}map(t){return t.empty?this:new bd(this.source,this.explicitPos<0?-1:t.mapPos(this.explicitPos),this.result,t.mapPos(this.from),t.mapPos(this.to,1))}}const wd=ut.define({map:(t,e)=>t.map((t=>t.map(e)))}),vd=ut.define(),yd=q.define({create:()=>dd.start(),update:(t,e)=>t.update(e),provide:t=>[Tr.from(t,(t=>t.tooltip)),Ts.contentAttributes.from(t,(t=>t.attrs))]}),Sd=Ts.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class xd{constructor(t,e,i,n){this.field=t,this.line=e,this.from=i,this.to=n}}class kd{constructor(t,e,i){this.field=t,this.from=e,this.to=i}map(t){let e=t.mapPos(this.from,-1,S.TrackDel),i=t.mapPos(this.to,1,S.TrackDel);return null==e||null==i?null:new kd(this.field,e,i)}}class Qd{constructor(t,e){this.lines=t,this.fieldPositions=e}instantiate(t,e){let i=[],n=[e],s=t.doc.lineAt(e),r=/^\s*/.exec(s.text)[0];for(let s of this.lines){if(i.length){let i=r,o=/^\t*/.exec(s)[0].length;for(let e=0;enew kd(t.field,n[t.line]+t.from,n[t.line]+t.to)));return{text:i,ranges:o}}static parse(t){let e,i=[],n=[],s=[];for(let r of t.split(/\r\n?|\n/)){for(;e=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(r);){let t=e[1]?+e[1]:null,o=e[2]||e[3]||"",a=-1;for(let e=0;e=a&&t.field++}s.push(new xd(a,n.length,e.index,e.index+o.length)),r=r.slice(0,e.index)+o+r.slice(e.index+e[0].length)}for(let t;t=/\\([{}])/.exec(r);){r=r.slice(0,t.index)+t[1]+r.slice(t.index+t[0].length);for(let e of s)e.line==n.length&&e.from>t.index&&(e.from--,e.to--)}n.push(r)}return new Qd(n,s)}}let $d=ni.widget({widget:new class extends ei{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),Pd=ni.mark({class:"cm-snippetField"});class Cd{constructor(t,e){this.ranges=t,this.active=e,this.deco=ni.set(t.map((t=>(t.from==t.to?$d:Pd).range(t.from,t.to))))}map(t){let e=[];for(let i of this.ranges){let n=i.map(t);if(!n)return null;e.push(n)}return new Cd(e,this.active)}selectionInsideField(t){return t.ranges.every((t=>this.ranges.some((e=>e.field==this.active&&e.from<=t.from&&e.to>=t.to))))}}const _d=ut.define({map:(t,e)=>t&&t.map(e)}),Xd=ut.define(),Zd=q.define({create:()=>null,update(t,e){for(let i of e.effects){if(i.is(_d))return i.value;if(i.is(Xd)&&t)return new Cd(t.ranges,i.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>Ts.decorations.from(t,(t=>t?t.deco:ni.none))});function Ad(t,e){return A.create(t.filter((t=>t.field==e)).map((t=>A.range(t.from,t.to))))}function Td(e){let i=Qd.parse(e);return(e,n,s,r)=>{let{text:o,ranges:a}=i.instantiate(e.state,s),l={changes:{from:s,to:r,insert:t.of(o)},scrollIntoView:!0,annotations:n?Nu.of(n):void 0};if(a.length&&(l.selection=Ad(a,0)),a.length>1){let t=new Cd(a,0),i=l.effects=[_d.of(t)];void 0===e.state.field(Zd,!1)&&i.push(ut.appendConfig.of([Zd,Md,Wd,Sd]))}e.dispatch(e.state.update(l))}}function Rd(t){return({state:e,dispatch:i})=>{let n=e.field(Zd,!1);if(!n||t<0&&0==n.active)return!1;let s=n.active+t,r=t>0&&!n.ranges.some((e=>e.field==s+t));return i(e.update({selection:Ad(n.ranges,s),effects:_d.of(r?null:new Cd(n.ranges,s))})),!0}}const Ed=[{key:"Tab",run:Rd(1),shift:Rd(-1)},{key:"Escape",run:({state:t,dispatch:e})=>!!t.field(Zd,!1)&&(e(t.update({effects:_d.of(null)})),!0)}],Vd=E.define({combine:t=>t.length?t[0]:Ed}),Md=N.highest(Ys.compute([Vd],(t=>t.facet(Vd))));function Dd(t,e){return Object.assign(Object.assign({},e),{apply:Td(t)})}const Wd=Ts.domEventHandlers({mousedown(t,e){let i,n=e.state.field(Zd,!1);if(!n||null==(i=e.posAtCoords({x:t.clientX,y:t.clientY})))return!1;let s=n.ranges.find((t=>t.from<=i&&t.to>=i));return!(!s||s.field==n.active)&&(e.dispatch({selection:Ad(n.ranges,s.field),effects:_d.of(n.ranges.some((t=>t.field>s.field))?new Cd(n.ranges,s.field):null)}),!0)}}),Ud=new class extends Qt{};function Yd(t={}){return[yd,td.of(t),od,Ld,Sd]}Ud.startSide=1,Ud.endSide=-1;const qd=[{key:"Ctrl-Space",run:t=>!!t.state.field(yd,!1)&&(t.dispatch({effects:Hu.of(!0)}),!0)},{key:"Escape",run:t=>{let e=t.state.field(yd,!1);return!(!e||!e.active.some((t=>0!=t.state)))&&(t.dispatch({effects:Ju.of(null)}),!0)}},{key:"ArrowDown",run:nd(!0)},{key:"ArrowUp",run:nd(!1)},{key:"PageDown",run:nd(!0,"page")},{key:"PageUp",run:nd(!1,"page")},{key:"Enter",run:sd}],Ld=N.highest(Ys.computeN([td],(t=>t.facet(td).defaultKeymap?[qd]:[]))),zd=(()=>[vr(),Sh(),ir(),$l(_l,{fallback:!0}),Ys.of([...Vc,...Wh])])();class Id{constructor(t,e,i,n,s,r,o,a,l,h=0,c){this.p=t,this.stack=e,this.state=i,this.reducePos=n,this.pos=s,this.score=r,this.buffer=o,this.bufferBase=a,this.curContext=l,this.lookAhead=h,this.parent=c}toString(){return`[${this.stack.filter(((t,e)=>e%3==0)).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,i=0){let n=t.parser.context;return new Id(t,[],e,i,i,0,[],0,n?new Bd(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let i=t>>19,n=65535&t,{parser:s}=this.p,r=s.dynamicPrecedence(n);if(r&&(this.score+=r),0==i)return this.pushState(s.getGoto(this.state,n,!0),this.reducePos),n=2e3&&!(null===(e=this.p.parser.nodeSet.types[n])||void 0===e?void 0:e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=l):this.p.lastBigReductionSizeo;)this.stack.pop();this.reduceContext(n,a)}storeNode(t,e,i,n=4,s=!1){if(0==t&&(!this.stack.length||this.stack[this.stack.length-1]0&&0==t.buffer[n-4]&&t.buffer[n-1]>-1){if(e==i)return;if(t.buffer[n-2]>=e)return void(t.buffer[n-2]=i)}}if(s&&this.pos!=i){let s=this.buffer.length;if(s>0&&0!=this.buffer[s-4])for(;s>0&&this.buffer[s-2]>i;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,n>4&&(n-=4);this.buffer[s]=t,this.buffer[s+1]=e,this.buffer[s+2]=i,this.buffer[s+3]=n}else this.buffer.push(t,e,i,n)}shift(t,e,i){let n=this.pos;if(131072&t)this.pushState(65535&t,this.pos);else if(0==(262144&t)){let s=t,{parser:r}=this.p;(i>this.pos||e<=r.maxNode)&&(this.pos=i,r.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,n),this.shiftContext(e,n),e<=r.maxNode&&this.buffer.push(e,n,i,4)}else this.pos=i,this.shiftContext(e,n),e<=this.p.parser.maxNode&&this.buffer.push(e,n,i,4)}apply(t,e,i){65536&t?this.reduce(t):this.shift(t,e,i)}useNode(t,e){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=t)&&(this.p.reused.push(t),i++);let n=this.pos;this.reducePos=this.pos=n+t.length,this.pushState(e,n),this.buffer.push(i,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let i=t.buffer.slice(e),n=t.bufferBase+e;for(;t&&n==t.bufferBase;)t=t.parent;return new Id(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,n,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let i=t<=this.p.parser.maxNode;i&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,i?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new Nd(this);;){let i=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(0==i)return!1;if(0==(65536&i))return!0;e.reduce(i)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let n,s=0;s1&e&&t==n))||i.push(e[t],n)}e=i}let i=[];for(let t=0;t>19,n=65535&t,s=this.stack.length-3*i;if(s<0||e.getGoto(this.stack[s],n,!1)<0)return!1;this.storeNode(0,this.reducePos,this.reducePos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:t}=this.p;return 65535==t.data[t.stateSlot(this.state,1)]&&!t.stateSlot(this.state,4)}restart(){this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;ethis.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Bd{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}var jd;!function(t){t[t.Insert=200]="Insert",t[t.Delete=190]="Delete",t[t.Reduce=100]="Reduce",t[t.MaxNext=4]="MaxNext",t[t.MaxInsertStackDepth=300]="MaxInsertStackDepth",t[t.DampenInsertStackDepth=120]="DampenInsertStackDepth",t[t.MinBigReduction=2e3]="MinBigReduction"}(jd||(jd={}));class Nd{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=65535&t,i=t>>19;0==i?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(i-1);let n=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=n}}class Gd{constructor(t,e,i){this.stack=t,this.pos=e,this.index=i,this.buffer=t.buffer,0==this.index&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new Gd(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;null!=t&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new Gd(this.stack,this.pos,this.index)}}function Fd(t,e=Uint16Array){if("string"!=typeof t)return t;let i=null;for(let n=0,s=0;n=92&&e--,e>=34&&e--;let s=e-32;if(s>=46&&(s-=46,i=!0),r+=s,i)break;r*=46}i?i[s++]=r:i=new e(r)}return i}class Hd{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Jd=new Hd;class Kd{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Jd,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let i=this.range,n=this.rangeIndex,s=this.pos+t;for(;si.to:s>=i.to;){if(n==this.ranges.length-1)return null;let t=this.ranges[++n];s+=t.from-i.to,i=t}return s}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,e.from);return this.end}peek(t){let e,i,n=this.chunkOff+t;if(n>=0&&n=this.chunk2Pos&&en.to&&(this.chunk2=this.chunk2.slice(0,n.to-e)),i=this.chunk2.charCodeAt(0)}}return e>=this.token.lookAhead&&(this.token.lookAhead=e+1),i}acceptToken(t,e=0){let i=e?this.resolveOffset(e,-1):this.pos;if(null==i||i=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=Jd,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let i="";for(let n of this.ranges){if(n.from>=e)break;n.to>t&&(i+=this.input.read(Math.max(n.from,t),Math.min(n.to,e)))}return i}}class tf{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:i}=e.p;sf(this.data,t,e,this.id,i.data,i.tokenPrecTable)}}tf.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class ef{constructor(t,e,i){this.precTable=e,this.elseToken=i,this.data="string"==typeof t?Fd(t):t}token(t,e){let i=t.pos,n=0;for(;sf(this.data,t,e,0,this.data,this.precTable),!(t.token.value>-1);){if(null==this.elseToken)return;if(t.next<0)break;t.advance(),t.reset(t.pos,t.token),n++}n&&(t.reset(i,t.token),t.acceptToken(this.elseToken,n))}}ef.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class nf{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function sf(t,e,i,n,s,r){let o=0,a=1<0){let i=t[n];if(l.allows(i)&&(-1==e.token.value||e.token.value==i||of(i,e.token.value,s,r))){e.acceptToken(i);break}}let n=e.next,h=0,c=t[o+2];if(!(e.next<0&&c>h&&65535==t[i+3*c-3]&&65535==t[i+3*c-3])){for(;h>1,r=i+s+(s<<1),a=t[r],l=t[r+1]||65536;if(n=l)){o=t[r+2],e.advance();continue t}h=s+1}}break}o=t[i+3*c-1]}}function rf(t,e,i){for(let n,s=e;65535!=(n=t[s]);s++)if(n==i)return s-e;return-1}function of(t,e,i,n){let s=rf(i,n,e);return s<0||rf(i,n,t)e)&&!n.type.isError)return i<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(t.length,Math.max(n.from+1,e+25));if(i<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return i<0?0:t.length}}!function(t){t[t.Margin=25]="Margin"}(hf||(hf={}));let uf=class{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?cf(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?cf(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=r,null;if(s instanceof bo){if(r==t){if(r=Math.max(this.safeFrom,t)&&(this.trees.push(s),this.start.push(r),this.index.push(0))}else this.index[e]++,this.nextStart=r+s.length}}};class df{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map((t=>new Hd))}getActions(t){let e=0,i=null,{parser:n}=t.p,{tokenizers:s}=n,r=n.stateSlot(t.state,3),o=t.curContext?t.curContext.hash:0,a=0;for(let n=0;nh.end+25&&(a=Math.max(h.lookAhead,a)),0!=h.value)){let n=e;if(h.extended>-1&&(e=this.addActions(t,h.extended,h.end,e)),e=this.addActions(t,h.value,h.end,e),!l.extend&&(i=h,e>n))break}}for(;this.actions.length>e;)this.actions.pop();return a&&t.setLookAhead(a),i||t.pos!=this.stream.end||(i=new Hd,i.value=t.p.parser.eofTerm,i.start=i.end=t.pos,e=this.addActions(t,i.value,i.end,e)),this.mainToken=i,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new Hd,{pos:i,p:n}=t;return e.start=i,e.end=Math.min(i+1,n.stream.end),e.value=i==n.stream.end?n.parser.eofTerm:0,e}updateCachedToken(t,e,i){let n=this.stream.clipPos(i.pos);if(e.token(this.stream.reset(n,t),i),t.value>-1){let{parser:e}=i.p;for(let n=0;n=0&&i.p.parser.dialect.allows(s>>1)){0==(1&s)?t.value=s>>1:t.extended=s>>1;break}}}else t.value=0,t.end=this.stream.clipPos(n+1)}putAction(t,e,i,n){for(let e=0;e4*t.bufferLength?new uf(i,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t,e,i=this.stacks,n=this.minStackPos,s=this.stacks=[];if(this.bigReductionCount>300&&1==i.length){let[t]=i;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;rn)s.push(o);else{if(this.advanceStack(o,s,i))continue;{t||(t=[],e=[]),t.push(o);let i=this.tokens.getMainToken(o);e.push(i.value,i.end)}}break}}if(!s.length){let e=t&&function(t){let e=null;for(let i of t){let t=i.p.stoppedAt;(i.pos==i.p.stream.end||null!=t&&i.pos>t)&&i.p.parser.stateFlag(i.state,2)&&(!e||e.scorethis.stoppedAt?t[0]:this.runRecovery(t,e,s);if(i)return this.stackToTree(i.forceAll())}if(this.recovering){let t=1==this.recovering?1:3*this.recovering;if(s.length>t)for(s.sort(((t,e)=>e.score-t.score));s.length>t;)s.pop();s.some((t=>t.reducePos>n))&&this.recovering--}else if(s.length>1){t:for(let t=0;t500&&n.buffer.length>500){if(!((e.score-n.score||e.buffer.length-n.buffer.length)>0)){s.splice(t--,1);continue t}s.splice(i--,1)}}}s.length>12&&s.splice(12,s.length-12)}this.minStackPos=s[0].pos;for(let t=1;t ":"";if(null!=this.stoppedAt&&n>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let e=t.curContext&&t.curContext.tracker.strict,i=e?t.curContext.hash:0;for(let o=this.fragments.nodeAt(n);o;){let n=this.parser.nodeSet.types[o.type.id]==o.type?s.getGoto(t.state,o.type.id):-1;if(n>-1&&o.length&&(!e||(o.prop(ho.contextHash)||0)==i))return t.useNode(o,n),af&&console.log(r+this.stackID(t)+` (via reuse of ${s.getName(o.type.id)})`),!0;if(!(o instanceof bo)||0==o.children.length||o.positions[0]>0)break;let a=o.children[0];if(!(a instanceof bo&&0==o.positions[0]))break;o=a}}let o=s.stateSlot(t.state,4);if(o>0)return t.reduce(o),af&&console.log(r+this.stackID(t)+` (via always-reduce ${s.getName(65535&o)})`),!0;if(t.stack.length>=15e3)for(;t.stack.length>9e3&&t.forceReduce(););let a=this.tokens.getActions(t);for(let o=0;on?e.push(d):i.push(d)}return!1}advanceFully(t,e){let i=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>i)return Of(t,e),!0}}runRecovery(t,e,i){let n=null,s=!1;for(let r=0;r ":"";if(o.deadEnd){if(s)continue;if(s=!0,o.restart(),af&&console.log(h+this.stackID(o)+" (restarted)"),this.advanceFully(o,i))continue}let c=o.split(),u=h;for(let t=0;c.forceReduce()&&t<10;t++){if(af&&console.log(u+this.stackID(c)+" (via force-reduce)"),this.advanceFully(c,i))break;af&&(u=this.stackID(c)+" -> ")}for(let t of o.recoverByInsert(a))af&&console.log(h+this.stackID(t)+" (via recover-insert)"),this.advanceFully(t,i);this.stream.end>o.pos?(l==o.pos&&(l++,a=0),o.recoverByDelete(a,l),af&&console.log(h+this.stackID(o)+` (via recover-delete ${this.parser.getName(a)})`),Of(o,i)):(!n||n.scoret;class bf{constructor(t){this.start=t.start,this.shift=t.shift||mf,this.reduce=t.reduce||mf,this.reuse=t.reuse||mf,this.hash=t.hash||(()=>0),this.strict=!1!==t.strict}}class wf extends Vo{constructor(t){if(super(),this.wrappers=[],14!=t.version)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let i=0;it.topRules[e][1])),n=[];for(let t=0;t=0)s(n,t,e[i++]);else{let r=e[i+-n];for(let o=-n;o>0;o--)s(e[i++],t,r);i++}}}this.nodeSet=new po(e.map(((e,s)=>fo.define({name:s>=this.minRepeatTerm?void 0:e,id:s,props:n[s],top:i.indexOf(s)>-1,error:0==s,skipped:t.skippedNodes&&t.skippedNodes.indexOf(s)>-1})))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=oo;let r=Fd(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let t=0;t"number"==typeof t?new tf(r,t):t)),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,i){let n=new pf(this,t,e,i);for(let s of this.wrappers)n=s(n,t,e,i);return n}getGoto(t,e,i=!1){let n=this.goto;if(e>=n[0])return-1;for(let s=n[e+1];;){let e=n[s++],r=1&e,o=n[s++];if(r&&i)return o;for(let i=s+(e>>1);s0}validAction(t,e){if(e==this.stateSlot(t,4))return!0;for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])return!1;i=vf(this.data,i+2)}if(e==vf(this.data,i+1))return!0}}nextStates(t){let e=[];for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])break;i=vf(this.data,i+2)}if(0==(1&this.data[i+2])){let t=this.data[i+1];e.some(((e,i)=>1&i&&e==t))||e.push(this.data[i],t)}}return e}configure(t){let e=Object.assign(Object.create(wf.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let i=this.topRules[t.top];if(!i)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=i}return t.tokenizers&&(e.tokenizers=this.tokenizers.map((e=>{let i=t.tokenizers.find((t=>t.from==e));return i?i.to:e}))),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map(((i,n)=>{let s=t.specializers.find((t=>t.from==i.external));if(!s)return i;let r=Object.assign(Object.assign({},i),{external:s.to});return e.specializers[n]=yf(r),r}))),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),null!=t.strict&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),null!=t.bufferLength&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return null==e?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),i=e.map((()=>!1));if(t)for(let n of t.split(" ")){let t=e.indexOf(n);t>=0&&(i[t]=!0)}let n=null;for(let t=0;tt.external(i,n)<<1|e}return t.get}const Sf=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],xf=new bf({start:!1,shift:(t,e)=>3==e||4==e||305==e?t:306==e,strict:!1}),kf=new nf(((t,e)=>{let{next:i}=t;(125==i||-1==i||e.context)&&e.canShift(303)&&t.acceptToken(303)}),{contextual:!0,fallback:!0}),Qf=new nf(((t,e)=>{let i,{next:n}=t;Sf.indexOf(n)>-1||(47!=n||47!=(i=t.peek(1))&&42!=i)&&125!=n&&59!=n&&-1!=n&&!e.context&&e.canShift(302)&&t.acceptToken(302)}),{contextual:!0}),$f=new nf(((t,e)=>{let{next:i}=t;if((43==i||45==i)&&(t.advance(),i==t.next)){t.advance();let i=!e.context&&e.canShift(1);t.acceptToken(i?1:2)}}),{contextual:!0}),Pf=ea({"get set async static":Sa.modifier,"for while do if else switch try catch finally return throw break continue default case":Sa.controlKeyword,"in of await yield void typeof delete instanceof":Sa.operatorKeyword,"let var const function class extends":Sa.definitionKeyword,"import export from":Sa.moduleKeyword,"with debugger as new":Sa.keyword,TemplateString:Sa.special(Sa.string),super:Sa.atom,BooleanLiteral:Sa.bool,this:Sa.self,null:Sa.null,Star:Sa.modifier,VariableName:Sa.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":Sa.function(Sa.variableName),VariableDefinition:Sa.definition(Sa.variableName),Label:Sa.labelName,PropertyName:Sa.propertyName,PrivatePropertyName:Sa.special(Sa.propertyName),"CallExpression/MemberExpression/PropertyName":Sa.function(Sa.propertyName),"FunctionDeclaration/VariableDefinition":Sa.function(Sa.definition(Sa.variableName)),"ClassDeclaration/VariableDefinition":Sa.definition(Sa.className),PropertyDefinition:Sa.definition(Sa.propertyName),PrivatePropertyDefinition:Sa.definition(Sa.special(Sa.propertyName)),UpdateOp:Sa.updateOperator,LineComment:Sa.lineComment,BlockComment:Sa.blockComment,Number:Sa.number,String:Sa.string,Escape:Sa.escape,ArithOp:Sa.arithmeticOperator,LogicOp:Sa.logicOperator,BitOp:Sa.bitwiseOperator,CompareOp:Sa.compareOperator,RegExp:Sa.regexp,Equals:Sa.definitionOperator,Arrow:Sa.function(Sa.punctuation),": Spread":Sa.punctuation,"( )":Sa.paren,"[ ]":Sa.squareBracket,"{ }":Sa.brace,"InterpolationStart InterpolationEnd":Sa.special(Sa.brace),".":Sa.derefOperator,", ;":Sa.separator,"@":Sa.meta,TypeName:Sa.typeName,TypeDefinition:Sa.definition(Sa.typeName),"type enum interface implements namespace module declare":Sa.definitionKeyword,"abstract global Privacy readonly override":Sa.modifier,"is keyof unique infer":Sa.operatorKeyword,JSXAttributeValue:Sa.attributeValue,JSXText:Sa.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":Sa.angleBracket,"JSXIdentifier JSXNameSpacedName":Sa.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":Sa.attributeName,"JSXBuiltin/JSXIdentifier":Sa.standard(Sa.tagName)}),Cf={__proto__:null,export:14,as:19,from:27,default:30,async:35,function:36,extends:46,this:50,true:58,false:58,null:70,void:74,typeof:78,super:96,new:130,delete:146,yield:155,await:159,class:164,public:221,private:221,protected:221,readonly:223,instanceof:242,satisfies:245,in:246,const:248,import:280,keyof:335,unique:339,infer:345,is:381,abstract:401,implements:403,type:405,let:408,var:410,interface:417,enum:421,namespace:427,module:429,declare:433,global:437,for:456,of:465,while:468,with:472,do:476,if:480,else:482,switch:486,case:492,try:498,catch:502,finally:506,return:510,throw:514,break:518,continue:522,debugger:526},_f={__proto__:null,async:117,get:119,set:121,declare:181,public:183,private:183,protected:183,static:185,abstract:187,override:189,readonly:195,accessor:197,new:385},Xf={__proto__:null,"<":137},Zf=wf.deserialize({version:14,states:"$6[O`QUOOO%QQUOOO'TQWOOP(bOSOOO*pQ(CjO'#CfO*wOpO'#CgO+VO!bO'#CgO+eO07`O'#DZO-vQUO'#DaO.WQUO'#DlO%QQUO'#DvO0[QUO'#EOOOQ(CY'#EW'#EWO0uQSO'#ETOOQO'#Ei'#EiOOQO'#Ib'#IbO0}QSO'#GkO1YQSO'#EhO1_QSO'#EhO3aQ(CjO'#JcO6QQ(CjO'#JdO6nQSO'#FWO6sQ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z|},ZR0q+qR,P&XQ%szR+c%tR+X%nT&b!U&eT&c!U&eT1d,b1e",nodeNames:"⚠ ArithOp ArithOp LineComment BlockComment Script ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXStartTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:364,context:xf,nodeProps:[["group",-26,6,14,16,62,199,203,206,207,209,212,215,225,227,233,235,237,239,242,248,254,256,258,260,262,264,265,"Statement",-32,10,11,25,28,29,35,45,48,49,51,56,64,72,76,78,80,81,103,104,113,114,131,134,136,137,138,139,141,142,162,163,165,"Expression",-23,24,26,30,34,36,38,166,168,170,171,173,174,175,177,178,179,181,182,183,193,195,197,198,"Type",-3,84,96,102,"ClassItem"],["openedBy",31,"InterpolationStart",50,"[",54,"{",69,"(",143,"JSXStartTag",155,"JSXStartTag JSXStartCloseTag"],["closedBy",33,"InterpolationEnd",44,"]",55,"}",70,")",144,"JSXSelfCloseEndTag JSXEndTag",160,"JSXEndTag"]],propSources:[Pf],skippedNodes:[0,3,4,268],repeatNodeCount:33,tokenData:"$>y(CSR!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tu>PuvBavwDxwxGgxyMvyz! Qz{!![{|!%O|}!&]}!O!%O!O!P!'g!P!Q!1w!Q!R#0t!R![#3T![!]#@T!]!^#Aa!^!_#Bk!_!`#GS!`!a#In!a!b#N{!b!c$$z!c!}>P!}#O$&U#O#P$'`#P#Q$,w#Q#R$.R#R#S>P#S#T$/`#T#o$0j#o#p$4z#p#q$5p#q#r$7Q#r#s$8^#s$f%Z$f$g+g$g#BY>P#BY#BZ$9h#BZ$IS>P$IS$I_$9h$I_$I|>P$I|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#p*g#p$f%Z$f$g+g$g#BY>P#BY#BZ$9h#BZ$IS>P$IS$I_$9h$I_$JT>P$JT$JU$9h$JU$KV>P$KV$KW$9h$KW&FU>P&FU&FV$9h&FV;'S>P;'S;=`BZ<%l?HT>P?HT?HU$9h?HUO>P(CS$=Uk$d&j'wp'z!b'n(;d(U!LY't&;d$W#tOY%ZYZ&cZr%Zrs&}st%Ztu>Puw%Zwx(rx}%Z}!O@T!O!Q%Z!Q![>P![!^%Z!^!_*g!_!c%Z!c!}>P!}#O%Z#O#P&c#P#R%Z#R#S>P#S#T%Z#T#o>P#o#p*g#p$g%Z$g;'S>P;'S;=`BZ<%lO>P",tokenizers:[Qf,$f,2,3,4,5,6,7,8,9,10,11,12,13,kf,new ef("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOq~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!O~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(T~~",141,326),new ef("j~RQYZXz{^~^O'q~~aP!P!Qd~iO'r~~",25,308)],topRules:{Script:[0,5],SingleExpression:[1,266],SingleClassItem:[2,267]},dialects:{jsx:12686,ts:12688},dynamicPrecedences:{76:1,78:1,163:1,191:1},specialized:[{term:312,get:t=>Cf[t]||-1},{term:328,get:t=>_f[t]||-1},{term:67,get:t=>Xf[t]||-1}],tokenPrec:12712}),Af=[Dd("function ${name}(${params}) {\n\t${}\n}",{label:"function",detail:"definition",type:"keyword"}),Dd("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n\t${}\n}",{label:"for",detail:"loop",type:"keyword"}),Dd("for (let ${name} of ${collection}) {\n\t${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Dd("do {\n\t${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),Dd("while (${}) {\n\t${}\n}",{label:"while",detail:"loop",type:"keyword"}),Dd("try {\n\t${}\n} catch (${error}) {\n\t${}\n}",{label:"try",detail:"/ catch block",type:"keyword"}),Dd("if (${}) {\n\t${}\n}",{label:"if",detail:"block",type:"keyword"}),Dd("if (${}) {\n\t${}\n} else {\n\t${}\n}",{label:"if",detail:"/ else block",type:"keyword"}),Dd("class ${name} {\n\tconstructor(${params}) {\n\t\t${}\n\t}\n}",{label:"class",detail:"definition",type:"keyword"}),Dd('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Dd('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Tf=new Ro,Rf=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Ef(t){return(e,i)=>{let n=e.node.getChild("VariableDefinition");return n&&i(n,t),!0}}const Vf=["FunctionDeclaration"],Mf={FunctionDeclaration:Ef("function"),ClassDeclaration:Ef("class"),ClassExpression:()=>!0,EnumDeclaration:Ef("constant"),TypeAliasDeclaration:Ef("type"),NamespaceDeclaration:Ef("namespace"),VariableDefinition(t,e){t.matchContext(Vf)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function Df(t,e){let i=Tf.get(e);if(i)return i;let n=[],s=!0;function r(e,i){let s=t.sliceString(e.from,e.to);n.push({label:s,type:i})}return e.cursor(mo.IncludeAnonymous).iterate((e=>{if(s)s=!1;else if(e.name){let t=Mf[e.name];if(t&&t(e,r)||Rf.has(e.name))return!1}else if(e.to-e.from>8192){for(let i of Df(t,e.node))n.push(i);return!1}})),Tf.set(e,n),n}const Wf=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Uf=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName"];function Yf(t){let e=Xa(t.state).resolveInner(t.pos,-1);if(Uf.indexOf(e.name)>-1)return null;let i="VariableName"==e.name||e.to-e.from<20&&Wf.test(t.state.sliceDoc(e.from,e.to));if(!i&&!t.explicit)return null;let n=[];for(let i=e;i;i=i.parent)Rf.has(i.name)&&(n=n.concat(Df(t.state.doc,i)));return{options:n,from:i?e.from:t.pos,validFor:Wf}}const qf=_a.define({name:"javascript",parser:Zf.configure({props:[Na.add({IfStatement:il({except:/^\s*({|else\b)/}),TryStatement:il({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:t=>t.baseIndent,SwitchBody:t=>{let e=t.textAfter,i=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return t.baseIndent+(i?0:n?1:2)*t.unit},Block:tl({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":il({except:/^{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag":t=>t.column(t.node.from)+t.unit}),rl.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression":ol,BlockComment:t=>({from:t.from+2,to:t.to-2})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Lf={test:t=>/^JSX/.test(t.name),facet:Qa({commentTokens:{block:{open:"{/*",close:"*/}"}}})},zf=qf.configure({dialect:"ts"},"typescript"),If=qf.configure({dialect:"jsx",props:[$a.add((t=>t.isTop?[Lf]:void 0))]}),Bf=qf.configure({dialect:"jsx ts",props:[$a.add((t=>t.isTop?[Lf]:void 0))]},"typescript"),jf="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map((t=>({label:t,type:"keyword"})));function Nf(t={}){let e=t.jsx?t.typescript?Bf:If:t.typescript?zf:qf;return new Ua(e,[qf.data.of({autocomplete:(i=Uf,n=zu(Af.concat(jf)),t=>{for(let e=Xa(t.state).resolveInner(t.pos,-1);e;e=e.parent){if(i.indexOf(e.name)>-1)return null;if(e.type.isTop)break}return n(t)})}),qf.data.of({autocomplete:Yf}),t.jsx?Hf:[]]);var i,n}function Gf(t,e,i=t.length){for(let n=null==e?void 0:e.firstChild;n;n=n.nextSibling)if("JSXIdentifier"==n.name||"JSXBuiltin"==n.name||"JSXNamespacedName"==n.name||"JSXMemberExpression"==n.name)return t.sliceString(n.from,Math.min(n.to,i));return""}const Ff="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),Hf=Ts.inputHandler.of(((t,e,i,n)=>{if((Ff?t.composing:t.compositionStarted)||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!qf.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((t=>{var e,i;let r,{head:o}=t,a=Xa(s).resolveInner(o,-1);if("JSXStartTag"==a.name&&(a=a.parent),">"==n&&"JSXFragmentTag"==a.name)return{range:A.cursor(o+1),changes:{from:o,insert:">"}};if("/"==n&&"JSXFragmentTag"==a.name){let t=a.parent,i=null==t?void 0:t.parent;if(t.from==o-1&&"JSXEndTag"!=(null===(e=i.lastChild)||void 0===e?void 0:e.name)&&(r=Gf(s.doc,null==i?void 0:i.firstChild,o))){let t=`/${r}>`;return{range:A.cursor(o+t.length),changes:{from:o,insert:t}}}}else if(">"==n){let t=function(t){for(;;){if("JSXOpenTag"==t.name||"JSXSelfClosingTag"==t.name||"JSXFragmentTag"==t.name)return t;if(!t.parent)return null;t=t.parent}}(a);if(t&&"JSXEndTag"!=(null===(i=t.lastChild)||void 0===i?void 0:i.name)&&"`}}}return{range:t}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)}));class Jf{constructor(t,e,i,n,s,r,o){this.type=t,this.value=e,this.from=i,this.hash=n,this.end=s,this.children=r,this.positions=o,this.hashProp=[[ho.contextHash,n]]}static create(t,e,i,n,s){return new Jf(t,e,i,n+(n<<8)+t+(e<<4)|0,s,[],[])}addChild(t,e){t.prop(ho.contextHash)!=this.hash&&(t=new bo(t.type,t.children,t.positions,t.length,this.hashProp)),this.children.push(t),this.positions.push(e)}toTree(t,e=this.end){let i=this.children.length-1;return i>=0&&(e=Math.max(e,this.positions[i]+this.children[i].length+this.from)),new bo(t.types[this.type],this.children,this.positions,e-this.from).balance({makeTree:(t,e,i)=>new bo(fo.none,t,e,i,this.hashProp)})}}var Kf;!function(t){t[t.Document=1]="Document",t[t.CodeBlock=2]="CodeBlock",t[t.FencedCode=3]="FencedCode",t[t.Blockquote=4]="Blockquote",t[t.HorizontalRule=5]="HorizontalRule",t[t.BulletList=6]="BulletList",t[t.OrderedList=7]="OrderedList",t[t.ListItem=8]="ListItem",t[t.ATXHeading1=9]="ATXHeading1",t[t.ATXHeading2=10]="ATXHeading2",t[t.ATXHeading3=11]="ATXHeading3",t[t.ATXHeading4=12]="ATXHeading4",t[t.ATXHeading5=13]="ATXHeading5",t[t.ATXHeading6=14]="ATXHeading6",t[t.SetextHeading1=15]="SetextHeading1",t[t.SetextHeading2=16]="SetextHeading2",t[t.HTMLBlock=17]="HTMLBlock",t[t.LinkReference=18]="LinkReference",t[t.Paragraph=19]="Paragraph",t[t.CommentBlock=20]="CommentBlock",t[t.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",t[t.Escape=22]="Escape",t[t.Entity=23]="Entity",t[t.HardBreak=24]="HardBreak",t[t.Emphasis=25]="Emphasis",t[t.StrongEmphasis=26]="StrongEmphasis",t[t.Link=27]="Link",t[t.Image=28]="Image",t[t.InlineCode=29]="InlineCode",t[t.HTMLTag=30]="HTMLTag",t[t.Comment=31]="Comment",t[t.ProcessingInstruction=32]="ProcessingInstruction",t[t.URL=33]="URL",t[t.HeaderMark=34]="HeaderMark",t[t.QuoteMark=35]="QuoteMark",t[t.ListMark=36]="ListMark",t[t.LinkMark=37]="LinkMark",t[t.EmphasisMark=38]="EmphasisMark",t[t.CodeMark=39]="CodeMark",t[t.CodeText=40]="CodeText",t[t.CodeInfo=41]="CodeInfo",t[t.LinkTitle=42]="LinkTitle",t[t.LinkLabel=43]="LinkLabel"}(Kf||(Kf={}));class tp{constructor(t,e){this.start=t,this.content=e,this.marks=[],this.parsers=[]}}class ep{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let t=this.skipSpace(this.basePos);this.indent=this.countIndent(t,this.pos,this.indent),this.pos=t,this.next=t==this.text.length?-1:this.text.charCodeAt(t)}skipSpace(t){return rp(this.text,t)}reset(t){for(this.text=t,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(t){this.basePos=t,this.baseIndent=this.countIndent(t,this.pos,this.indent)}moveBaseColumn(t){this.baseIndent=t,this.basePos=this.findColumn(t)}addMarker(t){this.markers.push(t)}countIndent(t,e=0,i=0){for(let n=e;n=e.stack[i.depth+1].value+i.baseIndent)return!0;if(i.indent>=i.baseIndent+4)return!1;let n=(t.type==Kf.OrderedList?dp:up)(i,e,!1);return n>0&&(t.type!=Kf.BulletList||hp(i,e,!1)<0)&&i.text.charCodeAt(i.pos+n-1)==t.value}const np={[Kf.Blockquote]:(t,e,i)=>62==i.next&&(i.markers.push(Up(Kf.QuoteMark,e.lineStart+i.pos,e.lineStart+i.pos+1)),i.moveBase(i.pos+(sp(i.text.charCodeAt(i.pos+1))?2:1)),t.end=e.lineStart+i.text.length,!0),[Kf.ListItem]:(t,e,i)=>!(i.indent-1)&&(i.moveBaseColumn(i.baseIndent+t.value),!0),[Kf.OrderedList]:ip,[Kf.BulletList]:ip,[Kf.Document]:()=>!0};function sp(t){return 32==t||9==t||10==t||13==t}function rp(t,e=0){for(;ei&&sp(t.charCodeAt(e-1));)e--;return e}function ap(t){if(96!=t.next&&126!=t.next)return-1;let e=t.pos+1;for(;e-1&&t.depth==e.stack.length||n<3?-1:1}function cp(t,e){for(let i=t.stack.length-1;i>=0;i--)if(t.stack[i].type==e)return!0;return!1}function up(t,e,i){return 45!=t.next&&43!=t.next&&42!=t.next||t.pos!=t.text.length-1&&!sp(t.text.charCodeAt(t.pos+1))||!(!i||cp(e,Kf.BulletList)||t.skipSpace(t.pos+2)=48&&s<=57;){if(n++,n==t.text.length)return-1;s=t.text.charCodeAt(n)}return n==t.pos||n>t.pos+9||46!=s&&41!=s||nt.pos+1||49!=t.next)?-1:n+1-t.pos}function fp(t){if(35!=t.next)return-1;let e=t.pos+1;for(;e6?-1:i}function pp(t){if(45!=t.next&&61!=t.next||t.indent>=t.baseIndent+4)return-1;let e=t.pos+1;for(;e/,mp=/\?>/,bp=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*/i.exec(n);if(r)return t.append(Up(Kf.Comment,i,i+1+r[0].length));let o=/^\?[^]*?\?>/.exec(n);if(o)return t.append(Up(Kf.ProcessingInstruction,i,i+1+o[0].length));let a=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(n);return a?t.append(Up(Kf.HTMLTag,i,i+1+a[0].length)):-1},Emphasis(t,e,i){if(95!=e&&42!=e)return-1;let n=i+1;for(;t.char(n)==e;)n++;let s=t.slice(i-1,i),r=t.slice(n,n+1),o=jp.test(s),a=jp.test(r),l=/\s|^$/.test(s),h=/\s|^$/.test(r),c=!h&&(!a||l||o),u=!l&&(!o||h||a),d=c&&(42==e||!u||o),f=u&&(42==e||!c||a);return t.append(new Ip(95==e?Yp:qp,i,n,(d?1:0)|(f?2:0)))},HardBreak(t,e,i){if(92==e&&10==t.char(i+1))return t.append(Up(Kf.HardBreak,i,i+2));if(32==e){let e=i+1;for(;32==t.char(e);)e++;if(10==t.char(e)&&e>=i+2)return t.append(Up(Kf.HardBreak,i,e+1))}return-1},Link:(t,e,i)=>91==e?t.append(new Ip(Lp,i,i+1,1)):-1,Image:(t,e,i)=>33==e&&91==t.char(i+1)?t.append(new Ip(zp,i,i+2,1)):-1,LinkEnd(t,e,i){if(93!=e)return-1;for(let e=t.parts.length-1;e>=0;e--){let n=t.parts[e];if(n instanceof Ip&&(n.type==Lp||n.type==zp)){if(!n.side||t.skipSpace(n.to)==i&&!/[(\[]/.test(t.slice(i+1,i+2)))return t.parts[e]=null,-1;let s=t.takeContent(e),r=t.parts[e]=Gp(t,s,n.type==Lp?Kf.Link:Kf.Image,n.from,i+1);if(n.type==Lp)for(let i=0;ie?Up(Kf.URL,e+i,s+i):s==t.length&&null}}function Hp(t,e,i){let n=t.charCodeAt(e);if(39!=n&&34!=n&&40!=n)return!1;let s=40==n?41:n;for(let n=e+1,r=!1;n=this.end?-1:this.text.charCodeAt(t-this.offset)}get end(){return this.offset+this.text.length}slice(t,e){return this.text.slice(t-this.offset,e-this.offset)}append(t){return this.parts.push(t),t.to}addDelimiter(t,e,i,n,s){return this.append(new Ip(t,e,i,(n?1:0)|(s?2:0)))}addElement(t){return this.append(t)}resolveMarkers(t){for(let e=t;e=t;o--){let t=this.parts[o];if(t instanceof Ip&&1&t.side&&t.type==i.type&&!(s&&(1&i.side||2&t.side)&&(t.to-t.from+r)%3==0&&((t.to-t.from)%3||r%3))){n=t;break}}if(!n)continue;let a=i.type.resolve,l=[],h=n.from,c=i.to;if(s){let t=Math.min(2,n.to-n.from,r);h=n.to-t,c=i.from+t,a=1==t?"Emphasis":"StrongEmphasis"}n.type.mark&&l.push(this.elt(n.type.mark,h,n.to));for(let t=o+1;t=0;e--){let i=this.parts[e];if(i instanceof Ip&&i.type==t)return e}return null}takeContent(t){let e=this.resolveMarkers(t);return this.parts.length=t,e}skipSpace(t){return rp(this.text,t-this.offset)+this.offset}elt(t,e,i,n){return"string"==typeof t?Up(this.parser.getNodeType(t),e,i,n):new Wp(t,e)}}function tO(t,e){if(!e.length)return t;if(!t.length)return e;let i=t.slice(),n=0;for(let t of e){for(;n(t?t-1:0))return!1;if(this.fragmentEnd<0){let t=this.fragment.to;for(;t>0&&"\n"!=this.input.read(t-1,t);)t--;this.fragmentEnd=t?t-1:0}let i=this.cursor;i||(i=this.cursor=this.fragment.tree.cursor(),i.firstChild());let n=t+this.fragment.offset;for(;i.to<=n;)if(!i.parent())return!1;for(;;){if(i.from>=n)return this.fragment.from<=e;if(!i.childAfter(n))return!1}}matches(t){let e=this.cursor.tree;return e&&e.prop(ho.contextHash)==t}takeNodes(t){let e=this.cursor,i=this.fragment.offset,n=this.fragmentEnd-(this.fragment.openEnd?1:0),s=t.absoluteLineStart,r=s,o=t.block.children.length,a=r,l=o;for(;;){if(e.to-i>n){if(e.type.isAnonymous&&e.firstChild())continue;break}if(t.dontInject.add(e.tree),t.addNode(e.tree,e.from-i),e.type.is("Block")&&(eO.indexOf(e.type.id)<0?(r=e.to-i,o=t.block.children.length):(r=a,o=l,a=e.to-i,l=t.block.children.length)),!e.nextSibling())break}for(;t.block.children.length>o;)t.block.children.pop(),t.block.positions.pop();return r-s}}const nO=ea({"Blockquote/...":Sa.quote,HorizontalRule:Sa.contentSeparator,"ATXHeading1/... SetextHeading1/...":Sa.heading1,"ATXHeading2/... SetextHeading2/...":Sa.heading2,"ATXHeading3/...":Sa.heading3,"ATXHeading4/...":Sa.heading4,"ATXHeading5/...":Sa.heading5,"ATXHeading6/...":Sa.heading6,"Comment CommentBlock":Sa.comment,Escape:Sa.escape,Entity:Sa.character,"Emphasis/...":Sa.emphasis,"StrongEmphasis/...":Sa.strong,"Link/... Image/...":Sa.link,"OrderedList/... BulletList/...":Sa.list,"BlockQuote/...":Sa.quote,"InlineCode CodeText":Sa.monospace,URL:Sa.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":Sa.processingInstruction,"CodeInfo LinkLabel":Sa.labelName,LinkTitle:Sa.string,Paragraph:Sa.content}),sO=new Zp(new po(Ep).extend(nO),Object.keys(Sp).map((t=>Sp[t])),Object.keys(Sp).map((t=>$p[t])),Object.keys(Sp),Pp,np,Object.keys(Np).map((t=>Np[t])),Object.keys(Np),[]);function rO(t,e,i){let n=[];for(let s=t.firstChild,r=e;;s=s.nextSibling){let t=s?s.from:i;if(t>r&&n.push({from:r,to:t}),!s)break;r=s.to}return n}const oO={resolve:"Strikethrough",mark:"StrikethroughMark"},aO={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":Sa.strikethrough}},{name:"StrikethroughMark",style:Sa.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,i){if(126!=e||126!=t.char(i+1)||126==t.char(i+2))return-1;let n=t.slice(i-1,i),s=t.slice(i+2,i+3),r=/\s|^$/.test(n),o=/\s|^$/.test(s),a=jp.test(n),l=jp.test(s);return t.addDelimiter(oO,i,i+2,!o&&(!l||r||a),!r&&(!a||o||l))},after:"Emphasis"}]};function lO(t,e,i=0,n,s=0){let r=0,o=!0,a=-1,l=-1,h=!1,c=()=>{n.push(t.elt("TableCell",s+a,s+l,t.parser.parseInline(e.slice(a,l),s+a)))};for(let u=i;u-1)&&r++,o=!1,n&&(a>-1&&c(),n.push(t.elt("TableDelimiter",u+s,u+s+1))),a=l=-1),h=!h&&92==i}return a>-1&&(r++,n&&c()),r}function hO(t,e){for(let i=e;ihO(e.content,0)?new uO:null,endLeaf(t,e,i){if(i.parsers.some((t=>t instanceof uO))||!hO(e.text,e.basePos))return!1;let n=t.scanLine(t.absoluteLineEnd+1).text;return cO.test(n)&&lO(t,e.text,e.basePos)==lO(t,n,e.basePos)},before:"SetextHeading"}]};class fO{nextLine(){return!1}finish(t,e){return t.addLeafElement(e,t.elt("Task",e.start,e.start+e.content.length,[t.elt("TaskMarker",e.start,e.start+3),...t.parser.parseInline(e.content.slice(3),e.start+3)])),!0}}const pO=[dO,{defineNodes:[{name:"Task",block:!0,style:Sa.list},{name:"TaskMarker",style:Sa.atom}],parseBlock:[{name:"TaskList",leaf:(t,e)=>/^\[[ xX]\]/.test(e.content)&&"ListItem"==t.parentType().name?new fO:null,after:"SetextHeading"}]},aO];function OO(t,e,i){return(n,s,r)=>{if(s!=t||n.char(r+1)==t)return-1;let o=[n.elt(i,r,r+1)];for(let s=r+1;s=65&&r<=90||95==r||r>=97&&r<=122||r>=161;)s+=String.fromCharCode(n),n=t.peek(++e);var r;return RO=t,EO=i,TO=s?s.toLowerCase():n==MO||n==DO?void 0:null}const MO=63,DO=33;function WO(t,e){this.name=t,this.parent=e,this.hash=e?e.hash:0;for(let e=0;eUO.indexOf(e)>-1?new WO(VO(n,1)||"",t):t,reduce:(t,e)=>e==wO&&t?t.parent:t,reuse(t,e,i,n){let s=e.type.id;return 6==s||36==s?new WO(VO(n,1)||"",t):t},hash:t=>t?t.hash:0,strict:!1}),qO=new nf(((t,e)=>{if(60!=t.next)return void(t.next<0&&e.context&&t.acceptToken(57));t.advance();let i=47==t.next;i&&t.advance();let n=VO(t,0);if(void 0===n)return;if(!n)return t.acceptToken(i?14:6);let s=e.context?e.context.name:null;if(i){if(n==s)return t.acceptToken(11);if(s&&XO[s])return t.acceptToken(57,-2);if(e.dialectEnabled(0))return t.acceptToken(12);for(let t=e.context;t;t=t.parent)if(t.name==n)return;t.acceptToken(13)}else{if("script"==n)return t.acceptToken(7);if("style"==n)return t.acceptToken(8);if("textarea"==n)return t.acceptToken(9);if(_O.hasOwnProperty(n))return t.acceptToken(10);s&&ZO[s]&&ZO[s][n]?t.acceptToken(57,-1):t.acceptToken(6)}}),{contextual:!0}),LO=new nf((t=>{for(let e=0,i=0;;i++){if(t.next<0){i&&t.acceptToken(58);break}if(45==t.next)e++;else{if(62==t.next&&e>=2){i>3&&t.acceptToken(58,-2);break}e=0}t.advance()}}));const zO=new nf(((t,e)=>{if(47==t.next&&62==t.peek(1)){let i=e.dialectEnabled(1)||function(t){for(;t;t=t.parent)if("svg"==t.name||"math"==t.name)return!0;return!1}(e.context);t.acceptToken(i?5:4,2)}else 62==t.next&&t.acceptToken(4,1)}));function IO(t,e,i){let n=2+t.length;return new nf((s=>{for(let r=0,o=0,a=0;;a++){if(s.next<0){a&&s.acceptToken(e);break}if(0==r&&60==s.next||1==r&&47==s.next||r>=2&&ro?s.acceptToken(e,-o):s.acceptToken(i,-(o-2));break}if((10==s.next||13==s.next)&&a){s.acceptToken(e,1);break}r=o=0}else o++;s.advance()}}))}const BO=IO("script",54,1),jO=IO("style",55,2),NO=IO("textarea",56,3),GO=ea({"Text RawText":Sa.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":Sa.angleBracket,TagName:Sa.tagName,"MismatchedCloseTag/TagName":[Sa.tagName,Sa.invalid],AttributeName:Sa.attributeName,"AttributeValue UnquotedAttributeValue":Sa.attributeValue,Is:Sa.definitionOperator,"EntityReference CharacterReference":Sa.character,Comment:Sa.blockComment,ProcessingInst:Sa.processingInstruction,DoctypeDecl:Sa.documentMeta}),FO=wf.deserialize({version:14,states:",xOVO!rOOO!WQ#tO'#CqO!]Q#tO'#CzO!bQ#tO'#C}O!gQ#tO'#DQO!lQ#tO'#DSO!qOaO'#CpO!|ObO'#CpO#XOdO'#CpO$eO!rO'#CpOOO`'#Cp'#CpO$lO$fO'#DTO$tQ#tO'#DVO$yQ#tO'#DWOOO`'#Dk'#DkOOO`'#DY'#DYQVO!rOOO%OQ&rO,59]O%WQ&rO,59fO%`Q&rO,59iO%hQ&rO,59lO%sQ&rO,59nOOOa'#D^'#D^O%{OaO'#CxO&WOaO,59[OOOb'#D_'#D_O&`ObO'#C{O&kObO,59[OOOd'#D`'#D`O&sOdO'#DOO'OOdO,59[OOO`'#Da'#DaO'WO!rO,59[O'_Q#tO'#DROOO`,59[,59[OOOp'#Db'#DbO'dO$fO,59oOOO`,59o,59oO'lQ#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gOhyO~OS!hOhyO~OS!iOT!jOhyO~OS!jOhyO~Of!kO~Of!lO~Of!mO~OS!nO~Ok!qO!`!oO!b!pO~OS!rO~OS!sO~OS!tO~Oa!uOb!uOc!uO!`!wO!a!uO~Oa!xOb!xOc!xO!b!wO!c!xO~Oa!uOb!uOc!uO!`!{O!a!uO~Oa!xOb!xOc!xO!b!{O!c!xO~OT~bac!dx{!d~",goto:"%p!`PPPPPPPPPPPPPPPPPPPP!a!gP!mPP!yP!|#P#S#Y#]#`#f#i#l#r#x!aP!a!aP$O$U$l$r$x%O%U%[%bPPPPPPPP%hX^OX`pXUOX`pezabcde{}!P!R!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ}bQ!PcQ!RdQ!UeZ!e{}!P!R!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:67,context:YO,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,21,30,33,36,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,29,32,35,37,"OpenTag"],["group",-9,14,17,18,19,20,39,40,41,42,"Entity",16,"Entity TextContent",-3,28,31,34,"TextContent Entity"]],propSources:[GO],skippedNodes:[0],repeatNodeCount:9,tokenData:"#%g!aR!YOX$qXY,QYZ,QZ[$q[]&X]^,Q^p$qpq,Qq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ncrs!Hpsw!Ncwx!Hpx!P!Nc!P!Q!Hp!Q!_!Nc!_!`!Hp!`!a!If!a#s!Nc#s$f!Hp$f;'S!Nc;'S;=`#!}<%l?Ah!Nc?Ah?BY!Hp?BY?Mn!Nc?MnO!HpT##QP;=`<%l!Nc!V##^chS!a`!cpOq!G_qr!Eyrs!HUsv!Eyvw!Ncwx!Jvx!P!Ey!P!Q!G_!Q!_!Ey!_!`!G_!`!a!Mm!a#s!Ey#s$f!G_$f;'S!Ey;'S;=`#$i<%l?Ah!Ey?Ah?BY!G_?BY?Mn!Ey?MnO!G_!V#$lP;=`<%l!Ey!V#$zXiS`P!a`!cpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X",tokenizers:[BO,jO,NO,zO,qO,LO,0,1,2,3,4,5],topRules:{Document:[0,15]},dialects:{noMatch:0,selfClosing:485},tokenPrec:487});function HO(t,e){let i=Object.create(null);for(let n of t.getChildren(yO)){let t=n.getChild(SO),s=n.getChild(xO)||n.getChild(kO);t&&(i[e.read(t.from,t.to)]=s?s.type.id==xO?e.read(s.from+1,s.to-1):e.read(s.from,s.to):"")}return i}function JO(t,e){let i=t.getChild(vO);return i?e.read(i.from,i.to):" "}function KO(t,e,i){let n;for(let s of i)if(!s.attrs||s.attrs(n||(n=HO(t.node.parent.firstChild,e))))return{parser:s.parser};return null}function tg(t=[],e=[]){let i=[],n=[],s=[],r=[];for(let e of t){("script"==e.tag?i:"style"==e.tag?n:"textarea"==e.tag?s:r).push(e)}let o=e.length?Object.create(null):null;for(let t of e)(o[t.name]||(o[t.name]=[])).push(t);return Do(((t,e)=>{let a=t.type.id;if(a==QO)return KO(t,e,i);if(a==$O)return KO(t,e,n);if(a==PO)return KO(t,e,s);if(a==wO&&r.length){let i,n=t.node,s=n.firstChild,o=s&&JO(s,e);if(o)for(let t of r)if(t.tag==o&&(!t.attrs||t.attrs(i||(i=HO(n,e))))){let e=n.lastChild;return{parser:t.parser,overlay:[{from:s.to,to:e.type.id==CO?e.from:n.to}]}}}if(o&&a==yO){let i,n=t.node;if(i=n.firstChild){let t=o[e.read(i.from,i.to)];if(t)for(let i of t){if(i.tagName&&i.tagName!=JO(n.parent,e))continue;let t=n.lastChild;if(t.type.id==xO){let e=t.from+1,n=t.lastChild,s=t.to-(n&&n.isError?0:1);if(s>e)return{parser:i.parser,overlay:[{from:e,to:s}]}}else if(t.type.id==kO)return{parser:i.parser,overlay:[{from:t.from,to:t.to}]}}}}return null}))}const eg=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288];function ig(t){return t>=65&&t<=90||t>=97&&t<=122||t>=161}const ng=new nf(((t,e)=>{for(let n=!1,s=0,r=0;;r++){let{next:o}=t;if(!(ig(o)||45==o||95==o||n&&(i=o,i>=48&&i<=57))){n&&t.acceptToken(40==o?95:2==s&&e.canShift(2)?2:96);break}!n&&(45!=o||r>0)&&(n=!0),s===r&&45==o&&s++,t.advance()}var i})),sg=new nf((t=>{if(eg.includes(t.peek(-1))){let{next:e}=t;(ig(e)||95==e||35==e||46==e||91==e||58==e||45==e)&&t.acceptToken(94)}})),rg=new nf((t=>{if(!eg.includes(t.peek(-1))){let{next:e}=t;if(37==e&&(t.advance(),t.acceptToken(1)),ig(e)){do{t.advance()}while(ig(t.next));t.acceptToken(1)}}})),og=ea({"AtKeyword import charset namespace keyframes media supports":Sa.definitionKeyword,"from to selector":Sa.keyword,NamespaceName:Sa.namespace,KeyframeName:Sa.labelName,TagName:Sa.tagName,ClassName:Sa.className,PseudoClassName:Sa.constant(Sa.className),IdName:Sa.labelName,"FeatureName PropertyName":Sa.propertyName,AttributeName:Sa.attributeName,NumberLiteral:Sa.number,KeywordQuery:Sa.keyword,UnaryQueryOp:Sa.operatorKeyword,"CallTag ValueName":Sa.atom,VariableName:Sa.variableName,Callee:Sa.operatorKeyword,Unit:Sa.unit,"UniversalSelector NestingSelector":Sa.definitionOperator,MatchOp:Sa.compareOperator,"ChildOp SiblingOp, LogicOp":Sa.logicOperator,BinOp:Sa.arithmeticOperator,Important:Sa.modifier,Comment:Sa.blockComment,ParenthesizedContent:Sa.special(Sa.name),ColorLiteral:Sa.color,StringLiteral:Sa.string,":":Sa.punctuation,"PseudoOp #":Sa.derefOperator,"; ,":Sa.separator,"( )":Sa.paren,"[ ]":Sa.squareBracket,"{ }":Sa.brace}),ag={__proto__:null,lang:32,"nth-child":32,"nth-last-child":32,"nth-of-type":32,"nth-last-of-type":32,dir:32,"host-context":32,url:60,"url-prefix":60,domain:60,regexp:60,selector:134},lg={__proto__:null,"@import":114,"@media":138,"@charset":142,"@namespace":146,"@keyframes":152,"@supports":164},hg={__proto__:null,not:128,only:128,from:158,to:160},cg=wf.deserialize({version:14,states:"7WQYQ[OOO#_Q[OOOOQP'#Cd'#CdOOQP'#Cc'#CcO#fQ[O'#CfO$YQXO'#CaO$aQ[O'#ChO$lQ[O'#DPO$qQ[O'#DTOOQP'#Ed'#EdO$vQdO'#DeO%bQ[O'#DrO$vQdO'#DtO%sQ[O'#DvO&OQ[O'#DyO&TQ[O'#EPO&cQ[O'#EROOQS'#Ec'#EcOOQS'#ET'#ETQYQ[OOO&jQXO'#CdO'_QWO'#DaO'dQWO'#EjO'oQ[O'#EjQOQWOOOOQP'#Cg'#CgOOQP,59Q,59QO#fQ[O,59QO'yQ[O'#EWO(eQWO,58{O(mQ[O,59SO$lQ[O,59kO$qQ[O,59oO'yQ[O,59sO'yQ[O,59uO'yQ[O,59vO(xQ[O'#D`OOQS,58{,58{OOQP'#Ck'#CkOOQO'#C}'#C}OOQP,59S,59SO)PQWO,59SO)UQWO,59SOOQP'#DR'#DROOQP,59k,59kOOQO'#DV'#DVO)ZQ`O,59oOOQS'#Cp'#CpO$vQdO'#CqO)cQvO'#CsO*pQtO,5:POOQO'#Cx'#CxO)UQWO'#CwO+UQWO'#CyOOQS'#Eg'#EgOOQO'#Dh'#DhO+ZQ[O'#DoO+iQWO'#Ek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%^^I[SvUOy%^z;'S%^;'S;=`%o<%lO%^XIkUOy%^z#b%^#b#cI}#c;'S%^;'S;=`%o<%lO%^XJSUoWOy%^z#W%^#W#XJf#X;'S%^;'S;=`%o<%lO%^XJmS!`PoWOy%^z;'S%^;'S;=`%o<%lO%^XJ|UOy%^z#f%^#f#gJf#g;'S%^;'S;=`%o<%lO%^XKeS!RPOy%^z;'S%^;'S;=`%o<%lO%^_KvS!QVOy%^z;'S%^;'S;=`%o<%lO%^ZLXU!PPOy%^z!_%^!_!`6y!`;'S%^;'S;=`%o<%lO%^WLnP;=`<%l$}",tokenizers:[sg,rg,ng,0,1,2,3],topRules:{StyleSheet:[0,4],Styles:[1,84]},specialized:[{term:95,get:t=>ag[t]||-1},{term:56,get:t=>lg[t]||-1},{term:96,get:t=>hg[t]||-1}],tokenPrec:1123});let ug=null;function dg(){if(!ug&&"object"==typeof document&&document.body){let{style:t}=document.body,e=[],i=new Set;for(let n in t)"cssText"!=n&&"cssFloat"!=n&&"string"==typeof t[n]&&(/[A-Z]/.test(n)&&(n=n.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))),i.has(n)||(e.push(n),i.add(n)));ug=e.sort().map((t=>({type:"property",label:t})))}return ug||[]}const fg=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map((t=>({type:"class",label:t}))),pg=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map((t=>({type:"keyword",label:t}))).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map((t=>({type:"constant",label:t})))),Og=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map((t=>({type:"type",label:t}))),gg=/^(\w[\w-]*|-\w[\w-]*|)$/,mg=/^-(-[\w-]*)?$/;const bg=new Ro,wg=["Declaration"];function vg(t){for(let e=t;;){if(e.type.isTop)return e;if(!(e=e.parent))return t}}function yg(t,e,i){if(e.to-e.from>4096){let n=bg.get(e);if(n)return n;let s=[],r=new Set,o=e.cursor(mo.IncludeAnonymous);if(o.firstChild())do{for(let e of yg(t,o.node,i))r.has(e.label)||(r.add(e.label),s.push(e))}while(o.nextSibling());return bg.set(e,s),s}{let n=[],s=new Set;return e.cursor().iterate((e=>{var r;if(i(e)&&e.matchContext(wg)&&":"==(null===(r=e.node.nextSibling)||void 0===r?void 0:r.name)){let i=t.sliceString(e.from,e.to);s.has(i)||(s.add(i),n.push({label:i,type:"variable"}))}})),n}}const Sg=t=>e=>{let{state:i,pos:n}=e,s=Xa(i).resolveInner(n,-1),r=s.type.isError&&s.from==s.to-1&&"-"==i.doc.sliceString(s.from,s.to);if("PropertyName"==s.name||(r||"TagName"==s.name)&&/^(Block|Styles)$/.test(s.resolve(s.to).name))return{from:s.from,options:dg(),validFor:gg};if("ValueName"==s.name)return{from:s.from,options:pg,validFor:gg};if("PseudoClassName"==s.name)return{from:s.from,options:fg,validFor:gg};if(t(s)||(e.explicit||r)&&function(t,e){var i;if(("("==t.name||t.type.isError)&&(t=t.parent||t),"ArgList"!=t.name)return!1;let n=null===(i=t.parent)||void 0===i?void 0:i.firstChild;return"Callee"==(null==n?void 0:n.name)&&"var"==e.sliceString(n.from,n.to)}(s,i.doc))return{from:t(s)||r?s.from:n,options:yg(i.doc,vg(s),t),validFor:mg};if("TagName"==s.name){for(let{parent:t}=s;t;t=t.parent)if("Block"==t.name)return{from:s.from,options:dg(),validFor:gg};return{from:s.from,options:Og,validFor:gg}}if(!e.explicit)return null;let o=s.resolve(n),a=o.childBefore(n);return a&&":"==a.name&&"PseudoClassSelector"==o.name?{from:n,options:fg,validFor:gg}:a&&":"==a.name&&"Declaration"==o.name||"ArgList"==o.name?{from:n,options:pg,validFor:gg}:"Block"==o.name||"Styles"==o.name?{from:n,options:dg(),validFor:gg}:null},xg=Sg((t=>"VariableName"==t.name)),kg=_a.define({name:"css",parser:cg.configure({props:[Na.add({Declaration:il()}),rl.add({"Block KeyframeList":ol})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function Qg(){return new Ua(kg,kg.data.of({autocomplete:xg}))}const $g=["_blank","_self","_top","_parent"],Pg=["ascii","utf-8","utf-16","latin1","latin1"],Cg=["get","post","put","delete"],_g=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Xg=["true","false"],Zg={},Ag={a:{attrs:{href:null,ping:null,type:null,media:null,target:$g,hreflang:null}},abbr:Zg,address:Zg,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Zg,aside:Zg,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Zg,base:{attrs:{href:null,target:$g}},bdi:Zg,bdo:Zg,blockquote:{attrs:{cite:null}},body:Zg,br:Zg,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Zg,center:Zg,cite:Zg,code:Zg,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:Zg,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Zg,div:Zg,dl:Zg,dt:Zg,em:Zg,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Zg,figure:Zg,footer:Zg,form:{attrs:{action:null,name:null,"accept-charset":Pg,autocomplete:["on","off"],enctype:_g,method:Cg,novalidate:["novalidate"],target:$g}},h1:Zg,h2:Zg,h3:Zg,h4:Zg,h5:Zg,h6:Zg,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Zg,hgroup:Zg,hr:Zg,html:{attrs:{manifest:null}},i:Zg,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:Zg,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Zg,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:Zg,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Pg,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:Zg,noscript:Zg,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:Zg,param:{attrs:{name:null,value:null}},pre:Zg,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Zg,rt:Zg,ruby:Zg,samp:Zg,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Pg}},section:Zg,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Zg,source:{attrs:{src:null,type:null,media:null}},span:Zg,strong:Zg,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Zg,summary:Zg,sup:Zg,table:Zg,tbody:Zg,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Zg,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:Zg,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Zg,time:{attrs:{datetime:null}},title:Zg,tr:Zg,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Zg,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:Zg},Tg={accesskey:null,class:null,contenteditable:Xg,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Xg,autocorrect:Xg,autocapitalize:Xg,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Xg,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Xg,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Xg,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Xg,"aria-hidden":Xg,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Xg,"aria-multiselectable":Xg,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Xg,"aria-relevant":null,"aria-required":Xg,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},Rg="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map((t=>"on"+t));for(let t of Rg)Tg[t]=null;class Eg{constructor(t,e){this.tags=Object.assign(Object.assign({},Ag),t),this.globalAttrs=Object.assign(Object.assign({},Tg),e),this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}function Vg(t,e,i=t.length){if(!e)return"";let n=e.firstChild,s=n&&n.getChild("TagName");return s?t.sliceString(s.from,Math.min(s.to,i)):""}function Mg(t,e=!1){for(let i=t.parent;i;i=i.parent)if("Element"==i.name){if(!e)return i;e=!1}return null}function Dg(t,e,i){let n=i.tags[Vg(t,Mg(e,!0))];return(null==n?void 0:n.children)||i.allTags}function Wg(t,e){let i=[];for(let n=e;n=Mg(n);){let s=Vg(t,n);if(s&&"CloseTag"==n.lastChild.name)break;s&&i.indexOf(s)<0&&("EndTag"==e.name||e.from>=n.firstChild.to)&&i.push(s)}return i}Eg.default=new Eg;const Ug=/^[:\-\.\w\u00b7-\uffff]*$/;function Yg(t,e,i,n,s){let r=/\s*>/.test(t.sliceDoc(s,s+5))?"":">";return{from:n,to:s,options:Dg(t.doc,i,e).map((t=>({label:t,type:"type"}))).concat(Wg(t.doc,i).map(((t,e)=>({label:"/"+t,apply:"/"+t+r,type:"type",boost:99-e})))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function qg(t,e,i,n){let s=/\s*>/.test(t.sliceDoc(n,n+5))?"":">";return{from:i,to:n,options:Wg(t.doc,e).map(((t,e)=>({label:t,apply:t+s,type:"type",boost:99-e}))),validFor:Ug}}function Lg(t,e){let{state:i,pos:n}=e,s=Xa(i).resolveInner(n),r=s.resolve(n,-1);for(let t,e=n;s==r&&(t=r.childBefore(e));){let i=t.lastChild;if(!i||!i.type.isError||i.from({label:t,type:"property"}))),validFor:Ug}}(i,t,r,"AttributeName"==r.name?r.from:n,n):"Is"==r.name||"AttributeValue"==r.name||"UnquotedAttributeValue"==r.name?function(t,e,i,n,s){var r;let o,a=null===(r=i.parent)||void 0===r?void 0:r.getChild("AttributeName"),l=[];if(a){let r=t.sliceDoc(a.from,a.to),h=e.globalAttrs[r];if(!h){let n=Mg(i),s=n?e.tags[Vg(t.doc,n)]:null;h=(null==s?void 0:s.attrs)&&s.attrs[r]}if(h){let e=t.sliceDoc(n,s).toLowerCase(),i='"',r='"';/^['"]/.test(e)?(o='"'==e[0]?/^[^"]*$/:/^[^']*$/,i="",r=t.sliceDoc(s,s+1)==e[0]?"":e[0],e=e.slice(1),n++):o=/^[^\s<>='"]*$/;for(let t of h)l.push({label:t,apply:i+t+r,type:"constant"})}}return{from:n,to:s,options:l,validFor:o}}(i,t,r,"Is"==r.name?n:r.from,n):!e.explicit||"Element"!=s.name&&"Text"!=s.name&&"Document"!=s.name?null:function(t,e,i,n){let s=[],r=0;for(let n of Dg(t.doc,i,e))s.push({label:"<"+n,type:"type"});for(let e of Wg(t.doc,i))s.push({label:"",type:"type",boost:99-r++});return{from:n,to:n,options:s,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}(i,t,r,n)}function zg(t){let{extraTags:e,extraGlobalAttributes:i}=t,n=i||e?new Eg(e,i):Eg.default;return t=>Lg(n,t)}const Ig=[{tag:"script",attrs:t=>"text/typescript"==t.type||"ts"==t.lang,parser:zf.parser},{tag:"script",attrs:t=>"text/babel"==t.type||"text/jsx"==t.type,parser:If.parser},{tag:"script",attrs:t=>"text/typescript-jsx"==t.type,parser:Bf.parser},{tag:"script",attrs:t=>!t.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(t.type),parser:qf.parser},{tag:"style",attrs:t=>(!t.lang||"css"==t.lang)&&(!t.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(t.type)),parser:kg.parser}],Bg=[{name:"style",parser:kg.parser.configure({top:"Styles"})}].concat(Rg.map((t=>({name:t,parser:qf.parser})))),jg=_a.define({name:"html",parser:FO.configure({props:[Na.add({Element(t){let e=/^(\s*)(<\/)?/.exec(t.textAfter);return t.node.to<=t.pos+e[0].length?t.continue():t.lineIndent(t.node.from)+(e[2]?0:t.unit)},"OpenTag CloseTag SelfClosingTag":t=>t.column(t.node.from)+t.unit,Document(t){if(t.pos+/\s*/.exec(t.textAfter)[0].lengtht.getChild("TagName")})],wrap:tg(Ig,Bg)}),languageData:{commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-._"}});function Ng(t={}){let e,i="";!1===t.matchClosingTags&&(i="noMatch"),!0===t.selfClosingTags&&(i=(i?i+" ":"")+"selfClosing"),(t.nestedLanguages&&t.nestedLanguages.length||t.nestedAttributes&&t.nestedAttributes.length)&&(e=tg((t.nestedLanguages||[]).concat(Ig),(t.nestedAttributes||[]).concat(Bg)));let n=e||i?jg.configure({dialect:i,wrap:e}):jg;return new Ua(n,[jg.data.of({autocomplete:zg(t)}),!1!==t.autoCloseTags?Fg:[],Nf().support,Qg().support])}const Gg=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),Fg=Ts.inputHandler.of(((t,e,i,n)=>{if(t.composing||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!jg.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((e=>{var i,r,o;let a,{head:l}=e,h=Xa(s).resolveInner(l,-1);if("TagName"!=h.name&&"StartTag"!=h.name||(h=h.parent),">"==n&&"OpenTag"==h.name){if("CloseTag"!=(null===(r=null===(i=h.parent)||void 0===i?void 0:i.lastChild)||void 0===r?void 0:r.name)&&(a=Vg(s.doc,h.parent,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`${e?"":">"}`;return{range:A.cursor(l+1),changes:{from:l+(e?1:0),insert:i}}}}else if("/"==n&&"OpenTag"==h.name){let e=h.parent,i=null==e?void 0:e.parent;if(e.from==l-1&&"CloseTag"!=(null===(o=i.lastChild)||void 0===o?void 0:o.name)&&(a=Vg(s.doc,i,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`/${a}${e?"":">"}`,n=l+i.length+(e?1:0);return{range:A.cursor(n),changes:{from:l,insert:i}}}}return{range:e}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)})),Hg=Qa({commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}}}),Jg=new ho,Kg=sO.configure({props:[rl.add((t=>!t.is("Block")||t.is("Document")||null!=tm(t)?void 0:(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to}))),Jg.add(tm),Na.add({Document:()=>null}),ka.add({Document:Hg})]});function tm(t){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(t.name);return e?+e[1]:void 0}function em(t,e){let i=t;for(;;){let t,n=i.nextSibling;if(!n||null!=(t=tm(n.type))&&t<=e)break;i=n}return i.to}const im=sl.of(((t,e,i)=>{for(let n=Xa(t).resolveInner(i,-1);n&&!(n.fromi)return{from:i,to:e}}return null}));function nm(t){return new Pa(Hg,t,[im],"markdown")}const sm=nm(Kg),rm=nm(Kg.configure([pO,mO,gO,bO]));class om{constructor(t,e,i,n,s,r,o){this.node=t,this.from=e,this.to=i,this.spaceBefore=n,this.spaceAfter=s,this.type=r,this.item=o}blank(t,e=!0){let i=this.spaceBefore+("Blockquote"==this.node.name?">":"");if(null!=t){for(;i.length0;t--)i+=" ";return i+(e?this.spaceAfter:"")}marker(t,e){let i="OrderedList"==this.node.name?String(+lm(this.item,t)[2]+e):"";return this.spaceBefore+i+this.type+this.spaceAfter}}function am(t,e){let i=[];for(let e=t;e&&"Document"!=e.name;e=e.parent)"ListItem"!=e.name&&"Blockquote"!=e.name&&"FencedCode"!=e.name||i.push(e);let n=[];for(let t=i.length-1;t>=0;t--){let s,r=i[t],o=e.lineAt(r.from),a=r.from-o.from;if("FencedCode"==r.name)n.push(new om(r,a,a,"","","",null));else if("Blockquote"==r.name&&(s=/^[ \t]*>( ?)/.exec(o.text.slice(a))))n.push(new om(r,a,a+s[0].length,"",s[1],">",null));else if("ListItem"==r.name&&"OrderedList"==r.parent.name&&(s=/^([ \t]*)\d+([.)])([ \t]*)/.exec(o.text.slice(a)))){let t=s[3],e=s[0].length;t.length>=4&&(t=t.slice(0,t.length-4),e-=4),n.push(new om(r.parent,a,a+e,s[1],t,s[2],r))}else if("ListItem"==r.name&&"BulletList"==r.parent.name&&(s=/^([ \t]*)([-+*])([ \t]{1,4}\[[ xX]\])?([ \t]+)/.exec(o.text.slice(a)))){let t=s[4],e=s[0].length;t.length>4&&(t=t.slice(0,t.length-4),e-=4);let i=s[2];s[3]&&(i+=s[3].replace(/[xX]/," ")),n.push(new om(r.parent,a,a+e,s[1],t,i,r))}}return n}function lm(t,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(t.from,t.from+10))}function hm(t,e,i,n=0){for(let s=-1,r=t;;){if("ListItem"==r.name){let t=lm(r,e),o=+t[2];if(s>=0){if(o!=s+1)return;i.push({from:r.from+t[1].length,to:r.from+t[0].length,insert:String(s+2+n)})}s=o}let t=r.nextSibling;if(!t)break;r=t}}function cm(t){return"QuoteMark"==t.name||"ListMark"==t.name}const um=[{key:"Enter",run:({state:t,dispatch:e})=>{let i=Xa(t),{doc:n}=t,s=null,r=t.changeByRange((e=>{if(!e.empty||!rm.isActiveAt(t,e.from))return s={range:e};let r=e.from,o=n.lineAt(r),a=am(i.resolveInner(r,-1),n);for(;a.length&&a[a.length-1].from>r-o.from;)a.pop();if(!a.length)return s={range:e};let l=a[a.length-1];if(l.to-l.spaceAfter.length>r-o.from)return s={range:e};let h=r>=l.to-l.spaceAfter.length&&!/\S/.test(o.text.slice(l.to));if(l.item&&h){if(l.node.firstChild.to>=r||o.from>0&&!/[^\s>]/.test(n.lineAt(o.from-1).text)){let t,e=a.length>1?a[a.length-2]:null,i="";e&&e.item?(t=o.from+e.from,i=e.marker(n,1)):t=o.from+(e?e.to:0);let s=[{from:t,to:r,insert:i}];return"OrderedList"==l.node.name&&hm(l.item,n,s,-2),e&&"OrderedList"==e.node.name&&hm(e.item,n,s),{range:A.cursor(t+i.length),changes:s}}{let e="";for(let t=0,i=a.length-2;t<=i;t++)e+=a[t].blank(t\s*$/.exec(i.text);if(s&&s.index==l.from){let n=t.changes([{from:i.from+s.index,to:i.to},{from:o.from+l.from,to:o.to}]);return{range:e.map(n),changes:n}}}let c=[];"OrderedList"==l.node.name&&hm(l.item,n,c);let u=l.item&&l.item.from]*/.exec(o.text)[0].length>=l.to)for(let t=0,e=a.length-1;t<=e;t++)d+=t!=e||u?a[t].blank(to.from&&/\s/.test(o.text.charAt(f-o.from-1));)f--;return d=t.lineBreak+d,c.push({from:f,to:r,insert:d}),{range:A.cursor(f+d.length),changes:c}}));return!s&&(e(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0)}},{key:"Backspace",run:({state:t,dispatch:e})=>{let i=Xa(t),n=null,s=t.changeByRange((e=>{let s=e.from,{doc:r}=t;if(e.empty&&rm.isActiveAt(t,e.from)){let t=r.lineAt(s),n=am(function(t,e){let i=t.resolveInner(e,-1),n=e;cm(i)&&(n=i.from,i=i.parent);for(let t;t=i.childBefore(n);)if(cm(t))n=t.from;else{if("OrderedList"!=t.name&&"BulletList"!=t.name)break;i=t.lastChild,n=i.to}return i}(i,s),r);if(n.length){let i=n[n.length-1],r=i.to-i.spaceAfter.length+(i.spaceAfter?1:0);if(s-t.from>r&&!/\S/.test(t.text.slice(r,s-t.from)))return{range:A.cursor(t.from+r),changes:{from:t.from+r,to:s}};if(s-t.from==r&&(!i.item||t.from<=i.item.from||!/\S/.test(t.text.slice(0,i.to)))){let n=t.from+i.from;if(i.item&&i.node.fromt.from-e.from||t.startSide-e.startSide)),ni.set(i)}getMatchingBracket(t){switch(t){case")":return"(";case"]":return"[";case"}":return"{";default:return null}}},{decorations:t=>t.decorations});var fm="[a-zA-Z\\$][a-zA-Z0-9\\$]*",pm="(?:\\.\\d+|\\d+\\.\\d*|\\d+)",Om="(?:`(?:`?"+pm+")?)",gm=new RegExp("(?:(?:\\d+)(?:\\^\\^(?:\\.\\w+|\\w+\\.\\w*|\\w+)"+Om+"?(?:\\*\\^[+-]?\\d+)?))"),mm=new RegExp("(?:"+pm+Om+"?(?:\\*\\^[+-]?\\d+)?)"),bm=new RegExp("(?:`?)(?:"+fm+")(?:`(?:"+fm+"))*(?:`?)");let wm=[];const vm=["True","False","All","None","Null","Full","$Failed","$Aborted"];function ym(t,e){var i;return'"'===(i=t.next())?(e.tokenize=Sm,e.tokenize(t,e)):"("===i&&t.eat("*")?(e.commentLevel++,e.tokenize=xm,e.tokenize(t,e)):(t.backUp(1),t.match(gm,!0,!1)||t.match(mm,!0,!1)?"number":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::usage)/,!0,!1)?"meta":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::[a-zA-Z\$][a-zA-Z0-9\$]*):?/,!0,!1)?"string.special":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*\s*:)(?:(?:[a-zA-Z\$][a-zA-Z0-9\$]*)|(?:[^:=>~@\^\&\*\)\[\]'\?,\|])).*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+/,!0,!1)||t.match(/_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)?"variableName.special":t.match(/\\\[[a-zA-Z\$][a-zA-Z0-9\$]*\]/,!0,!1)?"character":t.match(/(?:\[|\]|{|}|\(|\))/,!0,!1)?"bracket":t.match(/(?:#[a-zA-Z\$][a-zA-Z0-9\$]*|#+[0-9]?)/,!0,!1)?"variableName.constant":t.match(bm,!0,!1)?vm.indexOf(t.current())>-1?"number":wm.indexOf(t.current())>-1||0==wm.length?"keyword":t.current()in e.localVars?"atom":(e.localVars[t.current()]=!0,"function"):t.match(/(?:\\|\+|\-|\*|\/|,|;|\.|:|@|~|=|>|<|&|\||_|`|'|\^|\?|!|%)/,!0,!1)?"operator":(t.next(),"error"))}function Sm(t,e){for(var i,n=!1,s=!1;null!=(i=t.next());){if('"'===i&&!s){n=!0;break}s=!s&&"\\"===i}return n&&!s&&(e.tokenize=ym),"string"}function xm(t,e){for(var i,n;e.commentLevel>0&&null!=(n=t.next());)"("===i&&"*"===n&&e.commentLevel++,"*"===i&&")"===n&&e.commentLevel--,i=n;return e.commentLevel<=0&&(e.tokenize=ym),"comment"}const km={name:"mathematica",extendVariables:function(t){},startState:function(){return{tokenize:ym,commentLevel:0,localVars:{}}},token:function(t,e){return t.eatSpace()?null:e.tokenize(t,e)},languageData:{commentTokens:{block:{open:"(*",close:"*)"}}}};let Qm={of:t=>[Gl.define(km),Yd({override:[async e=>function(t,e){let i=t.matchBefore(/\w*/);return i.from!==i.to||t.explicit?{from:i.from,options:e.data}:null}(e,t)]}),Ys.of([{key:"Escape",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((t=>{let{from:e,to:i}=t;return{changes:{from:e,to:i,insert:"EC"},range:A.cursor(e+2)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])],reBuild:t=>{wm=t.map((t=>t.label))}};const $m=(t,e,i,n)=>{if(0==t.length)return;const s=(new Date).valueOf();let r=0;i.dom.loadingMark=!0;const o=i.dom.style.background;let a=0;console.log("Start animation");const l=setInterval((()=>{i.dom.style.setProperty("background","hsl("+a+"deg 100% 97%)","important"),a+=2,a>360&&(a=0)}),30);n.transaction(e,i,s,t.length);for(const a of t)Pm(a,((a,h)=>{n.file(e,i,s,a,h),r++,r>=t.length&&i.dom&&i.dom.loadingMark&&(i.dom.loadingMark=!1,setTimeout((()=>{i.dom.style.background=o,clearInterval(l),console.log("Stop animation")}),2e3))}),(()=>{console.warn("Fauilure");const t=i.dom.style.background;i.dom.style.background="rgb(255 189 189 / 97%)";let e=97;const n=setInterval((()=>{i.dom.style.background="rgb(255 189 189 / "+Math.round(e)+"%)",e*=.95}),30);clearInterval(l),setTimeout((()=>{clearInterval(n),i.dom.style.background=t}),3e3)}))};function Pm(t,e,i){const n=new FileReader;n.addEventListener("load",(n=>{const s=n.target.result;if(s.byteLength/1024/1024>100)return alert("Files > 100Mb are not supported for drag and drop"),void i();let r=base64ArrayBuffer(s);e(t.name,r)})),n.addEventListener("progress",(t=>{if(t.loaded&&t.total){const e=t.loaded/t.total*100;console.log(e)}})),n.readAsArrayBuffer(t)}const Cm=(t,e)=>Ts.domEventHandlers({drop(e,i){e.preventDefault();const n=[];e.dataTransfer.items?[...e.dataTransfer.items].forEach(((t,e)=>{if("file"===t.kind){const i=t.getAsFile();console.log(`… file[${e}].name = ${i.name}`),n.push(i)}})):[...e.dataTransfer.files].forEach(((t,e)=>{console.log(`… file[${e}].name = ${t.name}`),n.push(t)})),$m(n,e,i,t)},paste(t,i){let n=t.clipboardData||window.clipboardData;for(const s of n.items)if("string"===s.kind)switch(s.type){case"text/plain":break;case"image/png":t.preventDefault(),$m([s.getAsFile()],t,i,e)}else t.preventDefault(),$m([s.getAsFile()],t,i,e)}}),_m=new pr({regexp:/\\\[(\w+)\]/g,decoration:t=>ni.replace({widget:new Zm(t[1])})}),Xm=_i.fromClass(class{constructor(t){this.Greekholder=_m.createDeco(t)}update(t){this.Greekholder=_m.updateDeco(t,this.Greekholder)}},{decorations:t=>t.Greekholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Greekholder||ni.none))});class Zm extends ei{constructor(t){super(),this.name=t}eq(t){return this.name===t.name}toDOM(){let t=document.createElement("span");return t.innerHTML="&"+this.name.toLowerCase().replace("sqrt","radic").replace("undirectededge","harr").replace("directededge","rarr").replace(/capital(.*)/,((t,e)=>e.charAt(0).toUpperCase()+e.slice(1))).replace(/curly(.*)/,((t,e)=>e)).replace(/script(.*)/,((t,e)=>"el"+e.toLowerCase())).replace("transpose","#7488").replace("degree","deg")+";",t}ignoreEvent(){return!1}}const Am=new pr({regexp:/(->|<-)/g,decoration:t=>ni.replace({widget:new Tm(t[1])})});_i.fromClass(class{constructor(t){this.Arrowholder=Am.createDeco(t)}update(t){this.Arrowholder=Am.updateDeco(t,this.Arrowholder)}},{decorations:t=>t.Arrowholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Arrowholder||ni.none))});class Tm extends ei{constructor(t){super(),this.dir=t}eq(t){return this.dir===t.dir}toDOM(){let t=document.createElement("span");return"->"===this.dir?t.innerText="→":t.innerText="←",t}ignoreEvent(){return!1}}function Rm(t){if(!(t=t||{}).open)throw new Error('Balanced: please provide a "open" property');if(!t.close)throw new Error('Balanced: please provide a "close" property');if(this.balance=t.balance||!1,this.exceptions=t.exceptions||!1,this.caseInsensitive=t.caseInsensitive,this.head=t.head||t.open,this.head=Array.isArray(this.head)?this.head:[this.head],this.open=Array.isArray(t.open)?t.open:[t.open],this.close=Array.isArray(t.close)?t.close:[t.close],!Array.isArray(this.head)||!Array.isArray(this.open)||!Array.isArray(this.close)||this.head.length!==this.open.length||this.open.length!==this.close.length)throw new Error('Balanced: if you use arrays for a "head,open,close" you must use matching arrays for all options');var e=Dm(this.head.map(this.regExpFromArrayGroupedMap,this)),i=Dm(this.open.map(this.regExpFromArrayGroupedMap,this)),n=Dm(this.close.map(this.regExpFromArrayGroupedMap,this));this.regExp=Dm([e,i,n],"g"+(this.caseInsensitive?"i":"")),this.regExpGroupLength=this.head.length}function Em(t,e,i){for(var n=Mm(e.substr(0,i+1),/^.*\n?$/gim),s=Mm(e,/^.*\n?$/gim),r=n.length-1,o=i+1-(n.length?n[n.length-1].index:0),a="",l=2;l>=0;l--)r-l>=0&&s[r-l]&&(a+=e.substr(s[r-l].index,s[r-l].length)+"\n");for(l=0;l=0&&s[r+l]&&(a+=e.substr(s[r+l].index,s[r+l].length)+"\n");a=a.replace(/\t/g," ").replace(/\n$/,"");var h=new Error(t+" at "+(r+1)+":"+o+"\n\n"+a);return h.line=r+1,h.column=o,h.index=i,h}function Vm(t,e){return t>=e.index&&t<=e.index+e.length-1}function Mm(t,e){var i,n=new RegExp(e),s=[];if(t)for(;i=n.exec(t);)s.push({index:i.index,length:i[0].length,match:i[0]}),i[0].length||n.lastIndex++;return s}function Dm(t,e,i){var n=t.map((function(t){return t instanceof RegExp?t.source:function(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}(t)}),this).join("|");return n=i?"("+n+")":"(?:"+n+")",new RegExp(n,e||void 0)}Rm.prototype={regExpFromArrayGroupedMap:function(t){return Dm([t],null,!0)},matchContentsInBetweenBrackets:function(t,e){for(var i,n=new RegExp(this.regExp),s=[],r=[],o=null,a=!0;i=n.exec(t);){if(e){for(var l=!1,h=0;h{const i=((t,e,i)=>{var n,s=new RegExp(t),r=[];if(e)for(;n=s.exec(e);){if(i){for(var o=!1,a=0;a{new qm({open:"(*"+t+"[*)",close:"(*]"+t+"*)",balance:!1}).matchContentsInBetweenBrackets(e.value,[]).forEach((function(t){const s=e.value.slice(t.index+t.head.length,t.index+t.length-t.tail.length);n(i+t.index,{length:t.length,pos:i+t.index,argsPos:i+t.index+t.head.length,str:s})}))})(e,t,i,s)},o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)r(o,a)}var Im,Bm=function(){function t(t){var e=t.tag,i=t.decoration,n=t.decorate,s=t.boundary,r=t.maxLength,o=void 0===r?1e3:r;if(this.tag=e,n)this.addMatch=function(t,e,i,s){return n(s,i,i+t.length,t,e)};else if("function"==typeof i)this.addMatch=function(t,e,n,s){var r=i(t,e,n);r&&s(n,n+t.length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=function(t,e,n,s){return s(n,n+t.length,i)}}this.boundary=s,this.maxLength=o}return t.prototype.createDeco=function(t){for(var e=this,i=new Xt,n=i.add.bind(i),s=0,r=function(t,e){var i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;for(var n=[],s=0,r=i;s=a?n[n.length-1].to=l:n.push({from:a,to:l})}return n}(t,this.maxLength);st.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e},t.prototype.updateRange=function(t,e,i,n){for(var s=this,r=function(r){var a=Math.max(r.from,i),l=Math.min(r.to,n);if(l>a){var h=t.state.doc.lineAt(a),c=h.toh.from;a--)if(o.boundary.test(h.text[a-1-h.from])){u=a;break}for(;ld},add:f})}},o=this,a=0,l=t.visibleRanges;a{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*FB[*)((_)(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*FB[*)(("+s+")(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let Nm=class{constructor(t,e,i,n,s,r){this.view=e,this.visibleValue=t,this.placeholder=r,console.log(r),this.args=Lm(t.str,/\(\*,\*\)/gm);const o=this;let a,l;console.log("creating InstanceWidget"),a=Im({doc:o.args[0].body.slice(2,-1),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(o.visibleValue.pos),e.dispatch({selection:{anchor:o.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return l.dispatch({selection:{anchor:0}}),l.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){l.focus(),t.editorLastCursor=void 0}}])]}),l=Im({doc:o.args[2].body.slice(1,-2),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:a.state.doc.length}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:o.visibleValue.pos+o.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus(),t.editorLastCursor=void 0}}])]}),o.args[0].length=o.args[0].body.length,o.args[2].length=o.args[2].body.length,delete o.args[2].body,delete o.args[1].body,delete o.args[0].body,this.topEditor=a,this.bottomEditor=l}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="(("+t+")",s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length));const r=e.length-i[0].length;i[0].to=i[0].to+r,i[2].from=i[2].from+r,i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e="("+t+"))",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length));const r=e.length-i[2].length;i[2].to=i[2].to+r,i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t,e){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm),console.log("recreating InstanceWidget"),n=Im.state({doc:e.args[0].body.slice(2,-1),update:t=>e.applyChanges(t,0),eval:()=>{i.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(e.visibleValue.pos),i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus(),t.editorLastCursor=void 0}}])]}),s=Im.state({doc:e.args[2].body.slice(1,-2),update:t=>e.applyChanges(t,2),eval:()=>{e.view.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus(),t.editorLastCursor=void 0}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),console.log(e),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.placeholder=e,this.visibleValue.argsPos=t.argsPos}destroy(){this.topEditor.destroy(),this.bottomEditor.destroy()}},Gm=class extends ei{constructor(t,e,i,n){super(),this.view=i,this.visibleValue=t,this.reference=e,this.placeholder=n}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue,this),!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("fraction");const i=document.createElement("table");i.classList.add("container"),e.appendChild(i);const n=document.createElement("tbody");i.appendChild(n);const s=document.createElement("tr"),r=document.createElement("tr");n.appendChild(s),n.appendChild(r);const o=document.createElement("td");o.classList.add("enumenator"),s.appendChild(o);const a=document.createElement("td");r.appendChild(a);const l=this;return e.EditorWidget=new Nm(this.visibleValue,t,o,a,[],this),this.DOMElement=e,this.reference.push({destroy:()=>{l.destroy(e)}}),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const Fm=(t,e,i)=>new Bm({tag:"FB",decoration:n=>ni.replace({widget:new Gm(n,t,e,i)})}),Hm=t=>_i.fromClass(class{constructor(e){this.disposable=[],this.placeholder=Fm(this.disposable,e,this).createDeco(e),t.placeholder=this}update(t){this.placeholder=Fm(this.disposable,t,this).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var Jm;function Km(t){return Jm=t,[nb,Ys.of([{key:"Ctrl-2",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt[_](*]SqB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt["+s+"](*]SqB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let tb=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;this.sliceRanges=n,this.length=t.str.length,console.log("creating InstanceWidget"),this.editor=Jm({doc:t.str.slice(...n),parent:i,update:t=>r.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]})}applyChanges(t){const e=t,i={from:this.visibleValue.argsPos+5,to:this.visibleValue.argsPos+this.length-1,insert:e};console.log(this.visibleValue);const n=e.length+6-this.length;this.length=this.length+n,this.visibleValue.length=this.visibleValue.length+n,this.visibleValue.str="Sqrt["+e+"]",this.view.dispatch({changes:i})}update(t){if(this.visibleValue.str==t.str)this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos;else{console.warn("Out of sync"),this.visibleValue=t;const e=this.sliceRanges,i=this.editor,n=this,s=this.view;this.length=t.str.length;const r=Jm.state({doc:t.str.slice(...e),update:t=>n.applyChanges(t),eval:()=>{s.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos+n.visibleValue.length}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]});i.setState(r)}}destroy(){console.warn("destroy Instance of Widget!"),this.editor.destroy()}},eb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("sqroot");const i=this,n=document.createElement("span");return n.classList.add("radicand"),e.EditorWidget=new tb(this.visibleValue,t,n,[5,-1],[]),e.appendChild(n),this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const ib=(t,e)=>new Bm({tag:"SqB",decoration:i=>ni.replace({widget:new eb(i,t,e)})}),nb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=ib(this.disposable,t).createDeco(t)}update(t){this.placeholder=ib(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var sb;function rb(t){return sb=t,[hb,Ys.of([{key:"Ctrl--",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SbB[*)Subscript[_(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SbB[*)Subscript["+s+"(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let ob=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),console.log(r.visibleValue),o=sb({doc:r.args[0].body.slice(10),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){a.focus()}}])]}),a=sb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Subscript["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),console.log(e.visibleValue),n=sb.state({doc:e.args[0].body.slice(10),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus()}}])]}),s=sb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},ab=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sub");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new ob(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const lb=(t,e)=>new Bm({tag:"SbB",decoration:i=>ni.replace({widget:new ab(i,t,e)})}),hb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=lb(this.disposable,t).createDeco(t)}update(t){this.placeholder=lb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var cb;function ub(t){return cb=t,[Ob,Ys.of([{key:"Ctrl-6",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SpB[*)Power[_(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SpB[*)Power["+s+"(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let db=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),o=cb({doc:r.args[0].body.slice(6),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus()}}])]}),a=cb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Power["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),n=cb.state({doc:e.args[0].body.slice(6),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.bottomEditor.focus()}}])]}),s=cb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},fb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sup");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new db(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}destroy(t){t.EditorWidget.destroy()}};const pb=(t,e)=>new Bm({tag:"SpB",decoration:i=>ni.replace({widget:new fb(i,t,e)})}),Ob=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=pb(this.disposable,t).createDeco(t)}update(t){this.placeholder=pb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var gb={},mb={},bb={},wb={};function vb(t){let e=t.length;for(;--e>=0;)t[e]=0}const yb=256,Sb=286,xb=30,kb=15,Qb=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),$b=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Pb=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Cb=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_b=new Array(576);vb(_b);const Xb=new Array(60);vb(Xb);const Zb=new Array(512);vb(Zb);const Ab=new Array(256);vb(Ab);const Tb=new Array(29);vb(Tb);const Rb=new Array(xb);function Eb(t,e,i,n,s){this.static_tree=t,this.extra_bits=e,this.extra_base=i,this.elems=n,this.max_length=s,this.has_stree=t&&t.length}let Vb,Mb,Db;function Wb(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}vb(Rb);const Ub=t=>t<256?Zb[t]:Zb[256+(t>>>7)],Yb=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},qb=(t,e,i)=>{t.bi_valid>16-i?(t.bi_buf|=e<>16-t.bi_valid,t.bi_valid+=i-16):(t.bi_buf|=e<{qb(t,i[2*e],i[2*e+1])},zb=(t,e)=>{let i=0;do{i|=1&t,t>>>=1,i<<=1}while(--e>0);return i>>>1},Ib=(t,e,i)=>{const n=new Array(16);let s,r,o=0;for(s=1;s<=kb;s++)o=o+i[s-1]<<1,n[s]=o;for(r=0;r<=e;r++){let e=t[2*r+1];0!==e&&(t[2*r]=zb(n[e]++,e))}},Bb=t=>{let e;for(e=0;e{t.bi_valid>8?Yb(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},Nb=(t,e,i,n)=>{const s=2*e,r=2*i;return t[s]{const n=t.heap[i];let s=i<<1;for(;s<=t.heap_len&&(s{let n,s,r,o,a=0;if(0!==t.sym_next)do{n=255&t.pending_buf[t.sym_buf+a++],n+=(255&t.pending_buf[t.sym_buf+a++])<<8,s=t.pending_buf[t.sym_buf+a++],0===n?Lb(t,s,e):(r=Ab[s],Lb(t,r+yb+1,e),o=Qb[r],0!==o&&(s-=Tb[r],qb(t,s,o)),n--,r=Ub(n),Lb(t,r,i),o=$b[r],0!==o&&(n-=Rb[r],qb(t,n,o)))}while(a{const i=e.dyn_tree,n=e.stat_desc.static_tree,s=e.stat_desc.has_stree,r=e.stat_desc.elems;let o,a,l,h=-1;for(t.heap_len=0,t.heap_max=573,o=0;o>1;o>=1;o--)Gb(t,i,o);l=r;do{o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Gb(t,i,1),a=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=a,i[2*l]=i[2*o]+i[2*a],t.depth[l]=(t.depth[o]>=t.depth[a]?t.depth[o]:t.depth[a])+1,i[2*o+1]=i[2*a+1]=l,t.heap[1]=l++,Gb(t,i,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const i=e.dyn_tree,n=e.max_code,s=e.stat_desc.static_tree,r=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,l=e.stat_desc.max_length;let h,c,u,d,f,p,O=0;for(d=0;d<=kb;d++)t.bl_count[d]=0;for(i[2*t.heap[t.heap_max]+1]=0,h=t.heap_max+1;h<573;h++)c=t.heap[h],d=i[2*i[2*c+1]+1]+1,d>l&&(d=l,O++),i[2*c+1]=d,c>n||(t.bl_count[d]++,f=0,c>=a&&(f=o[c-a]),p=i[2*c],t.opt_len+=p*(d+f),r&&(t.static_len+=p*(s[2*c+1]+f)));if(0!==O){do{for(d=l-1;0===t.bl_count[d];)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[l]--,O-=2}while(O>0);for(d=l;0!==d;d--)for(c=t.bl_count[d];0!==c;)u=t.heap[--h],u>n||(i[2*u+1]!==d&&(t.opt_len+=(d-i[2*u+1])*i[2*u],i[2*u+1]=d),c--)}})(t,e),Ib(i,h,t.bl_count)},Jb=(t,e,i)=>{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),e[2*(i+1)+1]=65535,n=0;n<=i;n++)s=o,o=e[2*(n+1)+1],++a{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),n=0;n<=i;n++)if(s=o,o=e[2*(n+1)+1],!(++a{qb(t,0+(n?1:0),3),jb(t),Yb(t,i),Yb(t,~i),i&&t.pending_buf.set(t.window.subarray(e,e+i),t.pending),t.pending+=i};wb._tr_init=t=>{tw||((()=>{let t,e,i,n,s;const r=new Array(16);for(i=0,n=0;n<28;n++)for(Tb[n]=i,t=0;t<1<>=7;n{let s,r,o=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e{let e;for(Jb(t,t.dyn_ltree,t.l_desc.max_code),Jb(t,t.dyn_dtree,t.d_desc.max_code),Hb(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*Cb[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=i+5,i+4<=s&&-1!==e?ew(t,e,i,n):4===t.strategy||r===s?(qb(t,2+(n?1:0),3),Fb(t,_b,Xb)):(qb(t,4+(n?1:0),3),((t,e,i,n)=>{let s;for(qb(t,e-257,5),qb(t,i-1,5),qb(t,n-4,4),s=0;s(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=i,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(Ab[i]+yb+1)]++,t.dyn_dtree[2*Ub(e)]++),t.sym_next===t.sym_end),wb._tr_align=t=>{qb(t,2,3),Lb(t,256,_b),(t=>{16===t.bi_valid?(Yb(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)};var iw=(t,e,i,n)=>{let s=65535&t|0,r=t>>>16&65535|0,o=0;for(;0!==i;){o=i>2e3?2e3:i,i-=o;do{s=s+e[n++]|0,r=r+s|0}while(--o);s%=65521,r%=65521}return s|r<<16|0};const nw=new Uint32Array((()=>{let t,e=[];for(var i=0;i<256;i++){t=i;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e})());var sw=(t,e,i,n)=>{const s=nw,r=n+i;t^=-1;for(let i=n;i>>8^s[255&(t^e[i])];return-1^t},rw={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},ow={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:aw,_tr_stored_block:lw,_tr_flush_block:hw,_tr_tally:cw,_tr_align:uw}=wb,dw=iw,fw=sw,pw=rw,{Z_NO_FLUSH:Ow,Z_PARTIAL_FLUSH:gw,Z_FULL_FLUSH:mw,Z_FINISH:bw,Z_BLOCK:ww,Z_OK:vw,Z_STREAM_END:yw,Z_STREAM_ERROR:Sw,Z_DATA_ERROR:xw,Z_BUF_ERROR:kw,Z_DEFAULT_COMPRESSION:Qw,Z_FILTERED:$w,Z_HUFFMAN_ONLY:Pw,Z_RLE:Cw,Z_FIXED:_w,Z_DEFAULT_STRATEGY:Xw,Z_UNKNOWN:Zw,Z_DEFLATED:Aw}=ow,Tw=258,Rw=262,Ew=42,Vw=113,Mw=666,Dw=(t,e)=>(t.msg=pw[e],e),Ww=t=>2*t-(t>4?9:0),Uw=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Yw=t=>{let e,i,n,s=t.w_size;e=t.hash_size,n=e;do{i=t.head[--n],t.head[n]=i>=s?i-s:0}while(--e);e=s,n=e;do{i=t.prev[--n],t.prev[n]=i>=s?i-s:0}while(--e)};let qw=(t,e,i)=>(e<{const e=t.state;let i=e.pending;i>t.avail_out&&(i=t.avail_out),0!==i&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+i),t.next_out),t.next_out+=i,e.pending_out+=i,t.total_out+=i,t.avail_out-=i,e.pending-=i,0===e.pending&&(e.pending_out=0))},zw=(t,e)=>{hw(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Lw(t.strm)},Iw=(t,e)=>{t.pending_buf[t.pending++]=e},Bw=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},jw=(t,e,i,n)=>{let s=t.avail_in;return s>n&&(s=n),0===s?0:(t.avail_in-=s,e.set(t.input.subarray(t.next_in,t.next_in+s),i),1===t.state.wrap?t.adler=dw(t.adler,e,s,i):2===t.state.wrap&&(t.adler=fw(t.adler,e,s,i)),t.next_in+=s,t.total_in+=s,s)},Nw=(t,e)=>{let i,n,s=t.max_chain_length,r=t.strstart,o=t.prev_length,a=t.nice_match;const l=t.strstart>t.w_size-Rw?t.strstart-(t.w_size-Rw):0,h=t.window,c=t.w_mask,u=t.prev,d=t.strstart+Tw;let f=h[r+o-1],p=h[r+o];t.prev_length>=t.good_match&&(s>>=2),a>t.lookahead&&(a=t.lookahead);do{if(i=e,h[i+o]===p&&h[i+o-1]===f&&h[i]===h[r]&&h[++i]===h[r+1]){r+=2,i++;do{}while(h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&ro){if(t.match_start=e,o=n,n>=a)break;f=h[r+o-1],p=h[r+o]}}}while((e=u[e&c])>l&&0!=--s);return o<=t.lookahead?o:t.lookahead},Gw=t=>{const e=t.w_size;let i,n,s;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Rw)&&(t.window.set(t.window.subarray(e,e+e-n),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Yw(t),n+=e),0===t.strm.avail_in)break;if(i=jw(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=i,t.lookahead+t.insert>=3)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=qw(t,t.ins_h,t.window[s+1]);t.insert&&(t.ins_h=qw(t,t.ins_h,t.window[s+3-1]),t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead{let i,n,s,r=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,o=0,a=t.strm.avail_in;do{if(i=65535,s=t.bi_valid+42>>3,t.strm.avail_outn+t.strm.avail_in&&(i=n+t.strm.avail_in),i>s&&(i=s),i>8,t.pending_buf[t.pending-2]=~i,t.pending_buf[t.pending-1]=~i>>8,Lw(t.strm),n&&(n>i&&(n=i),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+n),t.strm.next_out),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n,t.block_start+=n,i-=n),i&&(jw(t.strm,t.strm.output,t.strm.next_out,i),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i)}while(0===o);return a-=t.strm.avail_in,a&&(a>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=a&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-a,t.strm.next_in),t.strstart),t.strstart+=a,t.insert+=a>t.w_size-t.insert?t.w_size-t.insert:a),t.block_start=t.strstart),t.high_waters&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,s+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),s>t.strm.avail_in&&(s=t.strm.avail_in),s&&(jw(t.strm,t.window,t.strstart,s),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.high_water>3,s=t.pending_buf_size-s>65535?65535:t.pending_buf_size-s,r=s>t.w_size?t.w_size:s,n=t.strstart-t.block_start,(n>=r||(n||e===bw)&&e!==Ow&&0===t.strm.avail_in&&n<=s)&&(i=n>s?s:n,o=e===bw&&0===t.strm.avail_in&&i===n?1:0,lw(t,t.block_start,i,o),t.block_start+=i,Lw(t.strm)),o?3:1)},Hw=(t,e)=>{let i,n;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==i&&t.strstart-i<=t.w_size-Rw&&(t.match_length=Nw(t,i)),t.match_length>=3)if(n=cw(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=qw(t,t.ins_h,t.window[t.strstart+1]);else n=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2},Jw=(t,e)=>{let i,n,s;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==i&&t.prev_length4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){s=t.strstart+t.lookahead-3,n=cw(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=s&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(zw(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(n=cw(t,0,t.window[t.strstart-1]),n&&zw(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=cw(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2};function Kw(t,e,i,n,s){this.good_length=t,this.max_lazy=e,this.nice_length=i,this.max_chain=n,this.func=s}const tv=[new Kw(0,0,0,0,Fw),new Kw(4,4,8,4,Hw),new Kw(4,5,16,8,Hw),new Kw(4,6,32,32,Hw),new Kw(4,4,16,16,Jw),new Kw(8,16,32,32,Jw),new Kw(8,16,128,128,Jw),new Kw(8,32,128,256,Jw),new Kw(32,128,258,1024,Jw),new Kw(32,258,258,4096,Jw)];function ev(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Aw,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Uw(this.dyn_ltree),Uw(this.dyn_dtree),Uw(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Uw(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Uw(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const iv=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==Ew&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==Vw&&e.status!==Mw?1:0},nv=t=>{if(iv(t))return Dw(t,Sw);t.total_in=t.total_out=0,t.data_type=Zw;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?Ew:Vw,t.adler=2===e.wrap?0:1,e.last_flush=-2,aw(e),vw},sv=t=>{const e=nv(t);var i;return e===vw&&((i=t.state).window_size=2*i.w_size,Uw(i.head),i.max_lazy_match=tv[i.level].max_lazy,i.good_match=tv[i.level].good_length,i.nice_match=tv[i.level].nice_length,i.max_chain_length=tv[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=2,i.match_available=0,i.ins_h=0),e},rv=(t,e,i,n,s,r)=>{if(!t)return Sw;let o=1;if(e===Qw&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),s<1||s>9||i!==Aw||n<8||n>15||e<0||e>9||r<0||r>_w||8===n&&1!==o)return Dw(t,Sw);8===n&&(n=9);const a=new ev;return t.state=a,a.strm=t,a.status=Ew,a.wrap=o,a.gzhead=null,a.w_bits=n,a.w_size=1<rv(t,e,Aw,15,8,Xw),bb.deflateInit2=rv,bb.deflateReset=sv,bb.deflateResetKeep=nv,bb.deflateSetHeader=(t,e)=>iv(t)||2!==t.state.wrap?Sw:(t.state.gzhead=e,vw),bb.deflate=(t,e)=>{if(iv(t)||e>ww||e<0)return t?Dw(t,Sw):Sw;const i=t.state;if(!t.output||0!==t.avail_in&&!t.input||i.status===Mw&&e!==bw)return Dw(t,0===t.avail_out?kw:Sw);const n=i.last_flush;if(i.last_flush=e,0!==i.pending){if(Lw(t),0===t.avail_out)return i.last_flush=-1,vw}else if(0===t.avail_in&&Ww(e)<=Ww(n)&&e!==bw)return Dw(t,kw);if(i.status===Mw&&0!==t.avail_in)return Dw(t,kw);if(i.status===Ew&&0===i.wrap&&(i.status=Vw),i.status===Ew){let e=Aw+(i.w_bits-8<<4)<<8,n=-1;if(n=i.strategy>=Pw||i.level<2?0:i.level<6?1:6===i.level?2:3,e|=n<<6,0!==i.strstart&&(e|=32),e+=31-e%31,Bw(i,e),0!==i.strstart&&(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),t.adler=1,i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(57===i.status)if(t.adler=0,Iw(i,31),Iw(i,139),Iw(i,8),i.gzhead)Iw(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),Iw(i,255&i.gzhead.time),Iw(i,i.gzhead.time>>8&255),Iw(i,i.gzhead.time>>16&255),Iw(i,i.gzhead.time>>24&255),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(Iw(i,255&i.gzhead.extra.length),Iw(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=fw(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if(Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,3),i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw;if(69===i.status){if(i.gzhead.extra){let e=i.pending,n=(65535&i.gzhead.extra.length)-i.gzindex;for(;i.pending+n>i.pending_buf_size;){let s=i.pending_buf_size-i.pending;if(i.pending_buf.set(i.gzhead.extra.subarray(i.gzindex,i.gzindex+s),i.pending),i.pending=i.pending_buf_size,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex+=s,Lw(t),0!==i.pending)return i.last_flush=-1,vw;e=0,n-=s}let s=new Uint8Array(i.gzhead.extra);i.pending_buf.set(s.subarray(i.gzindex,i.gzindex+n),i.pending),i.pending+=n,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex=0}i.status=73}if(73===i.status){if(i.gzhead.name){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),i.gzindex=0}i.status=91}if(91===i.status){if(i.gzhead.comment){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n))}i.status=103}if(103===i.status){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size&&(Lw(t),0!==i.pending))return i.last_flush=-1,vw;Iw(i,255&t.adler),Iw(i,t.adler>>8&255),t.adler=0}if(i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(0!==t.avail_in||0!==i.lookahead||e!==Ow&&i.status!==Mw){let n=0===i.level?Fw(i,e):i.strategy===Pw?((t,e)=>{let i;for(;;){if(0===t.lookahead&&(Gw(t),0===t.lookahead)){if(e===Ow)return 1;break}if(t.match_length=0,i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):i.strategy===Cw?((t,e)=>{let i,n,s,r;const o=t.window;for(;;){if(t.lookahead<=Tw){if(Gw(t),t.lookahead<=Tw&&e===Ow)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(s=t.strstart-1,n=o[s],n===o[++s]&&n===o[++s]&&n===o[++s])){r=t.strstart+Tw;do{}while(n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&st.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(i=cw(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):tv[i.level].func(i,e);if(3!==n&&4!==n||(i.status=Mw),1===n||3===n)return 0===t.avail_out&&(i.last_flush=-1),vw;if(2===n&&(e===gw?uw(i):e!==ww&&(lw(i,0,0,!1),e===mw&&(Uw(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),Lw(t),0===t.avail_out))return i.last_flush=-1,vw}return e!==bw?vw:i.wrap<=0?yw:(2===i.wrap?(Iw(i,255&t.adler),Iw(i,t.adler>>8&255),Iw(i,t.adler>>16&255),Iw(i,t.adler>>24&255),Iw(i,255&t.total_in),Iw(i,t.total_in>>8&255),Iw(i,t.total_in>>16&255),Iw(i,t.total_in>>24&255)):(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),Lw(t),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?vw:yw)},bb.deflateEnd=t=>{if(iv(t))return Sw;const e=t.state.status;return t.state=null,e===Vw?Dw(t,xw):vw},bb.deflateSetDictionary=(t,e)=>{let i=e.length;if(iv(t))return Sw;const n=t.state,s=n.wrap;if(2===s||1===s&&n.status!==Ew||n.lookahead)return Sw;if(1===s&&(t.adler=dw(t.adler,e,i,0)),n.wrap=0,i>=n.w_size){0===s&&(Uw(n.head),n.strstart=0,n.block_start=0,n.insert=0);let t=new Uint8Array(n.w_size);t.set(e.subarray(i-n.w_size,i),0),e=t,i=n.w_size}const r=t.avail_in,o=t.next_in,a=t.input;for(t.avail_in=i,t.next_in=0,t.input=e,Gw(n);n.lookahead>=3;){let t=n.strstart,e=n.lookahead-2;do{n.ins_h=qw(n,n.ins_h,n.window[t+3-1]),n.prev[t&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=t,t++}while(--e);n.strstart=t,n.lookahead=2,Gw(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,t.next_in=o,t.input=a,t.avail_in=r,n.wrap=s,vw},bb.deflateInfo="pako deflate (from Nodeca project)";var ov={};const av=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);ov.assign=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const e in i)av(i,e)&&(t[e]=i[e])}}return t},ov.flattenChunks=t=>{let e=0;for(let i=0,n=t.length;i=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;cv[254]=cv[254]=1,lv.string2buf=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,i,n,s,r,o=t.length,a=0;for(s=0;s>>6,e[r++]=128|63&i):i<65536?(e[r++]=224|i>>>12,e[r++]=128|i>>>6&63,e[r++]=128|63&i):(e[r++]=240|i>>>18,e[r++]=128|i>>>12&63,e[r++]=128|i>>>6&63,e[r++]=128|63&i);return e};lv.buf2string=(t,e)=>{const i=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let n,s;const r=new Array(2*i);for(s=0,n=0;n4)r[s++]=65533,n+=o-1;else{for(e&=2===o?31:3===o?15:7;o>1&&n1?r[s++]=65533:e<65536?r[s++]=e:(e-=65536,r[s++]=55296|e>>10&1023,r[s++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&hv)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let i="";for(let n=0;n{(e=e||t.length)>t.length&&(e=t.length);let i=e-1;for(;i>=0&&128==(192&t[i]);)i--;return i<0||0===i?e:i+cv[t[i]]>e?i:e};var uv=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const dv=bb,fv=ov,pv=lv,Ov=rw,gv=uv,mv=Object.prototype.toString,{Z_NO_FLUSH:bv,Z_SYNC_FLUSH:wv,Z_FULL_FLUSH:vv,Z_FINISH:yv,Z_OK:Sv,Z_STREAM_END:xv,Z_DEFAULT_COMPRESSION:kv,Z_DEFAULT_STRATEGY:Qv,Z_DEFLATED:$v}=ow;function Pv(t){this.options=fv.assign({level:kv,method:$v,chunkSize:16384,windowBits:15,memLevel:8,strategy:Qv},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new gv,this.strm.avail_out=0;let i=dv.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(i!==Sv)throw new Error(Ov[i]);if(e.header&&dv.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?pv.string2buf(e.dictionary):"[object ArrayBuffer]"===mv.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,i=dv.deflateSetDictionary(this.strm,t),i!==Sv)throw new Error(Ov[i]);this._dict_set=!0}}function Cv(t,e){const i=new Pv(e);if(i.push(t,!0),i.err)throw i.msg||Ov[i.err];return i.result}Pv.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize;let s,r;if(this.ended)return!1;for(r=e===~~e?e:!0===e?yv:bv,"string"==typeof t?i.input=pv.string2buf(t):"[object ArrayBuffer]"===mv.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),(r===wv||r===vv)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(s=dv.deflate(i,r),s===xv)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),s=dv.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===Sv;if(0!==i.avail_out){if(r>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},Pv.prototype.onData=function(t){this.chunks.push(t)},Pv.prototype.onEnd=function(t){t===Sv&&(this.result=fv.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},mb.Deflate=Pv,mb.deflate=Cv,mb.deflateRaw=function(t,e){return(e=e||{}).raw=!0,Cv(t,e)},mb.gzip=function(t,e){return(e=e||{}).gzip=!0,Cv(t,e)},mb.constants=ow;var _v={},Xv={};const Zv=16209;const Av=15,Tv=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Rv=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Ev=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Vv=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Mv=(t,e,i,n,s,r,o,a)=>{const l=a.bits;let h,c,u,d,f,p,O=0,g=0,m=0,b=0,w=0,v=0,y=0,S=0,x=0,k=0,Q=null;const $=new Uint16Array(16),P=new Uint16Array(16);let C,_,X,Z=null;for(O=0;O<=Av;O++)$[O]=0;for(g=0;g=1&&0===$[b];b--);if(w>b&&(w=b),0===b)return s[r++]=20971520,s[r++]=20971520,a.bits=1,0;for(m=1;m0&&(0===t||1!==b))return-1;for(P[1]=0,O=1;O852||2===t&&x>592)return 1;for(;;){C=O-y,o[g]+1=p?(_=Z[o[g]-p],X=Q[o[g]-p]):(_=96,X=0),h=1<>y)+c]=C<<24|_<<16|X|0}while(0!==c);for(h=1<>=1;if(0!==h?(k&=h-1,k+=h):k=0,g++,0==--$[O]){if(O===b)break;O=e[i+o[g]]}if(O>w&&(k&d)!==u){for(0===y&&(y=w),f+=m,v=O-y,S=1<852||2===t&&x>592)return 1;u=k&d,s[u]=w<<24|v<<16|f-r|0}}return 0!==k&&(s[f+k]=O-y<<24|64<<16|0),a.bits=w,0};const Dv=iw,Wv=sw,Uv=function(t,e){let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,y,S,x,k,Q;const $=t.state;i=t.next_in,k=t.input,n=i+(t.avail_in-5),s=t.next_out,Q=t.output,r=s-(e-t.avail_out),o=s+(t.avail_out-257),a=$.dmax,l=$.wsize,h=$.whave,c=$.wnext,u=$.window,d=$.hold,f=$.bits,p=$.lencode,O=$.distcode,g=(1<<$.lenbits)-1,m=(1<<$.distbits)-1;t:do{f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,0===w)Q[s++]=65535&b;else{if(!(16&w)){if(0==(64&w)){b=p[(65535&b)+(d&(1<>>=w,f-=w),f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,!(16&w)){if(0==(64&w)){b=O[(65535&b)+(d&(1<a){t.msg="invalid distance too far back",$.mode=Zv;break t}if(d>>>=w,f-=w,w=s-r,y>w){if(w=y-w,w>h&&$.sane){t.msg="invalid distance too far back",$.mode=Zv;break t}if(S=0,x=u,0===c){if(S+=l-w,w2;)Q[s++]=x[S++],Q[s++]=x[S++],Q[s++]=x[S++],v-=3;v&&(Q[s++]=x[S++],v>1&&(Q[s++]=x[S++]))}else{S=s-y;do{Q[s++]=Q[S++],Q[s++]=Q[S++],Q[s++]=Q[S++],v-=3}while(v>2);v&&(Q[s++]=Q[S++],v>1&&(Q[s++]=Q[S++]))}break}}break}}while(i>3,i-=v,f-=v<<3,d&=(1<(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function hy(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const cy=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode16211?1:0},uy=t=>{if(cy(t))return Nv;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Kv,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,Iv},dy=t=>{if(cy(t))return Nv;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,uy(t)},fy=(t,e)=>{let i;if(cy(t))return Nv;const n=t.state;return e<0?(i=0,e=-e):(i=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?Nv:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=i,n.wbits=e,dy(t))},py=(t,e)=>{if(!t)return Nv;const i=new hy;t.state=i,i.strm=t,i.window=null,i.mode=Kv;const n=fy(t,e);return n!==Iv&&(t.state=null),n};let Oy,gy,my=!0;const by=t=>{if(my){Oy=new Int32Array(512),gy=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Yv(1,t.lens,0,288,Oy,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Yv(2,t.lens,0,32,gy,0,t.work,{bits:5}),my=!1}t.lencode=Oy,t.lenbits=9,t.distcode=gy,t.distbits=5},wy=(t,e,i,n)=>{let s;const r=t.state;return null===r.window&&(r.wsize=1<=r.wsize?(r.window.set(e.subarray(i-r.wsize,i),0),r.wnext=0,r.whave=r.wsize):(s=r.wsize-r.wnext,s>n&&(s=n),r.window.set(e.subarray(i-n,i-n+s),r.wnext),(n-=s)?(r.window.set(e.subarray(i-n,i),0),r.wnext=n,r.whave=r.wsize):(r.wnext+=s,r.wnext===r.wsize&&(r.wnext=0),r.whavepy(t,15),Xv.inflateInit2=py,Xv.inflate=(t,e)=>{let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,y,S,x,k=0;const Q=new Uint8Array(4);let $,P;const C=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(cy(t)||!t.output||!t.input&&0!==t.avail_in)return Nv;i=t.state,i.mode===ey&&(i.mode=iy),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,u=a,d=l,x=Iv;t:for(;;)switch(i.mode){case Kv:if(0===i.wrap){i.mode=iy;break}for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0),h=0,c=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",i.mode=ay;break}if((15&h)!==Jv){t.msg="unknown compression method",i.mode=ay;break}if(h>>>=4,c-=4,S=8+(15&h),0===i.wbits&&(i.wbits=S),S>15||S>i.wbits){t.msg="invalid window size",i.mode=ay;break}i.dmax=1<>8&1),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16182;case 16182:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>8&255,Q[2]=h>>>16&255,Q[3]=h>>>24&255,i.check=Wv(i.check,Q,4,0)),h=0,c=0,i.mode=16183;case 16183:for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>8),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16184;case 16184:if(1024&i.flags){for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(f=i.length,f>a&&(f=a),f&&(i.head&&(S=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(n.subarray(r,r+f),S)),512&i.flags&&4&i.wrap&&(i.check=Wv(i.check,n,f,r)),a-=f,r+=f,i.length-=f),i.length))break t;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===a)break t;f=0;do{S=n[r+f++],i.head&&S&&i.length<65536&&(i.head.name+=String.fromCharCode(S))}while(S&&f>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=ey;break;case 16189:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>=7&c,c-=7&c,i.mode=oy;break}for(;c<3;){if(0===a)break t;a--,h+=n[r++]<>>=1,c-=1,3&h){case 0:i.mode=16193;break;case 1:if(by(i),i.mode=sy,e===zv){h>>>=2,c-=2;break t}break;case 2:i.mode=16196;break;case 3:t.msg="invalid block type",i.mode=ay}h>>>=2,c-=2;break;case 16193:for(h>>>=7&c,c-=7&c;c<32;){if(0===a)break t;a--,h+=n[r++]<>>16^65535)){t.msg="invalid stored block lengths",i.mode=ay;break}if(i.length=65535&h,h=0,c=0,i.mode=ny,e===zv)break t;case ny:i.mode=16195;case 16195:if(f=i.length,f){if(f>a&&(f=a),f>l&&(f=l),0===f)break t;s.set(n.subarray(r,r+f),o),a-=f,r+=f,l-=f,o+=f,i.length-=f;break}i.mode=ey;break;case 16196:for(;c<14;){if(0===a)break t;a--,h+=n[r++]<>>=5,c-=5,i.ndist=1+(31&h),h>>>=5,c-=5,i.ncode=4+(15&h),h>>>=4,c-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=ay;break}i.have=0,i.mode=16197;case 16197:for(;i.have>>=3,c-=3}for(;i.have<19;)i.lens[C[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,$={bits:i.lenbits},x=Yv(0,i.lens,0,19,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid code lengths set",i.mode=ay;break}i.have=0,i.mode=16198;case 16198:for(;i.have>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=g,c-=g,i.lens[i.have++]=b;else{if(16===b){for(P=g+2;c>>=g,c-=g,0===i.have){t.msg="invalid bit length repeat",i.mode=ay;break}S=i.lens[i.have-1],f=3+(3&h),h>>>=2,c-=2}else if(17===b){for(P=g+3;c>>=g,c-=g,S=0,f=3+(7&h),h>>>=3,c-=3}else{for(P=g+7;c>>=g,c-=g,S=0,f=11+(127&h),h>>>=7,c-=7}if(i.have+f>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=ay;break}for(;f--;)i.lens[i.have++]=S}}if(i.mode===ay)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=ay;break}if(i.lenbits=9,$={bits:i.lenbits},x=Yv(1,i.lens,0,i.nlen,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid literal/lengths set",i.mode=ay;break}if(i.distbits=6,i.distcode=i.distdyn,$={bits:i.distbits},x=Yv(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,$),i.distbits=$.bits,x){t.msg="invalid distances set",i.mode=ay;break}if(i.mode=sy,e===zv)break t;case sy:i.mode=ry;case ry:if(a>=6&&l>=258){t.next_out=o,t.avail_out=l,t.next_in=r,t.avail_in=a,i.hold=h,i.bits=c,Uv(t,d),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,i.mode===ey&&(i.back=-1);break}for(i.back=0;k=i.lencode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,i.length=b,0===m){i.mode=16205;break}if(32&m){i.back=-1,i.mode=ey;break}if(64&m){t.msg="invalid literal/length code",i.mode=ay;break}i.extra=15&m,i.mode=16201;case 16201:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;k=i.distcode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,64&m){t.msg="invalid distance code",i.mode=ay;break}i.offset=b,i.extra=15&m,i.mode=16203;case 16203:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=ay;break}i.mode=16204;case 16204:if(0===l)break t;if(f=d-l,i.offset>f){if(f=i.offset-f,f>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=ay;break}f>i.wnext?(f-=i.wnext,p=i.wsize-f):p=i.wnext-f,f>i.length&&(f=i.length),O=i.window}else O=s,p=o-i.offset,f=i.length;f>l&&(f=l),l-=f,i.length-=f;do{s[o++]=O[p++]}while(--f);0===i.length&&(i.mode=ry);break;case 16205:if(0===l)break t;s[o++]=i.length,l--,i.mode=ry;break;case oy:if(i.wrap){for(;c<32;){if(0===a)break t;a--,h|=n[r++]<{if(cy(t))return Nv;let e=t.state;return e.window&&(e.window=null),t.state=null,Iv},Xv.inflateGetHeader=(t,e)=>{if(cy(t))return Nv;const i=t.state;return 0==(2&i.wrap)?Nv:(i.head=e,e.done=!1,Iv)},Xv.inflateSetDictionary=(t,e)=>{const i=e.length;let n,s,r;return cy(t)?Nv:(n=t.state,0!==n.wrap&&n.mode!==ty?Nv:n.mode===ty&&(s=1,s=Dv(s,e,i,0),s!==n.check)?Gv:(r=wy(t,e,i,i),r?(n.mode=16210,Fv):(n.havedict=1,Iv)))},Xv.inflateInfo="pako inflate (from Nodeca project)";const vy=Xv,yy=ov,Sy=lv,xy=rw,ky=uv,Qy=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},$y=Object.prototype.toString,{Z_NO_FLUSH:Py,Z_FINISH:Cy,Z_OK:_y,Z_STREAM_END:Xy,Z_NEED_DICT:Zy,Z_STREAM_ERROR:Ay,Z_DATA_ERROR:Ty,Z_MEM_ERROR:Ry}=ow;function Ey(t){this.options=yy.assign({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ky,this.strm.avail_out=0;let i=vy.inflateInit2(this.strm,e.windowBits);if(i!==_y)throw new Error(xy[i]);if(this.header=new Qy,vy.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=Sy.string2buf(e.dictionary):"[object ArrayBuffer]"===$y.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(i=vy.inflateSetDictionary(this.strm,e.dictionary),i!==_y)))throw new Error(xy[i])}function Vy(t,e){const i=new Ey(e);if(i.push(t),i.err)throw i.msg||xy[i.err];return i.result}Ey.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize,s=this.options.dictionary;let r,o,a;if(this.ended)return!1;for(o=e===~~e?e:!0===e?Cy:Py,"[object ArrayBuffer]"===$y.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),r=vy.inflate(i,o),r===Zy&&s&&(r=vy.inflateSetDictionary(i,s),r===_y?r=vy.inflate(i,o):r===Ty&&(r=Zy));i.avail_in>0&&r===Xy&&i.state.wrap>0&&0!==t[i.next_in];)vy.inflateReset(i),r=vy.inflate(i,o);switch(r){case Ay:case Ty:case Zy:case Ry:return this.onEnd(r),this.ended=!0,!1}if(a=i.avail_out,i.next_out&&(0===i.avail_out||r===Xy))if("string"===this.options.to){let t=Sy.utf8border(i.output,i.next_out),e=i.next_out-t,s=Sy.buf2string(i.output,t);i.next_out=e,i.avail_out=n-e,e&&i.output.set(i.output.subarray(t,t+e),0),this.onData(s)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(r!==_y||0!==a){if(r===Xy)return r=vy.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},Ey.prototype.onData=function(t){this.chunks.push(t)},Ey.prototype.onEnd=function(t){t===_y&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=yy.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},_v.Inflate=Ey,_v.inflate=Vy,_v.inflateRaw=function(t,e){return(e=e||{}).raw=!0,Vy(t,e)},_v.ungzip=Vy,_v.constants=ow;const{Deflate:My,deflate:Dy,deflateRaw:Wy,gzip:Uy}=mb,{Inflate:Yy,inflate:qy,inflateRaw:Ly,ungzip:zy}=_v,Iy=ow;gb.Deflate=My,gb.deflate=Dy,gb.deflateRaw=Wy,gb.gzip=Uy,gb.Inflate=Yy,gb.inflate=qy,gb.inflateRaw=Ly,gb.ungzip=zy,gb.constants=Iy;const By=gb;let jy={};var Ny;function Gy(t){return Ny=t,[tS]}jy.Util={},jy.Decode={},jy.Messages=[],jy.Log=function(t){jy.Messages.push(["I",t]),console.log("Mma.js INFO: ",t)},jy.Warn=function(t){jy.Messages.push(["W",t]),console.log("Mma.js WARNING: ",t)},jy.Fail=function(t){throw jy.Messages.push(["E",t]),"Mma.js ERROR: "+t},jy.Util.Base64Decode=function(t){for(var e=atob(t),i=e.length>>>0,n=new Uint8Array(i),s=0;s1&&0===t[0]&&jy.Fail("IntegerAP: input starts with 0: "+String(t)),this.nstring=t}else void 0===t?this.nstring=void 0:jy.Fail("Integer: invalid input: "+String(t))},jy.RealMP=function(t){"number"==typeof t?this.n=t:void 0===t?this.n=void 0:jy.Fail("RealMP: invalid input")},jy.RealAP=function(t){"string"==typeof t?(t.length>1&&0===t[0]&&jy.Fail("RealAP: input starts with 0: "+String(t)),this.nstring=t):void 0===t?this.nstring=void 0:jy.Fail("RealAP: invalid input: "+String(t))},jy.Symbol=function(t){"string"==typeof t?this.name=t:void 0===t?this.name=void 0:jy.Fail("Symbol: invalid input: "+String(t))},jy.String=function(t){"string"==typeof t?this.str=t:void 0===t?this.str=void 0:jy.Fail("String: invalid input: "+String(t))},jy.Expression=function(t,e){t instanceof jy.Symbol||jy.Fail("Expression: head must be an Mma.Symbol"),e instanceof Array||jy.Fail("Expression: parts must be an Array"),this.head=t,this.parts=e},jy.Decode.Int32=function(t,e){try{return new DataView(t.buffer).getInt32(e,!0)}catch(t){return 0}},jy.Decode.Float64=function(t,e){try{return new DataView(t.buffer).getFloat64(e,!0)}catch(t){return 0}},jy.Decode.String=function(t,e,i){return void 0===e&&(e=0),void 0===i&&(i=t.length),jy.Util.U8ArrayToString(t.slice(e,e+i))},jy.Decode.StringEntry=function(t,e){void 0===e&&(e=0);var i=jy.Decode.Int32(t,e);return{length:i,string:jy.Decode.String(t,e+4,i),bytesRead:i+4}},jy.Decode.Any=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=1/0);var n=e;for(var s=0,r=[];ee%2!=0?t:{...t,body:Lm(t.body,/\(\*\|\*\)/gm)})),Array.isArray(this.args[this.args.length-1].body)||(this.decorator=this.args.pop());const r=this.args;console.log("creating InstanceWidget");for(let t=0;t{e.viewState.state.config.eval()},update:e=>this.applyChanges(e,t,i),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to&&!t.stringOnly)return i-2>=0?(o[i-2].editor.dispatch({selection:{anchor:o[i-2].editor.state.doc.length}}),o[i-2].editor.focus(),void(t.editorLastCursor=void 0)):(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0));t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to&&!t.stringOnly)return i+2=0)return r[t-2].body[i].editor.focus(),void(e.editorLastCursor=void 0)}},{key:"ArrowDown",run:function(e,n){if(t+2{},focus:()=>{},dispatch:()=>{},stringOnly:!0};const t=l.match(Fy);if(t){a.innerHTML=t[1];const e=jy.DecompressDecode(t[2]),i=jy.toArray(e.parts[0]),n=uuidv4();interpretate(i,{global:{call:n},element:a})}else a.innerHTML=l.slice(1,-1)}delete o[i].body,n.appendChild(a)}i.appendChild(n)}if(this.decorator){const t=jy.DecompressDecode(this.decorator.body.slice(2,-2)),e=jy.toArray(t.parts[0]);let n={global:{call:uuidv4(),EditorWidget:s},element:i};this.interpretated=interpretate(e,n)}}applyChanges(t,e,i){const n=this.args,s=this.args[e].body,r=this.visibleValue.argsPos,o=this.args[e].from;let a=t;0==i&&0==e&&(a="{{"+a),0==i&&0!=e&&(a="{"+a),i==s.length-1&&e==n.length-1&&(a+="}}"),i==s.length-1&&e!=n.length-1&&(a+="}");const l=s[i].length,h={from:r+o+s[i].from,to:r+o+s[i].from+l,insert:a},c=a.length-l;for(let t=i+1;t{s.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.args[0].body[0].editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.args[0].body[0].editor.focus();else{const t=this.DOMElement.EditorWidget.args,e=t[t.length-1].body[t[t.length-1].body.length-1].editor;e.dispatch({selection:{anchor:e.state.doc.length}}),e.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const Ky=(t,e)=>new Bm({tag:"GB",decoration:i=>ni.replace({widget:new Jy(i,t,e)})}),tS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=Ky(this.disposable,t).createDeco(t)}update(t){this.placeholder=Ky(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});function eS(t){return[rS]}let iS=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.span=i,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this,r=this.args[1].body.slice(3,-3),o=jy.DecompressDecode(r),a=jy.toArray(o.parts[0]);this.data=a;const l="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}));this.cuid=l;let h={call:l,EditorWidget:s},c={global:h,element:i};this.expression=a,this.env=c,this.interpretated=interpretate(a,c),this.interpretated.then((()=>{if(c.options?.Event){console.warn("Event listeners are enabled!"),s.events=c.options.Event;let t=c;if(h.stack){const e=Object.values(h.stack);e.length>0&&(console.log("Attaching first found instance..."),t=e[0].env)}interpretate(["MetaMarker","'"+l+"'"],t).then((()=>{server.kernel.emitt(s.events,'"'+l+'"',"Mounted")}))}}))}getDoc(){return this.args[0].body.slice(1,-1)}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+t+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].length=s.length,this.view.dispatch({changes:r})}applyOuterChanges(t){const e=this.visibleValue,i=t,n={from:e.pos,to:e.pos+e.length,insert:i};this.view.dispatch({changes:n})}update(t){if(!this.deactivated){if(t.str!=this.visibleValue.str){console.warn("Out of sync"),console.log("recreate..."),this.destroy();const e=this.span;return e.replaceChildren(),void this._construct(t,this.view,e)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}}destroy(t){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.events&&server.kernel.emitt(this.events,'"'+this.cuid+'"',"Destroy"),delete this.data}},nS=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=this;let i=document.createElement("span");return i.classList.add("frontend-view"),i.EditorWidget=new iS(this.visibleValue,t,i),this.reference.push({destroy:()=>{e.destroy(i)}}),i}ignoreEvent(){return!0}destroy(t){console.log("destroy in general*"),t.EditorWidget.destroy()}};const sS=(t,e)=>new Bm({tag:"VB",decoration:i=>ni.replace({widget:new nS(i,t,e)})}),rS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=sS(this.disposable,t).createDeco(t)}update(t){this.placeholder=sS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var oS;function aS(t){return oS=t,[uS]}let lS=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.span=i,this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this;this.epilog={offset:0,string:""},this.prolog={offset:0,string:""};const r=this.args[1].body.slice(3,-3),o=jy.DecompressDecode(r),a=jy.toArray(o.parts[0]);this.data=a;let l={global:{call:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)})),element:i,origin:s},element:i};this.env=l,interpretate(a,l).then((()=>{if(l.options?.Head&&(s.prolog.offset=l.options.Head.length+1,s.prolog.string=l.options.Head+"[",s.epilog.offset=1,s.epilog.string="]"),l.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=l.options.Event),l.options?.String){s.prolog.offset=1,s.prolog.string='"',s.epilog.offset=1,s.epilog.string='"',l.options?.HeadString&&(s.prolog.string=l.options.HeadString,s.prolog.offset=s.prolog.string.length),l.options?.TailString&&(s.epilog.string=l.options.TailString,s.epilog.offset=s.epilog.string.length),s.editor={destroy:()=>{console.log("Nothing to destroy, this is just a text field.")}};const t=document.createElement("span");return this.aa,t.onkeydown=function(t){13===t.keyCode&&t.preventDefault()},t.contentEditable="plaintext-only",t.innerText=s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),t.addEventListener("input",console.log),t.addEventListener("input",(()=>{console.log("Update"),console.log(t.innerText),this.applyChanges(t.innerText)})),l.global.element.appendChild(t),void(s.events&&server.kernel.emitt(s.events,"Null","Mounted"))}s.editor=oS({doc:s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),parent:l.global.element,update:t=>this.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos+s.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]}),s.events&&server.kernel.emitt(s.events,"Null","Mounted")}))}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+this.prolog.string+t+this.epilog.string+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length));const o=s.length-i[0].length;i[0].length=s.length,this.visibleValue.length=this.visibleValue.length+o,this.view.dispatch({changes:r})}update(t){if(this.visibleValue.str!=t.str)return console.warn("Out of sync"),console.log("recreating InstanceWidget"),this.destroy(),this.span.replaceChildren(),void this._construct(t,this.view,this.span);this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.editor.destroy(),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}},hS=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("subscript-tail"),e.EditorWidget=new lS(this.visibleValue,t,e,[]);const i=this;return this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const cS=(t,e)=>new Bm({tag:"BB",decoration:i=>ni.replace({widget:new hS(i,t,e)})}),uS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=cS(this.disposable,t).createDeco(t)}update(t){this.placeholder=cS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var dS;function fS(t){return dS=t,[mS]}class pS{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm);const s=this,r=Array.from({length:Math.ceil((s.args.length-3)/2)},((t,e)=>2*e+1));s.indexes=r;const o=[];this.span=i,this.spans=o;for(let t=0;t{c.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=c.options.Event),s.editors=r.map(((t,i)=>dS({doc:s.args[t].body,parent:o[i],update:e=>this.applyChanges(e,t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i>0?s.editors[i-1].focus():(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus()),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return it.destroy())),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}}class OS extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("inline-flex"),e.EditorWidget=new pS(this.visibleValue,t,e,[]);const i=this;return this.DOMElement=e,this.reference.push({destroy:()=>{i.destroy(e)}}),e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;const n=this.DOMElement.EditorWidget.editors;return t.from-e.from<0?(n[n.length-1].dispatch({selection:{anchor:n[n.length-1].state.doc.length}}),n[n.length-1].focus()):(n[0].dispatch({selection:{anchor:0}}),n[0].focus()),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}}const gS=(t,e)=>new Bm({tag:"TB",decoration:i=>ni.replace({widget:new OS(i,t,e)})}),mS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=gS(this.disposable,t).createDeco(t)}update(t){this.placeholder=gS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});const bS=_i.fromClass(class{decorations=ni.none;constructor(t){this.view=t,this.recompute()}recompute(t){let e,i,n=[];for(let{from:t,to:e}of this.view.visibleRanges)this.getDecorationsFor(t,e,n);this.decorations=ni.set(n,!0),this.decorations=this.decorations.update({filter:(n,s)=>!(n>e&&s=e&&s.selection.main.head<=i)return!0;if(!n&&s.selection.main.head>e&&s.selection.main.headt.decorations});class wS extends ei{constructor(t,e){super(),this.rawValue=t,this.visibleValue=e}eq(t){return this.rawValue===t.rawValue}toDOM(){let t=document.createElement("div");t.classList.add("cell-type-widget");const e=this.rawValue.split(" "),i=e[0].split(".");if(console.log(i),t.classList.add("cell-type-"+i[1].trim()),t.innerText=e[0].trim(),e.length>1){const n=e.slice(1),s=document.createElement("span");return s.appendChild(t),n.forEach((t=>{const e=document.createElement("span");e.innerText=t,e.classList.add("cell-type-"+i[1].trim()+"-"+t.split("=")[0]),s.appendChild(e)})),s}return t}ignoreEvent(){return!1}}const vS=new F,yS=new F,SS=[],xS=Sl.define([{tag:Sa.meta,color:"var(--editor-key-meta)"},{tag:Sa.link,textDecoration:"underline"},{tag:Sa.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Sa.emphasis,fontStyle:"italic"},{tag:Sa.strong,fontWeight:"bold"},{tag:Sa.strikethrough,textDecoration:"line-through"},{tag:Sa.keyword,color:"var(--editor-key-keyword)"},{tag:[Sa.atom,Sa.bool,Sa.url,Sa.contentSeparator,Sa.labelName],color:"var(--editor-key-atom)"},{tag:[Sa.literal,Sa.inserted],color:"var(--editor-key-literal)"},{tag:[Sa.string,Sa.deleted],color:"var(--editor-key-string)"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],color:"var(--editor-key-escape)"},{tag:Sa.definition(Sa.variableName),color:"var(--editor-key-variable)"},{tag:Sa.local(Sa.variableName),color:"var(--editor-local-variable)"},{tag:[Sa.typeName,Sa.namespace],color:"var(--editor-key-type)"},{tag:Sa.className,color:"var(--editor-key-class)"},{tag:[Sa.special(Sa.variableName),Sa.macroName],color:"var(--editor-special-variable)"},{tag:Sa.definition(Sa.propertyName),color:"var(--editor-key-property)"},{tag:Sa.comment,color:"var(--editor-key-comment)"},{tag:Sa.invalid,color:"var(--editor-key-invalid)"}]),kS={data:[],extend:t=>{kS.data.push(...t),Qm.reBuild(kS.data)},replaceAll:t=>{kS.data=t,Qm.reBuild(kS.data)}},QS=Gl.define({name:"spreadsheet",startState:function(){return{stringType:null,stack:[]}},token:function(t,e){if(t){switch(0===e.stack.length&&('"'!=t.peek()&&"'"!=t.peek()||(e.stringType=t.peek(),t.next(),e.stack.unshift("string"))),e.stack[0]){case"string":for(;"string"===e.stack[0]&&!t.eol();)t.peek()===e.stringType?(t.next(),e.stack.shift()):"\\"===t.peek()?(t.next(),t.next()):t.match(/^.[^\\\"\']*/);return"string";case"characterClass":for(;"characterClass"===e.stack[0]&&!t.eol();)t.match(/^[^\]\\]+/)||t.match(/^\\./)||e.stack.shift();return"operator"}var i=t.peek();switch(i){case"[":return t.next(),e.stack.unshift("characterClass"),"bracket";case":":return t.next(),"operator";case"\\":return t.match(/\\[a-z]+/)?"string.special":(t.next(),"atom");case".":case",":case";":case"*":case"-":case"+":case"^":case"<":case"/":case"=":return t.next(),"atom";case"$":return t.next(),"builtin"}return t.match(/\d+/)?t.match(/^\w+/)?"error":"number":t.match(/^[a-zA-Z_]\w*/)?t.match(/(?=[\(.])/,!1)?"keyword":"variable":-1!=["[","]","(",")","{","}"].indexOf(i)?(t.next(),"bracket"):(t.eatSpace()||t.next(),null)}}}),$S=new RegExp(/^[\w]*\.[\w]+/);function PS(t){const e=$S.exec(t),i=Object.values(window.SupportedLanguages);for(let t=0;t{if(!t.docChanged)return null;let e=PS(t.newDoc.line(1).text);if(e.legacy){const i=t.startState.facet(Wa);if(i){if(i.name==e.name)return null}else if(t.startState.facet(CS)==e.name)return null;return console.log("switching... to "+e.name),{effects:vS.reconfigure(e.plugins)}}return e.name===t.startState.facet(Wa).name?null:(console.log("switching... to "+e.name),{effects:vS.reconfigure(e.plugins)})}));let XS,ZS=null;const AS=t=>{const e=t||XS;return e&&e.viewState?(console.log(),PS(e.state.doc.line(1).text).name):""},TS=t=>{const e=t||XS;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return!1;const n=i[0];return[n.from,n.to]},RS=t=>{const e=t||XS;return e&&e.viewState?e.state.doc.toString():""},ES=t=>{const e=t||XS;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return"";const n=i[0];return console.log("yoko"),console.log(n),console.log(e.state.doc.toString().slice(n.from,n.to)),console.log("processing"),e.state.doc.toString().slice(n.from,n.to)},VS=(t,e)=>{const i=e||XS;if(!i)return;if(!i.viewState)return;const n=i.viewState.state.selection.ranges;if(!n.length)return;const s=n[0];console.log("result"),console.log(t),i.dispatch({changes:{...s,insert:t}})},MS=()=>XS,DS=(t,e)=>{const i=e||XS;i&&i.viewState&&(console.log("result"),console.log(t),i.dispatch({changes:{from:0,to:i.viewState.state.doc.length,insert:t}}))};ZS=t=>{let e=new Ts({doc:t.doc,extensions:[Ys.of([{key:"Tab",run:function(t,e){return sd(t)}},{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,zS,Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(XS=e.view)}))],parent:t.parent});return e.viewState.state.config.eval=t.eval,e},ZS.state=t=>{let e=xt.create({doc:t.doc,extensions:[Ys.of([{key:"Tab",run:function(t,e){return sd(t)}},{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,zS,Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(XS=e.view)}))]});return e.config.eval=t.eval,e};const WS=(t,e)=>{if(!t||e<=0)return[];const i=[];for(let n=0;n{if(console.log(e.dom.ocellref),XS=e,e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:DropEvent"]')}},file:(t,e,i,n,s)=>{if(e.dom.ocellref)if(s.length>5242880){const t=WS(s,5242880);t.forEach(((e,s)=>{server.emitt(i,`<|"Data"->"${e}", "Name"->"${n}", "Chunk"->${s+1}, "Chunks"->${t.length}|>`,"Chunk")}))}else server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},YS={transaction:(t,e,i,n)=>{if(console.log(e.dom.ocellref),e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:PasteEvent"]')}},file:(t,e,i,n,s)=>{if(console.log(e.dom.ocellref),e.dom.ocellref)if(s.length>5242880){const t=WS(s,5242880);t.forEach(((e,s)=>{server.emitt(i,`<|"Data"->"${e}", "Name"->"${n}", "Chunk"->${s+1}, "Chunks"->${t.length}|>`,"Chunk")}))}else server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},qS=[Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Cm(US,YS)];let LS=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"}}),zS=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"},".cm-scroller":{"line-height":"inherit","overflow-x":"overlay","overflow-y":"overlay","align-items":"initial"},".cm-content":{padding:"0px 0"},".rainbow-bracket-red":{color:"var(--editor-bracket-1)"},".rainbow-bracket-orange":{color:"var(--editor-bracket-2)"},".rainbow-bracket-yellow":{color:"var(--editor-bracket-3)"},".rainbow-bracket-green":{color:"var(--editor-bracket-4)"},".rainbow-bracket-blue":{color:"var(--editor-bracket-5)"},".rainbow-bracket-indigo":{color:"var(--editor-bracket-6)"},".rainbow-bracket-violet":{color:"var(--editor-bracket-7)"},".rainbow-bracket-red > span":{color:"var(--editor-bracket-1-a)"},".rainbow-bracket-orange > span":{color:"var(--editor-bracket-2-a)"},".rainbow-bracket-yellow > span":{color:"var(--editor-bracket-3-a)"},".rainbow-bracket-green > span":{color:"var(--editor-bracket-4-a)"},".rainbow-bracket-blue > span":{color:"var(--editor-bracket-5-a)"},".rainbow-bracket-indigo > span":{color:"var(--editor-bracket-6-a)"},".rainbow-bracket-violet > span":{color:"var(--editor-bracket-7-a)"}}),IS=!1;const BS=[()=>vr(),()=>Sh(),()=>ir(),()=>dr(),()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xS,{fallback:!1}),()=>tu()],jS={},NS=[()=>vr(),()=>Sh(),()=>ir(),()=>dr(),t=>GS.of(t),()=>jS.gutter?function(t={}){return[eo.of(t),jr(),so]}():[],()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xS,{fallback:!1}),()=>tu(),()=>bS,()=>function(t){return _i.fromClass(class{constructor(e){this.view=e,this.placeholder=ni.set([ni.widget({widget:new kr(t),side:1}).range(0)])}get decorations(){return this.view.state.doc.length?ni.none:this.placeholder}},{decorations:t=>t.decorations})}("Type WL Expression / .md / .js"),()=>xt.allowMultipleSelections.of(!0),(t,e)=>vS.of(e),()=>yS.of(xt.readOnly.of(!1)),()=>_S,()=>{return t?[ou.of(t),Yu]:Yu;var t},(t,e)=>Ys.of([{key:"Tab",run:function(t,e){const i=sd(t);return i||Rc(t)},shift:Ec},{key:"Backspace",run:function(e,i){if(0===e.state.doc.length)return t.origin.remove(),!0}},{key:"ArrowLeft",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus prev"),t.origin.focusPrev(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus next"),t.origin.focusNext(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"Shift-Enter",preventDefault:!0,run:function(e,i){console.log(e.state.doc.toString()),t.origin.eval(e.state.doc.toString())}},...Vc,...Wh,...Ru]),(t,e)=>Ts.updateListener.of((e=>{e.docChanged&&t.origin.save(encodeURIComponent(e.state.doc.toString())),e.selectionSet&&(XS=e.view)})),()=>LS];const GS=E.define();function FS(t){return t.replace(/\\\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\\\:/g,""),16))})).replaceAll("\\:F74E","I").replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))}function HS(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(t=>(+t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+t/4).toString(16)))}core.ReadOnly=()=>"ReadOnly",core.EditorView=async(t,e)=>{let i=await interpretate(t[0],e);i=FS(i),console.log("UNICODE Disaster");const n=await core._getRules(t,e);let s=()=>{},r=()=>{},o=i;const a=[];n.ReadOnly&&a.push(xt.readOnly.of(!0)),n.ForceUpdate&&(e.local.forceUpdate=n.ForceUpdate),n.Event&&(r=t=>{o=t,console.log("editor view emitt data: "+t),server.kernel.emitt(n.Event,'"'+t.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Input")},s=()=>{server.kernel.emitt(n.Event,'"'+o.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Evaluate")}),e.local?e.local.editor=ZS({doc:i,parent:e.element,eval:s,update:r,extensions:a}):ZS({doc:i,parent:e.element,eval:s,update:r,extensions:a}),e.element.style.verticalAlign="inherit"},core.StripOnInput=async()=>{},core.EditorView.update=async(t,e)=>{if(!e.local.editor)return;const i=FS(await interpretate(t[0],e));console.log("editor view: dispatch"),e.local.forceUpdate,e.local.editor.dispatch({changes:{from:0,to:e.local.editor.state.doc.length,insert:i}})},core.EditorView.destroy=async(t,e)=>{await interpretate(t[0],e),e.local&&e.local.editor&&e.local.editor.destroy()},core.EditorView.virtual=!0,core.PreviewCell=(t,e)=>{},window.SupportedLanguages.push({check:t=>null===t,legacy:!0,plugins:qS,name:"mathematica"}),window.SupportedLanguages.push({check:t=>null!=t[0].match(/\w+\.(wl|wls)$/),plugins:qS,legacy:!0,name:"mathematica"}),window.SupportedCells.codemirror={view:class{origin={};editor={};trash=[];forceFocusNext(){IS=!0}focus(t){t>0?this.editor.dispatch({selection:{anchor:0}}):t<0&&this.editor.dispatch({selection:{anchor:this.editor.state.doc.length}}),this.editor.focus()}setContent(t){if(console.warn("content mutation!"),!this.editor.viewState)return;const e=this.editor;console.log("result"),console.log(t),this.editor.dispatch({changes:{from:0,to:e.viewState.state.doc.length,insert:t}})}addDisposable(t){this.trash.push(t)}dispose(){this.editor.destroy()}readOnly(t){this.editor.dispatch({effects:yS.reconfigure(xt.readOnly.of(t))})}constructor(t,e){this.origin=t;const i=this.origin,n=PS(e).plugins,s=this;this.origin.element.ocellref=s;const r=new Ts({doc:(o=e,o.replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))),extensions:NS.map((t=>t(s,n))),parent:this.origin.element});var o;return this.editor=r,this.editor.dom.ocellref=s,this.editor.viewState.state.config.eval=()=>{i.eval(this.editor.state.doc.toString())},IS&&r.focus(),IS=!1,this}},context:{EditorAutocomplete:kS,javascriptLanguage:qf,javascript:Nf,markdownLanguage:rm,markdown:function(t={}){let{codeLanguages:e,defaultCodeLanguage:i,addKeymap:n=!0,base:{parser:s}=sm}=t;if(!(s instanceof Zp))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let r,o=t.extensions?[t.extensions]:[],a=[dm.support];i instanceof Ua?(a.push(i.support),r=i.language):i&&(r=i);let l=e||r?(h=e,c=r,t=>{if(t&&h){let e=null;if(t=/\S*/.exec(t)[0],e="function"==typeof h?h(t):Ya.matchLanguageName(h,t,!0),e instanceof Ya)return e.support?e.support.language.parser:Ta.getSkippingParser(e.load());if(e)return e.parser}return c?c.parser:null}):void 0;var h,c;return o.push(function(t){let{codeParser:e,htmlParser:i}=t,n=Do(((t,n)=>{let s=t.type.id;if(!e||s!=Kf.CodeBlock&&s!=Kf.FencedCode){if(i&&(s==Kf.HTMLBlock||s==Kf.HTMLTag))return{parser:i,overlay:rO(t.node,t.from,t.to)}}else{let i="";if(s==Kf.FencedCode){let e=t.node.getChild(Kf.CodeInfo);e&&(i=n.read(e.from,e.to))}let r=e(i);if(r)return{parser:r,overlay:t=>t.type.id==Kf.CodeText}}return null}));return{wrap:n}}({codeParser:l,htmlParser:dm.language.parser})),n&&a.push(N.high(Ys.of(um))),new Ua(nm(s.configure(o)),a)},htmlLanguage:jg,html:Ng,cssLanguage:kg,css:Qg,EditorView:Ts,EditorState:xt,highlightSpecialChars:vr,syntaxHighlighting:$l,defaultHighlightStyle:xS,editorCustomTheme:LS,foldGutter:function(t={}){let e=Object.assign(Object.assign({},wl),t),i=new vl(e,!0),n=new vl(e,!1),s=_i.fromClass(class{constructor(t){this.from=t.viewport.from,this.markers=this.buildMarkers(t)}update(t){(t.docChanged||t.viewportChanged||t.startState.facet(Wa)!=t.state.facet(Wa)||t.startState.field(dl,!1)!=t.state.field(dl,!1)||Xa(t.startState)!=Xa(t.state)||e.foldingChanged(t))&&(this.markers=this.buildMarkers(t.view))}buildMarkers(t){let e=new Xt;for(let s of t.viewportLineBlocks){let r=fl(t.state,s.from,s.to)?n:ll(t.state,s.from,s.to)?i:null;r&&e.add(s.from,s.from,r)}return e.finish()}}),{domEventHandlers:r}=e;return[s,Ir({class:"cm-foldGutter",markers(t){var e;return(null===(e=t.plugin(s))||void 0===e?void 0:e.markers)||_t.empty},initialSpacer:()=>new vl(e,!1),domEventHandlers:Object.assign(Object.assign({},r),{click:(t,e,i)=>{if(r.click&&r.click(t,e,i))return!0;let n=fl(t.state,e.from,e.to);if(n)return t.dispatch({effects:ul.of(n)}),!0;let s=ll(t.state,e.from,e.to);return!!s&&(t.dispatch({effects:cl.of(s)}),!0)}})}),ml()]},Facet:E,Compartment:F,mathematicaPlugins:qS,legacyLangNameFacet:CS,DropPasteHandlers:Cm,EditorExtensionsMinimal:BS,EditorParameters:jS,EditorExtensions:NS,StateField:q,StateEffect:ut,Decoration:ni,Prec:N,EditorSelection:A,keymap:Ys,ViewPlugin:_i,WidgetType:ei,originFacet:GS,MatchDecorator:pr}},window.OfflineMode&&SS.push(xt.readOnly.of(!0)),core.CellView=async(t,e)=>{const i=await core._getRules(t,e);i.Display||(i.Display="codemirror");const n=await interpretate(t[0],e),s={element:e.element,uid:HS()};i.Style&&(e.element.style=i.Style),i.Class&&e.element.classList.add(...i.Class.split(" ")),i.ImageSize&&(Array.isArray(i.ImageSize)?(e.element.style.width=i.ImageSize[0]+"px",e.element.style.height=i.ImageSize[1]+"px"):e.element.style.width=i.ImageSize+"px"),new window.SupportedCells[i.Display].view(s,n)};const JS={};core.FrontEditorSelected=async(t,e)=>{console.log("check");const i=await interpretate(t[0],e),n=await core._getRules(t,e);let s;switch(n.Editor&&(s=JS[n.Editor],console.log("Editor"),console.log(n.Editor),console.log(s)),i){case"Get":return ES(s);case"Set":let i=await interpretate(t[1],e);VS(i,s);break;case"GetDoc":return RS(s);case"SetDoc":let n=await interpretate(t[1],e);DS(n,s);break;case"Cursor":return TS(s);case"Type":return AS(s);case"Editor":const r=HS();return JS[r]=MS(),r}};window.SupportedCells.shell={view:class{dispose(){}constructor(t,e){this.origin=t;const i=document.createElement("div");return i.classList.add(..."flex sc-b max-h-60 text-sm overflow-y-scroll".split(" ")),i.style.overflowAnchor="auto",i.style.flexDirection="column-reverse",i.innerText=e,this.origin.element.appendChild(i),this}}}; +class t{constructor(){}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 a(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}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 l(n,o,i,r);n=o+1,i++}}decompose(t,i,r,o){let a=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(a.text,t.text.slice(),0,a.length);if(i.length<=32)r.push(new e(i,t.length+a.length));else{let t=i.length>>1;r.push(new e(i.slice(0,t)),new e(i.slice(t)))}}else r.push(a)}replace(t,r,o){if(!(o instanceof e))return super.replace(t,r,o);let a=n(this.text,n(o.text,s(this.text,0,t)),r),l=this.length+o.length-(r-t);return a.length<=32?new e(a,l):i.from(e.split(a,[]),l)}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=a+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,a=i+r.lines-1;if((e?a:o)>=t)return r.lineInner(t,e,i,n);n=o+1,i=a+1}}decompose(t,e,i,n){for(let s=0,r=0;r<=e&&s=r){let s=n&((r<=t?1:0)|(a>=e?2:0));r>=t&&a<=e&&!s?i.push(o):o.decompose(t-r,e-r,i,s)}r=a+1}}replace(t,e,n){if(n.lines=r&&e<=a){let l=o.replace(t-r,e-r,n),h=this.lines-o.lines+l.lines;if(l.lines>4&&l.lines>h>>6){let r=this.children.slice();return r[s]=l,new i(r,this.length-(e-t)+n.length)}return super.replace(r,a,l)}r=a+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=a+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,a]=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==a)return n;let i=this.children[s],l=t.children[r];if(i!=l)return n+i.scanIdentical(l,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,a=r>>1,l=[],h=0,c=-1,u=[];function d(t){let n;if(t.lines>o&&t instanceof i)for(let e of t.children)d(e);else t.lines>a&&(h>a||!h)?(f(),l.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&&f(),h+=t.lines,c+=t.length+1,u.push(t))}function f(){0!=h&&(l.push(1==u.length?u[0]:i.from(u,c)),c=-1,h=u.length=0)}for(let e of t)d(e);return f(),1==l.length?l[0]:new i(l,n)}}function n(t,e,i=0,n=1e9){for(let s=0,r=0,o=!0;r=i&&(l>n&&(a=a.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,a=s instanceof e?s.text.length:s.children.length;if(o==(i>0?a: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 a{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]=a.prototype[Symbol.iterator]=function(){return this});let l=class{constructor(t,e,i,n){this.from=t,this.to=e,this.number=i,this.text=n}get length(){return this.to-this.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,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 d=8205;function f(t,e,i=!0,n=!0){return(i?p:O)(t,e,n)}function p(t,e,i){if(e==t.length)return e;e&&g(t.charCodeAt(e))&&m(t.charCodeAt(e-1))&&e--;let n=b(t,e);for(e+=v(n);e=0&&u(b(t,n));)i++,n-=2;if(i%2==0)break;e+=2}}}return e}function O(t,e,i){for(;e>0;){let n=p(t,e-2,i);if(n=56320&&t<57344}function m(t){return t>=55296&&t<56320}function b(t,e){let i=t.charCodeAt(e);if(!m(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return g(n)?n-56320+(i-55296<<10)+65536:i}function w(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function v(t){return t<65536?1:2}const y=/\r\n?|\n/;var S=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(S||(S={}));class x{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;et)return s+(t-n);s+=o}else{if(i!=S.Simple&&l>=t&&(i==S.TrackDel&&nt||i==S.TrackBefore&&nt))return null;if(l>t||l==t&&e<0&&!o)return t==n||e<0?s:s+a;s+=a}n=l}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 x(t)}static create(t){return new x(t)}}class k extends x{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 P(this,((e,i,n,s,r)=>t=t.replace(n,n+(i-e),r)),!1),t}mapDesc(t,e=!1){return C(this,t,e,!0)}invert(e){let i=this.sections.slice(),n=[];for(let s=0,r=0;s=0){i[s]=a,i[s+1]=o;let l=s>>1;for(;n.length0&&$(i,e,s.text),s.forward(t),o+=t}let l=t[r++];for(;o>1].toJSON()))}return t}static of(e,i,n){let s=[],r=[],o=0,a=null;function l(t=!1){if(!t&&!s.length)return;oa||e<0||a>i)throw new RangeError(`Invalid change range ${e} to ${a} (in doc of length ${i})`);let u=c?"string"==typeof c?t.of(c.split(n||y)):c:t.empty,d=u.length;if(e==a&&0==d)return;eo&&Q(s,e-o,-1),Q(s,a-e,d),$(r,s,u),o=a}}(e),l(!a),a}static empty(t){return new k(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 $(e,i,n){if(0==n.length)return;let s=i.length-2>>1;if(s>1])),!(n||a==e.sections.length||e.sections[a+1]<0);)l=e.sections[a++],h=e.sections[a++];i(r,c,o,u,d),r=c,o=u}}}function C(t,e,i,n=!1){let s=[],r=n?[]:null,o=new X(t),a=new X(e);for(let t=-1;;)if(-1==o.ins&&-1==a.ins){let t=Math.min(o.len,a.len);Q(s,t,-1),o.forward(t),a.forward(t)}else if(a.ins>=0&&(o.ins<0||t==o.i||0==o.off&&(a.len=0&&t=0)){if(o.done&&a.done)return r?k.createSet(s,r):x.create(s);throw new Error("Mismatched change set lengths")}{let e=0,i=o.len;for(;i;)if(-1==a.ins){let t=Math.min(i,a.len);e+=t,i-=t,a.forward(t)}else{if(!(0==a.ins&&a.lene||o.ins>=0&&o.len>e)&&(t||n.length>i),r.forward2(e),o.forward(e)}}else Q(n,0,o.ins,t),s&&$(s,n,o.text),o.next()}}class X{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 Z{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 Z(i,n,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return A.range(t,e);let i=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return A.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 A.range(t.anchor,t.head)}static create(t,e,i){return new Z(t,e,i)}}class A{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:A.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 A(t.ranges.map((t=>Z.fromJSON(t))),t.main)}static single(t,e=t){return new A([A.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?A.range(o,r):A.range(r,o))}}return new A(t,e)}}function T(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let R=0;class E{constructor(t,e,i,n,s){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=n,this.id=R++,this.default=t([]),this.extensions="function"==typeof s?s(this):s}static define(t={}){return new E(t.combine||(t=>t),t.compareInput||((t,e)=>t===e),t.compare||(t.combine?(t,e)=>t===e:V),!!t.static,t.enables)}of(t){return new M([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new M(t,this,2,e)}from(t,e){return e||(e=t=>t),this.compute([t],(i=>e(i.field(t))))}}function V(t,e){return t==e||t.length==e.length&&t.every(((t,i)=>t===e[i]))}class M{constructor(t,e,i,n){this.dependencies=t,this.facet=e,this.type=i,this.value=n,this.id=R++}dynamicSlot(t){var e;let i=this.value,n=this.facet.compareInput,s=this.id,r=t[s]>>1,o=2==this.type,a=!1,l=!1,h=[];for(let i of this.dependencies)"doc"==i?a=!0:"selection"==i?l=!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(a&&e.docChanged||l&&(e.docChanged||e.selection)||W(t,h)){let e=i(t);if(o?!D(e,t.values[r],n):!n(e,t.values[r]))return t.values[r]=e,1}return 0},reconfigure:(t,e)=>{let a,l=e.config.address[s];if(null!=l){let s=tt(e,l);if(this.dependencies.every((i=>i instanceof E?e.facet(i)===t.facet(i):!(i instanceof q)||e.field(i,!1)==t.field(i,!1)))||(o?D(a=i(t),s,n):n(a=i(t),s)))return t.values[r]=s,0}else a=i(t);return t.values[r]=a,1}}}}function D(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 a(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(Y).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,Y.of({field:this,create:t})]}get extension(){return this}}const L=4,z=3,I=2,B=1;function j(t){return e=>new G(e,t)}const N={highest:j(0),high:j(B),default:j(I),low:j(z),lowest:j(L)};class G{constructor(t,e){this.inner=t,this.prec=e}}class F{of(t){return new H(this,t)}reconfigure(t){return F.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class H{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;function r(t,o){let a=s.get(t);if(null!=a){if(a<=o)return;let e=n[a].indexOf(t);e>-1&&n[a].splice(e,1),t instanceof H&&i.delete(t.compartment)}if(s.set(t,o),Array.isArray(t))for(let e of t)r(e,o);else if(t instanceof H){if(i.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");let n=e.get(t.compartment)||t.inner;i.set(t.compartment,n),r(n,o)}else if(t instanceof G)r(t.inner,t.prec);else if(t instanceof q)n[o].push(t),t.provides&&r(t.provides,o);else if(t instanceof M)n[o].push(t),t.facet.extensions&&r(t.facet.extensions,I);else{let e=t.extension;if(!e)throw new Error(`Unrecognized extension value in extension set (${t}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(e,o)}}return r(t,I),n.reduce(((t,e)=>t.concat(e)))}(t,e,r))i instanceof q?n.push(i):(s[i.facet.id]||(s[i.facet.id]=[])).push(i);let o=Object.create(null),a=[],l=[];for(let t of n)o[t.id]=l.length<<1,l.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]=a.length<<1|1,V(r,e))a.push(i.facet(n));else{let t=n.combine(e.map((t=>t.value)));a.push(i&&n.compare(t,i.facet(n))?i.facet(n):t)}else{for(let t of e)0==t.type?(o[t.id]=a.length<<1|1,a.push(t.value)):(o[t.id]=l.length<<1,l.push((e=>t.dynamicSlot(e))));o[n.id]=l.length<<1,l.push((t=>U(t,n,e)))}}let c=l.map((t=>t(o)));return new J(t,r,c,o,a,s)}}function K(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 tt(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}const et=E.define(),it=E.define({combine:t=>t.some((t=>t)),static:!0}),nt=E.define({combine:t=>t.length?t[0]:void 0,static:!0}),st=E.define(),rt=E.define(),ot=E.define(),at=E.define({combine:t=>!!t.length&&t[0]});class lt{constructor(t,e){this.type=t,this.value=e}static define(){return new ht}}class ht{of(t){return new lt(this,t)}}class ct{constructor(t){this.map=t}of(t){return new ut(this,t)}}class ut{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 ut(this.type,e)}is(t){return this.type==t}static define(t={}){return new ct(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}}ut.reconfigure=ut.define(),ut.appendConfig=ut.define();class dt{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&&T(i,e.newLength),s.some((t=>t.type==dt.time))||(this.annotations=s.concat(dt.time.of(Date.now())))}static create(t,e,i,n,s,r){return new dt(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(dt.userEvent);return!(!e||!(e==t||e.length>t.length&&e.slice(0,t.length)==t&&"."==e[t.length]))}}function ft(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=pt(n,Ot(e,r,t.changes.newLength),!0))}return n==t?t:dt.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(st)){let e=n(t);if(!1===e){i=!1;break}Array.isArray(e)&&(i=!0===i?e:ft(i,e))}if(!0!==i){let n,s;if(!1===i)s=t.changes.invertedDesc,n=k.empty(e.doc.length);else{let e=t.changes.filter(i);n=e.changes,s=e.filtered.mapDesc(e.changes).invertedDesc}t=dt.create(e,n,t.selection&&t.selection.map(s),ut.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let n=e.facet(rt);for(let i=n.length-1;i>=0;i--){let s=n[i](t);t=s instanceof dt?s:Array.isArray(s)&&1==s.length&&s[0]instanceof dt?s[0]:gt(e,bt(s),!1)}return t}(s):s)}dt.time=lt.define(),dt.userEvent=lt.define(),dt.addToHistory=lt.define(),dt.remote=lt.define();const mt=[];function bt(t){return null==t?mt:Array.isArray(t)?t:[t]}var wt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(wt||(wt={}));const vt=/[\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){}function St(t){return e=>{if(!/\S/.test(e))return wt.Space;if(function(t){if(yt)return yt.test(t);for(let e=0;e"€"&&(i.toUpperCase()!=i.toLowerCase()||vt.test(i)))return!0}return!1}(e))return wt.Word;for(let i=0;i-1)return wt.Word;return wt.Other}}class xt{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(ut.reconfigure)?(i=null,n=e.value):e.is(ut.appendConfig)&&(i=null,n=bt(n).concat(e.value));if(i)e=t.startState.values.slice();else{i=J.resolve(n,s,this),e=new xt(i,this.doc,this.selection,i.dynamicSlots.map((()=>null)),((t,e)=>e.reconfigure(t,this)),null).values}new xt(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:A.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=bt(i.effects);for(let i=1;is.spec.fromJSON(r,t))))}return xt.create({doc:t.doc,selection:A.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(xt.lineSeparator)||y)),s=e.selection?e.selection instanceof A?e.selection:A.single(e.selection.anchor,e.selection.head):A.single(0);return T(s,n.length),i.staticFacet(it)||(s=s.asSingle()),new xt(i,n,s,i.dynamicSlots.map((()=>null)),((t,e)=>e.create(t)),null)}get tabSize(){return this.facet(xt.tabSize)}get lineBreak(){return this.facet(xt.lineSeparator)||"\n"}get readOnly(){return this.facet(at)}phrase(t,...e){for(let e of this.facet(xt.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(et))for(let r of s(this,e,i))Object.prototype.hasOwnProperty.call(r,t)&&n.push(r[t]);return n}charCategorizer(t){return St(this.languageDataAt("wordChars",t).join(""))}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=f(e,r,!1);if(s(e.slice(t,r))!=wt.Word)break;r=t}for(;ot.length?t[0]:4}),xt.lineSeparator=nt,xt.readOnly=at,xt.phrases=E.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]))}}),xt.languageData=et,xt.changeFilter=st,xt.transactionFilter=rt,xt.transactionExtender=ot,F.reconfigure=ut.define();class Qt{eq(t){return this==t}range(t,e=t){return $t.create(t,e,this)}}Qt.prototype.startSide=Qt.prototype.endSide=0,Qt.prototype.point=!1,Qt.prototype.mapMode=S.TrackDel;let $t=class t{constructor(t,e,i){this.from=t,this.to=e,this.value=i}static create(e,i,n){return new t(e,i,n)}};function Pt(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Ct{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,a=s[n]-t||(i?this.value[n].endSide:this.value[n].startSide)-e;if(n==r)return a>=0?r:o;a>=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||l==h&&c.startSide>0&&c.endSide<=0)continue;(h-l||c.endSide-c.startSide)<0||(r<0&&(r=l),c.point&&(o=Math.max(o,h-l)),i.push(c),n.push(l-r),s.push(h-r))}return{mapped:i.length?new Ct(n,s,i,o):null,pos:r}}}class _t{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 _t(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(Pt)),this.isEmpty)return e.length?_t.of(e):this;let o=new At(this,null,-1).goto(0),a=0,l=[],h=new Xt;for(;o.value||a=0){let t=e[a++];h.addInner(t.from,t.to,t.value)||l.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 Tt.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return Tt.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)),a=Zt(r,o,i),l=new Et(r,a,s),h=new Et(o,a,s);i.iterGaps(((t,e,i)=>Vt(l,t,h,e,i,n))),i.empty&&0==i.length&&Vt(l,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=Zt(s,r),a=new Et(s,o,0).goto(i),l=new Et(r,o,0).goto(i);for(;;){if(a.to!=l.to||!Mt(a.active,l.active)||a.point&&(!l.point||!a.point.eq(l.point)))return!1;if(a.to>n)return!0;a.next(),l.next()}}static spans(t,e,i,n,s=-1){let r=new Et(t,null,s).goto(e),o=e,a=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,a),a=r.openEnd(t));if(r.to>i)return a+(r.point&&r.to>i?1:0);o=r.to,r.next()}}static of(t,e=!1){let i=new Xt;for(let n of t instanceof $t?[t]:e?function(t){if(t.length>1)for(let e=t[0],i=1;i0)return t.slice().sort(Pt);e=n}return t}(t):t)i.add(n.from,n.to,n.value);return i.finish()}}_t.empty=new _t([],[],null,-1),_t.empty.nextLayer=_t.empty;class Xt{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}finishChunk(t){this.chunks.push(new Ct(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=[])}add(t,e,i){this.addInner(t,e,i)||(this.nextLayer||(this.nextLayer=new Xt)).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(_t.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;let e=_t.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function Zt(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 At(r,e,i,s));return 1==n.length?n[0]:new Tt(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--)Rt(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--)Rt(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(),Rt(this.heap,0)}}}function Rt(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 Et{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=Tt.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){Dt(this.active,t),Dt(this.activeTo,t),Dt(this.activeRank,t),this.minActive=Ut(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&&Dt(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 Vt(t,e,i,n,s,r){t.goto(e),i.goto(n);let o=n+s,a=n,l=n-e;for(;;){let e=t.to+l-i.to||t.endSide-i.endSide,n=e<0?t.to+l: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))&&Mt(t.activeForPoint(t.to+l),i.activeForPoint(i.to))||r.comparePoint(a,s,t.point,i.point):s>a&&!Mt(t.active,i.active)&&r.compareRange(a,s,t.active,i.active),n>o)break;a=n,e<=0&&t.next(),e>=0&&i.next()}}function Mt(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 Ut(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(!l)throw new RangeError("The value of a property ("+i+") should be a primitive value.");s(n(i),o,a,h)}else null!=o&&a.push(i.replace(/_.*/,"").replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))+": "+o+";")}(a.length||h)&&r.push((!i||l||o?t:t.map(i)).join(", ")+" {"+a.join(" ")+"}")}for(let e in t)s(n(e),t[e],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let t=zt[qt]||1;return zt[qt]=t+1,"ͼ"+t.toString(36)}static mount(t,e){(t[Lt]||new jt(t)).mount(Array.isArray(e)?e:[e])}}let Bt=new Map;class jt{constructor(t){let e=t.ownerDocument||t,i=e.defaultView;if(!t.head&&t.adoptedStyleSheets&&i.CSSStyleSheet){let n=Bt.get(e);if(n)return t.adoptedStyleSheets=[n.sheet,...t.adoptedStyleSheets],t[Lt]=n;this.sheet=new i.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets],Bt.set(e,this)}else{this.styleTag=e.createElement("style");let i=t.head||t;i.insertBefore(this.styleTag,i.firstChild)}this.modules=[],t[Lt]=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:'"'},Ft="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),Ht="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Jt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Kt=Ht||Ft&&+Ft[1]<57,te=0;te<10;te++)Nt[48+te]=Nt[96+te]=String(te);for(te=1;te<=24;te++)Nt[te+111]="F"+te;for(te=65;te<=90;te++)Nt[te]=String.fromCharCode(te+32),Gt[te]=String.fromCharCode(te);for(var ee in Nt)Gt.hasOwnProperty(ee)||(Gt[ee]=Nt[ee]);function ie(t){let e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection()}function ne(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function se(t,e){if(!e.anchorNode)return!1;try{return ne(t,e.anchorNode)}catch(t){return!1}}function re(t){return 3==t.nodeType?me(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function oe(t,e,i,n){return!!i&&(le(t,e,i,n,-1)||le(t,e,i,n,1))}function ae(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function le(t,e,i,n,s){for(;;){if(t==i&&e==n)return!0;if(e==(s<0?0:he(t))){if("DIV"==t.nodeName)return!1;let i=t.parentNode;if(!i||1!=i.nodeType)return!1;e=ae(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?he(t):0}}}function he(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}const ce={left:0,right:0,top:0,bottom:0};function ue(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function de(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}class fe{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){this.set(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset)}set(t,e,i,n){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=n}}let pe,Oe=null;function ge(t){if(t.setActive)return t.setActive();if(Oe)return t.focus(Oe);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==Oe?{get preventScroll(){return Oe={preventScroll:!0},!0}}:void 0),!Oe){Oe=!1;for(let t=0;te)return i.domBoundsAround(t,e,l);if(c>=t&&-1==n&&(n=a,s=l),l>e&&i.dom.parentNode==this.dom){r=a,o=h;break}h=c,l=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.dirty|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.dirty|=2),1&e.dirty)return;e.dirty|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,this.dirty&&this.markParentsDirty(!0))}setDOM(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=ye){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 Qe(t,e,i,n,s,r,o,a,l){let{children:h}=t,c=h.length?h[e]:null,u=r.length?r[r.length-1]:null,d=u?u.breakAfter:o;if(!(e==n&&c&&!o&&!d&&r.length<2&&c.merge(i,s,r.length?u:null,0==i,a,l))){if(n0&&(!o&&r.length&&c.merge(i,c.length,r[0],!1,a,0)?c.breakAfter=r.shift().breakAfter:(i2);var De={mac:Me||/Mac/.test(Pe.platform),windows:/Win/.test(Pe.platform),linux:/Linux|X11/.test(Pe.platform),ie:Ae,ie_version:Xe?Ce.documentMode||6:Ze?+Ze[1]:_e?+_e[1]:0,gecko:Te,gecko_version:Te?+(/Firefox\/(\d+)/.exec(Pe.userAgent)||[0,0])[1]:0,chrome:!!Re,chrome_version:Re?+Re[1]:0,ios:Me,android:/Android\b/.test(Pe.userAgent),webkit:Ee,safari:Ve,webkit_version:Ee?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Ce.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class We extends Se{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(!i||i instanceof We&&!(this.length-(e-t)+i.length>256))&&(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),!0)}split(t){let e=new We(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new ve(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 Ye(this.dom,t,e)}}class Ue extends Se{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(we(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}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.dirty|=6)}sync(t,e){this.dom?4&this.dirty&&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 Ue&&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 Ue(this.mark,e,r)}domAtPos(t){return Ge(this,t)}coordsAt(t,e){return He(this,t,e)}}function Ye(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?De.chrome||De.gecko||(e?(s--,o=1):r=0)?0:a.length-1];return De.safari&&!o&&0==l.width&&(l=Array.prototype.find.call(a,(t=>t.width))||l),o?ue(l,o<0):l||null}class qe extends Se{constructor(t,e,i){super(),this.widget=t,this.length=e,this.side=i,this.prevWidget=null}static create(t,e,i){return new(t.customView||qe)(t,e,i)}split(t){let e=qe.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 qe&&this.widget.compare(i.widget))||t>0&&s<=0||e0)?ve.before(this.dom):ve.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let i=this.dom.getClientRects(),n=null;if(!i.length)return ce;for(let e=t>0?i.length-1:0;n=i[e],!(t>0?0==e:e==i.length-1||n.top0?-1:1);return this.length?n:ue(n,this.side>0)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class Le extends qe{domAtPos(t){let{topView:e,text:i}=this.widget;return e?ze(t,0,e,i,this.length-e.length,((t,e)=>t.domAtPos(e)),((t,e)=>new ve(t,Math.min(e,t.nodeValue.length)))):new ve(i,Math.min(t,i.nodeValue.length))}sync(){this.setDOM(this.widget.toDOM())}localPosFromDOM(t,e){let{topView:i,text:n}=this.widget;return i?Be(t,e,i,n,this.length-i.length):Math.min(e,this.length)}ignoreMutation(){return!1}get overrideDOMText(){return null}coordsAt(t,e){let{topView:i,text:n}=this.widget;return i?ze(t,e,i,n,this.length-i.length,((t,e,i)=>t.coordsAt(e,i)),((t,e,i)=>Ye(t,e,i))):Ye(n,t,e)}destroy(){var t;super.destroy(),null===(t=this.widget.topView)||void 0===t||t.destroy()}get isEditable(){return!0}canReuseDOM(){return!0}}function ze(t,e,i,n,s,r,o){if(i instanceof Ue){for(let a=i.dom.firstChild;a;a=a.nextSibling){let i=Se.get(a);if(i){let l=ne(a,n),h=i.length+(l?s:0);if(t0?ve.before(this.dom):ve.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){let e=this.dom.getBoundingClientRect(),i=function(t,e){let i=t.parent,n=i?i.children.indexOf(t):-1;for(;i&&n>=0;)if(e<0?n>0:n0?-1:1);return i&&i.tope.top?{left:e.left,right:e.right,top:i.top,bottom:i.bottom}:e}get overrideDOMText(){return t.empty}get isHidden(){return!0}}function Ge(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 Ue&&s.length&&(n=s[s.length-1])instanceof Ue&&n.mark.eq(e.mark)?Fe(n,e.children[0],i-1):(s.push(e),e.setParent(t)),t.length+=e.length}function He(t,e,i){let n=null,s=-1,r=null,o=-1;!function t(e,a){for(let l=0,h=0;l=a&&(c.children.length?t(c,a-h):(!r||r instanceof Ne&&i>0)&&(u>a||h==u&&c.getSide()>0)?(r=c,o=a-h):(h0?3e8:-4e8:e>0?1e8:-1e8,new oi(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}=ai(t,n);e=(s?n?-3e8:-1:5e8)-1,i=1+(r?n?2e8:1:-6e8)}return new oi(t,e,i,n,t.widget||null,!0)}static line(t){return new ri(t)}static set(t,e=!1){return _t.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}ni.none=_t.empty;class si extends ni{constructor(t){let{start:e,end:i}=ai(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){return this==t||t instanceof si&&this.tagName==t.tagName&&this.class==t.class&&Ke(this.attrs,t.attrs)}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}si.prototype.point=!1;class ri extends ni{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof ri&&this.spec.class==t.spec.class&&Ke(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)}}ri.prototype.mapMode=S.TrackBefore,ri.prototype.point=!0;class oi extends ni{constructor(t,e,i,n,s,r){super(e,i,s,t),this.block=n,this.isReplace=r,this.mapMode=n?e<=0?S.TrackBefore:S.TrackAfter:S.TrackDel}get type(){return this.startSide=5}eq(t){return t instanceof oi&&(e=this.widget,i=t.widget,e==i||!!(e&&i&&e.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var e,i}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 ai(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 li(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)}oi.prototype.point=!0;class hi extends Se{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 hi))return!1;this.dom||i.transferDOM(this)}return n&&this.setDeco(i?i.attrs:null),$e(this,t,e,i?i.children:[],s,r),!0}split(t){let e=new hi;if(e.breakAfter=this.breakAfter,0==this.length)return e;let{i: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){Ke(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){Fe(this,t,e)}addLineDeco(t){let e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=Je(e,this.attrs||{})),i&&(this.attrs=Je({class:i},this.attrs||{}))}domAtPos(t){return Ge(this,t)}reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.dirty|=6)}sync(t,e){var i;this.dom?4&this.dirty&&(we(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&&(ti(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&&Se.get(n)instanceof Ue;)n=n.lastChild;if(!(n&&this.length&&("BR"==n.nodeName||0!=(null===(i=Se.get(n))||void 0===i?void 0:i.isEditable)||De.ios&&this.children.some((t=>t instanceof We))))){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 We)||/[^ -~]/.test(i.text))return null;let n=re(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=He(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 hi)return s;if(r>e)break}n=r+s.breakAfter}return null}}class ci extends Se{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 ci&&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(di(new We(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 oi){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let o=e-t;if(i instanceof oi)if(i.block){let{type:t}=i;t!=ii.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new ci(i.widget||new fi("div"),o,t))}else{let r=qe.create(i.widget||new fi("span"),o,o?0:i.startSide),a=this.atCursorPos&&!r.isEditable&&s<=n.length&&(t0),l=!r.isEditable&&(tn.length||i.startSide<=0),h=this.getLine();2!=this.pendingBuffer||a||r.isEditable||(this.pendingBuffer=0),this.flushBuffer(n),a&&(h.append(di(new Ne(1),n),s),s=n.length+Math.max(0,s-n.length)),h.append(di(r,n),s),this.atCursorPos=l,this.pendingBuffer=l?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 ui(t,e,i,s);return r.openEnd=_t.spans(n,e,i,r),r.openStart<0&&(r.openStart=r.openEnd),r.finish(r.openEnd),r}}function di(t,e){for(let i of e)t=new Ue(i,[t],t.length);return t}class fi extends ei{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 pi=E.define(),Oi=E.define(),gi=E.define(),mi=E.define(),bi=E.define(),wi=E.define(),vi=E.define(),yi=E.define({combine:t=>t.some((t=>t))}),Si=E.define({combine:t=>t.some((t=>t))});class xi{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 xi(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin)}}const ki=ut.define({map:(t,e)=>t.map(e)});function Qi(t,e,i){let n=t.facet(mi);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 $i=E.define({combine:t=>!t.length||t[0]});let Pi=0;const Ci=E.define();class _i{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 _i(Pi++,t,i,(t=>{let e=[Ci.of(t)];return s&&e.push(Ti.of((e=>{let i=e.plugin(t);return i?s(i):ni.none}))),n&&e.push(n(t)),e}))}static fromClass(t,e){return _i.define((e=>new t(e)),e)}}class Xi{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(Qi(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){Qi(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){Qi(t.state,e,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Zi=E.define(),Ai=E.define(),Ti=E.define(),Ri=E.define(),Ei=E.define(),Vi=E.define();class Mi{constructor(t,e,i,n){this.fromA=t,this.toA=e,this.fromB=i,this.toB=n}join(t){return new Mi(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(!a)return i;new Mi(a.fromA,a.toA,a.fromB,a.toB).addToSet(i),r=a.toA,o=a.toB}}}class Di{constructor(t,e,i){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=k.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 Mi(t,e,i,s)))),this.changedRanges=n}static create(t,e,i){return new Di(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 Wi=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Wi||(Wi={}));const Ui=Wi.LTR,Yi=Wi.RTL;function qi(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}}const Gi=[];function Fi(t){return[new Ni(0,t,0)]}let Hi="";function Ji(t,e,i,n,s){var r;let o=n.head-t.from,a=-1;if(0==o){if(!s||!t.length)return null;e[0].level!=i&&(o=e[0].side(!1,i),a=0)}else if(o==t.length){if(s)return null;let t=e[e.length-1];t.level!=i&&(o=t.side(!0,i),a=e.length-1)}a<0&&(a=Ni.find(e,o,null!==(r=n.bidiLevel)&&void 0!==r?r:-1,n.assoc));let l=e[a];o==l.side(s,i)&&(l=e[a+=s?1:-1],o=l.side(!s,i));let h=s==(l.dir==i),c=f(t.text,o,h);if(Hi=t.text.slice(Math.min(o,c),Math.max(o,c)),c!=l.side(s,i))return A.cursor(c+t.from,h?-1:1,l.level);let u=a==(s?e.length-1:0)?null:e[a+(s?1:-1)];return u||l.level==i?u&&u.level1)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=Se.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 en(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}class nn{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class sn extends Se{constructor(t){super(),this.view=t,this.compositionDeco=ni.none,this.decorations=[],this.dynamicDecorationMap=[],this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(t.contentDOM),this.children=[new hi],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Mi(0,0,0,t.state.doc.length)],0)}get length(){return this.view.state.doc.length}update(t){let e=t.changedRanges;this.minWidth>0&&e.length&&(e.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),this.view.inputState.composing<0?this.compositionDeco=ni.none:(t.transactions.length||this.dirty)&&(this.compositionDeco=function(t,e){let i=on(t);if(!i)return ni.none;let{from:n,to:s,node:r,text:o}=i,a=e.mapPos(n,1),l=Math.max(a,e.mapPos(s,-1)),{state:h}=t,c=3==r.nodeType?r.nodeValue:new tn([],h).readRange(r.firstChild,null).text;if(l-a{this.dom.style.height=this.view.viewState.contentHeight+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let t=De.chrome||De.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,t),this.dirty=0,t&&(t.written||i.selectionRange.focusNode!=t.node)&&(this.forceSelection=!0),this.dom.style.height=""}));let n=[];if(this.view.viewport.from||this.view.viewport.to=0?t[e]:null;if(!n)break;let{fromA:s,toA:r,fromB:o,toB:a}=n,{content:l,breakAtStart:h,openStart:c,openEnd:u}=ui.build(this.view.state.doc,o,a,this.decorations,this.dynamicDecorationMap),{i:d,off:f}=i.findPos(r,1),{i:p,off:O}=i.findPos(s,-1);Qe(this,p,O,d,f,l,h,c,u)}}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&&se(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,a=this.domAtPos(o.anchor),l=o.empty?a:this.domAtPos(o.head);if(De.gecko&&o.empty&&!this.compositionDeco.size&&(1==(h=a).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((()=>a.node.insertBefore(t,a.node.childNodes[a.offset]||null))),a=l=new ve(t,0),r=!0}var h;let c=this.view.observer.selectionRange;!r&&c.focusNode&&oe(a.node,a.offset,c.anchorNode,c.anchorOffset)&&oe(l.node,l.offset,c.focusNode,c.focusOffset)||(this.view.observer.ignore((()=>{De.android&&De.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=ie(this.view.root);if(t)if(o.empty){if(De.gecko){let t=(e=a.node,n=a.offset,1!=e.nodeType?0:(n&&"false"==e.childNodes[n-1].contentEditable?1:0)|(no.head&&([a,l]=[l,a]),e.setEnd(l.node,l.offset),e.setStart(a.node,a.offset),t.removeAllRanges(),t.addRange(e)}else;var e,n;s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())})),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new ve(c.anchorNode,c.anchorOffset),this.impreciseHead=l.precise?null:new ve(c.focusNode,c.focusOffset)}enforceCursorAssoc(){if(this.compositionDeco.size)return;let{view:t}=this,e=t.state.selection.main,i=ie(t.root),{anchorNode:n,anchorOffset:s}=t.observer.selectionRange;if(!(i&&e.empty&&e.assoc&&i.modify))return;let r=hi.find(this,e.head);if(!r)return;let o=r.posAtStart;if(e.head==o||e.head==o+r.length)return;let a=this.coordsAt(e.head,-1),l=this.coordsAt(e.head,1);if(!a||!l||a.bottom>l.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)}nearest(t){for(let e=t;e;){let t=Se.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!=ii.WidgetBefore&&s.type!=ii.WidgetAfter&&(!n||2==e||this.children[n-1].breakAfter||this.children[n-1].type==ii.WidgetBefore&&e>-2))return s.coordsAt(t-r,e);i=r}}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,a=this.view.textDirection==Wi.LTR;for(let t=0,l=0;ln)break;if(t>=i){let i=h.dom.getBoundingClientRect();if(e.push(i.height),r){let e=h.dom.lastChild,n=e?re(e):[];if(n.length){let e=n[n.length-1],r=a?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?Wi.RTL:Wi.LTR}measureTextSize(){for(let t of this.children)if(t instanceof hi){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.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(n);let s=re(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 ke(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;t.push(ni.replace({widget:new rn(n),block:!0,inclusive:!0,isBlockGap:!0}).range(i,r))}if(!s)break;i=s.to+1}return ni.set(t)}updateDeco(){let t=this.view.state.facet(Ti).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=0,r=0,o=0,a=0;for(let t of this.view.state.facet(Ei).map((t=>t(this.view))))if(t){let{left:e,right:i,top:n,bottom:l}=t;null!=e&&(s=Math.max(s,e)),null!=i&&(r=Math.max(r,i)),null!=n&&(o=Math.max(o,n)),null!=l&&(a=Math.max(a,l))}let l={left:n.left-s,top:n.top-o,right:n.right+r,bottom:n.bottom+a};!function(t,e,i,n,s,r,o,a){let l=t.ownerDocument,h=l.defaultView||window;for(let c=t;c;)if(1==c.nodeType){let t,u=c==l.body;if(u)t=de(h);else{if(c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let e=c.getBoundingClientRect();t={left:e.left,right:e.left+c.clientWidth,top:e.top,bottom:e.top+c.clientHeight}}let d=0,f=0;if("nearest"==s)e.top0&&e.bottom>t.bottom+f&&(f=e.bottom-t.bottom+f+o)):e.bottom>t.bottom&&(f=e.bottom-t.bottom+o,i<0&&e.top-f0&&e.right>t.right+d&&(d=e.right-t.right+d+r)):e.right>t.right&&(d=e.right-t.right+r,i<0&&e.left0))break;i=i.childNodes[n-1],n=he(i)}if(i>=0)for(let n=t,s=e;;){if(3==n.nodeType)return n;if(!(1==n.nodeType&&s=0))break;n=n.childNodes[s],s=0}return null}class hn{constructor(){this.changes=[]}compareRange(t,e){li(t,e,this.changes)}comparePoint(t,e){li(t,e,this.changes)}}function cn(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function un(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function dn(t,e){return t.tope.top+1}function fn(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,a,l,h,c,u=!1;for(let d=t.firstChild;d;d=d.nextSibling){let t=re(d);for(let f=0;fg||o==g&&r>O){n=d,s=p,r=O,o=g;let a=g?i0?f0)}0==O?i>p.bottom&&(!h||h.bottomp.top)&&(l=d,c=p):h&&dn(h,p)?h=pn(h,p.bottom):c&&dn(c,p)&&(c=fn(c,p.top))}}if(h&&h.bottom>=i?(n=a,s=h):c&&c.top<=i&&(n=l,s=c),!n)return{node:t,offset:0};let d=Math.max(s.left,Math.min(s.right,e));return 3==n.nodeType?gn(n,d,i):u&&"false"!=n.contentEditable?On(n,d,i):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,n)+(e>=(s.left+s.right)/2?1:0)}}function gn(t,e,i){let n=t.nodeValue.length,s=-1,r=1e9,o=0;for(let a=0;ai?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(De.chrome||De.gecko){me(t,a).getBoundingClientRect().left==h.right&&(n=!i)}if(c<=0)return{node:t,offset:a+(n?1:0)};s=a+(n?1:0),r=c}}}return{node:t,offset:s>-1?s:o>0?t.nodeValue.length:0}}function mn(t,e,i,n=-1){var s,r;let o,a=t.contentDOM.getBoundingClientRect(),l=a.top+t.viewState.paddingTop,{docHeight:h}=t.viewState,{x:c,y:u}=e,d=u-l;if(d<0)return 0;if(d>h)return t.state.doc.length;for(let e=t.defaultLineHeight/2,s=!1;o=t.elementAtHeight(d),o.type!=ii.Text;)for(;d=n>0?o.bottom+e:o.top-e,!(d>=0&&d<=h);){if(s)return i?null:0;s=!0,n=-n}u=l+d;let f=o.from;if(ft.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:bn(t,a,o,c,u);let p=t.dom.ownerDocument,O=t.root.elementFromPoint?t.root:p,g=O.elementFromPoint(c,u);g&&!t.contentDOM.contains(g)&&(g=null),g||(c=Math.max(a.left+1,Math.min(a.right-1,c)),g=O.elementFromPoint(c,u),g&&!t.contentDOM.contains(g)&&(g=null));let m,b=-1;if(g&&0!=(null===(s=t.docView.nearest(g))||void 0===s?void 0:s.isEditable))if(p.caretPositionFromPoint){let t=p.caretPositionFromPoint(c,u);t&&({offsetNode:m,offset:b}=t)}else if(p.caretRangeFromPoint){let e=p.caretRangeFromPoint(c,u);e&&(({startContainer:m,startOffset:b}=e),(!t.contentDOM.contains(m)||De.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 me(t,n-1,n).getBoundingClientRect().left>i}(m,b,c)||De.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}let n=1==t.nodeType?t.getBoundingClientRect():me(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return i-n.left>5}(m,b,c))&&(m=void 0))}if(!m||!t.docView.dom.contains(m)){let e=hi.find(t.docView,f);if(!e)return d>o.top+o.height/2?o.to:o.from;({node:m,offset:b}=On(e.dom,c,u))}let w=t.docView.nearest(m);if(!w)return null;if(w.isWidget&&1==(null===(r=w.dom)||void 0===r?void 0:r.nodeType)){let t=w.dom.getBoundingClientRect();return e.y1.5*t.defaultLineHeight){r+=Math.floor((s-i.top)/t.defaultLineHeight)*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=f(t,n)}return!0===n?-1:t.length}(o,r,t.state.tabSize)}function wn(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=t.bidiSpans(s),o=t.textDirectionAt(s.from);for(let a=e,l=null;;){let e=Ji(s,r,o,a,i),h=Hi;if(!e){if(s.number==(i?t.state.doc.lines:1))return a;h="\n",s=t.state.doc.line(s.number+(i?1:-1)),r=t.bidiSpans(s),e=A.cursor(i?s.from:s.to)}if(l){if(!l(h))return a}else{if(!n)return e;l=n(h)}a=e}}function vn(t,e,i,n){let s=t.state.facet(Ri).map((e=>e(t)));for(;;){let t=!1;for(let r of s)r.between(i.from-1,i.from+1,((s,r,o)=>{i.from>s&&i.fromi.from?A.cursor(s,1):A.cursor(r,-1),t=!0,o.widget.skipPosition&&(i=o.widget.skipPosition(i,e,n)))}));if(!t)return i}}class yn{constructor(t){this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null;let e=(e,i)=>{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 Cn){let n=Cn[i];t.contentDOM.addEventListener(i,(i=>{Pn(t,i)&&e(n,i)}),_n[i]),this.registeredEvents.push(i)}t.scrollDOM.addEventListener("mousedown",(i=>{if(i.target==t.scrollDOM&&i.clientY>t.contentDOM.getBoundingClientRect().bottom&&(e(Cn.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)}})),De.chrome&&102==De.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,De.safari&&t.contentDOM.addEventListener("input",(()=>null))}setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}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=>{Pn(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){Qi(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){Qi(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||xn.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,be(t.contentDOM,e.key,e.keyCode))}ignoreDuringComposition(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(De.safari&&!De.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 Sn=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],xn="dthko",kn=[16,17,18,20,91,92,224,225];function Qn(t){return.7*Math.max(0,t)+8}class $n{constructor(t,e,i,n){this.view=t,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);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(xt.allowMultipleSelections)&&function(t,e){let i=t.state.facet(pi);return i.length?i[0](e):(De.mac,e.altKey)}(t,e),this.dragMove=function(t,e){let i=t.state.facet(Oi);return i.length?i[0](e):De.mac?!e.altKey:!e.ctrlKey}(t,e),this.dragging=!(!function(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let n=ie(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!=Yn(e))&&null}start(t){!1===this.dragging&&(t.preventDefault(),this.select(t))}move(t){var e;if(0==t.buttons)return this.destroy();if(!1!==this.dragging)return;this.select(this.lastEvent=t);let i=0,n=0,s=(null===(e=this.scrollParent)||void 0===e?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight};t.clientX<=s.left+6?i=-Qn(s.left-t.clientX):t.clientX>=s.right-6&&(i=Qn(t.clientX-s.right)),t.clientY<=s.top+6?n=-Qn(s.top-t.clientY):t.clientY>=s.bottom-6&&(n=Qn(t.clientY-s.bottom)),this.setScrollSpeed(i,n)}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)}select(t){let e=this.style.get(t,this.extend,this.multiple);!this.mustSelect&&e.eq(this.view.state.selection)&&e.main.assoc==this.view.state.selection.main.assoc||this.view.dispatch({selection:e,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.docChanged&&this.dragging&&(this.dragging=this.dragging.map(t.changes)),this.style.update(t)&&setTimeout((()=>this.select(this.lastEvent)),20)}}function Pn(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=Se.get(n))&&i.ignoreEvent(e))return!1;return!0}const Cn=Object.create(null),_n=Object.create(null),Xn=De.ie&&De.ie_version<15||De.ios&&De.webkit_version<604;function Zn(t,e){let i,{state:n}=t,s=1,r=n.toText(e),o=r.lines==n.selection.ranges.length;if(null!=Ln&&n.selection.ranges.every((t=>t.empty))&&Ln==r.toString()){let t=-1;i=n.changeByRange((i=>{let a=n.doc.lineAt(i.from);if(a.from==t)return{range:i};t=a.from;let l=n.toText((o?r.line(s++).text:e)+n.lineBreak);return{changes:{from:a.from,insert:l},range:A.cursor(i.from+l.length)}}))}else i=o?n.changeByRange((t=>{let e=r.line(s++);return{changes:{from:t.from,to:t.to,insert:e.text},range:A.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 A.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 A.cursor(e);0==r?i=1:r==s.length&&(i=-1);let o=r,a=r;i<0?o=f(s.text,r,!1):a=f(s.text,r);let l=n(s.text.slice(o,a));for(;o>0;){let t=f(s.text,o,!1);if(n(s.text.slice(t,o))!=l)break;o=t}for(;a{t.inputState.setSelectionOrigin("select"),27==e.keyCode&&(t.inputState.lastEscPress=Date.now())},Cn.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},Cn.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},_n.touchstart=_n.touchmove={passive:!0},Cn.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return;let i=null;for(let n of t.state.facet(gi))if(i=n(t,e),i)break;if(i||0!=e.button||(i=function(t,e){let i=Vn(t,e),n=Yn(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 a,l=Vn(t,e),h=An(t,l.pos,l.bias,n);if(i.pos!=l.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&&(a=function(t,e){for(let i=0;i=e)return A.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,l.pos))?a:o?s.addRange(h):A.create([h])}}}(t,e)),i){let n=t.root.activeElement!=t.contentDOM;t.inputState.startMouseSelection(new $n(t,e,i,n)),n&&t.observer.ignore((()=>ge(t.contentDOM))),t.inputState.mouseSelection&&t.inputState.mouseSelection.start(e)}};let Tn=(t,e)=>t>=e.top&&t<=e.bottom,Rn=(t,e,i)=>Tn(e,i)&&t>=i.left&&t<=i.right;function En(t,e,i,n){let s=hi.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&&Rn(i,n,o))return-1;let a=s.coordsAt(r,1);return a&&Rn(i,n,a)?1:o&&Tn(n,o)?-1:1}function Vn(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:En(t,i,e.clientX,e.clientY)}}const Mn=De.ie&&De.ie_version<=11;let Dn=null,Wn=0,Un=0;function Yn(t){if(!Mn)return t.detail;let e=Dn,i=Un;return Dn=t,Un=Date.now(),Wn=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Wn+1)%3:1}function qn(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&&r.dragMove?{from:r.dragging.from,to:r.dragging.to}:null,a={from:s,insert:i},l=t.state.changes(o?[o,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(s,-1),head:l.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"})}Cn.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")},Cn.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&&qn(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 qn(t,e,e.dataTransfer.getData("Text"),!0)},Cn.paste=(t,e)=>{if(t.state.readOnly)return e.preventDefault();t.observer.flush();let i=Xn?null:e.clipboardData;i?(Zn(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(),Zn(t,i.value)}),50)}(t)};let Ln=null;Cn.copy=Cn.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;Ln=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 zn=lt.define();function In(t,e){let i=[];for(let n of t.facet(vi)){let s=n(t,e);s&&i.push(s)}return i?t.update({effects:i,annotations:zn.of(!0)}):null}function Bn(t){setTimeout((()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=In(t.state,e);i?t.dispatch(i):t.update([])}}),10)}Cn.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),Bn(t)},Cn.blur=t=>{t.observer.clearSelectionRange(),Bn(t)},Cn.compositionstart=Cn.compositionupdate=t=>{null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},Cn.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,De.chrome&&De.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then((()=>t.observer.flush())):setTimeout((()=>{t.inputState.composing<0&&t.docView.compositionDeco.size&&t.update([])}),50)},Cn.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},Cn.beforeinput=(t,e)=>{var i;let n;if(De.chrome&&De.android&&(n=Sn.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 jn=["pre-wrap","normal","pre-line","break-spaces"];class Nn{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){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return jn.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i-1,a=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,a){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)>Jn&&(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:a,toA:l,fromB:h,toB:c}=n[o],u=s.lineAt(a,Hn.ByPosNoHeight,i.setDoc(e),0,0),d=u.to>=l?u:s.lineAt(l,Hn.ByPosNoHeight,i,0,0);for(c+=d.to-l,l=d.to;o>0&&u.from<=n[o-1].toA;)a=n[o-1].fromA,h=n[o-1].fromB,o--,a2*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 es extends ts{constructor(t,e){super(t,e,ii.Text),this.collapsed=0,this.widgetHeight=0}replace(t,e,i){let n=i[0];return 1==i.length&&(n instanceof es||n instanceof is&&4&n.flags)&&Math.abs(this.length-n.length)<10?(n instanceof is?n=new es(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.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class is 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:a}=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),l=o+r.length*a,h=Math.max(i,t-l/2);return new Fn(r.from,r.length,h,l,ii.Text)}{let n=Math.max(0,Math.min(r-s,Math.floor((t-i)/o))),{from:a,length:l}=e.doc.line(s+n);return new Fn(a,l,i+o*n,o,ii.Text)}}lineAt(t,e,i,n,s){if(e==Hn.ByHeight)return this.blockAt(t,i,n,s);if(e==Hn.ByPosNoHeight){let{from:e,to:n}=i.doc.lineAt(t);return new Fn(e,n-e,0,0,ii.Text)}let{firstLine:r,perLine:o,perChar:a}=this.heightMetrics(i,s),l=i.doc.lineAt(t),h=o+l.length*a,c=l.number-r,u=n+o*c+a*(l.from-s-c);return new Fn(l.from,l.length,Math.max(n,Math.min(u,n+this.height-h)),h,ii.Text)}forEachLine(t,e,i,n,s,r){t=Math.max(t,s),e=Math.min(e,s+this.length);let{firstLine:o,perLine:a,perChar:l}=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+=a*i+l*(t-s-i)}let n=a+l*e.length;r(new Fn(e.from,e.length,c,n,ii.Text)),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 is?i[i.length-1]=new is(t.length+n):i.push(null,new is(n-1))}if(t>0){let e=i[0];e instanceof is?i[0]=new is(t+e.length):i.unshift(new is(t-1),null)}return Kn.of(i)}decomposeLeft(t,e){e.push(new is(t-1),null)}decomposeRight(t,e){e.push(null,new is(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 is(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)>=Jn&&(o=-2);let a=new es(e,s);a.outdated=!1,i.push(a),r+=e+1}r<=s&&i.push(null,new is(s-r).updateHeight(t,r));let a=Kn.of(i);return(o<0||Math.abs(a.height-this.height)>=Jn||Math.abs(o-this.heightMetrics(t,e).perLine)>=Jn)&&(t.heightChanged=!0),a}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class ns 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 l;let h=e==Hn.ByPosNoHeight?Hn.ByPosNoHeight:Hn.ByPos;return a?l.join(this.right.lineAt(o,h,i,r,o)):this.left.lineAt(o,h,i,n,s).join(l)}forEachLine(t,e,i,n,s,r){let o=n+this.left.height,a=s+this.left.length+this.break;if(this.break)t=a&&this.right.forEachLine(t,e,i,o,a,r);else{let l=this.lineAt(a,Hn.ByPos,i,n,s);t=t&&l.from<=e&&r(l),e>l.to&&this.right.forEachLine(l.to+1,e,i,o,a,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&&ss(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,a=null;return n&&n.from<=e+s.length&&n.more?a=s=s.updateHeight(t,e,i,n):s.updateHeight(t,e,i),n&&n.from<=o+r.length&&n.more?a=r=r.updateHeight(t,o,i,n):r.updateHeight(t,o,i),a?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 ss(t,e){let i,n;null==t[e]&&(i=t[e-1])instanceof is&&(n=t[e+1])instanceof is&&t.splice(e-1,3,new is(i.length+1+n.length))}class rs{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 es?i.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new es(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)}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 es(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let i=new is(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 es)return t;let e=new es(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine(),t.type!=ii.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,t.type!=ii.WidgetBefore&&(this.covering=t)}addLineDeco(t,e){let i=this.ensureLine();i.length+=e,i.collapsed+=e,i.widgetHeight=Math.max(i.widgetHeight,t),this.writtenTo=this.pos=this.pos+e}finish(t){let e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof es||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),a=Math.max(a,n.top),l=e==t.parentNode?n.bottom:Math.min(l,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:a-(i.top+e),bottom:Math.max(a,l)-(i.top+e)}}function ls(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class hs{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 Nn(i),this.stateDeco=e.facet(Ti).filter((t=>"function"!=typeof t)),this.heightMap=Kn.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle.setDoc(e.doc),[new Mi(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ni.set(this.lineGaps.map((t=>t.draw(!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 ds(e,i))}}this.viewports=t.sort(((t,e)=>t.from-e.from)),this.scaler=this.heightMap.height<=7e6?gs:new ms(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:bs(t,this.scaler))}))}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=this.state.facet(Ti).filter((t=>"function"!=typeof t));let n=t.changedRanges,s=Mi.extendWithRanges(n,function(t,e,i){let n=new os;return _t.compare(t,e,i,n,0),n.changes}(i,this.stateDeco,t?t.changes:k.empty(this.state.doc.length))),r=this.heightMap.height;this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),s),this.heightMap.height!=r&&(t.flags|=2);let o=s.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.heado.to)||!this.viewportIsAppropriate(o))&&(o=this.getViewport(0,e));let a=!t.changes.empty||2&t.flags||o.from!=this.viewport.from||o.to!=this.viewport.to;this.viewport=o,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(Si)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let i=e.contentDOM,n=window.getComputedStyle(i),s=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Wi.RTL:Wi.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),a=i.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let h=0,c=0,u=parseInt(n.paddingTop)||0,d=parseInt(n.paddingBottom)||0;this.paddingTop==u&&this.paddingBottom==d||(this.paddingTop=u,this.paddingBottom=d,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let f=(this.printing?ls:as)(i,this.paddingTop),p=f.top-this.pixelViewport.top,O=f.bottom-this.pixelViewport.bottom;this.pixelViewport=f;let g=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(g!=this.inView&&(this.inView=g,g&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let m=a.width;if(this.contentDOMWidth==m&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,h|=8),l){let i=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(i)&&(o=!0),o||s.lineWrapping&&Math.abs(m-this.contentDOMWidth)>s.charWidth){let{lineHeight:t,charWidth:n,textHeight:a}=e.docView.measureTextSize();o=t>0&&s.refresh(r,t,n,a,m/n,i),o&&(e.docView.minWidth=0,h|=8)}p>0&&O>0?c=Math.max(p,O):p<0&&O<0&&(c=Math.min(p,O)),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 Mi(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new Gn(n.from,r))}s.heightChanged&&(h|=2)}let b=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return b&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(2&h||b)&&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,a=new ds(n.lineAt(r-1e3*i,Hn.ByHeight,s,0,0).from,n.lineAt(o+1e3*(1-i),Hn.ByHeight,s,0,0).to);if(e){let{head:t}=e.range;if(ta.to){let i,r=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=n.lineAt(t,Hn.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!=Wi.LTR&&!i)return[];let o=[],a=(n,r,l,h)=>{if(r-nn&&tt.from>=l.from&&t.to<=l.to&&Math.abs(t.from-n)t.frome))));if(!d){if(rt.from<=r&&t.to>=r))){let t=e.moveToLineBoundary(A.cursor(r),!1,!0).head;t>n&&(r=t)}d=new hs(n,r,this.gapSize(l,n,r,h))}o.push(d)};for(let t of this.viewportLines){if(t.lengtht.from&&a(t.from,s,t,e),ot.draw(this.heightOracle.lineWrapping)))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];_t.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))||bs(this.heightMap.lineAt(t,Hn.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return bs(this.heightMap.lineAt(this.scaler.fromDOM(t),Hn.ByHeight,this.heightOracle,0,0),this.scaler)}elementAtHeight(t){return bs(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 ds{constructor(t,e){this.from=t,this.to=e}}function fs(t,e,i){let n=[],s=t,r=0;return _t.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 Os(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 gs={toDOM:t=>t,fromDOM:t=>t,scale:1};class ms{constructor(t,e,i){let n=0,s=0,r=0;this.viewports=i.map((({from:i,to:s})=>{let r=e.lineAt(i,Hn.ByPos,t,0,0).top,o=e.lineAt(s,Hn.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=ebs(t,e))):t.type)}const ws=E.define({combine:t=>t.join(" ")}),vs=E.define({combine:t=>t.indexOf(!0)>-1}),ys=It.newName(),Ss=It.newName(),xs=It.newName(),ks={"&light":"."+Ss,"&dark":"."+xs};function Qs(t,e,i){return new It(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 $s=Qs("."+ys,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",borderRadius:"4px",marginTop:"0.5rem",width:"30%",minWidth:"190px",marginLeft:"auto",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&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:"#333338",fontSize:"70%",padding:".2em 1em",borderRadius:"4px"},"&light .cm-button":{background:"#eee"},"&dark .cm-button":{background:"#eee"},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",borderRadius:"0.25rem",border:"1px solid silver",padding:".0em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},ks);class Ps{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;i&&(e.push(new nn(i,n)),s==i&&r==n||e.push(new nn(s,r)));return e}(t),i=new tn(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?A.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||!ne(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||!ne(t.contentDOM,e.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(e.anchorNode,e.anchorOffset);this.newSel=A.single(n,i)}}}function Cs(e,i){let n,{newSel:s}=i,r=e.state.selection.main;if(i.bounds){let{from:s,to:o}=i.bounds,a=r.from,l=null;(8===e.inputState.lastKeyCode&&e.inputState.lastKeyTime>Date.now()-100||De.android&&i.text.length0&&a>0&&t.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if("end"==n){i-=o+Math.max(0,r-Math.min(o,a))-r}if(o=o?r-i:0,a=r+(a-o),o=r}else if(a=a?r-i:0,o=r+(o-a),a=r}return{from:r,toA:o,toB:a}}(e.state.doc.sliceString(s,o,Ki),i.text,a-s,l);h&&(De.chrome&&13==e.inputState.lastKeyCode&&h.toB==h.from+2&&i.text.slice(h.from,h.toB)==Ki+Ki&&h.toB--,n={from:s+h.from,to:s+h.toA,insert:t.of(i.text.slice(h.from,h.toB).split(Ki))})}else s&&(!e.hasFocus&&e.state.facet($i)||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))}:(De.mac||De.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=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}):De.chrome&&n&&n.from==n.to&&n.from==r.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(s&&(s=A.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}),n){let t=e.state;if(De.ios&&e.inputState.flushIOSKey(e))return!0;if(De.android&&(n.from==r.from&&n.to==r.to&&1==n.insert.length&&2==n.insert.lines&&be(e.contentDOM,"Enter",13)||n.from==r.from-1&&n.to==r.to&&0==n.insert.length&&be(e.contentDOM,"Backspace",8)||n.from==r.from&&n.to==r.to+1&&0==n.insert.length&&be(e.contentDOM,"Delete",46)))return!0;let i,o=n.insert.toString();if(e.state.facet(wi).some((t=>t(e,n.from,n.to,o))))return!0;if(e.inputState.composing>=0&&e.inputState.composing++,n.from>=r.from&&n.to<=r.to&&n.to-n.from>=(r.to-r.from)/3&&(!s||s.main.empty&&s.main.from==n.from+n.insert.length)&&e.inputState.composing<0){let s=r.fromn.to?t.sliceDoc(n.to,r.to):"";i=t.replaceSelection(e.state.toText(s+n.insert.sliceString(0,void 0,e.state.lineBreak)+o))}else{let o=t.changes(n),a=s&&s.main.to<=o.newLength?s.main:void 0;if(t.selection.ranges.length>1&&e.inputState.composing>=0&&n.to<=r.to&&n.to>=r.to-10){let s=e.state.sliceDoc(n.from,n.to),l=on(e)||e.state.doc.lineAt(r.head),h=r.to-n.to,c=r.to-r.from;i=t.changeByRange((i=>{if(i.from==r.from&&i.to==r.to)return{changes:o,range:a||i.map(o)};let u=i.to-h,d=u-s.length;if(i.to-i.from!=c||e.state.sliceDoc(d,u)!=s||l&&i.to>=l.from&&i.from<=l.to)return{range:i};let f=t.changes({from:d,to:u,insert:n.insert}),p=i.to-r.to;return{changes:f,range:a?A.range(Math.max(0,a.anchor+p),Math.max(0,a.head+p)):i.map(f)}}))}else i={changes:o,selection:a&&t.selection.replaceRange(a)}}let a="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,a+=".compose",e.inputState.compositionFirstChange&&(a+=".start",e.inputState.compositionFirstChange=!1)),e.dispatch(i,{scrollIntoView:!0,userEvent:a}),!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 _s={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Xs=De.ie&&De.ie_version<=11;class Zs{constructor(t){this.view=t,this.active=!1,this.selectionRange=new fe,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);(De.ie&&De.ie_version<=11||De.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()})),Xs&&(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")))}),{}),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($i)?i.root.activeElement!=this.dom:!se(i.dom,n))return;let s=n.anchorNode&&i.docView.nearest(n.anchorNode);s&&s.ignoreEvent(t)?e||(this.selectionChanged=!1):(De.ie&&De.ie_version<=11||De.android&&De.chrome)&&!i.state.selection.main.empty&&n.focusNode&&oe(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=De.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,a=t.docView.domAtPos(t.state.selection.main.anchor);oe(a.node,a.offset,r,o)&&([n,s,r,o]=[r,o,n,s]);return{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:o}}(this.view)||ie(t.root);if(!e||this.selectionRange.eq(e))return!1;let i=se(this.dom,e);return i&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let t=this.delayedAndroidKey;t&&(this.clearDelayedAndroidKey(),!this.flush()&&t.force&&be(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&&se(this.dom,this.selectionRange);return t<0&&!n?null:(t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new Ps(this.view,t,e,i))}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=Cs(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.dirty|=4),"childList"==t.type){let i=As(e,t.previousSibling||t.target.previousSibling,-1),n=As(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 As(t,e,i){for(;e;){let n=Se.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 Ts{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),this._dispatch=t.dispatch||(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 us(t.state||xt.create(t)),this.plugins=this.state.facet(Ci).map((t=>new Xi(t)));for(let t of this.plugins)t.update(this);this.observer=new Zs(this),this.inputState=new yn(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new sn(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),t.parent&&t.parent.appendChild(this.dom)}get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}dispatch(...t){this._dispatch(1==t.length&&t[0]instanceof dt?t[0]:this.state.update(...t))}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,a=null;t.some((t=>t.annotation(zn)))?(this.inputState.notifiedFocused=r,o=1):r!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=r,a=In(s,r),a||(o=1));let l=this.observer.delayedAndroidKey,h=null;if(l?(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(xt.phrases)!=this.state.facet(xt.phrases))return this.setState(s);e=Di.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 xi(t.empty?t:A.cursor(t.head,t.head>t.anchor?-1:1))}for(let t of e.effects)t.is(ki)&&(c=t.value)}this.viewState.update(e,c),this.bidiCache=Vs.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),i=this.docView.update(e),this.state.facet(Vi)!=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(ws)!=e.state.facet(ws)&&(this.viewState.mustMeasureContent=!0),(i||n||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!e.empty)for(let t of this.state.facet(bi))t(e);(a||h)&&Promise.resolve().then((()=>{a&&this.state==a.startState&&this.dispatch(a),h&&!Cs(this,h)&&l.force&&be(this.contentDOM,l.key,l.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 us(t),this.plugins=t.facet(Ci).map((t=>new Xi(t))),this.pluginMap.clear();for(let t of this.plugins)t.update(this);this.docView=new sn(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(Ci),i=t.state.facet(Ci);if(e!=i){let n=[];for(let s of i){let i=e.indexOf(s);if(i<0)n.push(new Xi(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.measureScheduled=0,t&&this.observer.forceFlush();let e=null,{scrollHeight:i,scrollTop:n,clientHeight:s}=this.scrollDOM,r=n>i-s-4?i:n;try{for(let t=0;;t++){this.updateState=1;let i=this.viewport,n=this.viewState.lineBlockAtHeight(r),s=this.viewState.measure(this);if(!s&&!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 o=[];4&s||([this.measureRequests,o]=[o,this.measureRequests]);let a=o.map((t=>{try{return t.read(this)}catch(t){return Qi(this.state,t),Es}})),l=Di.create(this,this.state,[]),h=!1,c=!1;l.flags|=s,e?e.flags|=s:e=l,this.updateState=2,l.empty||(this.updatePlugins(l),this.inputState.update(l),this.updateAttrs(),h=this.docView.update(l));for(let t=0;t1||t<-1)&&(this.scrollDOM.scrollTop+=t,c=!0)}if(h&&this.docView.updateSelection(!0),this.viewport.from==i.from&&this.viewport.to==i.to&&!c&&0==this.measureRequests.length)break}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let t of this.state.facet(bi))t(e)}get themeClasses(){return ys+" "+(this.state.facet(vs)?xs:Ss)+" "+this.state.facet(ws)}updateAttrs(){let t=Ms(this,Zi,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet($i)?"true":"false",class:"cm-content",style:`${De.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Ms(this,Ai,e);let i=this.observer.ignore((()=>{let i=ti(this.contentDOM,this.contentAttrs,e),n=ti(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)if(t.is(Ts.announce)){e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(Vi),It.mount(this.root,this.styleModules.concat($s).reverse())}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}}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 vn(this,t,wn(this,t,e,i))}moveByCharSelected(t,e,i){return vn(this,t,wn(this,t,e,i),!0)}moveByGroup(t,e){return vn(this,t,wn(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==wt.Space&&(s=e),s==e}}(this,t.head,e))))}moveToLineBoundary(t,e,i=!0){return function(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=n&&t.lineWrapping?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==Wi.LTR)?e.right-1:e.left+1,y:(r.top+r.bottom)/2});if(null!=o)return A.cursor(o,i?-1:1)}let o=hi.find(t.docView,e.head),a=o?i?o.posAtEnd:o.posAtStart:i?s.to:s.from;return A.cursor(a,i?-1:1)}(this,t,e,i)}moveVertically(t,e,i){return vn(this,t,function(t,e,i,n){let s=e.head,r=i?1:-1;if(s==(i?t.state.doc.length:0))return A.cursor(s,e.assoc);let o,a=e.goalColumn,l=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s),c=t.documentTop;if(h)null==a&&(a=h.left-l.left),o=r<0?h.top:h.bottom;else{let e=t.viewState.lineBlockAt(s);null==a&&(a=Math.min(l.right-l.left,t.defaultCharacterWidth*(s-e.from))),o=(r<0?e.top:e.bottom)+c}let u=l.left+a,d=null!=n?n:t.defaultLineHeight>>1;for(let i=0;;i+=10){let n=o+(d+i)*r,h=mn(t,{x:u,y:n},!1,r);if(nl.bottom||(r<0?hs))return A.cursor(h,e.assoc,void 0,a)}}(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(),mn(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 ue(i,s[Ni.find(s,t-n.from,-1,e)].dir==Wi.LTR==e>0)}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(yi)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Rs)return Fi(t.length);let e=this.textDirectionAt(t.from);for(let i of this.bidiCache)if(i.from==t.from&&i.dir==e)return i.order;let i=function(t,e){let i=t.length,n=e==Ui?1:2,s=e==Ui?2:1;if(!t||1==n&&!ji.test(t))return Fi(i);for(let e=0,s=n,o=n;e=0;t-=3)if(Bi[t+1]==-r){let e=Bi[t+2],i=2&e?n:4&e?1&e?s:n:0;i&&(Gi[a]=Gi[Bi[t]]=i),l=t;break}}else{if(189==Bi.length)break;Bi[l++]=a,Bi[l++]=e,Bi[l++]=h}else if(2==(o=Gi[a])||1==o){let t=o==n;h=t?0:1;for(let e=l-3;e>=0;e-=3){let i=Bi[e+2];if(2&i)break;if(t)Bi[e+2]|=2;else{if(4&i)break;Bi[e+2]|=4}}}for(let t=0;te;){let t=i,n=2!=Gi[--i];for(;i>e&&n==(2!=Gi[i-1]);)i--;o.push(new Ni(i,t,n?2:1))}else o.push(new Ni(e,t,0))}else for(let t=0;tDate.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{ge(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 ki.of(new xi("number"==typeof t?A.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}static domEventHandlers(t){return _i.define((()=>({})),{eventHandlers:t})}static theme(t,e){let i=It.newName(),n=[ws.of(i),Vi.of(Qs(`.${i}`,t))];return e&&e.dark&&n.push(vs.of(!0)),n}static baseTheme(t){return N.lowest(Vi.of(Qs("."+ys,t,ks)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),n=i&&Se.get(i)||Se.get(t);return(null===(e=null==n?void 0:n.rootView)||void 0===e?void 0:e.view)||null}}Ts.styleModule=Vi,Ts.inputHandler=wi,Ts.focusChangeEffect=vi,Ts.perLineTextDirection=yi,Ts.exceptionSink=mi,Ts.updateListener=bi,Ts.editable=$i,Ts.mouseSelectionStyle=gi,Ts.dragMovesSelection=Oi,Ts.clickAddsSelectionRange=pi,Ts.decorations=Ti,Ts.atomicRanges=Ri,Ts.scrollMargins=Ei,Ts.darkTheme=vs,Ts.contentAttributes=Ai,Ts.editorAttributes=Zi,Ts.lineWrapping=Ts.contentAttributes.of({class:"cm-lineWrapping"}),Ts.announce=ut.define();const Rs=4096,Es={};class Vs{constructor(t,e,i,n){this.from=t,this.to=e,this.dir=i,this.order=n}static update(t,e){if(e.empty)return t;let i=[],n=t.length?t[t.length-1].dir:Wi.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&&Je(r,i)}return i}const Ds=De.mac?"mac":De.windows?"win":De.linux?"linux":"key";function Ws(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 Us=N.default(Ts.domEventHandlers({keydown:(t,e)=>Bs(Ls(e.state),t,e,"editor")})),Ys=E.define({enables:Us}),qs=new WeakMap;function Ls(t){let e=t.facet(Ys),i=qs.get(e);return i||qs.set(e,i=function(t,e=Ds){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)=>{var a,l;let h=i[t]||(i[t]=Object.create(null)),c=n.split(/ (?!$)/).map((t=>function(t,e){const i=t.split(/-(?!$)/);let n,s,r,o,a=i[i.length-1];"Space"==a&&(a=" ");for(let t=0;t{let n=zs={view:e,prefix:i,scope:t};return setTimeout((()=>{zs==n&&(zs=null)}),Is),!0}]})}let u=c.join(" ");s(u,!1);let d=h[u]||(h[u]={preventDefault:!1,run:(null===(l=null===(a=h._any)||void 0===a?void 0:a.run)||void 0===l?void 0:l.slice())||[]});r&&d.run.push(r),o&&(d.preventDefault=!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,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.shift&&r(e,"Shift-"+s,n.shift,n.preventDefault)}return i}(e.reduce(((t,e)=>t.concat(e)),[]))),i}let zs=null;const Is=4e3;function Bs(t,e,i,n){let s=function(t){var e=!(Kt&&(t.ctrlKey||t.altKey||t.metaKey)||Jt&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?Gt:Nt)[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=v(b(s,0))==s.length&&" "!=s,o="",a=!1;zs&&zs.view==i&&zs.scope==n&&(o=zs.prefix+" ",(a=kn.indexOf(e.keyCode)<0)&&(zs=null));let l,h,c=new Set,u=t=>{if(t){for(let n of t.run)if(!c.has(n)&&(c.add(n),n(i,e)))return!0;t.preventDefault&&(a=!0)}return!1},d=t[n];if(d){if(u(d[o+Ws(s,e,!r)]))return!0;if(r&&(e.altKey||e.metaKey||e.ctrlKey)&&!(De.windows&&e.ctrlKey&&e.altKey)&&(l=Nt[e.keyCode])&&l!=s){if(u(d[o+Ws(l,e,!0)]))return!0;if(e.shiftKey&&(h=Gt[e.keyCode])!=s&&h!=l&&u(d[o+Ws(h,e,!1)]))return!0}else if(r&&e.shiftKey&&u(d[o+Ws(s,e,!0)]))return!0;if(u(d._any))return!0}return a}class js{constructor(t,e,i,n,s){this.className=t,this.left=e,this.top=i,this.width=n,this.height=s}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className==this.className&&(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",null!=this.width&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,i){if(i.empty){let n=t.coordsAtPos(i.head,i.assoc||1);if(!n)return[];let s=Ns(t);return[new js(e,n.left-s.left,n.top-s.top,null,n.bottom-n.top)]}return function(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];let n=Math.max(i.from,t.viewport.from),s=Math.min(i.to,t.viewport.to),r=t.textDirection==Wi.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=Ns(t),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),u=a.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),d=a.right-(c?parseInt(c.paddingRight):0),f=Fs(t,n),p=Fs(t,s),O=f.type==ii.Text?f:null,g=p.type==ii.Text?p:null;t.lineWrapping&&(O&&(O=Gs(t,n,O)),g&&(g=Gs(t,s,g)));if(O&&g&&O.from==g.from)return b(w(i.from,i.to,O));{let e=O?w(i.from,null,O):v(f,!1),n=g?w(null,i.to,g):v(p,!0),s=[];return(O||f).to<(g||p).from-1?s.push(m(u,e.bottom,d,n.top)):e.bottomh&&n.from=r)break;a>s&&l(Math.max(t,s),null==e&&t<=h,Math.min(a,r),null==i&&a>=c,o.dir)}if(s=n.to+1,s>=r)break}return 0==a.length&&l(h,null==e,c,null==i,t.textDirection),{top:s,bottom:o,horizontal:a}}function v(t,e){let i=a.top+(e?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]}}}(t,e,i)}}function Ns(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Wi.LTR?e.left:e.right-t.scrollDOM.clientWidth)-t.scrollDOM.scrollLeft,top:e.top-t.scrollDOM.scrollTop}}function Gs(t,e,i){let n=A.cursor(e);return{from:Math.max(i.from,t.moveToLineBoundary(n,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(n,!0,!0).from),type:ii.Text}}function Fs(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==ii.Text))return t;return i}class Hs{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),e.above&&this.dom.classList.add("cm-layer-above"),e.class&&this.dom.classList.add(e.class),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(Js)!=t.state.facet(Js)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&t.view.requestMeasure(this.measureReq)}setOrder(t){let e=0,i=t.facet(Js);for(;e{return i=t,n=this.drawn[e],!(i.constructor==n.constructor&&i.eq(n));var i,n}))){let e=this.dom.firstChild,i=0;for(let n of t)n.update&&e&&n.constructor&&this.drawn[i].constructor&&n.update(e,this.drawn[i])?(e=e.nextSibling,i++):this.dom.insertBefore(n.draw(),e);for(;e;){let t=e.nextSibling;e.remove(),e=t}this.drawn=t}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Js=E.define();function Ks(t){return[_i.define((e=>new Hs(e,t))),Js.of(t)]}const tr=!De.ios,er=E.define({combine:t=>kt(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})});function ir(t={}){return[er.of(t),sr,or,lr,Si.of(!0)]}function nr(t){return t.startState.facet(er)!=t.state.facet(er)}const sr=Ks({above:!0,markers(t){let{state:e}=t,i=e.facet(er),n=[];for(let s of e.selection.ranges){let r=s==e.selection.main;if(s.empty?!r||tr:i.drawRangeCursor){let e=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",i=s.empty?s:A.cursor(s.head,s.head>s.anchor?-1:1);for(let s of js.forRange(t,e,i))n.push(s)}}return n},update(t,e){t.transactions.some((t=>t.selection))&&(e.style.animationName="cm-blink"==e.style.animationName?"cm-blink2":"cm-blink");let i=nr(t);return i&&rr(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){rr(e.state,t)},class:"cm-cursorLayer"});function rr(t,e){e.style.animationDuration=t.facet(er).cursorBlinkRate+"ms"}const or=Ks({above:!1,markers:t=>t.state.selection.ranges.map((e=>e.empty?[]:js.forRange(t,"cm-selectionBackground",e))).reduce(((t,e)=>t.concat(e))),update:(t,e)=>t.docChanged||t.selectionSet||t.viewportChanged||nr(t),class:"cm-selectionLayer"}),ar={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};tr&&(ar[".cm-line"].caretColor="transparent !important");const lr=N.highest(Ts.theme(ar)),hr=ut.define({map:(t,e)=>null==t?null:e.mapPos(t)}),cr=q.define({create:()=>null,update:(t,e)=>(null!=t&&(t=e.changes.mapPos(t)),e.effects.reduce(((t,e)=>e.is(hr)?e.value:t),t))}),ur=_i.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let i=t.state.field(cr);null==i?null!=this.cursor&&(null===(e=this.cursor)||void 0===e||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(cr)!=i||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let t=this.view.state.field(cr),e=null!=t&&this.view.coordsAtPos(t);if(!e)return null;let i=this.view.scrollDOM.getBoundingClientRect();return{left:e.left-i.left+this.view.scrollDOM.scrollLeft,top:e.top-i.top+this.view.scrollDOM.scrollTop,height:e.bottom-e.top}}drawCursor(t){this.cursor&&(t?(this.cursor.style.left=t.left+"px",this.cursor.style.top=t.top+"px",this.cursor.style.height=t.height+"px"):this.cursor.style.left="-100000px")}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(cr)!=t&&this.view.dispatch({effects:hr.of(t)})}},{eventHandlers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){t.target!=this.view.contentDOM&&this.view.contentDOM.contains(t.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function dr(){return[cr,ur]}function fr(t,e,i,n,s){e.lastIndex=0;for(let r,o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)if(!o.lineBreak)for(;r=e.exec(o.value);)s(a+r.index,r)}class pr{constructor(t){const{regexp:e,decoration:i,decorate:n,boundary:s,maxLength:r=1e3}=t;if(!e.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=e,n)this.addMatch=(t,e,i,s)=>n(s,i,i+t[0].length,t,e);else if("function"==typeof i)this.addMatch=(t,e,n,s)=>{let r=i(t,e,n);r&&s(n,n+t[0].length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(t,e,n,s)=>s(n,n+t[0].length,i)}this.boundary=s,this.maxLength=r}createDeco(t){let e=new Xt,i=e.add.bind(e);for(let{from:e,to:n}of function(t,e){let i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;let n=[];for(let{from:s,to:r}of i)s=Math.max(t.state.doc.lineAt(s).from,s-e),r=Math.min(t.state.doc.lineAt(r).to,r+e),n.length&&n[n.length-1].to>=s?n[n.length-1].to=r:n.push({from:s,to:r});return n}(t,this.maxLength))fr(t.state.doc,this.regexp,e,n,((e,n)=>this.addMatch(n,t,e,i)));return e.finish()}updateDeco(t,e){let i=1e9,n=-1;return t.docChanged&&t.changes.iterChanges(((e,s,r,o)=>{o>t.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e}updateRange(t,e,i,n){for(let s of t.visibleRanges){let r=Math.max(s.from,i),o=Math.min(s.to,n);if(o>r){let i=t.state.doc.lineAt(r),n=i.toi.from;r--)if(this.boundary.test(i.text[r-1-i.from])){a=r;break}for(;oc.push(i.range(t,e));if(i==n)for(this.regexp.lastIndex=a-i.from;(h=this.regexp.exec(i.text))&&h.indexthis.addMatch(i,t,e,u)));e=e.update({filterFrom:a,filterTo:l,filter:(t,e)=>tl,add:c})}}return e}}const Or=null!=/x/.unicode?"gu":"g",gr=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",Or),mr={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let br=null;const wr=E.define({combine(t){let e=kt(t,{render:null,specialChars:gr,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==br&&"undefined"!=typeof document&&document.body){let e=document.body.style;br=null!=(null!==(t=e.tabSize)&&void 0!==t?t:e.MozTabSize)}return br||!1}())&&(e.specialChars=new RegExp("\t|"+e.specialChars.source,Or)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Or)),e}});function vr(t={}){return[wr.of(t),yr||(yr=_i.fromClass(class{constructor(t){this.view=t,this.decorations=ni.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(wr)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new pr({regexp:t.specialChars,decoration:(e,i,n)=>{let{doc:s}=i.state,r=b(e[0],0);if(9==r){let t=s.lineAt(n),e=i.state.tabSize,r=Yt(t.text,e,n-t.from);return ni.replace({widget:new xr((e-r%e)*this.view.defaultCharacterWidth)})}return this.decorationCache[r]||(this.decorationCache[r]=ni.replace({widget:new Sr(t,r)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(wr);t.startState.facet(wr)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))]}let yr=null;class Sr extends ei{constructor(t,e){super(),this.options=t,this.code=e}eq(t){return t.code==this.code}toDOM(t){let e=function(t){return t>=32?"•":10==t?"␤":String.fromCharCode(9216+t)}(this.code),i=t.state.phrase("Control character")+" "+(mr[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,i,e);if(n)return n;let s=document.createElement("span");return s.textContent=e,s.title=i,s.setAttribute("aria-label",i),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class xr extends ei{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent="\t",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}class kr extends ei{constructor(t){super(),this.content=t}toDOM(){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):this.content),"string"==typeof this.content?t.setAttribute("aria-label","placeholder "+this.content):t.setAttribute("aria-hidden","true"),t}ignoreEvent(){return!1}}const Qr="-10000px";class $r{constructor(t,e,i){this.facet=e,this.createTooltipView=i,this.input=t.state.facet(e),this.tooltips=this.input.filter((t=>t)),this.tooltipViews=this.tooltips.map(i)}update(t){var e;let i=t.state.facet(this.facet),n=i.filter((t=>t));if(i===this.input){for(let e of this.tooltipViews)e.update&&e.update(t);return!1}let s=[];for(let e=0;e{var e,i,n;return{position:De.ios?"absolute":(null===(e=t.find((t=>t.position)))||void 0===e?void 0:e.position)||"fixed",parent:(null===(i=t.find((t=>t.parent)))||void 0===i?void 0:i.parent)||null,tooltipSpace:(null===(n=t.find((t=>t.tooltipSpace)))||void 0===n?void 0:n.tooltipSpace)||Pr}}}),_r=new WeakMap,Xr=_i.fromClass(class{constructor(t){this.view=t,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(Cr);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new $r(t,Tr,(t=>this.createTooltip(t))),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout((()=>{this.measureTimeout=-1,this.maybeMeasure()}),50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t);e&&this.observeIntersection();let i=e||t.geometryChanged,n=t.state.facet(Cr);if(n.position!=this.position){this.position=n.position;for(let t of this.manager.tooltipViews)t.dom.style.position=this.position;i=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let t of this.manager.tooltipViews)this.container.appendChild(t.dom);i=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure()}createTooltip(t){let e=t.create(this.view);if(e.dom.classList.add("cm-tooltip"),t.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",e.dom.appendChild(t)}return e.dom.style.position=this.position,e.dom.style.top=Qr,this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var t,e;this.view.win.removeEventListener("resize",this.measureSoon);for(let e of this.manager.tooltipViews)e.dom.remove(),null===(t=e.destroy)||void 0===t||t.call(e);null===(e=this.intersectionObserver)||void 0===e||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=this.view.dom.getBoundingClientRect();return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map(((t,e)=>{let i=this.manager.tooltipViews[e];return i.getCoords?i.getCoords(t.pos):this.view.coordsAtPos(t.pos)})),size:this.manager.tooltipViews.map((({dom:t})=>t.getBoundingClientRect())),space:this.view.state.facet(Cr).tooltipSpace(this.view)}}writeMeasure(t){var e;let{editor:i,space:n}=t,s=[];for(let r=0;r=Math.min(i.bottom,n.bottom)||h.rightMath.min(i.right,n.right)+.1){l.style.top=Qr;continue}let u=o.arrow?a.dom.querySelector(".cm-tooltip-arrow"):null,d=u?7:0,f=c.right-c.left,p=null!==(e=_r.get(a))&&void 0!==e?e:c.bottom-c.top,O=a.offset||Ar,g=this.view.textDirection==Wi.LTR,m=c.width>n.right-n.left?g?n.left:n.right-c.width:g?Math.min(h.left-(u?14:0)+O.x,n.right-f):Math.max(n.left,h.left-f+(u?14:0)-O.x),b=!!o.above;!o.strictSide&&(b?h.top-(c.bottom-c.top)-O.yn.bottom)&&b==n.bottom-h.bottom>h.top-n.top&&(b=!b);let w=(b?h.top-n.top:n.bottom-h.bottom)-d;if(wm&&t.topv&&(v=b?t.top-p-2-d:t.bottom+d+2);"absolute"==this.position?(l.style.top=v-t.parent.top+"px",l.style.left=m-t.parent.left+"px"):(l.style.top=v+"px",l.style.left=m+"px"),u&&(u.style.left=h.left+(g?O.x:-O.x)-(m+14-7)+"px"),!0!==a.overlap&&s.push({left:m,top:v,right:y,bottom:v+p}),l.classList.toggle("cm-tooltip-above",b),l.classList.toggle("cm-tooltip-below",!b),a.positioned&&a.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=Qr}},{eventHandlers:{scroll(){this.maybeMeasure()}}}),Zr=Ts.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Ar={x:0,y:0},Tr=E.define({enables:[Xr,Zr]});function Rr(t,e){let i=t.plugin(Xr);if(!i)return null;let n=i.manager.tooltips.indexOf(e);return n<0?null:i.manager.tooltipViews[n]}const Er=E.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 Vr(t,e){let i=t.plugin(Mr),n=i?i.specs.indexOf(e):-1;return n>-1?i.panels[n]:null}const Mr=_i.fromClass(class{constructor(t){this.input=t.state.facet(Ur),this.specs=this.input.filter((t=>t)),this.panels=this.specs.map((e=>e(t)));let e=t.state.facet(Er);this.top=new Dr(t,!0,e.topContainer),this.bottom=new Dr(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(Er);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Dr(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Dr(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(Ur);if(i!=this.input){let e=i.filter((t=>t)),n=[],s=[],r=[],o=[];for(let i of e){let e,a=this.specs.indexOf(i);a<0?(e=i(t.view),o.push(e)):(e=this.panels[a],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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}}))});class Dr{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=Wr(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=Wr(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 Wr(t){let e=t.nextSibling;return t.remove(),e}const Ur=E.define({enables:Mr});class Yr extends Qt{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Yr.prototype.elementClass="",Yr.prototype.toDOM=void 0,Yr.prototype.mapMode=S.TrackBefore,Yr.prototype.startSide=Yr.prototype.endSide=-1,Yr.prototype.point=!0;const qr=E.define(),Lr={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>_t.empty,lineMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},zr=E.define();function Ir(t){return[jr(),zr.of(Object.assign(Object.assign({},Lr),t))]}const Br=E.define({combine:t=>t.some((t=>t))});function jr(t){let e=[Nr];return t&&!1===t.fixed&&e.push(Br.of(!0)),e}const Nr=_i.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+"px",this.gutters=t.state.facet(zr).map((e=>new Jr(t,e)));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!t.state.facet(Br),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(Br)!=!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=_t.iter(this.view.state.facet(qr),this.view.viewport.from),n=[],s=this.gutters.map((t=>new Hr(t,this.view.viewport,-this.view.documentPadding.top)));for(let t of this.view.viewportLineBlocks){let e;if(Array.isArray(t.type)){for(let i of t.type)if(i.type==ii.Text){e=i;break}}else e=t.type==ii.Text?t:void 0;if(e){n.length&&(n=[]),Fr(i,n,t.from);for(let t of s)t.line(this.view,e,n)}}for(let t of s)t.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(zr),i=t.state.facet(zr),n=t.docChanged||t.heightChanged||t.viewportChanged||!_t.eq(t.startState.facet(qr),t.state.facet(qr),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 Jr(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=>Ts.scrollMargins.of((e=>{let i=e.plugin(t);return i&&0!=i.gutters.length&&i.fixed?e.textDirection==Wi.LTR?{left:i.dom.offsetWidth}:{right:i.dom.offsetWidth}:null}))});function Gr(t){return Array.isArray(t)?t:[t]}function Fr(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class Hr{constructor(t,e,i){this.gutter=t,this.height=i,this.i=0,this.cursor=_t.iter(t.markers,e.from)}line(t,e,i){let n=[];Fr(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;if(0==n.length&&!r.config.renderEmptyElements)return;let o=e.top-this.height;if(this.i==r.elements.length){let i=new Kr(t,e.height,o,n);r.elements.push(i),r.dom.appendChild(i.dom)}else r.elements[this.i].update(t,e.height,o,n);this.height=e.bottom,this.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 Jr{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=Gr(e.markers(t)),e.initialSpacer&&(this.spacer=new Kr(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=Gr(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!_t.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 Kr{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.dom.style.height=(this.height=e)+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),function(t,e){if(t.length!=e.length)return!1;for(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 io extends Yr{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function no(t,e){return t.state.facet(eo).formatNumber(e,t.state)}const so=zr.compute([eo],(t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:t=>t.state.facet(to),lineMarker:(t,e,i)=>i.some((t=>t.toDOM))?null:new io(no(t,t.state.doc.lineAt(e.from).number)),lineMarkerChange:t=>t.startState.facet(eo)!=t.state.facet(eo),initialSpacer:t=>new io(no(t,ro(t.state.doc.lines))),updateSpacer(t,e){let i=no(e.view,ro(e.view.state.doc.lines));return i==t.number?t:new io(i)},domEventHandlers:t.facet(eo).domEventHandlers})));function ro(t){let e=9;for(;e{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=fo.match(t)),e=>{let i=t(e);return void 0===i?null:[this,i]}}}ho.closedBy=new ho({deserialize:t=>t.split(" ")}),ho.openedBy=new ho({deserialize:t=>t.split(" ")}),ho.group=new ho({deserialize:t=>t.split(" ")}),ho.contextHash=new ho({perNode:!0}),ho.lookAhead=new ho({perNode:!0}),ho.mounted=new ho({perNode:!0});class co{constructor(t,e,i){this.tree=t,this.overlay=e,this.parser=i}}const uo=Object.create(null);class fo{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):uo,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),n=new fo(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(ho.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(ho.group),n=-1;n<(i?i.length:0);n++){let s=e[n<0?t.name:i[n]];if(s)return s}}}}fo.none=new fo("",Object.create(null),0,8);class po{constructor(t){this.types=t;for(let e=0;e=n&&(r.type.isAnonymous||!1!==e(r))){if(r.firstChild())continue;t=!0}for(;t&&i&&!r.type.isAnonymous&&i(r),!r.nextSibling();){if(!r.parent())return;t=!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:To(fo.none,this.children,this.positions,0,this.children.length,0,this.length,((t,e,i)=>new bo(this.type,t,e,i,this.propValues)),t.makeTree||((t,e,i)=>new bo(fo.none,t,e,i)))}static build(t){return function(t){var e;let{buffer:i,nodeSet:n,maxBufferLength:s=oo,reused:r=[],minRepeatType:o=n.types.length}=t,a=Array.isArray(i)?new wo(i,i.length):i,l=n.types,h=0,c=0;function u(t,e,i,m,b){let{id:w,start:v,end:y,size:S}=a,x=c;for(;S<0;){if(a.next(),-1==S){let e=r[w];return i.push(e),void m.push(v-t)}if(-3==S)return void(h=w);if(-4==S)return void(c=w);throw new RangeError(`Unrecognized record size: ${S}`)}let k,Q,$=l[w],P=v-t;if(y-v<=s&&(Q=O(a.pos-e,b))){let e=new Uint16Array(Q.size-Q.skip),i=a.pos-Q.size,s=e.length;for(;a.pos>i;)s=g(Q.start,e,s);k=new vo(e,y-Q.start,n),P=Q.start-t}else{let t=a.pos-S;a.next();let e=[],i=[],n=w>=o?w:-1,r=0,l=y;for(;a.pos>t;)n>=0&&a.id==n&&a.size>=0?(a.end<=l-s&&(f(e,i,v,r,a.end,l,n,x),r=e.length,l=a.end),a.next()):u(v,t,e,i,n);if(n>=0&&r>0&&r-1&&r>0){let t=d($);k=To($,e,i,0,e.length,0,y-v,t,t)}else k=p($,e,i,y-v,x-y)}i.push(k),m.push(P)}function d(t){return(e,i,n)=>{let s,r,o=0,a=e.length-1;if(a>=0&&(s=e[a])instanceof bo){if(!a&&s.type==t&&s.length==n)return s;(r=s.prop(ho.lookAhead))&&(o=i[a]+s.length+r)}return p(t,e,i,n,o)}}function f(t,e,i,s,r,o,a,l){let h=[],c=[];for(;t.length>s;)h.push(t.pop()),c.push(e.pop()+i-r);t.push(p(n.types[a],h,c,o-r,l-o)),e.push(r-i)}function p(t,e,i,n,s=0,r){if(h){let t=[ho.contextHash,h];r=r?[t].concat(r):[t]}if(s>25){let t=[ho.lookAhead,s];r=r?[t].concat(r):[t]}return new bo(t,e,i,n,r)}function O(t,e){let i=a.fork(),n=0,r=0,l=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=l,l+=4,n+=4,i.next();continue}let a=i.pos-t;if(t<0||a=o?4:0,d=i.start;for(i.next();i.pos>a;){if(i.size<0){if(-3!=i.size)break t;u+=4}else i.id>=o&&(u+=4);i.next()}r=d,n+=t,l+=u}return(e<0||n==t)&&(c.size=n,c.start=r,c.skip=l),c.size>4?c:void 0}function g(t,e,i){let{id:n,start:s,end:r,size:l}=a;if(a.next(),l>=0&&n4){let n=a.pos-(l-4);for(;a.pos>n;)i=g(t,e,i)}e[--i]=o,e[--i]=r-t,e[--i]=s-t,e[--i]=n}else-3==l?h=n:-4==l&&(c=n);return i}let m=[],b=[];for(;a.pos>0;)u(t.start||0,t.bufferStart||0,m,b,-1);let w=null!==(e=t.length)&&void 0!==e?e:m.length?b[0]+m[0].length:0;return new bo(l[t.topID],m.reverse(),b.reverse(),w)}(t)}}bo.empty=new bo(fo.none,[],[],0);class wo{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 wo(this.buffer,this.index)}}class vo{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return fo.none}toString(){let t=[];for(let e=0;e0));a=r[a+3]);return o}slice(t,e,i){let n=this.buffer,s=new Uint16Array(e-t),r=0;for(let o=t,a=0;o=e&&ie;case 1:return i<=e&&n>e;case 2:return n>e;case 4:return!0}}function So(t,e){let i=t.childBefore(e);for(;i;){let e=i.lastChild;if(!e||e.to!=i.to)break;e.type.isError&&e.from==e.to?(t=i,i=e.prevSibling):i=e}return t}function xo(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!=l;t+=e){let l=o[t],h=a[t]+r.from;if(yo(n,i,h,h+l.length))if(l instanceof vo){if(s&mo.ExcludeBuffers)continue;let o=l.findChild(0,l.buffer.length,e,i-h,n);if(o>-1)return new Co(new Po(r,l,t,h),null,o)}else if(s&mo.IncludeAnonymous||!l.type.isAnonymous||Xo(l)){let o;if(!(s&mo.IgnoreMounts)&&l.props&&(o=l.prop(ho.mounted))&&!o.overlay)return new ko(o.tree,h,t,r);let a=new ko(l,h,t,r);return s&mo.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(e<0?l.children.length-1:0,e,i,n)}}if(s&mo.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&mo.IgnoreOverlays)&&(n=this._tree.prop(ho.mounted))&&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 ko(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}cursor(t=0){return new _o(this,t)}get tree(){return this._tree}toTree(){return this._tree}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return So(this,t)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}toString(){return this._tree.toString()}get node(){return this}matchContext(t){return $o(this,t)}}function Qo(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 $o(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 Po{constructor(t,e,i,n){this.parent=t,this.buffer=e,this.index=i,this.start=n}}class Co{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){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 Co(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&mo.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 Co(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 Co(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 Co(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}cursor(t=0){return new _o(this,t)}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 bo(this.type,t,e,this.to-this.from)}resolve(t,e=0){return xo(this,t,e,!1)}resolveInner(t,e=0){return xo(this,t,e,!0)}enterUnfinishedNodesBefore(t){return So(this,t)}toString(){return this.context.buffer.childString(this.index)}getChild(t,e=null,i=null){let n=Qo(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Qo(this,t,e,i)}get node(){return this}matchContext(t){return $o(this,t)}}class _o{get name(){return this.type.name}constructor(t,e=0){if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof ko)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let e=t._parent;e;e=e._parent)this.stack.unshift(e.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return!!t&&(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0)}yieldBuf(t,e){this.index=t;let{start:i,buffer:n}=this.buffer;return this.type=e||n.set.types[n.buffer[t]],this.from=i+n.buffer[t+1],this.to=i+n.buffer[t+2],!0}yield(t){return!!t&&(t instanceof ko?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,i){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,i,this.mode));let{buffer:n}=this.buffer,s=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.buffer.start,i);return!(s<0)&&(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,i=this.mode){return this.buffer?!(i&mo.ExcludeBuffers)&&this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&mo.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&mo.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode));let{buffer:e}=this.buffer,i=this.stack.length-1;if(t<0){let t=i<0?0:this.stack[i]+4;if(this.index!=t)return this.yieldBuf(e.findChild(t,this.index,-1,0,4))}else{let t=e.buffer[this.index+3];if(t<(i<0?e.buffer.length:e.buffer[this.stack[i]+3]))return this.yieldBuf(t)}return i<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,i,{buffer:n}=this;if(n){if(t>0){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&mo.IncludeAnonymous||t instanceof vo||!t.type.isAnonymous||Xo(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 $o(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 Xo(t){return t.children.some((t=>t instanceof vo||!t.type.isAnonymous||Xo(t)))}const Zo=new WeakMap;function Ao(t,e){if(!t.isAnonymous||e instanceof vo||e.type!=t)return 1;let i=Zo.get(e);if(null==i){i=1;for(let n of e.children){if(n.type!=t||!(n instanceof bo)){i=1;break}i+=Ao(t,n)}Zo.set(e,i)}return i}function To(t,e,i,n,s,r,o,a,l){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]+a);continue}u.push(i[s])}else{let e=n[h-1]+i[h-1].length-f;u.push(To(t,i,n,s,h,f,e,null,l))}d.push(f+a-r)}}(e,i,n,s,0),(a||l)(u,d,o)}class Ro{constructor(){this.map=new WeakMap}setBuffer(t,e,i){let n=this.map.get(t);n||this.map.set(t,n=new Map),n.set(e,i)}getBuffer(t,e){let i=this.map.get(t);return i&&i.get(e)}set(t,e){t instanceof Co?this.setBuffer(t.context.buffer,t.index,e):t instanceof ko&&this.map.set(t.tree,e)}get(t){return t instanceof Co?this.getBuffer(t.context.buffer,t.index):t instanceof ko?this.map.get(t.tree):void 0}cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}}class Eo{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 Eo(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,a=0,l=0;;o++){let h=o=i)for(;r&&r.from=e.from||c<=e.to||l){let t=Math.max(e.from,a)-l,i=Math.min(e.to,c)-l;e=t>=i?null:new Eo(t,i,e.tree,e.offset+l,o>0,!!h)}if(e&&n.push(e),r.to>c)break;r=snew lo(t.from,t.to))):[new lo(0,0)]:[new lo(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 Mo{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)}}function Do(t){return(e,i,n,s)=>new qo(e,t,i,n,s)}class Wo{constructor(t,e,i,n,s){this.parser=t,this.parse=e,this.overlay=i,this.target=n,this.ranges=s}}class Uo{constructor(t,e,i,n,s,r,o){this.parser=t,this.predicate=e,this.mounts=i,this.index=n,this.start=s,this.target=r,this.prev=o,this.depth=0,this.ranges=[]}}const Yo=new ho({perNode:!0});class qo{constructor(t,e,i,n,s){this.nest=e,this.input=i,this.fragments=n,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=t}advance(){if(this.baseParse){let t=this.baseParse.advance();if(!t)return null;if(this.baseParse=null,this.baseTree=t,this.startInner(),null!=this.stoppedAt)for(let t of this.inner)t.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let t=this.baseTree;return null!=this.stoppedAt&&(t=new bo(t.type,t.children,t.positions,t.length,t.propValues.concat([[Yo,this.stoppedAt]]))),t}let t=this.inner[this.innerDone],e=t.parse.advance();if(e){this.innerDone++;let i=Object.assign(Object.create(null),t.target.props);i[ho.mounted.id]=new co(e,t.overlay,t.parser),t.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let t=this.input.length;for(let e=this.innerDone;et.frag.from<=n.from&&t.frag.to>=n.to&&t.mount.overlay));if(t)for(let i of t.mount.overlay){let s=i.from+t.pos,r=i.to+t.pos;s>=n.from&&r<=n.to&&!e.ranges.some((t=>t.froms))&&e.ranges.push({from:s,to:r})}}a=!1}else if(i&&(r=Lo(i.ranges,n.from,n.to)))a=2!=r;else if(!n.type.isAnonymous&&n.fromnew lo(t.from-n.from,t.to-n.from))):null,n.tree,t)),s.overlay?t.length&&(i={ranges:t,depth:0,prev:i}):a=!1}}else e&&(o=e.predicate(n))&&(!0===o&&(o=new lo(n.from,n.to)),o.fromnew lo(t.from-e.start,t.to-e.start))),e.target,t)),e=e.prev}i&&! --i.depth&&(i=i.prev)}}}}function Lo(t,e,i){for(let n of t){if(n.from>=i)break;if(n.to>e)return n.from<=e&&n.to>=i?2:1}return 0}function zo(t,e,i,n,s,r){if(e=e.to);n++);let o=s.children[n],a=o.buffer;s.children[n]=function t(i,n,s,l,h){let c=i;for(;a[c+2]+r<=e.from;)c=a[c+3];let u=[],d=[];zo(o,i,c,u,d,l);let f=a[c+1],p=a[c+2],O=f+r==e.from&&p+r==e.to&&a[c]==e.type.id;return u.push(O?e.toTree():t(c+4,a[c+3],o.set.types[a[c]],f,p-f)),d.push(f-l),zo(o,a[c+3],n,u,d,l),new bo(s,u,d,h)}(0,a.length,fo.none,0,o.length);for(let n=0;n<=i;n++)t.childAfter(e.from)}class Bo{constructor(t,e){this.offset=e,this.done=!1,this.cursor=t.cursor(mo.IncludeAnonymous|mo.IgnoreMounts)}moveTo(t){let{cursor:e}=this,i=t-this.offset;for(;!this.done&&e.from=t&&e.enter(i,1,mo.IgnoreOverlays|mo.ExcludeBuffers)||e.next(!1)||(this.done=!0)}hasNode(t){if(this.moveTo(t.from),!this.done&&this.cursor.from+this.offset==t.from&&this.cursor.tree)for(let e=this.cursor.tree;;){if(e==t.tree)return!0;if(!(e.children.length&&0==e.positions[0]&&e.children[0]instanceof bo))break;e=e.children[0]}return!1}}let jo=class{constructor(t){var e;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){let i=this.curFrag=t[0];this.curTo=null!==(e=i.tree.prop(Yo))&&void 0!==e?e:i.to,this.inner=new Bo(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t)}nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=null!==(t=e.tree.prop(Yo))&&void 0!==t?t:e.to,this.inner=new Bo(e.tree,-e.offset)}}findMounts(t,e){var i;let n=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let t=this.inner.cursor.node;t;t=t.parent){let s=null===(i=t.tree)||void 0===i?void 0:i.prop(ho.mounted);if(s&&s.parser==e)for(let e=this.fragI;e=t.to)break;i.tree==this.curFrag.tree&&n.push({frag:i,pos:t.from-i.offset,mount:s})}}}return n}};function No(t,e){let i=null,n=e;for(let s=1,r=0;s=a)break;t.to<=o||(i||(n=i=e.slice()),t.froma&&i.splice(r+1,0,new lo(a,t.to))):t.to>a?i[r--]=new lo(a,t.to):i.splice(r--,1))}}return n}function Go(t,e,i,n){let s=0,r=0,o=!1,a=!1,l=-1e9,h=[];for(;;){let c=s==t.length?1e9:o?t[s].to:t[s].from,u=r==e.length?1e9:a?e[r].to:e[r].from;if(o!=a){let t=Math.max(l,i),e=Math.min(c,u,n);tnew lo(t.from+n,t.to+n))),a,l);for(let e=0,n=a;;e++){let a=e==o.length,h=a?l:o[e].from;if(h>n&&i.push(new Eo(n,h,s.tree,-t,r.from>=n||r.openStart,r.to<=h||r.openEnd)),a)break;n=o[e].to}}else i.push(new Eo(a,l,s.tree,-t,r.from>=t||r.openStart,r.to<=o||r.openEnd))}return i}let Ho=0;class Jo{constructor(t,e,i){this.set=t,this.base=e,this.modified=i,this.id=Ho++}static define(t){if(null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let e=new Jo([],null,[]);if(e.set.push(e),t)for(let i of t.set)e.set.push(i);return e}static defineModifier(){let t=new ta;return e=>e.modified.indexOf(t)>-1?e:ta.get(e.base||e,e.modified.concat(t).sort(((t,e)=>t.id-e.id)))}}let Ko=0;class ta{constructor(){this.instances=[],this.id=Ko++}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 Jo(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(ta.get(e,t));return s}}function ea(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,a=i[o];if(!a)throw new RangeError("Invalid path: "+t);let l=new na(n,s,o>0?i.slice(0,o):null);e[a]=l.sort(e[a])}}return ia.add(e)}const ia=new ho;class na{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 ra(t,e,i,n=0,s=t.length){let r=new oa(n,Array.isArray(e)?e:[e],i);r.highlightRange(t.cursor(),n,s,"",r.highlighters),r.flush(s)}na.empty=new na([],2,null);class oa{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:a}=t;if(o>=i||a<=e)return;r.isTop&&(s=this.highlighters.filter((t=>!t.scope||t.scope(r))));let l=n,h=function(t){let e=t.type.prop(ia);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}(t)||na.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&&(l&&(l+=" "),l+=c,1==h.mode&&(n+=(n?" ":"")+c)),this.startSpan(t.from,l),h.opaque)return;let u=t.tree&&t.tree.prop(ho.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 d=0,f=o;;d++){let p=d=O)&&t.nextSibling()););if(!p||O>i)break;f=p.to+o,f>e&&(this.highlightRange(r.cursor(),Math.max(e,p.from+o),Math.min(i,f),n,h),this.startSpan(f,l))}c&&t.parent()}else if(t.firstChild()){do{if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,n,s),this.startSpan(Math.min(i,t.to),l)}}while(t.nextSibling());t.parent()}}}const aa=Jo.define,la=aa(),ha=aa(),ca=aa(ha),ua=aa(ha),da=aa(),fa=aa(da),pa=aa(da),Oa=aa(),ga=aa(Oa),ma=aa(),ba=aa(),wa=aa(),va=aa(wa),ya=aa(),Sa={comment:la,lineComment:aa(la),blockComment:aa(la),docComment:aa(la),name:ha,variableName:aa(ha),typeName:ca,tagName:aa(ca),propertyName:ua,attributeName:aa(ua),className:aa(ha),labelName:aa(ha),namespace:aa(ha),macroName:aa(ha),literal:da,string:fa,docString:aa(fa),character:aa(fa),attributeValue:aa(fa),number:pa,integer:aa(pa),float:aa(pa),bool:aa(da),regexp:aa(da),escape:aa(da),color:aa(da),url:aa(da),keyword:ma,self:aa(ma),null:aa(ma),atom:aa(ma),unit:aa(ma),modifier:aa(ma),operatorKeyword:aa(ma),controlKeyword:aa(ma),definitionKeyword:aa(ma),moduleKeyword:aa(ma),operator:ba,derefOperator:aa(ba),arithmeticOperator:aa(ba),logicOperator:aa(ba),bitwiseOperator:aa(ba),compareOperator:aa(ba),updateOperator:aa(ba),definitionOperator:aa(ba),typeOperator:aa(ba),controlOperator:aa(ba),punctuation:wa,separator:aa(wa),bracket:va,angleBracket:aa(va),squareBracket:aa(va),paren:aa(va),brace:aa(va),content:Oa,heading:ga,heading1:aa(ga),heading2:aa(ga),heading3:aa(ga),heading4:aa(ga),heading5:aa(ga),heading6:aa(ga),contentSeparator:aa(Oa),list:aa(Oa),quote:aa(Oa),emphasis:aa(Oa),strong:aa(Oa),link:aa(Oa),monospace:aa(Oa),strikethrough:aa(Oa),inserted:aa(),deleted:aa(),changed:aa(),invalid:aa(),meta:ya,documentMeta:aa(ya),annotation:aa(ya),processingInstruction:aa(ya),definition:Jo.defineModifier(),constant:Jo.defineModifier(),function:Jo.defineModifier(),standard:Jo.defineModifier(),local:Jo.defineModifier(),special:Jo.defineModifier()};var xa;sa([{tag:Sa.link,class:"tok-link"},{tag:Sa.heading,class:"tok-heading"},{tag:Sa.emphasis,class:"tok-emphasis"},{tag:Sa.strong,class:"tok-strong"},{tag:Sa.keyword,class:"tok-keyword"},{tag:Sa.atom,class:"tok-atom"},{tag:Sa.bool,class:"tok-bool"},{tag:Sa.url,class:"tok-url"},{tag:Sa.labelName,class:"tok-labelName"},{tag:Sa.inserted,class:"tok-inserted"},{tag:Sa.deleted,class:"tok-deleted"},{tag:Sa.literal,class:"tok-literal"},{tag:Sa.string,class:"tok-string"},{tag:Sa.number,class:"tok-number"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],class:"tok-string2"},{tag:Sa.variableName,class:"tok-variableName"},{tag:Sa.local(Sa.variableName),class:"tok-variableName tok-local"},{tag:Sa.definition(Sa.variableName),class:"tok-variableName tok-definition"},{tag:Sa.special(Sa.variableName),class:"tok-variableName2"},{tag:Sa.definition(Sa.propertyName),class:"tok-propertyName tok-definition"},{tag:Sa.typeName,class:"tok-typeName"},{tag:Sa.namespace,class:"tok-namespace"},{tag:Sa.className,class:"tok-className"},{tag:Sa.macroName,class:"tok-macroName"},{tag:Sa.propertyName,class:"tok-propertyName"},{tag:Sa.operator,class:"tok-operator"},{tag:Sa.comment,class:"tok-comment"},{tag:Sa.meta,class:"tok-meta"},{tag:Sa.invalid,class:"tok-invalid"},{tag:Sa.punctuation,class:"tok-punctuation"}]);const ka=new ho;function Qa(t){return E.define({combine:t?e=>e.concat(t):void 0})}const $a=new ho;class Pa{constructor(t,e,i=[],n=""){this.data=t,this.name=n,xt.prototype.hasOwnProperty("tree")||Object.defineProperty(xt.prototype,"tree",{get(){return Xa(this)}}),this.parser=e,this.extension=[Wa.of(this),xt.languageData.of(((t,e,i)=>{let n=Ca(t,e,i),s=n.type.prop(ka);if(!s)return[];let r=t.facet(s),o=n.type.prop($a);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 Ca(t,e,i).type.prop(ka)==this.data}findRegions(t){let e=t.facet(Wa);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(ka)==this.data)return void i.push({from:e,to:e+t.length});let s=t.prop(ho.mounted);if(s){if(s.tree.prop(ka)==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;it.isTop?e:void 0))]}),t.name)}configure(t,e){return new _a(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Xa(t){let e=t.field(Pa.state,!1);return e?e.tree:bo.empty}class Za{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let i=this.cursorPos-this.string.length;return t=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i)}}let Aa=null;class Ta{constructor(t,e,i=[],n,s,r,o,a){this.parser=t,this.state=e,this.fragments=i,this.tree=n,this.treeLen=s,this.viewport=r,this.skipped=o,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(t,e,i){return new Ta(t,e,[],bo.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Za(this.state.doc),this.fragments)}work(t,e){return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=bo.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(Eo.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Aa;Aa=this;try{return t()}finally{Aa=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=Ra(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=Eo.applyChanges(i,e),n=bo.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=Ra(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 Vo{createParse(e,i,n){let s=n[0].from,r=n[n.length-1].to;return{parsedPos:s,advance(){let e=Aa;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 bo(fo.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 Aa}}function Ra(t,e,i){return Eo.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class Ea{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 Ea(e)}static init(t){let e=Math.min(3e3,t.doc.length),i=Ta.create(t.facet(Wa).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new Ea(i)}}Pa.state=q.define({create:Ea.init,update(t,e){for(let t of e.effects)if(t.is(Pa.setState))return t.value;return e.startState.facet(Wa)!=e.state.facet(Wa)?Ea.init(e.state):t.apply(e)}});let Va=t=>{let e=setTimeout((()=>t()),500);return()=>clearTimeout(e)};"undefined"!=typeof requestIdleCallback&&(Va=t=>{let e=-1,i=setTimeout((()=>{e=requestIdleCallback(t,{timeout:400})}),100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const Ma="undefined"!=typeof navigator&&(null===(xa=navigator.scheduling)||void 0===xa?void 0:xa.isInputPending)?()=>navigator.scheduling.isInputPending():null,Da=_i.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(Pa.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),t.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(Pa.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=Va(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEndn+1e3,a=s.context.work((()=>Ma&&Ma()||Date.now()>r),n+(o?0:1e5));this.chunkBudget-=Date.now()-e,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Pa.setState.of(new Ea(s.context))})),this.chunkBudget>0&&(!a||o)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then((()=>this.scheduleWork())).catch((t=>Qi(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()}}}),Wa=E.define({combine:t=>t.length?t[0]:null,enables:t=>[Pa.state,Da,Ts.contentAttributes.compute([t],(e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}}))]});class Ua{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}class Ya{constructor(t,e,i,n,s,r=void 0){this.name=t,this.alias=e,this.extensions=i,this.filename=n,this.loadFunc=s,this.support=r,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then((t=>this.support=t),(t=>{throw this.loading=null,t})))}static of(t){let{load:e,support:i}=t;if(!e){if(!i)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");e=()=>Promise.resolve(i)}return new Ya(t.name,(t.alias||[]).concat(t.name).map((t=>t.toLowerCase())),t.extensions||[],t.filename,e,i)}static matchFilename(t,e){for(let i of t)if(i.filename&&i.filename.test(e))return i;let i=/\.([^.]+)$/.exec(e);if(i)for(let e of t)if(e.extensions.indexOf(i[1])>-1)return e;return null}static matchLanguageName(t,e,i=!0){e=e.toLowerCase();for(let i of t)if(i.alias.some((t=>t==e)))return i;if(i)for(let i of t)for(let t of i.alias){let n=e.indexOf(t);if(n>-1&&(t.length>2||!/\w/.test(e[n-1])&&!/\w/.test(e[n+t.length])))return i}return null}}const qa=E.define(),La=E.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 za(t){let e=t.facet(La);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function Ia(t,e){let i="",n=t.tabSize,s=t.facet(La)[0];if("\t"==s){for(;e>=n;)i+="\t",e-=n;s=" "}for(let t=0;t=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 Yt(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 Na=new ho;function Ga(t){let e=t.type.prop(Na);if(e)return e;let i,n=t.firstChild;if(n&&(i=n.type.prop(ho.closedBy))){let e=t.lastChild,n=e&&i.indexOf(e.name)>-1;return t=>el(t,!0,1,void 0,n&&!function(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}(t)?e.from:void 0)}return null==t.parent?Ha:null}function Fa(t,e,i){for(;t;t=t.parent){let n=Ga(t);if(n)return n(Ja.create(i,e,t))}return null}function Ha(){return 0}class Ja extends ja{constructor(t,e,i){super(t.state,t.options),this.base=t,this.pos=e,this.node=i}static create(t,e,i){return new Ja(t,e,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){let t=this.state.doc.lineAt(this.node.from);for(;;){let e=this.node.resolve(t.from);for(;e.parent&&e.parent.from==e.from;)e=e.parent;if(Ka(e,this.node))break;t=this.state.doc.lineAt(e.from)}return this.lineIndent(t.from)}continue(){let t=this.node.parent;return t?Fa(t,this.pos,this.base):0}}function Ka(t,e){for(let i=e;i;i=i.parent)if(t==i)return!0;return!1}function tl({closing:t,align:e=!0,units:i=1}){return n=>el(n,e,i,t)}function el(t,e,i,n,s){let r=t.textAfter,o=r.match(/^\s*/)[0].length,a=n&&r.slice(o,o+n.length)==n||s==t.pos+o,l=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.from{let n=t&&t.test(i.textAfter);return i.baseIndent+(n?0:e*i.unit)}}function nl(){return xt.transactionFilter.of((t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let i=t.newDoc,{head:n}=t.newSelection.main,s=i.lineAt(n);if(n>s.from+200)return t;let r=i.sliceString(s.from,n);if(!e.some((t=>t.test(r))))return t;let{state:o}=t,a=-1,l=[];for(let{head:t}of o.selection.ranges){let e=o.doc.lineAt(t);if(e.from==a)continue;a=e.from;let i=Ba(o,e.from);if(null==i)continue;let n=/^\s*/.exec(e.text)[0],s=Ia(o,i);n!=s&&l.push({from:e.from,to:e.from+n.length,insert:s})}return l.length?[t,{changes:l,sequential:!0}]:t}))}const sl=E.define(),rl=new ho;function ol(t){let e=t.firstChild,i=t.lastChild;return e&&e.toi)continue;if(s&&r.from=e&&n.to>i&&(s=n)}}return s}(t,e,i)}function hl(t,e){let i=e.mapPos(t.from,1),n=e.mapPos(t.to,-1);return i>=n?void 0:{from:i,to:n}}const cl=ut.define({map:hl}),ul=ut.define({map:hl}),dl=q.define({create:()=>ni.none,update(t,e){t=t.map(e.changes);for(let i of e.effects)i.is(cl)&&!pl(t,i.value.from,i.value.to)?t=t.update({add:[bl.range(i.value.from,i.value.to)]}):i.is(ul)&&(t=t.update({filter:(t,e)=>i.value.from!=t||i.value.to!=e,filterFrom:i.value.from,filterTo:i.value.to}));if(e.selection){let i=!1,{head:n}=e.selection.main;t.between(n,n,((t,e)=>{tn&&(i=!0)})),i&&(t=t.update({filterFrom:n,filterTo:n,filter:(t,e)=>e<=n||t>=n}))}return t},provide:t=>Ts.decorations.from(t),toJSON(t,e){let i=[];return t.between(0,e.doc.length,((t,e)=>{i.push(t,e)})),i},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let i=0;i{(!s||s.from>t)&&(s={from:t,to:e})})),s}function pl(t,e,i){let n=!1;return t.between(e,e,((t,s)=>{t==e&&s==i&&(n=!0)})),n}const Ol={placeholderDOM:null,placeholderText:"…"},gl=E.define({combine:t=>kt(t,Ol)});function ml(t){let e=[dl,yl];return t&&e.push(gl.of(t)),e}const bl=ni.replace({widget:new class extends ei{toDOM(t){let{state:e}=t,i=e.facet(gl),n=e=>{let i=t.lineBlockAt(t.posAtDOM(e.target)),n=fl(t.state,i.from,i.to);n&&t.dispatch({effects:ul.of(n)}),e.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(t,n);let s=document.createElement("span");return s.textContent=i.placeholderText,s.setAttribute("aria-label",e.phrase("folded code")),s.title=e.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=n,s}}}),wl={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class vl extends Yr{constructor(t,e){super(),this.config=t,this.open=e}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let e=document.createElement("span");return e.textContent=this.open?this.config.openText:this.config.closedText,e.title=t.state.phrase(this.open?"Fold line":"Unfold line"),e}}const yl=Ts.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Sl{constructor(t,e){let i;function n(t){let e=It.newName();return(i||(i=Object.create(null)))["."+e]=t,e}this.specs=t;const s="string"==typeof e.all?e.all:e.all?n(e.all):void 0,r=e.scope;this.scope=r instanceof Pa?t=>t.prop(ka)==r.data:r?t=>t==r:void 0,this.style=sa(t.map((t=>({tag:t.tag,class:t.class||n(Object.assign({},t,{tag:null}))}))),{all:s}).style,this.module=i?new It(i):null,this.themeType=e.themeType}static define(t,e){return new Sl(t,e||{})}}const xl=E.define(),kl=E.define({combine:t=>t.length?[t[0]]:null});function Ql(t){let e=t.facet(xl);return e.length?e:t.facet(kl)}function $l(t,e){let i,n=[Cl];return t instanceof Sl&&(t.module&&n.push(Ts.styleModule.of(t.module)),i=t.themeType),(null==e?void 0:e.fallback)?n.push(kl.of(t)):i?n.push(xl.computeN([Ts.darkTheme],(e=>e.facet(Ts.darkTheme)==("dark"==i)?[t]:[]))):n.push(xl.of(t)),n}class Pl{constructor(t){this.markCache=Object.create(null),this.tree=Xa(t.state),this.decorations=this.buildDeco(t,Ql(t.state))}update(t){let e=Xa(t.state),i=Ql(t.state),n=i!=Ql(t.startState);e.length{i.add(t,e,this.markCache[n]||(this.markCache[n]=ni.mark({class:n})))}),n,s);return i.finish()}}const Cl=N.high(_i.fromClass(Pl,{decorations:t=>t.decorations})),_l=Sl.define([{tag:Sa.meta,color:"#404740"},{tag:Sa.link,textDecoration:"underline"},{tag:Sa.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Sa.emphasis,fontStyle:"italic"},{tag:Sa.strong,fontWeight:"bold"},{tag:Sa.strikethrough,textDecoration:"line-through"},{tag:Sa.keyword,color:"#708"},{tag:[Sa.atom,Sa.bool,Sa.url,Sa.contentSeparator,Sa.labelName],color:"#219"},{tag:[Sa.literal,Sa.inserted],color:"#164"},{tag:[Sa.string,Sa.deleted],color:"#a11"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],color:"#e40"},{tag:Sa.definition(Sa.variableName),color:"#00f"},{tag:Sa.local(Sa.variableName),color:"#30a"},{tag:[Sa.typeName,Sa.namespace],color:"#085"},{tag:Sa.className,color:"#167"},{tag:[Sa.special(Sa.variableName),Sa.macroName],color:"#256"},{tag:Sa.definition(Sa.propertyName),color:"#00c"},{tag:Sa.comment,color:"#940"},{tag:Sa.invalid,color:"#f00"}]),Xl=Ts.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Zl=1e4,Al="()[]{}",Tl=E.define({combine:t=>kt(t,{afterCursor:!0,brackets:Al,maxScanDistance:Zl,renderMatch:Vl})}),Rl=ni.mark({class:"cm-matchingBracket"}),El=ni.mark({class:"cm-nonmatchingBracket"});function Vl(t){let e=[],i=t.matched?Rl:El;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 Ml=q.define({create:()=>ni.none,update(t,e){if(!e.docChanged&&!e.selection)return t;let i=[],n=e.state.facet(Tl);for(let t of e.state.selection.ranges){if(!t.empty)continue;let s=Ll(e.state,t.head,-1,n)||t.head>0&&Ll(e.state,t.head-1,1,n)||n.afterCursor&&(Ll(e.state,t.head,1,n)||t.headTs.decorations.from(t)}),Dl=[Ml,Xl];function Wl(t={}){return[Tl.of(t),Dl]}const Ul=new ho;function Yl(t,e,i){let n=t.prop(e<0?ho.openedBy:ho.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 ql(t){let e=t.type.prop(Ul);return e?e(t.node):t}function Ll(t,e,i,n={}){let s=n.maxScanDistance||Zl,r=n.brackets||Al,o=Xa(t),a=o.resolveInner(e,i);for(let n=a;n;n=n.parent){let s=Yl(n.type,i,r);if(s&&n.from0?e>=o.from&&eo.from&&e<=o.to))return zl(t,e,i,n,o,s,r)}}return function(t,e,i,n,s,r,o){let a=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%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 a=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(a+t,1).type!=s))if(e%2==0==i>0)u++;else{if(1==u)return{start:h,end:{from:a+t,to:a+t+1},matched:e>>1==l>>1};u--}}i>0&&(t+=r.length)}return c.done?{start:h,matched:!1}:null}(t,e,i,o,a.type,s,r)}function zl(t,e,i,n,s,r,o){let a=n.parent,l={from:s.from,to:s.to},h=0,c=null==a?void 0:a.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 jl(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 Nl=new WeakMap;class Gl extends Pa{constructor(t){let e,i=Qa(t.languageData),n={name:(s=t).name||"",token:s.token,blankLine:s.blankLine||(()=>{}),startState:s.startState||(()=>!0),copyState:s.copyState||jl,indent:s.indent||(()=>null),languageData:s.languageData||{},tokenTable:s.tokenTable||th};var s;super(i,new class extends Vo{createParse(t,i,n){return new Jl(e,t,i,n)}},[qa.of(((t,e)=>this.getIndent(t,e)))],t.name),this.topNode=function(t){let e=fo.define({id:eh.length,name:"Document",props:[ka.add((()=>t))]});return eh.push(e),e}(i),e=this,this.streamParser=n,this.stateAfter=new ho({perNode:!0}),this.tokenTable=t.tokenTable?new rh(n.tokenTable):oh}static define(t){return new Gl(t)}getIndent(t,e){let i,n=Xa(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=Nl.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],a=i+e.positions[r],l=o instanceof bo&&a=e.length)return e;s||e.type!=t.topNode||(s=!0);for(let r=e.children.length-1;r>=0;r--){let o,a=e.positions[r],l=e.children[r];if(ai&&Fl(t,n.tree,0-n.offset,i,r);if(o&&(e=Hl(t,n.tree,i+n.offset,o.pos+n.offset,!1)))return{state:o.state,tree:e}}return{state:t.streamParser.startState(n?za(n):4),tree:bo.empty}}(t,i,r,null==s?void 0:s.state);this.state=o,this.parsedPos=this.chunkStart=r+a.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 Bl(e,t?t.state.tabSize:4,t?za(t.state):2);if(r.eol())s.blankLine(this.state,r.indentUnit);else for(;!r.eol();){let t=Kl(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 th=Object.create(null),eh=[fo.none],ih=new po(eh),nh=[],sh=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"]])sh[t]=lh(th,e);class rh{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),sh)}resolve(t){return t?this.table[t]||(this.table[t]=lh(this.extra,t)):0}}const oh=new rh(th);function ah(t,e){nh.indexOf(t)>-1||(nh.push(t),console.warn(e))}function lh(t,e){let i=null;for(let n of e.split(".")){let e=t[n]||Sa[n];e?"function"==typeof e?i?i=e(i):ah(n,`Modifier ${n} used at start of tag`):i?ah(n,`Tag ${n} used as modifier`):i=e:ah(n,`Unknown highlighting tag ${n}`)}if(!i)return 0;let n=e.replace(/ /g,"_"),s=fo.define({id:eh.length,name:n,props:[ea({[n]:i})]});return eh.push(s),s.id}function hh(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 ch=hh(gh,0),uh=hh(Oh,0),dh=hh(((t,e)=>Oh(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 fh(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}const ph=50;function Oh(t,e,i=e.selection.ranges){let n=i.map((t=>fh(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,a=t.sliceDoc(n-ph,n),l=t.sliceDoc(s,s+ph),h=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(l)[0].length,u=a.length-h;if(a.slice(u-e.length,u)==e&&l.slice(c,c+i.length)==i)return{open:{pos:n-h,margin:h&&1},close:{pos:s+c,margin:c&&1}};s-n<=2*ph?r=o=t.sliceDoc(n,s):(r=t.sliceDoc(n,n+ph),o=t.sliceDoc(s-ph,s));let d=/^\s*/.exec(r)[0].length,f=/\s*$/.exec(o)[0].length,p=o.length-f-i.length;return r.slice(d,d+e.length)==e&&o.slice(p,p+i.length)==i?{open:{pos:n+d+e.length,margin:/\s/.test(r.charAt(d+e.length))?1:0},close:{pos:s-f-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>l.from)){s=l.from;let t=/^\s*/.exec(l.text)[0].length,e=t==l.length,i=l.text.slice(t,t+a.length)==a?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 mh=lt.define(),bh=lt.define(),wh=E.define(),vh=E.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)})});const yh=q.define({create:()=>Dh.empty,update(t,e){let i=e.state.facet(vh),n=e.annotation(mh);if(n){let s=e.docChanged?A.single(function(t){let e=0;return t.iterChangedRanges(((t,i)=>e=i)),e}(e.changes)):void 0,r=Ch.fromTransaction(e,s),o=n.side,a=0==o?t.undone:t.done;return a=r?_h(a,a.length,i.minDepth,r):Th(a,e.startState.selection),new Dh(0==o?n.rest:a,0==o?a:n.rest)}let s=e.annotation(bh);if("full"!=s&&"before"!=s||(t=t.isolate()),!1===e.annotation(dt.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);let r=Ch.fromTransaction(e),o=e.annotation(dt.time),a=e.annotation(dt.userEvent);return r?t=t.addChanges(r,o,a,i,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,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 Dh(t.done.map(Ch.fromJSON),t.undone.map(Ch.fromJSON))});function Sh(t={}){return[yh,vh.of(t),Ts.domEventHandlers({beforeinput(t,e){let i="historyUndo"==t.inputType?kh:"historyRedo"==t.inputType?Qh:null;return!!i&&(t.preventDefault(),i(e))}})]}function xh(t,e){return function({state:i,dispatch:n}){if(!e&&i.readOnly)return!1;let s=i.field(yh,!1);if(!s)return!1;let r=s.pop(t,i,e);return!!r&&(n(r),!0)}}const kh=xh(0,!1),Qh=xh(1,!1),$h=xh(0,!0),Ph=xh(1,!0);class Ch{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 Ch(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 Ch(t.changes&&k.fromJSON(t.changes),[],t.mapped&&x.fromJSON(t.mapped),t.startSelection&&A.fromJSON(t.startSelection),t.selectionsAfter.map(A.fromJSON))}static fromTransaction(t,e){let i=Zh;for(let e of t.startState.facet(wh)){let n=e(t);n.length&&(i=i.concat(n))}return!i.length&&t.changes.empty?null:new Ch(t.changes.invert(t.startState.doc),i,void 0,e||t.startState.selection,Zh)}static selection(t){return new Ch(void 0,Zh,void 0,void 0,t)}}function _h(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 Xh(t,e){return t.length?e.length?t.concat(e):t:e}const Zh=[],Ah=200;function Th(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-Ah));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),_h(t,t.length-1,1e9,i.setSelAfter(n)))}return[Ch.selection([e])]}function Rh(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 Eh(t,e){if(!t.length)return t;let i=t.length,n=Zh;for(;i;){let s=Vh(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?[Ch.selection(n)]:Zh}function Vh(t,e,i){let n=Xh(t.selectionsAfter.length?t.selectionsAfter.map((t=>t.map(e))):Zh,i);if(!t.changes)return Ch.selection(n);let s=t.changes.map(e),r=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(r):r;return new Ch(s,ut.mapEffects(t.effects,e),o,t.startSelection.map(r),n)}const Mh=/^(input\.type|delete)($|\.)/;class Dh{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 Dh(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||Mh.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)?_h(r,r.length-1,n.minDepth,new Ch(t.changes.compose(o.changes),Xh(t.effects,o.effects),o.mapped,o.startSelection,Zh)):_h(r,r.length,n.minDepth,t),new Dh(r,Zh,e,i)}addSelection(t,e,i,n){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Zh;return s.length>0&&e-this.prevTimet.empty!=o.ranges[e].empty)).length)?this:new Dh(Th(this.done,t),this.undone,e,i);var r,o}addMapping(t){return new Dh(Eh(this.done,t),Eh(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:mh.of({side:t,rest:Rh(n)}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let i=1==n.length?Zh:n.slice(0,n.length-1);return s.mapped&&(i=Eh(i,s.mapped)),e.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:mh.of({side:t,rest:i}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}}Dh.empty=new Dh(Zh,Zh);const Wh=[{key:"Mod-z",run:kh,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Qh,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Qh,preventDefault:!0},{key:"Mod-u",run:$h,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Ph,preventDefault:!0}];function Uh(t,e){return A.create(t.ranges.map(e),t.mainIndex)}function Yh(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function qh({state:t,dispatch:e},i){let n=Uh(t.selection,i);return!n.eq(t.selection)&&(e(Yh(t,n)),!0)}function Lh(t,e){return A.cursor(e?t.to:t.from)}function zh(t,e){return qh(t,(i=>i.empty?t.moveByChar(i,e):Lh(i,e)))}function Ih(t){return t.textDirectionAt(t.state.selection.main.head)==Wi.LTR}const Bh=t=>zh(t,!Ih(t)),jh=t=>zh(t,Ih(t));function Nh(t,e){return qh(t,(i=>i.empty?t.moveByGroup(i,e):Lh(i,e)))}function Gh(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 Fh(t,e,i){let n,s,r=Xa(t).resolveInner(e.head),o=i?ho.closedBy:ho.openedBy;for(let n=e.head;;){let e=i?r.childAfter(n):r.childBefore(n);if(!e)break;Gh(t,e,o)?r=e:n=i?e.to:e.from}return s=r.type.prop(o)&&(n=i?Ll(t,r.from,1):Ll(t,r.to,-1))&&n.matched?i?n.end.to:n.end.from:i?r.to:r.from,A.cursor(s,i?-1:1)}function Hh(t,e){return qh(t,(i=>{if(!i.empty)return Lh(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)}))}const Jh=t=>Hh(t,!1),Kh=t=>Hh(t,!0);function tc(t){let e,i=t.scrollDOM.clientHeighti.empty?t.moveVertically(i,e,n.height):Lh(i,e)));if(r.eq(s.selection))return!1;if(n.selfScroll){let e=t.coordsAtPos(s.selection.main.head),o=t.scrollDOM.getBoundingClientRect(),a=o.top+n.marginTop,l=o.bottom-n.marginBottom;e&&e.top>a&&e.bottomec(t,!1),nc=t=>ec(t,!0);function sc(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=A.cursor(n.from+i))}return s}function rc(t,e){let i=Uh(t.state.selection,(t=>{let i=e(t);return A.range(t.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)}));return!i.eq(t.state.selection)&&(t.dispatch(Yh(t.state,i)),!0)}function oc(t,e){return console.log("Select!"),rc(t,(i=>t.moveByCharSelected(i,e)))}const ac=t=>oc(t,!Ih(t)),lc=t=>oc(t,Ih(t));function hc(t,e){return rc(t,(i=>t.moveByGroup(i,e)))}function cc(t,e){return rc(t,(i=>t.moveVertically(i,e)))}const uc=t=>cc(t,!1),dc=t=>cc(t,!0);function fc(t,e){return rc(t,(i=>t.moveVertically(i,e,tc(t).height)))}const pc=t=>fc(t,!1),Oc=t=>fc(t,!0),gc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:0})),!0),mc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.doc.length})),!0),bc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:0})),!0),wc=({state:t,dispatch:e})=>(e(Yh(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0);function vc(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=yc(t,n,!0)),s=Math.min(s,n),r=Math.max(r,n)}else s=yc(t,s,!1),r=yc(t,r,!0);return s==r?{range:n}:{changes:{from:s,to:r},range:A.cursor(s)}}));return!s.changes.empty&&(t.dispatch(n.update(s,{scrollIntoView:!0,userEvent:i,effects:"delete.selection"==i?Ts.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function yc(t,e,i){if(t instanceof Ts)for(let n of t.state.facet(Ts.atomicRanges).map((e=>e(t))))n.between(e,e,((t,n)=>{te&&(e=i?n:t)}));return e}const Sc=(t,e)=>vc(t,(i=>{let n,s,{state:r}=t,o=r.doc.lineAt(i);if(!e&&i>o.from&&iSc(t,!1),kc=t=>Sc(t,!0),Qc=(t,e)=>vc(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 a=f(r.text,n-r.from,e)+r.from,l=r.text.slice(Math.min(n,a)-r.from,Math.max(n,a)-r.from),h=o(l);if(null!=t&&h!=t)break;" "==l&&n==i||(t=h),n=a}return n})),$c=t=>Qc(t,!1),Pc=t=>vc(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 _c(t,e,i){if(t.readOnly)return!1;let n=[],s=[];for(let e of Cc(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(A.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(A.range(t.anchor-o,t.head-o))}}return!!n.length&&(e(t.update({changes:n,scrollIntoView:!0,selection:A.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0)}function Xc(t,e,i){if(t.readOnly)return!1;let n=[];for(let e of Cc(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 Zc=Ac(!1);function Ac(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),a=!e&&s==r&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i,n=Xa(t).resolveInner(e),s=n.childBefore(e),r=n.childAfter(e);return s&&r&&s.to<=e&&r.from>=e&&(i=s.type.prop(ho.closedBy))&&i.indexOf(r.name)>-1&&t.doc.lineAt(s.to).from==t.doc.lineAt(r.from).from?{from:s.to,to:r.from}:null}(i,s);e&&(s=r=(r<=o.to?o:i.doc.lineAt(r)).to);let l=new ja(i,{simulateBreak:s,simulateDoubleBreak:!!a}),h=Ba(l,s);for(null==h&&(h=/^\s*/.exec(i.doc.lineAt(s).text)[0].length);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:A.range(r.mapPos(n.anchor,1),r.mapPos(n.head,1))}}))}const Rc=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{i.push({from:e.from,insert:t.facet(La)})})),{userEvent:"input.indent"})),!0),Ec=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Tc(t,((e,i)=>{let n=/^\s*/.exec(e.text)[0];if(!n)return;let s=Yt(n,t.tabSize),r=0,o=Ia(t,Math.max(0,s-za(t)));for(;rqh(t,(e=>Fh(t.state,e,!Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,!Ih(t))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:t=>qh(t,(e=>Fh(t.state,e,Ih(t)))),shift:t=>rc(t,(e=>Fh(t.state,e,Ih(t))))},{key:"Alt-ArrowUp",run:({state:t,dispatch:e})=>_c(t,e,!1)},{key:"Shift-Alt-ArrowUp",run:({state:t,dispatch:e})=>Xc(t,e,!1)},{key:"Alt-ArrowDown",run:({state:t,dispatch:e})=>_c(t,e,!0)},{key:"Shift-Alt-ArrowDown",run:({state:t,dispatch:e})=>Xc(t,e,!0)},{key:"Escape",run:({state:t,dispatch:e})=>{let i=t.selection,n=null;return i.ranges.length>1?n=A.create([i.main]):i.main.empty||(n=A.create([A.cursor(i.main.head)])),!!n&&(e(Yh(t,n)),!0)}},{key:"Mod-Enter",run:Ac(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:t,dispatch:e})=>{let i=Cc(t).map((({from:e,to:i})=>A.range(e,Math.min(i+1,t.doc.length))));return e(t.update({selection:A.create(i),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:t,dispatch:e})=>{let i=Uh(t.selection,(e=>{var i;let n=Xa(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 A.range(n.to,n.from)}));return e(Yh(t,i)),!0},preventDefault:!0},{key:"Mod-[",run:Ec},{key:"Mod-]",run:Rc},{key:"Mod-Alt-\\",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new ja(t,{overrideIndentation:t=>{let e=i[t];return null==e?-1:e}}),s=Tc(t,((e,s,r)=>{let o=Ba(n,e.from);if(null==o)return;/\S/.test(e.text)||(o=0);let a=/^\s*/.exec(e.text)[0],l=Ia(t,o);(a!=l||r.from{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(Cc(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=Uh(t.selection,(e=>{let s=Ll(t,e.head,-1)||Ll(t,e.head,1)||e.head>0&&Ll(t,e.head-1,1)||e.head{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=fh(t.state,i.from);return n.line?ch(t):!!n.block&&dh(t)}},{key:"Alt-A",run:uh}].concat([{key:"ArrowLeft",run:Bh,shift:ac,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:t=>Nh(t,!Ih(t)),shift:t=>hc(t,!Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:t=>qh(t,(e=>sc(t,e,!Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,!Ih(t)))),preventDefault:!0},{key:"ArrowRight",run:jh,shift:lc,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:t=>Nh(t,Ih(t)),shift:t=>hc(t,Ih(t)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:t=>qh(t,(e=>sc(t,e,Ih(t)))),shift:t=>rc(t,(e=>sc(t,e,Ih(t)))),preventDefault:!0},{key:"ArrowUp",run:Jh,shift:uc,preventDefault:!0},{mac:"Cmd-ArrowUp",run:gc,shift:bc},{mac:"Ctrl-ArrowUp",run:ic,shift:pc},{key:"ArrowDown",run:Kh,shift:dc,preventDefault:!0},{mac:"Cmd-ArrowDown",run:mc,shift:wc},{mac:"Ctrl-ArrowDown",run:nc,shift:Oc},{key:"PageUp",run:ic,shift:pc},{key:"PageDown",run:nc,shift:Oc},{key:"Home",run:t=>qh(t,(e=>sc(t,e,!1))),shift:t=>rc(t,(e=>sc(t,e,!1))),preventDefault:!0},{key:"Mod-Home",run:gc,shift:bc},{key:"End",run:t=>qh(t,(e=>sc(t,e,!0))),shift:t=>rc(t,(e=>sc(t,e,!0))),preventDefault:!0},{key:"Mod-End",run:mc,shift:wc},{key:"Enter",run:Zc},{key:"Mod-a",run:({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:xc,shift:xc},{key:"Delete",run:kc},{key:"Mod-Backspace",mac:"Alt-Backspace",run:$c},{key:"Mod-Delete",mac:"Alt-Delete",run:t=>Qc(t,!0)},{mac:"Mod-Backspace",run:t=>vc(t,(e=>{let i=t.lineBlockAt(e).from;return e>i?i:Math.max(0,e-1)}))},{mac:"Mod-Delete",run:Pc}].concat([{key:"Ctrl-b",run:Bh,shift:ac,preventDefault:!0},{key:"Ctrl-f",run:jh,shift:lc},{key:"Ctrl-p",run:Jh,shift:uc},{key:"Ctrl-n",run:Kh,shift:dc},{key:"Ctrl-a",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).from,1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).from)))},{key:"Ctrl-e",run:t=>qh(t,(e=>A.cursor(t.lineBlockAt(e.head).to,-1))),shift:t=>rc(t,(e=>A.cursor(t.lineBlockAt(e.head).to)))},{key:"Ctrl-d",run:kc},{key:"Ctrl-h",run:xc},{key:"Ctrl-k",run:Pc},{key:"Ctrl-Alt-h",run:$c},{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:A.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:f(n.text,i-n.from,!1)+n.from,r=i==n.to?i+1:f(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:A.cursor(r)}}));return!i.changes.empty&&(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:nc}].map((t=>({mac:t.key,run:t.run,shift:t.shift})))));function Mc(){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 Uc{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(Wc(t)):Wc,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 b(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=w(t),i=this.bufferStart+this.bufferPos;this.bufferPos+=v(t);let n=this.normalize(e);for(let t=0,s=i;;t++){let r=n.charCodeAt(t),o=this.match(r,s);if(o)return this.value=o,this;if(t==n.length-1)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=jc(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 Ic(e,t.sliceString(e,i));return zc.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=jc(this.text,i+(t==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ic.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function jc(t,e){if(e>=t.length)return e;let i,n=t.lineAt(e);for(;e=56320&&i<57344;)e++;return e}function Nc(t){let e=Mc("input",{class:"cm-textfield",name:"line"});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,a,l]=i,h=a?+a.slice(1):0,c=o?+o:s.number;if(o&&l){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)));t.dispatch({effects:Gc.of(!1),selection:A.cursor(u.from+Math.max(0,Math.min(h,u.length))),scrollIntoView:!0}),t.focus()}return{dom:Mc("form",{class:"cm-gotoLine",onkeydown:e=>{27==e.keyCode?(e.preventDefault(),t.dispatch({effects:Gc.of(!1)}),t.focus()):13==e.keyCode&&(e.preventDefault(),i())},onsubmit:t=>{t.preventDefault(),i()}},Mc("label",t.state.phrase("Go to line"),": ",e)," ",Mc("button",{class:"cm-button",type:"submit"},t.state.phrase("go")))}}"undefined"!=typeof Symbol&&(Lc.prototype[Symbol.iterator]=Bc.prototype[Symbol.iterator]=function(){return this});const Gc=ut.define(),Fc=q.define({create:()=>!0,update(t,e){for(let i of e.effects)i.is(Gc)&&(t=i.value);return t},provide:t=>Ur.from(t,(t=>t?Nc:null))}),Hc=Ts.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),Jc={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Kc=E.define({combine:t=>kt(t,Jc,{highlightWordAroundCursor:(t,e)=>t||e,minSelectionLength:Math.min,maxMatches:Math.min})});function tu(t){let e=[ru,su];return t&&e.push(Kc.of(t)),e}const eu=ni.mark({class:"cm-selectionMatch"}),iu=ni.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function nu(t,e,i,n){return!(0!=i&&t(e.sliceDoc(i-1,i))==wt.Word||n!=e.doc.length&&t(e.sliceDoc(n,n+1))==wt.Word)}const su=_i.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(Kc),{state:i}=t,n=i.selection;if(n.ranges.length>1)return ni.none;let s,r=n.main,o=null;if(r.empty){if(!e.highlightWordAroundCursor)return ni.none;let t=i.wordAt(r.head);if(!t)return ni.none;o=i.charCategorizer(r.head),s=i.sliceDoc(t.from,t.to)}else{let t=r.to-r.from;if(t200)return ni.none;if(e.wholeWords){if(s=i.sliceDoc(r.from,r.to),o=i.charCategorizer(r.head),!nu(o,i,r.from,r.to)||!function(t,e,i,n){return t(e.sliceDoc(i,i+1))==wt.Word&&t(e.sliceDoc(n-1,n))==wt.Word}(o,i,r.from,r.to))return ni.none}else if(s=i.sliceDoc(r.from,r.to).trim(),!s)return ni.none}let a=[];for(let n of t.visibleRanges){let t=new Uc(i.doc,s,n.from,n.to);for(;!t.next().done;){let{from:n,to:s}=t.value;if((!o||nu(o,i,n,s))&&(r.empty&&n<=r.from&&s>=r.to?a.push(iu.range(n,s)):(n>=r.to||s<=r.from)&&a.push(eu.range(n,s)),a.length>e.maxMatches))return ni.none}}return ni.set(a)}},{decorations:t=>t.decorations}),ru=Ts.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});const ou=E.define({combine:t=>kt(t,{top:!1,caseSensitive:!1,literal:!1,wholeWord:!1,createPanel:t=>new Eu(t),scrollToMatch:t=>Ts.scrollIntoView(t)})});class au{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,qc),!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 pu(this):new cu(this)}getCursor(t,e=0,i){let n=t.doc?t:xt.create({doc:t});return null==i&&(i=n.doc.length),this.regexp?uu(this,n,e,i):hu(this,n,e,i)}}class lu{constructor(t){this.spec=t}}function hu(t,e,i,n){return new Uc(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=hu(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 uu(t,e,i,n){return new Lc(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?(s=e.charCategorizer(e.selection.main.head),(t,e,i)=>!i[0].length||(s(du(i.input,i.index))!=wt.Word||s(fu(i.input,i.index))!=wt.Word)&&(s(fu(i.input,i.index+i[0].length))!=wt.Word||s(du(i.input,i.index+i[0].length))!=wt.Word)):void 0},i,n);var s}function du(t,e){return t.slice(f(t,e,!1),e)}function fu(t,e){return t.slice(e,f(t,e))}class pu extends lu{nextMatch(t,e,i){let n=uu(this.spec,t,i,t.doc.length).next();return n.done&&(n=uu(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=uu(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=uu(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 Ou=ut.define(),gu=ut.define(),mu=q.define({create:t=>new bu(_u(t).create(),null),update(t,e){for(let i of e.effects)i.is(Ou)?t=new bu(i.value.create(),t.panel):i.is(gu)&&(t=new bu(t.query,i.value?Cu:null));return t},provide:t=>Ur.from(t,(t=>t.panel))});class bu{constructor(t,e){this.query=t,this.panel=e}}const wu=ni.mark({class:"cm-searchMatch"}),vu=ni.mark({class:"cm-searchMatch cm-searchMatch-selected"}),yu=_i.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(mu))}update(t){let e=t.state.field(mu);(e!=t.startState.field(mu)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ni.none;let{view:i}=this,n=new Xt;for(let e=0,s=i.visibleRanges,r=s.length;es[e+1].from-500;)a=s[++e].to;t.highlight(i.state,o,a,((t,e)=>{let s=i.state.selection.ranges.some((i=>i.from==t&&i.to==e));n.add(t,e,s?vu:wu)}))}return n.finish()}},{decorations:t=>t.decorations});function Su(t){return e=>{let i=e.state.field(mu,!1);return i&&i.query.spec.valid?t(e,i):Au(e)}}const xu=Su(((t,{query:e})=>{let{to:i}=t.state.selection.main,n=e.nextMatch(t.state,i,i);if(!n)return!1;let s=A.single(n.from,n.to),r=t.state.facet(ou);return t.dispatch({selection:s,effects:[Wu(t,n),r.scrollToMatch(s.main,t)],userEvent:"select.search"}),Zu(t),!0})),ku=Su(((t,{query:e})=>{let{state:i}=t,{from:n}=i.selection.main,s=e.prevMatch(i,n,n);if(!s)return!1;let r=A.single(s.from,s.to),o=t.state.facet(ou);return t.dispatch({selection:r,effects:[Wu(t,s),o.scrollToMatch(r.main,t)],userEvent:"select.search"}),Zu(t),!0})),Qu=Su(((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!(!i||!i.length)&&(t.dispatch({selection:A.create(i.map((t=>A.range(t.from,t.to)))),userEvent:"select.search.matches"}),!0)})),$u=Su(((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,a,l=[],h=[];if(r.from==n&&r.to==s&&(a=i.toText(e.getReplacement(r)),l.push({from:r.from,to:r.to,insert:a}),r=e.nextMatch(i,r.from,r.to),h.push(Ts.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(n).number)+"."))),r){let e=0==l.length||l[0].from>=r.to?0:r.to-r.from-a.length;o=A.single(r.from-e,r.to-e),h.push(Wu(t,r)),h.push(i.facet(ou).scrollToMatch(o.main,t))}return t.dispatch({changes:l,selection:o,effects:h,userEvent:"input.replace"}),!0})),Pu=Su(((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:Ts.announce.of(n),userEvent:"input.replace.all"}),!0}));function Cu(t){return t.state.facet(ou).createPanel(t)}function _u(t,e){var i,n,s,r;let o=t.selection.main,a=o.empty||o.to>o.from+100?"":t.sliceDoc(o.from,o.to);if(e&&!a)return e;let l=t.facet(ou);return new au({search:(null!==(i=null==e?void 0:e.literal)&&void 0!==i?i:l.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:null!==(n=null==e?void 0:e.caseSensitive)&&void 0!==n?n:l.caseSensitive,literal:null!==(s=null==e?void 0:e.literal)&&void 0!==s?s:l.literal,wholeWord:null!==(r=null==e?void 0:e.wholeWord)&&void 0!==r?r:l.wholeWord})}function Xu(t){let e=Vr(t,Cu);return e&&e.dom.querySelector("[main-field]")}function Zu(t){let e=Xu(t);e&&e==t.root.activeElement&&e.select()}const Au=t=>{let e=t.state.field(mu,!1);if(e&&e.panel){let i=Xu(t);if(i&&i!=t.root.activeElement){let n=_u(t.state,e.query.spec);n.valid&&t.dispatch({effects:Ou.of(n)}),i.focus(),i.select()}}else t.dispatch({effects:[gu.of(!0),e?Ou.of(_u(t.state,e.query.spec)):ut.appendConfig.of(Yu)]});return!0},Tu=t=>{let e=t.state.field(mu,!1);if(!e||!e.panel)return!1;let i=Vr(t,Cu);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:gu.of(!1)}),!0},Ru=[{key:"Mod-f",run:Au,scope:"editor search-panel"},{key:"F3",run:xu,shift:ku,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:xu,shift:ku,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Tu,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 Uc(t.doc,t.sliceDoc(n,s));!e.next().done;){if(r.length>1e3)return!1;e.value.from==n&&(o=r.length),r.push(A.range(e.value.from,e.value.to))}return e(t.update({selection:A.create(r,o),userEvent:"select.search.matches"})),!0}},{key:"Alt-g",run:t=>{let e=Vr(t,Nc);if(!e){let i=[Gc.of(!0)];null==t.state.field(Fc,!1)&&i.push(ut.appendConfig.of([Fc,Hc])),t.dispatch({effects:i}),e=Vr(t,Nc)}return e&&e.dom.querySelector("input").focus(),!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=A.create(i.ranges.map((e=>t.wordAt(e.head)||A.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 Uc(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 Uc(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(A.range(s.from,s.to),!1),effects:Ts.scrollIntoView(s.to)})),!0)},preventDefault:!0}];class Eu{constructor(t){this.view=t;let e=this.query=t.state.field(mu).query.spec;function i(t,e,i){return Mc("button",{class:"cm-button",name:t,onclick:e,type:"button"},i)}this.commit=this.commit.bind(this),this.searchField=Mc("input",{value:e.search,placeholder:Vu(t,"Find"),"aria-label":Vu(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Mc("input",{value:e.replace,placeholder:Vu(t,"Replace"),"aria-label":Vu(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Mc("input",{type:"checkbox",name:"case",form:"",checked:e.caseSensitive,onchange:this.commit}),this.reField=Mc("input",{type:"checkbox",name:"re",form:"",checked:e.regexp,onchange:this.commit}),this.wordField=Mc("input",{type:"checkbox",name:"word",form:"",checked:e.wholeWord,onchange:this.commit}),this.dom=Mc("div",{onkeydown:t=>this.keydown(t),class:"cm-search"},[this.searchField,i("next",(()=>xu(t)),[Vu(t,"next")]),i("prev",(()=>ku(t)),[Vu(t,"previous")]),i("select",(()=>Qu(t)),[Vu(t,"all")]),...t.state.readOnly?[]:[Mc("br"),this.replaceField,i("replace",(()=>$u(t)),[Vu(t,"replace")]),i("replaceAll",(()=>Pu(t)),[Vu(t,"replace all")])],Mc("button",{name:"close",onclick:()=>Tu(t),"aria-label":Vu(t,"close"),type:"button"},["×"])])}commit(){let t=new au({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:Ou.of(t)}))}keydown(t){var e,i,n;e=this.view,i=t,n="search-panel",Bs(Ls(e.state),i,e,n)?t.preventDefault():13==t.keyCode&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?ku:xu)(this.view)):13==t.keyCode&&t.target==this.replaceField&&(t.preventDefault(),$u(this.view))}update(t){for(let e of t.transactions)for(let t of e.effects)t.is(Ou)&&!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(ou).top}}function Vu(t,e){return t.state.phrase(e)}const Mu=30,Du=/[\s\.,:;?!]/;function Wu(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-Mu),o=Math.min(s,i+Mu),a=t.state.sliceDoc(r,o);if(r!=n.from)for(let t=0;ta.length-Mu;t--)if(!Du.test(a[t-1])&&Du.test(a[t])){a=a.slice(0,t);break}return Ts.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${n.number}.`)}const Uu=Ts.baseTheme({".cm-panel.cm-search":{padding:"0.25rem 0.5rem 0.25rem 0.5rem",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"0.5rem",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"}}),Yu=[mu,N.lowest(yu),Uu];class qu{constructor(t,e,i){this.state=t,this.pos=e,this.explicit=i,this.abortListeners=[]}tokenBefore(t){let e=Xa(this.state).resolveInner(this.pos,-1);for(;e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null}matchBefore(t){let e=this.state.doc.lineAt(this.pos),i=Math.max(e.from,this.pos-250),n=e.text.slice(i-e.from,this.pos-e.from),s=n.search(ju(t,!1));return s<0?null:{from:i+s,to:this.pos,text:n.slice(s)}}get aborted(){return null==this.abortListeners}addEventListener(t,e){"abort"==t&&this.abortListeners&&this.abortListeners.push(e)}}function Lu(t){let e=Object.keys(t).join(""),i=/\w/.test(e);return i&&(e=e.replace(/\w/g,"")),`[${i?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function zu(t){let e=t.map((t=>"string"==typeof t?{label:t}:t)),[i,n]=e.every((t=>/^\w+$/.test(t.label)))?[/\w*$/,/\w+$/]:function(t){let e=Object.create(null),i=Object.create(null);for(let{label:n}of t){e[n[0]]=!0;for(let t=1;t{let s=t.matchBefore(n);return s||t.explicit?{from:s?s.from:t.pos,options:e,validFor:i}:null}}class Iu{constructor(t,e,i,n){this.completion=t,this.source=e,this.match=i,this.score=n}}function Bu(t){return t.selection.main.from}function ju(t,e){var i;let{source:n}=t,s=e&&"^"!=n[0],r="$"!=n[n.length-1];return s||r?new RegExp(`${s?"^":""}(?:${n})${r?"$":""}`,null!==(i=t.flags)&&void 0!==i?i:t.ignoreCase?"i":""):t}const Nu=lt.define();const Gu=new WeakMap;function Fu(t){if(!Array.isArray(t))return t;let e=Gu.get(t);return e||Gu.set(t,e=zu(t)),e}const Hu=ut.define(),Ju=ut.define();class Ku{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[];for(let e=0;e=48&&l<=57||l>=97&&l<=122?2:l>=65&&l<=90?1:0:(y=w(l))!=y.toLowerCase()?1:y!=y.toUpperCase()?2:0;(!n||1==S&&O||0==m&&0!=S)&&(e[c]==l||i[c]==l&&(u=!0)?r[c++]=n:r.length&&(g=!1)),m=S,n+=v(l)}return c==a&&0==r[0]&&g?this.result((u?-200:0)-100,r,t):d==a&&0==f?[-200-t.length+(p==t.length?0:-100),0,p]:o>-1?[-700-t.length,o,o+this.pattern.length]:d==a?[-900-t.length,f,p]:c==a?this.result((u?-200:0)-100-700+(g?0:-1100),r,t):2==e.length?null:this.result((n[0]?-700:0)-200-1100,n,t)}result(t,e,i){let n=[t-i.length],s=1;for(let t of e){let e=t+(this.astral?v(b(i,t)):1);s>1&&n[s-1]==t?n[s-1]=e:(n[s++]=t,n[s++]=e)}return n}}const td=E.define({combine:t=>kt(t,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:id,compareCompletions:(t,e)=>t.label.localeCompare(e.label),interactionDelay:75},{defaultKeymap:(t,e)=>t&&e,closeOnBlur:(t,e)=>t&&e,icons:(t,e)=>t&&e,tooltipClass:(t,e)=>i=>ed(t(i),e(i)),optionClass:(t,e)=>i=>ed(t(i),e(i)),addToOptions:(t,e)=>t.concat(e)})});function ed(t,e){return t?e?t+" "+e:t:e}function id(t,e,i,n,s){let r,o,a=t.textDirection==Wi.RTL,l=a,h=!1,c="top",u=e.left-s.left,d=s.right-e.right,f=n.right-n.left,p=n.bottom-n.top;if(l&&u=p||t>e.top?r=i.bottom-e.top:(c="bottom",r=e.bottom-i.top)}return{style:`${c}: ${r}px; max-width: ${o}px`,class:"cm-completionInfo-"+(h?a?"left-narrow":"right-narrow":l?"left":"right")}}function nd(t,e="option"){return i=>{let n=i.state.field(yd,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp-1?n.open.selected+r*(t?1:-1):t?0:o-1;return a<0?a="page"==e?0:o-1:a>=o&&(a="page"==e?o-1:0),i.dispatch({effects:vd.of(a)}),!0}}const sd=t=>{let e=t.state.field(yd,!1);return!(t.state.readOnly||!e||!e.open||e.open.selected<0||Date.now()-e.open.timestamp(t.selection||t.docChanged)&&!gd(t)));for(let e=0;e50&&Date.now()-n.time>1e3){for(let t of n.context.abortListeners)try{t()}catch(t){Qi(this.view.state,t)}n.context.abortListeners=null,this.running.splice(e--,1)}else n.updates.push(...t.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some((t=>1==t.state&&!this.running.some((e=>e.active.source==t.source))))?setTimeout((()=>this.startUpdate()),50):-1,0!=this.composing)for(let e of t.transactions)"input"==gd(e)?this.composing=2:2==this.composing&&e.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:t}=this.view,e=t.field(yd);for(let t of e.active)1!=t.state||this.running.some((e=>e.active.source==t.source))||this.startQuery(t)}startQuery(t){let{state:e}=this.view,i=Bu(e),n=new qu(e,i,t.explicitPos==i),s=new rd(t,n);this.running.push(s),Promise.resolve(t.source(n)).then((t=>{s.context.aborted||(s.done=t||null,this.scheduleAccept())}),(t=>{this.view.dispatch({effects:Ju.of(null)}),Qi(this.view.state,t)}))}scheduleAccept(){this.running.every((t=>void 0!==t.done))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((()=>this.accept()),50))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],i=this.view.state.facet(td);for(let n=0;nt.source==s.active.source));if(r&&1==r.state)if(null==s.done){let t=new md(s.active.source,0);for(let e of s.updates)t=t.update(e,i);1!=t.state&&e.push(t)}else this.startQuery(r)}e.length&&this.view.dispatch({effects:wd.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(yd,!1);if(e&&e.tooltip&&this.view.state.facet(td).closeOnBlur){let i=e.open&&Rr(this.view,e.open.tooltip);i&&i.dom.contains(t.relatedTarget)||this.view.dispatch({effects:Ju.of(null)})}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout((()=>this.view.dispatch({effects:Hu.of(!1)})),20),this.composing=0}}});function ad(t,e){const i=e.completion.apply||e.completion.label;let n=t.state.field(yd).active.find((t=>t.source==e.source));return n instanceof bd&&("string"==typeof i?t.dispatch(Object.assign(Object.assign({},function(t,e,i,n){let{main:s}=t.selection,r=i-s.from,o=n-s.from;return Object.assign(Object.assign({},t.changeByRange((a=>a!=s&&i!=n&&t.sliceDoc(a.from+r,a.from+o)!=t.sliceDoc(i,n)?{range:a}:{changes:{from:a.from+r,to:n==s.from?a.to:a.from+o,insert:e},range:A.cursor(a.from+r+e.length)}))),{userEvent:"input.complete"})}(t.state,i,n.from,n.to)),{annotations:Nu.of(e.completion)})):i(t,e.completion,n.from,n.to),!0)}function ld(t,e,i){if(t<=i)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let t=Math.floor(e/i);return{from:t*i,to:(t+1)*i}}let n=Math.floor((t-e)/i);return{from:t-(n+1)*i,to:t-n*i}}class hd{constructor(t,e){this.view=t,this.stateField=e,this.info=null,this.placeInfoReq={read:()=>this.measureInfo(),write:t=>this.placeInfo(t),key:this},this.space=null,this.currentClass="";let i=t.state.field(e),{options:n,selected:s}=i.open,r=t.state.facet(td);this.optionContent=function(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(t){let e=document.createElement("div");return e.classList.add("cm-completionIcon"),t.type&&e.classList.add(...t.type.split(/\s+/g).map((t=>"cm-completionIcon-"+t))),e.setAttribute("aria-hidden","true"),e},position:20}),e.push({render(t,e,i){let n=document.createElement("span");n.className="cm-completionLabel";let{label:s}=t,r=0;for(let t=1;tr&&n.appendChild(document.createTextNode(s.slice(r,e)));let a=n.appendChild(document.createElement("span"));a.appendChild(document.createTextNode(s.slice(e,o))),a.className="cm-completionMatchedText",r=o}return rt.position-e.position)).map((t=>t.render))}(r),this.optionClass=r.optionClass,this.tooltipClass=r.tooltipClass,this.range=ld(n.length,s,r.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",(e=>{for(let i,s=e.target;s&&s!=this.dom;s=s.parentNode)if("LI"==s.nodeName&&(i=/-(\d+)$/.exec(s.id))&&+i[1]{let i=t.state.field(this.stateField,!1);i&&i.tooltip&&t.state.facet(td).closeOnBlur&&e.relatedTarget!=t.contentDOM&&t.dispatch({effects:Ju.of(null)})})),this.list=this.dom.appendChild(this.createListBox(n,i.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))}mount(){this.updateSel()}update(t){var e,i,n;let s=t.state.field(this.stateField),r=t.startState.field(this.stateField);this.updateTooltipClass(t.state),s!=r&&(this.updateSel(),(null===(e=s.open)||void 0===e?void 0:e.disabled)!=(null===(i=r.open)||void 0===i?void 0:i.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!(null===(n=s.open)||void 0===n?void 0:n.disabled)))}updateTooltipClass(t){let e=this.tooltipClass(t);if(e!=this.currentClass){for(let t of this.currentClass.split(" "))t&&this.dom.classList.remove(t);for(let t of e.split(" "))t&&this.dom.classList.add(t);this.currentClass=e}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),e=t.open;if((e.selected>-1&&e.selected=this.range.to)&&(this.range=ld(e.options.length,e.selected,this.view.state.facet(td).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e.options,t.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))),this.updateSelectedOption(e.selected)){this.info&&(this.info.remove(),this.info=null);let{completion:i}=e.options[e.selected],{info:n,label:s,c:r}=i;if(!n)return;let o="string"==typeof n?document.createTextNode(n+" "):n(i);if(!o)return;if(!r){const t=document.createElement("span");t.appendChild(o),o=t;const e=document.createElement("a");e.innerText="🔎",e.href="/docFind/"+s,e.target="blank",o.appendChild(e)}if(!o)return;"then"in o?o.then((e=>{e&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(e)})).catch((t=>Qi(this.view.state,t,"completion info"))):this.addInfoPane(o)}}addInfoPane(t){let e=this.info=document.createElement("div");e.className="cm-tooltip cm-completionInfo",e.appendChild(t),this.dom.appendChild(e),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let e=null;for(let i=this.list.firstChild,n=this.range.from;i;i=i.nextSibling,n++)"LI"==i.nodeName&&i.id?n==t?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),e=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected"):n--;return e&&function(t,e){let i=t.getBoundingClientRect(),n=e.getBoundingClientRect();n.topi.bottom&&(t.scrollTop+=n.bottom-i.bottom)}(this.list,e),e}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let e=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),n=t.getBoundingClientRect(),s=this.space;if(!s){let t=this.dom.ownerDocument.defaultView||window;s={left:0,top:0,right:t.innerWidth,bottom:t.innerHeight}}return n.top>Math.min(s.bottom,e.bottom)-10||n.bottomi.from||0==i.from))if(s=t,"string"!=typeof l&&l.header)n.appendChild(l.header(l));else{n.appendChild(document.createElement("completion-section")).textContent=t}}const h=n.appendChild(document.createElement("li"));h.id=e+"-"+r,h.setAttribute("role","option");let c=this.optionClass(o);c&&(h.className=c);for(let t of this.optionContent){let e=t(o,this.view.state,a);e&&h.appendChild(e)}}return i.from&&n.classList.add("cm-completionListIncompleteTop"),i.to=this.options.length?this:new ud(this.options,pd(e,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,e,i,n,s){let r=function(t,e){let i=[],n=null,s=t=>{i.push(t);let{section:e}=t.completion;if(e){n||(n=[]);let t="string"==typeof e?e:e.name;n.some((e=>e.name==t))||n.push("string"==typeof e?{name:t}:e)}};for(let n of t)if(n.hasResult())if(!1===n.result.filter){let t=n.result.getMatch;for(let e of n.result.options){let r=[1e9-i.length];if(t)for(let i of t(e))r.push(i);s(new Iu(e,n.source,r,r[0]))}}else{let t,i=new Ku(e.sliceDoc(n.from,n.to));for(let e of n.result.options)(t=i.match(e.label))&&s(new Iu(e,n.source,t,t[0]+(e.boost||0)))}if(n){let t=Object.create(null),e=0,s=(t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:1e9)-(null!==(n=e.rank)&&void 0!==n?n:1e9)||(t.namee.score-t.score||a(t.completion,e.completion))))!o||o.label!=t.completion.label||o.detail!=t.completion.detail||null!=o.type&&null!=t.completion.type&&o.type!=t.completion.type||o.apply!=t.completion.apply?r.push(t):cd(t.completion)>cd(o)&&(r[r.length-1]=t),o=t.completion;return r}(t,e);if(!r.length)return n&&t.some((t=>1==t.state))?new ud(n.options,n.attrs,n.tooltip,n.timestamp,n.selected,!0):null;let o=e.facet(td).selectOnOpen?0:-1;if(n&&n.selected!=o&&-1!=n.selected){let t=n.options[n.selected].completion;for(let e=0;ee.hasResult()?Math.min(t,e.from):t),1e8),create:(a=yd,t=>new hd(t,a)),above:s.aboveCursor},n?n.timestamp:Date.now(),o,!1);var a}map(t){return new ud(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class dd{constructor(t,e,i){this.active=t,this.id=e,this.open=i}static start(){return new dd(Od,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(t){let{state:e}=t,i=e.facet(td),n=(i.override||e.languageDataAt("autocomplete",Bu(e)).map(Fu)).map((e=>(this.active.find((t=>t.source==e))||new md(e,this.active.some((t=>0!=t.state))?1:0)).update(t,i)));n.length==this.active.length&&n.every(((t,e)=>t==this.active[e]))&&(n=this.active);let s=this.open;s&&t.docChanged&&(s=s.map(t.changes)),t.selection||n.some((e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to)))||!function(t,e){if(t==e)return!0;for(let i=0,n=0;;){for(;i1==t.state))&&(s=null),!s&&n.every((t=>1!=t.state))&&n.some((t=>t.hasResult()))&&(n=n.map((t=>t.hasResult()?new md(t.source,0):t)));for(let e of t.effects)e.is(vd)&&(s=s&&s.setSelected(e.value,this.id));return n==this.active&&s==this.open?this:new dd(n,this.id,s)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:fd}}const fd={"aria-autocomplete":"list"};function pd(t,e){let i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(i["aria-activedescendant"]=t+"-"+e),i}const Od=[];function gd(t){return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null}class md{constructor(t,e,i=-1){this.source=t,this.state=e,this.explicitPos=i}hasResult(){return!1}update(t,e){let i=gd(t),n=this;i?n=n.handleUserEvent(t,i,e):t.docChanged?n=n.handleChange(t):t.selection&&0!=n.state&&(n=new md(n.source,0));for(let e of t.effects)if(e.is(Hu))n=new md(n.source,1,e.value?Bu(t.state):-1);else if(e.is(Ju))n=new md(n.source,0);else if(e.is(wd))for(let t of e.value)t.source==n.source&&(n=t);return n}handleUserEvent(t,e,i){return"delete"!=e&&i.activateOnTyping?new md(this.source,1):this.map(t.changes)}handleChange(t){return t.changes.touchesRange(Bu(t.startState))?new md(this.source,0):this.map(t.changes)}map(t){return t.empty||this.explicitPos<0?this:new md(this.source,this.state,t.mapPos(this.explicitPos))}}class bd extends md{constructor(t,e,i,n,s){super(t,2,e),this.result=i,this.from=n,this.to=s}hasResult(){return!0}handleUserEvent(t,e,i){var n;let s=t.changes.mapPos(this.from),r=t.changes.mapPos(this.to,1),o=Bu(t.state);if((this.explicitPos<0?o<=s:or||"delete"==e&&Bu(t.startState)==this.from)return new md(this.source,"input"==e&&i.activateOnTyping?1:0);let a,l=this.explicitPos<0?-1:t.changes.mapPos(this.explicitPos);return function(t,e,i,n){if(!t)return!1;let s=e.sliceDoc(i,n);return"function"==typeof t?t(s,i,n,e):ju(t,!0).test(s)}(this.result.validFor,t.state,s,r)?new bd(this.source,l,this.result,s,r):this.result.update&&(a=this.result.update(this.result,s,r,new qu(t.state,o,l>=0)))?new bd(this.source,l,a,a.from,null!==(n=a.to)&&void 0!==n?n:Bu(t.state)):new md(this.source,1,l)}handleChange(t){return t.changes.touchesRange(this.from,this.to)?new md(this.source,0):this.map(t.changes)}map(t){return t.empty?this:new bd(this.source,this.explicitPos<0?-1:t.mapPos(this.explicitPos),this.result,t.mapPos(this.from),t.mapPos(this.to,1))}}const wd=ut.define({map:(t,e)=>t.map((t=>t.map(e)))}),vd=ut.define(),yd=q.define({create:()=>dd.start(),update:(t,e)=>t.update(e),provide:t=>[Tr.from(t,(t=>t.tooltip)),Ts.contentAttributes.from(t,(t=>t.attrs))]}),Sd=Ts.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class xd{constructor(t,e,i,n){this.field=t,this.line=e,this.from=i,this.to=n}}class kd{constructor(t,e,i){this.field=t,this.from=e,this.to=i}map(t){let e=t.mapPos(this.from,-1,S.TrackDel),i=t.mapPos(this.to,1,S.TrackDel);return null==e||null==i?null:new kd(this.field,e,i)}}class Qd{constructor(t,e){this.lines=t,this.fieldPositions=e}instantiate(t,e){let i=[],n=[e],s=t.doc.lineAt(e),r=/^\s*/.exec(s.text)[0];for(let s of this.lines){if(i.length){let i=r,o=/^\t*/.exec(s)[0].length;for(let e=0;enew kd(t.field,n[t.line]+t.from,n[t.line]+t.to)));return{text:i,ranges:o}}static parse(t){let e,i=[],n=[],s=[];for(let r of t.split(/\r\n?|\n/)){for(;e=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(r);){let t=e[1]?+e[1]:null,o=e[2]||e[3]||"",a=-1;for(let e=0;e=a&&t.field++}s.push(new xd(a,n.length,e.index,e.index+o.length)),r=r.slice(0,e.index)+o+r.slice(e.index+e[0].length)}for(let t;t=/\\([{}])/.exec(r);){r=r.slice(0,t.index)+t[1]+r.slice(t.index+t[0].length);for(let e of s)e.line==n.length&&e.from>t.index&&(e.from--,e.to--)}n.push(r)}return new Qd(n,s)}}let $d=ni.widget({widget:new class extends ei{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),Pd=ni.mark({class:"cm-snippetField"});class Cd{constructor(t,e){this.ranges=t,this.active=e,this.deco=ni.set(t.map((t=>(t.from==t.to?$d:Pd).range(t.from,t.to))))}map(t){let e=[];for(let i of this.ranges){let n=i.map(t);if(!n)return null;e.push(n)}return new Cd(e,this.active)}selectionInsideField(t){return t.ranges.every((t=>this.ranges.some((e=>e.field==this.active&&e.from<=t.from&&e.to>=t.to))))}}const _d=ut.define({map:(t,e)=>t&&t.map(e)}),Xd=ut.define(),Zd=q.define({create:()=>null,update(t,e){for(let i of e.effects){if(i.is(_d))return i.value;if(i.is(Xd)&&t)return new Cd(t.ranges,i.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>Ts.decorations.from(t,(t=>t?t.deco:ni.none))});function Ad(t,e){return A.create(t.filter((t=>t.field==e)).map((t=>A.range(t.from,t.to))))}function Td(e){let i=Qd.parse(e);return(e,n,s,r)=>{let{text:o,ranges:a}=i.instantiate(e.state,s),l={changes:{from:s,to:r,insert:t.of(o)},scrollIntoView:!0,annotations:n?Nu.of(n):void 0};if(a.length&&(l.selection=Ad(a,0)),a.length>1){let t=new Cd(a,0),i=l.effects=[_d.of(t)];void 0===e.state.field(Zd,!1)&&i.push(ut.appendConfig.of([Zd,Md,Wd,Sd]))}e.dispatch(e.state.update(l))}}function Rd(t){return({state:e,dispatch:i})=>{let n=e.field(Zd,!1);if(!n||t<0&&0==n.active)return!1;let s=n.active+t,r=t>0&&!n.ranges.some((e=>e.field==s+t));return i(e.update({selection:Ad(n.ranges,s),effects:_d.of(r?null:new Cd(n.ranges,s))})),!0}}const Ed=[{key:"Tab",run:Rd(1),shift:Rd(-1)},{key:"Escape",run:({state:t,dispatch:e})=>!!t.field(Zd,!1)&&(e(t.update({effects:_d.of(null)})),!0)}],Vd=E.define({combine:t=>t.length?t[0]:Ed}),Md=N.highest(Ys.compute([Vd],(t=>t.facet(Vd))));function Dd(t,e){return Object.assign(Object.assign({},e),{apply:Td(t)})}const Wd=Ts.domEventHandlers({mousedown(t,e){let i,n=e.state.field(Zd,!1);if(!n||null==(i=e.posAtCoords({x:t.clientX,y:t.clientY})))return!1;let s=n.ranges.find((t=>t.from<=i&&t.to>=i));return!(!s||s.field==n.active)&&(e.dispatch({selection:Ad(n.ranges,s.field),effects:_d.of(n.ranges.some((t=>t.field>s.field))?new Cd(n.ranges,s.field):null)}),!0)}}),Ud=new class extends Qt{};function Yd(t={}){return[yd,td.of(t),od,Ld,Sd]}Ud.startSide=1,Ud.endSide=-1;const qd=[{key:"Ctrl-Space",run:t=>!!t.state.field(yd,!1)&&(t.dispatch({effects:Hu.of(!0)}),!0)},{key:"Escape",run:t=>{let e=t.state.field(yd,!1);return!(!e||!e.active.some((t=>0!=t.state)))&&(t.dispatch({effects:Ju.of(null)}),!0)}},{key:"ArrowDown",run:nd(!0)},{key:"ArrowUp",run:nd(!1)},{key:"PageDown",run:nd(!0,"page")},{key:"PageUp",run:nd(!1,"page")},{key:"Enter",run:sd}],Ld=N.highest(Ys.computeN([td],(t=>t.facet(td).defaultKeymap?[qd]:[]))),zd=(()=>[vr(),Sh(),ir(),$l(_l,{fallback:!0}),Ys.of([...Vc,...Wh])])();class Id{constructor(t,e,i,n,s,r,o,a,l,h=0,c){this.p=t,this.stack=e,this.state=i,this.reducePos=n,this.pos=s,this.score=r,this.buffer=o,this.bufferBase=a,this.curContext=l,this.lookAhead=h,this.parent=c}toString(){return`[${this.stack.filter(((t,e)=>e%3==0)).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,i=0){let n=t.parser.context;return new Id(t,[],e,i,i,0,[],0,n?new Bd(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let i=t>>19,n=65535&t,{parser:s}=this.p,r=s.dynamicPrecedence(n);if(r&&(this.score+=r),0==i)return this.pushState(s.getGoto(this.state,n,!0),this.reducePos),n=2e3&&!(null===(e=this.p.parser.nodeSet.types[n])||void 0===e?void 0:e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=l):this.p.lastBigReductionSizeo;)this.stack.pop();this.reduceContext(n,a)}storeNode(t,e,i,n=4,s=!1){if(0==t&&(!this.stack.length||this.stack[this.stack.length-1]0&&0==t.buffer[n-4]&&t.buffer[n-1]>-1){if(e==i)return;if(t.buffer[n-2]>=e)return void(t.buffer[n-2]=i)}}if(s&&this.pos!=i){let s=this.buffer.length;if(s>0&&0!=this.buffer[s-4])for(;s>0&&this.buffer[s-2]>i;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,n>4&&(n-=4);this.buffer[s]=t,this.buffer[s+1]=e,this.buffer[s+2]=i,this.buffer[s+3]=n}else this.buffer.push(t,e,i,n)}shift(t,e,i){let n=this.pos;if(131072&t)this.pushState(65535&t,this.pos);else if(0==(262144&t)){let s=t,{parser:r}=this.p;(i>this.pos||e<=r.maxNode)&&(this.pos=i,r.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,n),this.shiftContext(e,n),e<=r.maxNode&&this.buffer.push(e,n,i,4)}else this.pos=i,this.shiftContext(e,n),e<=this.p.parser.maxNode&&this.buffer.push(e,n,i,4)}apply(t,e,i){65536&t?this.reduce(t):this.shift(t,e,i)}useNode(t,e){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=t)&&(this.p.reused.push(t),i++);let n=this.pos;this.reducePos=this.pos=n+t.length,this.pushState(e,n),this.buffer.push(i,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let i=t.buffer.slice(e),n=t.bufferBase+e;for(;t&&n==t.bufferBase;)t=t.parent;return new Id(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,n,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let i=t<=this.p.parser.maxNode;i&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,i?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new Nd(this);;){let i=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(0==i)return!1;if(0==(65536&i))return!0;e.reduce(i)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let n,s=0;s1&e&&t==n))||i.push(e[t],n)}e=i}let i=[];for(let t=0;t>19,n=65535&t,s=this.stack.length-3*i;if(s<0||e.getGoto(this.stack[s],n,!1)<0)return!1;this.storeNode(0,this.reducePos,this.reducePos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:t}=this.p;return 65535==t.data[t.stateSlot(this.state,1)]&&!t.stateSlot(this.state,4)}restart(){this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;ethis.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Bd{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}var jd;!function(t){t[t.Insert=200]="Insert",t[t.Delete=190]="Delete",t[t.Reduce=100]="Reduce",t[t.MaxNext=4]="MaxNext",t[t.MaxInsertStackDepth=300]="MaxInsertStackDepth",t[t.DampenInsertStackDepth=120]="DampenInsertStackDepth",t[t.MinBigReduction=2e3]="MinBigReduction"}(jd||(jd={}));class Nd{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=65535&t,i=t>>19;0==i?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(i-1);let n=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=n}}class Gd{constructor(t,e,i){this.stack=t,this.pos=e,this.index=i,this.buffer=t.buffer,0==this.index&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new Gd(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;null!=t&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new Gd(this.stack,this.pos,this.index)}}function Fd(t,e=Uint16Array){if("string"!=typeof t)return t;let i=null;for(let n=0,s=0;n=92&&e--,e>=34&&e--;let s=e-32;if(s>=46&&(s-=46,i=!0),r+=s,i)break;r*=46}i?i[s++]=r:i=new e(r)}return i}class Hd{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Jd=new Hd;class Kd{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Jd,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let i=this.range,n=this.rangeIndex,s=this.pos+t;for(;si.to:s>=i.to;){if(n==this.ranges.length-1)return null;let t=this.ranges[++n];s+=t.from-i.to,i=t}return s}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,e.from);return this.end}peek(t){let e,i,n=this.chunkOff+t;if(n>=0&&n=this.chunk2Pos&&en.to&&(this.chunk2=this.chunk2.slice(0,n.to-e)),i=this.chunk2.charCodeAt(0)}}return e>=this.token.lookAhead&&(this.token.lookAhead=e+1),i}acceptToken(t,e=0){let i=e?this.resolveOffset(e,-1):this.pos;if(null==i||i=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=Jd,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let i="";for(let n of this.ranges){if(n.from>=e)break;n.to>t&&(i+=this.input.read(Math.max(n.from,t),Math.min(n.to,e)))}return i}}class tf{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:i}=e.p;sf(this.data,t,e,this.id,i.data,i.tokenPrecTable)}}tf.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class ef{constructor(t,e,i){this.precTable=e,this.elseToken=i,this.data="string"==typeof t?Fd(t):t}token(t,e){let i=t.pos,n=0;for(;sf(this.data,t,e,0,this.data,this.precTable),!(t.token.value>-1);){if(null==this.elseToken)return;if(t.next<0)break;t.advance(),t.reset(t.pos,t.token),n++}n&&(t.reset(i,t.token),t.acceptToken(this.elseToken,n))}}ef.prototype.contextual=tf.prototype.fallback=tf.prototype.extend=!1;class nf{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function sf(t,e,i,n,s,r){let o=0,a=1<0){let i=t[n];if(l.allows(i)&&(-1==e.token.value||e.token.value==i||of(i,e.token.value,s,r))){e.acceptToken(i);break}}let n=e.next,h=0,c=t[o+2];if(!(e.next<0&&c>h&&65535==t[i+3*c-3]&&65535==t[i+3*c-3])){for(;h>1,r=i+s+(s<<1),a=t[r],l=t[r+1]||65536;if(n=l)){o=t[r+2],e.advance();continue t}h=s+1}}break}o=t[i+3*c-1]}}function rf(t,e,i){for(let n,s=e;65535!=(n=t[s]);s++)if(n==i)return s-e;return-1}function of(t,e,i,n){let s=rf(i,n,e);return s<0||rf(i,n,t)e)&&!n.type.isError)return i<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(t.length,Math.max(n.from+1,e+25));if(i<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return i<0?0:t.length}}!function(t){t[t.Margin=25]="Margin"}(hf||(hf={}));let uf=class{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?cf(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?cf(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=r,null;if(s instanceof bo){if(r==t){if(r=Math.max(this.safeFrom,t)&&(this.trees.push(s),this.start.push(r),this.index.push(0))}else this.index[e]++,this.nextStart=r+s.length}}};class df{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map((t=>new Hd))}getActions(t){let e=0,i=null,{parser:n}=t.p,{tokenizers:s}=n,r=n.stateSlot(t.state,3),o=t.curContext?t.curContext.hash:0,a=0;for(let n=0;nh.end+25&&(a=Math.max(h.lookAhead,a)),0!=h.value)){let n=e;if(h.extended>-1&&(e=this.addActions(t,h.extended,h.end,e)),e=this.addActions(t,h.value,h.end,e),!l.extend&&(i=h,e>n))break}}for(;this.actions.length>e;)this.actions.pop();return a&&t.setLookAhead(a),i||t.pos!=this.stream.end||(i=new Hd,i.value=t.p.parser.eofTerm,i.start=i.end=t.pos,e=this.addActions(t,i.value,i.end,e)),this.mainToken=i,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new Hd,{pos:i,p:n}=t;return e.start=i,e.end=Math.min(i+1,n.stream.end),e.value=i==n.stream.end?n.parser.eofTerm:0,e}updateCachedToken(t,e,i){let n=this.stream.clipPos(i.pos);if(e.token(this.stream.reset(n,t),i),t.value>-1){let{parser:e}=i.p;for(let n=0;n=0&&i.p.parser.dialect.allows(s>>1)){0==(1&s)?t.value=s>>1:t.extended=s>>1;break}}}else t.value=0,t.end=this.stream.clipPos(n+1)}putAction(t,e,i,n){for(let e=0;e4*t.bufferLength?new uf(i,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t,e,i=this.stacks,n=this.minStackPos,s=this.stacks=[];if(this.bigReductionCount>300&&1==i.length){let[t]=i;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;rn)s.push(o);else{if(this.advanceStack(o,s,i))continue;{t||(t=[],e=[]),t.push(o);let i=this.tokens.getMainToken(o);e.push(i.value,i.end)}}break}}if(!s.length){let e=t&&function(t){let e=null;for(let i of t){let t=i.p.stoppedAt;(i.pos==i.p.stream.end||null!=t&&i.pos>t)&&i.p.parser.stateFlag(i.state,2)&&(!e||e.scorethis.stoppedAt?t[0]:this.runRecovery(t,e,s);if(i)return this.stackToTree(i.forceAll())}if(this.recovering){let t=1==this.recovering?1:3*this.recovering;if(s.length>t)for(s.sort(((t,e)=>e.score-t.score));s.length>t;)s.pop();s.some((t=>t.reducePos>n))&&this.recovering--}else if(s.length>1){t:for(let t=0;t500&&n.buffer.length>500){if(!((e.score-n.score||e.buffer.length-n.buffer.length)>0)){s.splice(t--,1);continue t}s.splice(i--,1)}}}s.length>12&&s.splice(12,s.length-12)}this.minStackPos=s[0].pos;for(let t=1;t ":"";if(null!=this.stoppedAt&&n>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let e=t.curContext&&t.curContext.tracker.strict,i=e?t.curContext.hash:0;for(let o=this.fragments.nodeAt(n);o;){let n=this.parser.nodeSet.types[o.type.id]==o.type?s.getGoto(t.state,o.type.id):-1;if(n>-1&&o.length&&(!e||(o.prop(ho.contextHash)||0)==i))return t.useNode(o,n),af&&console.log(r+this.stackID(t)+` (via reuse of ${s.getName(o.type.id)})`),!0;if(!(o instanceof bo)||0==o.children.length||o.positions[0]>0)break;let a=o.children[0];if(!(a instanceof bo&&0==o.positions[0]))break;o=a}}let o=s.stateSlot(t.state,4);if(o>0)return t.reduce(o),af&&console.log(r+this.stackID(t)+` (via always-reduce ${s.getName(65535&o)})`),!0;if(t.stack.length>=15e3)for(;t.stack.length>9e3&&t.forceReduce(););let a=this.tokens.getActions(t);for(let o=0;on?e.push(d):i.push(d)}return!1}advanceFully(t,e){let i=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>i)return Of(t,e),!0}}runRecovery(t,e,i){let n=null,s=!1;for(let r=0;r ":"";if(o.deadEnd){if(s)continue;if(s=!0,o.restart(),af&&console.log(h+this.stackID(o)+" (restarted)"),this.advanceFully(o,i))continue}let c=o.split(),u=h;for(let t=0;c.forceReduce()&&t<10;t++){if(af&&console.log(u+this.stackID(c)+" (via force-reduce)"),this.advanceFully(c,i))break;af&&(u=this.stackID(c)+" -> ")}for(let t of o.recoverByInsert(a))af&&console.log(h+this.stackID(t)+" (via recover-insert)"),this.advanceFully(t,i);this.stream.end>o.pos?(l==o.pos&&(l++,a=0),o.recoverByDelete(a,l),af&&console.log(h+this.stackID(o)+` (via recover-delete ${this.parser.getName(a)})`),Of(o,i)):(!n||n.scoret;class bf{constructor(t){this.start=t.start,this.shift=t.shift||mf,this.reduce=t.reduce||mf,this.reuse=t.reuse||mf,this.hash=t.hash||(()=>0),this.strict=!1!==t.strict}}class wf extends Vo{constructor(t){if(super(),this.wrappers=[],14!=t.version)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let i=0;it.topRules[e][1])),n=[];for(let t=0;t=0)s(n,t,e[i++]);else{let r=e[i+-n];for(let o=-n;o>0;o--)s(e[i++],t,r);i++}}}this.nodeSet=new po(e.map(((e,s)=>fo.define({name:s>=this.minRepeatTerm?void 0:e,id:s,props:n[s],top:i.indexOf(s)>-1,error:0==s,skipped:t.skippedNodes&&t.skippedNodes.indexOf(s)>-1})))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=oo;let r=Fd(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let t=0;t"number"==typeof t?new tf(r,t):t)),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,i){let n=new pf(this,t,e,i);for(let s of this.wrappers)n=s(n,t,e,i);return n}getGoto(t,e,i=!1){let n=this.goto;if(e>=n[0])return-1;for(let s=n[e+1];;){let e=n[s++],r=1&e,o=n[s++];if(r&&i)return o;for(let i=s+(e>>1);s0}validAction(t,e){if(e==this.stateSlot(t,4))return!0;for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])return!1;i=vf(this.data,i+2)}if(e==vf(this.data,i+1))return!0}}nextStates(t){let e=[];for(let i=this.stateSlot(t,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])break;i=vf(this.data,i+2)}if(0==(1&this.data[i+2])){let t=this.data[i+1];e.some(((e,i)=>1&i&&e==t))||e.push(this.data[i],t)}}return e}configure(t){let e=Object.assign(Object.create(wf.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let i=this.topRules[t.top];if(!i)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=i}return t.tokenizers&&(e.tokenizers=this.tokenizers.map((e=>{let i=t.tokenizers.find((t=>t.from==e));return i?i.to:e}))),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map(((i,n)=>{let s=t.specializers.find((t=>t.from==i.external));if(!s)return i;let r=Object.assign(Object.assign({},i),{external:s.to});return e.specializers[n]=yf(r),r}))),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),null!=t.strict&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),null!=t.bufferLength&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return null==e?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),i=e.map((()=>!1));if(t)for(let n of t.split(" ")){let t=e.indexOf(n);t>=0&&(i[t]=!0)}let n=null;for(let t=0;tt.external(i,n)<<1|e}return t.get}const Sf=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],xf=new bf({start:!1,shift:(t,e)=>3==e||4==e||305==e?t:306==e,strict:!1}),kf=new nf(((t,e)=>{let{next:i}=t;(125==i||-1==i||e.context)&&e.canShift(303)&&t.acceptToken(303)}),{contextual:!0,fallback:!0}),Qf=new nf(((t,e)=>{let i,{next:n}=t;Sf.indexOf(n)>-1||(47!=n||47!=(i=t.peek(1))&&42!=i)&&125!=n&&59!=n&&-1!=n&&!e.context&&e.canShift(302)&&t.acceptToken(302)}),{contextual:!0}),$f=new nf(((t,e)=>{let{next:i}=t;if((43==i||45==i)&&(t.advance(),i==t.next)){t.advance();let i=!e.context&&e.canShift(1);t.acceptToken(i?1:2)}}),{contextual:!0}),Pf=ea({"get set async static":Sa.modifier,"for while do if else switch try catch finally return throw break continue default case":Sa.controlKeyword,"in of await yield void typeof delete instanceof":Sa.operatorKeyword,"let var const function class extends":Sa.definitionKeyword,"import export from":Sa.moduleKeyword,"with debugger as new":Sa.keyword,TemplateString:Sa.special(Sa.string),super:Sa.atom,BooleanLiteral:Sa.bool,this:Sa.self,null:Sa.null,Star:Sa.modifier,VariableName:Sa.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":Sa.function(Sa.variableName),VariableDefinition:Sa.definition(Sa.variableName),Label:Sa.labelName,PropertyName:Sa.propertyName,PrivatePropertyName:Sa.special(Sa.propertyName),"CallExpression/MemberExpression/PropertyName":Sa.function(Sa.propertyName),"FunctionDeclaration/VariableDefinition":Sa.function(Sa.definition(Sa.variableName)),"ClassDeclaration/VariableDefinition":Sa.definition(Sa.className),PropertyDefinition:Sa.definition(Sa.propertyName),PrivatePropertyDefinition:Sa.definition(Sa.special(Sa.propertyName)),UpdateOp:Sa.updateOperator,LineComment:Sa.lineComment,BlockComment:Sa.blockComment,Number:Sa.number,String:Sa.string,Escape:Sa.escape,ArithOp:Sa.arithmeticOperator,LogicOp:Sa.logicOperator,BitOp:Sa.bitwiseOperator,CompareOp:Sa.compareOperator,RegExp:Sa.regexp,Equals:Sa.definitionOperator,Arrow:Sa.function(Sa.punctuation),": Spread":Sa.punctuation,"( )":Sa.paren,"[ ]":Sa.squareBracket,"{ }":Sa.brace,"InterpolationStart InterpolationEnd":Sa.special(Sa.brace),".":Sa.derefOperator,", ;":Sa.separator,"@":Sa.meta,TypeName:Sa.typeName,TypeDefinition:Sa.definition(Sa.typeName),"type enum interface implements namespace module declare":Sa.definitionKeyword,"abstract global Privacy readonly override":Sa.modifier,"is keyof unique infer":Sa.operatorKeyword,JSXAttributeValue:Sa.attributeValue,JSXText:Sa.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":Sa.angleBracket,"JSXIdentifier JSXNameSpacedName":Sa.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":Sa.attributeName,"JSXBuiltin/JSXIdentifier":Sa.standard(Sa.tagName)}),Cf={__proto__:null,export:14,as:19,from:27,default:30,async:35,function:36,extends:46,this:50,true:58,false:58,null:70,void:74,typeof:78,super:96,new:130,delete:146,yield:155,await:159,class:164,public:221,private:221,protected:221,readonly:223,instanceof:242,satisfies:245,in:246,const:248,import:280,keyof:335,unique:339,infer:345,is:381,abstract:401,implements:403,type:405,let:408,var:410,interface:417,enum:421,namespace:427,module:429,declare:433,global:437,for:456,of:465,while:468,with:472,do:476,if:480,else:482,switch:486,case:492,try:498,catch:502,finally:506,return:510,throw:514,break:518,continue:522,debugger:526},_f={__proto__:null,async:117,get:119,set:121,declare:181,public:183,private:183,protected:183,static:185,abstract:187,override:189,readonly:195,accessor:197,new:385},Xf={__proto__:null,"<":137},Z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#h%Z(X(Y(Z+h-s-t-u-w2b2c5wQ1_,ZQ1r,oQ5e1jQ7m5fT:x&y+fT#]W%vS#[W%vS'u#S'}S'z#V+eS,t&y+fT-h't-mT'O!c%wQ$hfR)j$mT)_$h)`R3Z.kT*O$u*QR*W$xQ/}*zQ2e.OQ4s0wQ5{2iQ7X4vQ7x5zQ8e7WQ8w7wQ9W8gQ9`8yQ9e9XR9h9alpOXr!X#`%]&d&f&g&i,],b1b1eQ&^!TR,Q&ZV%z|},ZR0q+qR,P&XQ%szR+c%tR+X%nT&b!U&eT&c!U&eT1d,b1e",nodeNames:"⚠ ArithOp ArithOp LineComment BlockComment Script ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXStartTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:364,context:xf,nodeProps:[["group",-26,6,14,16,62,199,203,206,207,209,212,215,225,227,233,235,237,239,242,248,254,256,258,260,262,264,265,"Statement",-32,10,11,25,28,29,35,45,48,49,51,56,64,72,76,78,80,81,103,104,113,114,131,134,136,137,138,139,141,142,162,163,165,"Expression",-23,24,26,30,34,36,38,166,168,170,171,173,174,175,177,178,179,181,182,183,193,195,197,198,"Type",-3,84,96,102,"ClassItem"],["openedBy",31,"InterpolationStart",50,"[",54,"{",69,"(",143,"JSXStartTag",155,"JSXStartTag JSXStartCloseTag"],["closedBy",33,"InterpolationEnd",44,"]",55,"}",70,")",144,"JSXSelfCloseEndTag JSXEndTag",160,"JSXEndTag"]],propSources:[Pf],skippedNodes:[0,3,4,268],repeatNodeCount:33,tokenData:"$>y(CSR!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tu>PuvBavwDxwx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:1},specialized:[{term:312,get:t=>Cf[t]||-1},{term:328,get:t=>_f[t]||-1},{term:67,get:t=>Xf[t]||-1}],tokenPrec:12712}),Af=[Dd("function ${name}(${params}) {\n\t${}\n}",{label:"function",detail:"definition",type:"keyword"}),Dd("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n\t${}\n}",{label:"for",detail:"loop",type:"keyword"}),Dd("for (let ${name} of ${collection}) {\n\t${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Dd("do {\n\t${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),Dd("while (${}) {\n\t${}\n}",{label:"while",detail:"loop",type:"keyword"}),Dd("try {\n\t${}\n} catch (${error}) {\n\t${}\n}",{label:"try",detail:"/ catch block",type:"keyword"}),Dd("if (${}) {\n\t${}\n}",{label:"if",detail:"block",type:"keyword"}),Dd("if (${}) {\n\t${}\n} else {\n\t${}\n}",{label:"if",detail:"/ else block",type:"keyword"}),Dd("class ${name} {\n\tconstructor(${params}) {\n\t\t${}\n\t}\n}",{label:"class",detail:"definition",type:"keyword"}),Dd('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Dd('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Tf=new Ro,Rf=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Ef(t){return(e,i)=>{let n=e.node.getChild("VariableDefinition");return n&&i(n,t),!0}}const Vf=["FunctionDeclaration"],Mf={FunctionDeclaration:Ef("function"),ClassDeclaration:Ef("class"),ClassExpression:()=>!0,EnumDeclaration:Ef("constant"),TypeAliasDeclaration:Ef("type"),NamespaceDeclaration:Ef("namespace"),VariableDefinition(t,e){t.matchContext(Vf)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function Df(t,e){let i=Tf.get(e);if(i)return i;let n=[],s=!0;function r(e,i){let s=t.sliceString(e.from,e.to);n.push({label:s,type:i})}return e.cursor(mo.IncludeAnonymous).iterate((e=>{if(s)s=!1;else if(e.name){let t=Mf[e.name];if(t&&t(e,r)||Rf.has(e.name))return!1}else if(e.to-e.from>8192){for(let i of Df(t,e.node))n.push(i);return!1}})),Tf.set(e,n),n}const Wf=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Uf=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName"];function Yf(t){let e=Xa(t.state).resolveInner(t.pos,-1);if(Uf.indexOf(e.name)>-1)return null;let i="VariableName"==e.name||e.to-e.from<20&&Wf.test(t.state.sliceDoc(e.from,e.to));if(!i&&!t.explicit)return null;let n=[];for(let i=e;i;i=i.parent)Rf.has(i.name)&&(n=n.concat(Df(t.state.doc,i)));return{options:n,from:i?e.from:t.pos,validFor:Wf}}const qf=_a.define({name:"javascript",parser:Zf.configure({props:[Na.add({IfStatement:il({except:/^\s*({|else\b)/}),TryStatement:il({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:t=>t.baseIndent,SwitchBody:t=>{let e=t.textAfter,i=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return t.baseIndent+(i?0:n?1:2)*t.unit},Block:tl({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":il({except:/^{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag":t=>t.column(t.node.from)+t.unit}),rl.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression":ol,BlockComment:t=>({from:t.from+2,to:t.to-2})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Lf={test:t=>/^JSX/.test(t.name),facet:Qa({commentTokens:{block:{open:"{/*",close:"*/}"}}})},zf=qf.configure({dialect:"ts"},"typescript"),If=qf.configure({dialect:"jsx",props:[$a.add((t=>t.isTop?[Lf]:void 0))]}),Bf=qf.configure({dialect:"jsx ts",props:[$a.add((t=>t.isTop?[Lf]:void 0))]},"typescript"),jf="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map((t=>({label:t,type:"keyword"})));function Nf(t={}){let e=t.jsx?t.typescript?Bf:If:t.typescript?zf:qf;return new Ua(e,[qf.data.of({autocomplete:(i=Uf,n=zu(Af.concat(jf)),t=>{for(let e=Xa(t.state).resolveInner(t.pos,-1);e;e=e.parent){if(i.indexOf(e.name)>-1)return null;if(e.type.isTop)break}return n(t)})}),qf.data.of({autocomplete:Yf}),t.jsx?Hf:[]]);var i,n}function Gf(t,e,i=t.length){for(let n=null==e?void 0:e.firstChild;n;n=n.nextSibling)if("JSXIdentifier"==n.name||"JSXBuiltin"==n.name||"JSXNamespacedName"==n.name||"JSXMemberExpression"==n.name)return t.sliceString(n.from,Math.min(n.to,i));return""}const Ff="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),Hf=Ts.inputHandler.of(((t,e,i,n)=>{if((Ff?t.composing:t.compositionStarted)||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!qf.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((t=>{var e,i;let r,{head:o}=t,a=Xa(s).resolveInner(o,-1);if("JSXStartTag"==a.name&&(a=a.parent),">"==n&&"JSXFragmentTag"==a.name)return{range:A.cursor(o+1),changes:{from:o,insert:">"}};if("/"==n&&"JSXFragmentTag"==a.name){let t=a.parent,i=null==t?void 0:t.parent;if(t.from==o-1&&"JSXEndTag"!=(null===(e=i.lastChild)||void 0===e?void 0:e.name)&&(r=Gf(s.doc,null==i?void 0:i.firstChild,o))){let t=`/${r}>`;return{range:A.cursor(o+t.length),changes:{from:o,insert:t}}}}else if(">"==n){let t=function(t){for(;;){if("JSXOpenTag"==t.name||"JSXSelfClosingTag"==t.name||"JSXFragmentTag"==t.name)return t;if(!t.parent)return null;t=t.parent}}(a);if(t&&"JSXEndTag"!=(null===(i=t.lastChild)||void 0===i?void 0:i.name)&&"`}}}return{range:t}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)}));class Jf{constructor(t,e,i,n,s,r,o){this.type=t,this.value=e,this.from=i,this.hash=n,this.end=s,this.children=r,this.positions=o,this.hashProp=[[ho.contextHash,n]]}static create(t,e,i,n,s){return new Jf(t,e,i,n+(n<<8)+t+(e<<4)|0,s,[],[])}addChild(t,e){t.prop(ho.contextHash)!=this.hash&&(t=new bo(t.type,t.children,t.positions,t.length,this.hashProp)),this.children.push(t),this.positions.push(e)}toTree(t,e=this.end){let i=this.children.length-1;return i>=0&&(e=Math.max(e,this.positions[i]+this.children[i].length+this.from)),new bo(t.types[this.type],this.children,this.positions,e-this.from).balance({makeTree:(t,e,i)=>new bo(fo.none,t,e,i,this.hashProp)})}}var Kf;!function(t){t[t.Document=1]="Document",t[t.CodeBlock=2]="CodeBlock",t[t.FencedCode=3]="FencedCode",t[t.Blockquote=4]="Blockquote",t[t.HorizontalRule=5]="HorizontalRule",t[t.BulletList=6]="BulletList",t[t.OrderedList=7]="OrderedList",t[t.ListItem=8]="ListItem",t[t.ATXHeading1=9]="ATXHeading1",t[t.ATXHeading2=10]="ATXHeading2",t[t.ATXHeading3=11]="ATXHeading3",t[t.ATXHeading4=12]="ATXHeading4",t[t.ATXHeading5=13]="ATXHeading5",t[t.ATXHeading6=14]="ATXHeading6",t[t.SetextHeading1=15]="SetextHeading1",t[t.SetextHeading2=16]="SetextHeading2",t[t.HTMLBlock=17]="HTMLBlock",t[t.LinkReference=18]="LinkReference",t[t.Paragraph=19]="Paragraph",t[t.CommentBlock=20]="CommentBlock",t[t.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",t[t.Escape=22]="Escape",t[t.Entity=23]="Entity",t[t.HardBreak=24]="HardBreak",t[t.Emphasis=25]="Emphasis",t[t.StrongEmphasis=26]="StrongEmphasis",t[t.Link=27]="Link",t[t.Image=28]="Image",t[t.InlineCode=29]="InlineCode",t[t.HTMLTag=30]="HTMLTag",t[t.Comment=31]="Comment",t[t.ProcessingInstruction=32]="ProcessingInstruction",t[t.URL=33]="URL",t[t.HeaderMark=34]="HeaderMark",t[t.QuoteMark=35]="QuoteMark",t[t.ListMark=36]="ListMark",t[t.LinkMark=37]="LinkMark",t[t.EmphasisMark=38]="EmphasisMark",t[t.CodeMark=39]="CodeMark",t[t.CodeText=40]="CodeText",t[t.CodeInfo=41]="CodeInfo",t[t.LinkTitle=42]="LinkTitle",t[t.LinkLabel=43]="LinkLabel"}(Kf||(Kf={}));class tp{constructor(t,e){this.start=t,this.content=e,this.marks=[],this.parsers=[]}}class ep{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let t=this.skipSpace(this.basePos);this.indent=this.countIndent(t,this.pos,this.indent),this.pos=t,this.next=t==this.text.length?-1:this.text.charCodeAt(t)}skipSpace(t){return rp(this.text,t)}reset(t){for(this.text=t,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(t){this.basePos=t,this.baseIndent=this.countIndent(t,this.pos,this.indent)}moveBaseColumn(t){this.baseIndent=t,this.basePos=this.findColumn(t)}addMarker(t){this.markers.push(t)}countIndent(t,e=0,i=0){for(let n=e;n=e.stack[i.depth+1].value+i.baseIndent)return!0;if(i.indent>=i.baseIndent+4)return!1;let n=(t.type==Kf.OrderedList?dp:up)(i,e,!1);return n>0&&(t.type!=Kf.BulletList||hp(i,e,!1)<0)&&i.text.charCodeAt(i.pos+n-1)==t.value}const np={[Kf.Blockquote]:(t,e,i)=>62==i.next&&(i.markers.push(Up(Kf.QuoteMark,e.lineStart+i.pos,e.lineStart+i.pos+1)),i.moveBase(i.pos+(sp(i.text.charCodeAt(i.pos+1))?2:1)),t.end=e.lineStart+i.text.length,!0),[Kf.ListItem]:(t,e,i)=>!(i.indent-1)&&(i.moveBaseColumn(i.baseIndent+t.value),!0),[Kf.OrderedList]:ip,[Kf.BulletList]:ip,[Kf.Document]:()=>!0};function sp(t){return 32==t||9==t||10==t||13==t}function rp(t,e=0){for(;ei&&sp(t.charCodeAt(e-1));)e--;return e}function ap(t){if(96!=t.next&&126!=t.next)return-1;let e=t.pos+1;for(;e-1&&t.depth==e.stack.length||n<3?-1:1}function cp(t,e){for(let i=t.stack.length-1;i>=0;i--)if(t.stack[i].type==e)return!0;return!1}function up(t,e,i){return 45!=t.next&&43!=t.next&&42!=t.next||t.pos!=t.text.length-1&&!sp(t.text.charCodeAt(t.pos+1))||!(!i||cp(e,Kf.BulletList)||t.skipSpace(t.pos+2)=48&&s<=57;){if(n++,n==t.text.length)return-1;s=t.text.charCodeAt(n)}return n==t.pos||n>t.pos+9||46!=s&&41!=s||nt.pos+1||49!=t.next)?-1:n+1-t.pos}function fp(t){if(35!=t.next)return-1;let e=t.pos+1;for(;e6?-1:i}function pp(t){if(45!=t.next&&61!=t.next||t.indent>=t.baseIndent+4)return-1;let e=t.pos+1;for(;e/,mp=/\?>/,bp=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*/i.exec(n);if(r)return t.append(Up(Kf.Comment,i,i+1+r[0].length));let o=/^\?[^]*?\?>/.exec(n);if(o)return t.append(Up(Kf.ProcessingInstruction,i,i+1+o[0].length));let a=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(n);return a?t.append(Up(Kf.HTMLTag,i,i+1+a[0].length)):-1},Emphasis(t,e,i){if(95!=e&&42!=e)return-1;let n=i+1;for(;t.char(n)==e;)n++;let s=t.slice(i-1,i),r=t.slice(n,n+1),o=jp.test(s),a=jp.test(r),l=/\s|^$/.test(s),h=/\s|^$/.test(r),c=!h&&(!a||l||o),u=!l&&(!o||h||a),d=c&&(42==e||!u||o),f=u&&(42==e||!c||a);return t.append(new Ip(95==e?Yp:qp,i,n,(d?1:0)|(f?2:0)))},HardBreak(t,e,i){if(92==e&&10==t.char(i+1))return t.append(Up(Kf.HardBreak,i,i+2));if(32==e){let e=i+1;for(;32==t.char(e);)e++;if(10==t.char(e)&&e>=i+2)return t.append(Up(Kf.HardBreak,i,e+1))}return-1},Link:(t,e,i)=>91==e?t.append(new Ip(Lp,i,i+1,1)):-1,Image:(t,e,i)=>33==e&&91==t.char(i+1)?t.append(new Ip(zp,i,i+2,1)):-1,LinkEnd(t,e,i){if(93!=e)return-1;for(let e=t.parts.length-1;e>=0;e--){let n=t.parts[e];if(n instanceof Ip&&(n.type==Lp||n.type==zp)){if(!n.side||t.skipSpace(n.to)==i&&!/[(\[]/.test(t.slice(i+1,i+2)))return t.parts[e]=null,-1;let s=t.takeContent(e),r=t.parts[e]=Gp(t,s,n.type==Lp?Kf.Link:Kf.Image,n.from,i+1);if(n.type==Lp)for(let i=0;ie?Up(Kf.URL,e+i,s+i):s==t.length&&null}}function Hp(t,e,i){let n=t.charCodeAt(e);if(39!=n&&34!=n&&40!=n)return!1;let s=40==n?41:n;for(let n=e+1,r=!1;n=this.end?-1:this.text.charCodeAt(t-this.offset)}get end(){return this.offset+this.text.length}slice(t,e){return this.text.slice(t-this.offset,e-this.offset)}append(t){return this.parts.push(t),t.to}addDelimiter(t,e,i,n,s){return this.append(new Ip(t,e,i,(n?1:0)|(s?2:0)))}addElement(t){return this.append(t)}resolveMarkers(t){for(let e=t;e=t;o--){let t=this.parts[o];if(t instanceof Ip&&1&t.side&&t.type==i.type&&!(s&&(1&i.side||2&t.side)&&(t.to-t.from+r)%3==0&&((t.to-t.from)%3||r%3))){n=t;break}}if(!n)continue;let a=i.type.resolve,l=[],h=n.from,c=i.to;if(s){let t=Math.min(2,n.to-n.from,r);h=n.to-t,c=i.from+t,a=1==t?"Emphasis":"StrongEmphasis"}n.type.mark&&l.push(this.elt(n.type.mark,h,n.to));for(let t=o+1;t=0;e--){let i=this.parts[e];if(i instanceof Ip&&i.type==t)return e}return null}takeContent(t){let e=this.resolveMarkers(t);return this.parts.length=t,e}skipSpace(t){return rp(this.text,t-this.offset)+this.offset}elt(t,e,i,n){return"string"==typeof t?Up(this.parser.getNodeType(t),e,i,n):new Wp(t,e)}}function tO(t,e){if(!e.length)return t;if(!t.length)return e;let i=t.slice(),n=0;for(let t of e){for(;n(t?t-1:0))return!1;if(this.fragmentEnd<0){let t=this.fragment.to;for(;t>0&&"\n"!=this.input.read(t-1,t);)t--;this.fragmentEnd=t?t-1:0}let i=this.cursor;i||(i=this.cursor=this.fragment.tree.cursor(),i.firstChild());let n=t+this.fragment.offset;for(;i.to<=n;)if(!i.parent())return!1;for(;;){if(i.from>=n)return this.fragment.from<=e;if(!i.childAfter(n))return!1}}matches(t){let e=this.cursor.tree;return e&&e.prop(ho.contextHash)==t}takeNodes(t){let e=this.cursor,i=this.fragment.offset,n=this.fragmentEnd-(this.fragment.openEnd?1:0),s=t.absoluteLineStart,r=s,o=t.block.children.length,a=r,l=o;for(;;){if(e.to-i>n){if(e.type.isAnonymous&&e.firstChild())continue;break}if(t.dontInject.add(e.tree),t.addNode(e.tree,e.from-i),e.type.is("Block")&&(eO.indexOf(e.type.id)<0?(r=e.to-i,o=t.block.children.length):(r=a,o=l,a=e.to-i,l=t.block.children.length)),!e.nextSibling())break}for(;t.block.children.length>o;)t.block.children.pop(),t.block.positions.pop();return r-s}}const nO=ea({"Blockquote/...":Sa.quote,HorizontalRule:Sa.contentSeparator,"ATXHeading1/... SetextHeading1/...":Sa.heading1,"ATXHeading2/... SetextHeading2/...":Sa.heading2,"ATXHeading3/...":Sa.heading3,"ATXHeading4/...":Sa.heading4,"ATXHeading5/...":Sa.heading5,"ATXHeading6/...":Sa.heading6,"Comment CommentBlock":Sa.comment,Escape:Sa.escape,Entity:Sa.character,"Emphasis/...":Sa.emphasis,"StrongEmphasis/...":Sa.strong,"Link/... Image/...":Sa.link,"OrderedList/... BulletList/...":Sa.list,"BlockQuote/...":Sa.quote,"InlineCode CodeText":Sa.monospace,URL:Sa.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":Sa.processingInstruction,"CodeInfo LinkLabel":Sa.labelName,LinkTitle:Sa.string,Paragraph:Sa.content}),sO=new Zp(new po(Ep).extend(nO),Object.keys(Sp).map((t=>Sp[t])),Object.keys(Sp).map((t=>$p[t])),Object.keys(Sp),Pp,np,Object.keys(Np).map((t=>Np[t])),Object.keys(Np),[]);function rO(t,e,i){let n=[];for(let s=t.firstChild,r=e;;s=s.nextSibling){let t=s?s.from:i;if(t>r&&n.push({from:r,to:t}),!s)break;r=s.to}return n}const oO={resolve:"Strikethrough",mark:"StrikethroughMark"},aO={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":Sa.strikethrough}},{name:"StrikethroughMark",style:Sa.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,i){if(126!=e||126!=t.char(i+1)||126==t.char(i+2))return-1;let n=t.slice(i-1,i),s=t.slice(i+2,i+3),r=/\s|^$/.test(n),o=/\s|^$/.test(s),a=jp.test(n),l=jp.test(s);return t.addDelimiter(oO,i,i+2,!o&&(!l||r||a),!r&&(!a||o||l))},after:"Emphasis"}]};function lO(t,e,i=0,n,s=0){let r=0,o=!0,a=-1,l=-1,h=!1,c=()=>{n.push(t.elt("TableCell",s+a,s+l,t.parser.parseInline(e.slice(a,l),s+a)))};for(let u=i;u-1)&&r++,o=!1,n&&(a>-1&&c(),n.push(t.elt("TableDelimiter",u+s,u+s+1))),a=l=-1),h=!h&&92==i}return a>-1&&(r++,n&&c()),r}function hO(t,e){for(let i=e;ihO(e.content,0)?new uO:null,endLeaf(t,e,i){if(i.parsers.some((t=>t instanceof uO))||!hO(e.text,e.basePos))return!1;let n=t.scanLine(t.absoluteLineEnd+1).text;return cO.test(n)&&lO(t,e.text,e.basePos)==lO(t,n,e.basePos)},before:"SetextHeading"}]};class fO{nextLine(){return!1}finish(t,e){return t.addLeafElement(e,t.elt("Task",e.start,e.start+e.content.length,[t.elt("TaskMarker",e.start,e.start+3),...t.parser.parseInline(e.content.slice(3),e.start+3)])),!0}}const pO=[dO,{defineNodes:[{name:"Task",block:!0,style:Sa.list},{name:"TaskMarker",style:Sa.atom}],parseBlock:[{name:"TaskList",leaf:(t,e)=>/^\[[ xX]\]/.test(e.content)&&"ListItem"==t.parentType().name?new fO:null,after:"SetextHeading"}]},aO];function OO(t,e,i){return(n,s,r)=>{if(s!=t||n.char(r+1)==t)return-1;let o=[n.elt(i,r,r+1)];for(let s=r+1;s=65&&r<=90||95==r||r>=97&&r<=122||r>=161;)s+=String.fromCharCode(n),n=t.peek(++e);var r;return RO=t,EO=i,TO=s?s.toLowerCase():n==MO||n==DO?void 0:null}const MO=63,DO=33;function WO(t,e){this.name=t,this.parent=e,this.hash=e?e.hash:0;for(let e=0;eUO.indexOf(e)>-1?new WO(VO(n,1)||"",t):t,reduce:(t,e)=>e==wO&&t?t.parent:t,reuse(t,e,i,n){let s=e.type.id;return 6==s||36==s?new WO(VO(n,1)||"",t):t},hash:t=>t?t.hash:0,strict:!1}),qO=new nf(((t,e)=>{if(60!=t.next)return void(t.next<0&&e.context&&t.acceptToken(57));t.advance();let i=47==t.next;i&&t.advance();let n=VO(t,0);if(void 0===n)return;if(!n)return t.acceptToken(i?14:6);let s=e.context?e.context.name:null;if(i){if(n==s)return t.acceptToken(11);if(s&&XO[s])return t.acceptToken(57,-2);if(e.dialectEnabled(0))return t.acceptToken(12);for(let t=e.context;t;t=t.parent)if(t.name==n)return;t.acceptToken(13)}else{if("script"==n)return t.acceptToken(7);if("style"==n)return t.acceptToken(8);if("textarea"==n)return t.acceptToken(9);if(_O.hasOwnProperty(n))return t.acceptToken(10);s&&ZO[s]&&ZO[s][n]?t.acceptToken(57,-1):t.acceptToken(6)}}),{contextual:!0}),LO=new nf((t=>{for(let e=0,i=0;;i++){if(t.next<0){i&&t.acceptToken(58);break}if(45==t.next)e++;else{if(62==t.next&&e>=2){i>3&&t.acceptToken(58,-2);break}e=0}t.advance()}}));const zO=new nf(((t,e)=>{if(47==t.next&&62==t.peek(1)){let i=e.dialectEnabled(1)||function(t){for(;t;t=t.parent)if("svg"==t.name||"math"==t.name)return!0;return!1}(e.context);t.acceptToken(i?5:4,2)}else 62==t.next&&t.acceptToken(4,1)}));function IO(t,e,i){let n=2+t.length;return new nf((s=>{for(let r=0,o=0,a=0;;a++){if(s.next<0){a&&s.acceptToken(e);break}if(0==r&&60==s.next||1==r&&47==s.next||r>=2&&ro?s.acceptToken(e,-o):s.acceptToken(i,-(o-2));break}if((10==s.next||13==s.next)&&a){s.acceptToken(e,1);break}r=o=0}else o++;s.advance()}}))}const BO=IO("script",54,1),jO=IO("style",55,2),NO=IO("textarea",56,3),GO=ea({"Text RawText":Sa.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":Sa.angleBracket,TagName:Sa.tagName,"MismatchedCloseTag/TagName":[Sa.tagName,Sa.invalid],AttributeName:Sa.attributeName,"AttributeValue UnquotedAttributeValue":Sa.attributeValue,Is:Sa.definitionOperator,"EntityReference CharacterReference":Sa.character,Comment:Sa.blockComment,ProcessingInst:Sa.processingInstruction,DoctypeDecl:Sa.documentMeta}),FO=wf.deserialize({version:14,states:",xOVO!rOOO!WQ#tO'#CqO!]Q#tO'#CzO!bQ#tO'#C}O!gQ#tO'#DQO!lQ#tO'#DSO!qOaO'#CpO!|ObO'#CpO#XOdO'#CpO$eO!rO'#CpOOO`'#Cp'#CpO$lO$fO'#DTO$tQ#tO'#DVO$yQ#tO'#DWOOO`'#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]O][O^^O`^Oa^Ob^Oc^Ox^O!dZO~O!ZrO~P#dO![sO!euO~OfvO~OfwO~OS|OhyO~OS!OOhyO~OS!QOhyO~OS!SOT!TOhyO~OS!TOhyO~O!WfOPlX!ZlX~OP!WO!Z!XO~O!XiOQoX!ZoX~OQ!ZO!Z!XO~O!YlORrX!ZrX~OR!]O!Z!XO~O!Z!XO~P#dOf!_O~O![sO!e!aO~OS!bO~OS!cO~Oi!dOSgXhgXTgX~OS!fOhyO~OS!gOhyO~OS!hOhyO~OS!iOT!jOhyO~OS!jOhyO~Of!kO~Of!lO~Of!mO~OS!nO~Ok!qO!`!oO!b!pO~OS!rO~OS!sO~OS!tO~Oa!uOb!uOc!uO!`!wO!a!uO~Oa!xOb!xOc!xO!b!wO!c!xO~Oa!uOb!uOc!uO!`!{O!a!uO~Oa!xOb!xOc!xO!b!{O!c!xO~OT~bac!dx{!d~",goto:"%p!`PPPPPPPPPPPPPPPPPPPP!a!gP!mPP!yP!|#P#S#Y#]#`#f#i#l#r#x!aP!a!aP$O$U$l$r$x%O%U%[%bPPPPPPPP%hX^OX`pXUOX`pezabcde{}!P!R!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ}bQ!PcQ!RdQ!UeZ!e{}!P!R!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:67,context:YO,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,21,30,33,36,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,29,32,35,37,"OpenTag"],["group",-9,14,17,18,19,20,39,40,41,42,"Entity",16,"Entity TextContent",-3,28,31,34,"TextContent Entity"]],propSources:[GO],skippedNodes:[0],repeatNodeCount:9,tokenData:"#%g!aR!YOX$qXY,QYZ,QZ[$q[]&X]^,Q^p$qpq,Qqr-_rs4ysv-_vw5iwxJ^x}-_}!OKP!O!P-_!P!Q$q!Q![-_![!]!!O!]!^-_!^!_!&W!_!`#$o!`!a&X!a!c-_!c!}!!O!}#R-_#R#S!!O#S#T3V#T#o!!O#o#s-_#s$f$q$f%W-_%W%o!!O%o%p-_%p&a!!O&a&b-_&b1p!!O1p4U-_4U4d!!O4d4e-_4e$IS!!O$IS$I`-_$I`$Ib!!O$Ib$Kh-_$Kh%#t!!O%#t&/x-_&/x&Et!!O&Et&FV-_&FV;'S!!O;'S;:j!&Q;:j;=`4s<%l?&r-_?&r?Ah!!O?Ah?BY$q?BY?Mn!!O?MnO$q!Z$|c`PkW!a`!cpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr$qrs&}sv$qvw+Pwx(tx!^$q!^!_*V!_!a&X!a#S$q#S#T&X#T;'S$q;'S;=`+z<%lO$q!R&bX`P!a`!cpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&Xq'UV`P!cpOv&}wx'kx!^&}!^!_(V!_;'S&};'S;=`(n<%lO&}P'pT`POv'kw!^'k!_;'S'k;'S;=`(P<%lO'kP(SP;=`<%l'kp([S!cpOv(Vx;'S(V;'S;=`(h<%lO(Vp(kP;=`<%l(Vq(qP;=`<%l&}a({W`P!a`Or(trs'ksv(tw!^(t!^!_)e!_;'S(t;'S;=`*P<%lO(t`)jT!a`Or)esv)ew;'S)e;'S;=`)y<%lO)e`)|P;=`<%l)ea*SP;=`<%l(t!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!G_;'S;=`!N]<%lO!G_!R!MvV!a`!cpxPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!N`P;=`<%l!G_T!NhbhSOq!Hpqr!Ncrs!Hpsw!Ncwx!Hpx!P!Nc!P!Q!Hp!Q!_!Nc!_!a!Hp!a!b# p!b#s!Nc#s$f!Hp$f;'S!Nc;'S;=`#!}<%l?Ah!Nc?Ah?BY!Hp?BY?Mn!Nc?MnO!HpT# ubhSOq!Hpqr!Ncrs!Hpsw!Ncwx!Hpx!P!Nc!P!Q!Hp!Q!_!Nc!_!`!Hp!`!a!If!a#s!Nc#s$f!Hp$f;'S!Nc;'S;=`#!}<%l?Ah!Nc?Ah?BY!Hp?BY?Mn!Nc?MnO!HpT##QP;=`<%l!Nc!V##^chS!a`!cpOq!G_qr!Eyrs!HUsv!Eyvw!Ncwx!Jvx!P!Ey!P!Q!G_!Q!_!Ey!_!`!G_!`!a!Mm!a#s!Ey#s$f!G_$f;'S!Ey;'S;=`#$i<%l?Ah!Ey?Ah?BY!G_?BY?Mn!Ey?MnO!G_!V#$lP;=`<%l!Ey!V#$zXiS`P!a`!cpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X",tokenizers:[BO,jO,NO,zO,qO,LO,0,1,2,3,4,5],topRules:{Document:[0,15]},dialects:{noMatch:0,selfClosing:485},tokenPrec:487});function HO(t,e){let i=Object.create(null);for(let n of t.getChildren(yO)){let t=n.getChild(SO),s=n.getChild(xO)||n.getChild(kO);t&&(i[e.read(t.from,t.to)]=s?s.type.id==xO?e.read(s.from+1,s.to-1):e.read(s.from,s.to):"")}return i}function JO(t,e){let i=t.getChild(vO);return i?e.read(i.from,i.to):" "}function KO(t,e,i){let n;for(let s of i)if(!s.attrs||s.attrs(n||(n=HO(t.node.parent.firstChild,e))))return{parser:s.parser};return null}function tg(t=[],e=[]){let i=[],n=[],s=[],r=[];for(let e of t){("script"==e.tag?i:"style"==e.tag?n:"textarea"==e.tag?s:r).push(e)}let o=e.length?Object.create(null):null;for(let t of e)(o[t.name]||(o[t.name]=[])).push(t);return Do(((t,e)=>{let a=t.type.id;if(a==QO)return KO(t,e,i);if(a==$O)return KO(t,e,n);if(a==PO)return KO(t,e,s);if(a==wO&&r.length){let i,n=t.node,s=n.firstChild,o=s&&JO(s,e);if(o)for(let t of r)if(t.tag==o&&(!t.attrs||t.attrs(i||(i=HO(n,e))))){let e=n.lastChild;return{parser:t.parser,overlay:[{from:s.to,to:e.type.id==CO?e.from:n.to}]}}}if(o&&a==yO){let i,n=t.node;if(i=n.firstChild){let t=o[e.read(i.from,i.to)];if(t)for(let i of t){if(i.tagName&&i.tagName!=JO(n.parent,e))continue;let t=n.lastChild;if(t.type.id==xO){let e=t.from+1,n=t.lastChild,s=t.to-(n&&n.isError?0:1);if(s>e)return{parser:i.parser,overlay:[{from:e,to:s}]}}else if(t.type.id==kO)return{parser:i.parser,overlay:[{from:t.from,to:t.to}]}}}}return null}))}const eg=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288];function ig(t){return t>=65&&t<=90||t>=97&&t<=122||t>=161}const ng=new nf(((t,e)=>{for(let n=!1,s=0,r=0;;r++){let{next:o}=t;if(!(ig(o)||45==o||95==o||n&&(i=o,i>=48&&i<=57))){n&&t.acceptToken(40==o?95:2==s&&e.canShift(2)?2:96);break}!n&&(45!=o||r>0)&&(n=!0),s===r&&45==o&&s++,t.advance()}var i})),sg=new nf((t=>{if(eg.includes(t.peek(-1))){let{next:e}=t;(ig(e)||95==e||35==e||46==e||91==e||58==e||45==e)&&t.acceptToken(94)}})),rg=new nf((t=>{if(!eg.includes(t.peek(-1))){let{next:e}=t;if(37==e&&(t.advance(),t.acceptToken(1)),ig(e)){do{t.advance()}while(ig(t.next));t.acceptToken(1)}}})),og=ea({"AtKeyword import charset namespace keyframes media supports":Sa.definitionKeyword,"from to selector":Sa.keyword,NamespaceName:Sa.namespace,KeyframeName:Sa.labelName,TagName:Sa.tagName,ClassName:Sa.className,PseudoClassName:Sa.constant(Sa.className),IdName:Sa.labelName,"FeatureName PropertyName":Sa.propertyName,AttributeName:Sa.attributeName,NumberLiteral:Sa.number,KeywordQuery:Sa.keyword,UnaryQueryOp:Sa.operatorKeyword,"CallTag ValueName":Sa.atom,VariableName:Sa.variableName,Callee:Sa.operatorKeyword,Unit:Sa.unit,"UniversalSelector NestingSelector":Sa.definitionOperator,MatchOp:Sa.compareOperator,"ChildOp SiblingOp, LogicOp":Sa.logicOperator,BinOp:Sa.arithmeticOperator,Important:Sa.modifier,Comment:Sa.blockComment,ParenthesizedContent:Sa.special(Sa.name),ColorLiteral:Sa.color,StringLiteral:Sa.string,":":Sa.punctuation,"PseudoOp #":Sa.derefOperator,"; ,":Sa.separator,"( )":Sa.paren,"[ ]":Sa.squareBracket,"{ }":Sa.brace}),ag={__proto__:null,lang:32,"nth-child":32,"nth-last-child":32,"nth-of-type":32,"nth-last-of-type":32,dir:32,"host-context":32,url:60,"url-prefix":60,domain:60,regexp:60,selector:134},lg={__proto__:null,"@import":114,"@media":138,"@charset":142,"@namespace":146,"@keyframes":152,"@supports":164},hg={__proto__:null,not:128,only:128,from:158,to:160},cg=wf.deserialize({version:14,states:"7WQYQ[OOO#_Q[OOOOQP'#Cd'#CdOOQP'#Cc'#CcO#fQ[O'#CfO$YQXO'#CaO$aQ[O'#ChO$lQ[O'#DPO$qQ[O'#DTOOQP'#Ed'#EdO$vQdO'#DeO%bQ[O'#DrO$vQdO'#DtO%sQ[O'#DvO&OQ[O'#DyO&TQ[O'#EPO&cQ[O'#EROOQS'#Ec'#EcOOQS'#ET'#ETQYQ[OOO&jQXO'#CdO'_QWO'#DaO'dQWO'#EjO'oQ[O'#EjQOQWOOOOQP'#Cg'#CgOOQP,59Q,59QO#fQ[O,59QO'yQ[O'#EWO(eQWO,58{O(mQ[O,59SO$lQ[O,59kO$qQ[O,59oO'yQ[O,59sO'yQ[O,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;'S%^;'S;=`%o<%lO%^XFeU|POy%^z!`%^!`!aFw!a;'S%^;'S;=`%o<%lO%^XGOS|PoWOy%^z;'S%^;'S;=`%o<%lO%^XG_WOy%^z!c%^!c!}Gw!}#T%^#T#oGw#o;'S%^;'S;=`%o<%lO%^XHO[!YPoWOy%^z}%^}!OGw!O!Q%^!Q![Gw![!c%^!c!}Gw!}#T%^#T#oGw#o;'S%^;'S;=`%o<%lO%^XHySxPOy%^z;'S%^;'S;=`%o<%lO%^^I[SvUOy%^z;'S%^;'S;=`%o<%lO%^XIkUOy%^z#b%^#b#cI}#c;'S%^;'S;=`%o<%lO%^XJSUoWOy%^z#W%^#W#XJf#X;'S%^;'S;=`%o<%lO%^XJmS!`PoWOy%^z;'S%^;'S;=`%o<%lO%^XJ|UOy%^z#f%^#f#gJf#g;'S%^;'S;=`%o<%lO%^XKeS!RPOy%^z;'S%^;'S;=`%o<%lO%^_KvS!QVOy%^z;'S%^;'S;=`%o<%lO%^ZLXU!PPOy%^z!_%^!_!`6y!`;'S%^;'S;=`%o<%lO%^WLnP;=`<%l$}",tokenizers:[sg,rg,ng,0,1,2,3],topRules:{StyleSheet:[0,4],Styles:[1,84]},specialized:[{term:95,get:t=>ag[t]||-1},{term:56,get:t=>lg[t]||-1},{term:96,get:t=>hg[t]||-1}],tokenPrec:1123});let ug=null;function dg(){if(!ug&&"object"==typeof document&&document.body){let{style:t}=document.body,e=[],i=new Set;for(let n in t)"cssText"!=n&&"cssFloat"!=n&&"string"==typeof t[n]&&(/[A-Z]/.test(n)&&(n=n.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))),i.has(n)||(e.push(n),i.add(n)));ug=e.sort().map((t=>({type:"property",label:t})))}return ug||[]}const fg=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map((t=>({type:"class",label:t}))),pg=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map((t=>({type:"keyword",label:t}))).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map((t=>({type:"constant",label:t})))),Og=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map((t=>({type:"type",label:t}))),gg=/^(\w[\w-]*|-\w[\w-]*|)$/,mg=/^-(-[\w-]*)?$/;const bg=new Ro,wg=["Declaration"];function vg(t){for(let e=t;;){if(e.type.isTop)return e;if(!(e=e.parent))return t}}function yg(t,e,i){if(e.to-e.from>4096){let n=bg.get(e);if(n)return n;let s=[],r=new Set,o=e.cursor(mo.IncludeAnonymous);if(o.firstChild())do{for(let e of yg(t,o.node,i))r.has(e.label)||(r.add(e.label),s.push(e))}while(o.nextSibling());return bg.set(e,s),s}{let n=[],s=new Set;return e.cursor().iterate((e=>{var r;if(i(e)&&e.matchContext(wg)&&":"==(null===(r=e.node.nextSibling)||void 0===r?void 0:r.name)){let i=t.sliceString(e.from,e.to);s.has(i)||(s.add(i),n.push({label:i,type:"variable"}))}})),n}}const Sg=t=>e=>{let{state:i,pos:n}=e,s=Xa(i).resolveInner(n,-1),r=s.type.isError&&s.from==s.to-1&&"-"==i.doc.sliceString(s.from,s.to);if("PropertyName"==s.name||(r||"TagName"==s.name)&&/^(Block|Styles)$/.test(s.resolve(s.to).name))return{from:s.from,options:dg(),validFor:gg};if("ValueName"==s.name)return{from:s.from,options:pg,validFor:gg};if("PseudoClassName"==s.name)return{from:s.from,options:fg,validFor:gg};if(t(s)||(e.explicit||r)&&function(t,e){var i;if(("("==t.name||t.type.isError)&&(t=t.parent||t),"ArgList"!=t.name)return!1;let n=null===(i=t.parent)||void 0===i?void 0:i.firstChild;return"Callee"==(null==n?void 0:n.name)&&"var"==e.sliceString(n.from,n.to)}(s,i.doc))return{from:t(s)||r?s.from:n,options:yg(i.doc,vg(s),t),validFor:mg};if("TagName"==s.name){for(let{parent:t}=s;t;t=t.parent)if("Block"==t.name)return{from:s.from,options:dg(),validFor:gg};return{from:s.from,options:Og,validFor:gg}}if(!e.explicit)return null;let o=s.resolve(n),a=o.childBefore(n);return a&&":"==a.name&&"PseudoClassSelector"==o.name?{from:n,options:fg,validFor:gg}:a&&":"==a.name&&"Declaration"==o.name||"ArgList"==o.name?{from:n,options:pg,validFor:gg}:"Block"==o.name||"Styles"==o.name?{from:n,options:dg(),validFor:gg}:null},xg=Sg((t=>"VariableName"==t.name)),kg=_a.define({name:"css",parser:cg.configure({props:[Na.add({Declaration:il()}),rl.add({"Block KeyframeList":ol})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function Qg(){return new Ua(kg,kg.data.of({autocomplete:xg}))}const $g=["_blank","_self","_top","_parent"],Pg=["ascii","utf-8","utf-16","latin1","latin1"],Cg=["get","post","put","delete"],_g=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Xg=["true","false"],Zg={},Ag={a:{attrs:{href:null,ping:null,type:null,media:null,target:$g,hreflang:null}},abbr:Zg,address:Zg,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Zg,aside:Zg,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Zg,base:{attrs:{href:null,target:$g}},bdi:Zg,bdo:Zg,blockquote:{attrs:{cite:null}},body:Zg,br:Zg,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Zg,center:Zg,cite:Zg,code:Zg,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:Zg,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Zg,div:Zg,dl:Zg,dt:Zg,em:Zg,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Zg,figure:Zg,footer:Zg,form:{attrs:{action:null,name:null,"accept-charset":Pg,autocomplete:["on","off"],enctype:_g,method:Cg,novalidate:["novalidate"],target:$g}},h1:Zg,h2:Zg,h3:Zg,h4:Zg,h5:Zg,h6:Zg,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Zg,hgroup:Zg,hr:Zg,html:{attrs:{manifest:null}},i:Zg,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:_g,formmethod:Cg,formnovalidate:["novalidate"],formtarget:$g,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:Zg,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Zg,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:Zg,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Pg,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:Zg,noscript:Zg,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:Zg,param:{attrs:{name:null,value:null}},pre:Zg,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Zg,rt:Zg,ruby:Zg,samp:Zg,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Pg}},section:Zg,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Zg,source:{attrs:{src:null,type:null,media:null}},span:Zg,strong:Zg,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Zg,summary:Zg,sup:Zg,table:Zg,tbody:Zg,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Zg,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:Zg,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Zg,time:{attrs:{datetime:null}},title:Zg,tr:Zg,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Zg,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:Zg},Tg={accesskey:null,class:null,contenteditable:Xg,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Xg,autocorrect:Xg,autocapitalize:Xg,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Xg,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Xg,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Xg,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Xg,"aria-hidden":Xg,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Xg,"aria-multiselectable":Xg,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Xg,"aria-relevant":null,"aria-required":Xg,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},Rg="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map((t=>"on"+t));for(let t of Rg)Tg[t]=null;class Eg{constructor(t,e){this.tags=Object.assign(Object.assign({},Ag),t),this.globalAttrs=Object.assign(Object.assign({},Tg),e),this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}function Vg(t,e,i=t.length){if(!e)return"";let n=e.firstChild,s=n&&n.getChild("TagName");return s?t.sliceString(s.from,Math.min(s.to,i)):""}function Mg(t,e=!1){for(let i=t.parent;i;i=i.parent)if("Element"==i.name){if(!e)return i;e=!1}return null}function Dg(t,e,i){let n=i.tags[Vg(t,Mg(e,!0))];return(null==n?void 0:n.children)||i.allTags}function Wg(t,e){let i=[];for(let n=e;n=Mg(n);){let s=Vg(t,n);if(s&&"CloseTag"==n.lastChild.name)break;s&&i.indexOf(s)<0&&("EndTag"==e.name||e.from>=n.firstChild.to)&&i.push(s)}return i}Eg.default=new Eg;const Ug=/^[:\-\.\w\u00b7-\uffff]*$/;function Yg(t,e,i,n,s){let r=/\s*>/.test(t.sliceDoc(s,s+5))?"":">";return{from:n,to:s,options:Dg(t.doc,i,e).map((t=>({label:t,type:"type"}))).concat(Wg(t.doc,i).map(((t,e)=>({label:"/"+t,apply:"/"+t+r,type:"type",boost:99-e})))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function qg(t,e,i,n){let s=/\s*>/.test(t.sliceDoc(n,n+5))?"":">";return{from:i,to:n,options:Wg(t.doc,e).map(((t,e)=>({label:t,apply:t+s,type:"type",boost:99-e}))),validFor:Ug}}function Lg(t,e){let{state:i,pos:n}=e,s=Xa(i).resolveInner(n),r=s.resolve(n,-1);for(let t,e=n;s==r&&(t=r.childBefore(e));){let i=t.lastChild;if(!i||!i.type.isError||i.from({label:t,type:"property"}))),validFor:Ug}}(i,t,r,"AttributeName"==r.name?r.from:n,n):"Is"==r.name||"AttributeValue"==r.name||"UnquotedAttributeValue"==r.name?function(t,e,i,n,s){var r;let o,a=null===(r=i.parent)||void 0===r?void 0:r.getChild("AttributeName"),l=[];if(a){let r=t.sliceDoc(a.from,a.to),h=e.globalAttrs[r];if(!h){let n=Mg(i),s=n?e.tags[Vg(t.doc,n)]:null;h=(null==s?void 0:s.attrs)&&s.attrs[r]}if(h){let e=t.sliceDoc(n,s).toLowerCase(),i='"',r='"';/^['"]/.test(e)?(o='"'==e[0]?/^[^"]*$/:/^[^']*$/,i="",r=t.sliceDoc(s,s+1)==e[0]?"":e[0],e=e.slice(1),n++):o=/^[^\s<>='"]*$/;for(let t of h)l.push({label:t,apply:i+t+r,type:"constant"})}}return{from:n,to:s,options:l,validFor:o}}(i,t,r,"Is"==r.name?n:r.from,n):!e.explicit||"Element"!=s.name&&"Text"!=s.name&&"Document"!=s.name?null:function(t,e,i,n){let s=[],r=0;for(let n of Dg(t.doc,i,e))s.push({label:"<"+n,type:"type"});for(let e of Wg(t.doc,i))s.push({label:"",type:"type",boost:99-r++});return{from:n,to:n,options:s,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}(i,t,r,n)}function zg(t){let{extraTags:e,extraGlobalAttributes:i}=t,n=i||e?new Eg(e,i):Eg.default;return t=>Lg(n,t)}const Ig=[{tag:"script",attrs:t=>"text/typescript"==t.type||"ts"==t.lang,parser:zf.parser},{tag:"script",attrs:t=>"text/babel"==t.type||"text/jsx"==t.type,parser:If.parser},{tag:"script",attrs:t=>"text/typescript-jsx"==t.type,parser:Bf.parser},{tag:"script",attrs:t=>!t.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(t.type),parser:qf.parser},{tag:"style",attrs:t=>(!t.lang||"css"==t.lang)&&(!t.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(t.type)),parser:kg.parser}],Bg=[{name:"style",parser:kg.parser.configure({top:"Styles"})}].concat(Rg.map((t=>({name:t,parser:qf.parser})))),jg=_a.define({name:"html",parser:FO.configure({props:[Na.add({Element(t){let e=/^(\s*)(<\/)?/.exec(t.textAfter);return t.node.to<=t.pos+e[0].length?t.continue():t.lineIndent(t.node.from)+(e[2]?0:t.unit)},"OpenTag CloseTag SelfClosingTag":t=>t.column(t.node.from)+t.unit,Document(t){if(t.pos+/\s*/.exec(t.textAfter)[0].lengtht.getChild("TagName")})],wrap:tg(Ig,Bg)}),languageData:{commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-._"}});function Ng(t={}){let e,i="";!1===t.matchClosingTags&&(i="noMatch"),!0===t.selfClosingTags&&(i=(i?i+" ":"")+"selfClosing"),(t.nestedLanguages&&t.nestedLanguages.length||t.nestedAttributes&&t.nestedAttributes.length)&&(e=tg((t.nestedLanguages||[]).concat(Ig),(t.nestedAttributes||[]).concat(Bg)));let n=e||i?jg.configure({dialect:i,wrap:e}):jg;return new Ua(n,[jg.data.of({autocomplete:zg(t)}),!1!==t.autoCloseTags?Fg:[],Nf().support,Qg().support])}const Gg=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),Fg=Ts.inputHandler.of(((t,e,i,n)=>{if(t.composing||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!jg.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((e=>{var i,r,o;let a,{head:l}=e,h=Xa(s).resolveInner(l,-1);if("TagName"!=h.name&&"StartTag"!=h.name||(h=h.parent),">"==n&&"OpenTag"==h.name){if("CloseTag"!=(null===(r=null===(i=h.parent)||void 0===i?void 0:i.lastChild)||void 0===r?void 0:r.name)&&(a=Vg(s.doc,h.parent,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`${e?"":">"}`;return{range:A.cursor(l+1),changes:{from:l+(e?1:0),insert:i}}}}else if("/"==n&&"OpenTag"==h.name){let e=h.parent,i=null==e?void 0:e.parent;if(e.from==l-1&&"CloseTag"!=(null===(o=i.lastChild)||void 0===o?void 0:o.name)&&(a=Vg(s.doc,i,l))&&!Gg.has(a)){let e=">"===t.state.doc.sliceString(l,l+1),i=`/${a}${e?"":">"}`,n=l+i.length+(e?1:0);return{range:A.cursor(n),changes:{from:l,insert:i}}}}return{range:e}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)})),Hg=Qa({commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}}}),Jg=new ho,Kg=sO.configure({props:[rl.add((t=>!t.is("Block")||t.is("Document")||null!=tm(t)?void 0:(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to}))),Jg.add(tm),Na.add({Document:()=>null}),ka.add({Document:Hg})]});function tm(t){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(t.name);return e?+e[1]:void 0}function em(t,e){let i=t;for(;;){let t,n=i.nextSibling;if(!n||null!=(t=tm(n.type))&&t<=e)break;i=n}return i.to}const im=sl.of(((t,e,i)=>{for(let n=Xa(t).resolveInner(i,-1);n&&!(n.fromi)return{from:i,to:e}}return null}));function nm(t){return new Pa(Hg,t,[im],"markdown")}const sm=nm(Kg),rm=nm(Kg.configure([pO,mO,gO,bO]));class om{constructor(t,e,i,n,s,r,o){this.node=t,this.from=e,this.to=i,this.spaceBefore=n,this.spaceAfter=s,this.type=r,this.item=o}blank(t,e=!0){let i=this.spaceBefore+("Blockquote"==this.node.name?">":"");if(null!=t){for(;i.length0;t--)i+=" ";return i+(e?this.spaceAfter:"")}marker(t,e){let i="OrderedList"==this.node.name?String(+lm(this.item,t)[2]+e):"";return this.spaceBefore+i+this.type+this.spaceAfter}}function am(t,e){let i=[];for(let e=t;e&&"Document"!=e.name;e=e.parent)"ListItem"!=e.name&&"Blockquote"!=e.name&&"FencedCode"!=e.name||i.push(e);let n=[];for(let t=i.length-1;t>=0;t--){let s,r=i[t],o=e.lineAt(r.from),a=r.from-o.from;if("FencedCode"==r.name)n.push(new om(r,a,a,"","","",null));else if("Blockquote"==r.name&&(s=/^[ \t]*>( ?)/.exec(o.text.slice(a))))n.push(new om(r,a,a+s[0].length,"",s[1],">",null));else if("ListItem"==r.name&&"OrderedList"==r.parent.name&&(s=/^([ \t]*)\d+([.)])([ \t]*)/.exec(o.text.slice(a)))){let t=s[3],e=s[0].length;t.length>=4&&(t=t.slice(0,t.length-4),e-=4),n.push(new om(r.parent,a,a+e,s[1],t,s[2],r))}else if("ListItem"==r.name&&"BulletList"==r.parent.name&&(s=/^([ \t]*)([-+*])([ \t]{1,4}\[[ xX]\])?([ \t]+)/.exec(o.text.slice(a)))){let t=s[4],e=s[0].length;t.length>4&&(t=t.slice(0,t.length-4),e-=4);let i=s[2];s[3]&&(i+=s[3].replace(/[xX]/," ")),n.push(new om(r.parent,a,a+e,s[1],t,i,r))}}return n}function lm(t,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(t.from,t.from+10))}function hm(t,e,i,n=0){for(let s=-1,r=t;;){if("ListItem"==r.name){let t=lm(r,e),o=+t[2];if(s>=0){if(o!=s+1)return;i.push({from:r.from+t[1].length,to:r.from+t[0].length,insert:String(s+2+n)})}s=o}let t=r.nextSibling;if(!t)break;r=t}}function cm(t){return"QuoteMark"==t.name||"ListMark"==t.name}const um=[{key:"Enter",run:({state:t,dispatch:e})=>{let i=Xa(t),{doc:n}=t,s=null,r=t.changeByRange((e=>{if(!e.empty||!rm.isActiveAt(t,e.from))return s={range:e};let r=e.from,o=n.lineAt(r),a=am(i.resolveInner(r,-1),n);for(;a.length&&a[a.length-1].from>r-o.from;)a.pop();if(!a.length)return s={range:e};let l=a[a.length-1];if(l.to-l.spaceAfter.length>r-o.from)return s={range:e};let h=r>=l.to-l.spaceAfter.length&&!/\S/.test(o.text.slice(l.to));if(l.item&&h){if(l.node.firstChild.to>=r||o.from>0&&!/[^\s>]/.test(n.lineAt(o.from-1).text)){let t,e=a.length>1?a[a.length-2]:null,i="";e&&e.item?(t=o.from+e.from,i=e.marker(n,1)):t=o.from+(e?e.to:0);let s=[{from:t,to:r,insert:i}];return"OrderedList"==l.node.name&&hm(l.item,n,s,-2),e&&"OrderedList"==e.node.name&&hm(e.item,n,s),{range:A.cursor(t+i.length),changes:s}}{let e="";for(let t=0,i=a.length-2;t<=i;t++)e+=a[t].blank(t\s*$/.exec(i.text);if(s&&s.index==l.from){let n=t.changes([{from:i.from+s.index,to:i.to},{from:o.from+l.from,to:o.to}]);return{range:e.map(n),changes:n}}}let c=[];"OrderedList"==l.node.name&&hm(l.item,n,c);let u=l.item&&l.item.from]*/.exec(o.text)[0].length>=l.to)for(let t=0,e=a.length-1;t<=e;t++)d+=t!=e||u?a[t].blank(to.from&&/\s/.test(o.text.charAt(f-o.from-1));)f--;return d=t.lineBreak+d,c.push({from:f,to:r,insert:d}),{range:A.cursor(f+d.length),changes:c}}));return!s&&(e(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0)}},{key:"Backspace",run:({state:t,dispatch:e})=>{let i=Xa(t),n=null,s=t.changeByRange((e=>{let s=e.from,{doc:r}=t;if(e.empty&&rm.isActiveAt(t,e.from)){let t=r.lineAt(s),n=am(function(t,e){let i=t.resolveInner(e,-1),n=e;cm(i)&&(n=i.from,i=i.parent);for(let t;t=i.childBefore(n);)if(cm(t))n=t.from;else{if("OrderedList"!=t.name&&"BulletList"!=t.name)break;i=t.lastChild,n=i.to}return i}(i,s),r);if(n.length){let i=n[n.length-1],r=i.to-i.spaceAfter.length+(i.spaceAfter?1:0);if(s-t.from>r&&!/\S/.test(t.text.slice(r,s-t.from)))return{range:A.cursor(t.from+r),changes:{from:t.from+r,to:s}};if(s-t.from==r&&(!i.item||t.from<=i.item.from||!/\S/.test(t.text.slice(0,i.to)))){let n=t.from+i.from;if(i.item&&i.node.fromt.from-e.from||t.startSide-e.startSide)),ni.set(i)}getMatchingBracket(t){switch(t){case")":return"(";case"]":return"[";case"}":return"{";default:return null}}},{decorations:t=>t.decorations});var fm="[a-zA-Z\\$][a-zA-Z0-9\\$]*",pm="(?:\\.\\d+|\\d+\\.\\d*|\\d+)",Om="(?:`(?:`?"+pm+")?)",gm=new RegExp("(?:(?:\\d+)(?:\\^\\^(?:\\.\\w+|\\w+\\.\\w*|\\w+)"+Om+"?(?:\\*\\^[+-]?\\d+)?))"),mm=new RegExp("(?:"+pm+Om+"?(?:\\*\\^[+-]?\\d+)?)"),bm=new RegExp("(?:`?)(?:"+fm+")(?:`(?:"+fm+"))*(?:`?)");let wm=[];const vm=["True","False","All","None","Null","Full","$Failed","$Aborted"];function ym(t,e){var i;return'"'===(i=t.next())?(e.tokenize=Sm,e.tokenize(t,e)):"("===i&&t.eat("*")?(e.commentLevel++,e.tokenize=xm,e.tokenize(t,e)):(t.backUp(1),t.match(gm,!0,!1)||t.match(mm,!0,!1)?"number":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::usage)/,!0,!1)?"meta":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::[a-zA-Z\$][a-zA-Z0-9\$]*):?/,!0,!1)?"string.special":t.match(/([a-zA-Z\$][a-zA-Z0-9\$]*\s*:)(?:(?:[a-zA-Z\$][a-zA-Z0-9\$]*)|(?:[^:=>~@\^\&\*\)\[\]'\?,\|])).*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)||t.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+/,!0,!1)||t.match(/_+[a-zA-Z\$][a-zA-Z0-9\$]*/,!0,!1)?"variableName.special":t.match(/\\\[[a-zA-Z\$][a-zA-Z0-9\$]*\]/,!0,!1)?"character":t.match(/(?:\[|\]|{|}|\(|\))/,!0,!1)?"bracket":t.match(/(?:#[a-zA-Z\$][a-zA-Z0-9\$]*|#+[0-9]?)/,!0,!1)?"variableName.constant":t.match(bm,!0,!1)?vm.indexOf(t.current())>-1?"number":wm.indexOf(t.current())>-1||0==wm.length?"keyword":t.current()in e.localVars?"atom":(e.localVars[t.current()]=!0,"function"):t.match(/(?:\\|\+|\-|\*|\/|,|;|\.|:|@|~|=|>|<|&|\||_|`|'|\^|\?|!|%)/,!0,!1)?"operator":(t.next(),"error"))}function Sm(t,e){for(var i,n=!1,s=!1;null!=(i=t.next());){if('"'===i&&!s){n=!0;break}s=!s&&"\\"===i}return n&&!s&&(e.tokenize=ym),"string"}function xm(t,e){for(var i,n;e.commentLevel>0&&null!=(n=t.next());)"("===i&&"*"===n&&e.commentLevel++,"*"===i&&")"===n&&e.commentLevel--,i=n;return e.commentLevel<=0&&(e.tokenize=ym),"comment"}const km={name:"mathematica",extendVariables:function(t){},startState:function(){return{tokenize:ym,commentLevel:0,localVars:{}}},token:function(t,e){return t.eatSpace()?null:e.tokenize(t,e)},languageData:{commentTokens:{block:{open:"(*",close:"*)"}}}};let Qm={of:t=>[Gl.define(km),Yd({override:[async e=>function(t,e){let i=t.matchBefore(/\w*/);return i.from!==i.to||t.explicit?{from:i.from,options:e.data}:null}(e,t)]}),Ys.of([{key:"Escape",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((t=>{let{from:e,to:i}=t;return{changes:{from:e,to:i,insert:"EC"},range:A.cursor(e+2)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])],reBuild:t=>{wm=t.map((t=>t.label))}};const $m=(t,e,i,n)=>{if(0==t.length)return;const s=(new Date).valueOf();let r=0;i.dom.loadingMark=!0;const o=i.dom.style.background;let a=0;console.log("Start animation");const l=setInterval((()=>{i.dom.style.setProperty("background","hsl("+a+"deg 100% 97%)","important"),a+=2,a>360&&(a=0)}),30);n.transaction(e,i,s,t.length);for(const a of t)Pm(a,((a,h)=>{n.file(e,i,s,a,h),r++,r>=t.length&&i.dom&&i.dom.loadingMark&&(i.dom.loadingMark=!1,setTimeout((()=>{i.dom.style.background=o,clearInterval(l),console.log("Stop animation")}),2e3))}),(()=>{console.warn("Fauilure");const t=i.dom.style.background;i.dom.style.background="rgb(255 189 189 / 97%)";let e=97;const n=setInterval((()=>{i.dom.style.background="rgb(255 189 189 / "+Math.round(e)+"%)",e*=.95}),30);clearInterval(l),setTimeout((()=>{clearInterval(n),i.dom.style.background=t}),3e3)}))};function Pm(t,e,i){const n=new FileReader;n.addEventListener("load",(n=>{const s=n.target.result;if(s.byteLength/1024/1024>100)return alert("Files > 100Mb are not supported for drag and drop"),void i();let r=base64ArrayBuffer(s);e(t.name,r)})),n.addEventListener("progress",(t=>{if(t.loaded&&t.total){const e=t.loaded/t.total*100;console.log(e)}})),n.readAsArrayBuffer(t)}const Cm=(t,e)=>Ts.domEventHandlers({drop(e,i){e.preventDefault();const n=[];e.dataTransfer.items?[...e.dataTransfer.items].forEach(((t,e)=>{if("file"===t.kind){const i=t.getAsFile();console.log(`… file[${e}].name = ${i.name}`),n.push(i)}})):[...e.dataTransfer.files].forEach(((t,e)=>{console.log(`… file[${e}].name = ${t.name}`),n.push(t)})),$m(n,e,i,t)},paste(t,i){let n=t.clipboardData||window.clipboardData;for(const s of n.items)if("string"===s.kind)switch(s.type){case"text/plain":break;case"image/png":t.preventDefault(),$m([s.getAsFile()],t,i,e)}else t.preventDefault(),$m([s.getAsFile()],t,i,e)}}),_m=new pr({regexp:/\\\[(\w+)\]/g,decoration:t=>ni.replace({widget:new Zm(t[1])})}),Xm=_i.fromClass(class{constructor(t){this.Greekholder=_m.createDeco(t)}update(t){this.Greekholder=_m.updateDeco(t,this.Greekholder)}},{decorations:t=>t.Greekholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Greekholder||ni.none))});class Zm extends ei{constructor(t){super(),this.name=t}eq(t){return this.name===t.name}toDOM(){let t=document.createElement("span");return t.innerHTML="&"+this.name.toLowerCase().replace("sqrt","radic").replace("undirectededge","harr").replace("directededge","rarr").replace(/capital(.*)/,((t,e)=>e.charAt(0).toUpperCase()+e.slice(1))).replace(/curly(.*)/,((t,e)=>e)).replace(/script(.*)/,((t,e)=>"el"+e.toLowerCase())).replace("transpose","#7488").replace("degree","deg")+";",t}ignoreEvent(){return!1}}const Am=new pr({regexp:/(->|<-)/g,decoration:t=>ni.replace({widget:new Tm(t[1])})});_i.fromClass(class{constructor(t){this.Arrowholder=Am.createDeco(t)}update(t){this.Arrowholder=Am.updateDeco(t,this.Arrowholder)}},{decorations:t=>t.Arrowholder,provide:t=>Ts.atomicRanges.of((e=>e.plugin(t)?.Arrowholder||ni.none))});class Tm extends ei{constructor(t){super(),this.dir=t}eq(t){return this.dir===t.dir}toDOM(){let t=document.createElement("span");return"->"===this.dir?t.innerText="→":t.innerText="←",t}ignoreEvent(){return!1}}function Rm(t){if(!(t=t||{}).open)throw new Error('Balanced: please provide a "open" property');if(!t.close)throw new Error('Balanced: please provide a "close" property');if(this.balance=t.balance||!1,this.exceptions=t.exceptions||!1,this.caseInsensitive=t.caseInsensitive,this.head=t.head||t.open,this.head=Array.isArray(this.head)?this.head:[this.head],this.open=Array.isArray(t.open)?t.open:[t.open],this.close=Array.isArray(t.close)?t.close:[t.close],!Array.isArray(this.head)||!Array.isArray(this.open)||!Array.isArray(this.close)||this.head.length!==this.open.length||this.open.length!==this.close.length)throw new Error('Balanced: if you use arrays for a "head,open,close" you must use matching arrays for all options');var e=Dm(this.head.map(this.regExpFromArrayGroupedMap,this)),i=Dm(this.open.map(this.regExpFromArrayGroupedMap,this)),n=Dm(this.close.map(this.regExpFromArrayGroupedMap,this));this.regExp=Dm([e,i,n],"g"+(this.caseInsensitive?"i":"")),this.regExpGroupLength=this.head.length}function Em(t,e,i){for(var n=Mm(e.substr(0,i+1),/^.*\n?$/gim),s=Mm(e,/^.*\n?$/gim),r=n.length-1,o=i+1-(n.length?n[n.length-1].index:0),a="",l=2;l>=0;l--)r-l>=0&&s[r-l]&&(a+=e.substr(s[r-l].index,s[r-l].length)+"\n");for(l=0;l=0&&s[r+l]&&(a+=e.substr(s[r+l].index,s[r+l].length)+"\n");a=a.replace(/\t/g," ").replace(/\n$/,"");var h=new Error(t+" at "+(r+1)+":"+o+"\n\n"+a);return h.line=r+1,h.column=o,h.index=i,h}function Vm(t,e){return t>=e.index&&t<=e.index+e.length-1}function Mm(t,e){var i,n=new RegExp(e),s=[];if(t)for(;i=n.exec(t);)s.push({index:i.index,length:i[0].length,match:i[0]}),i[0].length||n.lastIndex++;return s}function Dm(t,e,i){var n=t.map((function(t){return t instanceof RegExp?t.source:function(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}(t)}),this).join("|");return n=i?"("+n+")":"(?:"+n+")",new RegExp(n,e||void 0)}Rm.prototype={regExpFromArrayGroupedMap:function(t){return Dm([t],null,!0)},matchContentsInBetweenBrackets:function(t,e){for(var i,n=new RegExp(this.regExp),s=[],r=[],o=null,a=!0;i=n.exec(t);){if(e){for(var l=!1,h=0;h{const i=((t,e,i)=>{var n,s=new RegExp(t),r=[];if(e)for(;n=s.exec(e);){if(i){for(var o=!1,a=0;a{new qm({open:"(*"+t+"[*)",close:"(*]"+t+"*)",balance:!1}).matchContentsInBetweenBrackets(e.value,[]).forEach((function(t){const s=e.value.slice(t.index+t.head.length,t.index+t.length-t.tail.length);n(i+t.index,{length:t.length,pos:i+t.index,argsPos:i+t.index+t.head.length,str:s})}))})(e,t,i,s)},o=t.iterRange(i,n),a=i;!o.next().done;a+=o.value.length)r(o,a)}var Im,Bm=function(){function t(t){var e=t.tag,i=t.decoration,n=t.decorate,s=t.boundary,r=t.maxLength,o=void 0===r?1e3:r;if(this.tag=e,n)this.addMatch=function(t,e,i,s){return n(s,i,i+t.length,t,e)};else if("function"==typeof i)this.addMatch=function(t,e,n,s){var r=i(t,e,n);r&&s(n,n+t.length,r)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=function(t,e,n,s){return s(n,n+t.length,i)}}this.boundary=s,this.maxLength=o}return t.prototype.createDeco=function(t){for(var e=this,i=new Xt,n=i.add.bind(i),s=0,r=function(t,e){var i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;for(var n=[],s=0,r=i;s=a?n[n.length-1].to=l:n.push({from:a,to:l})}return n}(t,this.maxLength);st.view.viewport.from&&r1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e},t.prototype.updateRange=function(t,e,i,n){for(var s=this,r=function(r){var a=Math.max(r.from,i),l=Math.min(r.to,n);if(l>a){var h=t.state.doc.lineAt(a),c=h.toh.from;a--)if(o.boundary.test(h.text[a-1-h.from])){u=a;break}for(;ld},add:f})}},o=this,a=0,l=t.visibleRanges;a{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*FB[*)((_)(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*FB[*)(("+s+")(*,*)/(*,*)(_))(*]FB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let Nm=class{constructor(t,e,i,n,s,r){this.view=e,this.visibleValue=t,this.placeholder=r,console.log(r),this.args=Lm(t.str,/\(\*,\*\)/gm);const o=this;let a,l;console.log("creating InstanceWidget"),a=Im({doc:o.args[0].body.slice(2,-1),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(o.visibleValue.pos),e.dispatch({selection:{anchor:o.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return l.dispatch({selection:{anchor:0}}),l.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){l.focus(),t.editorLastCursor=void 0}}])]}),l=Im({doc:o.args[2].body.slice(1,-2),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:a.state.doc.length}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:o.visibleValue.pos+o.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus(),t.editorLastCursor=void 0}}])]}),o.args[0].length=o.args[0].body.length,o.args[2].length=o.args[2].body.length,delete o.args[2].body,delete o.args[1].body,delete o.args[0].body,this.topEditor=a,this.bottomEditor=l}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="(("+t+")",s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length));const r=e.length-i[0].length;i[0].to=i[0].to+r,i[2].from=i[2].from+r,i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e="("+t+"))",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length));const r=e.length-i[2].length;i[2].to=i[2].to+r,i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t,e){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm),console.log("recreating InstanceWidget"),n=Im.state({doc:e.args[0].body.slice(2,-1),update:t=>e.applyChanges(t,0),eval:()=>{i.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(e.visibleValue.pos),i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus(),t.editorLastCursor=void 0}}])]}),s=Im.state({doc:e.args[2].body.slice(1,-2),update:t=>e.applyChanges(t,2),eval:()=>{e.view.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus(),t.editorLastCursor=void 0}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),console.log(e),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.placeholder=e,this.visibleValue.argsPos=t.argsPos}destroy(){this.topEditor.destroy(),this.bottomEditor.destroy()}},Gm=class extends ei{constructor(t,e,i,n){super(),this.view=i,this.visibleValue=t,this.reference=e,this.placeholder=n}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue,this),!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("fraction");const i=document.createElement("table");i.classList.add("container"),e.appendChild(i);const n=document.createElement("tbody");i.appendChild(n);const s=document.createElement("tr"),r=document.createElement("tr");n.appendChild(s),n.appendChild(r);const o=document.createElement("td");o.classList.add("enumenator"),s.appendChild(o);const a=document.createElement("td");r.appendChild(a);const l=this;return e.EditorWidget=new Nm(this.visibleValue,t,o,a,[],this),this.DOMElement=e,this.reference.push({destroy:()=>{l.destroy(e)}}),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const Fm=(t,e,i)=>new Bm({tag:"FB",decoration:n=>ni.replace({widget:new Gm(n,t,e,i)})}),Hm=t=>_i.fromClass(class{constructor(e){this.disposable=[],this.placeholder=Fm(this.disposable,e,this).createDeco(e),t.placeholder=this}update(t){this.placeholder=Fm(this.disposable,t,this).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var Jm;function Km(t){return Jm=t,[nb,Ys.of([{key:"Ctrl-2",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt[_](*]SqB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SqB[*)Sqrt["+s+"](*]SqB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let tb=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;this.sliceRanges=n,this.length=t.str.length,console.log("creating InstanceWidget"),this.editor=Jm({doc:t.str.slice(...n),parent:i,update:t=>r.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]})}applyChanges(t){const e=t,i={from:this.visibleValue.argsPos+5,to:this.visibleValue.argsPos+this.length-1,insert:e};console.log(this.visibleValue);const n=e.length+6-this.length;this.length=this.length+n,this.visibleValue.length=this.visibleValue.length+n,this.visibleValue.str="Sqrt["+e+"]",this.view.dispatch({changes:i})}update(t){if(this.visibleValue.str==t.str)this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos;else{console.warn("Out of sync"),this.visibleValue=t;const e=this.sliceRanges,i=this.editor,n=this,s=this.view;this.length=t.str.length;const r=Jm.state({doc:t.str.slice(...e),update:t=>n.applyChanges(t),eval:()=>{s.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos+n.visibleValue.length}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return s.dispatch({selection:{anchor:n.visibleValue.pos}}),s.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]});i.setState(r)}}destroy(){console.warn("destroy Instance of Widget!"),this.editor.destroy()}},eb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("sqroot");const i=this,n=document.createElement("span");return n.classList.add("radicand"),e.EditorWidget=new tb(this.visibleValue,t,n,[5,-1],[]),e.appendChild(n),this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const ib=(t,e)=>new Bm({tag:"SqB",decoration:i=>ni.replace({widget:new eb(i,t,e)})}),nb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=ib(this.disposable,t).createDeco(t)}update(t){this.placeholder=ib(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var sb;function rb(t){return sb=t,[hb,Ys.of([{key:"Ctrl--",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SbB[*)Subscript[_(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SbB[*)Subscript["+s+"(*|*),(*|*)_](*]SbB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let ob=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),console.log(r.visibleValue),o=sb({doc:r.args[0].body.slice(10),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){a.focus()}}])]}),a=sb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Subscript["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),console.log(e.visibleValue),n=sb.state({doc:e.args[0].body.slice(10),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.bottomEditor.focus()}}])]}),s=sb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},ab=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sub");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new ob(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const lb=(t,e)=>new Bm({tag:"SbB",decoration:i=>ni.replace({widget:new ab(i,t,e)})}),hb=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=lb(this.disposable,t).createDeco(t)}update(t){this.placeholder=lb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var cb;function ub(t){return cb=t,[Ob,Ys.of([{key:"Ctrl-6",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{let{from:i,to:n}=e;const s=t.sliceDoc(i,n);return 0===s.length?{changes:{from:i,to:n,insert:"(*SpB[*)Power[_(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}:{changes:{from:i,to:n,insert:"(*SpB[*)Power["+s+"(*|*),(*|*)_](*]SpB*)"},range:A.cursor(i)}}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}])]}let db=class{constructor(t,e,i,n,s){this.view=e,this.visibleValue=t;const r=this;let o,a;this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("creating InstanceWidget"),o=cb({doc:r.args[0].body.slice(6),parent:i,update:t=>this.applyChanges(t,0),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return a.dispatch({selection:{anchor:0}}),a.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,e){a.focus()}}])]}),a=cb({doc:r.args[2].body.slice(0,-1),parent:n,update:t=>this.applyChanges(t,2),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.dispatch({selection:{anchor:r.visibleValue.pos+r.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,e){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return o.dispatch({selection:{anchor:o.state.doc.length}}),o.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,e){o.focus()}}])]}),this.topEditor=o,this.bottomEditor=a,r.args[0].length=r.args[0].body.length,r.args[2].length=r.args[2].body.length,delete r.args[2].body,delete r.args[1].body,delete r.args[0].body}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos;if(0==e){const e="Power["+t,s={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(e,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].to=i[0].to+(e.length-i[0].length),i[2].from=i[2].from+(e.length-i[0].length);const r=e.length-i[0].length;i[0].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}else{const e=t+"]",s={from:n+i[2].from,to:n+i[2].from+i[2].length,insert:e};this.visibleValue.str=this.visibleValue.str.substring(0,i[2].from).concat(e,this.visibleValue.str.substring(i[2].from+i[2].length)),i[2].to=i[2].to+(e.length-i[2].length);const r=e.length-i[2].length;i[2].length=e.length,this.visibleValue.length=this.visibleValue.length+r,this.view.dispatch({changes:s})}}update(t){if(this.visibleValue.str!=t.str){console.warn("Out of sync");const e=this,i=this.view;let n,s;return this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm),console.log("recreating InstanceWidget"),n=cb.state({doc:e.args[0].body.slice(6),update:t=>e.applyChanges(t,0),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.bottomEditor.dispatch({selection:{anchor:0}}),e.bottomEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(t,i){e.bottomEditor.focus()}}])]}),s=cb.state({doc:e.args[2].body.slice(0,-1),update:t=>e.applyChanges(t,2),extensions:[Ys.of([{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i.dispatch({selection:{anchor:e.visibleValue.pos+e.visibleValue.length}}),i.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return e.topEditor.dispatch({selection:{anchor:e.topEditor.state.doc.length}}),e.topEditor.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(t,i){e.topEditor.focus()}}])]}),this.topEditor.setState(n),this.bottomEditor.setState(s),e.args[0].length=e.args[0].body.length,void(e.args[2].length=e.args[2].body.length)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){console.warn("destroy Instance of Widget!"),this.topEditor.destroy(),this.bottomEditor.destroy()}},fb=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=document.createElement("span"),i=document.createElement("span");i.classList.add("subscript-tail");const n=document.createElement("sup");n.classList.add("subscript-tail"),e.appendChild(i),e.appendChild(n),e.EditorWidget=new db(this.visibleValue,t,i,n,[]);const s=this;return this.reference.push({destroy:()=>{s.destroy(e)}}),this.DOMElement=e,e}ignoreEvent(){return!0}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.topEditor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.topEditor.focus();else{const t=this.DOMElement.EditorWidget.bottomEditor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}destroy(t){t.EditorWidget.destroy()}};const pb=(t,e)=>new Bm({tag:"SpB",decoration:i=>ni.replace({widget:new fb(i,t,e)})}),Ob=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=pb(this.disposable,t).createDeco(t)}update(t){this.placeholder=pb(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var gb={},mb={},bb={},wb={};function vb(t){let e=t.length;for(;--e>=0;)t[e]=0}const yb=256,Sb=286,xb=30,kb=15,Qb=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),$b=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Pb=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Cb=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_b=new Array(576);vb(_b);const Xb=new Array(60);vb(Xb);const Zb=new Array(512);vb(Zb);const Ab=new Array(256);vb(Ab);const Tb=new Array(29);vb(Tb);const Rb=new Array(xb);function Eb(t,e,i,n,s){this.static_tree=t,this.extra_bits=e,this.extra_base=i,this.elems=n,this.max_length=s,this.has_stree=t&&t.length}let Vb,Mb,Db;function Wb(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}vb(Rb);const Ub=t=>t<256?Zb[t]:Zb[256+(t>>>7)],Yb=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},qb=(t,e,i)=>{t.bi_valid>16-i?(t.bi_buf|=e<>16-t.bi_valid,t.bi_valid+=i-16):(t.bi_buf|=e<{qb(t,i[2*e],i[2*e+1])},zb=(t,e)=>{let i=0;do{i|=1&t,t>>>=1,i<<=1}while(--e>0);return i>>>1},Ib=(t,e,i)=>{const n=new Array(16);let s,r,o=0;for(s=1;s<=kb;s++)o=o+i[s-1]<<1,n[s]=o;for(r=0;r<=e;r++){let e=t[2*r+1];0!==e&&(t[2*r]=zb(n[e]++,e))}},Bb=t=>{let e;for(e=0;e{t.bi_valid>8?Yb(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},Nb=(t,e,i,n)=>{const s=2*e,r=2*i;return t[s]{const n=t.heap[i];let s=i<<1;for(;s<=t.heap_len&&(s{let n,s,r,o,a=0;if(0!==t.sym_next)do{n=255&t.pending_buf[t.sym_buf+a++],n+=(255&t.pending_buf[t.sym_buf+a++])<<8,s=t.pending_buf[t.sym_buf+a++],0===n?Lb(t,s,e):(r=Ab[s],Lb(t,r+yb+1,e),o=Qb[r],0!==o&&(s-=Tb[r],qb(t,s,o)),n--,r=Ub(n),Lb(t,r,i),o=$b[r],0!==o&&(n-=Rb[r],qb(t,n,o)))}while(a{const i=e.dyn_tree,n=e.stat_desc.static_tree,s=e.stat_desc.has_stree,r=e.stat_desc.elems;let o,a,l,h=-1;for(t.heap_len=0,t.heap_max=573,o=0;o>1;o>=1;o--)Gb(t,i,o);l=r;do{o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Gb(t,i,1),a=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=a,i[2*l]=i[2*o]+i[2*a],t.depth[l]=(t.depth[o]>=t.depth[a]?t.depth[o]:t.depth[a])+1,i[2*o+1]=i[2*a+1]=l,t.heap[1]=l++,Gb(t,i,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const i=e.dyn_tree,n=e.max_code,s=e.stat_desc.static_tree,r=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,l=e.stat_desc.max_length;let h,c,u,d,f,p,O=0;for(d=0;d<=kb;d++)t.bl_count[d]=0;for(i[2*t.heap[t.heap_max]+1]=0,h=t.heap_max+1;h<573;h++)c=t.heap[h],d=i[2*i[2*c+1]+1]+1,d>l&&(d=l,O++),i[2*c+1]=d,c>n||(t.bl_count[d]++,f=0,c>=a&&(f=o[c-a]),p=i[2*c],t.opt_len+=p*(d+f),r&&(t.static_len+=p*(s[2*c+1]+f)));if(0!==O){do{for(d=l-1;0===t.bl_count[d];)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[l]--,O-=2}while(O>0);for(d=l;0!==d;d--)for(c=t.bl_count[d];0!==c;)u=t.heap[--h],u>n||(i[2*u+1]!==d&&(t.opt_len+=(d-i[2*u+1])*i[2*u],i[2*u+1]=d),c--)}})(t,e),Ib(i,h,t.bl_count)},Jb=(t,e,i)=>{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),e[2*(i+1)+1]=65535,n=0;n<=i;n++)s=o,o=e[2*(n+1)+1],++a{let n,s,r=-1,o=e[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),n=0;n<=i;n++)if(s=o,o=e[2*(n+1)+1],!(++a{qb(t,0+(n?1:0),3),jb(t),Yb(t,i),Yb(t,~i),i&&t.pending_buf.set(t.window.subarray(e,e+i),t.pending),t.pending+=i};wb._tr_init=t=>{tw||((()=>{let t,e,i,n,s;const r=new Array(16);for(i=0,n=0;n<28;n++)for(Tb[n]=i,t=0;t<1<>=7;n{let s,r,o=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e{let e;for(Jb(t,t.dyn_ltree,t.l_desc.max_code),Jb(t,t.dyn_dtree,t.d_desc.max_code),Hb(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*Cb[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=i+5,i+4<=s&&-1!==e?ew(t,e,i,n):4===t.strategy||r===s?(qb(t,2+(n?1:0),3),Fb(t,_b,Xb)):(qb(t,4+(n?1:0),3),((t,e,i,n)=>{let s;for(qb(t,e-257,5),qb(t,i-1,5),qb(t,n-4,4),s=0;s(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=i,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(Ab[i]+yb+1)]++,t.dyn_dtree[2*Ub(e)]++),t.sym_next===t.sym_end),wb._tr_align=t=>{qb(t,2,3),Lb(t,256,_b),(t=>{16===t.bi_valid?(Yb(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)};var iw=(t,e,i,n)=>{let s=65535&t|0,r=t>>>16&65535|0,o=0;for(;0!==i;){o=i>2e3?2e3:i,i-=o;do{s=s+e[n++]|0,r=r+s|0}while(--o);s%=65521,r%=65521}return s|r<<16|0};const nw=new Uint32Array((()=>{let t,e=[];for(var i=0;i<256;i++){t=i;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e})());var sw=(t,e,i,n)=>{const s=nw,r=n+i;t^=-1;for(let i=n;i>>8^s[255&(t^e[i])];return-1^t},rw={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},ow={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:aw,_tr_stored_block:lw,_tr_flush_block:hw,_tr_tally:cw,_tr_align:uw}=wb,dw=iw,fw=sw,pw=rw,{Z_NO_FLUSH:Ow,Z_PARTIAL_FLUSH:gw,Z_FULL_FLUSH:mw,Z_FINISH:bw,Z_BLOCK:ww,Z_OK:vw,Z_STREAM_END:yw,Z_STREAM_ERROR:Sw,Z_DATA_ERROR:xw,Z_BUF_ERROR:kw,Z_DEFAULT_COMPRESSION:Qw,Z_FILTERED:$w,Z_HUFFMAN_ONLY:Pw,Z_RLE:Cw,Z_FIXED:_w,Z_DEFAULT_STRATEGY:Xw,Z_UNKNOWN:Zw,Z_DEFLATED:Aw}=ow,Tw=258,Rw=262,Ew=42,Vw=113,Mw=666,Dw=(t,e)=>(t.msg=pw[e],e),Ww=t=>2*t-(t>4?9:0),Uw=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Yw=t=>{let e,i,n,s=t.w_size;e=t.hash_size,n=e;do{i=t.head[--n],t.head[n]=i>=s?i-s:0}while(--e);e=s,n=e;do{i=t.prev[--n],t.prev[n]=i>=s?i-s:0}while(--e)};let qw=(t,e,i)=>(e<{const e=t.state;let i=e.pending;i>t.avail_out&&(i=t.avail_out),0!==i&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+i),t.next_out),t.next_out+=i,e.pending_out+=i,t.total_out+=i,t.avail_out-=i,e.pending-=i,0===e.pending&&(e.pending_out=0))},zw=(t,e)=>{hw(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Lw(t.strm)},Iw=(t,e)=>{t.pending_buf[t.pending++]=e},Bw=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},jw=(t,e,i,n)=>{let s=t.avail_in;return s>n&&(s=n),0===s?0:(t.avail_in-=s,e.set(t.input.subarray(t.next_in,t.next_in+s),i),1===t.state.wrap?t.adler=dw(t.adler,e,s,i):2===t.state.wrap&&(t.adler=fw(t.adler,e,s,i)),t.next_in+=s,t.total_in+=s,s)},Nw=(t,e)=>{let i,n,s=t.max_chain_length,r=t.strstart,o=t.prev_length,a=t.nice_match;const l=t.strstart>t.w_size-Rw?t.strstart-(t.w_size-Rw):0,h=t.window,c=t.w_mask,u=t.prev,d=t.strstart+Tw;let f=h[r+o-1],p=h[r+o];t.prev_length>=t.good_match&&(s>>=2),a>t.lookahead&&(a=t.lookahead);do{if(i=e,h[i+o]===p&&h[i+o-1]===f&&h[i]===h[r]&&h[++i]===h[r+1]){r+=2,i++;do{}while(h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&ro){if(t.match_start=e,o=n,n>=a)break;f=h[r+o-1],p=h[r+o]}}}while((e=u[e&c])>l&&0!=--s);return o<=t.lookahead?o:t.lookahead},Gw=t=>{const e=t.w_size;let i,n,s;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Rw)&&(t.window.set(t.window.subarray(e,e+e-n),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Yw(t),n+=e),0===t.strm.avail_in)break;if(i=jw(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=i,t.lookahead+t.insert>=3)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=qw(t,t.ins_h,t.window[s+1]);t.insert&&(t.ins_h=qw(t,t.ins_h,t.window[s+3-1]),t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead{let i,n,s,r=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,o=0,a=t.strm.avail_in;do{if(i=65535,s=t.bi_valid+42>>3,t.strm.avail_outn+t.strm.avail_in&&(i=n+t.strm.avail_in),i>s&&(i=s),i>8,t.pending_buf[t.pending-2]=~i,t.pending_buf[t.pending-1]=~i>>8,Lw(t.strm),n&&(n>i&&(n=i),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+n),t.strm.next_out),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n,t.block_start+=n,i-=n),i&&(jw(t.strm,t.strm.output,t.strm.next_out,i),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i)}while(0===o);return a-=t.strm.avail_in,a&&(a>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=a&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-a,t.strm.next_in),t.strstart),t.strstart+=a,t.insert+=a>t.w_size-t.insert?t.w_size-t.insert:a),t.block_start=t.strstart),t.high_waters&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,s+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),s>t.strm.avail_in&&(s=t.strm.avail_in),s&&(jw(t.strm,t.window,t.strstart,s),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.high_water>3,s=t.pending_buf_size-s>65535?65535:t.pending_buf_size-s,r=s>t.w_size?t.w_size:s,n=t.strstart-t.block_start,(n>=r||(n||e===bw)&&e!==Ow&&0===t.strm.avail_in&&n<=s)&&(i=n>s?s:n,o=e===bw&&0===t.strm.avail_in&&i===n?1:0,lw(t,t.block_start,i,o),t.block_start+=i,Lw(t.strm)),o?3:1)},Hw=(t,e)=>{let i,n;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==i&&t.strstart-i<=t.w_size-Rw&&(t.match_length=Nw(t,i)),t.match_length>=3)if(n=cw(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=qw(t,t.ins_h,t.window[t.strstart+1]);else n=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2},Jw=(t,e)=>{let i,n,s;for(;;){if(t.lookahead=3&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==i&&t.prev_length4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){s=t.strstart+t.lookahead-3,n=cw(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=s&&(t.ins_h=qw(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(zw(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(n=cw(t,0,t.window[t.strstart-1]),n&&zw(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=cw(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2};function Kw(t,e,i,n,s){this.good_length=t,this.max_lazy=e,this.nice_length=i,this.max_chain=n,this.func=s}const tv=[new Kw(0,0,0,0,Fw),new Kw(4,4,8,4,Hw),new Kw(4,5,16,8,Hw),new Kw(4,6,32,32,Hw),new Kw(4,4,16,16,Jw),new Kw(8,16,32,32,Jw),new Kw(8,16,128,128,Jw),new Kw(8,32,128,256,Jw),new Kw(32,128,258,1024,Jw),new Kw(32,258,258,4096,Jw)];function ev(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Aw,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Uw(this.dyn_ltree),Uw(this.dyn_dtree),Uw(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Uw(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Uw(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const iv=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==Ew&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==Vw&&e.status!==Mw?1:0},nv=t=>{if(iv(t))return Dw(t,Sw);t.total_in=t.total_out=0,t.data_type=Zw;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?Ew:Vw,t.adler=2===e.wrap?0:1,e.last_flush=-2,aw(e),vw},sv=t=>{const e=nv(t);var i;return e===vw&&((i=t.state).window_size=2*i.w_size,Uw(i.head),i.max_lazy_match=tv[i.level].max_lazy,i.good_match=tv[i.level].good_length,i.nice_match=tv[i.level].nice_length,i.max_chain_length=tv[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=2,i.match_available=0,i.ins_h=0),e},rv=(t,e,i,n,s,r)=>{if(!t)return Sw;let o=1;if(e===Qw&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),s<1||s>9||i!==Aw||n<8||n>15||e<0||e>9||r<0||r>_w||8===n&&1!==o)return Dw(t,Sw);8===n&&(n=9);const a=new ev;return t.state=a,a.strm=t,a.status=Ew,a.wrap=o,a.gzhead=null,a.w_bits=n,a.w_size=1<rv(t,e,Aw,15,8,Xw),bb.deflateInit2=rv,bb.deflateReset=sv,bb.deflateResetKeep=nv,bb.deflateSetHeader=(t,e)=>iv(t)||2!==t.state.wrap?Sw:(t.state.gzhead=e,vw),bb.deflate=(t,e)=>{if(iv(t)||e>ww||e<0)return t?Dw(t,Sw):Sw;const i=t.state;if(!t.output||0!==t.avail_in&&!t.input||i.status===Mw&&e!==bw)return Dw(t,0===t.avail_out?kw:Sw);const n=i.last_flush;if(i.last_flush=e,0!==i.pending){if(Lw(t),0===t.avail_out)return i.last_flush=-1,vw}else if(0===t.avail_in&&Ww(e)<=Ww(n)&&e!==bw)return Dw(t,kw);if(i.status===Mw&&0!==t.avail_in)return Dw(t,kw);if(i.status===Ew&&0===i.wrap&&(i.status=Vw),i.status===Ew){let e=Aw+(i.w_bits-8<<4)<<8,n=-1;if(n=i.strategy>=Pw||i.level<2?0:i.level<6?1:6===i.level?2:3,e|=n<<6,0!==i.strstart&&(e|=32),e+=31-e%31,Bw(i,e),0!==i.strstart&&(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),t.adler=1,i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(57===i.status)if(t.adler=0,Iw(i,31),Iw(i,139),Iw(i,8),i.gzhead)Iw(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),Iw(i,255&i.gzhead.time),Iw(i,i.gzhead.time>>8&255),Iw(i,i.gzhead.time>>16&255),Iw(i,i.gzhead.time>>24&255),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(Iw(i,255&i.gzhead.extra.length),Iw(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=fw(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if(Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,0),Iw(i,9===i.level?2:i.strategy>=Pw||i.level<2?4:0),Iw(i,3),i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw;if(69===i.status){if(i.gzhead.extra){let e=i.pending,n=(65535&i.gzhead.extra.length)-i.gzindex;for(;i.pending+n>i.pending_buf_size;){let s=i.pending_buf_size-i.pending;if(i.pending_buf.set(i.gzhead.extra.subarray(i.gzindex,i.gzindex+s),i.pending),i.pending=i.pending_buf_size,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex+=s,Lw(t),0!==i.pending)return i.last_flush=-1,vw;e=0,n-=s}let s=new Uint8Array(i.gzhead.extra);i.pending_buf.set(s.subarray(i.gzindex,i.gzindex+n),i.pending),i.pending+=n,i.gzhead.hcrc&&i.pending>e&&(t.adler=fw(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex=0}i.status=73}if(73===i.status){if(i.gzhead.name){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),i.gzindex=0}i.status=91}if(91===i.status){if(i.gzhead.comment){let e,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n)),Lw(t),0!==i.pending)return i.last_flush=-1,vw;n=0}e=i.gzindexn&&(t.adler=fw(t.adler,i.pending_buf,i.pending-n,n))}i.status=103}if(103===i.status){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size&&(Lw(t),0!==i.pending))return i.last_flush=-1,vw;Iw(i,255&t.adler),Iw(i,t.adler>>8&255),t.adler=0}if(i.status=Vw,Lw(t),0!==i.pending)return i.last_flush=-1,vw}if(0!==t.avail_in||0!==i.lookahead||e!==Ow&&i.status!==Mw){let n=0===i.level?Fw(i,e):i.strategy===Pw?((t,e)=>{let i;for(;;){if(0===t.lookahead&&(Gw(t),0===t.lookahead)){if(e===Ow)return 1;break}if(t.match_length=0,i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):i.strategy===Cw?((t,e)=>{let i,n,s,r;const o=t.window;for(;;){if(t.lookahead<=Tw){if(Gw(t),t.lookahead<=Tw&&e===Ow)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(s=t.strstart-1,n=o[s],n===o[++s]&&n===o[++s]&&n===o[++s])){r=t.strstart+Tw;do{}while(n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&n===o[++s]&&st.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(i=cw(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(i=cw(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),i&&(zw(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===bw?(zw(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zw(t,!1),0===t.strm.avail_out)?1:2})(i,e):tv[i.level].func(i,e);if(3!==n&&4!==n||(i.status=Mw),1===n||3===n)return 0===t.avail_out&&(i.last_flush=-1),vw;if(2===n&&(e===gw?uw(i):e!==ww&&(lw(i,0,0,!1),e===mw&&(Uw(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),Lw(t),0===t.avail_out))return i.last_flush=-1,vw}return e!==bw?vw:i.wrap<=0?yw:(2===i.wrap?(Iw(i,255&t.adler),Iw(i,t.adler>>8&255),Iw(i,t.adler>>16&255),Iw(i,t.adler>>24&255),Iw(i,255&t.total_in),Iw(i,t.total_in>>8&255),Iw(i,t.total_in>>16&255),Iw(i,t.total_in>>24&255)):(Bw(i,t.adler>>>16),Bw(i,65535&t.adler)),Lw(t),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?vw:yw)},bb.deflateEnd=t=>{if(iv(t))return Sw;const e=t.state.status;return t.state=null,e===Vw?Dw(t,xw):vw},bb.deflateSetDictionary=(t,e)=>{let i=e.length;if(iv(t))return Sw;const n=t.state,s=n.wrap;if(2===s||1===s&&n.status!==Ew||n.lookahead)return Sw;if(1===s&&(t.adler=dw(t.adler,e,i,0)),n.wrap=0,i>=n.w_size){0===s&&(Uw(n.head),n.strstart=0,n.block_start=0,n.insert=0);let t=new Uint8Array(n.w_size);t.set(e.subarray(i-n.w_size,i),0),e=t,i=n.w_size}const r=t.avail_in,o=t.next_in,a=t.input;for(t.avail_in=i,t.next_in=0,t.input=e,Gw(n);n.lookahead>=3;){let t=n.strstart,e=n.lookahead-2;do{n.ins_h=qw(n,n.ins_h,n.window[t+3-1]),n.prev[t&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=t,t++}while(--e);n.strstart=t,n.lookahead=2,Gw(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,t.next_in=o,t.input=a,t.avail_in=r,n.wrap=s,vw},bb.deflateInfo="pako deflate (from Nodeca project)";var ov={};const av=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);ov.assign=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const e in i)av(i,e)&&(t[e]=i[e])}}return t},ov.flattenChunks=t=>{let e=0;for(let i=0,n=t.length;i=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;cv[254]=cv[254]=1,lv.string2buf=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,i,n,s,r,o=t.length,a=0;for(s=0;s>>6,e[r++]=128|63&i):i<65536?(e[r++]=224|i>>>12,e[r++]=128|i>>>6&63,e[r++]=128|63&i):(e[r++]=240|i>>>18,e[r++]=128|i>>>12&63,e[r++]=128|i>>>6&63,e[r++]=128|63&i);return e};lv.buf2string=(t,e)=>{const i=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let n,s;const r=new Array(2*i);for(s=0,n=0;n4)r[s++]=65533,n+=o-1;else{for(e&=2===o?31:3===o?15:7;o>1&&n1?r[s++]=65533:e<65536?r[s++]=e:(e-=65536,r[s++]=55296|e>>10&1023,r[s++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&hv)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let i="";for(let n=0;n{(e=e||t.length)>t.length&&(e=t.length);let i=e-1;for(;i>=0&&128==(192&t[i]);)i--;return i<0||0===i?e:i+cv[t[i]]>e?i:e};var uv=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const dv=bb,fv=ov,pv=lv,Ov=rw,gv=uv,mv=Object.prototype.toString,{Z_NO_FLUSH:bv,Z_SYNC_FLUSH:wv,Z_FULL_FLUSH:vv,Z_FINISH:yv,Z_OK:Sv,Z_STREAM_END:xv,Z_DEFAULT_COMPRESSION:kv,Z_DEFAULT_STRATEGY:Qv,Z_DEFLATED:$v}=ow;function Pv(t){this.options=fv.assign({level:kv,method:$v,chunkSize:16384,windowBits:15,memLevel:8,strategy:Qv},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new gv,this.strm.avail_out=0;let i=dv.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(i!==Sv)throw new Error(Ov[i]);if(e.header&&dv.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?pv.string2buf(e.dictionary):"[object ArrayBuffer]"===mv.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,i=dv.deflateSetDictionary(this.strm,t),i!==Sv)throw new Error(Ov[i]);this._dict_set=!0}}function Cv(t,e){const i=new Pv(e);if(i.push(t,!0),i.err)throw i.msg||Ov[i.err];return i.result}Pv.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize;let s,r;if(this.ended)return!1;for(r=e===~~e?e:!0===e?yv:bv,"string"==typeof t?i.input=pv.string2buf(t):"[object ArrayBuffer]"===mv.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),(r===wv||r===vv)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(s=dv.deflate(i,r),s===xv)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),s=dv.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===Sv;if(0!==i.avail_out){if(r>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},Pv.prototype.onData=function(t){this.chunks.push(t)},Pv.prototype.onEnd=function(t){t===Sv&&(this.result=fv.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},mb.Deflate=Pv,mb.deflate=Cv,mb.deflateRaw=function(t,e){return(e=e||{}).raw=!0,Cv(t,e)},mb.gzip=function(t,e){return(e=e||{}).gzip=!0,Cv(t,e)},mb.constants=ow;var _v={},Xv={};const Zv=16209;const Av=15,Tv=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Rv=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Ev=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Vv=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Mv=(t,e,i,n,s,r,o,a)=>{const l=a.bits;let h,c,u,d,f,p,O=0,g=0,m=0,b=0,w=0,v=0,y=0,S=0,x=0,k=0,Q=null;const $=new Uint16Array(16),P=new Uint16Array(16);let C,_,X,Z=null;for(O=0;O<=Av;O++)$[O]=0;for(g=0;g=1&&0===$[b];b--);if(w>b&&(w=b),0===b)return s[r++]=20971520,s[r++]=20971520,a.bits=1,0;for(m=1;m0&&(0===t||1!==b))return-1;for(P[1]=0,O=1;O852||2===t&&x>592)return 1;for(;;){C=O-y,o[g]+1=p?(_=Z[o[g]-p],X=Q[o[g]-p]):(_=96,X=0),h=1<>y)+c]=C<<24|_<<16|X|0}while(0!==c);for(h=1<>=1;if(0!==h?(k&=h-1,k+=h):k=0,g++,0==--$[O]){if(O===b)break;O=e[i+o[g]]}if(O>w&&(k&d)!==u){for(0===y&&(y=w),f+=m,v=O-y,S=1<852||2===t&&x>592)return 1;u=k&d,s[u]=w<<24|v<<16|f-r|0}}return 0!==k&&(s[f+k]=O-y<<24|64<<16|0),a.bits=w,0};const Dv=iw,Wv=sw,Uv=function(t,e){let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,y,S,x,k,Q;const $=t.state;i=t.next_in,k=t.input,n=i+(t.avail_in-5),s=t.next_out,Q=t.output,r=s-(e-t.avail_out),o=s+(t.avail_out-257),a=$.dmax,l=$.wsize,h=$.whave,c=$.wnext,u=$.window,d=$.hold,f=$.bits,p=$.lencode,O=$.distcode,g=(1<<$.lenbits)-1,m=(1<<$.distbits)-1;t:do{f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,0===w)Q[s++]=65535&b;else{if(!(16&w)){if(0==(64&w)){b=p[(65535&b)+(d&(1<>>=w,f-=w),f<15&&(d+=k[i++]<>>24,d>>>=w,f-=w,w=b>>>16&255,!(16&w)){if(0==(64&w)){b=O[(65535&b)+(d&(1<a){t.msg="invalid distance too far back",$.mode=Zv;break t}if(d>>>=w,f-=w,w=s-r,y>w){if(w=y-w,w>h&&$.sane){t.msg="invalid distance too far back",$.mode=Zv;break t}if(S=0,x=u,0===c){if(S+=l-w,w2;)Q[s++]=x[S++],Q[s++]=x[S++],Q[s++]=x[S++],v-=3;v&&(Q[s++]=x[S++],v>1&&(Q[s++]=x[S++]))}else{S=s-y;do{Q[s++]=Q[S++],Q[s++]=Q[S++],Q[s++]=Q[S++],v-=3}while(v>2);v&&(Q[s++]=Q[S++],v>1&&(Q[s++]=Q[S++]))}break}}break}}while(i>3,i-=v,f-=v<<3,d&=(1<(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function hy(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const cy=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode16211?1:0},uy=t=>{if(cy(t))return Nv;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Kv,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,Iv},dy=t=>{if(cy(t))return Nv;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,uy(t)},fy=(t,e)=>{let i;if(cy(t))return Nv;const n=t.state;return e<0?(i=0,e=-e):(i=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?Nv:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=i,n.wbits=e,dy(t))},py=(t,e)=>{if(!t)return Nv;const i=new hy;t.state=i,i.strm=t,i.window=null,i.mode=Kv;const n=fy(t,e);return n!==Iv&&(t.state=null),n};let Oy,gy,my=!0;const by=t=>{if(my){Oy=new Int32Array(512),gy=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Yv(1,t.lens,0,288,Oy,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Yv(2,t.lens,0,32,gy,0,t.work,{bits:5}),my=!1}t.lencode=Oy,t.lenbits=9,t.distcode=gy,t.distbits=5},wy=(t,e,i,n)=>{let s;const r=t.state;return null===r.window&&(r.wsize=1<=r.wsize?(r.window.set(e.subarray(i-r.wsize,i),0),r.wnext=0,r.whave=r.wsize):(s=r.wsize-r.wnext,s>n&&(s=n),r.window.set(e.subarray(i-n,i-n+s),r.wnext),(n-=s)?(r.window.set(e.subarray(i-n,i),0),r.wnext=n,r.whave=r.wsize):(r.wnext+=s,r.wnext===r.wsize&&(r.wnext=0),r.whavepy(t,15),Xv.inflateInit2=py,Xv.inflate=(t,e)=>{let i,n,s,r,o,a,l,h,c,u,d,f,p,O,g,m,b,w,v,y,S,x,k=0;const Q=new Uint8Array(4);let $,P;const C=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(cy(t)||!t.output||!t.input&&0!==t.avail_in)return Nv;i=t.state,i.mode===ey&&(i.mode=iy),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,u=a,d=l,x=Iv;t:for(;;)switch(i.mode){case Kv:if(0===i.wrap){i.mode=iy;break}for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0),h=0,c=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",i.mode=ay;break}if((15&h)!==Jv){t.msg="unknown compression method",i.mode=ay;break}if(h>>>=4,c-=4,S=8+(15&h),0===i.wbits&&(i.wbits=S),S>15||S>i.wbits){t.msg="invalid window size",i.mode=ay;break}i.dmax=1<>8&1),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16182;case 16182:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>8&255,Q[2]=h>>>16&255,Q[3]=h>>>24&255,i.check=Wv(i.check,Q,4,0)),h=0,c=0,i.mode=16183;case 16183:for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>8),512&i.flags&&4&i.wrap&&(Q[0]=255&h,Q[1]=h>>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0,i.mode=16184;case 16184:if(1024&i.flags){for(;c<16;){if(0===a)break t;a--,h+=n[r++]<>>8&255,i.check=Wv(i.check,Q,2,0)),h=0,c=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(f=i.length,f>a&&(f=a),f&&(i.head&&(S=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(n.subarray(r,r+f),S)),512&i.flags&&4&i.wrap&&(i.check=Wv(i.check,n,f,r)),a-=f,r+=f,i.length-=f),i.length))break t;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===a)break t;f=0;do{S=n[r+f++],i.head&&S&&i.length<65536&&(i.head.name+=String.fromCharCode(S))}while(S&&f>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=ey;break;case 16189:for(;c<32;){if(0===a)break t;a--,h+=n[r++]<>>=7&c,c-=7&c,i.mode=oy;break}for(;c<3;){if(0===a)break t;a--,h+=n[r++]<>>=1,c-=1,3&h){case 0:i.mode=16193;break;case 1:if(by(i),i.mode=sy,e===zv){h>>>=2,c-=2;break t}break;case 2:i.mode=16196;break;case 3:t.msg="invalid block type",i.mode=ay}h>>>=2,c-=2;break;case 16193:for(h>>>=7&c,c-=7&c;c<32;){if(0===a)break t;a--,h+=n[r++]<>>16^65535)){t.msg="invalid stored block lengths",i.mode=ay;break}if(i.length=65535&h,h=0,c=0,i.mode=ny,e===zv)break t;case ny:i.mode=16195;case 16195:if(f=i.length,f){if(f>a&&(f=a),f>l&&(f=l),0===f)break t;s.set(n.subarray(r,r+f),o),a-=f,r+=f,l-=f,o+=f,i.length-=f;break}i.mode=ey;break;case 16196:for(;c<14;){if(0===a)break t;a--,h+=n[r++]<>>=5,c-=5,i.ndist=1+(31&h),h>>>=5,c-=5,i.ncode=4+(15&h),h>>>=4,c-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=ay;break}i.have=0,i.mode=16197;case 16197:for(;i.have>>=3,c-=3}for(;i.have<19;)i.lens[C[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,$={bits:i.lenbits},x=Yv(0,i.lens,0,19,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid code lengths set",i.mode=ay;break}i.have=0,i.mode=16198;case 16198:for(;i.have>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=g,c-=g,i.lens[i.have++]=b;else{if(16===b){for(P=g+2;c>>=g,c-=g,0===i.have){t.msg="invalid bit length repeat",i.mode=ay;break}S=i.lens[i.have-1],f=3+(3&h),h>>>=2,c-=2}else if(17===b){for(P=g+3;c>>=g,c-=g,S=0,f=3+(7&h),h>>>=3,c-=3}else{for(P=g+7;c>>=g,c-=g,S=0,f=11+(127&h),h>>>=7,c-=7}if(i.have+f>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=ay;break}for(;f--;)i.lens[i.have++]=S}}if(i.mode===ay)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=ay;break}if(i.lenbits=9,$={bits:i.lenbits},x=Yv(1,i.lens,0,i.nlen,i.lencode,0,i.work,$),i.lenbits=$.bits,x){t.msg="invalid literal/lengths set",i.mode=ay;break}if(i.distbits=6,i.distcode=i.distdyn,$={bits:i.distbits},x=Yv(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,$),i.distbits=$.bits,x){t.msg="invalid distances set",i.mode=ay;break}if(i.mode=sy,e===zv)break t;case sy:i.mode=ry;case ry:if(a>=6&&l>=258){t.next_out=o,t.avail_out=l,t.next_in=r,t.avail_in=a,i.hold=h,i.bits=c,Uv(t,d),o=t.next_out,s=t.output,l=t.avail_out,r=t.next_in,n=t.input,a=t.avail_in,h=i.hold,c=i.bits,i.mode===ey&&(i.back=-1);break}for(i.back=0;k=i.lencode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,i.length=b,0===m){i.mode=16205;break}if(32&m){i.back=-1,i.mode=ey;break}if(64&m){t.msg="invalid literal/length code",i.mode=ay;break}i.extra=15&m,i.mode=16201;case 16201:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;k=i.distcode[h&(1<>>24,m=k>>>16&255,b=65535&k,!(g<=c);){if(0===a)break t;a--,h+=n[r++]<>w)],g=k>>>24,m=k>>>16&255,b=65535&k,!(w+g<=c);){if(0===a)break t;a--,h+=n[r++]<>>=w,c-=w,i.back+=w}if(h>>>=g,c-=g,i.back+=g,64&m){t.msg="invalid distance code",i.mode=ay;break}i.offset=b,i.extra=15&m,i.mode=16203;case 16203:if(i.extra){for(P=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=ay;break}i.mode=16204;case 16204:if(0===l)break t;if(f=d-l,i.offset>f){if(f=i.offset-f,f>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=ay;break}f>i.wnext?(f-=i.wnext,p=i.wsize-f):p=i.wnext-f,f>i.length&&(f=i.length),O=i.window}else O=s,p=o-i.offset,f=i.length;f>l&&(f=l),l-=f,i.length-=f;do{s[o++]=O[p++]}while(--f);0===i.length&&(i.mode=ry);break;case 16205:if(0===l)break t;s[o++]=i.length,l--,i.mode=ry;break;case oy:if(i.wrap){for(;c<32;){if(0===a)break t;a--,h|=n[r++]<{if(cy(t))return Nv;let e=t.state;return e.window&&(e.window=null),t.state=null,Iv},Xv.inflateGetHeader=(t,e)=>{if(cy(t))return Nv;const i=t.state;return 0==(2&i.wrap)?Nv:(i.head=e,e.done=!1,Iv)},Xv.inflateSetDictionary=(t,e)=>{const i=e.length;let n,s,r;return cy(t)?Nv:(n=t.state,0!==n.wrap&&n.mode!==ty?Nv:n.mode===ty&&(s=1,s=Dv(s,e,i,0),s!==n.check)?Gv:(r=wy(t,e,i,i),r?(n.mode=16210,Fv):(n.havedict=1,Iv)))},Xv.inflateInfo="pako inflate (from Nodeca project)";const vy=Xv,yy=ov,Sy=lv,xy=rw,ky=uv,Qy=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},$y=Object.prototype.toString,{Z_NO_FLUSH:Py,Z_FINISH:Cy,Z_OK:_y,Z_STREAM_END:Xy,Z_NEED_DICT:Zy,Z_STREAM_ERROR:Ay,Z_DATA_ERROR:Ty,Z_MEM_ERROR:Ry}=ow;function Ey(t){this.options=yy.assign({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ky,this.strm.avail_out=0;let i=vy.inflateInit2(this.strm,e.windowBits);if(i!==_y)throw new Error(xy[i]);if(this.header=new Qy,vy.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=Sy.string2buf(e.dictionary):"[object ArrayBuffer]"===$y.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(i=vy.inflateSetDictionary(this.strm,e.dictionary),i!==_y)))throw new Error(xy[i])}function Vy(t,e){const i=new Ey(e);if(i.push(t),i.err)throw i.msg||xy[i.err];return i.result}Ey.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize,s=this.options.dictionary;let r,o,a;if(this.ended)return!1;for(o=e===~~e?e:!0===e?Cy:Py,"[object ArrayBuffer]"===$y.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),r=vy.inflate(i,o),r===Zy&&s&&(r=vy.inflateSetDictionary(i,s),r===_y?r=vy.inflate(i,o):r===Ty&&(r=Zy));i.avail_in>0&&r===Xy&&i.state.wrap>0&&0!==t[i.next_in];)vy.inflateReset(i),r=vy.inflate(i,o);switch(r){case Ay:case Ty:case Zy:case Ry:return this.onEnd(r),this.ended=!0,!1}if(a=i.avail_out,i.next_out&&(0===i.avail_out||r===Xy))if("string"===this.options.to){let t=Sy.utf8border(i.output,i.next_out),e=i.next_out-t,s=Sy.buf2string(i.output,t);i.next_out=e,i.avail_out=n-e,e&&i.output.set(i.output.subarray(t,t+e),0),this.onData(s)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(r!==_y||0!==a){if(r===Xy)return r=vy.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},Ey.prototype.onData=function(t){this.chunks.push(t)},Ey.prototype.onEnd=function(t){t===_y&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=yy.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},_v.Inflate=Ey,_v.inflate=Vy,_v.inflateRaw=function(t,e){return(e=e||{}).raw=!0,Vy(t,e)},_v.ungzip=Vy,_v.constants=ow;const{Deflate:My,deflate:Dy,deflateRaw:Wy,gzip:Uy}=mb,{Inflate:Yy,inflate:qy,inflateRaw:Ly,ungzip:zy}=_v,Iy=ow;gb.Deflate=My,gb.deflate=Dy,gb.deflateRaw=Wy,gb.gzip=Uy,gb.Inflate=Yy,gb.inflate=qy,gb.inflateRaw=Ly,gb.ungzip=zy,gb.constants=Iy;const By=gb;let jy={};var Ny;function Gy(t){return Ny=t,[tS]}jy.Util={},jy.Decode={},jy.Messages=[],jy.Log=function(t){jy.Messages.push(["I",t]),console.log("Mma.js INFO: ",t)},jy.Warn=function(t){jy.Messages.push(["W",t]),console.log("Mma.js WARNING: ",t)},jy.Fail=function(t){throw jy.Messages.push(["E",t]),"Mma.js ERROR: "+t},jy.Util.Base64Decode=function(t){for(var e=atob(t),i=e.length>>>0,n=new Uint8Array(i),s=0;s1&&0===t[0]&&jy.Fail("IntegerAP: input starts with 0: "+String(t)),this.nstring=t}else void 0===t?this.nstring=void 0:jy.Fail("Integer: invalid input: "+String(t))},jy.RealMP=function(t){"number"==typeof t?this.n=t:void 0===t?this.n=void 0:jy.Fail("RealMP: invalid input")},jy.RealAP=function(t){"string"==typeof t?(t.length>1&&0===t[0]&&jy.Fail("RealAP: input starts with 0: "+String(t)),this.nstring=t):void 0===t?this.nstring=void 0:jy.Fail("RealAP: invalid input: "+String(t))},jy.Symbol=function(t){"string"==typeof t?this.name=t:void 0===t?this.name=void 0:jy.Fail("Symbol: invalid input: "+String(t))},jy.String=function(t){"string"==typeof t?this.str=t:void 0===t?this.str=void 0:jy.Fail("String: invalid input: "+String(t))},jy.Expression=function(t,e){t instanceof jy.Symbol||jy.Fail("Expression: head must be an Mma.Symbol"),e instanceof Array||jy.Fail("Expression: parts must be an Array"),this.head=t,this.parts=e},jy.Decode.Int32=function(t,e){try{return new DataView(t.buffer).getInt32(e,!0)}catch(t){return 0}},jy.Decode.Float64=function(t,e){try{return new DataView(t.buffer).getFloat64(e,!0)}catch(t){return 0}},jy.Decode.String=function(t,e,i){return void 0===e&&(e=0),void 0===i&&(i=t.length),jy.Util.U8ArrayToString(t.slice(e,e+i))},jy.Decode.StringEntry=function(t,e){void 0===e&&(e=0);var i=jy.Decode.Int32(t,e);return{length:i,string:jy.Decode.String(t,e+4,i),bytesRead:i+4}},jy.Decode.Any=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=1/0);var n=e;for(var s=0,r=[];ee%2!=0?t:{...t,body:Lm(t.body,/\(\*\|\*\)/gm)})),Array.isArray(this.args[this.args.length-1].body)||(this.decorator=this.args.pop());const r=this.args;console.log("creating InstanceWidget");for(let t=0;t{e.viewState.state.config.eval()},update:e=>this.applyChanges(e,t,i),extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to&&!t.stringOnly)return i-2>=0?(o[i-2].editor.dispatch({selection:{anchor:o[i-2].editor.state.doc.length}}),o[i-2].editor.focus(),void(t.editorLastCursor=void 0)):(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0));t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to&&!t.stringOnly)return i+2=0)return r[t-2].body[i].editor.focus(),void(e.editorLastCursor=void 0)}},{key:"ArrowDown",run:function(e,n){if(t+2{},focus:()=>{},dispatch:()=>{},stringOnly:!0};const t=l.match(Fy);if(t){a.innerHTML=t[1];const e=jy.DecompressDecode(t[2]),i=jy.toArray(e.parts[0]),n=uuidv4();interpretate(i,{global:{call:n},element:a})}else a.innerHTML=l.slice(1,-1)}delete o[i].body,n.appendChild(a)}i.appendChild(n)}if(this.decorator){const t=jy.DecompressDecode(this.decorator.body.slice(2,-2)),e=jy.toArray(t.parts[0]);let n={global:{call:uuidv4(),EditorWidget:s},element:i};this.interpretated=interpretate(e,n)}}applyChanges(t,e,i){const n=this.args,s=this.args[e].body,r=this.visibleValue.argsPos,o=this.args[e].from;let a=t;0==i&&0==e&&(a="{{"+a),0==i&&0!=e&&(a="{"+a),i==s.length-1&&e==n.length-1&&(a+="}}"),i==s.length-1&&e!=n.length-1&&(a+="}");const l=s[i].length,h={from:r+o+s[i].from,to:r+o+s[i].from+l,insert:a},c=a.length-l;for(let t=i+1;t{s.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.args[0].body[0].editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.args[0].body[0].editor.focus();else{const t=this.DOMElement.EditorWidget.args,e=t[t.length-1].body[t[t.length-1].body.length-1].editor;e.dispatch({selection:{anchor:e.state.doc.length}}),e.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const Ky=(t,e)=>new Bm({tag:"GB",decoration:i=>ni.replace({widget:new Jy(i,t,e)})}),tS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=Ky(this.disposable,t).createDeco(t)}update(t){this.placeholder=Ky(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});function eS(t){return[rS]}let iS=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.span=i,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this,r=this.args[1].body.slice(3,-3),o=jy.DecompressDecode(r),a=jy.toArray(o.parts[0]);this.data=a;const l="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}));this.cuid=l;let h={call:l,EditorWidget:s},c={global:h,element:i};this.expression=a,this.env=c,this.interpretated=interpretate(a,c),this.interpretated.then((()=>{if(c.options?.Event){console.warn("Event listeners are enabled!"),s.events=c.options.Event;let t=c;if(h.stack){const e=Object.values(h.stack);e.length>0&&(console.log("Attaching first found instance..."),t=e[0].env)}interpretate(["MetaMarker","'"+l+"'"],t).then((()=>{server.kernel.emitt(s.events,'"'+l+'"',"Mounted")}))}}))}getDoc(){return this.args[0].body.slice(1,-1)}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+t+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length)),i[0].length=s.length,this.view.dispatch({changes:r})}applyOuterChanges(t){const e=this.visibleValue,i=t,n={from:e.pos,to:e.pos+e.length,insert:i};this.view.dispatch({changes:n})}update(t){if(!this.deactivated){if(t.str!=this.visibleValue.str){console.warn("Out of sync"),console.log("recreate..."),this.destroy();const e=this.span;return e.replaceChildren(),void this._construct(t,this.view,e)}this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}}destroy(t){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.events&&server.kernel.emitt(this.events,'"'+this.cuid+'"',"Destroy"),delete this.data}},nS=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");const e=this;let i=document.createElement("span");return i.classList.add("frontend-view"),i.EditorWidget=new iS(this.visibleValue,t,i),this.reference.push({destroy:()=>{e.destroy(i)}}),i}ignoreEvent(){return!0}destroy(t){console.log("destroy in general*"),t.EditorWidget.destroy()}};const sS=(t,e)=>new Bm({tag:"VB",decoration:i=>ni.replace({widget:new nS(i,t,e)})}),rS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=sS(this.disposable,t).createDeco(t)}update(t){this.placeholder=sS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var oS;function aS(t){return oS=t,[uS]}let lS=class{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.span=i,this.visibleValue=t,this.args=Lm(t.str,/\(\*,\*\)/gm);const s=this;this.epilog={offset:0,string:""},this.prolog={offset:0,string:""};const r=this.args[1].body.slice(3,-3),o=jy.DecompressDecode(r),a=jy.toArray(o.parts[0]);this.data=a;let l={global:{call:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)})),element:i,origin:s},element:i};this.env=l,interpretate(a,l).then((()=>{if(l.options?.Head&&(s.prolog.offset=l.options.Head.length+1,s.prolog.string=l.options.Head+"[",s.epilog.offset=1,s.epilog.string="]"),l.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=l.options.Event),l.options?.String){s.prolog.offset=1,s.prolog.string='"',s.epilog.offset=1,s.epilog.string='"',l.options?.HeadString&&(s.prolog.string=l.options.HeadString,s.prolog.offset=s.prolog.string.length),l.options?.TailString&&(s.epilog.string=l.options.TailString,s.epilog.offset=s.epilog.string.length),s.editor={destroy:()=>{console.log("Nothing to destroy, this is just a text field.")}};const t=document.createElement("span");return this.aa,t.onkeydown=function(t){13===t.keyCode&&t.preventDefault()},t.contentEditable="plaintext-only",t.innerText=s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),t.addEventListener("input",console.log),t.addEventListener("input",(()=>{console.log("Update"),console.log(t.innerText),this.applyChanges(t.innerText)})),l.global.element.appendChild(t),void(s.events&&server.kernel.emitt(s.events,"Null","Mounted"))}s.editor=oS({doc:s.args[0].body.slice(1+s.prolog.offset,-1-s.epilog.offset),parent:l.global.element,update:t=>this.applyChanges(t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,i){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return console.log(s.visibleValue.pos),e.dispatch({selection:{anchor:s.visibleValue.pos+s.visibleValue.length}}),e.focus(),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}}])]}),s.events&&server.kernel.emitt(s.events,"Null","Mounted")}))}applyChanges(t,e){const i=this.args,n=this.visibleValue.argsPos,s="("+this.prolog.string+t+this.epilog.string+")",r={from:n+i[0].from,to:n+i[0].from+i[0].length,insert:s};this.visibleValue.str=this.visibleValue.str.substring(0,i[0].from).concat(s,this.visibleValue.str.substring(i[0].from+i[0].length));const o=s.length-i[0].length;i[0].length=s.length,this.visibleValue.length=this.visibleValue.length+o,this.view.dispatch({changes:r})}update(t){if(this.visibleValue.str!=t.str)return console.warn("Out of sync"),console.log("recreating InstanceWidget"),this.destroy(),this.span.replaceChildren(),void this._construct(t,this.view,this.span);this.visibleValue.pos=t.pos,this.visibleValue.argsPos=t.argsPos}destroy(){if(console.warn("destroy Instance of Widget"),console.log(this),this.env.global.stack)for(const t of Object.values(this.env.global.stack))t.dispose();this.editor.destroy(),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}},hS=class extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return console.log("update widget DOM"),this.DOMElement=t,t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("subscript-tail"),e.EditorWidget=new lS(this.visibleValue,t,e,[]);const i=this;return this.reference.push({destroy:()=>{i.destroy(e)}}),this.DOMElement=e,e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;if(t.from-e.from>0)this.DOMElement.EditorWidget.editor.dispatch({selection:{anchor:0}}),this.DOMElement.EditorWidget.editor.focus();else{const t=this.DOMElement.EditorWidget.editor;t.dispatch({selection:{anchor:t.state.doc.length}}),t.focus()}return e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}};const cS=(t,e)=>new Bm({tag:"BB",decoration:i=>ni.replace({widget:new hS(i,t,e)})}),uS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=cS(this.disposable,t).createDeco(t)}update(t){this.placeholder=cS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});var dS;function fS(t){return dS=t,[mS]}class pS{constructor(t,e,i,n){return this._construct(t,e,i,n)}_construct(t,e,i,n){this.view=e,this.visibleValue=t,this.args=Lm(t.str,/\(\*\|\*\)/gm);const s=this,r=Array.from({length:Math.ceil((s.args.length-3)/2)},((t,e)=>2*e+1));s.indexes=r;const o=[];this.span=i,this.spans=o;for(let t=0;t{c.options?.Event&&(console.warn("Event listeners are enabled!"),s.events=c.options.Event),s.editors=r.map(((t,i)=>dS({doc:s.args[t].body,parent:o[i],update:e=>this.applyChanges(e,t),eval:()=>{e.viewState.state.config.eval()},extensions:[Ys.of([{key:"ArrowLeft",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return i>0?s.editors[i-1].focus():(e.dispatch({selection:{anchor:s.visibleValue.pos}}),e.focus()),void(t.editorLastCursor=void 0);t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,n){if(t?.editorLastCursor===t.state.selection.ranges[0].to)return it.destroy())),this.events&&server.kernel.emitt(this.events,"Null","Destroy"),delete this.data}}class OS extends ei{constructor(t,e,i){super(),this.view=i,this.visibleValue=t,this.reference=e}eq(t){return!1}updateDOM(t,e){return this.DOMElement=t,console.log("update widget DOM"),t.EditorWidget.update(this.visibleValue),!0}toDOM(t){console.log("Create a new one!");let e=document.createElement("span");e.classList.add("inline-flex"),e.EditorWidget=new pS(this.visibleValue,t,e,[]);const i=this;return this.DOMElement=e,this.reference.push({destroy:()=>{i.destroy(e)}}),e}skipPosition(t,e,i){if(e.from!=e.to||i)return t;const n=this.DOMElement.EditorWidget.editors;return t.from-e.from<0?(n[n.length-1].dispatch({selection:{anchor:n[n.length-1].state.doc.length}}),n[n.length-1].focus()):(n[0].dispatch({selection:{anchor:0}}),n[0].focus()),e}ignoreEvent(){return!0}destroy(t){t.EditorWidget.destroy()}}const gS=(t,e)=>new Bm({tag:"TB",decoration:i=>ni.replace({widget:new OS(i,t,e)})}),mS=_i.fromClass(class{constructor(t){this.disposable=[],this.placeholder=gS(this.disposable,t).createDeco(t)}update(t){this.placeholder=gS(this.disposable,t).updateDeco(t,this.placeholder)}destroy(){this.disposable.forEach((t=>{t.destroy()}))}},{decorations:t=>t.placeholder,provide:t=>Ts.atomicRanges.of((e=>{var i;return(null===(i=e.plugin(t))||void 0===i?void 0:i.placeholder)||ni.none}))});const bS=_i.fromClass(class{decorations=ni.none;constructor(t){this.view=t,this.recompute()}recompute(t){let e,i,n=[];for(let{from:t,to:e}of this.view.visibleRanges)this.getDecorationsFor(t,e,n);this.decorations=ni.set(n,!0),this.decorations=this.decorations.update({filter:(n,s)=>!(n>e&&s=e&&s.selection.main.head<=i)return!0;if(!n&&s.selection.main.head>e&&s.selection.main.headt.decorations});class wS extends ei{constructor(t,e){super(),this.rawValue=t,this.visibleValue=e}eq(t){return this.rawValue===t.rawValue}toDOM(){let t=document.createElement("div");t.classList.add("cell-type-widget");const e=this.rawValue.split(" "),i=e[0].split(".");if(console.log(i),t.classList.add("cell-type-"+i[1].trim()),t.innerText=e[0].trim(),e.length>1){const n=e.slice(1),s=document.createElement("span");return s.appendChild(t),n.forEach((t=>{const e=document.createElement("span");e.innerText=t,e.classList.add("cell-type-"+i[1].trim()+"-"+t.split("=")[0]),s.appendChild(e)})),s}return t}ignoreEvent(){return!1}}const vS=new F,yS=new F,SS=[],xS=Sl.define([{tag:Sa.meta,color:"var(--editor-key-meta)"},{tag:Sa.link,textDecoration:"underline"},{tag:Sa.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Sa.emphasis,fontStyle:"italic"},{tag:Sa.strong,fontWeight:"bold"},{tag:Sa.strikethrough,textDecoration:"line-through"},{tag:Sa.keyword,color:"var(--editor-key-keyword)"},{tag:[Sa.atom,Sa.bool,Sa.url,Sa.contentSeparator,Sa.labelName],color:"var(--editor-key-atom)"},{tag:[Sa.literal,Sa.inserted],color:"var(--editor-key-literal)"},{tag:[Sa.string,Sa.deleted],color:"var(--editor-key-string)"},{tag:[Sa.regexp,Sa.escape,Sa.special(Sa.string)],color:"var(--editor-key-escape)"},{tag:Sa.definition(Sa.variableName),color:"var(--editor-key-variable)"},{tag:Sa.local(Sa.variableName),color:"var(--editor-local-variable)"},{tag:[Sa.typeName,Sa.namespace],color:"var(--editor-key-type)"},{tag:Sa.className,color:"var(--editor-key-class)"},{tag:[Sa.special(Sa.variableName),Sa.macroName],color:"var(--editor-special-variable)"},{tag:Sa.definition(Sa.propertyName),color:"var(--editor-key-property)"},{tag:Sa.comment,color:"var(--editor-key-comment)"},{tag:Sa.invalid,color:"var(--editor-key-invalid)"}]),kS={data:[],extend:t=>{kS.data.push(...t),Qm.reBuild(kS.data)},replaceAll:t=>{kS.data=t,Qm.reBuild(kS.data)}},QS=Gl.define({name:"spreadsheet",startState:function(){return{stringType:null,stack:[]}},token:function(t,e){if(t){switch(0===e.stack.length&&('"'!=t.peek()&&"'"!=t.peek()||(e.stringType=t.peek(),t.next(),e.stack.unshift("string"))),e.stack[0]){case"string":for(;"string"===e.stack[0]&&!t.eol();)t.peek()===e.stringType?(t.next(),e.stack.shift()):"\\"===t.peek()?(t.next(),t.next()):t.match(/^.[^\\\"\']*/);return"string";case"characterClass":for(;"characterClass"===e.stack[0]&&!t.eol();)t.match(/^[^\]\\]+/)||t.match(/^\\./)||e.stack.shift();return"operator"}var i=t.peek();switch(i){case"[":return t.next(),e.stack.unshift("characterClass"),"bracket";case":":return t.next(),"operator";case"\\":return t.match(/\\[a-z]+/)?"string.special":(t.next(),"atom");case".":case",":case";":case"*":case"-":case"+":case"^":case"<":case"/":case"=":return t.next(),"atom";case"$":return t.next(),"builtin"}return t.match(/\d+/)?t.match(/^\w+/)?"error":"number":t.match(/^[a-zA-Z_]\w*/)?t.match(/(?=[\(.])/,!1)?"keyword":"variable":-1!=["[","]","(",")","{","}"].indexOf(i)?(t.next(),"bracket"):(t.eatSpace()||t.next(),null)}}}),$S=new RegExp(/^[\w]*\.[\w]+/);function PS(t){const e=$S.exec(t),i=Object.values(window.SupportedLanguages);for(let t=0;t{if(!t.docChanged)return null;let e=PS(t.newDoc.line(1).text);if(e.legacy){const i=t.startState.facet(Wa);if(i){if(i.name==e.name)return null}else if(t.startState.facet(CS)==e.name)return null;return console.log("switching... to "+e.name),{effects:vS.reconfigure(e.plugins)}}return e.name===t.startState.facet(Wa).name?null:(console.log("switching... to "+e.name),{effects:vS.reconfigure(e.plugins)})}));let XS,ZS=null;const AS=t=>{const e=t||XS;return e&&e.viewState?(console.log(),PS(e.state.doc.line(1).text).name):""},TS=t=>{const e=t||XS;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return!1;const n=i[0];return[n.from,n.to]},RS=t=>{const e=t||XS;return e&&e.viewState?e.state.doc.toString():""},ES=t=>{const e=t||XS;if(!e)return"";if(!e.viewState)return"";const i=e.viewState.state.selection.ranges;if(!i.length)return"";const n=i[0];return console.log("yoko"),console.log(n),console.log(e.state.doc.toString().slice(n.from,n.to)),console.log("processing"),e.state.doc.toString().slice(n.from,n.to)},VS=(t,e)=>{const i=e||XS;if(!i)return;if(!i.viewState)return;const n=i.viewState.state.selection.ranges;if(!n.length)return;const s=n[0];console.log("result"),console.log(t),i.dispatch({changes:{...s,insert:t}})},MS=()=>XS,DS=(t,e)=>{const i=e||XS;i&&i.viewState&&(console.log("result"),console.log(t),i.dispatch({changes:{from:0,to:i.viewState.state.doc.length,insert:t}}))};ZS=t=>{let e=new Ts({doc:t.doc,extensions:[Ys.of([{key:"Tab",run:function(t,e){return sd(t)}},{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,zS,Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(XS=e.view)}))],parent:t.parent});return e.viewState.state.config.eval=t.eval,e},ZS.state=t=>{let e=xt.create({doc:t.doc,extensions:[Ys.of([{key:"Tab",run:function(t,e){return sd(t)}},{key:"Enter",preventDefault:!0,run:function(t,e){return!0}}]),Ys.of([{key:"Shift-Enter",preventDefault:!0,run:function(e,i){return t.eval(),!0}}]),t.extensions||[],zd,zS,Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Ts.updateListener.of((e=>{e.docChanged&&t.update(e.state.doc.toString()),e.selectionSet&&(XS=e.view)}))]});return e.config.eval=t.eval,e};const WS=(t,e)=>{if(!t||e<=0)return[];const i=[];for(let n=0;n{if(console.log(e.dom.ocellref),XS=e,e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:DropEvent"]')}},file:(t,e,i,n,s)=>{if(e.dom.ocellref)if(s.length>5242880){const t=WS(s,5242880);t.forEach(((e,s)=>{server.emitt(i,`<|"Data"->"${e}", "Name"->"${n}", "Chunk"->${s+1}, "Chunks"->${t.length}|>`,"Chunk")}))}else server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},YS={transaction:(t,e,i,n)=>{if(console.log(e.dom.ocellref),e.dom.ocellref){const t=e.dom.ocellref.origin.channel;server._emitt(t,`<|"Channel"->"${i}", "Length"->${n}, "CellType"->"wl"|>`,'Forwarded["CM:PasteEvent"]')}},file:(t,e,i,n,s)=>{if(console.log(e.dom.ocellref),e.dom.ocellref)if(s.length>5242880){const t=WS(s,5242880);t.forEach(((e,s)=>{server.emitt(i,`<|"Data"->"${e}", "Name"->"${n}", "Chunk"->${s+1}, "Chunks"->${t.length}|>`,"Chunk")}))}else server.emitt(i,`<|"Data"->"${s}", "Name"->"${n}"|>`,"File")}},qS=[Qm.of(kS),jm(ZS),Km(ZS),rb(ZS),ub(ZS),Gy(ZS),eS(),aS(ZS),fS(ZS),Wl(),Xm,SS,Cm(US,YS)];let LS=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"}}),zS=Ts.theme({"&.cm-focused":{outline:"1px dashed var(--editor-outline)",background:"inherit"},".cm-line":{padding:0,"padding-left":"2px","align-items":"center"},".cm-activeLine":{"background-color":"transparent"},".cm-scroller":{"line-height":"inherit","overflow-x":"overlay","overflow-y":"overlay","align-items":"initial"},".cm-content":{padding:"0px 0"},".rainbow-bracket-red":{color:"var(--editor-bracket-1)"},".rainbow-bracket-orange":{color:"var(--editor-bracket-2)"},".rainbow-bracket-yellow":{color:"var(--editor-bracket-3)"},".rainbow-bracket-green":{color:"var(--editor-bracket-4)"},".rainbow-bracket-blue":{color:"var(--editor-bracket-5)"},".rainbow-bracket-indigo":{color:"var(--editor-bracket-6)"},".rainbow-bracket-violet":{color:"var(--editor-bracket-7)"},".rainbow-bracket-red > span":{color:"var(--editor-bracket-1-a)"},".rainbow-bracket-orange > span":{color:"var(--editor-bracket-2-a)"},".rainbow-bracket-yellow > span":{color:"var(--editor-bracket-3-a)"},".rainbow-bracket-green > span":{color:"var(--editor-bracket-4-a)"},".rainbow-bracket-blue > span":{color:"var(--editor-bracket-5-a)"},".rainbow-bracket-indigo > span":{color:"var(--editor-bracket-6-a)"},".rainbow-bracket-violet > span":{color:"var(--editor-bracket-7-a)"}}),IS=!1;const BS=[()=>vr(),()=>Sh(),()=>ir(),()=>dr(),()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xS,{fallback:!1}),()=>tu()],jS={},NS=[()=>vr(),()=>Sh(),()=>ir(),()=>dr(),t=>GS.of(t),()=>jS.gutter?function(t={}){return[eo.of(t),jr(),so]}():[],()=>nl(),()=>Wl(),()=>Ts.lineWrapping,()=>Yd(),()=>$l(xS,{fallback:!1}),()=>tu(),()=>bS,()=>function(t){return _i.fromClass(class{constructor(e){this.view=e,this.placeholder=ni.set([ni.widget({widget:new kr(t),side:1}).range(0)])}get decorations(){return this.view.state.doc.length?ni.none:this.placeholder}},{decorations:t=>t.decorations})}("Type WL Expression / .md / .js"),()=>xt.allowMultipleSelections.of(!0),(t,e)=>vS.of(e),()=>yS.of(xt.readOnly.of(!1)),()=>_S,()=>{return t?[ou.of(t),Yu]:Yu;var t},(t,e)=>Ys.of([{key:"Tab",run:function(t,e){const i=sd(t);return i||Rc(t)},shift:Ec},{key:"Backspace",run:function(e,i){if(0===e.state.doc.length)return t.origin.remove(),!0}},{key:"ArrowLeft",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowRight",run:function(t,e){t.editorLastCursor=t.state.selection.ranges[0].to}},{key:"ArrowUp",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus prev"),t.origin.focusPrev(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"ArrowDown",run:function(e,i){if(e?.editorLastCursor===e.state.selection.ranges[0].to)return console.log("focus next"),t.origin.focusNext(),void(e.editorLastCursor=void 0);e.editorLastCursor=e.state.selection.ranges[0].to}},{key:"Shift-Enter",preventDefault:!0,run:function(e,i){console.log(e.state.doc.toString()),t.origin.eval(e.state.doc.toString())}},...Vc,...Wh,...Ru]),(t,e)=>Ts.updateListener.of((e=>{e.docChanged&&t.origin.save(encodeURIComponent(e.state.doc.toString())),e.selectionSet&&(XS=e.view)})),()=>LS];const GS=E.define();function FS(t){return t.replace(/\\\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\\\:/g,""),16))})).replaceAll("\\:F74E","I").replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))}function HS(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(t=>(+t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+t/4).toString(16)))}core.ReadOnly=()=>"ReadOnly",core.EditorView=async(t,e)=>{let i=await interpretate(t[0],e);i=FS(i),console.log("UNICODE Disaster");const n=await core._getRules(t,e);let s=()=>{},r=()=>{},o=i;const a=[];n.ReadOnly&&a.push(xt.readOnly.of(!0)),"Selectable"in n&&(n.Selectable||a.push(xt.transactionFilter.of((t=>!1)))),n.ForceUpdate&&(e.local.forceUpdate=n.ForceUpdate),n.Event&&(r=t=>{o=t,console.log("editor view emitt data: "+t),server.kernel.emitt(n.Event,'"'+t.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Input")},s=()=>{server.kernel.emitt(n.Event,'"'+o.replaceAll('\\"','\\\\"').replaceAll('"','\\"')+'"',"Evaluate")}),e.local?e.local.editor=ZS({doc:i,parent:e.element,eval:s,update:r,extensions:a}):ZS({doc:i,parent:e.element,eval:s,update:r,extensions:a}),e.element.style.verticalAlign="inherit"},core.StripOnInput=async()=>{},core.EditorView.update=async(t,e)=>{if(!e.local.editor)return;const i=FS(await interpretate(t[0],e));console.log("editor view: dispatch"),e.local.forceUpdate,e.local.editor.dispatch({changes:{from:0,to:e.local.editor.state.doc.length,insert:i}})},core.EditorView.destroy=async(t,e)=>{await interpretate(t[0],e),e.local&&e.local.editor&&e.local.editor.destroy()},core.EditorView.virtual=!0,core.PreviewCell=(t,e)=>{},window.SupportedLanguages.push({check:t=>null===t,legacy:!0,plugins:qS,name:"mathematica"}),window.SupportedLanguages.push({check:t=>null!=t[0].match(/\w+\.(wl|wls)$/),plugins:qS,legacy:!0,name:"mathematica"}),window.SupportedCells.codemirror={view:class{origin={};editor={};trash=[];forceFocusNext(){IS=!0}focus(t){t>0?this.editor.dispatch({selection:{anchor:0}}):t<0&&this.editor.dispatch({selection:{anchor:this.editor.state.doc.length}}),this.editor.focus()}setContent(t){if(console.warn("content mutation!"),!this.editor.viewState)return;const e=this.editor;console.log("result"),console.log(t),this.editor.dispatch({changes:{from:0,to:e.viewState.state.doc.length,insert:t}})}addDisposable(t){this.trash.push(t)}dispose(){this.editor.destroy()}readOnly(t){this.editor.dispatch({effects:yS.reconfigure(xt.readOnly.of(t))})}constructor(t,e){this.origin=t;const i=this.origin,n=PS(e).plugins,s=this;this.origin.element.ocellref=s;const r=new Ts({doc:(o=e,o.replace(/\\:[\da-f]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\:/g,""),16))}))),extensions:NS.map((t=>t(s,n))),parent:this.origin.element});var o;return this.editor=r,this.editor.dom.ocellref=s,this.editor.viewState.state.config.eval=()=>{i.eval(this.editor.state.doc.toString())},IS&&r.focus(),IS=!1,this}},context:{EditorAutocomplete:kS,javascriptLanguage:qf,javascript:Nf,markdownLanguage:rm,markdown:function(t={}){let{codeLanguages:e,defaultCodeLanguage:i,addKeymap:n=!0,base:{parser:s}=sm}=t;if(!(s instanceof Zp))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let r,o=t.extensions?[t.extensions]:[],a=[dm.support];i instanceof Ua?(a.push(i.support),r=i.language):i&&(r=i);let l=e||r?(h=e,c=r,t=>{if(t&&h){let e=null;if(t=/\S*/.exec(t)[0],e="function"==typeof h?h(t):Ya.matchLanguageName(h,t,!0),e instanceof Ya)return e.support?e.support.language.parser:Ta.getSkippingParser(e.load());if(e)return e.parser}return c?c.parser:null}):void 0;var h,c;return o.push(function(t){let{codeParser:e,htmlParser:i}=t,n=Do(((t,n)=>{let s=t.type.id;if(!e||s!=Kf.CodeBlock&&s!=Kf.FencedCode){if(i&&(s==Kf.HTMLBlock||s==Kf.HTMLTag))return{parser:i,overlay:rO(t.node,t.from,t.to)}}else{let i="";if(s==Kf.FencedCode){let e=t.node.getChild(Kf.CodeInfo);e&&(i=n.read(e.from,e.to))}let r=e(i);if(r)return{parser:r,overlay:t=>t.type.id==Kf.CodeText}}return null}));return{wrap:n}}({codeParser:l,htmlParser:dm.language.parser})),n&&a.push(N.high(Ys.of(um))),new Ua(nm(s.configure(o)),a)},htmlLanguage:jg,html:Ng,cssLanguage:kg,css:Qg,EditorView:Ts,EditorState:xt,highlightSpecialChars:vr,syntaxHighlighting:$l,defaultHighlightStyle:xS,editorCustomTheme:LS,foldGutter:function(t={}){let e=Object.assign(Object.assign({},wl),t),i=new vl(e,!0),n=new vl(e,!1),s=_i.fromClass(class{constructor(t){this.from=t.viewport.from,this.markers=this.buildMarkers(t)}update(t){(t.docChanged||t.viewportChanged||t.startState.facet(Wa)!=t.state.facet(Wa)||t.startState.field(dl,!1)!=t.state.field(dl,!1)||Xa(t.startState)!=Xa(t.state)||e.foldingChanged(t))&&(this.markers=this.buildMarkers(t.view))}buildMarkers(t){let e=new Xt;for(let s of t.viewportLineBlocks){let r=fl(t.state,s.from,s.to)?n:ll(t.state,s.from,s.to)?i:null;r&&e.add(s.from,s.from,r)}return e.finish()}}),{domEventHandlers:r}=e;return[s,Ir({class:"cm-foldGutter",markers(t){var e;return(null===(e=t.plugin(s))||void 0===e?void 0:e.markers)||_t.empty},initialSpacer:()=>new vl(e,!1),domEventHandlers:Object.assign(Object.assign({},r),{click:(t,e,i)=>{if(r.click&&r.click(t,e,i))return!0;let n=fl(t.state,e.from,e.to);if(n)return t.dispatch({effects:ul.of(n)}),!0;let s=ll(t.state,e.from,e.to);return!!s&&(t.dispatch({effects:cl.of(s)}),!0)}})}),ml()]},Facet:E,Compartment:F,mathematicaPlugins:qS,legacyLangNameFacet:CS,DropPasteHandlers:Cm,EditorExtensionsMinimal:BS,EditorParameters:jS,EditorExtensions:NS,StateField:q,StateEffect:ut,Decoration:ni,Prec:N,EditorSelection:A,keymap:Ys,ViewPlugin:_i,WidgetType:ei,originFacet:GS,MatchDecorator:pr}},window.OfflineMode&&SS.push(xt.readOnly.of(!0)),core.CellView=async(t,e)=>{const i=await core._getRules(t,e);i.Display||(i.Display="codemirror");const n=await interpretate(t[0],e),s={element:e.element,uid:HS()};i.Style&&(e.element.style=i.Style),i.Class&&e.element.classList.add(...i.Class.split(" ")),i.ImageSize&&(Array.isArray(i.ImageSize)?(e.element.style.width=i.ImageSize[0]+"px",e.element.style.height=i.ImageSize[1]+"px"):e.element.style.width=i.ImageSize+"px"),new window.SupportedCells[i.Display].view(s,n)};const JS={};core.FrontEditorSelected=async(t,e)=>{console.log("check");const i=await interpretate(t[0],e),n=await core._getRules(t,e);let s;switch(n.Editor&&(s=JS[n.Editor],console.log("Editor"),console.log(n.Editor),console.log(s)),i){case"Get":return ES(s);case"Set":let i=await interpretate(t[1],e);VS(i,s);break;case"GetDoc":return RS(s);case"SetDoc":let n=await interpretate(t[1],e);DS(n,s);break;case"Cursor":return TS(s);case"Type":return AS(s);case"Editor":const r=HS();return JS[r]=MS(),r}};window.SupportedCells.shell={view:class{dispose(){}constructor(t,e){this.origin=t;const i=document.createElement("div");return i.classList.add(..."flex sc-b max-h-60 text-sm overflow-y-scroll".split(" ")),i.style.overflowAnchor="auto",i.style.flexDirection="column-reverse",i.innerText=e,this.origin.element.appendChild(i),this}}}; diff --git a/package.json b/package.json index 43cb173..cea660d 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wljs-editor", - "version": "1.2.8", + "version": "1.2.9", "description": "WLJS Code editor", "scripts": { "build": "node --max-old-space-size=8192 ./node_modules/.bin/rollup --config rollup.config.mjs", diff --git a/src/AutocompleteDefaults.wl b/src/AutocompleteDefaults.wl index 205aed8..45230e6 100644 --- a/src/AutocompleteDefaults.wl +++ b/src/AutocompleteDefaults.wl @@ -1,4 +1,6 @@ { + <|"label"->"StringTake", "type"->"keyword", "info"->"StringTake[str, n] takes n characters"|>, + <|"label"->"StringDrop", "type"->"keyword", "info"->"StringDrop[str, n] drop n characters"|>, <|"label"->"AnimatedImage", "type"->"keyword", "info"->"AnimatedImage[List[Image__]] produces an animated image from list of frames"|>, <|"label"->"ByteCount", "type"->"keyword", "info"->"ByteCount[expr] gives the number of bytes used internally by the Wolfram System"|>, <|"label"->"Sum", "type"->"keyword", "info"->"Sum[f,{i,imax}] evaluates the sum. Sum[f,{i,imax, di}] with a step di"|>, diff --git a/src/AutocompleteKernel.wl b/src/AutocompleteKernel.wl index 2c5c9b3..71c2425 100644 --- a/src/AutocompleteKernel.wl +++ b/src/AutocompleteKernel.wl @@ -3,7 +3,8 @@ BeginPackage["Notebook`Autocomplete`", { "JerryI`Misc`WLJS`Transport`", "JerryI`Misc`Events`", "JerryI`Misc`Events`Promise`", - "JerryI`Misc`Async`" + "JerryI`Misc`Async`", + "Notebook`Utils`Notifications`" }]; UIAutocompleteExtend; @@ -43,13 +44,15 @@ extend[set_] := shareDefinitions[#, set] &/@ clients; (* a bug with a first defined symbol $InterfaceEnvironment that causes shutdown (BUT THIS IS A STRING!!!). No idea why *) skip = -1; -blacklist = {"CodeParser`", "Notebook`Autocomplete`", "KirillBelov`LTP`JerryI`Events`","KirillBelov`CSockets`EventsExtension`","JerryI`Misc`WLJS`Transport`","KirillBelov`WebSocketHandler`","KirillBelov`TCPServer`","KirillBelov`LTP`","KirillBelov`Internal`","KirillBelov`CSockets`","HighlightingCompatibility`","System`","Global`"}; +blacklist = {"CodeParser`", "Notebook`Autocomplete`", "KirillBelov`LTP`JerryI`Events`","KirillBelov`CSockets`EventsExtension`","JerryI`Misc`WLJS`Transport`","KirillBelov`WebSocketHandler`","KirillBelov`TCPServer`","KirillBelov`LTP`","KirillBelov`Internal`","KirillBelov`CSockets`","HighlightingCompatibility`","System`","Global`", "Parallel`Developer`", "CUDACompileTools`"}; BuildVocabularAsync := With[{}, BuildVocabularAsync = Null; SessionSubmit[BuildVocabular]; ] +currentContextPath = $ContextPath; + BuildVocabular := With[{}, BuildVocabular = Null; @@ -59,6 +62,57 @@ BuildVocabular := With[{}, With[{r = Flatten[( ((*Echo[#]; *){#, Information[#, "Usage"]}) &/@ Names[#<>"*"] ) &/@ Complement[$ContextPath, blacklist], 1]}, definitions = Join[definitions, r] // DeleteDuplicates; ]; + + currentContextPath = $ContextPath; + + Internal`AddHandler["GetFileEvent", + If[checkContext[#], reBuildVocabulary]& + ]; +] + +checkContext[HoldComplete[s_String, Identity, Last]] := checkContext[s] +checkContext[s_String] := StringTake[s, -1] == "`" +checkContext[_] := False + +timer = Null; +lastTime = AbsoluteTime[]; + + + +reBuildVocabulary := With[{}, + lastTime = AbsoluteTime[]; + + If[timer === Null, + timer = SetInterval[With[{now = AbsoluteTime[]}, + If[now - lastTime > 4, + TaskRemove[timer]; + + With[{contexts = Complement[$ContextPath, currentContextPath]}, + currentContextPath = $ContextPath; + + If[Length[contexts] > 0, + Module[{old = definitions, spinner = Notify["Rebuilding vocabulary", "Topic"->"Autocomplete", "Type"->"Spinner"]}, + + With[{r = Flatten[( ((*Echo[#]; *){#, Information[#, "Usage"]}) &/@ Names[#<>"*"] ) &/@ Complement[contexts, blacklist], 1]}, + definitions = Join[definitions, r] // DeleteDuplicates; + ]; + + + + extend[Complement[definitions, old] ]; + Delete[spinner]; + timer = Null; + ]; + , + timer = Null; + ]; + + ]; + + + ] + ], 1000]; + ] ] StartTracking := ( diff --git a/src/BoxesWorkarounds.wl b/src/BoxesWorkarounds.wl index 5a88f4b..69904e9 100644 --- a/src/BoxesWorkarounds.wl +++ b/src/BoxesWorkarounds.wl @@ -631,7 +631,7 @@ BoxForm`ArrangeSummaryBox[head_, interpretation_, icon_, above_, hidden_, ___, O temporalStorage = interpretation; - With[{fakeEditor = EditorView[viewBox, "ReadOnly"->True]}, + With[{fakeEditor = EditorView[viewBox, "ReadOnly"->True, "Selectable"->False]}, RowBox[{"(*VB[*)", tempSymbol, "(*,*)(*", ToString[Compress[fakeEditor], InputForm ], "*)(*]VB*)"}] ] ] @@ -663,7 +663,7 @@ BoxForm`ArrangeSummaryBox[head_, interpretation_, icon_, above_, hidden_, ___, O temporalStorage = interpretation; - With[{fakeEditor = EditorView[viewBox, "ReadOnly"->True]}, + With[{fakeEditor = EditorView[viewBox, "ReadOnly"->True, "Selectable"->False]}, RowBox[{"(*VB[*)", tempSymbol, "(*,*)(*", ToString[Compress[fakeEditor], InputForm ], "*)(*]VB*)"}] ] ] diff --git a/src/Notifications.wl b/src/Notifications.wl index 8ac39d8..6b7523f 100644 --- a/src/Notifications.wl +++ b/src/Notifications.wl @@ -12,8 +12,26 @@ Begin["`Private`"] (*truncatedTemplate = ImportComponent[ FileNameJoin[{$InputFileName // DirectoryName // ParentDirectory, "templates", "truncated.wlx"}] ]; truncatedTemplate = truncatedTemplate["Data"->"``", "Size"->"``"];*) +spinners = <||>; + EventHandler[NotebookEditorChannel // EventClone, { + "CreateSpinner" -> Function[assoc, + With[{kernel = assoc["Kernel"], data= assoc["Data"], topic = assoc["Topic"], UId = assoc["UId"]}, + With[{spinner = Notifications`Spinner["Topic"->topic, "Body"->data]}, + spinners[UId] = spinner; + EventFire[kernel, spinner, True]; + ] + ] + ], + + "RemoveSpinner" -> Function[UId, + With[{s = spinners[UId]}, + Delete[s]; + spinners[UId] = .; + ] + ], + "CreateModal" -> Function[data, With[{promise = Promise[], backpromise = data["Promise"], modal = data["Modal"], kernel = Kernel`HashMap[ data["Kernel"] ], notebook = Notebook`HashMap[ data["Notebook"] ]}, With[{ diff --git a/src/NotificationsKernel.wl b/src/NotificationsKernel.wl index 43eaa6b..37b075f 100644 --- a/src/NotificationsKernel.wl +++ b/src/NotificationsKernel.wl @@ -29,7 +29,27 @@ Notify[template_String, args__?notRule, OptionsPattern[] ] := With[{ Notify[template_String, OptionsPattern[] ] := With[{ message = template }, - EventFire[Internal`Kernel`Stdout[ Internal`Kernel`Hash ], Notifications`NotificationMessage[OptionValue["Topic"] ], message]; + Switch[OptionValue["Type"], + "Spinner", + With[{p = Unique["spinner"], uid = CreateUUID[]}, + EventFire[Internal`Kernel`CommunicationChannel, "CreateSpinner", <| + "UId" -> uid, + "Kernel"->Internal`Kernel`Hash, + "Topic"->OptionValue["Topic"], + "Data"->message + |>]; + + p /: Delete[p] := (EventFire[Internal`Kernel`CommunicationChannel, "RemoveSpinner", uid ]; ClearAll[p]); + + p + ] + , + + _, + EventFire[Internal`Kernel`Stdout[ Internal`Kernel`Hash ], Notifications`NotificationMessage[OptionValue["Topic"] ], message]; + Null + ] + ] Notify[template_, OptionsPattern[] ] := With[{ @@ -61,7 +81,7 @@ Notify`CreateModal[name_String, data_Association, OptionsPattern[] ] := Module[{ Options[Notify`CreateModal] = {"Notebook" :> RemoteNotebook[ Global`$EvaluationContext["Notebook"] ] } -Options[Notify] = {"Topic" -> "Kernel"} +Options[Notify] = {"Topic" -> "Kernel", "Type"->"Message"} End[] EndPackage[] diff --git a/src/kernel.js b/src/kernel.js index 22e6ef8..80f26dd 100644 --- a/src/kernel.js +++ b/src/kernel.js @@ -826,6 +826,14 @@ class CodeMirrorCell { if (options.ReadOnly) { ext.push(EditorState.readOnly.of(true)) } + //console.warn(options); + if ('Selectable' in options) { + if (!options.Selectable) + ext.push(EditorState.transactionFilter.of((tr) => { + //console.log(tr); + return false; + })); + } if (options.ForceUpdate) { env.local.forceUpdate = options.ForceUpdate From cff01366a900f9adf0b80fb3ddab9ea01dbec156 Mon Sep 17 00:00:00 2001 From: Kirill Vasin Date: Fri, 29 Nov 2024 15:17:18 +0100 Subject: [PATCH 26/26] added settings item --- package.json | 2 +- src/Frontend.wl | 15 +++++++++--- templates/Settings.wlx | 54 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 4 deletions(-) create mode 100644 templates/Settings.wlx diff --git a/package.json b/package.json index cea660d..f8d25ed 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wljs-editor", - "version": "1.2.9", + "version": "1.3.0", "description": "WLJS Code editor", "scripts": { "build": "node --max-old-space-size=8192 ./node_modules/.bin/rollup --config rollup.config.mjs", diff --git a/src/Frontend.wl b/src/Frontend.wl index afcb36d..838af2b 100644 --- a/src/Frontend.wl +++ b/src/Frontend.wl @@ -7,8 +7,10 @@ BeginPackage["Notebook`Editor`", { "JerryI`Misc`Events`", "JerryI`WLX`", "JerryI`WLX`Importer`", + "JerryI`WLX`WebUI`", "JerryI`Misc`WLJS`Transport`", - "Notebook`Editor`FrontendObject`" + "Notebook`Editor`FrontendObject`", + "JerryI`Notebook`AppExtensions`" }] NotebookEditorChannel::usage = "used to transfer extra events" @@ -19,6 +21,11 @@ Begin["`Internal`"] truncatedTemplate = ImportComponent[ FileNameJoin[{$InputFileName // DirectoryName // ParentDirectory, "templates", "truncated.wlx"}] ]; truncatedTemplate = truncatedTemplate["Data"->"``", "Size"->"``"]; +AppExtensions`TemplateInjection["SettingsFooter"] = ImportComponent[ FileNameJoin[{$InputFileName // DirectoryName // ParentDirectory, "templates", "Settings.wlx"}] ]; + +{loadSettings, storeSettings} = ImportComponent["Frontend/Settings.wl"]; +settings = <||>; + NotebookEditorChannel = CreateUUID[]; rootFolder = $InputFileName // DirectoryName; @@ -102,11 +109,13 @@ evaluator = StandardEvaluator["Name" -> "Wolfram Evaluator", "InitKernel" -> in init[k_] := Module[{}, Print["Kernel init..."]; - With[{channel = NotebookEditorChannel, tt = truncatedTemplate}, + loadSettings[settings]; + + With[{channel = NotebookEditorChannel, tt = truncatedTemplate, charLim = Lookup[settings, "OutputCharactersLimit", 6000]}, Kernel`Init[k, Print["Init internal communication"]; Internal`Kernel`TruncatedOutputTemplate = tt; - Notebook`Editor`$OutputCharactersLimit = 5000; + Notebook`Editor`$OutputCharactersLimit = charLim; Internal`Kernel`CommunicationChannel = Internal`Kernel`Stdout[channel]; ]; ]; diff --git a/templates/Settings.wlx b/templates/Settings.wlx new file mode 100644 index 0000000..24f1028 --- /dev/null +++ b/templates/Settings.wlx @@ -0,0 +1,54 @@ + + + +parseInt[any_String] := ToExpression[any] +parseInt[any_] := any + + + +Component[OptionsPattern[]] := Module[{tempBuffer}, With[{ + update = CreateUUID[], + settings = OptionValue["Settings"], + log = OptionValue["Messager"], + onsave = OptionValue["OnSave"], + controller = CreateUUID[], + + initialValues = Join[<| + "OutputCharactersLimit" -> 6000 + |>, OptionValue["Settings"]] +}, + + EventHandler[controller, { + "Charlim" -> Function[value, + If[NumericQ[parseInt[value]], + onsave[<|"OutputCharactersLimit" -> parseInt[value]|>]; + EventFire[log, Notifications`NotificationMessage["Info"](*`*), "Restart of a Kernel required"]; + , + EventFire[Messager, Notifications`NotificationMessage["Warning"](*`*), "Not a valid number!"]; + ]; + ] + }]; + + With[{lim = initialValues["OutputCharactersLimit"]}, + +

  • +
    +

    Editor settings

    +

    +
    +
    + Output form +
    +

    Sets the maximum character limit for the output before the output cell is truncated.

    +
    + + + +
    +
    +
    +
  • + ] +]] + +Component \ No newline at end of file