var cm6=function(t){"use strict";class e{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,i){let s=[];return this.decompose(0,t,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(e,this.length,s,1),n.from(s,this.length-(e-t)+i.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,e=this.length){let i=[];return this.decompose(t,e,i,0),n.from(i,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 o(this),s=new o(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 o(this,t)}iterRange(t,e=this.length){return new l(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(t){if(0==t.length)throw new RangeError("A document must have at least one line");return 1!=t.length||t[0]?t.length<=32?new i(t):n.from(i.split(t,[])):e.empty}}class i extends e{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 h(n,o,i,r);n=o+1,i++}}decompose(t,e,n,o){let l=t<=0&&e>=this.length?this:new i(r(this.text,t,e),Math.min(e,this.length)-Math.max(0,t));if(1&o){let t=n.pop(),e=s(l.text,t.text.slice(),0,l.length);if(e.length<=32)n.push(new i(e,t.length+l.length));else{let t=e.length>>1;n.push(new i(e.slice(0,t)),new i(e.slice(t)))}}else n.push(l)}replace(t,e,o){if(!(o instanceof i))return super.replace(t,e,o);let l=s(this.text,s(o.text,r(this.text,0,t)),e),a=this.length+o.length-(e-t);return l.length<=32?new i(l,a):n.from(i.split(l,[]),a)}sliceString(t,e=this.length,i="\n"){let n="";for(let s=0,r=0;s<=e&&rt&&r&&(n+=i),ts&&(n+=o.slice(Math.max(0,t-s),e-s)),s=l+1}return n}flatten(t){for(let e of this.text)t.push(e)}scanIdentical(){return 0}static split(t,e){let n=[],s=-1;for(let r of t)n.push(r),s+=r.length+1,32==n.length&&(e.push(new i(n,s)),n=[],s=-1);return s>-1&&e.push(new i(n,s)),e}}class n extends e{constructor(t,e){super(),this.children=t,this.length=e,this.lines=0;for(let e of t)this.lines+=e.lines}lineInner(t,e,i,n){for(let s=0;;s++){let r=this.children[s],o=n+r.length,l=i+r.lines-1;if((e?l:o)>=t)return r.lineInner(t,e,i,n);n=o+1,i=l+1}}decompose(t,e,i,n){for(let s=0,r=0;r<=e&&s=r){let s=n&((r<=t?1:0)|(l>=e?2:0));r>=t&&l<=e&&!s?i.push(o):o.decompose(t-r,e-r,i,s)}r=l+1}}replace(t,e,i){if(i.lines=r&&e<=l){let a=o.replace(t-r,e-r,i),h=this.lines-o.lines+a.lines;if(a.lines>4&&a.lines>h>>6){let r=this.children.slice();return r[s]=a,new n(r,this.length-(e-t)+i.length)}return super.replace(r,l,a)}r=l+1}return super.replace(t,e,i)}sliceString(t,e=this.length,i="\n"){let n="";for(let s=0,r=0;st&&s&&(n+=i),tr&&(n+=o.sliceString(t-r,e-r,i)),r=l+1}return n}flatten(t){for(let e of this.children)e.flatten(t)}scanIdentical(t,e){if(!(t instanceof n))return 0;let i=0,[s,r,o,l]=e>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;s+=e,r+=e){if(s==o||r==l)return i;let n=this.children[s],a=t.children[r];if(n!=a)return i+n.scanIdentical(a,e);i+=n.length+1}}static from(t,e=t.reduce(((t,e)=>t+e.length+1),-1)){let s=0;for(let e of t)s+=e.lines;if(s<32){let n=[];for(let e of t)e.flatten(n);return new i(n,e)}let r=Math.max(32,s>>5),o=r<<1,l=r>>1,a=[],h=0,c=-1,u=[];function f(t){let e;if(t.lines>o&&t instanceof n)for(let e of t.children)f(e);else t.lines>l&&(h>l||!h)?(O(),a.push(t)):t instanceof i&&h&&(e=u[u.length-1])instanceof i&&t.lines+e.lines<=32?(h+=t.lines,c+=t.length+1,u[u.length-1]=new i(e.text.concat(t.text),e.length+1+t.length)):(h+t.lines>r&&O(),h+=t.lines,c+=t.length+1,u.push(t))}function O(){0!=h&&(a.push(1==u.length?u[0]:n.from(u,c)),c=-1,h=u.length=0)}for(let e of t)f(e);return O(),1==a.length?a[0]:new n(a,e)}}function s(t,e,i=0,n=1e9){for(let s=0,r=0,o=!0;r=i&&(a>n&&(l=l.slice(0,n-s)),s0?1:(t instanceof i?t.text.length:t.children.length)<<1]}nextInner(t,e){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,s=this.nodes[n],r=this.offsets[n],o=r>>1,l=s instanceof i?s.text.length:s.children.length;if(o==(e>0?l:0)){if(0==n)return this.done=!0,this.value="",this;e>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&r)==(e>0?0:1)){if(this.offsets[n]+=e,0==t)return this.lineBreak=!0,this.value="\n",this;t--}else if(s instanceof i){let i=s.text[o+(e<0?-1:0)];if(this.offsets[n]+=e,i.length>Math.max(0,t))return this.value=0==t?i:e>0?i.slice(t):i.slice(0,i.length-t),this;t-=i.length}else{let r=s.children[o+(e<0?-1:0)];t>r.length?(t-=r.length,this.offsets[n]+=e):(e<0&&this.offsets[n]--,this.nodes.push(r),this.offsets.push(e>0?1:(r instanceof i?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 l{constructor(t,e,i){this.value="",this.done=!1,this.cursor=new o(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&&(e.prototype[Symbol.iterator]=function(){return this.iter()},o.prototype[Symbol.iterator]=l.prototype[Symbol.iterator]=a.prototype[Symbol.iterator]=function(){return this});class h{constructor(t,e,i,n){this.from=t,this.to=e,this.number=i,this.text=n}get length(){return this.to-this.from}}let c="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,,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=127462&&t<=127487}function O(t,e,i=!0,n=!0){return(i?d:p)(t,e,n)}function d(t,e,i){if(e==t.length)return e;e&&m(t.charCodeAt(e))&&g(t.charCodeAt(e-1))&&e--;let n=Q(t,e);for(e+=S(n);e=0&&f(Q(t,n));)i++,n-=2;if(i%2==0)break;e+=2}}}return e}function p(t,e,i){for(;e>0;){let n=d(t,e-2,i);if(n=56320&&t<57344}function g(t){return t>=55296&&t<56320}function Q(t,e){let i=t.charCodeAt(e);if(!g(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return m(n)?n-56320+(i-55296<<10)+65536:i}function b(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function S(t){return t<65536?1:2}const y=/\r\n?|\n/;var w=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(w||(w={}));class v{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;et)return s+(t-n);s+=o}else{if(i!=w.Simple&&a>=t&&(i==w.TrackDel&&nt||i==w.TrackBefore&&nt))return null;if(a>t||a==t&&e<0&&!o)return t==n||e<0?s:s+l;s+=l}n=a}if(t>n)throw new RangeError(`Position ${t} is out of range for changeset of length ${n}`);return s}touchesRange(t,e=t){for(let i=0,n=0;i=0&&n<=e&&s>=t)return!(ne)||"cover";n=s}return!1}toString(){let t="";for(let e=0;e=0?":"+n:"")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some((t=>"number"!=typeof t)))throw new RangeError("Invalid JSON representation of ChangeDesc");return new v(t)}static create(t){return new v(t)}}class x extends v{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 T(this,((e,i,n,s,r)=>t=t.replace(n,n+(i-e),r)),!1),t}mapDesc(t,e=!1){return P(this,t,e,!0)}invert(t){let i=this.sections.slice(),n=[];for(let s=0,r=0;s=0){i[s]=l,i[s+1]=o;let a=s>>1;for(;n.length0&&$(i,e,s.text),s.forward(t),o+=t}let a=t[r++];for(;o>1].toJSON()))}return t}static of(t,i,n){let s=[],r=[],o=0,l=null;function a(t=!1){if(!t&&!s.length)return;ol||t<0||l>i)throw new RangeError(`Invalid change range ${t} to ${l} (in doc of length ${i})`);let u=c?"string"==typeof c?e.of(c.split(n||y)):c:e.empty,f=u.length;if(t==l&&0==f)return;to&&k(s,t-o,-1),k(s,l-t,f),$(r,s,u),o=l}}(t),a(!l),l}static empty(t){return new x(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");let i=[],n=[];for(let s=0;se&&"string"!=typeof t)))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==r.length)i.push(r[0],0);else{for(;n.length=0&&i<=0&&i==t[s+1]?t[s]+=e:0==e&&0==t[s]?t[s+1]+=i:n?(t[s]+=e,t[s+1]+=i):t.push(e,i)}function $(t,i,n){if(0==n.length)return;let s=i.length-2>>1;if(s>1])),!(n||l==t.sections.length||t.sections[l+1]<0);)a=t.sections[l++],h=t.sections[l++];i(r,c,o,u,f),r=c,o=u}}}function P(t,e,i,n=!1){let s=[],r=n?[]:null,o=new Z(t),l=new Z(e);for(let t=-1;;)if(-1==o.ins&&-1==l.ins){let t=Math.min(o.len,l.len);k(s,t,-1),o.forward(t),l.forward(t)}else if(l.ins>=0&&(o.ins<0||t==o.i||0==o.off&&(l.len=0&&t=0)){if(o.done&&l.done)return r?x.createSet(s,r):v.create(s);throw new Error("Mismatched change set lengths")}{let e=0,i=o.len;for(;i;)if(-1==l.ins){let t=Math.min(i,l.len);e+=t,i-=t,l.forward(t)}else{if(!(0==l.ins&&l.lene||o.ins>=0&&o.len>e)&&(t||n.length>i),r.forward2(e),o.forward(e)}}else k(n,0,o.ins,t),s&&$(s,n,o.text),o.next()}}class Z{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i>1;return i>=t.length?e.empty:t[i]}textBit(t){let{inserted:i}=this.set,n=this.i-2>>1;return n>=i.length&&!t?e.empty:i[n].slice(this.off,null==t?void 0:this.off+t)}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 A{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 A(i,n,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return R.range(t,e);let i=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return R.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 R.range(t.anchor,t.head)}static create(t,e,i){return new A(t,e,i)}}class R{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:R.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 R(t.ranges.map((t=>A.fromJSON(t))),t.main)}static single(t,e=t){return new R([R.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))}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?R.range(o,r):R.range(r,o))}}return new R(t,e)}}function X(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let U=0;class q{constructor(t,e,i,n,s){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=n,this.id=U++,this.default=t([]),this.extensions="function"==typeof s?s(this):s}static define(t={}){return new q(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 _([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new _(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new _(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 _{constructor(t,e,i,n){this.dependencies=t,this.facet=e,this.type=i,this.value=n,this.id=U++}dynamicSlot(t){var e;let i=this.value,n=this.facet.compareInput,s=this.id,r=t[s]>>1,o=2==this.type,l=!1,a=!1,h=[];for(let i of this.dependencies)"doc"==i?l=!0:"selection"==i?a=!0:0==(1&(null!==(e=t[i.id])&&void 0!==e?e:1))&&h.push(t[i.id]);return{create:t=>(t.values[r]=i(t),1),update(t,e){if(l&&e.docChanged||a&&(e.docChanged||e.selection)||D(t,h)){let e=i(t);if(o?!M(e,t.values[r],n):!n(e,t.values[r]))return t.values[r]=e,1}return 0},reconfigure:(t,e)=>{let l,a=e.config.address[s];if(null!=a){let s=tt(e,a);if(this.dependencies.every((i=>i instanceof q?e.facet(i)===t.facet(i):!(i instanceof E)||e.field(i,!1)==t.field(i,!1)))||(o?M(l=i(t),s,n):n(l=i(t),s)))return t.values[r]=s,0}else l=i(t);return t.values[r]=l,1}}}}function M(t,e,i){if(t.length!=e.length)return!1;for(let n=0;nt[e.id])),s=i.map((t=>t.type)),r=n.filter((t=>!(1&t))),o=t[e.id]>>1;function l(t){let i=[];for(let e=0;et===e),t);return t.provide&&(e.provides=t.provide(e)),e}create(t){let e=t.facet(W).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,W.of({field:this,create:t})]}get extension(){return this}}const G=4,B=3,z=2,N=1;function I(t){return e=>new Y(e,t)}const L={highest:I(0),high:I(N),default:I(z),low:I(B),lowest:I(G)};class Y{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 l=s.get(t);if(null!=l){if(l<=o)return;let e=n[l].indexOf(t);e>-1&&n[l].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 Y)r(t.inner,t.prec);else if(t instanceof E)n[o].push(t),t.provides&&r(t.provides,o);else if(t instanceof _)n[o].push(t),t.facet.extensions&&r(t.facet.extensions,z);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,z),n.reduce(((t,e)=>t.concat(e)))}(t,e,r))i instanceof E?n.push(i):(s[i.facet.id]||(s[i.facet.id]=[])).push(i);let o=Object.create(null),l=[],a=[];for(let t of n)o[t.id]=a.length<<1,a.push((e=>t.slot(e)));let h=null==i?void 0:i.config.facets;for(let t in s){let e=s[t],n=e[0].facet,r=h&&h[t]||[];if(e.every((t=>0==t.type)))if(o[n.id]=l.length<<1|1,V(r,e))l.push(i.facet(n));else{let t=n.combine(e.map((t=>t.value)));l.push(i&&n.compare(t,i.facet(n))?i.facet(n):t)}else{for(let t of e)0==t.type?(o[t.id]=l.length<<1|1,l.push(t.value)):(o[t.id]=a.length<<1,a.push((e=>t.dynamicSlot(e))));o[n.id]=a.length<<1,a.push((t=>j(t,n,e)))}}let c=a.map((t=>t(o)));return new J(t,r,c,o,l,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=q.define(),it=q.define({combine:t=>t.some((t=>t)),static:!0}),nt=q.define({combine:t=>t.length?t[0]:void 0,static:!0}),st=q.define(),rt=q.define(),ot=q.define(),lt=q.define({combine:t=>!!t.length&&t[0]});class at{constructor(t,e){this.type=t,this.value=e}static define(){return new ht}}class ht{of(t){return new at(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 ft{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&&X(i,e.newLength),s.some((t=>t.type==ft.time))||(this.annotations=s.concat(ft.time.of(Date.now())))}static create(t,e,i,n,s,r){return new ft(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(ft.userEvent);return!(!e||!(e==t||e.length>t.length&&e.slice(0,t.length)==t&&"."==e[t.length]))}}function Ot(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=dt(n,pt(e,r,t.changes.newLength),!0))}return n==t?t:ft.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:Ot(i,e))}if(!0!==i){let n,s;if(!1===i)s=t.changes.invertedDesc,n=x.empty(e.doc.length);else{let e=t.changes.filter(i);n=e.changes,s=e.filtered.mapDesc(e.changes).invertedDesc}t=ft.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 ft?s:Array.isArray(s)&&1==s.length&&s[0]instanceof ft?s[0]:mt(e,Qt(s),!1)}return t}(s):s)}ft.time=at.define(),ft.userEvent=at.define(),ft.addToHistory=at.define(),ft.remote=at.define();const gt=[];function Qt(t){return null==t?gt:Array.isArray(t)?t:[t]}var bt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(bt||(bt={}));const St=/[\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 wt(t){return e=>{if(!/\S/.test(e))return bt.Space;if(function(t){if(yt)return yt.test(t);for(let e=0;e"€"&&(i.toUpperCase()!=i.toLowerCase()||St.test(i)))return!0}return!1}(e))return bt.Word;for(let i=0;i-1)return bt.Word;return bt.Other}}class vt{constructor(t,e,i,n,s,r){this.config=t,this.doc=e,this.selection=i,this.values=n,this.status=t.statusTemplate.slice(),this.computeSlot=s,r&&(r._state=this);for(let t=0;ts.set(e,t))),i=null),s.set(e.value.compartment,e.value.extension)):e.is(ut.reconfigure)?(i=null,n=e.value):e.is(ut.appendConfig)&&(i=null,n=Qt(n).concat(e.value));if(i)e=t.startState.values.slice();else{i=J.resolve(n,s,this),e=new vt(i,this.doc,this.selection,i.dynamicSlots.map((()=>null)),((t,e)=>e.reconfigure(t,this)),null).values}new vt(i,t.newDoc,t.newSelection,e,((e,i)=>i.update(e,t)),t)}replaceSelection(t){return"string"==typeof t&&(t=this.toText(t)),this.changeByRange((e=>({changes:{from:e.from,to:e.to,insert:t},range:R.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=Qt(i.effects);for(let i=1;is.spec.fromJSON(r,t))))}return vt.create({doc:t.doc,selection:R.fromJSON(t.selection),extensions:e.extensions?n.concat([e.extensions]):n})}static create(t={}){let i=J.resolve(t.extensions||[],new Map),n=t.doc instanceof e?t.doc:e.of((t.doc||"").split(i.staticFacet(vt.lineSeparator)||y)),s=t.selection?t.selection instanceof R?t.selection:R.single(t.selection.anchor,t.selection.head):R.single(0);return X(s,n.length),i.staticFacet(it)||(s=s.asSingle()),new vt(i,n,s,i.dynamicSlots.map((()=>null)),((t,e)=>e.create(t)),null)}get tabSize(){return this.facet(vt.tabSize)}get lineBreak(){return this.facet(vt.lineSeparator)||"\n"}get readOnly(){return this.facet(lt)}phrase(t,...e){for(let e of this.facet(vt.phrases))if(Object.prototype.hasOwnProperty.call(e,t)){t=e[t];break}return e.length&&(t=t.replace(/\$(\$|\d*)/g,((t,i)=>{if("$"==i)return"$";let n=+(i||1);return!n||n>e.length?t:e[n-1]}))),t}languageDataAt(t,e,i=-1){let n=[];for(let s of this.facet(et))for(let r of s(this,e,i))Object.prototype.hasOwnProperty.call(r,t)&&n.push(r[t]);return n}charCategorizer(t){return wt(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=O(e,r,!1);if(s(e.slice(t,r))!=bt.Word)break;r=t}for(;ot.length?t[0]:4}),vt.lineSeparator=nt,vt.readOnly=lt,vt.phrases=q.define({compare(t,e){let i=Object.keys(t),n=Object.keys(e);return i.length==n.length&&i.every((i=>t[i]==e[i]))}}),vt.languageData=et,vt.changeFilter=st,vt.transactionFilter=rt,vt.transactionExtender=ot,F.reconfigure=ut.define();class kt{eq(t){return this==t}range(t,e=t){return $t.create(t,e,this)}}kt.prototype.startSide=kt.prototype.endSide=0,kt.prototype.point=!1,kt.prototype.mapMode=w.TrackDel;let $t=class{constructor(t,e,i){this.from=t,this.to=e,this.value=i}static create(t,e,i){return new $t(t,e,i)}};function Tt(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Pt{constructor(t,e,i,n){this.from=t,this.to=e,this.value=i,this.maxPoint=n}get length(){return this.to[this.to.length-1]}findIndex(t,e,i,n=0){let s=i?this.to:this.from;for(let r=n,o=s.length;;){if(r==o)return r;let n=r+o>>1,l=s[n]-t||(i?this.value[n].endSide:this.value[n].startSide)-e;if(n==r)return l>=0?r:o;l>=0?o=n:r=n+1}}between(t,e,i,n){for(let s=this.findIndex(e,-1e9,!0),r=this.findIndex(i,1e9,!1,s);sh||a==h&&c.startSide>0&&c.endSide<=0)continue;(h-a||c.endSide-c.startSide)<0||(r<0&&(r=a),c.point&&(o=Math.max(o,h-a)),i.push(c),n.push(a-r),s.push(h-r))}return{mapped:i.length?new Pt(n,s,i,o):null,pos:r}}}class Ct{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 Ct(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(Tt)),this.isEmpty)return e.length?Ct.of(e):this;let o=new Rt(this,null,-1).goto(0),l=0,a=[],h=new Zt;for(;o.value||l=0){let t=e[l++];h.addInner(t.from,t.to,t.value)||a.push(t)}else 1==o.rangeIndex&&o.chunkIndexthis.chunkEnd(o.chunkIndex)||so.to||s=s&&t<=s+r.length&&!1===r.between(s,t-s,e-s,i))return}this.nextLayer.between(t,e,i)}}iter(t=0){return Xt.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return Xt.from(t).goto(e)}static compare(t,e,i,n,s=-1){let r=t.filter((t=>t.maxPoint>0||!t.isEmpty&&t.maxPoint>=s)),o=e.filter((t=>t.maxPoint>0||!t.isEmpty&&t.maxPoint>=s)),l=At(r,o,i),a=new qt(r,l,s),h=new qt(o,l,s);i.iterGaps(((t,e,i)=>Vt(a,t,h,e,i,n))),i.empty&&0==i.length&&Vt(a,0,h,0,0,n)}static eq(t,e,i=0,n){null==n&&(n=999999999);let s=t.filter((t=>!t.isEmpty&&e.indexOf(t)<0)),r=e.filter((e=>!e.isEmpty&&t.indexOf(e)<0));if(s.length!=r.length)return!1;if(!s.length)return!0;let o=At(s,r),l=new qt(s,o,0).goto(i),a=new qt(r,o,0).goto(i);for(;;){if(l.to!=a.to||!_t(l.active,a.active)||l.point&&(!a.point||!l.point.eq(a.point)))return!1;if(l.to>n)return!0;l.next(),a.next()}}static spans(t,e,i,n,s=-1){let r=new qt(t,null,s).goto(e),o=e,l=r.openStart;for(;;){let t=Math.min(r.to,i);if(r.point){let i=r.activeForPoint(r.to),s=r.pointFromo&&(n.span(o,t,r.active,l),l=r.openEnd(t));if(r.to>i)return l+(r.point&&r.to>i?1:0);o=r.to,r.next()}}static of(t,e=!1){let i=new Zt;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(Tt);e=n}return t}(t):t)i.add(n.from,n.to,n.value);return i.finish()}}Ct.empty=new Ct([],[],null,-1),Ct.empty.nextLayer=Ct.empty;class Zt{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 Pt(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 Zt)).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(Ct.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;let e=Ct.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function At(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 Rt(r,e,i,s));return 1==n.length?n[0]:new Xt(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--)Ut(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--)Ut(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(),Ut(this.heap,0)}}}function Ut(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 qt{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=Xt.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){Mt(this.active,t),Mt(this.activeTo,t),Mt(this.activeRank,t),this.minActive=jt(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&&Mt(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,l=n,a=n-e;for(;;){let e=t.to+a-i.to||t.endSide-i.endSide,n=e<0?t.to+a:i.to,s=Math.min(n,o);if(t.point||i.point?t.point&&i.point&&(t.point==i.point||t.point.eq(i.point))&&_t(t.activeForPoint(t.to+a),i.activeForPoint(i.to))||r.comparePoint(l,s,t.point,i.point):s>l&&!_t(t.active,i.active)&&r.compareRange(l,s,t.active,i.active),n>o)break;l=n,e<=0&&t.next(),e>=0&&i.next()}}function _t(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 jt(t,e){let i=-1,n=1e9;for(let s=0;s=e)return n;if(n==t.length)break;s+=9==t.charCodeAt(n)?i-s%i:1,n=O(t,n)}return!0===n?-1:t.length}const Gt="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),Bt="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),zt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};class Nt{constructor(t,e){this.rules=[];let{finish:i}=e||{};function n(t){return/^@/.test(t)?[t]:t.split(/,\s*/)}function s(t,e,r,o){let l=[],a=/^@(\w+)\b/.exec(t[0]),h=a&&"keyframes"==a[1];if(a&&null==e)return r.push(t[0]+";");for(let i in e){let o=e[i];if(/&/.test(i))s(i.split(/,\s*/).map((e=>t.map((t=>e.replace(/&/,t))))).reduce(((t,e)=>t.concat(e))),o,r);else if(o&&"object"==typeof o){if(!a)throw new RangeError("The value of a property ("+i+") should be a primitive value.");s(n(i),o,l,h)}else null!=o&&l.push(i.replace(/_.*/,"").replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))+": "+o+";")}(l.length||h)&&r.push((!i||a||o?t:t.map(i)).join(", ")+" {"+l.join(" ")+"}")}for(let e in t)s(n(e),t[e],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let t=zt[Gt]||1;return zt[Gt]=t+1,"ͼ"+t.toString(36)}static mount(t,e){(t[Bt]||new Lt(t)).mount(Array.isArray(e)?e:[e])}}let It=null;class Lt{constructor(t){if(!t.head&&t.adoptedStyleSheets&&"undefined"!=typeof CSSStyleSheet){if(It)return t.adoptedStyleSheets=[It.sheet].concat(t.adoptedStyleSheets),t[Bt]=It;this.sheet=new CSSStyleSheet,t.adoptedStyleSheets=[this.sheet].concat(t.adoptedStyleSheets),It=this}else{this.styleTag=(t.ownerDocument||t).createElement("style");let e=t.head||t;e.insertBefore(this.styleTag,e.firstChild)}this.modules=[],t[Bt]=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:'"'},Ht="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent);"undefined"!=typeof navigator&&/Gecko\/\d+/.test(navigator.userAgent);for(var Jt="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Kt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),te=Jt||Ht&&+Ht[1]<57,ee=0;ee<10;ee++)Yt[48+ee]=Yt[96+ee]=String(ee);for(ee=1;ee<=24;ee++)Yt[ee+111]="F"+ee;for(ee=65;ee<=90;ee++)Yt[ee]=String.fromCharCode(ee+32),Ft[ee]=String.fromCharCode(ee);for(var ie in Yt)Ft.hasOwnProperty(ie)||(Ft[ie]=Yt[ie]);function ne(t){let e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection()}function se(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function re(t,e){if(!e.anchorNode)return!1;try{return se(t,e.anchorNode)}catch(t){return!1}}function oe(t){return 3==t.nodeType?Qe(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function le(t,e,i,n){return!!i&&(he(t,e,i,n,-1)||he(t,e,i,n,1))}function ae(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function he(t,e,i,n,s){for(;;){if(t==i&&e==n)return!0;if(e==(s<0?0:ce(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?ce(t):0}}}function ce(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}const ue={left:0,right:0,top:0,bottom:0};function fe(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function Oe(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}class de{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,me=null;function ge(t){if(t.setActive)return t.setActive();if(me)return t.focus(me);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==me?{get preventScroll(){return me={preventScroll:!0},!0}}:void 0),!me){me=!1;for(let t=0;te)return i.domBoundsAround(t,e,a);if(c>=t&&-1==n&&(n=l,s=a),a>e&&i.dom.parentNode==this.dom){r=l,o=h;break}h=c,a=c+i.breakAfter}return{from:s,to:o<0?i+this.length:o,startDOM:(n?this.children[n-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:r=0?this.children[r].dom:null}}markDirty(t=!1){this.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=we){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 $e(t,e,i,n,s,r,o,l,a){let{children:h}=t,c=h.length?h[e]:null,u=r.length?r[r.length-1]:null,f=u?u.breakAfter:o;if(!(e==n&&c&&!o&&!f&&r.length<2&&c.merge(i,s,r.length?u:null,0==i,l,a))){if(n0&&(!o&&r.length&&c.merge(i,c.length,r[0],!1,l,0)?c.breakAfter=r.shift().breakAfter:(i2);var De={mac:Me||/Mac/.test(Pe.platform),windows:/Win/.test(Pe.platform),linux:/Linux|X11/.test(Pe.platform),ie:Xe,ie_version:Ae?Ce.documentMode||6:Re?+Re[1]:Ze?+Ze[1]:0,gecko:Ue,gecko_version:Ue?+(/Firefox\/(\d+)/.exec(Pe.userAgent)||[0,0])[1]:0,chrome:!!qe,chrome_version:qe?+qe[1]:0,ios:Me,android:/Android\b/.test(Pe.userAgent),webkit:Ve,safari:_e,webkit_version:Ve?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Ce.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class je extends ve{constructor(t){super(),this.text=t}get length(){return this.text.length}createDOM(t){this.setDOM(t||document.createTextNode(this.text))}sync(t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(t){3==t.nodeType&&this.createDOM(t)}merge(t,e,i){return(!i||i instanceof je&&!(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 je(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 ye(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 Ee(this.dom,t,e)}}class We extends ve{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(Se(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){this.dom?4&this.dirty&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(t)}merge(t,e,i,n,s,r){return(!i||!(!(i instanceof We&&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 We(this.mark,e,r)}domAtPos(t){return Le(this,t)}coordsAt(t,e){return Fe(this,t,e)}}function Ee(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:l.length-1];return De.safari&&!o&&0==a.width&&(a=Array.prototype.find.call(l,(t=>t.width))||a),o?fe(a,o<0):a||null}class Ge extends ve{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||Ge)(t,e,i)}split(t){let e=Ge.create(this.widget,this.length-t,this.side);return this.length-=t,e}sync(){this.dom&&this.widget.updateDOM(this.dom)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(this.editorView)),this.dom.contentEditable="false")}getSide(){return this.side}merge(t,e,i,n,s,r){return!(i&&(!(i instanceof Ge&&this.widget.compare(i.widget))||t>0&&s<=0||e0?i.length-1:0;n=i[e],!(t>0?0==e:e==i.length-1||n.top0?-1:1);return this.length?n:fe(n,this.side>0)}get isEditable(){return!1}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class Be extends Ge{domAtPos(t){let{topView:e,text:i}=this.widget;return e?ze(t,0,e,i,((t,e)=>t.domAtPos(e)),(t=>new ye(i,Math.min(t,i.nodeValue.length)))):new ye(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?Ne(t,e,i,n):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,((t,e,i)=>t.coordsAt(e,i)),((t,e)=>Ee(n,t,e))):Ee(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){if(i instanceof We){for(let o=i.dom.firstChild;o;o=o.nextSibling){let i=ve.get(o);if(!i)return r(t,e);let l=se(o,n),a=i.length+(l?n.nodeValue.length:0);if(t=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 e.empty}}function Le(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 We&&s.length&&(n=s[s.length-1])instanceof We&&n.mark.eq(e.mark)?Ye(n,e.children[0],i-1):(s.push(e),e.setParent(t)),t.length+=e.length}function Fe(t,e,i){let n=null,s=-1,r=null,o=-1;!function t(e,i){for(let l=0,a=0;l=i&&(h.children.length?t(h,i-a):!r&&(c>i||a==c&&h.getSide()>0)?(r=h,o=i-a):(a0?3e8:-4e8:e>0?1e8:-1e8,new ri(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}=oi(t,n);e=(s?n?-3e8:-1:5e8)-1,i=1+(r?n?2e8:1:-6e8)}return new ri(t,e,i,n,t.widget||null,!0)}static line(t){return new si(t)}static set(t,e=!1){return Ct.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}ii.none=Ct.empty;class ni extends ii{constructor(t){let{start:e,end:i}=oi(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 ni&&this.tagName==t.tagName&&this.class==t.class&&Je(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)}}ni.prototype.point=!1;class si extends ii{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof si&&Je(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)}}si.prototype.mapMode=w.TrackBefore,si.prototype.point=!0;class ri extends ii{constructor(t,e,i,n,s,r){super(e,i,s,t),this.block=n,this.isReplace=r,this.mapMode=n?e<=0?w.TrackBefore:w.TrackAfter:w.TrackDel}get type(){return this.startSide=5}eq(t){return t instanceof ri&&(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 oi(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)}ri.prototype.point=!0;class ai extends ve{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 ai))return!1;this.dom||i.transferDOM(this)}return n&&this.setDeco(i?i.attrs:null),Te(this,t,e,i?i.children:[],s,r),!0}split(t){let e=new ai;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){Je(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){Ye(this,t,e)}addLineDeco(t){let e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=He(e,this.attrs||{})),i&&(this.attrs=He({class:i},this.attrs||{}))}domAtPos(t){return Le(this,t)}reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.dirty|=6)}sync(t){var e;this.dom?4&this.dirty&&(Se(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&&(Ke(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(t);let i=this.dom.lastChild;for(;i&&ve.get(i)instanceof We;)i=i.lastChild;if(!(i&&this.length&&("BR"==i.nodeName||0!=(null===(e=ve.get(i))||void 0===e?void 0:e.isEditable)||De.ios&&this.children.some((t=>t instanceof je))))){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=0;for(let e of this.children){if(!(e instanceof je)||/[^ -~]/.test(e.text))return null;let i=oe(e.dom);if(1!=i.length)return null;t+=i[0].width}return t?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:t/this.length}:null}coordsAt(t,e){return Fe(this,t,e)}become(t){return!1}get type(){return ei.Text}static find(t,e){for(let i=0,n=0;i=e){if(s instanceof ai)return s;if(r>e)break}n=r+s.breakAfter}return null}}class hi extends ve{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 hi&&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,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(ui(new je(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 ri){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 ri)if(i.block){let{type:t}=i;t!=ei.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new hi(i.widget||new fi("div"),o,t))}else{let r=Ge.create(i.widget||new fi("span"),o,o?0:i.startSide),l=this.atCursorPos&&!r.isEditable&&s<=n.length&&(t0),a=!r.isEditable&&(tt.some((t=>t))}),Si=q.define({combine:t=>t.some((t=>t))});class yi{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 yi(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin)}}const wi=ut.define({map:(t,e)=>t.map(e)});function vi(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 xi=q.define({combine:t=>!t.length||t[0]});let ki=0;const $i=q.define();class Ti{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 Ti(ki++,t,i,(t=>{let e=[$i.of(t)];return s&&e.push(Ai.of((e=>{let i=e.plugin(t);return i?s(i):ii.none}))),n&&e.push(n(t)),e}))}static fromClass(t,e){return Ti.define((e=>new t(e)),e)}}class Pi{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(vi(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){vi(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){vi(t.state,e,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Ci=q.define(),Zi=q.define(),Ai=q.define(),Ri=q.define(),Xi=q.define(),Ui=q.define();class qi{constructor(t,e,i,n){this.fromA=t,this.toA=e,this.fromB=i,this.toB=n}join(t){return new qi(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let e=t.length,i=this;for(;e>0;e--){let n=t[e-1];if(!(n.fromA>i.toA)){if(n.toAh)break;s+=2}if(!l)return i;new qi(l.fromA,l.toA,l.fromB,l.toB).addToSet(i),r=l.toA,o=l.toB}}}class Vi{constructor(t,e,i){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=x.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 qi(t,e,i,s)))),this.changedRanges=n;let s=t.hasFocus;s!=t.inputState.notifiedFocused&&(t.inputState.notifiedFocused=s,this.flags|=1)}static create(t,e,i){return new Vi(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 _i=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(_i||(_i={}));const Mi=_i.LTR,Di=_i.RTL;function ji(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 Ii=[];function Li(t){return[new Ni(0,t,0)]}let Yi="";function Fi(t,e,i,n,s){var r;let o=n.head-t.from,l=-1;if(0==o){if(!s||!t.length)return null;e[0].level!=i&&(o=e[0].side(!1,i),l=0)}else if(o==t.length){if(s)return null;let t=e[e.length-1];t.level!=i&&(o=t.side(!0,i),l=e.length-1)}l<0&&(l=Ni.find(e,o,null!==(r=n.bidiLevel)&&void 0!==r?r:-1,n.assoc));let a=e[l];o==a.side(s,i)&&(a=e[l+=s?1:-1],o=a.side(!s,i));let h=s==(a.dir==i),c=O(t.text,o,h);if(Yi=t.text.slice(Math.min(o,c),Math.max(o,c)),c!=a.side(s,i))return R.cursor(c+t.from,h?-1:1,a.level);let u=l==(s?e.length-1:0)?null:e[l+(s?1:-1)];return u||a.level==i?u&&u.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=ve.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 Ki(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}class tn{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class en extends ve{constructor(t){super(),this.view=t,this.compositionDeco=ii.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 ai],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new qi(0,0,0,t.state.doc.length)],0)}get editorView(){return this.view}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=ii.none:(t.transactions.length||this.dirty)&&(this.compositionDeco=function(t,e){let i=sn(t);if(!i)return ii.none;let{from:n,to:s,node:r,text:o}=i,l=e.mapPos(n,1),a=Math.max(l,e.mapPos(s,-1)),{state:h}=t,c=3==r.nodeType?r.nodeValue:new Ji([],h).readRange(r.firstChild,null).text;if(a-l{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(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:l}=n,{content:a,breakAtStart:h,openStart:c,openEnd:u}=ci.build(this.view.state.doc,o,l,this.decorations,this.dynamicDecorationMap),{i:f,off:O}=i.findPos(r,1),{i:d,off:p}=i.findPos(s,-1);$e(this,d,p,f,O,a,h,c,u)}}updateSelection(t=!1,e=!1){if(!t&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange(),!e&&!this.mayControlSelection())return;let i=this.forceSelection;this.forceSelection=!1;let n=this.view.state.selection.main,s=this.domAtPos(n.anchor),r=n.empty?s:this.domAtPos(n.head);if(De.gecko&&n.empty&&(1==(o=s).node.nodeType&&o.node.firstChild&&(0==o.offset||"false"==o.node.childNodes[o.offset-1].contentEditable)&&(o.offset==o.node.childNodes.length||"false"==o.node.childNodes[o.offset].contentEditable))){let t=document.createTextNode("");this.view.observer.ignore((()=>s.node.insertBefore(t,s.node.childNodes[s.offset]||null))),s=r=new ye(t,0),i=!0}var o;let l=this.view.observer.selectionRange;!i&&l.focusNode&&le(s.node,s.offset,l.anchorNode,l.anchorOffset)&&le(r.node,r.offset,l.focusNode,l.focusOffset)||(this.view.observer.ignore((()=>{De.android&&De.chrome&&this.dom.contains(l.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}(l.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let t=ne(this.view.root);if(t)if(n.empty){if(De.gecko){let t=(e=s.node,i=s.offset,1!=e.nodeType?0:(i&&"false"==e.childNodes[i-1].contentEditable?1:0)|(in.head&&([s,r]=[r,s]),e.setEnd(r.node,r.offset),e.setStart(s.node,s.offset),t.removeAllRanges(),t.addRange(e)}else;var e,i})),this.view.observer.setSelectionRange(s,r)),this.impreciseAnchor=s.precise?null:new ye(l.anchorNode,l.anchorOffset),this.impreciseHead=r.precise?null:new ye(l.focusNode,l.focusOffset)}enforceCursorAssoc(){if(this.compositionDeco.size)return;let{view:t}=this,e=t.state.selection.main,i=ne(t.root),{anchorNode:n,anchorOffset:s}=t.observer.selectionRange;if(!(i&&e.empty&&e.assoc&&i.modify))return;let r=ai.find(this,e.head);if(!r)return;let o=r.posAtStart;if(e.head==o||e.head==o+r.length)return;let l=this.coordsAt(e.head,-1),a=this.coordsAt(e.head,1);if(!l||!a||l.bottom>a.top)return;let h=this.domAtPos(e.head+e.assoc);i.collapse(h.node,h.offset),i.modify("move",e.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let c=t.observer.selectionRange;t.docView.posFromDOM(c.anchorNode,c.anchorOffset)!=e.from&&i.collapse(n,s)}mayControlSelection(){let t=this.view.root.activeElement;return t==this.dom||re(this.dom,this.view.observer.selectionRange)&&!(t&&this.dom.contains(t))}nearest(t){for(let e=t;e;){let t=ve.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!=ei.WidgetBefore&&s.type!=ei.WidgetAfter&&(!n||2==e||this.children[n-1].breakAfter||this.children[n-1].type==ei.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,l=this.view.textDirection==_i.LTR;for(let t=0,a=0;an)break;if(t>=i){let i=h.dom.getBoundingClientRect();if(e.push(i.height),r){let e=h.dom.lastChild,n=e?oe(e):[];if(n.length){let e=n[n.length-1],r=l?e.right-i.left:i.right-e.left;r>o&&(o=r,this.minWidth=s,this.minWidthFrom=t,this.minWidthTo=c)}}}t=c+h.breakAfter}return e}textDirectionAt(t){let{i:e}=this.childPos(t,1);return"rtl"==getComputedStyle(this.children[e].dom).direction?_i.RTL:_i.LTR}measureTextSize(){for(let t of this.children)if(t instanceof ai){let e=t.measureTextSize();if(e)return e}let t,e,i=document.createElement("div");return i.className="cm-line",i.style.width="99999px",i.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(i);let n=oe(i.firstChild)[0];t=i.getBoundingClientRect().height,e=n?n.width/27:7,i.remove()})),{lineHeight:t,charWidth:e}}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(ii.replace({widget:new nn(n),block:!0,inclusive:!0,isBlockGap:!0}).range(i,r))}if(!s)break;i=s.to+1}return ii.set(t)}updateDeco(){let t=this.view.state.facet(Ai).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,l=0;for(let t of this.view.state.facet(Xi).map((t=>t(this.view))))if(t){let{left:e,right:i,top:n,bottom:a}=t;null!=e&&(s=Math.max(s,e)),null!=i&&(r=Math.max(r,i)),null!=n&&(o=Math.max(o,n)),null!=a&&(l=Math.max(l,a))}let a={left:n.left-s,top:n.top-o,right:n.right+r,bottom:n.bottom+l};!function(t,e,i,n,s,r,o,l){let a=t.ownerDocument,h=a.defaultView||window;for(let c=t;c;)if(1==c.nodeType){let t,u=c==a.body;if(u)t=Oe(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 f=0,O=0;if("nearest"==s)e.top0&&e.bottom>t.bottom+O&&(O=e.bottom-t.bottom+O+o)):e.bottom>t.bottom&&(O=e.bottom-t.bottom+o,i<0&&e.top-O0&&e.right>t.right+f&&(f=e.right-t.right+f+r)):e.right>t.right&&(f=e.right-t.right+r,i<0&&e.left0&&i<=0)e=ce(t=t.childNodes[e-1]);else{if(!(1==t.nodeType&&e=0))return null;t=t.childNodes[e],e=0}}}class ln{constructor(){this.changes=[]}compareRange(t,e){li(t,e,this.changes)}comparePoint(t,e){li(t,e,this.changes)}}function an(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function hn(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function cn(t,e){return t.tope.top+1}function un(t,e){return et.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function On(t,e,i){let n,s,r,o,l,a,h,c,u=!1;for(let f=t.firstChild;f;f=f.nextSibling){let t=oe(f);for(let O=0;Om||o==m&&r>p)&&(n=f,s=d,r=p,o=m,u=!p||(p>0?O0)),0==p?i>d.bottom&&(!h||h.bottomd.top)&&(a=f,c=d):h&&cn(h,d)?h=fn(h,d.bottom):c&&cn(c,d)&&(c=un(c,d.top))}}if(h&&h.bottom>=i?(n=l,s=h):c&&c.top<=i&&(n=a,s=c),!n)return{node:t,offset:0};let f=Math.max(s.left,Math.min(s.right,e));return 3==n.nodeType?dn(n,f,i):u&&"false"!=n.contentEditable?On(n,f,i):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,n)+(e>=(s.left+s.right)/2?1:0)}}function dn(t,e,i){let n=t.nodeValue.length,s=-1,r=1e9,o=0;for(let l=0;li?h.top-i:i-h.bottom)-1;if(h.left-1<=e&&h.right+1>=e&&c=(h.left+h.right)/2,n=i;if(De.chrome||De.gecko){Qe(t,l).getBoundingClientRect().left==h.right&&(n=!i)}if(c<=0)return{node:t,offset:l+(n?1:0)};s=l+(n?1:0),r=c}}}return{node:t,offset:s>-1?s:o>0?t.nodeValue.length:0}}function pn(t,{x:e,y:i},n,s=-1){var r;let o,l=t.contentDOM.getBoundingClientRect(),a=l.top+t.viewState.paddingTop,{docHeight:h}=t.viewState,c=i-a;if(c<0)return 0;if(c>h)return t.state.doc.length;for(let e=t.defaultLineHeight/2,i=!1;o=t.elementAtHeight(c),o.type!=ei.Text;)for(;c=s>0?o.bottom+e:o.top-e,!(c>=0&&c<=h);){if(i)return n?null:0;i=!0,s=-s}i=a+c;let u=o.from;if(ut.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:n?null:mn(t,l,o,e,i);let f=t.dom.ownerDocument,O=t.root.elementFromPoint?t.root:f,d=O.elementFromPoint(e,i);d&&!t.contentDOM.contains(d)&&(d=null),d||(e=Math.max(l.left+1,Math.min(l.right-1,e)),d=O.elementFromPoint(e,i),d&&!t.contentDOM.contains(d)&&(d=null));let p,m=-1;if(d&&0!=(null===(r=t.docView.nearest(d))||void 0===r?void 0:r.isEditable))if(f.caretPositionFromPoint){let t=f.caretPositionFromPoint(e,i);t&&({offsetNode:p,offset:m}=t)}else if(f.caretRangeFromPoint){let n=f.caretRangeFromPoint(e,i);n&&(({startContainer:p,startOffset:m}=n),(!t.contentDOM.contains(p)||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 Qe(t,n-1,n).getBoundingClientRect().left>i}(p,m,e)||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():Qe(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return i-n.left>5}(p,m,e))&&(p=void 0))}if(!p||!t.docView.dom.contains(p)){let n=ai.find(t.docView,u);if(!n)return c>o.top+o.height/2?o.to:o.from;({node:p,offset:m}=On(n.dom,e,i))}return t.docView.posFromDOM(p,m)}function mn(t,e,i,n,s){let r=Math.round((n-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&i.height>1.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+Et(o,r,t.state.tabSize)}function gn(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=t.bidiSpans(s),o=t.textDirectionAt(s.from);for(let l=e,a=null;;){let e=Fi(s,r,o,l,i),h=Yi;if(!e){if(s.number==(i?t.state.doc.lines:1))return l;h="\n",s=t.state.doc.line(s.number+(i?1:-1)),r=t.bidiSpans(s),e=R.cursor(i?s.from:s.to)}if(a){if(!a(h))return l}else{if(!n)return e;a=n(h)}l=e}}function Qn(t,e,i){let n=t.state.facet(Ri).map((e=>e(t)));for(;;){let t=!1;for(let s of n)s.between(i.from-1,i.from+1,((n,s,r)=>{i.from>n&&i.fromi.from?R.cursor(n,1):R.cursor(s,-1),t=!0)}));if(!t)return i}}class bn{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.mouseSelection=null;for(let e in kn){let i=kn[e];t.contentDOM.addEventListener(e,(n=>{xn(t,n)&&!this.ignoreDuringComposition(n)&&("keydown"==e&&this.keydown(t,n)||(this.mustFlushObserver(n)&&t.observer.forceFlush(),this.runCustomHandlers(e,t,n)?n.preventDefault():i(t,n)))}),$n[e]),this.registeredEvents.push(e)}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=>{xn(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){vi(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){vi(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||yn.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&&Date.now()-this.compositionEndedAt<100)&&(this.compositionEndedAt=0,!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"}],yn="dthko",wn=[16,17,18,20,91,92,224,225];class vn{constructor(t,e,i,n){this.view=t,this.style=i,this.mustSelect=n,this.lastEvent=e;let s=t.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=e.shiftKey,this.multiple=t.state.facet(vt.allowMultipleSelections)&&function(t,e){let i=t.state.facet(Oi);return i.length?i[0](e):De.mac?e.metaKey:e.ctrlKey}(t,e),this.dragMove=function(t,e){let i=t.state.facet(di);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=ne(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!=Mn(e))&&null,!1===this.dragging&&(e.preventDefault(),this.select(e))}move(t){if(0==t.buttons)return this.destroy();!1===this.dragging&&this.select(this.lastEvent=t)}up(t){null==this.dragging&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=null}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",scrollIntoView:!0}),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 xn(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=ve.get(n))&&i.ignoreEvent(e))return!1;return!0}const kn=Object.create(null),$n=Object.create(null),Tn=De.ie&&De.ie_version<15||De.ios&&De.webkit_version<604;function Pn(t,e){let i,{state:n}=t,s=1,r=n.toText(e),o=r.lines==n.selection.ranges.length;if(null!=jn&&n.selection.ranges.every((t=>t.empty))&&jn==r.toString()){let t=-1;i=n.changeByRange((i=>{let l=n.doc.lineAt(i.from);if(l.from==t)return{range:i};t=l.from;let a=n.toText((o?r.line(s++).text:e)+n.lineBreak);return{changes:{from:l.from,insert:a},range:R.cursor(i.from+a.length)}}))}else i=o?n.changeByRange((t=>{let e=r.line(s++);return{changes:{from:t.from,to:t.to,insert:e.text},range:R.cursor(t.from+e.length)}})):n.replaceSelection(r);t.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}function Cn(t,e,i,n){if(1==n)return R.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 R.cursor(e);0==r?i=1:r==s.length&&(i=-1);let o=r,l=r;i<0?o=O(s.text,r,!1):l=O(s.text,r);let a=n(s.text.slice(o,l));for(;o>0;){let t=O(s.text,o,!1);if(n(s.text.slice(t,o))!=a)break;o=t}for(;l{t.inputState.setSelectionOrigin("select"),27==e.keyCode?t.inputState.lastEscPress=Date.now():wn.indexOf(e.keyCode)<0&&(t.inputState.lastEscPress=0)},kn.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},kn.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},$n.touchstart=$n.touchmove={passive:!0},kn.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return;let i=null;for(let n of t.state.facet(pi))if(i=n(t,e),i)break;if(i||0!=e.button||(i=function(t,e){let i=Xn(t,e),n=Mn(e),s=t.state.selection,r=i,o=e;return{update(t){t.docChanged&&(i.pos=t.changes.mapPos(i.pos),s=s.map(t.changes),o=null)},get(e,l,a){let h;o&&e.clientX==o.clientX&&e.clientY==o.clientY?h=r:(h=r=Xn(t,e),o=e);let c=Cn(t,h.pos,h.bias,n);if(i.pos!=h.pos&&!l){let e=Cn(t,i.pos,i.bias,n),s=Math.min(e.from,c.from),r=Math.max(e.to,c.to);c=s1&&s.ranges.some((t=>t.eq(c)))?function(t,e){for(let i=0;;i++)if(t.ranges[i].eq(e))return R.create(t.ranges.slice(0,i).concat(t.ranges.slice(i+1)),t.mainIndex==i?0:t.mainIndex-(t.mainIndex>i?1:0))}(s,c):a?s.addRange(c):R.create([c])}}}(t,e)),i){let n=t.root.activeElement!=t.contentDOM;n&&t.observer.ignore((()=>ge(t.contentDOM))),t.inputState.startMouseSelection(new vn(t,e,i,n))}};let Zn=(t,e)=>t>=e.top&&t<=e.bottom,An=(t,e,i)=>Zn(e,i)&&t>=i.left&&t<=i.right;function Rn(t,e,i,n){let s=ai.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&&An(i,n,o))return-1;let l=s.coordsAt(r,1);return l&&An(i,n,l)?1:o&&Zn(n,o)?-1:1}function Xn(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:Rn(t,i,e.clientX,e.clientY)}}const Un=De.ie&&De.ie_version<=11;let qn=null,Vn=0,_n=0;function Mn(t){if(!Un)return t.detail;let e=qn,i=_n;return qn=t,_n=Date.now(),Vn=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Vn+1)%3:1}function Dn(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,l={from:s,insert:i},a=t.state.changes(o?[o,l]:l);t.focus(),t.dispatch({changes:a,selection:{anchor:a.mapPos(s,-1),head:a.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"})}kn.dragstart=(t,e)=>{let{selection:{main:i}}=t.state,{mouseSelection:n}=t.inputState;n&&(n.dragging=i),e.dataTransfer&&(e.dataTransfer.setData("Text",t.state.sliceDoc(i.from,i.to)),e.dataTransfer.effectAllowed="copyMove")},kn.drop=(t,e)=>{if(!e.dataTransfer)return;if(t.state.readOnly)return e.preventDefault();let i=e.dataTransfer.files;if(i&&i.length){e.preventDefault();let n=Array(i.length),s=0,r=()=>{++s==i.length&&Dn(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 Dn(t,e,e.dataTransfer.getData("Text"),!0)},kn.paste=(t,e)=>{if(t.state.readOnly)return e.preventDefault();t.observer.flush();let i=Tn?null:e.clipboardData;i?(Pn(t,i.getData("text/plain")),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(),Pn(t,i.value)}),50)}(t)};let jn=null;function Wn(t){setTimeout((()=>{t.hasFocus!=t.inputState.notifiedFocused&&t.update([])}),10)}kn.copy=kn.cut=(t,e)=>{let{text:i,ranges:n,linewise:s}=function(t){let e=[],i=[],n=!1;for(let n of t.selection.ranges)n.empty||(e.push(t.sliceDoc(n.from,n.to)),i.push(n));if(!e.length){let s=-1;for(let{from:n}of t.selection.ranges){let r=t.doc.lineAt(n);r.number>s&&(e.push(r.text),i.push({from:r.from,to:Math.min(t.doc.length,r.to+1)})),s=r.number}n=!0}return{text:e.join(t.lineBreak),ranges:i,linewise:n}}(t.state);if(!i&&!s)return;jn=s?i:null;let r=Tn?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"})},kn.focus=t=>{t.inputState.lastFocusTime=Date.now(),t.scrollDOM.scrollTop||!t.inputState.lastScrollTop&&!t.inputState.lastScrollLeft||(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),Wn(t)},kn.blur=t=>{t.observer.clearSelectionRange(),Wn(t)},kn.compositionstart=kn.compositionupdate=t=>{null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},kn.compositionend=t=>{t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionFirstChange=null,De.chrome&&De.android&&t.observer.flushSoon(),setTimeout((()=>{t.inputState.composing<0&&t.docView.compositionDeco.size&&t.update([])}),50)},kn.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},kn.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 En=["pre-wrap","normal","pre-line","break-spaces"];class Gn{constructor(t){this.lineWrapping=t,this.doc=e.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,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.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 En.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i-1,o=Math.round(e)!=Math.round(this.lineHeight)||this.lineWrapping!=r;if(this.lineWrapping=r,this.lineHeight=e,this.charWidth=i,this.lineLength=n,o){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)>In&&(t.heightChanged=!0),this.height=e)}replace(t,e,i){return Ln.of(i)}decomposeLeft(t,e){e.push(this)}decomposeRight(t,e){e.push(this)}applyChanges(t,e,i,n){let s=this;for(let r=n.length-1;r>=0;r--){let{fromA:o,toA:l,fromB:a,toB:h}=n[r],c=s.lineAt(o,Nn.ByPosNoHeight,e,0,0),u=c.to>=l?c:s.lineAt(l,Nn.ByPosNoHeight,e,0,0);for(h+=u.to-l,l=u.to;r>0&&c.from<=n[r-1].toA;)o=n[r-1].fromA,a=n[r-1].fromB,r--,o2*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 Fn extends Yn{constructor(t,e){super(t,e,ei.Text),this.collapsed=0,this.widgetHeight=0}replace(t,e,i){let n=i[0];return 1==i.length&&(n instanceof Fn||n instanceof Hn&&4&n.flags)&&Math.abs(this.length-n.length)<10?(n instanceof Hn?n=new Fn(n.length,this.height):n.height=this.height,this.outdated||(n.outdated=!1),n):Ln.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 Hn extends Ln{constructor(t){super(t,0)}lines(t,e){let i=t.lineAt(e).number,n=t.lineAt(e+this.length).number;return{firstLine:i,lastLine:n,lineHeight:this.height/(n-i+1)}}blockAt(t,e,i,n){let{firstLine:s,lastLine:r,lineHeight:o}=this.lines(e,n),l=Math.max(0,Math.min(r-s,Math.floor((t-i)/o))),{from:a,length:h}=e.line(s+l);return new zn(a,h,i+o*l,o,ei.Text)}lineAt(t,e,i,n,s){if(e==Nn.ByHeight)return this.blockAt(t,i,n,s);if(e==Nn.ByPosNoHeight){let{from:e,to:n}=i.lineAt(t);return new zn(e,n-e,0,0,ei.Text)}let{firstLine:r,lineHeight:o}=this.lines(i,s),{from:l,length:a,number:h}=i.lineAt(t);return new zn(l,a,n+o*(h-r),o,ei.Text)}forEachLine(t,e,i,n,s,r){let{firstLine:o,lineHeight:l}=this.lines(i,s);for(let a=Math.max(t,s),h=Math.min(s+this.length,e);a<=h;){let e=i.lineAt(a);a==t&&(n+=l*(e.number-o)),r(new zn(e.from,e.length,n,l,ei.Text)),n+=l,a=e.to+1}}replace(t,e,i){let n=this.length-e;if(n>0){let t=i[i.length-1];t instanceof Hn?i[i.length-1]=new Hn(t.length+n):i.push(null,new Hn(n-1))}if(t>0){let e=i[0];e instanceof Hn?i[0]=new Hn(t+e.length):i.unshift(new Hn(t-1),null)}return Ln.of(i)}decomposeLeft(t,e){e.push(new Hn(t-1),null)}decomposeRight(t,e){e.push(null,new Hn(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,l=t.heightChanged;for(n.from>e&&i.push(new Hn(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)>=In&&(o=-2);let l=new Fn(e,s);l.outdated=!1,i.push(l),r+=e+1}r<=s&&i.push(null,new Hn(s-r).updateHeight(t,r));let a=Ln.of(i);return t.heightChanged=l||o<0||Math.abs(a.height-this.height)>=In||Math.abs(o-this.lines(t.doc,e).lineHeight)>=In,a}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class Jn extends Ln{constructor(t,e,i){super(t.length+e+i.length,t.height+i.height,e|(t.outdated||i.outdated?2:0)),this.left=t,this.right=i,this.size=t.size+i.size}get break(){return 1&this.flags}blockAt(t,e,i,n){let s=i+this.left.height;return to))return a;let h=e==Nn.ByPosNoHeight?Nn.ByPosNoHeight:Nn.ByPos;return l?a.join(this.right.lineAt(o,h,i,r,o)):this.left.lineAt(o,h,i,n,s).join(a)}forEachLine(t,e,i,n,s,r){let o=n+this.left.height,l=s+this.left.length+this.break;if(this.break)t=l&&this.right.forEachLine(t,e,i,o,l,r);else{let a=this.lineAt(l,Nn.ByPos,i,n,s);t=t&&a.from<=e&&r(a),e>a.to&&this.right.forEachLine(a.to+1,e,i,o,l,r)}}replace(t,e,i){let n=this.left.length+this.break;if(ethis.left.length)return this.balanced(this.left,this.right.replace(t-n,e-n,i));let s=[];t>0&&this.decomposeLeft(t,s);let r=s.length;for(let t of i)s.push(t);if(t>0&&Kn(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?Ln.of(this.break?[t,null,e]:[t,e]):(this.left=t,this.right=e,this.height=t.height+e.height,this.outdated=t.outdated||e.outdated,this.size=t.size+e.size,this.length=t.length+this.break+e.length,this)}updateHeight(t,e=0,i=!1,n){let{left:s,right:r}=this,o=e+s.length+this.break,l=null;return n&&n.from<=e+s.length&&n.more?l=s=s.updateHeight(t,e,i,n):s.updateHeight(t,e,i),n&&n.from<=o+r.length&&n.more?l=r=r.updateHeight(t,o,i,n):r.updateHeight(t,o,i),l?this.balanced(s,r):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Kn(t,e){let i,n;null==t[e]&&(i=t[e-1])instanceof Hn&&(n=t[e+1])instanceof Hn&&t.splice(e-1,3,new Hn(i.length+1+n.length))}class ts{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 Fn?i.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new Fn(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 Fn(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let i=new Hn(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 Fn)return t;let e=new Fn(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine(),t.type!=ei.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,t.type!=ei.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 Fn||this.isCovered?(this.writtenToi.clientHeight||i.scrollWidth>i.clientWidth)&&"visible"!=n.overflow){let n=i.getBoundingClientRect();r=Math.max(r,n.left),o=Math.min(o,n.right),l=Math.max(l,n.top),a=e==t.parentNode?n.bottom:Math.min(a,n.bottom)}e="absolute"==n.position||"fixed"==n.position?i.offsetParent:i.parentNode}else{if(11!=e.nodeType)break;e=e.host}return{left:r-i.left,right:Math.max(r,o)-i.left,top:l-(i.top+e),bottom:Math.max(l,a)-(i.top+e)}}function ns(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class ss{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 Gn(i),this.stateDeco=t.facet(Ai).filter((t=>"function"!=typeof t)),this.heightMap=Ln.empty().applyChanges(this.stateDeco,e.empty,this.heightOracle.setDoc(t.doc),[new qi(0,0,0,t.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ii.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 ls(e,i))}}this.viewports=t.sort(((t,e)=>t.from-e.from)),this.scaler=this.heightMap.height<=7e6?us:new fs(this.heightOracle.doc,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.state.doc,0,0,(t=>{this.viewportLines.push(1==this.scaler.scale?t:Os(t,this.scaler))}))}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=this.state.facet(Ai).filter((t=>"function"!=typeof t));let n=t.changedRanges,s=qi.extendWithRanges(n,function(t,e,i){let n=new es;return Ct.compare(t,e,i,n,0),n.changes}(i,this.stateDeco,t?t.changes:x.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 l=!t.changes.empty||2&t.flags||o.from!=this.viewport.from||o.to!=this.viewport.to;this.viewport=o,this.updateForViewport(),l&&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(t){let i=t.contentDOM,n=window.getComputedStyle(i),s=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?_i.RTL:_i.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),l=o||this.mustMeasureContent||this.contentDOMHeight!=i.clientHeight;this.contentDOMHeight=i.clientHeight,this.mustMeasureContent=!1;let a=0,h=0,c=parseInt(n.paddingTop)||0,u=parseInt(n.paddingBottom)||0;this.paddingTop==c&&this.paddingBottom==u||(this.paddingTop=c,this.paddingBottom=u,a|=10),this.editorWidth!=t.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=t.scrollDOM.clientWidth,a|=8);let f=(this.printing?ns:is)(i,this.paddingTop),O=f.top-this.pixelViewport.top,d=f.bottom-this.pixelViewport.bottom;this.pixelViewport=f;let p=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(p!=this.inView&&(this.inView=p,p&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let m=i.clientWidth;if(this.contentDOMWidth==m&&this.editorHeight==t.scrollDOM.clientHeight||(this.contentDOMWidth=m,this.editorHeight=t.scrollDOM.clientHeight,a|=8),l){let i=t.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(i)&&(o=!0),o||s.lineWrapping&&Math.abs(m-this.contentDOMWidth)>s.charWidth){let{lineHeight:e,charWidth:n}=t.docView.measureTextSize();o=e>0&&s.refresh(r,e,n,m/n,i),o&&(t.docView.minWidth=0,a|=8)}O>0&&d>0?h=Math.max(O,d):O<0&&d<0&&(h=Math.min(O,d)),s.heightChanged=!1;for(let n of this.viewports){let r=n.from==this.viewport.from?i:t.docView.measureVisibleLineHeights(n);this.heightMap=(o?Ln.empty().applyChanges(this.stateDeco,e.empty,this.heightOracle,[new qi(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new Bn(n.from,r))}s.heightChanged&&(a|=2)}let g=!this.viewportIsAppropriate(this.viewport,h)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return g&&(this.viewport=this.getViewport(h,this.scrollTarget)),this.updateForViewport(),(2&a||g)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,t)),a|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),a}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.state.doc,{visibleTop:r,visibleBottom:o}=this,l=new ls(n.lineAt(r-1e3*i,Nn.ByHeight,s,0,0).from,n.lineAt(o+1e3*(1-i),Nn.ByHeight,s,0,0).to);if(e){let{head:t}=e.range;if(tl.to){let i,r=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=n.lineAt(t,Nn.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!=_i.LTR&&!i)return[];let o=[],l=(n,r,a,h)=>{if(r-nn&&tt.from>=a.from&&t.to<=a.to&&Math.abs(t.from-n)t.frome))));if(!f){if(rt.from<=r&&t.to>=r))){let t=e.moveToLineBoundary(R.cursor(r),!1,!0).head;t>n&&(r=t)}f=new ss(n,r,this.gapSize(a,n,r,h))}o.push(f)};for(let t of this.viewportLines){if(t.lengtht.from&&l(t.from,s,t,e),ot.draw(this.heightOracle.lineWrapping)))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];Ct.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))||Os(this.heightMap.lineAt(t,Nn.ByPos,this.state.doc,0,0),this.scaler)}lineBlockAtHeight(t){return Os(this.heightMap.lineAt(this.scaler.fromDOM(t),Nn.ByHeight,this.state.doc,0,0),this.scaler)}elementAtHeight(t){return Os(this.heightMap.blockAt(this.scaler.fromDOM(t),this.state.doc,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class ls{constructor(t,e){this.from=t,this.to=e}}function as(t,e,i){let n=[],s=t,r=0;return Ct.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 cs(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 us={toDOM:t=>t,fromDOM:t=>t,scale:1};class fs{constructor(t,e,i){let n=0,s=0,r=0;this.viewports=i.map((({from:i,to:s})=>{let r=e.lineAt(i,Nn.ByPos,t,0,0).top,o=e.lineAt(s,Nn.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=eOs(t,e))):t.type)}const ds=q.define({combine:t=>t.join(" ")}),ps=q.define({combine:t=>t.indexOf(!0)>-1}),ms=Nt.newName(),gs=Nt.newName(),Qs=Nt.newName(),bs={"&light":"."+gs,"&dark":"."+Qs};function Ss(t,e,i){return new Nt(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 ys=Ss("."+ms,{"&.cm-editor":{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,minHeight:"100%",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":{contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused .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-focused .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},bs);class ws{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 tn(i,n)),s==i&&r==n||e.push(new tn(s,r)));return e}(t),i=new Ji(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?R.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||!se(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||!se(t.contentDOM,e.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(e.anchorNode,e.anchorOffset);this.newSel=R.single(n,i)}}}function vs(t,i){let n,{newSel:s}=i,r=t.state.selection.main;if(i.bounds){let{from:s,to:o}=i.bounds,l=r.from,a=null;(8===t.inputState.lastKeyCode&&t.inputState.lastKeyTime>Date.now()-100||De.android&&i.text.length0&&l>0&&t.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if("end"==n){i-=o+Math.max(0,r-Math.min(o,l))-r}if(o=o?r-i:0,l=r+(l-o),o=r}else if(l=l?r-i:0,o=r+(o-l),l=r}return{from:r,toA:o,toB:l}}(t.state.doc.sliceString(s,o,Hi),i.text,l-s,a);h&&(De.chrome&&13==t.inputState.lastKeyCode&&h.toB==h.from+2&&i.text.slice(h.from,h.toB)==Hi+Hi&&h.toB--,n={from:s+h.from,to:s+h.toA,insert:e.of(i.text.slice(h.from,h.toB).split(Hi))})}else!s||t.hasFocus&&t.state.facet(xi)&&!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:t.state.doc.slice(r.from,r.to)}:n&&n.from>=r.from&&n.to<=r.to&&(n.from!=r.from||n.to!=r.to)&&r.to-r.from-(n.to-n.from)<=4?n={from:r.from,to:r.to,insert:t.state.doc.slice(r.from,n.from).append(n.insert).append(t.state.doc.slice(n.to,r.to))}:(De.mac||De.android)&&n&&n.from==n.to&&n.from==r.head-1&&/^\. ?$/.test(n.insert.toString())?(s&&2==n.insert.length&&(s=R.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:e.of([" "])}):De.chrome&&n&&n.from==n.to&&n.from==r.head&&"\n "==n.insert.toString()&&t.lineWrapping&&(s&&(s=R.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:e.of([" "])}),n){let e=t.state;if(De.ios&&t.inputState.flushIOSKey(t))return!0;if(De.android&&(n.from==r.from&&n.to==r.to&&1==n.insert.length&&2==n.insert.lines&&be(t.contentDOM,"Enter",13)||n.from==r.from-1&&n.to==r.to&&0==n.insert.length&&be(t.contentDOM,"Backspace",8)||n.from==r.from&&n.to==r.to+1&&0==n.insert.length&&be(t.contentDOM,"Delete",46)))return!0;let i,o=n.insert.toString();if(t.state.facet(Qi).some((e=>e(t,n.from,n.to,o))))return!0;if(t.inputState.composing>=0&&t.inputState.composing++,n.from>=r.from&&n.to<=r.to&&n.to-n.from>=(r.to-r.from)/3&&(!s||s.main.empty&&s.main.from==n.from+n.insert.length)&&t.inputState.composing<0){let s=r.fromn.to?e.sliceDoc(n.to,r.to):"";i=e.replaceSelection(t.state.toText(s+n.insert.sliceString(0,void 0,t.state.lineBreak)+o))}else{let o=e.changes(n),l=s&&!e.selection.main.eq(s.main)&&s.main.to<=o.newLength?s.main:void 0;if(e.selection.ranges.length>1&&t.inputState.composing>=0&&n.to<=r.to&&n.to>=r.to-10){let s=t.state.sliceDoc(n.from,n.to),a=sn(t)||t.state.doc.lineAt(r.head),h=r.to-n.to,c=r.to-r.from;i=e.changeByRange((i=>{if(i.from==r.from&&i.to==r.to)return{changes:o,range:l||i.map(o)};let u=i.to-h,f=u-s.length;if(i.to-i.from!=c||t.state.sliceDoc(f,u)!=s||a&&i.to>=a.from&&i.from<=a.to)return{range:i};let O=e.changes({from:f,to:u,insert:n.insert}),d=i.to-r.to;return{changes:O,range:l?R.range(Math.max(0,l.anchor+d),Math.max(0,l.head+d)):i.map(O)}}))}else i={changes:o,selection:l&&e.selection.replaceRange(l)}}let l="input.type";return t.composing&&(l+=".compose",t.inputState.compositionFirstChange&&(l+=".start",t.inputState.compositionFirstChange=!1)),t.dispatch(i,{scrollIntoView:!0,userEvent:l}),!0}if(s&&!s.main.eq(r)){let e=!1,i="select";return t.inputState.lastSelectionTime>Date.now()-50&&("select"==t.inputState.lastSelectionOrigin&&(e=!0),i=t.inputState.lastSelectionOrigin),t.dispatch({selection:s,scrollIntoView:e,userEvent:i}),!0}return!1}const xs={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},ks=De.ie&&De.ie_version<=11;class $s{constructor(t){this.view=t,this.active=!1,this.selectionRange=new de,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resize=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()})),ks&&(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.resize=new ResizeObserver((()=>{var t;(null===(t=this.view.docView)||void 0===t?void 0:t.lastUpdate){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(xi)?i.root.activeElement!=this.dom:!re(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&&le(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,l=t.docView.domAtPos(t.state.selection.main.anchor);le(l.node,l.offset,r,o)&&([n,s,r,o]=[r,o,n,s]);return{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:o}}(this.view)||ne(t.root);if(!e||this.selectionRange.eq(e))return!1;let i=re(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()}processRecords(){let t=this.queue;for(let e of this.observer.takeRecords())t.push(e);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&&re(this.dom,this.selectionRange);return t<0&&!n?null:(t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new ws(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=vs(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=Ts(e,t.previousSibling||t.target.previousSibling,-1),n=Ts(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;this.stop(),null===(t=this.intersection)||void 0===t||t.disconnect(),null===(e=this.gapIntersection)||void 0===e||e.disconnect(),null===(i=this.resize)||void 0===i||i.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 Ts(t,e,i){for(;e;){let n=ve.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 Ps{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: absolute; 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 os(t.state||vt.create(t)),this.plugins=this.state.facet($i).map((t=>new Pi(t)));for(let t of this.plugins)t.update(this);this.observer=new $s(this),this.inputState=new bn(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new en(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 ft?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.observer.delayedAndroidKey,o=null;if(r?(this.observer.clearDelayedAndroidKey(),o=this.observer.readChange(),(o&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(o=null)):this.observer.clear(),s.facet(vt.phrases)!=this.state.facet(vt.phrases))return this.setState(s);e=Vi.create(this,s,t);let l=this.viewState.scrollTarget;try{this.updateState=2;for(let e of t){if(l&&(l=l.map(e.changes)),e.scrollIntoView){let{main:t}=e.state.selection;l=new yi(t.empty?t:R.cursor(t.head,t.head>t.anchor?-1:1))}for(let t of e.effects)t.is(wi)&&(l=t.value)}this.viewState.update(e,l),this.bidiCache=As.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),i=this.docView.update(e),this.state.facet(Ui)!=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(ds)!=e.state.facet(ds)&&(this.viewState.mustMeasureContent=!0),(i||n||l||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!e.empty)for(let t of this.state.facet(gi))t(e);o&&!vs(this,o)&&r.force&&be(this.contentDOM,r.key,r.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 os(t),this.plugins=t.facet($i).map((t=>new Pi(t))),this.pluginMap.clear();for(let t of this.plugins)t.update(this);this.docView=new en(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($i),i=t.state.facet($i);if(e!=i){let n=[];for(let s of i){let i=e.indexOf(s);if(i<0)n.push(new Pi(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&&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 l=o.map((t=>{try{return t.read(this)}catch(t){return vi(this.state,t),Zs}})),a=Vi.create(this,this.state,[]),h=!1,c=!1;a.flags|=s,e?e.flags|=s:e=a,this.updateState=2,a.empty||(this.updatePlugins(a),this.inputState.update(a),this.updateAttrs(),h=this.docView.update(a));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(gi))t(e)}get themeClasses(){return ms+" "+(this.state.facet(ps)?Qs:gs)+" "+this.state.facet(ds)}updateAttrs(){let t=Rs(this,Ci,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(xi)?"true":"false",class:"cm-content",style:`${De.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Rs(this,Zi,e);let i=this.observer.ignore((()=>{let i=Ke(this.contentDOM,this.contentAttrs,e),n=Ke(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(Ps.announce)){e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(Ui),Nt.mount(this.root,this.styleModules.concat(ys).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(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 Qn(this,t,gn(this,t,e,i))}moveByGroup(t,e){return Qn(this,t,gn(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==bt.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==_i.LTR)?e.right-1:e.left+1,y:(r.top+r.bottom)/2});if(null!=o)return R.cursor(o,i?-1:1)}let o=ai.find(t.docView,e.head),l=o?i?o.posAtEnd:o.posAtStart:i?s.to:s.from;return R.cursor(l,i?-1:1)}(this,t,e,i)}moveVertically(t,e,i){return Qn(this,t,function(t,e,i,n){let s=e.head,r=i?1:-1;if(s==(i?t.state.doc.length:0))return R.cursor(s,e.assoc);let o,l=e.goalColumn,a=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s),c=t.documentTop;if(h)null==l&&(l=h.left-a.left),o=r<0?h.top:h.bottom;else{let e=t.viewState.lineBlockAt(s);null==l&&(l=Math.min(a.right-a.left,t.defaultCharacterWidth*(s-e.from))),o=(r<0?e.top:e.bottom)+c}let u=a.left+l,f=null!=n?n:t.defaultLineHeight>>1;for(let i=0;;i+=10){let n=o+(f+i)*r,h=pn(t,{x:u,y:n},!1,r);if(na.bottom||(r<0?hs))return R.cursor(h,e.assoc,void 0,l)}}(this,t,e,i))}domAtPos(t){return this.docView.domAtPos(t)}posAtDOM(t,e=0){return this.docView.posFromDOM(t,e)}posAtCoords(t,e=!0){return this.readMeasured(),pn(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 fe(i,s[Ni.find(s,t-n.from,-1,e)].dir==_i.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(bi)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Cs)return Li(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==Mi?1:2,s=e==Mi?2:1;if(!t||1==n&&!zi.test(t))return Li(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&&(Ii[l]=Ii[Bi[t]]=i),a=t;break}}else{if(189==Bi.length)break;Bi[a++]=l,Bi[a++]=e,Bi[a++]=h}else if(2==(o=Ii[l])||1==o){let t=o==n;h=t?0:1;for(let e=a-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!=Ii[--i];for(;i>e&&n==(2!=Ii[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&&cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,e={}){return wi.of(new yi("number"==typeof t?R.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}static domEventHandlers(t){return Ti.define((()=>({})),{eventHandlers:t})}static theme(t,e){let i=Nt.newName(),n=[ds.of(i),Ui.of(Ss(`.${i}`,t))];return e&&e.dark&&n.push(ps.of(!0)),n}static baseTheme(t){return L.lowest(Ui.of(Ss("."+ms,t,bs)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),n=i&&ve.get(i)||ve.get(t);return(null===(e=null==n?void 0:n.rootView)||void 0===e?void 0:e.view)||null}}Ps.styleModule=Ui,Ps.inputHandler=Qi,Ps.perLineTextDirection=bi,Ps.exceptionSink=mi,Ps.updateListener=gi,Ps.editable=xi,Ps.mouseSelectionStyle=pi,Ps.dragMovesSelection=di,Ps.clickAddsSelectionRange=Oi,Ps.decorations=Ai,Ps.atomicRanges=Ri,Ps.scrollMargins=Xi,Ps.darkTheme=ps,Ps.contentAttributes=Zi,Ps.editorAttributes=Ci,Ps.lineWrapping=Ps.contentAttributes.of({class:"cm-lineWrapping"}),Ps.announce=ut.define();const Cs=4096,Zs={};class As{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:_i.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&&He(r,i)}return i}const Xs=De.mac?"mac":De.windows?"win":De.linux?"linux":"key";function Us(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 qs=L.default(Ps.domEventHandlers({keydown:(t,e)=>function(t,e,i,n){let s=function(t){var e=!(te&&(t.ctrlKey||t.altKey||t.metaKey)||Kt&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?Ft:Yt)[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=Q(s,0),o=S(r)==s.length&&" "!=s,l="",a=!1;Ms&&Ms.view==i&&Ms.scope==n&&(l=Ms.prefix+" ",(a=wn.indexOf(e.keyCode)<0)&&(Ms=null));let h,c,u=new Set,f=t=>{if(t){for(let n of t.run)if(!u.has(n)&&(u.add(n),n(i,e)))return!0;t.preventDefault&&(a=!0)}return!1},O=t[n];if(O){if(f(O[l+Us(s,e,!o)]))return!0;if(o&&(e.altKey||e.metaKey||e.ctrlKey)&&(h=Yt[e.keyCode])&&h!=s){if(f(O[l+Us(h,e,!0)]))return!0;if(e.shiftKey&&(c=Ft[e.keyCode])!=s&&c!=h&&f(O[l+Us(c,e,!1)]))return!0}else if(o&&e.shiftKey&&f(O[l+Us(s,e,!0)]))return!0;if(f(O._any))return!0}return a}(function(t){let e=t.facet(Vs),i=_s.get(e);i||_s.set(e,i=function(t,e=Xs){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 l,a;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,l=i[i.length-1];"Space"==l&&(l=" ");for(let t=0;t{let n=Ms={view:e,prefix:i,scope:t};return setTimeout((()=>{Ms==n&&(Ms=null)}),4e3),!0}]})}let u=c.join(" ");s(u,!1);let f=h[u]||(h[u]={preventDefault:!1,run:(null===(a=null===(l=h._any)||void 0===l?void 0:l.run)||void 0===a?void 0:a.slice())||[]});r&&f.run.push(r),o&&(f.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)),[])));return i}(e.state),t,e,"editor")})),Vs=q.define({enables:qs}),_s=new WeakMap;let Ms=null;class Ds{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",this.width>=0&&(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}}class js{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(Ws)!=t.state.facet(Ws)&&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(Ws);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.dom.remove()}}const Ws=q.define();function Es(t){return[Ti.define((e=>new js(e,t))),Ws.of(t)]}const Gs=!De.ios,Bs=q.define({combine:t=>xt(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})});function zs(t={}){return[Bs.of(t),Is,Ys,Hs,Si.of(!0)]}function Ns(t){return t.startState.facet(Bs)!=t.startState.facet(Bs)}const Is=Es({above:!0,markers(t){let{state:e}=t,i=e.facet(Bs),n=[];for(let s of e.selection.ranges){let r=s==e.selection.main;if(s.empty?!r||Gs:i.drawRangeCursor){let e=er(t,s,r);e&&n.push(e)}}return n},update(t,e){t.transactions.some((t=>t.scrollIntoView))&&(e.style.animationName="cm-blink"==e.style.animationName?"cm-blink2":"cm-blink");let i=Ns(t);return i&&Ls(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){Ls(e.state,t)},class:"cm-cursorLayer"});function Ls(t,e){e.style.animationDuration=t.facet(Bs).cursorBlinkRate+"ms"}const Ys=Es({above:!1,markers:t=>t.state.selection.ranges.map((e=>e.empty?[]:function(t,e){if(e.to<=t.viewport.from||e.from>=t.viewport.to)return[];let i=Math.max(e.from,t.viewport.from),n=Math.min(e.to,t.viewport.to),s=t.textDirection==_i.LTR,r=t.contentDOM,o=r.getBoundingClientRect(),l=Js(t),a=window.getComputedStyle(r.firstChild),h=o.left+parseInt(a.paddingLeft)+Math.min(0,parseInt(a.textIndent)),c=o.right-parseInt(a.paddingRight),u=tr(t,i),f=tr(t,n),O=u.type==ei.Text?u:null,d=f.type==ei.Text?f:null;t.lineWrapping&&(O&&(O=Ks(t,i,O)),d&&(d=Ks(t,n,d)));if(O&&d&&O.from==d.from)return m(g(e.from,e.to,O));{let i=O?g(e.from,null,O):Q(u,!1),n=d?g(null,e.to,d):Q(f,!0),s=[];return(O||u).to<(d||f).from-1?s.push(p(h,i.bottom,c,n.top)):i.bottomu&&n.from=r)break;l>s&&a(Math.max(t,s),null==e&&t<=u,Math.min(l,r),null==i&&l>=f,o.dir)}if(s=n.to+1,s>=r)break}return 0==l.length&&a(u,null==e,f,null==i,t.textDirection),{top:r,bottom:o,horizontal:l}}function Q(t,e){let i=o.top+(e?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]}}}(t,e))).reduce(((t,e)=>t.concat(e))),update:(t,e)=>t.docChanged||t.selectionSet||t.viewportChanged||Ns(t),class:"cm-selectionLayer"}),Fs={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};Gs&&(Fs[".cm-line"].caretColor="transparent !important");const Hs=L.highest(Ps.theme(Fs));function Js(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==_i.LTR?e.left:e.right-t.scrollDOM.clientWidth)-t.scrollDOM.scrollLeft,top:e.top-t.scrollDOM.scrollTop}}function Ks(t,e,i){let n=R.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:ei.Text}}function tr(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==ei.Text))return t;return i}function er(t,e,i){let n=t.coordsAtPos(e.head,e.assoc||1);if(!n)return null;let s=Js(t);return new Ds(i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",n.left-s.left,n.top-s.top,-1,n.bottom-n.top)}function ir(t,e,i,n,s){e.lastIndex=0;for(let r,o=t.iterRange(i,n),l=i;!o.next().done;l+=o.value.length)if(!o.lineBreak)for(;r=e.exec(o.value);)s(l+r.index,r)}class nr{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 Zt,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))ir(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])){l=r;break}for(;oc.push(i.range(t,e));if(i==n)for(this.regexp.lastIndex=l-i.from;(h=this.regexp.exec(i.text))&&h.indexthis.addMatch(i,t,e,u)));e=e.update({filterFrom:l,filterTo:a,filter:(t,e)=>ta,add:c})}}return e}}const sr=null!=/x/.unicode?"gu":"g",rr=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",sr),or={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 lr=null;const ar=q.define({combine(t){let e=xt(t,{render:null,specialChars:rr,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==lr&&"undefined"!=typeof document&&document.body){let e=document.body.style;lr=null!=(null!==(t=e.tabSize)&&void 0!==t?t:e.MozTabSize)}return lr||!1}())&&(e.specialChars=new RegExp("\t|"+e.specialChars.source,sr)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,sr)),e}});function hr(t={}){return[ar.of(t),cr||(cr=Ti.fromClass(class{constructor(t){this.view=t,this.decorations=ii.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(ar)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new nr({regexp:t.specialChars,decoration:(e,i,n)=>{let{doc:s}=i.state,r=Q(e[0],0);if(9==r){let t=s.lineAt(n),e=i.state.tabSize,r=Wt(t.text,e,n-t.from);return ii.replace({widget:new fr((e-r%e)*this.view.defaultCharacterWidth)})}return this.decorationCache[r]||(this.decorationCache[r]=ii.replace({widget:new ur(t,r)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(ar);t.startState.facet(ar)!=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 cr=null;class ur extends ti{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")+" "+(or[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 fr extends ti{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}}const Or=ii.line({class:"cm-activeLine"}),dr=Ti.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,i=[];for(let n of t.state.selection.ranges){let s=t.lineBlockAt(n.head);s.from>e&&(i.push(Or.range(s.from)),e=s.from)}return ii.set(i)}},{decorations:t=>t.decorations}),pr=2e3;function mr(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),n=t.state.doc.lineAt(i),s=i-n.from,r=s>pr?-1:s==n.length?function(t,e){let i=t.coordsAtPos(t.viewport.from);return i?Math.round(Math.abs((i.left-e)/t.defaultCharacterWidth)):-1}(t,e.clientX):Wt(n.text,t.state.tabSize,i-n.from);return{line:n.number,col:r,off:s}}function gr(t,e){let i=mr(t,e),n=t.state.selection;return i?{update(t){if(t.docChanged){let e=t.changes.mapPos(t.startState.doc.line(i.line).from),s=t.state.doc.lineAt(e);i={line:s.number,col:i.col,off:Math.min(i.off,s.length)},n=n.map(t.changes)}},get(e,s,r){let o=mr(t,e);if(!o)return n;let l=function(t,e,i){let n=Math.min(e.line,i.line),s=Math.max(e.line,i.line),r=[];if(e.off>pr||i.off>pr||e.col<0||i.col<0){let o=Math.min(e.off,i.off),l=Math.max(e.off,i.off);for(let e=n;e<=s;e++){let i=t.doc.line(e);i.length<=l&&r.push(R.range(i.from+o,i.to+l))}}else{let o=Math.min(e.col,i.col),l=Math.max(e.col,i.col);for(let e=n;e<=s;e++){let i=t.doc.line(e),n=Et(i.text,o,t.tabSize,!0);if(n<0)r.push(R.cursor(i.to));else{let e=Et(i.text,l,t.tabSize);r.push(R.range(i.from+n,i.from+e))}}}return r}(t.state,i,o);return l.length?r?R.create(l.concat(n.ranges)):R.create(l):n}}:null}function Qr(t){let e=(null==t?void 0:t.eventFilter)||(t=>t.altKey&&0==t.button);return Ps.mouseSelectionStyle.of(((t,i)=>e(i)?gr(t,i):null))}const br={Alt:[18,t=>t.altKey],Control:[17,t=>t.ctrlKey],Shift:[16,t=>t.shiftKey],Meta:[91,t=>t.metaKey]},Sr={style:"cursor: crosshair"};function yr(t={}){let[e,i]=br[t.key||"Alt"],n=Ti.fromClass(class{constructor(t){this.view=t,this.isDown=!1}set(t){this.isDown!=t&&(this.isDown=t,this.view.update([]))}},{eventHandlers:{keydown(t){this.set(t.keyCode==e||i(t))},keyup(t){t.keyCode!=e&&i(t)||this.set(!1)},mousemove(t){this.set(i(t))}}});return[n,Ps.contentAttributes.of((t=>{var e;return(null===(e=t.plugin(n))||void 0===e?void 0:e.isDown)?Sr:null}))]}const wr="-10000px";class vr{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)||xr}}}),$r=Ti.fromClass(class{constructor(t){this.view=t,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(kr);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 vr(t,Cr,(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(kr);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=wr,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(kr).tooltipSpace(this.view)}}writeMeasure(t){let{editor:e,space:i}=t,n=[];for(let s=0;s=Math.min(e.bottom,i.bottom)||a.rightMath.min(e.right,i.right)+.1){l.style.top=wr;continue}let c=r.arrow?o.dom.querySelector(".cm-tooltip-arrow"):null,u=c?7:0,f=h.right-h.left,O=h.bottom-h.top,d=o.offset||Pr,p=this.view.textDirection==_i.LTR,m=h.width>i.right-i.left?p?i.left:i.right-h.width:p?Math.min(a.left-(c?14:0)+d.x,i.right-f):Math.max(i.left,a.left-f+(c?14:0)-d.x),g=!!r.above;!r.strictSide&&(g?a.top-(h.bottom-h.top)-d.yi.bottom)&&g==i.bottom-a.bottom>a.top-i.top&&(g=!g);let Q=(g?a.top-i.top:i.bottom-a.bottom)-u;if(Qm&&t.topb&&(b=g?t.top-O-2-u:t.bottom+u+2);"absolute"==this.position?(l.style.top=b-t.parent.top+"px",l.style.left=m-t.parent.left+"px"):(l.style.top=b+"px",l.style.left=m+"px"),c&&(c.style.left=a.left+(p?d.x:-d.x)-(m+14-7)+"px"),!0!==o.overlap&&n.push({left:m,top:b,right:S,bottom:b+O}),l.classList.toggle("cm-tooltip-above",g),l.classList.toggle("cm-tooltip-below",!g),o.positioned&&o.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=wr}},{eventHandlers:{scroll(){this.maybeMeasure()}}}),Tr=Ps.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"}}}),Pr={x:0,y:0},Cr=q.define({enables:[$r,Tr]});class Zr extends kt{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Zr.prototype.elementClass="",Zr.prototype.toDOM=void 0,Zr.prototype.mapMode=w.TrackBefore,Zr.prototype.startSide=Zr.prototype.endSide=-1,Zr.prototype.point=!0;const Ar=q.define(),Rr={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Ct.empty,lineMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},Xr=q.define();function Ur(t){return[Vr(),Xr.of(Object.assign(Object.assign({},Rr),t))]}const qr=q.define({combine:t=>t.some((t=>t))});function Vr(t){let e=[_r];return t&&!1===t.fixed&&e.push(qr.of(!0)),e}const _r=Ti.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(Xr).map((e=>new Wr(t,e)));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!t.state.facet(qr),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(qr)!=!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=Ct.iter(this.view.state.facet(Ar),this.view.viewport.from),n=[],s=this.gutters.map((t=>new jr(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==ei.Text){e=i;break}}else e=t.type==ei.Text?t:void 0;if(e){n.length&&(n=[]),Dr(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(Xr),i=t.state.facet(Xr),n=t.docChanged||t.heightChanged||t.viewportChanged||!Ct.eq(t.startState.facet(Ar),t.state.facet(Ar),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 Wr(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=>Ps.scrollMargins.of((e=>{let i=e.plugin(t);return i&&0!=i.gutters.length&&i.fixed?e.textDirection==_i.LTR?{left:i.dom.offsetWidth}:{right:i.dom.offsetWidth}:null}))});function Mr(t){return Array.isArray(t)?t:[t]}function Dr(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class jr{constructor(t,e,i){this.gutter=t,this.height=i,this.localMarkers=[],this.i=0,this.cursor=Ct.iter(t.markers,e.from)}line(t,e,i){this.localMarkers.length&&(this.localMarkers=[]),Dr(this.cursor,this.localMarkers,e.from);let n=i.length?this.localMarkers.concat(i):this.localMarkers,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 Er(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 Wr{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=t.lineBlockAtHeight(n.clientY-t.documentTop);e.domEventHandlers[i](t,s,n)&&n.preventDefault()}));this.markers=Mr(e.markers(t)),e.initialSpacer&&(this.spacer=new Er(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=Mr(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!Ct.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 Er{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;ixt(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 zr extends Zr{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function Nr(t,e){return t.state.facet(Br).formatNumber(e,t.state)}const Ir=Xr.compute([Br],(t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:t=>t.state.facet(Gr),lineMarker:(t,e,i)=>i.some((t=>t.toDOM))?null:new zr(Nr(t,t.state.doc.lineAt(e.from).number)),lineMarkerChange:t=>t.startState.facet(Br)!=t.state.facet(Br),initialSpacer:t=>new zr(Nr(t,Yr(t.state.doc.lines))),updateSpacer(t,e){let i=Nr(e.view,Yr(e.view.state.doc.lines));return i==t.number?t:new zr(i)},domEventHandlers:t.facet(Br).domEventHandlers})));function Lr(t={}){return[Br.of(t),Vr(),Ir]}function Yr(t){let e=9;for(;e{let e=[],i=-1;for(let n of t.selection.ranges){let s=t.doc.lineAt(n.head).from;s>i&&(i=s,e.push(Fr.range(s)))}return Ct.of(e)}));const Jr="function"==typeof String.prototype.normalize?t=>t.normalize("NFKD"):t=>t;class Kr{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(Jr(t)):Jr,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 Q(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=b(t),i=this.bufferStart+this.bufferPos;this.bufferPos+=S(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&&txt(t,to,{highlightWordAroundCursor:(t,e)=>t||e,minSelectionLength:Math.min,maxMatches:Math.min})});function io(t){let e=[lo,oo];return t&&e.push(eo.of(t)),e}const no=ii.mark({class:"cm-selectionMatch"}),so=ii.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function ro(t,e,i,n){return!(0!=i&&t(e.sliceDoc(i-1,i))==bt.Word||n!=e.doc.length&&t(e.sliceDoc(n,n+1))==bt.Word)}const oo=Ti.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(eo),{state:i}=t,n=i.selection;if(n.ranges.length>1)return ii.none;let s,r=n.main,o=null;if(r.empty){if(!e.highlightWordAroundCursor)return ii.none;let t=i.wordAt(r.head);if(!t)return ii.none;o=i.charCategorizer(r.head),s=i.sliceDoc(t.from,t.to)}else{let t=r.to-r.from;if(t200)return ii.none;if(e.wholeWords){if(s=i.sliceDoc(r.from,r.to),o=i.charCategorizer(r.head),!ro(o,i,r.from,r.to)||!function(t,e,i,n){return t(e.sliceDoc(i,i+1))==bt.Word&&t(e.sliceDoc(n-1,n))==bt.Word}(o,i,r.from,r.to))return ii.none}else if(s=i.sliceDoc(r.from,r.to).trim(),!s)return ii.none}let l=[];for(let n of t.visibleRanges){let t=new Kr(i.doc,s,n.from,n.to);for(;!t.next().done;){let{from:n,to:s}=t.value;if((!o||ro(o,i,n,s))&&(r.empty&&n<=r.from&&s>=r.to?l.push(so.range(n,s)):(n>=r.to||s<=r.from)&&l.push(no.range(n,s)),l.length>e.maxMatches))return ii.none}}return ii.set(l)}},{decorations:t=>t.decorations}),lo=Ps.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),ao=1024;let ho=0;class co{constructor(t,e){this.from=t,this.to=e}}class uo{constructor(t={}){this.id=ho++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof t&&(t=Oo.match(t)),e=>{let i=t(e);return void 0===i?null:[this,i]}}}uo.closedBy=new uo({deserialize:t=>t.split(" ")}),uo.openedBy=new uo({deserialize:t=>t.split(" ")}),uo.group=new uo({deserialize:t=>t.split(" ")}),uo.contextHash=new uo({perNode:!0}),uo.lookAhead=new uo({perNode:!0}),uo.mounted=new uo({perNode:!0});const fo=Object.create(null);class Oo{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):fo,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),n=new Oo(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(uo.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(uo.group),n=-1;n<(i?i.length:0);n++){let s=e[n<0?t.name:i[n]];if(s)return s}}}}Oo.none=new Oo("",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:Uo(Oo.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(Oo.none,t,e,i)))}static build(t){return function(t){var e;let{buffer:i,nodeSet:n,maxBufferLength:s=ao,reused:r=[],minRepeatType:o=n.types.length}=t,l=Array.isArray(i)?new So(i,i.length):i,a=n.types,h=0,c=0;function u(t,e,i,g,Q){let{id:b,start:S,end:y,size:w}=l,v=c;for(;w<0;){if(l.next(),-1==w){let e=r[b];return i.push(e),void g.push(S-t)}if(-3==w)return void(h=b);if(-4==w)return void(c=b);throw new RangeError(`Unrecognized record size: ${w}`)}let x,k,$=a[b],T=S-t;if(y-S<=s&&(k=p(l.pos-e,Q))){let e=new Uint16Array(k.size-k.skip),i=l.pos-k.size,s=e.length;for(;l.pos>i;)s=m(k.start,e,s);x=new yo(e,y-k.start,n),T=k.start-t}else{let t=l.pos-w;l.next();let e=[],i=[],n=b>=o?b:-1,r=0,a=y;for(;l.pos>t;)n>=0&&l.id==n&&l.size>=0?(l.end<=a-s&&(O(e,i,S,r,l.end,a,n,v),r=e.length,a=l.end),l.next()):u(S,t,e,i,n);if(n>=0&&r>0&&r-1&&r>0){let t=f($);x=Uo($,e,i,0,e.length,0,y-S,t,t)}else x=d($,e,i,y-S,v-y)}i.push(x),g.push(T)}function f(t){return(e,i,n)=>{let s,r,o=0,l=e.length-1;if(l>=0&&(s=e[l])instanceof bo){if(!l&&s.type==t&&s.length==n)return s;(r=s.prop(uo.lookAhead))&&(o=i[l]+s.length+r)}return d(t,e,i,n,o)}}function O(t,e,i,s,r,o,l,a){let h=[],c=[];for(;t.length>s;)h.push(t.pop()),c.push(e.pop()+i-r);t.push(d(n.types[l],h,c,o-r,a-o)),e.push(r-i)}function d(t,e,i,n,s=0,r){if(h){let t=[uo.contextHash,h];r=r?[t].concat(r):[t]}if(s>25){let t=[uo.lookAhead,s];r=r?[t].concat(r):[t]}return new bo(t,e,i,n,r)}function p(t,e){let i=l.fork(),n=0,r=0,a=0,h=i.end-s,c={size:0,start:0,skip:0};t:for(let s=i.pos-t;i.pos>s;){let t=i.size;if(i.id==e&&t>=0){c.size=n,c.start=r,c.skip=a,a+=4,n+=4,i.next();continue}let l=i.pos-t;if(t<0||l=o?4:0,f=i.start;for(i.next();i.pos>l;){if(i.size<0){if(-3!=i.size)break t;u+=4}else i.id>=o&&(u+=4);i.next()}r=f,n+=t,a+=u}return(e<0||n==t)&&(c.size=n,c.start=r,c.skip=a),c.size>4?c:void 0}function m(t,e,i){let{id:n,start:s,end:r,size:a}=l;if(l.next(),a>=0&&n4){let n=l.pos-(a-4);for(;l.pos>n;)i=m(t,e,i)}e[--i]=o,e[--i]=r-t,e[--i]=s-t,e[--i]=n}else-3==a?h=n:-4==a&&(c=n);return i}let g=[],Q=[];for(;l.pos>0;)u(t.start||0,t.bufferStart||0,g,Q,-1);let b=null!==(e=t.length)&&void 0!==e?e:g.length?Q[0]+g[0].length:0;return new bo(a[t.topID],g.reverse(),Q.reverse(),b)}(t)}}bo.empty=new bo(Oo.none,[],[],0);class So{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 So(this.buffer,this.index)}}class yo{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return Oo.none}toString(){let t=[];for(let e=0;e0));l=r[l+3]);return o}slice(t,e,i){let n=this.buffer,s=new Uint16Array(e-t),r=0;for(let o=t,l=0;o=e&&ie;case 1:return i<=e&&n>e;case 2:return n>e;case 4:return!0}}function vo(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!=a;t+=e){let a=o[t],h=l[t]+r.from;if(wo(n,i,h,h+a.length))if(a instanceof yo){if(s&Qo.ExcludeBuffers)continue;let o=a.findChild(0,a.buffer.length,e,i-h,n);if(o>-1)return new Co(new Po(r,a,t,h),null,o)}else if(s&Qo.IncludeAnonymous||!a.type.isAnonymous||Ao(a)){let o;if(!(s&Qo.IgnoreMounts)&&a.props&&(o=a.prop(uo.mounted))&&!o.overlay)return new ko(o.tree,h,t,r);let l=new ko(a,h,t,r);return s&Qo.IncludeAnonymous||!l.type.isAnonymous?l:l.nextChild(e<0?a.children.length-1:0,e,i,n)}}if(s&Qo.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&Qo.IgnoreOverlays)&&(n=this._tree.prop(uo.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 Zo(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 vo(this,t)}getChild(t,e=null,i=null){let n=$o(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return $o(this,t,e,i)}toString(){return this._tree.toString()}get node(){return this}matchContext(t){return To(this,t)}}function $o(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 To(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&Qo.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 Zo(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 vo(this,t)}toString(){return this.context.buffer.childString(this.index)}getChild(t,e=null,i=null){let n=$o(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return $o(this,t,e,i)}get node(){return this}matchContext(t){return To(this,t)}}class Zo{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&Qo.ExcludeBuffers)&&this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Qo.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&Qo.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&Qo.IncludeAnonymous||t instanceof yo||!t.type.isAnonymous||Ao(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 To(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 Ao(t){return t.children.some((t=>t instanceof yo||!t.type.isAnonymous||Ao(t)))}const Ro=new WeakMap;function Xo(t,e){if(!t.isAnonymous||e instanceof yo||e.type!=t)return 1;let i=Ro.get(e);if(null==i){i=1;for(let n of e.children){if(n.type!=t||!(n instanceof bo)){i=1;break}i+=Xo(t,n)}Ro.set(e,i)}return i}function Uo(t,e,i,n,s,r,o,l,a){let h=0;for(let i=n;i=c)break;d+=e}if(h==s+1){if(d>c){let t=i[s];e(t.children,t.positions,0,t.children.length,n[s]+l);continue}u.push(i[s])}else{let e=n[h-1]+i[h-1].length-O;u.push(Uo(t,i,n,s,h,O,e,null,a))}f.push(O+l-r)}}(e,i,n,s,0),(l||a)(u,f,o)}class qo{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 Vo{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 Vo(0,t.length,t,0,!1,i)];for(let i of e)i.to>t.length&&n.push(i);return n}static applyChanges(t,e,i=128){if(!e.length)return t;let n=[],s=1,r=t.length?t[0]:null;for(let o=0,l=0,a=0;;o++){let h=o=i)for(;r&&r.from=e.from||c<=e.to||a){let t=Math.max(e.from,l)-a,i=Math.min(e.to,c)-a;e=t>=i?null:new Vo(t,i,e.tree,e.offset+a,o>0,!!h)}if(e&&n.push(e),r.to>c)break;r=snew co(t.from,t.to))):[new co(0,0)]:[new co(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)}}new uo({perNode:!0});let Do=0;class jo{constructor(t,e,i){this.set=t,this.base=e,this.modified=i,this.id=Do++}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 Eo;return e=>e.modified.indexOf(t)>-1?e:Eo.get(e.base||e,e.modified.concat(t).sort(((t,e)=>t.id-e.id)))}}let Wo=0;class Eo{constructor(){this.instances=[],this.id=Wo++}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(Eo.get(e,t));return s}}function Go(t){let e=Object.create(null);for(let i in t){let n=t[i];Array.isArray(n)||(n=[n]);for(let t of i.split(" "))if(t){let i=[],s=2,r=t;for(let e=0;;){if("..."==r&&e>0&&e+3==t.length){s=1;break}let n=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(r);if(!n)throw new RangeError("Invalid path: "+t);if(i.push("*"==n[0]?"":'"'==n[0][0]?JSON.parse(n[0]):n[0]),e+=n[0].length,e==t.length)break;let o=t[e++];if(e==t.length&&"!"==o){s=0;break}if("/"!=o)throw new RangeError("Invalid path: "+t);r=t.slice(e)}let o=i.length-1,l=i[o];if(!l)throw new RangeError("Invalid path: "+t);let a=new zo(n,s,o>0?i.slice(0,o):null);e[l]=a.sort(e[l])}}return Bo.add(e)}const Bo=new uo;class zo{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 Io(t,e,i,n=0,s=t.length){let r=new Lo(n,Array.isArray(e)?e:[e],i);r.highlightRange(t.cursor(),n,s,"",r.highlighters),r.flush(s)}zo.empty=new zo([],2,null);class Lo{constructor(t,e,i){this.at=t,this.highlighters=e,this.span=i,this.class=""}startSpan(t,e){e!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=e)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,e,i,n,s){let{type:r,from:o,to:l}=t;if(o>=i||l<=e)return;r.isTop&&(s=this.highlighters.filter((t=>!t.scope||t.scope(r))));let a=n,h=function(t){let e=t.type.prop(Bo);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}(t)||zo.empty,c=function(t,e){let i=null;for(let n of t){let t=n.style(e);t&&(i=i?i+" "+t:t)}return i}(s,h.tags);if(c&&(a&&(a+=" "),a+=c,1==h.mode&&(n+=(n?" ":"")+c)),this.startSpan(t.from,a),h.opaque)return;let u=t.tree&&t.tree.prop(uo.mounted);if(u&&u.overlay){let r=t.node.enter(u.overlay[0].from+o,1),h=this.highlighters.filter((t=>!t.scope||t.scope(u.tree.type))),c=t.firstChild();for(let f=0,O=o;;f++){let d=f=p)&&t.nextSibling()););if(!d||p>i)break;O=d.to+o,O>e&&(this.highlightRange(r.cursor(),Math.max(e,d.from+o),Math.min(i,O),n,h),this.startSpan(O,a))}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),a)}}while(t.nextSibling());t.parent()}}}const Yo=jo.define,Fo=Yo(),Ho=Yo(),Jo=Yo(Ho),Ko=Yo(Ho),tl=Yo(),el=Yo(tl),il=Yo(tl),nl=Yo(),sl=Yo(nl),rl=Yo(),ol=Yo(),ll=Yo(),al=Yo(ll),hl=Yo(),cl={comment:Fo,lineComment:Yo(Fo),blockComment:Yo(Fo),docComment:Yo(Fo),name:Ho,variableName:Yo(Ho),typeName:Jo,tagName:Yo(Jo),propertyName:Ko,attributeName:Yo(Ko),className:Yo(Ho),labelName:Yo(Ho),namespace:Yo(Ho),macroName:Yo(Ho),literal:tl,string:el,docString:Yo(el),character:Yo(el),attributeValue:Yo(el),number:il,integer:Yo(il),float:Yo(il),bool:Yo(tl),regexp:Yo(tl),escape:Yo(tl),color:Yo(tl),url:Yo(tl),keyword:rl,self:Yo(rl),null:Yo(rl),atom:Yo(rl),unit:Yo(rl),modifier:Yo(rl),operatorKeyword:Yo(rl),controlKeyword:Yo(rl),definitionKeyword:Yo(rl),moduleKeyword:Yo(rl),operator:ol,derefOperator:Yo(ol),arithmeticOperator:Yo(ol),logicOperator:Yo(ol),bitwiseOperator:Yo(ol),compareOperator:Yo(ol),updateOperator:Yo(ol),definitionOperator:Yo(ol),typeOperator:Yo(ol),controlOperator:Yo(ol),punctuation:ll,separator:Yo(ll),bracket:al,angleBracket:Yo(al),squareBracket:Yo(al),paren:Yo(al),brace:Yo(al),content:nl,heading:sl,heading1:Yo(sl),heading2:Yo(sl),heading3:Yo(sl),heading4:Yo(sl),heading5:Yo(sl),heading6:Yo(sl),contentSeparator:Yo(nl),list:Yo(nl),quote:Yo(nl),emphasis:Yo(nl),strong:Yo(nl),link:Yo(nl),monospace:Yo(nl),strikethrough:Yo(nl),inserted:Yo(),deleted:Yo(),changed:Yo(),invalid:Yo(),meta:hl,documentMeta:Yo(hl),annotation:Yo(hl),processingInstruction:Yo(hl),definition:jo.defineModifier(),constant:jo.defineModifier(),function:jo.defineModifier(),standard:jo.defineModifier(),local:jo.defineModifier(),special:jo.defineModifier()};var ul;No([{tag:cl.link,class:"tok-link"},{tag:cl.heading,class:"tok-heading"},{tag:cl.emphasis,class:"tok-emphasis"},{tag:cl.strong,class:"tok-strong"},{tag:cl.keyword,class:"tok-keyword"},{tag:cl.atom,class:"tok-atom"},{tag:cl.bool,class:"tok-bool"},{tag:cl.url,class:"tok-url"},{tag:cl.labelName,class:"tok-labelName"},{tag:cl.inserted,class:"tok-inserted"},{tag:cl.deleted,class:"tok-deleted"},{tag:cl.literal,class:"tok-literal"},{tag:cl.string,class:"tok-string"},{tag:cl.number,class:"tok-number"},{tag:[cl.regexp,cl.escape,cl.special(cl.string)],class:"tok-string2"},{tag:cl.variableName,class:"tok-variableName"},{tag:cl.local(cl.variableName),class:"tok-variableName tok-local"},{tag:cl.definition(cl.variableName),class:"tok-variableName tok-definition"},{tag:cl.special(cl.variableName),class:"tok-variableName2"},{tag:cl.definition(cl.propertyName),class:"tok-propertyName tok-definition"},{tag:cl.typeName,class:"tok-typeName"},{tag:cl.namespace,class:"tok-namespace"},{tag:cl.className,class:"tok-className"},{tag:cl.macroName,class:"tok-macroName"},{tag:cl.propertyName,class:"tok-propertyName"},{tag:cl.operator,class:"tok-operator"},{tag:cl.comment,class:"tok-comment"},{tag:cl.meta,class:"tok-meta"},{tag:cl.invalid,class:"tok-invalid"},{tag:cl.punctuation,class:"tok-punctuation"}]);const fl=new uo;class Ol{constructor(t,e,i=[],n=""){this.data=t,this.name=n,vt.prototype.hasOwnProperty("tree")||Object.defineProperty(vt.prototype,"tree",{get(){return ml(this)}}),this.parser=e,this.extension=[kl.of(this),vt.languageData.of(((t,e,i)=>t.facet(dl(t,e,i))))].concat(i)}isActiveAt(t,e,i=-1){return dl(t,e,i)==this.data}findRegions(t){let e=t.facet(kl);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(fl)==this.data)return void i.push({from:e,to:e+t.length});let s=t.prop(uo.mounted);if(s){if(s.tree.prop(fl)==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.concat(i):void 0}));var i;return new pl(e,t.parser.configure({props:[fl.add((t=>t.isTop?e:void 0))]}),t.name)}configure(t,e){return new pl(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function ml(t){let e=t.field(Ol.state,!1);return e?e.tree:bo.empty}class gl{constructor(t,e=t.length){this.doc=t,this.length=e,this.cursorPos=0,this.string="",this.cursor=t.iter()}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 Ql=null;class bl{constructor(t,e,i=[],n,s,r,o,l){this.parser=t,this.state=e,this.fragments=i,this.tree=n,this.treeLen=s,this.viewport=r,this.skipped=o,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(t,e,i){return new bl(t,e,[],bo.empty,0,i,[],null)}startParse(){return this.parser.startParse(new gl(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(Vo.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Ql;Ql=this;try{return t()}finally{Ql=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=Sl(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=Vo.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=Sl(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 _o{createParse(e,i,n){let s=n[0].from,r=n[n.length-1].to;return{parsedPos:s,advance(){let e=Ql;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(Oo.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 Ql}}function Sl(t,e,i){return Vo.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class yl{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 yl(e)}static init(t){let e=Math.min(3e3,t.doc.length),i=bl.create(t.facet(kl).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new yl(i)}}Ol.state=E.define({create:yl.init,update(t,e){for(let t of e.effects)if(t.is(Ol.setState))return t.value;return e.startState.facet(kl)!=e.state.facet(kl)?yl.init(e.state):t.apply(e)}});let wl=t=>{let e=setTimeout((()=>t()),500);return()=>clearTimeout(e)};"undefined"!=typeof requestIdleCallback&&(wl=t=>{let e=-1,i=setTimeout((()=>{e=requestIdleCallback(t,{timeout:400})}),100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const vl="undefined"!=typeof navigator&&(null===(ul=navigator.scheduling)||void 0===ul?void 0:ul.isInputPending)?()=>navigator.scheduling.isInputPending():null,xl=Ti.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(Ol.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(Ol.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=wl(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEndn+1e3,l=s.context.work((()=>vl&&vl()||Date.now()>r),n+(o?0:1e5));this.chunkBudget-=Date.now()-e,(l||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Ol.setState.of(new yl(s.context))})),this.chunkBudget>0&&(!l||o)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then((()=>this.scheduleWork())).catch((t=>vi(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()}}}),kl=q.define({combine:t=>t.length?t[0]:null,enables:t=>[Ol.state,xl,Ps.contentAttributes.compute([t],(e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}}))]});class $l{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}const Tl=q.define(),Pl=q.define({combine:t=>{if(!t.length)return" ";if(!/^(?: +|\t+)$/.test(t[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return t[0]}});function Cl(t){let e=t.facet(Pl);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function Zl(t,e){let i="",n=t.tabSize;if(9==t.facet(Pl).charCodeAt(0))for(;e>=n;)i+="\t",e-=n;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 Wt(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 Xl=new uo;function Ul(t){let e=t.type.prop(Xl);if(e)return e;let i,n=t.firstChild;if(n&&(i=n.type.prop(uo.closedBy))){let e=t.lastChild,n=e&&i.indexOf(e.name)>-1;return t=>jl(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?Vl:null}function ql(t,e,i){for(;t;t=t.parent){let n=Ul(t);if(n)return n(_l.create(i,e,t))}return null}function Vl(){return 0}class _l extends Rl{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 _l(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(Ml(e,this.node))break;t=this.state.doc.lineAt(e.from)}return this.lineIndent(t.from)}continue(){let t=this.node.parent;return t?ql(t,this.pos,this.base):0}}function Ml(t,e){for(let i=e;i;i=i.parent)if(t==i)return!0;return!1}function Dl({closing:t,align:e=!0,units:i=1}){return n=>jl(n,e,i,t)}function jl(t,e,i,n,s){let r=t.textAfter,o=r.match(/^\s*/)[0].length,l=n&&r.slice(o,o+n.length)==n||s==t.pos+o,a=e?function(t){let e=t.node,i=e.childAfter(e.from),n=e.lastChild;if(!i)return null;let s=t.options.simulateBreak,r=t.state.doc.lineAt(i.from),o=null==s||s<=r.from?r.to:Math.min(r.to,s);for(let t=i.to;;){let s=e.childAfter(t);if(!s||s==n)return null;if(!s.type.isSkipped)return s.from{let n=t&&t.test(i.textAfter);return i.baseIndent+(n?0:e*i.unit)}}const El=q.define(),Gl=new uo;function Bl(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function zl(t,e,i){for(let n of t.facet(El)){let s=n(t,e,i);if(s)return s}return function(t,e,i){let n=ml(t);if(n.lengthi)continue;if(s&&r.from=e&&n.to>i&&(s=n)}}return s}(t,e,i)}function Nl(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 Il=ut.define({map:Nl}),Ll=ut.define({map:Nl});function Yl(t){let e=[];for(let{head:i}of t.state.selection.ranges)e.some((t=>t.from<=i&&t.to>=i))||e.push(t.lineBlockAt(i));return e}const Fl=E.define({create:()=>ii.none,update(t,e){t=t.map(e.changes);for(let i of e.effects)i.is(Il)&&!Jl(t,i.value.from,i.value.to)?t=t.update({add:[ra.range(i.value.from,i.value.to)]}):i.is(Ll)&&(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=>Ps.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 Jl(t,e,i){let n=!1;return t.between(e,e,((t,s)=>{t==e&&s==i&&(n=!0)})),n}function Kl(t,e){return t.field(Fl,!1)?e:e.concat(ut.appendConfig.of(sa()))}function ta(t,e,i=!0){let n=t.state.doc.lineAt(e.from).number,s=t.state.doc.lineAt(e.to).number;return Ps.announce.of(`${t.state.phrase(i?"Folded lines":"Unfolded lines")} ${n} ${t.state.phrase("to")} ${s}.`)}const ea=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:t=>{for(let e of Yl(t)){let i=zl(t.state,e.from,e.to);if(i)return t.dispatch({effects:Kl(t.state,[Il.of(i),ta(t,i)])}),!0}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:t=>{if(!t.state.field(Fl,!1))return!1;let e=[];for(let i of Yl(t)){let n=Hl(t.state,i.from,i.to);n&&e.push(Ll.of(n),ta(t,n,!1))}return e.length&&t.dispatch({effects:e}),e.length>0}},{key:"Ctrl-Alt-[",run:t=>{let{state:e}=t,i=[];for(let n=0;n{let e=t.state.field(Fl,!1);if(!e||!e.size)return!1;let i=[];return e.between(0,t.state.doc.length,((t,e)=>{i.push(Ll.of({from:t,to:e}))})),t.dispatch({effects:i}),!0}}],ia={placeholderDOM:null,placeholderText:"…"},na=q.define({combine:t=>xt(t,ia)});function sa(t){let e=[Fl,ha];return t&&e.push(na.of(t)),e}const ra=ii.replace({widget:new class extends ti{toDOM(t){let{state:e}=t,i=e.facet(na),n=e=>{let i=t.lineBlockAt(t.posAtDOM(e.target)),n=Hl(t.state,i.from,i.to);n&&t.dispatch({effects:Ll.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}}}),oa={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class la extends Zr{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}}function aa(t={}){let e=Object.assign(Object.assign({},oa),t),i=new la(e,!0),n=new la(e,!1),s=Ti.fromClass(class{constructor(t){this.from=t.viewport.from,this.markers=this.buildMarkers(t)}update(t){(t.docChanged||t.viewportChanged||t.startState.facet(kl)!=t.state.facet(kl)||t.startState.field(Fl,!1)!=t.state.field(Fl,!1)||ml(t.startState)!=ml(t.state)||e.foldingChanged(t))&&(this.markers=this.buildMarkers(t.view))}buildMarkers(t){let e=new Zt;for(let s of t.viewportLineBlocks){let r=Hl(t.state,s.from,s.to)?n:zl(t.state,s.from,s.to)?i:null;r&&e.add(s.from,s.from,r)}return e.finish()}}),{domEventHandlers:r}=e;return[s,Ur({class:"cm-foldGutter",markers(t){var e;return(null===(e=t.plugin(s))||void 0===e?void 0:e.markers)||Ct.empty},initialSpacer:()=>new la(e,!1),domEventHandlers:Object.assign(Object.assign({},r),{click:(t,e,i)=>{if(r.click&&r.click(t,e,i))return!0;let n=Hl(t.state,e.from,e.to);if(n)return t.dispatch({effects:Ll.of(n)}),!0;let s=zl(t.state,e.from,e.to);return!!s&&(t.dispatch({effects:Il.of(s)}),!0)}})}),sa()]}const ha=Ps.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 ca{constructor(t,e){let i;function n(t){let e=Nt.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 Ol?t=>t.prop(fl)==r.data:r?t=>t==r:void 0,this.style=No(t.map((t=>({tag:t.tag,class:t.class||n(Object.assign({},t,{tag:null}))}))),{all:s}).style,this.module=i?new Nt(i):null,this.themeType=e.themeType}static define(t,e){return new ca(t,e||{})}}const ua=q.define(),fa=q.define({combine:t=>t.length?[t[0]]:null});function Oa(t){let e=t.facet(ua);return e.length?e:t.facet(fa)}function da(t,e){let i,n=[ma];return t instanceof ca&&(t.module&&n.push(Ps.styleModule.of(t.module)),i=t.themeType),(null==e?void 0:e.fallback)?n.push(fa.of(t)):i?n.push(ua.computeN([Ps.darkTheme],(e=>e.facet(Ps.darkTheme)==("dark"==i)?[t]:[]))):n.push(ua.of(t)),n}class pa{constructor(t){this.markCache=Object.create(null),this.tree=ml(t.state),this.decorations=this.buildDeco(t,Oa(t.state))}update(t){let e=ml(t.state),i=Oa(t.state),n=i!=Oa(t.startState);e.length{i.add(t,e,this.markCache[n]||(this.markCache[n]=ii.mark({class:n})))}),n,s);return i.finish()}}const ma=L.high(Ti.fromClass(pa,{decorations:t=>t.decorations})),ga=ca.define([{tag:cl.meta,color:"#7a757a"},{tag:cl.link,textDecoration:"underline"},{tag:cl.heading,textDecoration:"underline",fontWeight:"bold"},{tag:cl.emphasis,fontStyle:"italic"},{tag:cl.strong,fontWeight:"bold"},{tag:cl.strikethrough,textDecoration:"line-through"},{tag:cl.keyword,color:"#708"},{tag:[cl.atom,cl.bool,cl.url,cl.contentSeparator,cl.labelName],color:"#219"},{tag:[cl.literal,cl.inserted],color:"#164"},{tag:[cl.string,cl.deleted],color:"#a11"},{tag:[cl.regexp,cl.escape,cl.special(cl.string)],color:"#e40"},{tag:cl.definition(cl.variableName),color:"#00f"},{tag:cl.local(cl.variableName),color:"#30a"},{tag:[cl.typeName,cl.namespace],color:"#085"},{tag:cl.className,color:"#167"},{tag:[cl.special(cl.variableName),cl.macroName],color:"#256"},{tag:cl.definition(cl.propertyName),color:"#00c"},{tag:cl.comment,color:"#940"},{tag:cl.invalid,color:"#f00"}]),Qa=Ps.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),ba="()[]{}",Sa=q.define({combine:t=>xt(t,{afterCursor:!0,brackets:ba,maxScanDistance:1e4,renderMatch:va})}),ya=ii.mark({class:"cm-matchingBracket"}),wa=ii.mark({class:"cm-nonmatchingBracket"});function va(t){let e=[],i=t.matched?ya:wa;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 xa=E.define({create:()=>ii.none,update(t,e){if(!e.docChanged&&!e.selection)return t;let i=[],n=e.state.facet(Sa);for(let t of e.state.selection.ranges){if(!t.empty)continue;let s=Pa(e.state,t.head,-1,n)||t.head>0&&Pa(e.state,t.head-1,1,n)||n.afterCursor&&(Pa(e.state,t.head,1,n)||t.headPs.decorations.from(t)}),ka=[xa,Qa];function $a(t={}){return[Sa.of(t),ka]}function Ta(t,e,i){let n=t.prop(e<0?uo.openedBy:uo.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 Pa(t,e,i,n={}){let s=n.maxScanDistance||1e4,r=n.brackets||ba,o=ml(t),l=o.resolveInner(e,i);for(let n=l;n;n=n.parent){let s=Ta(n.type,i,r);if(s&&n.from0)return null;let h={from:i<0?e-1:e,to:i>0?e+1:e},c=t.doc.iterRange(e,i>0?t.doc.length:0),u=0;for(let t=0;!c.next().done&&t<=r;){let r=c.value;i<0&&(t+=r.length);let l=e+t*i;for(let t=i>0?0:r.length-1,e=i>0?r.length:-1;t!=e;t+=i){let e=o.indexOf(r[t]);if(!(e<0||n.resolveInner(l+t,1).type!=s))if(e%2==0==i>0)u++;else{if(1==u)return{start:h,end:{from:l+t,to:l+t+1},matched:e>>1==a>>1};u--}}i>0&&(t+=r.length)}return c.done?{start:h,matched:!1}:null}(t,e,i,o,l.type,s,r)}function Ca(t,e,i,n,s,r){let o=n.parent,l={from:n.from,to:n.to},a=0,h=null==o?void 0:o.cursor();if(h&&(i<0?h.childBefore(n.from):h.childAfter(n.to)))do{if(i<0?h.to<=n.from:h.from>=n.to){if(0==a&&s.indexOf(h.type.name)>-1&&h.from-1||(Ra.push(t),console.warn(e))}function qa(t,e){let i=null;for(let n of e.split(".")){let e=t[n]||cl[n];e?"function"==typeof e?i?i=e(i):Ua(n,`Modifier ${n} used at start of tag`):i?Ua(n,`Tag ${n} used as modifier`):i=e:Ua(n,`Unknown highlighting tag ${n}`)}if(!i)return 0;let n=e.replace(/ /g,"_"),s=Oo.define({id:Aa.length,name:n,props:[Go({[n]:i})]});return Aa.push(s),s.id}function Va(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 _a=Va(Ea,0),Ma=Va(Wa,0),Da=Va(((t,e)=>Wa(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,to:s.to})}return e}(e))),0);function ja(t,e=t.selection.main.head){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}function Wa(t,e,i=e.selection.ranges){let n=i.map((t=>ja(e,t.from).block));if(!n.every((t=>t)))return null;let s=i.map(((t,i)=>function(t,{open:e,close:i},n,s){let r,o,l=t.sliceDoc(n-50,n),a=t.sliceDoc(s,s+50),h=/\s*$/.exec(l)[0].length,c=/^\s*/.exec(a)[0].length,u=l.length-h;if(l.slice(u-e.length,u)==e&&a.slice(c,c+i.length)==i)return{open:{pos:n-h,margin:h&&1},close:{pos:s+c,margin:c&&1}};s-n<=100?r=o=t.sliceDoc(n,s):(r=t.sliceDoc(n,n+50),o=t.sliceDoc(s-50,s));let f=/^\s*/.exec(r)[0].length,O=/\s*$/.exec(o)[0].length,d=o.length-O-i.length;return r.slice(f,f+e.length)==e&&o.slice(d,d+i.length)==i?{open:{pos:n+f+e.length,margin:/\s/.test(r.charAt(f+e.length))?1:0},close:{pos:s-O-i.length,margin:/\s/.test(o.charAt(d-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=ja(e,i).line;if(!t)continue;let r=/^\s*/.exec(l.text)[0].length,a=r==l.length,h=l.text.slice(r,r+t.length)==t?r:-1;rt.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 Ga=at.define(),Ba=at.define(),za=q.define(),Na=q.define({combine:t=>xt(t,{minDepth:100,newGroupDelay:500},{minDepth:Math.max,newGroupDelay:Math.min})});const Ia=E.define({create:()=>hh.empty,update(t,e){let i=e.state.facet(Na),n=e.annotation(Ga);if(n){let s=e.docChanged?R.single(function(t){let e=0;return t.iterChangedRanges(((t,i)=>e=i)),e}(e.changes)):void 0,r=th.fromTransaction(e,s),o=n.side,l=0==o?t.undone:t.done;return l=r?eh(l,l.length,i.minDepth,r):sh(l,e.startState.selection),new hh(0==o?n.rest:l,0==o?l:n.rest)}let s=e.annotation(Ba);if("full"!=s&&"before"!=s||(t=t.isolate()),!1===e.annotation(ft.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);let r=th.fromTransaction(e),o=e.annotation(ft.time),l=e.annotation(ft.userEvent);return r?t=t.addChanges(r,o,l,i.newGroupDelay,i.minDepth):e.selection&&(t=t.addSelection(e.startState.selection,o,l,i.newGroupDelay)),"full"!=s&&"after"!=s||(t=t.isolate()),t},toJSON:t=>({done:t.done.map((t=>t.toJSON())),undone:t.undone.map((t=>t.toJSON()))}),fromJSON:t=>new hh(t.done.map(th.fromJSON),t.undone.map(th.fromJSON))});function La(t={}){return[Ia,Na.of(t),Ps.domEventHandlers({beforeinput(t,e){let i="historyUndo"==t.inputType?Fa:"historyRedo"==t.inputType?Ha:null;return!!i&&(t.preventDefault(),i(e))}})]}function Ya(t,e){return function({state:i,dispatch:n}){if(!e&&i.readOnly)return!1;let s=i.field(Ia,!1);if(!s)return!1;let r=s.pop(t,i,e);return!!r&&(n(r),!0)}}const Fa=Ya(0,!1),Ha=Ya(1,!1),Ja=Ya(0,!0),Ka=Ya(1,!0);class th{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 th(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 th(t.changes&&x.fromJSON(t.changes),[],t.mapped&&v.fromJSON(t.mapped),t.startSelection&&R.fromJSON(t.startSelection),t.selectionsAfter.map(R.fromJSON))}static fromTransaction(t,e){let i=nh;for(let e of t.startState.facet(za)){let n=e(t);n.length&&(i=i.concat(n))}return!i.length&&t.changes.empty?null:new th(t.changes.invert(t.startState.doc),i,void 0,e||t.startState.selection,nh)}static selection(t){return new th(void 0,nh,void 0,void 0,t)}}function eh(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 ih(t,e){return t.length?e.length?t.concat(e):t:e}const nh=[];function sh(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-200));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),eh(t,t.length-1,1e9,i.setSelAfter(n)))}return[th.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 oh(t,e){if(!t.length)return t;let i=t.length,n=nh;for(;i;){let s=lh(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?[th.selection(n)]:nh}function lh(t,e,i){let n=ih(t.selectionsAfter.length?t.selectionsAfter.map((t=>t.map(e))):nh,i);if(!t.changes)return th.selection(n);let s=t.changes.map(e),r=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(r):r;return new th(s,ut.mapEffects(t.effects,e),o,t.startSelection.map(r),n)}const ah=/^(input\.type|delete)($|\.)/;class hh{constructor(t,e,i=0,n){this.done=t,this.undone=e,this.prevTime=i,this.prevUserEvent=n}isolate(){return this.prevTime?new hh(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||ah.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)?eh(r,r.length-1,s,new th(t.changes.compose(o.changes),ih(t.effects,o.effects),o.mapped,o.startSelection,nh)):eh(r,r.length,s,t),new hh(r,nh,e,i)}addSelection(t,e,i,n){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:nh;return s.length>0&&e-this.prevTimet.empty!=o.ranges[e].empty)).length)?this:new hh(sh(this.done,t),this.undone,e,i);var r,o}addMapping(t){return new hh(oh(this.done,t),oh(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:Ga.of({side:t,rest:rh(n)}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let i=1==n.length?nh:n.slice(0,n.length-1);return s.mapped&&(i=oh(i,s.mapped)),e.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:Ga.of({side:t,rest:i}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}}hh.empty=new hh(nh,nh);const ch=[{key:"Mod-z",run:Fa,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Ha,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Ha,preventDefault:!0},{key:"Mod-u",run:Ja,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Ka,preventDefault:!0}];function uh(t,e){return R.create(t.ranges.map(e),t.mainIndex)}function fh(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function Oh({state:t,dispatch:e},i){let n=uh(t.selection,i);return!n.eq(t.selection)&&(e(fh(t,n)),!0)}function dh(t,e){return R.cursor(e?t.to:t.from)}function ph(t,e){return Oh(t,(i=>i.empty?t.moveByChar(i,e):dh(i,e)))}function mh(t){return t.textDirectionAt(t.state.selection.main.head)==_i.LTR}const gh=t=>ph(t,!mh(t)),Qh=t=>ph(t,mh(t));function bh(t,e){return Oh(t,(i=>i.empty?t.moveByGroup(i,e):dh(i,e)))}function Sh(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 yh(t,e,i){let n,s,r=ml(t).resolveInner(e.head),o=i?uo.closedBy:uo.openedBy;for(let n=e.head;;){let e=i?r.childAfter(n):r.childBefore(n);if(!e)break;Sh(t,e,o)?r=e:n=i?e.to:e.from}return s=r.type.prop(o)&&(n=i?Pa(t,r.from,1):Pa(t,r.to,-1))&&n.matched?i?n.end.to:n.end.from:i?r.to:r.from,R.cursor(s,i?-1:1)}function wh(t,e){return Oh(t,(i=>{if(!i.empty)return dh(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)}))}const vh=t=>wh(t,!1),xh=t=>wh(t,!0);function kh(t){return Math.max(t.defaultLineHeight,Math.min(t.dom.clientHeight,innerHeight)-5)}function $h(t,e){let{state:i}=t,n=uh(i.selection,(i=>i.empty?t.moveVertically(i,e,kh(t)):dh(i,e)));if(n.eq(i.selection))return!1;let s,r=t.coordsAtPos(i.selection.main.head),o=t.scrollDOM.getBoundingClientRect();return r&&r.top>o.top&&r.bottom$h(t,!1),Ph=t=>$h(t,!0);function Ch(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=R.cursor(n.from+i))}return s}function Zh(t,e){let i=uh(t.state.selection,(t=>{let i=e(t);return R.range(t.anchor,i.head,i.goalColumn)}));return!i.eq(t.state.selection)&&(t.dispatch(fh(t.state,i)),!0)}function Ah(t,e){return Zh(t,(i=>t.moveByChar(i,e)))}const Rh=t=>Ah(t,!mh(t)),Xh=t=>Ah(t,mh(t));function Uh(t,e){return Zh(t,(i=>t.moveByGroup(i,e)))}function qh(t,e){return Zh(t,(i=>t.moveVertically(i,e)))}const Vh=t=>qh(t,!1),_h=t=>qh(t,!0);function Mh(t,e){return Zh(t,(i=>t.moveVertically(i,e,kh(t))))}const Dh=t=>Mh(t,!1),jh=t=>Mh(t,!0),Wh=({state:t,dispatch:e})=>(e(fh(t,{anchor:0})),!0),Eh=({state:t,dispatch:e})=>(e(fh(t,{anchor:t.doc.length})),!0),Gh=({state:t,dispatch:e})=>(e(fh(t,{anchor:t.selection.main.anchor,head:0})),!0),Bh=({state:t,dispatch:e})=>(e(fh(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0);function zh(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=Nh(t,n,!0)),s=Math.min(s,n),r=Math.max(r,n)}else s=Nh(t,s,!1),r=Nh(t,r,!0);return s==r?{range:n}:{changes:{from:s,to:r},range:R.cursor(s)}}));return!s.changes.empty&&(t.dispatch(n.update(s,{scrollIntoView:!0,userEvent:i,effects:"delete.selection"==i?Ps.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function Nh(t,e,i){if(t instanceof Ps)for(let n of t.state.facet(Ps.atomicRanges).map((e=>e(t))))n.between(e,e,((t,n)=>{te&&(e=i?n:t)}));return e}const Ih=(t,e)=>zh(t,(i=>{let n,s,{state:r}=t,o=r.doc.lineAt(i);if(!e&&i>o.from&&iIh(t,!1),Yh=t=>Ih(t,!0),Fh=(t,e)=>zh(t,(i=>{let n=i,{state:s}=t,r=s.doc.lineAt(n),o=s.charCategorizer(n);for(let t=null;;){if(n==(e?r.to:r.from)){n==i&&r.number!=(e?s.doc.lines:1)&&(n+=e?1:-1);break}let l=O(r.text,n-r.from,e)+r.from,a=r.text.slice(Math.min(n,l)-r.from,Math.max(n,l)-r.from),h=o(a);if(null!=t&&h!=t)break;" "==a&&n==i||(t=h),n=l}return n})),Hh=t=>Fh(t,!1),Jh=t=>zh(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 tc(t,e,i){if(t.readOnly)return!1;let n=[],s=[];for(let e of Kh(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(R.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(R.range(t.anchor-o,t.head-o))}}return!!n.length&&(e(t.update({changes:n,scrollIntoView:!0,selection:R.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0)}function ec(t,e,i){if(t.readOnly)return!1;let n=[];for(let e of Kh(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 ic=nc(!1);function nc(t){return({state:i,dispatch:n})=>{if(i.readOnly)return!1;let s=i.changeByRange((n=>{let{from:s,to:r}=n,o=i.doc.lineAt(s),l=!t&&s==r&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i,n=ml(t).resolveInner(e),s=n.childBefore(e),r=n.childAfter(e);return s&&r&&s.to<=e&&r.from>=e&&(i=s.type.prop(uo.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);t&&(s=r=(r<=o.to?o:i.doc.lineAt(r)).to);let a=new Rl(i,{simulateBreak:s,simulateDoubleBreak:!!l}),h=Al(a,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:R.range(r.mapPos(n.anchor,1),r.mapPos(n.head,1))}}))}const rc=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(sc(t,((e,i)=>{i.push({from:e.from,insert:t.facet(Pl)})})),{userEvent:"input.indent"})),!0),oc=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(sc(t,((e,i)=>{let n=/^\s*/.exec(e.text)[0];if(!n)return;let s=Wt(n,t.tabSize),r=0,o=Zl(t,Math.max(0,s-Cl(t)));for(;rOh(t,(e=>yh(t.state,e,!mh(t)))),shift:t=>Zh(t,(e=>yh(t.state,e,!mh(t))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:t=>Oh(t,(e=>yh(t.state,e,mh(t)))),shift:t=>Zh(t,(e=>yh(t.state,e,mh(t))))},{key:"Alt-ArrowUp",run:({state:t,dispatch:e})=>tc(t,e,!1)},{key:"Shift-Alt-ArrowUp",run:({state:t,dispatch:e})=>ec(t,e,!1)},{key:"Alt-ArrowDown",run:({state:t,dispatch:e})=>tc(t,e,!0)},{key:"Shift-Alt-ArrowDown",run:({state:t,dispatch:e})=>ec(t,e,!0)},{key:"Escape",run:({state:t,dispatch:e})=>{let i=t.selection,n=null;return i.ranges.length>1?n=R.create([i.main]):i.main.empty||(n=R.create([R.cursor(i.main.head)])),!!n&&(e(fh(t,n)),!0)}},{key:"Mod-Enter",run:nc(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:t,dispatch:e})=>{let i=Kh(t).map((({from:e,to:i})=>R.range(e,Math.min(i+1,t.doc.length))));return e(t.update({selection:R.create(i),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:t,dispatch:e})=>{let i=uh(t.selection,(e=>{var i;let n=ml(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 R.range(n.to,n.from)}));return e(fh(t,i)),!0},preventDefault:!0},{key:"Mod-[",run:oc},{key:"Mod-]",run:rc},{key:"Mod-Alt-\\",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new Rl(t,{overrideIndentation:t=>{let e=i[t];return null==e?-1:e}}),s=sc(t,((e,s,r)=>{let o=Al(n,e.from);if(null==o)return;/\S/.test(e.text)||(o=0);let l=/^\s*/.exec(e.text)[0],a=Zl(t,o);(l!=a||r.from{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(Kh(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=Pa(t,e.head,-1)||Pa(t,e.head,1)||e.head>0&&Pa(t,e.head-1,1)||e.head{let e=ja(t.state);return e.line?_a(t):!!e.block&&Da(t)}},{key:"Alt-A",run:Ma}].concat([{key:"ArrowLeft",run:gh,shift:Rh,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:t=>bh(t,!mh(t)),shift:t=>Uh(t,!mh(t)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:t=>Oh(t,(e=>Ch(t,e,!mh(t)))),shift:t=>Zh(t,(e=>Ch(t,e,!mh(t)))),preventDefault:!0},{key:"ArrowRight",run:Qh,shift:Xh,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:t=>bh(t,mh(t)),shift:t=>Uh(t,mh(t)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:t=>Oh(t,(e=>Ch(t,e,mh(t)))),shift:t=>Zh(t,(e=>Ch(t,e,mh(t)))),preventDefault:!0},{key:"ArrowUp",run:vh,shift:Vh,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Wh,shift:Gh},{mac:"Ctrl-ArrowUp",run:Th,shift:Dh},{key:"ArrowDown",run:xh,shift:_h,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Eh,shift:Bh},{mac:"Ctrl-ArrowDown",run:Ph,shift:jh},{key:"PageUp",run:Th,shift:Dh},{key:"PageDown",run:Ph,shift:jh},{key:"Home",run:t=>Oh(t,(e=>Ch(t,e,!1))),shift:t=>Zh(t,(e=>Ch(t,e,!1))),preventDefault:!0},{key:"Mod-Home",run:Wh,shift:Gh},{key:"End",run:t=>Oh(t,(e=>Ch(t,e,!0))),shift:t=>Zh(t,(e=>Ch(t,e,!0))),preventDefault:!0},{key:"Mod-End",run:Eh,shift:Bh},{key:"Enter",run:ic},{key:"Mod-a",run:({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:Lh,shift:Lh},{key:"Delete",run:Yh},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Hh},{key:"Mod-Delete",mac:"Alt-Delete",run:t=>Fh(t,!0)},{mac:"Mod-Backspace",run:t=>zh(t,(e=>{let i=t.lineBlockAt(e).from;return e>i?i:Math.max(0,e-1)}))},{mac:"Mod-Delete",run:Jh}].concat([{key:"Ctrl-b",run:gh,shift:Rh,preventDefault:!0},{key:"Ctrl-f",run:Qh,shift:Xh},{key:"Ctrl-p",run:vh,shift:Vh},{key:"Ctrl-n",run:xh,shift:_h},{key:"Ctrl-a",run:t=>Oh(t,(e=>R.cursor(t.lineBlockAt(e.head).from,1))),shift:t=>Zh(t,(e=>R.cursor(t.lineBlockAt(e.head).from)))},{key:"Ctrl-e",run:t=>Oh(t,(e=>R.cursor(t.lineBlockAt(e.head).to,-1))),shift:t=>Zh(t,(e=>R.cursor(t.lineBlockAt(e.head).to)))},{key:"Ctrl-d",run:Yh},{key:"Ctrl-h",run:Lh},{key:"Ctrl-k",run:Jh},{key:"Ctrl-Alt-h",run:Hh},{key:"Ctrl-o",run:({state:t,dispatch:i})=>{if(t.readOnly)return!1;let n=t.changeByRange((t=>({changes:{from:t.from,to:t.to,insert:e.of(["",""])},range:R.cursor(t.from)})));return i(t.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:O(n.text,i-n.from,!1)+n.from,r=i==n.to?i+1:O(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:R.cursor(r)}}));return!i.changes.empty&&(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:Ph}].map((t=>({mac:t.key,run:t.run,shift:t.shift}))))),ac={key:"Tab",run:rc,shift:oc};class hc{constructor(t,e,i){this.state=t,this.pos=e,this.explicit=i,this.abortListeners=[]}tokenBefore(t){let e=ml(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(dc(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 cc(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 uc(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 fc{constructor(t,e,i){this.completion=t,this.source=e,this.match=i}}function Oc(t){return t.selection.main.head}function dc(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 pc=at.define();function mc(t,e){const i=e.completion.apply||e.completion.label;let n=e.source;var s,r,o,l;"string"==typeof i?t.dispatch(Object.assign(Object.assign({},(s=t.state,r=i,o=n.from,l=n.to,Object.assign(Object.assign({},s.changeByRange((t=>{if(t==s.selection.main)return{changes:{from:o,to:l,insert:r},range:R.cursor(o+r.length)};let e=l-o;return!t.empty||e&&s.sliceDoc(t.from-e,t.from)!=s.sliceDoc(o,l)?{range:t}:{changes:{from:t.from-e,to:t.from,insert:r},range:R.cursor(t.from-e+r.length)}}))),{userEvent:"input.complete"}))),{annotations:pc.of(e.completion)})):i(t,e.completion,n.from,n.to)}const gc=new WeakMap;function Qc(t){if(!Array.isArray(t))return t;let e=gc.get(t);return e||gc.set(t,e=uc(t)),e}class bc{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[];for(let e=0;e=48&&a<=57||a>=97&&a<=122?2:a>=65&&a<=90?1:0:(y=b(a))!=y.toLowerCase()?1:y!=y.toUpperCase()?2:0;(!n||1==w&&p||0==g&&0!=w)&&(e[c]==a||i[c]==a&&(u=!0)?r[c++]=n:r.length&&(m=!1)),g=w,n+=S(a)}return c==l&&0==r[0]&&m?this.result((u?-200:0)-100,r,t):f==l&&0==O?[-200-t.length,0,d]:o>-1?[-700-t.length,o,o+this.pattern.length]:f==l?[-900-t.length,O,d]:c==l?this.result((u?-200:0)-100-700+(m?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?S(Q(i,t)):1);s>1&&n[s-1]==t?n[s-1]=e:(n[s++]=t,n[s++]=e)}return n}}const Sc=q.define({combine:t=>xt(t,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],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,optionClass:(t,e)=>i=>function(t,e){return t?e?t+" "+e:t:e}(t(i),e(i)),addToOptions:(t,e)=>t.concat(e)})});function yc(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 wc{constructor(t,e){this.view=t,this.stateField=e,this.info=null,this.placeInfo={read:()=>this.measureInfo(),write:t=>this.positionInfo(t),key:this},this.space=null;let i=t.state.field(e),{options:n,selected:s}=i.open,r=t.state.facet(Sc);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 l=n.appendChild(document.createElement("span"));l.appendChild(document.createTextNode(s.slice(e,o))),l.className="cm-completionMatchedText",r=o}return rt.position-e.position)).map((t=>t.render))}(r),this.optionClass=r.optionClass,this.range=yc(n.length,s,r.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",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]{this.info&&this.view.requestMeasure(this.placeInfo)}))}mount(){this.updateSel()}update(t){var e,i,n;let s=t.state.field(this.stateField),r=t.startState.field(this.stateField);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)))}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfo)}updateSel(){let t=this.view.state.field(this.stateField),e=t.open;if((e.selected>-1&&e.selected=this.range.to)&&(this.range=yc(e.options.length,e.selected,this.view.state.facet(Sc).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.placeInfo)}))),this.updateSelectedOption(e.selected)){this.info&&(this.info.remove(),this.info=null);let{completion:i}=e.options[e.selected],{info:n}=i;if(!n)return;let s="string"==typeof n?document.createTextNode(n):n(i);if(!s)return;"then"in s?s.then((e=>{e&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(e)})).catch((t=>vi(this.view.state,t,"completion info"))):this.addInfoPane(s)}}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.placeInfo)}updateSelectedOption(t){let e=null;for(let i=this.list.firstChild,n=this.range.from;i;i=i.nextSibling,n++)n==t?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),e=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected");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}}if(n.top>Math.min(s.bottom,e.bottom)-10||n.bottom=i.height||t>e.top?h=n.bottom-e.top+"px":c=e.bottom-n.top+"px"}return{top:h,bottom:c,maxWidth:r,class:a?o?"left-narrow":"right-narrow":l?"left":"right"}}positionInfo(t){this.info&&(t?(this.info.style.top=t.top,this.info.style.bottom=t.bottom,this.info.style.maxWidth=t.maxWidth,this.info.className="cm-tooltip cm-completionInfo cm-completionInfo-"+t.class):this.info.style.top="-1e6px")}createListBox(t,e,i){const n=document.createElement("ul");n.id=e,n.setAttribute("role","listbox"),n.setAttribute("aria-expanded","true"),n.setAttribute("aria-label",this.view.state.phrase("Completions"));for(let s=i.from;s=this.options.length?this:new xc(this.options,Tc(e,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,e,i,n,s){let r=function(t,e){let i=[],n=0;for(let s of t)if(s.hasResult())if(!1===s.result.filter){let t=s.result.getMatch;for(let e of s.result.options){let r=[1e9-n++];if(t)for(let i of t(e))r.push(i);i.push(new fc(e,s,r))}}else{let t,n=new bc(e.sliceDoc(s.from,s.to));for(let e of s.result.options)(t=n.match(e.label))&&(null!=e.boost&&(t[0]+=e.boost),i.push(new fc(e,s,t)))}let s=[],r=null,o=e.facet(Sc).compareCompletions;for(let t of i.sort(((t,e)=>e.match[0]-t.match[0]||o(t.completion,e.completion))))!r||r.label!=t.completion.label||r.detail!=t.completion.detail||null!=r.type&&null!=t.completion.type&&r.type!=t.completion.type||r.apply!=t.completion.apply?s.push(t):vc(t.completion)>vc(r)&&(s[s.length-1]=t),r=t.completion;return s}(t,e);if(!r.length)return n&&t.some((t=>1==t.state))?new xc(n.options,n.attrs,n.tooltip,n.timestamp,n.selected,!0):null;let o=e.facet(Sc).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:(l=Vc,t=>new wc(t,l)),above:s.aboveCursor},n?n.timestamp:Date.now(),o,!1);var l}map(t){return new xc(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class kc{constructor(t,e,i){this.active=t,this.id=e,this.open=i}static start(){return new kc(Pc,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(t){let{state:e}=t,i=e.facet(Sc),n=(i.override||e.languageDataAt("autocomplete",Oc(e)).map(Qc)).map((e=>(this.active.find((t=>t.source==e))||new Zc(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;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&&t.docChanged&&(s=s.map(t.changes)),!s&&n.every((t=>1!=t.state))&&n.some((t=>t.hasResult()))&&(n=n.map((t=>t.hasResult()?new Zc(t.source,0):t)));for(let e of t.effects)e.is(qc)&&(s=s&&s.setSelected(e.value,this.id));return n==this.active&&s==this.open?this:new kc(n,this.id,s)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:$c}}const $c={"aria-autocomplete":"list"};function Tc(t,e){let i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(i["aria-activedescendant"]=t+"-"+e),i}const Pc=[];function Cc(t){return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null}class Zc{constructor(t,e,i=-1){this.source=t,this.state=e,this.explicitPos=i}hasResult(){return!1}update(t,e){let i=Cc(t),n=this;i?n=n.handleUserEvent(t,i,e):t.docChanged?n=n.handleChange(t):t.selection&&0!=n.state&&(n=new Zc(n.source,0));for(let e of t.effects)if(e.is(Rc))n=new Zc(n.source,1,e.value?Oc(t.state):-1);else if(e.is(Xc))n=new Zc(n.source,0);else if(e.is(Uc))for(let t of e.value)t.source==n.source&&(n=t);return n}handleUserEvent(t,e,i){return"delete"!=e&&i.activateOnTyping?new Zc(this.source,1):this.map(t.changes)}handleChange(t){return t.changes.touchesRange(Oc(t.startState))?new Zc(this.source,0):this.map(t.changes)}map(t){return t.empty||this.explicitPos<0?this:new Zc(this.source,this.state,t.mapPos(this.explicitPos))}}class Ac extends Zc{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=Oc(t.state);if((this.explicitPos<0?o<=s:or||"delete"==e&&Oc(t.startState)==this.from)return new Zc(this.source,"input"==e&&i.activateOnTyping?1:0);let l,a=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):dc(t,!0).test(s)}(this.result.validFor,t.state,s,r)?new Ac(this.source,a,this.result,s,r):this.result.update&&(l=this.result.update(this.result,s,r,new hc(t.state,o,a>=0)))?new Ac(this.source,a,l,l.from,null!==(n=l.to)&&void 0!==n?n:Oc(t.state)):new Zc(this.source,1,a)}handleChange(t){return t.changes.touchesRange(this.from,this.to)?new Zc(this.source,0):this.map(t.changes)}map(t){return t.empty?this:new Ac(this.source,this.explicitPos<0?-1:t.mapPos(this.explicitPos),this.result,t.mapPos(this.from),t.mapPos(this.to,1))}}const Rc=ut.define(),Xc=ut.define(),Uc=ut.define({map:(t,e)=>t.map((t=>t.map(e)))}),qc=ut.define(),Vc=E.define({create:()=>kc.start(),update:(t,e)=>t.update(e),provide:t=>[Cr.from(t,(t=>t.tooltip)),Ps.contentAttributes.from(t,(t=>t.attrs))]});function _c(t,e="option"){return i=>{let n=i.state.field(Vc,!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 l<0?l="page"==e?0:o-1:l>=o&&(l="page"==e?o-1:0),i.dispatch({effects:qc.of(l)}),!0}}class Mc{constructor(t,e){this.active=t,this.context=e,this.time=Date.now(),this.updates=[],this.done=void 0}}const Dc=Ti.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(Vc).active)1==e.state&&this.startQuery(e)}update(t){let e=t.state.field(Vc);if(!t.selectionSet&&!t.docChanged&&t.startState.field(Vc)==e)return;let i=t.transactions.some((t=>(t.selection||t.docChanged)&&!Cc(t)));for(let e=0;e50&&Date.now()-n.time>1e3){for(let t of n.context.abortListeners)try{t()}catch(t){vi(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"==Cc(e)?this.composing=2:2==this.composing&&e.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:t}=this.view,e=t.field(Vc);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=Oc(e),n=new hc(e,i,t.explicitPos==i),s=new Mc(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:Xc.of(null)}),vi(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(Sc);for(let n=0;nt.source==s.active.source));if(r&&1==r.state)if(null==s.done){let t=new Zc(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:Uc.of(e)})}},{eventHandlers:{blur(){let t=this.view.state.field(Vc,!1);t&&t.tooltip&&this.view.state.facet(Sc).closeOnBlur&&this.view.dispatch({effects:Xc.of(null)})},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout((()=>this.view.dispatch({effects:Rc.of(!1)})),20),this.composing=0}}}),jc=Ps.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":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer",padding:"1px 3px",lineHeight:1.2}}},"&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 Wc{constructor(t,e,i,n){this.field=t,this.line=e,this.from=i,this.to=n}}class Ec{constructor(t,e,i){this.field=t,this.from=e,this.to=i}map(t){let e=t.mapPos(this.from,-1,w.TrackDel),i=t.mapPos(this.to,1,w.TrackDel);return null==e||null==i?null:new Ec(this.field,e,i)}}class Gc{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 Ec(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]||"",l=-1;for(let e=0;e=l&&t.field++}s.push(new Wc(l,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 Gc(n,s)}}let Bc=ii.widget({widget:new class extends ti{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),zc=ii.mark({class:"cm-snippetField"});class Nc{constructor(t,e){this.ranges=t,this.active=e,this.deco=ii.set(t.map((t=>(t.from==t.to?Bc:zc).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 Nc(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 Ic=ut.define({map:(t,e)=>t&&t.map(e)}),Lc=ut.define(),Yc=E.define({create:()=>null,update(t,e){for(let i of e.effects){if(i.is(Ic))return i.value;if(i.is(Lc)&&t)return new Nc(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=>Ps.decorations.from(t,(t=>t?t.deco:ii.none))});function Fc(t,e){return R.create(t.filter((t=>t.field==e)).map((t=>R.range(t.from,t.to))))}function Hc(t){let i=Gc.parse(t);return(t,n,s,r)=>{let{text:o,ranges:l}=i.instantiate(t.state,s),a={changes:{from:s,to:r,insert:e.of(o)},scrollIntoView:!0};if(l.length&&(a.selection=Fc(l,0)),l.length>1){let e=new Nc(l,0),i=a.effects=[Ic.of(e)];void 0===t.state.field(Yc,!1)&&i.push(ut.appendConfig.of([Yc,eu,nu,jc]))}t.dispatch(t.state.update(a))}}function Jc(t){return({state:e,dispatch:i})=>{let n=e.field(Yc,!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:Fc(n.ranges,s),effects:Ic.of(r?null:new Nc(n.ranges,s))})),!0}}const Kc=[{key:"Tab",run:Jc(1),shift:Jc(-1)},{key:"Escape",run:({state:t,dispatch:e})=>!!t.field(Yc,!1)&&(e(t.update({effects:Ic.of(null)})),!0)}],tu=q.define({combine:t=>t.length?t[0]:Kc}),eu=L.highest(Vs.compute([tu],(t=>t.facet(tu))));function iu(t,e){return Object.assign(Object.assign({},e),{apply:Hc(t)})}const nu=Ps.domEventHandlers({mousedown(t,e){let i,n=e.state.field(Yc,!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:Fc(n.ranges,s.field),effects:Ic.of(n.ranges.some((t=>t.field>s.field))?new Nc(n.ranges,s.field):null)}),!0)}}),su={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},ru=ut.define({map(t,e){let i=e.mapPos(t,-1,w.TrackAfter);return null==i?void 0:i}}),ou=ut.define({map:(t,e)=>e.mapPos(t)}),lu=new class extends kt{};lu.startSide=1,lu.endSide=-1;const au=E.define({create:()=>Ct.empty,update(t,e){if(e.selection){let i=e.state.doc.lineAt(e.selection.main.head).from,n=e.startState.doc.lineAt(e.startState.selection.main.head).from;i!=e.changes.mapPos(n,-1)&&(t=Ct.empty)}t=t.map(e.changes);for(let i of e.effects)i.is(ru)?t=t.update({add:[lu.range(i.value,i.value+1)]}):i.is(ou)&&(t=t.update({filter:t=>t!=i.value}));return t}});const hu="()[]{}<>";function cu(t){for(let e=0;e{if((fu?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let s=t.state.selection.main;if(n.length>2||2==n.length&&1==S(Q(n,0))||e!=s.from||i!=s.to)return!1;let r=function(t,e){let i=uu(t,t.selection.main.head),n=i.brackets||su.brackets;for(let s of n){let r=cu(Q(s,0));if(e==s)return r==s?bu(t,s,n.indexOf(s+s+s)>-1,i):gu(t,s,r,i.before||su.before);if(e==r&&pu(t,t.selection.main.from))return Qu(t,s,r)}return null}(t.state,n);return!!r&&(t.dispatch(r),!0)})),du=[{key:"Backspace",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=uu(t,t.selection.main.head).brackets||su.brackets,n=null,s=t.changeByRange((e=>{if(e.empty){let n=function(t,e){let i=t.sliceString(e-2,e);return S(Q(i,0))==i.length?i:i.slice(1)}(t.doc,e.head);for(let s of i)if(s==n&&mu(t.doc,e.head)==cu(Q(s,0)))return{changes:{from:e.head-s.length,to:e.head+s.length},range:R.cursor(e.head-s.length)}}return{range:n=e}}));return n||e(t.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!n}}];function pu(t,e){let i=!1;return t.field(au).between(0,t.doc.length,(t=>{t==e&&(i=!0)})),i}function mu(t,e){let i=t.sliceString(e,e+2);return i.slice(0,S(Q(i,0)))}function gu(t,e,i,n){let s=null,r=t.changeByRange((r=>{if(!r.empty)return{changes:[{insert:e,from:r.from},{insert:i,from:r.to}],effects:ru.of(r.to+e.length),range:R.range(r.anchor+e.length,r.head+e.length)};let o=mu(t.doc,r.head);return!o||/\s/.test(o)||n.indexOf(o)>-1?{changes:{insert:e+i,from:r.head},effects:ru.of(r.head+e.length),range:R.cursor(r.head+e.length)}:{range:s=r}}));return s?null:t.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function Qu(t,e,i){let n=null,s=t.selection.ranges.map((e=>e.empty&&mu(t.doc,e.head)==i?R.cursor(e.head+i.length):n=e));return n?null:t.update({selection:R.create(s,t.selection.mainIndex),scrollIntoView:!0,effects:t.selection.ranges.map((({from:t})=>ou.of(t)))})}function bu(t,e,i,n){let s=n.stringPrefixes||su.stringPrefixes,r=null,o=t.changeByRange((n=>{if(!n.empty)return{changes:[{insert:e,from:n.from},{insert:e,from:n.to}],effects:ru.of(n.to+e.length),range:R.range(n.anchor+e.length,n.head+e.length)};let o,l=n.head,a=mu(t.doc,l);if(a==e){if(Su(t,l))return{changes:{insert:e+e,from:l},effects:ru.of(l+e.length),range:R.cursor(l+e.length)};if(pu(t,l)){let n=i&&t.sliceDoc(l,l+3*e.length)==e+e+e;return{range:R.cursor(l+e.length*(n?3:1)),effects:ou.of(l)}}}else{if(i&&t.sliceDoc(l-2*e.length,l)==e+e&&(o=yu(t,l-2*e.length,s))>-1&&Su(t,o))return{changes:{insert:e+e+e+e,from:l},effects:ru.of(l+e.length),range:R.cursor(l+e.length)};if(t.charCategorizer(l)(a)!=bt.Word&&yu(t,l,s)>-1&&!function(t,e,i,n){let s=ml(t).resolveInner(e,-1),r=n.reduce(((t,e)=>Math.max(t,e.length)),0);for(let o=0;o<5;o++){let o=t.sliceDoc(s.from,Math.min(s.to,s.from+i.length+r)),l=o.indexOf(i);if(!l||l>-1&&n.indexOf(o.slice(0,l))>-1){let e=s.firstChild;for(;e&&e.from==s.from&&e.to-e.from>i.length+l;){if(t.sliceDoc(e.to-i.length,e.to)==i)return!1;e=e.firstChild}return!0}let a=s.to==e&&s.parent;if(!a)break;s=a}return!1}(t,l,e,s))return{changes:{insert:e+e,from:l},effects:ru.of(l+e.length),range:R.cursor(l+e.length)}}return{range:r=n}}));return r?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Su(t,e){let i=ml(t).resolveInner(e+1);return i.parent&&i.from==e}function yu(t,e,i){let n=t.charCategorizer(e);if(n(t.sliceDoc(e-1,e))!=bt.Word)return e;for(let s of i){let i=e-s.length;if(t.sliceDoc(i,e)==s&&n(t.sliceDoc(i-1,i))!=bt.Word)return i}return-1}function wu(t={}){return[Vc,Sc.of(t),Dc,xu,jc]}const vu=[{key:"Ctrl-Space",run:t=>!!t.state.field(Vc,!1)&&(t.dispatch({effects:Rc.of(!0)}),!0)},{key:"Escape",run:t=>{let e=t.state.field(Vc,!1);return!(!e||!e.active.some((t=>0!=t.state)))&&(t.dispatch({effects:Xc.of(null)}),!0)}},{key:"ArrowDown",run:_c(!0)},{key:"ArrowUp",run:_c(!1)},{key:"PageDown",run:_c(!0,"page")},{key:"PageUp",run:_c(!1,"page")},{key:"Enter",run:t=>{let e=t.state.field(Vc,!1);return!(t.state.readOnly||!e||!e.open||e.open.selected<0||Date.now()-e.open.timestampt.facet(Sc).defaultKeymap?[vu]:[]))),ku="#e06c75",$u="#abb2bf",Tu="#7d8799",Pu="#d19a66",Cu="#2c313a",Zu="#282c34",Au="#353a42",Ru="#528bff",Xu=[Ps.theme({"&":{color:$u,backgroundColor:Zu},".cm-content":{caretColor:Ru},".cm-cursor, .cm-dropCursor":{borderLeftColor:Ru},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"#3E4451"},".cm-panels":{backgroundColor:"#21252b",color:$u},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847",outline:"1px solid #515a6b"},".cm-gutters":{backgroundColor:Zu,color:Tu,border:"none"},".cm-activeLineGutter":{backgroundColor:Cu},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Au},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Au,borderBottomColor:Au},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Cu,color:$u}}},{dark:!0}),da(ca.define([{tag:cl.keyword,color:"#c678dd"},{tag:[cl.name,cl.deleted,cl.character,cl.propertyName,cl.macroName],color:ku},{tag:[cl.function(cl.variableName),cl.labelName],color:"#61afef"},{tag:[cl.color,cl.constant(cl.name),cl.standard(cl.name)],color:Pu},{tag:[cl.definition(cl.name),cl.separator],color:$u},{tag:[cl.typeName,cl.className,cl.number,cl.changed,cl.annotation,cl.modifier,cl.self,cl.namespace],color:"#e5c07b"},{tag:[cl.operator,cl.operatorKeyword,cl.url,cl.escape,cl.regexp,cl.link,cl.special(cl.string)],color:"#56b6c2"},{tag:[cl.meta,cl.comment],color:Tu},{tag:cl.strong,fontWeight:"bold"},{tag:cl.emphasis,fontStyle:"italic"},{tag:cl.strikethrough,textDecoration:"line-through"},{tag:cl.link,color:Tu,textDecoration:"underline"},{tag:cl.heading,fontWeight:"bold",color:ku},{tag:[cl.atom,cl.bool,cl.special(cl.variableName)],color:Pu},{tag:[cl.processingInstruction,cl.string,cl.inserted],color:"#98c379"},{tag:cl.invalid,color:"#ffffff"}]))];class Uu{constructor(t,e,i,n,s,r,o,l,a,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=l,this.curContext=a,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 Uu(t,[],e,i,i,0,[],0,n?new qu(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){let e=t>>19,i=65535&t,{parser:n}=this.p,s=n.dynamicPrecedence(i);if(s&&(this.score+=s),0==e)return this.pushState(n.getGoto(this.state,i,!0),this.reducePos),ir;)this.stack.pop();this.reduceContext(i,o)}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 Uu(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 _u(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 qu{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}var Vu;!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"}(Vu||(Vu={}));class _u{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 Mu{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 Mu(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 Mu(this.stack,this.pos,this.index)}}class Du{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const ju=new Du;class Wu{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=ju,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=ju,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 Eu{constructor(t,e){this.data=t,this.id=e}token(t,e){!function(t,e,i,n){let s=0,r=1<0){let i=t[n];if(l.allows(i)&&(-1==e.token.value||e.token.value==i||o.overrides(i,e.token.value))){e.acceptToken(i);break}}let n=e.next,a=0,h=t[s+2];if(!(e.next<0&&h>a&&65535==t[i+3*h-3]&&65535==t[i+3*h-3])){for(;a>1,o=i+r+(r<<1),l=t[o],c=t[o+1]||65536;if(n=c)){s=t[o+2],e.advance();continue t}a=r+1}}break}s=t[i+3*h-1]}}(this.data,t,e,this.id)}}Eu.prototype.contextual=Eu.prototype.fallback=Eu.prototype.extend=!1;class Gu{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function Bu(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}const zu="undefined"!=typeof process&&process.env&&/\bparse\b/.test(process.env.LOG);let Nu=null;var Iu,Lu;function Yu(t,e,i){let n=t.cursor(Qo.IncludeAnonymous);for(n.moveTo(e);;)if(!(i<0?n.childBefore(e):n.childAfter(e)))for(;;){if((i<0?n.toe)&&!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"}(Iu||(Iu={}));class Fu{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?Yu(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?Yu(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 Hu{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map((t=>new Du))}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,l=0;for(let n=0;nh.end+25&&(l=Math.max(h.lookAhead,l)),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),!a.extend&&(i=h,e>n))break}}for(;this.actions.length>e;)this.actions.pop();return l&&t.setLookAhead(l),i||t.pos!=this.stream.end||(i=new Du,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 Du,{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 Fu(i,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t,e,i=this.stacks,n=this.minStackPos,s=this.stacks=[];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)}}}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(uo.contextHash)||0)==i))return t.useNode(o,n),zu&&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 l=o.children[0];if(!(l instanceof bo&&0==o.positions[0]))break;o=l}}let o=s.stateSlot(t.state,4);if(o>0)return t.reduce(o),zu&&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 l=this.tokens.getActions(t);for(let o=0;on?e.push(f):i.push(f)}return!1}advanceFully(t,e){let i=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>i)return Ku(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(),zu&&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(zu&&console.log(u+this.stackID(c)+" (via force-reduce)"),this.advanceFully(c,i))break;zu&&(u=this.stackID(c)+" -> ")}for(let t of o.recoverByInsert(l))zu&&console.log(h+this.stackID(t)+" (via recover-insert)"),this.advanceFully(t,i);this.stream.end>o.pos?(a==o.pos&&(a++,l=0),o.recoverByDelete(l,a),zu&&console.log(h+this.stackID(o)+` (via recover-delete ${this.parser.getName(l)})`),Ku(o,i)):(!n||n.scoret;class nf extends _o{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)=>Oo.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=ao;let r=Bu(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 Eu(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 Ju(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=sf(this.data,i+2)}if(e==sf(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=sf(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}overrides(t,e){let i=rf(this.data,this.tokenPrecTable,e);return i<0||rf(this.data,this.tokenPrecTable,t){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]=of(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 lf=295,af=[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],hf=new class{constructor(t){this.start=t.start,this.shift=t.shift||ef,this.reduce=t.reduce||ef,this.reuse=t.reuse||ef,this.hash=t.hash||(()=>0),this.strict=!1!==t.strict}}({start:!1,shift:(t,e)=>5==e||6==e||299==e?t:300==e,strict:!1}),cf=new Gu(((t,e)=>{let{next:i}=t;(125==i||-1==i||e.context)&&e.canShift(297)&&t.acceptToken(297)}),{contextual:!0,fallback:!0}),uf=new Gu(((t,e)=>{let i,{next:n}=t;af.indexOf(n)>-1||(47!=n||47!=(i=t.peek(1))&&42!=i)&&125!=n&&59!=n&&-1!=n&&!e.context&&e.canShift(294)&&t.acceptToken(294)}),{contextual:!0}),ff=new Gu(((t,e)=>{let{next:i}=t;if((43==i||45==i)&&(t.advance(),i==t.next)){t.advance();let i=!e.context&&e.canShift(2);t.acceptToken(i?2:3)}}),{contextual:!0}),Of=new Gu((t=>{for(let e=!1,i=0;;i++){let{next:n}=t;if(n<0){i&&t.acceptToken(lf);break}if(96==n){i?t.acceptToken(lf):t.acceptToken(296,1);break}if(123==n&&e){1==i?t.acceptToken(4,1):t.acceptToken(lf,-1);break}if(10==n&&i){t.advance(),t.acceptToken(lf);break}92==n&&t.advance(),e=36==n,t.advance()}})),df=new Gu(((t,e)=>{if(101==t.next&&e.dialectEnabled(1)){t.advance();for(let e=0;e<6;e++){if(t.next!="xtends".charCodeAt(e))return;t.advance()}t.next>=57&&t.next<=65||t.next>=48&&t.next<=90||95==t.next||t.next>=97&&t.next<=122||t.next>160||t.acceptToken(1)}})),pf=Go({"get set async static":cl.modifier,"for while do if else switch try catch finally return throw break continue default case":cl.controlKeyword,"in of await yield void typeof delete instanceof":cl.operatorKeyword,"let var const function class extends":cl.definitionKeyword,"import export from":cl.moduleKeyword,"with debugger as new":cl.keyword,TemplateString:cl.special(cl.string),super:cl.atom,BooleanLiteral:cl.bool,this:cl.self,null:cl.null,Star:cl.modifier,VariableName:cl.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":cl.function(cl.variableName),VariableDefinition:cl.definition(cl.variableName),Label:cl.labelName,PropertyName:cl.propertyName,PrivatePropertyName:cl.special(cl.propertyName),"CallExpression/MemberExpression/PropertyName":cl.function(cl.propertyName),"FunctionDeclaration/VariableDefinition":cl.function(cl.definition(cl.variableName)),"ClassDeclaration/VariableDefinition":cl.definition(cl.className),PropertyDefinition:cl.definition(cl.propertyName),PrivatePropertyDefinition:cl.definition(cl.special(cl.propertyName)),UpdateOp:cl.updateOperator,LineComment:cl.lineComment,BlockComment:cl.blockComment,Number:cl.number,String:cl.string,ArithOp:cl.arithmeticOperator,LogicOp:cl.logicOperator,BitOp:cl.bitwiseOperator,CompareOp:cl.compareOperator,RegExp:cl.regexp,Equals:cl.definitionOperator,Arrow:cl.function(cl.punctuation),": Spread":cl.punctuation,"( )":cl.paren,"[ ]":cl.squareBracket,"{ }":cl.brace,"InterpolationStart InterpolationEnd":cl.special(cl.brace),".":cl.derefOperator,", ;":cl.separator,"@":cl.meta,TypeName:cl.typeName,TypeDefinition:cl.definition(cl.typeName),"type enum interface implements namespace module declare":cl.definitionKeyword,"abstract global Privacy readonly override":cl.modifier,"is keyof unique infer":cl.operatorKeyword,JSXAttributeValue:cl.attributeValue,JSXText:cl.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":cl.angleBracket,"JSXIdentifier JSXNameSpacedName":cl.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":cl.attributeName,"JSXBuiltin/JSXIdentifier":cl.standard(cl.tagName)}),mf={__proto__:null,export:18,as:23,from:29,default:32,async:37,function:38,this:50,true:58,false:58,null:68,void:72,typeof:76,super:92,new:126,await:143,yield:145,delete:146,class:156,extends:158,public:213,private:213,protected:213,readonly:215,instanceof:234,satisfies:237,in:238,const:240,import:272,keyof:327,unique:331,infer:337,is:373,abstract:393,implements:395,type:397,let:400,var:402,interface:409,enum:413,namespace:419,module:421,declare:425,global:429,for:450,of:459,while:462,with:466,do:470,if:474,else:476,switch:480,case:486,try:492,catch:496,finally:500,return:504,throw:508,break:512,continue:516,debugger:520},gf={__proto__:null,async:113,get:115,set:117,public:175,private:175,protected:175,static:177,abstract:179,override:181,readonly:187,accessor:189,new:377},Qf={__proto__:null,"<":133},bf=nf.deserialize({version:14,states:"$CWO`QdOOO$}QdOOO)WQ(C|O'#ChO)_OWO'#DYO+jQdO'#D_O+zQdO'#DjO$}QdO'#DtO.OQdO'#DzOOQ(C['#ET'#ETO.fQ`O'#EQOOQO'#IW'#IWO.nQ`O'#GgOOQO'#Ee'#EeO.yQ`O'#EdO/OQ`O'#EdO1QQ(C|O'#JQO3nQ(C|O'#JRO4_Q`O'#FSO4dQ!bO'#FkOOQ(C['#F['#F[O4oO#tO'#F[O4}Q&jO'#FrO6bQ`O'#FqOOQ(C['#JR'#JROOQ(CW'#JQ'#JQOOQS'#Jk'#JkO6gQ`O'#H{O6lQ(ChO'#H|OOQS'#Iu'#IuOOQS'#IO'#IOQ`QdOOO$}QdO'#DlO6tQ`O'#GgO6yQ&jO'#CmO7XQ`O'#EcO7dQ`O'#EnO7iQ&jO'#FZO8TQ`O'#GgO8YQ`O'#GkO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[X~O!_dX!e[X!edX'}dX~P'$ZOQ;VOR;VO]gOb=ZOc!`OigOk;VOlgOmgOrgOt;VOv;VO{SO!OgO!PgO!VTO!a;YO!fVO!i;VO!j;VO!k;VO!l;VO!m;VO!p!_O#|!bO$QbO'j'|O'rRO'|WO(Z=XO~O]$SOi$cOk$TOl$SOm$SOr$dOt$eOv;pO{$[O!V$]O!a=aO!f$XO#_;yO#|$iO$i;sO$k;vO$n$jO'j'dO'n$bO'r$UO~O!T;jO!U$ga~O]$SOi$cOk$TOl$SOm$SOr$dOt$eOv;qO{$[O!V$]O!a=bO!f$XO#_;zO#|$iO$i;tO$k;wO$n$jO'j'dO'n$bO'r$UO~O#l(TO~P'*^O!U[X!UdX~P'$ZO!_;^O~O#`;]O~O!_#UO#`;]O~O#T;nO~O#k;cO~O#T;{O!T(SX!U(SX~O#T;nO!T(QX!U(QX~O#`;|O~Oe TypeParamList TypeDefinition ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation NullType null VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression await yield delete LogicOp BitOp ParenthesizedExpression ClassExpression class extends ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression 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 MethodDeclaration 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",maxTerm:345,context:hf,nodeProps:[["closedBy",4,"InterpolationEnd",43,"]",53,"}",68,")",140,"JSXSelfCloseEndTag JSXEndTag",156,"JSXEndTag"],["group",-26,8,15,17,60,195,199,202,203,205,208,211,222,224,230,232,234,236,239,245,251,253,255,257,259,261,262,"Statement",-30,12,13,25,28,29,34,44,46,47,49,54,62,70,76,77,99,100,109,110,127,130,132,133,134,135,137,138,158,159,161,"Expression",-23,24,26,30,33,35,37,162,164,166,167,169,170,171,173,174,175,177,178,179,189,191,193,194,"Type",-3,81,92,98,"ClassItem"],["openedBy",31,"InterpolationStart",48,"[",52,"{",67,"(",139,"JSXStartTag",151,"JSXStartTag JSXStartCloseTag"]],propSources:[pf],skippedNodes:[0,5,6],repeatNodeCount:29,tokenData:"#2k~R!bOX%ZXY%uYZ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p;'S>l;'S;=`Ik;=`<%lBt<%lO>l1iF]]$Z,U$`W]&ZOYGUYZ%ZZwGUwx4hx!^GU!^!_Bt!_#OGU#O#PHU#P#oGU#o#pBt#p;'SGU;'S;=`Ie<%lOGU&cG]]$`W]&ZOYGUYZ%ZZwGUwx4hx!^GU!^!_Bt!_#OGU#O#PHU#P#oGU#o#pBt#p;'SGU;'S;=`Ie<%lOGU&cHZW$`WO!^GU!^!_Bt!_#oGU#o#pBt#p;'SGU;'S;=`Hs;=`<%lBt<%lOGU&cHxX]&ZOYBtZwBtwx/px#OBt#O#PCc#P;'SBt;'S;=`Da;=`<%lGU<%lOBt&cIhP;=`<%lGU1iIpX]&ZOYBtZwBtwx/px#OBt#O#PCc#P;'SBt;'S;=`Da;=`<%l>l<%lOBt1iJ`P;=`<%l>l,TJjT!f+{$`WO!^%Z!_#o%Z#p;'S%Z;'S;=`%o<%lO%Z$PKQT!e#w$`WO!^%Z!_#o%Z#p;'S%Z;'S;=`%o<%lO%Z)ZKjW$`W'k#e#f&lOz%Zz{LS{!^%Z!_!`q#P#Q!-n#Q#o!;l#o#p!6|#p;'S!;l;'S;=`!?i<%lO!;l7Z!q#P#Q!-n#Q#o!;l#o#p!6|#p;'S!;l;'S;=`!?i<%lO!;l7Z!={[$`WU7ROY!+TYZ%ZZ!^!+T!^!_!)o!_#O!+T#O#P!,O#P#Q!&V#Q#o!+T#o#p!)o#p;'S!+T;'S;=`!,p<%lO!+T7Z!>vZ$`WOY!;lYZ!.wZz!;lz{!mf[t]||-1},{term:311,get:t=>gf[t]||-1},{term:65,get:t=>Qf[t]||-1}],tokenPrec:13429}),Sf=[iu("function ${name}(${params}) {\n\t${}\n}",{label:"function",detail:"definition",type:"keyword"}),iu("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n\t${}\n}",{label:"for",detail:"loop",type:"keyword"}),iu("for (let ${name} of ${collection}) {\n\t${}\n}",{label:"for",detail:"of loop",type:"keyword"}),iu("do {\n\t${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),iu("while (${}) {\n\t${}\n}",{label:"while",detail:"loop",type:"keyword"}),iu("try {\n\t${}\n} catch (${error}) {\n\t${}\n}",{label:"try",detail:"/ catch block",type:"keyword"}),iu("if (${}) {\n\t${}\n}",{label:"if",detail:"block",type:"keyword"}),iu("if (${}) {\n\t${}\n} else {\n\t${}\n}",{label:"if",detail:"/ else block",type:"keyword"}),iu("class ${name} {\n\tconstructor(${params}) {\n\t\t${}\n\t}\n}",{label:"class",detail:"definition",type:"keyword"}),iu('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),iu('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],yf=new qo,wf=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function vf(t){return(e,i)=>{let n=e.node.getChild("VariableDefinition");return n&&i(n,t),!0}}const xf=["FunctionDeclaration"],kf={FunctionDeclaration:vf("function"),ClassDeclaration:vf("class"),ClassExpression:()=>!0,EnumDeclaration:vf("constant"),TypeAliasDeclaration:vf("type"),NamespaceDeclaration:vf("namespace"),VariableDefinition(t,e){t.matchContext(xf)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function $f(t,e){let i=yf.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(Qo.IncludeAnonymous).iterate((e=>{if(s)s=!1;else if(e.name){let t=kf[e.name];if(t&&t(e,r)||wf.has(e.name))return!1}else if(e.to-e.from>8192){for(let i of $f(t,e.node))n.push(i);return!1}})),yf.set(e,n),n}const Tf=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Pf=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName"];function Cf(t){let e=ml(t.state).resolveInner(t.pos,-1);if(Pf.indexOf(e.name)>-1)return null;let i="VariableName"==e.name||e.to-e.from<20&&Tf.test(t.state.sliceDoc(e.from,e.to));if(!i&&!t.explicit)return null;let n=[];for(let i=e;i;i=i.parent)wf.has(i.name)&&(n=n.concat($f(t.state.doc,i)));return{options:n,from:i?e.from:t.pos,validFor:Tf}}const Zf=pl.define({name:"javascript",parser:bf.configure({props:[Xl.add({IfStatement:Wl({except:/^\s*({|else\b)/}),TryStatement:Wl({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:Dl({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":Wl({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}),Gl.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression":function(t){let e=t.firstChild,i=t.lastChild;return e&&e.to({from:t.from+2,to:t.to-2})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Af=Zf.configure({dialect:"ts"},"typescript"),Rf=Zf.configure({dialect:"jsx"}),Xf=Zf.configure({dialect:"jsx ts"},"typescript"),Uf="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 qf(t={}){let e=t.jsx?t.typescript?Xf:Rf:t.typescript?Af:Zf;return new $l(e,[Zf.data.of({autocomplete:(i=Pf,n=uc(Sf.concat(Uf)),t=>{for(let e=ml(t.state).resolveInner(t.pos,-1);e;e=e.parent)if(i.indexOf(e.name)>-1)return null;return n(t)})}),Zf.data.of({autocomplete:Cf}),t.jsx?Mf:[]]);var i,n}function Vf(t,e,i=t.length){if(!e)return"";let n=e.getChild("JSXIdentifier");return n?t.sliceString(n.from,Math.min(n.to,i)):""}const _f="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),Mf=Ps.inputHandler.of(((t,e,i,n)=>{if((_f?t.composing:t.compositionStarted)||t.state.readOnly||e!=i||">"!=n&&"/"!=n||!Zf.isActiveAt(t.state,e,-1))return!1;let{state:s}=t,r=s.changeByRange((t=>{var e,i,r;let o,{head:l}=t,a=ml(s).resolveInner(l,-1);if("JSXStartTag"==a.name&&(a=a.parent),">"==n&&"JSXFragmentTag"==a.name)return{range:R.cursor(l+1),changes:{from:l,insert:"><>"}};if(">"==n&&"JSXIdentifier"==a.name){if("JSXEndTag"!=(null===(i=null===(e=a.parent)||void 0===e?void 0:e.lastChild)||void 0===i?void 0:i.name)&&(o=Vf(s.doc,a.parent,l)))return{range:R.cursor(l+1),changes:{from:l,insert:`>`}}}else if("/"==n&&"JSXFragmentTag"==a.name){let t=a.parent,e=null==t?void 0:t.parent;if(t.from==l-1&&"JSXEndTag"!=(null===(r=e.lastChild)||void 0===r?void 0:r.name)&&(o=Vf(s.doc,null==e?void 0:e.firstChild,l))){let t=`/${o}>`;return{range:R.cursor(l+t.length),changes:{from:l,insert:t}}}}return{range:t}}));return!r.changes.empty&&(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)}));return t.createEditorState=function(t,e={}){let i=[Lr(),Hr,hr(),La(),aa(),zs(),Pl.of(" "),vt.allowMultipleSelections.of(!0),vt.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,l=-1,a=[];for(let{head:t}of o.selection.ranges){let e=o.doc.lineAt(t);if(e.from==l)continue;l=e.from;let i=Al(o,e.from);if(null==i)continue;let n=/^\s*/.exec(e.text)[0],s=Zl(o,i);n!=s&&a.push({from:e.from,to:e.from+n.length,insert:s})}return a.length?[t,{changes:a,sequential:!0}]:t})),$a(),[Ou,au],wu(),Qr(),yr(),dr,io(),Vs.of([ac,...du,...lc,...ch,...ea,...vu]),qf(),da(ga,{fallback:!0})];return e.oneDark&&i.push(Xu),vt.create({doc:t,extensions:i})},t.createEditorView=function(t,e){return new Ps({state:t,parent:e})},t}({});