import{d as dc,Y as lt,Z as pc,cx as gc,a5 as ho,a3 as fo,cy as co,ae as uo,cj as mc,b as rn,f as bc,o as Pe,c as Xe,h as _,w as be,a as x,l as D,ab as Oo,k as Dt,af as di,X as bt,i as Ce,t as sn,j as It,au as on,aZ as hr,bc as Sc,F as ln,p as po,g as go,s as Qc,n as fr,aS as kc,e as wc,cz as yc,cA as Pc,cB as xc,cC as $c,cD as vc,cE as Zc,z as Tc,cF as Rc,a8 as Xc,cG as Cc,cH as Ac,_ as Wc}from"./C6MRUCyE.js";import{M as cr}from"./CeaQViss.js";import{B as Ae}from"./DqN2GKf3.js";import{C as Yc}from"./EJjQs73W.js";import{F as Mc}from"./DHTte2-5.js";import{_ as Ec}from"./D9_N0jqg.js";class I{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=Jt(this,e,t);let n=[];return this.decompose(0,e,n,2),i.length&&i.decompose(0,i.length,n,3),this.decompose(t,this.length,n,1),Fe.from(n,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Jt(this,e,t);let i=[];return this.decompose(e,t,i,0),Fe.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),n=new vi(this),s=new vi(e);for(let o=t,l=t;;){if(n.next(o),s.next(o),o=0,n.lineBreak!=s.lineBreak||n.done!=s.done||n.value!=s.value)return!1;if(l+=n.value.length,n.done||l>=i)return!0}}iter(e=1){return new vi(this,e)}iterRange(e,t=this.length){return new da(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let n=this.line(e).from;i=this.iterRange(n,Math.max(n,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new pa(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?I.empty:e.length<=32?new oe(e):Fe.from(oe.split(e,[]))}}class oe extends I{constructor(e,t=qc(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,n){for(let s=0;;s++){let o=this.text[s],l=n+o.length;if((t?i:l)>=e)return new _c(n,l,i,o);n=l+1,i++}}decompose(e,t,i,n){let s=e<=0&&t>=this.length?this:new oe(mo(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(n&1){let o=i.pop(),l=$n(s.text,o.text.slice(),0,s.length);if(l.length<=32)i.push(new oe(l,o.length+s.length));else{let a=l.length>>1;i.push(new oe(l.slice(0,a)),new oe(l.slice(a)))}}else i.push(s)}replace(e,t,i){if(!(i instanceof oe))return super.replace(e,t,i);[e,t]=Jt(this,e,t);let n=$n(this.text,$n(i.text,mo(this.text,0,e)),t),s=this.length+i.length-(t-e);return n.length<=32?new oe(n,s):Fe.from(oe.split(n,[]),s)}sliceString(e,t=this.length,i=` `){[e,t]=Jt(this,e,t);let n="";for(let s=0,o=0;s<=t&&oe&&o&&(n+=i),es&&(n+=l.slice(Math.max(0,e-s),t-s)),s=a+1}return n}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],n=-1;for(let s of e)i.push(s),n+=s.length+1,i.length==32&&(t.push(new oe(i,n)),i=[],n=-1);return n>-1&&t.push(new oe(i,n)),t}}class Fe extends I{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,n){for(let s=0;;s++){let o=this.children[s],l=n+o.length,a=i+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,i,n);n=l+1,i=a+1}}decompose(e,t,i,n){for(let s=0,o=0;o<=t&&s=o){let h=n&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?i.push(l):l.decompose(e-o,t-o,i,h)}o=a+1}}replace(e,t,i){if([e,t]=Jt(this,e,t),i.lines=s&&t<=l){let a=o.replace(e-s,t-s,i),h=this.lines-o.lines+a.lines;if(a.lines>4&&a.lines>h>>6){let f=this.children.slice();return f[n]=a,new Fe(f,this.length-(t-e)+i.length)}return super.replace(s,l,a)}s=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=` `){[e,t]=Jt(this,e,t);let n="";for(let s=0,o=0;se&&s&&(n+=i),eo&&(n+=l.sliceString(e-o,t-o,i)),o=a+1}return n}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Fe))return 0;let i=0,[n,s,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;n+=t,s+=t){if(n==o||s==l)return i;let a=this.children[n],h=e.children[s];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,n)=>i+n.length+1,-1)){let i=0;for(let O of e)i+=O.lines;if(i<32){let O=[];for(let d of e)d.flatten(O);return new oe(O,t)}let n=Math.max(32,i>>5),s=n<<1,o=n>>1,l=[],a=0,h=-1,f=[];function c(O){let d;if(O.lines>s&&O instanceof Fe)for(let g of O.children)c(g);else O.lines>o&&(a>o||!a)?(u(),l.push(O)):O instanceof oe&&a&&(d=f[f.length-1])instanceof oe&&O.lines+d.lines<=32?(a+=O.lines,h+=O.length+1,f[f.length-1]=new oe(d.text.concat(O.text),d.length+1+O.length)):(a+O.lines>n&&u(),a+=O.lines,h+=O.length+1,f.push(O))}function u(){a!=0&&(l.push(f.length==1?f[0]:Fe.from(f,h)),h=-1,a=f.length=0)}for(let O of e)c(O);return u(),l.length==1?l[0]:new Fe(l,t)}}I.empty=new oe([""],0);function qc(r){let e=-1;for(let t of r)e+=t.length+1;return e}function $n(r,e,t=0,i=1e9){for(let n=0,s=0,o=!0;s=t&&(a>i&&(l=l.slice(0,i-n)),n0?1:(e instanceof oe?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,n=this.nodes[i],s=this.offsets[i],o=s>>1,l=n instanceof oe?n.text.length:n.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=` `,this;e--}else if(n instanceof oe){let a=n.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=n.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof oe?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class da{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new vi(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:n}=this.cursor.next(e);return this.pos+=(n.length+e)*t,this.value=n.length<=i?n:t<0?n.slice(n.length-i):n.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class pa{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:n}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(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}}typeof Symbol<"u"&&(I.prototype[Symbol.iterator]=function(){return this.iter()},vi.prototype[Symbol.iterator]=da.prototype[Symbol.iterator]=pa.prototype[Symbol.iterator]=function(){return this});let _c=class{constructor(e,t,i,n){this.from=e,this.to=t,this.number=i,this.text=n}get length(){return this.to-this.from}};function Jt(r,e,t){return e=Math.max(0,Math.min(r.length,e)),[e,Math.max(e,Math.min(r.length,t))]}let Lt="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(r=>r?parseInt(r,36):1);for(let r=1;rr)return Lt[e-1]<=r;return!1}function bo(r){return r>=127462&&r<=127487}const So=8205;function Ke(r,e,t=!0,i=!0){return(t?ga:Vc)(r,e,i)}function ga(r,e,t){if(e==r.length)return e;e&&ma(r.charCodeAt(e))&&ba(r.charCodeAt(e-1))&&e--;let i=vn(r,e);for(e+=_r(i);e=0&&bo(vn(r,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function Vc(r,e,t){for(;e>0;){let i=ga(r,e-2,t);if(i=56320&&r<57344}function ba(r){return r>=55296&&r<56320}function vn(r,e){let t=r.charCodeAt(e);if(!ba(t)||e+1==r.length)return t;let i=r.charCodeAt(e+1);return ma(i)?(t-55296<<10)+(i-56320)+65536:t}function _r(r){return r<65536?1:2}const zr=/\r\n?|\n/;var we=function(r){return r[r.Simple=0]="Simple",r[r.TrackDel=1]="TrackDel",r[r.TrackBefore=2]="TrackBefore",r[r.TrackAfter=3]="TrackAfter",r}(we||(we={}));class it{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return s+(e-n);s+=l}else{if(i!=we.Simple&&h>=e&&(i==we.TrackDel&&ne||i==we.TrackBefore&&ne))return null;if(h>e||h==e&&t<0&&!l)return e==n||t<0?s:s+a;s+=a}n=h}if(e>n)throw new RangeError(`Position ${e} is out of range for changeset of length ${n}`);return s}touchesRange(e,t=e){for(let i=0,n=0;i=0&&n<=t&&l>=e)return nt?"cover":!0;n=l}return!1}toString(){let e="";for(let t=0;t=0?":"+n:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new it(e)}static create(e){return new it(e)}}class he extends it{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Vr(this,(t,i,n,s,o)=>e=e.replace(n,n+(i-t),o),!1),e}mapDesc(e,t=!1){return Ur(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let n=0,s=0;n=0){t[n]=l,t[n+1]=o;let a=n>>1;for(;i.length0&&Pt(i,t,s.text),s.forward(f),l+=f}let h=e[o++];for(;l>1].toJSON()))}return e}static of(e,t,i){let n=[],s=[],o=0,l=null;function a(f=!1){if(!f&&!n.length)return;ou||c<0||u>t)throw new RangeError(`Invalid change range ${c} to ${u} (in doc of length ${t})`);let d=O?typeof O=="string"?I.of(O.split(i||zr)):O:I.empty,g=d.length;if(c==u&&g==0)return;co&&Se(n,c-o,-1),Se(n,u-c,g),Pt(s,n,d),o=u}}return h(e),a(!l),l}static empty(e){return new he(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let n=0;nl&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;i.length=0&&t<=0&&t==r[n+1]?r[n]+=e:e==0&&r[n]==0?r[n+1]+=t:i?(r[n]+=e,r[n+1]+=t):r.push(e,t)}function Pt(r,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i>1])),!(t||o==r.sections.length||r.sections[o+1]<0);)l=r.sections[o++],a=r.sections[o++];e(n,h,s,f,c),n=h,s=f}}}function Ur(r,e,t,i=!1){let n=[],s=i?[]:null,o=new Ai(r),l=new Ai(e);for(let a=-1;;)if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);Se(n,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len=0&&a=0){let h=0,f=o.len;for(;f;)if(l.ins==-1){let c=Math.min(f,l.len);h+=c,f-=c,l.forward(c)}else if(l.ins==0&&l.lena||o.ins>=0&&o.len>a)&&(l||i.length>h),s.forward2(a),o.forward(a)}}}}class Ai{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?I.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?I.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Yt{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let i,n;return this.empty?i=n=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),n=e.mapPos(this.to,-1)),i==this.from&&n==this.to?this:new Yt(i,n,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return P.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return P.range(this.anchor,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return P.range(e.anchor,e.head)}static create(e,t,i){return new Yt(e,t,i)}}class P{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:P.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;ie.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new P(e.ranges.map(t=>Yt.fromJSON(t)),e.main)}static single(e,t=e){return new P([P.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,n=0;ne?8:0)|s)}static normalized(e,t=0){let i=e[t];e.sort((n,s)=>n.from-s.from),t=e.indexOf(i);for(let n=1;ns.head?P.range(a,l):P.range(l,a))}}return new P(e,t)}}function Qa(r,e){for(let t of r.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let As=0;class W{constructor(e,t,i,n,s){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=n,this.id=As++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new W(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:Ws),!!e.static,e.enables)}of(e){return new Zn([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Zn(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Zn(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function Ws(r,e){return r==e||r.length==e.length&&r.every((t,i)=>t===e[i])}class Zn{constructor(e,t,i,n){this.dependencies=e,this.facet=t,this.type=i,this.value=n,this.id=As++}dynamicSlot(e){var t;let i=this.value,n=this.facet.compareInput,s=this.id,o=e[s]>>1,l=this.type==2,a=!1,h=!1,f=[];for(let c of this.dependencies)c=="doc"?a=!0:c=="selection"?h=!0:((t=e[c.id])!==null&&t!==void 0?t:1)&1||f.push(e[c.id]);return{create(c){return c.values[o]=i(c),1},update(c,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||Dr(c,f)){let O=i(c);if(l?!Qo(O,c.values[o],n):!n(O,c.values[o]))return c.values[o]=O,1}return 0},reconfigure:(c,u)=>{let O,d=u.config.address[s];if(d!=null){let g=qn(u,d);if(this.dependencies.every(m=>m instanceof W?u.facet(m)===c.facet(m):m instanceof dt?u.field(m,!1)==c.field(m,!1):!0)||(l?Qo(O=i(c),g,n):n(O=i(c),g)))return c.values[o]=g,0}else O=i(c);return c.values[o]=O,1}}}}function Qo(r,e,t){if(r.length!=e.length)return!1;for(let i=0;ir[a.id]),n=t.map(a=>a.type),s=i.filter(a=>!(a&1)),o=r[e.id]>>1;function l(a){let h=[];for(let f=0;fi===n),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(ko).find(i=>i.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,n)=>{let s=i.values[t],o=this.updateF(s,n);return this.compareF(s,o)?0:(i.values[t]=o,1)},reconfigure:(i,n)=>n.config.address[this.id]!=null?(i.values[t]=n.field(this),0):(i.values[t]=this.create(i),1)}}init(e){return[this,ko.of({field:this,create:e})]}get extension(){return this}}const Wt={lowest:4,low:3,default:2,high:1,highest:0};function pi(r){return e=>new ka(e,r)}const ir={highest:pi(Wt.highest),high:pi(Wt.high),default:pi(Wt.default),low:pi(Wt.low),lowest:pi(Wt.lowest)};class ka{constructor(e,t){this.inner=e,this.prec=t}}class ei{of(e){return new Ir(this,e)}reconfigure(e){return ei.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Ir{constructor(e,t){this.compartment=e,this.inner=t}}class En{constructor(e,t,i,n,s,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=n,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,i){let n=[],s=Object.create(null),o=new Map;for(let u of Dc(e,t,o))u instanceof dt?n.push(u):(s[u.facet.id]||(s[u.facet.id]=[])).push(u);let l=Object.create(null),a=[],h=[];for(let u of n)l[u.id]=h.length<<1,h.push(O=>u.slot(O));let f=i==null?void 0:i.config.facets;for(let u in s){let O=s[u],d=O[0].facet,g=f&&f[u]||[];if(O.every(m=>m.type==0))if(l[d.id]=a.length<<1|1,Ws(g,O))a.push(i.facet(d));else{let m=d.combine(O.map(b=>b.value));a.push(i&&d.compare(m,i.facet(d))?i.facet(d):m)}else{for(let m of O)m.type==0?(l[m.id]=a.length<<1|1,a.push(m.value)):(l[m.id]=h.length<<1,h.push(b=>m.dynamicSlot(b)));l[d.id]=h.length<<1,h.push(m=>Uc(m,d,O))}}let c=h.map(u=>u(l));return new En(e,o,c,l,a,s)}}function Dc(r,e,t){let i=[[],[],[],[],[]],n=new Map;function s(o,l){let a=n.get(o);if(a!=null){if(a<=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof Ir&&t.delete(o.compartment)}if(n.set(o,l),Array.isArray(o))for(let h of o)s(h,l);else if(o instanceof Ir){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),s(h,l)}else if(o instanceof ka)s(o.inner,o.prec);else if(o instanceof dt)i[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof Zn)i[l].push(o),o.facet.extensions&&s(o.facet.extensions,Wt.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(h,l)}}return s(r,Wt.default),i.reduce((o,l)=>o.concat(l))}function Zi(r,e){if(e&1)return 2;let t=e>>1,i=r.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;r.status[t]=4;let n=r.computeSlot(r,r.config.dynamicSlots[t]);return r.status[t]=2|n}function qn(r,e){return e&1?r.config.staticValues[e>>1]:r.values[e>>1]}const wa=W.define(),jr=W.define({combine:r=>r.some(e=>e),static:!0}),ya=W.define({combine:r=>r.length?r[0]:void 0,static:!0}),Pa=W.define(),xa=W.define(),$a=W.define(),va=W.define({combine:r=>r.length?r[0]:!1});class pt{constructor(e,t){this.type=e,this.value=t}static define(){return new Ic}}class Ic{of(e){return new pt(this,e)}}class jc{constructor(e){this.map=e}of(e){return new ie(this,e)}}class ie{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new ie(this.type,t)}is(e){return this.type==e}static define(e={}){return new jc(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let n of e){let s=n.map(t);s&&i.push(s)}return i}}ie.reconfigure=ie.define();ie.appendConfig=ie.define();class ae{constructor(e,t,i,n,s,o){this.startState=e,this.changes=t,this.selection=i,this.effects=n,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,i&&Qa(i,t.newLength),s.some(l=>l.type==ae.time)||(this.annotations=s.concat(ae.time.of(Date.now())))}static create(e,t,i,n,s,o){return new ae(e,t,i,n,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(ae.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}ae.time=pt.define();ae.userEvent=pt.define();ae.addToHistory=pt.define();ae.remote=pt.define();function Bc(r,e){let t=[];for(let i=0,n=0;;){let s,o;if(i=r[i]))s=r[i++],o=r[i++];else if(n=0;n--){let s=i[n](r);s instanceof ae?r=s:Array.isArray(s)&&s.length==1&&s[0]instanceof ae?r=s[0]:r=Ta(e,Nt(s),!1)}return r}function Nc(r){let e=r.startState,t=e.facet($a),i=r;for(let n=t.length-1;n>=0;n--){let s=t[n](r);s&&Object.keys(s).length&&(i=Za(i,Br(e,s,r.changes.newLength),!0))}return i==r?r:ae.create(e,r.changes,r.selection,i.effects,i.annotations,i.scrollIntoView)}const Gc=[];function Nt(r){return r==null?Gc:Array.isArray(r)?r:[r]}var ht=function(r){return r[r.Word=0]="Word",r[r.Space=1]="Space",r[r.Other=2]="Other",r}(ht||(ht={}));const Fc=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Lr;try{Lr=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Hc(r){if(Lr)return Lr.test(r);for(let e=0;e"€"&&(t.toUpperCase()!=t.toLowerCase()||Fc.test(t)))return!0}return!1}function Kc(r){return e=>{if(!/\S/.test(e))return ht.Space;if(Hc(e))return ht.Word;for(let t=0;t-1)return ht.Word;return ht.Other}}class V{constructor(e,t,i,n,s,o){this.config=e,this.doc=t,this.selection=i,this.values=n,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let l=0;ln.set(h,a)),t=null),n.set(l.value.compartment,l.value.extension)):l.is(ie.reconfigure)?(t=null,i=l.value):l.is(ie.appendConfig)&&(t=null,i=Nt(i).concat(l.value));let s;t?s=e.startState.values.slice():(t=En.resolve(i,n,this),s=new V(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=e.startState.facet(jr)?e.newSelection:e.newSelection.asSingle();new V(t,e.newDoc,o,s,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:P.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),n=this.changes(i.changes),s=[i.range],o=Nt(i.effects);for(let l=1;lo.spec.fromJSON(l,a)))}}return V.create({doc:e.doc,selection:P.fromJSON(e.selection),extensions:t.extensions?n.concat([t.extensions]):n})}static create(e={}){let t=En.resolve(e.extensions||[],new Map),i=e.doc instanceof I?e.doc:I.of((e.doc||"").split(t.staticFacet(V.lineSeparator)||zr)),n=e.selection?e.selection instanceof P?e.selection:P.single(e.selection.anchor,e.selection.head):P.single(0);return Qa(n,i.length),t.staticFacet(jr)||(n=n.asSingle()),new V(t,i,n,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(V.tabSize)}get lineBreak(){return this.facet(V.lineSeparator)||` `}get readOnly(){return this.facet(va)}phrase(e,...t){for(let i of this.facet(V.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,n)=>{if(n=="$")return"$";let s=+(n||1);return!s||s>t.length?i:t[s-1]})),e}languageDataAt(e,t,i=-1){let n=[];for(let s of this.facet(wa))for(let o of s(this,t,i))Object.prototype.hasOwnProperty.call(o,e)&&n.push(o[e]);return n}charCategorizer(e){return Kc(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:i,length:n}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-i,l=e-i;for(;o>0;){let a=Ke(t,o,!1);if(s(t.slice(a,o))!=ht.Word)break;o=a}for(;lr.length?r[0]:4});V.lineSeparator=ya;V.readOnly=va;V.phrases=W.define({compare(r,e){let t=Object.keys(r),i=Object.keys(e);return t.length==i.length&&t.every(n=>r[n]==e[n])}});V.languageData=wa;V.changeFilter=Pa;V.transactionFilter=xa;V.transactionExtender=$a;ei.reconfigure=ie.define();function Jc(r,e,t={}){let i={};for(let n of r)for(let s of Object.keys(n)){let o=n[s],l=i[s];if(l===void 0)i[s]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(t,s))i[s]=t[s](l,o);else throw new Error("Config merge conflict for field "+s)}for(let n in e)i[n]===void 0&&(i[n]=e[n]);return i}class qt{eq(e){return this==e}range(e,t=e){return Nr.create(e,t,this)}}qt.prototype.startSide=qt.prototype.endSide=0;qt.prototype.point=!1;qt.prototype.mapMode=we.TrackDel;let Nr=class Ra{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new Ra(e,t,i)}};function Gr(r,e){return r.from-e.from||r.value.startSide-e.value.startSide}class Ys{constructor(e,t,i,n){this.from=e,this.to=t,this.value=i,this.maxPoint=n}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,n=0){let s=i?this.to:this.from;for(let o=n,l=s.length;;){if(o==l)return o;let a=o+l>>1,h=s[a]-e||(i?this.value[a].endSide:this.value[a].startSide)-t;if(a==o)return h>=0?o:l;h>=0?l=a:o=a+1}}between(e,t,i,n){for(let s=this.findIndex(t,-1e9,!0),o=this.findIndex(i,1e9,!1,s);sO||u==O&&h.startSide>0&&h.endSide<=0)continue;(O-u||h.endSide-h.startSide)<0||(o<0&&(o=u),h.point&&(l=Math.max(l,O-u)),i.push(h),n.push(u-o),s.push(O-o))}return{mapped:i.length?new Ys(n,s,i,l):null,pos:o}}}class J{constructor(e,t,i,n){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=n}static create(e,t,i,n){return new J(e,t,i,n)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:i=!1,filterFrom:n=0,filterTo:s=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(i&&(t=t.slice().sort(Gr)),this.isEmpty)return t.length?J.of(t):this;let l=new Xa(this,null,-1).goto(0),a=0,h=[],f=new _n;for(;l.value||a=0){let c=t[a++];f.addInner(c.from,c.to,c.value)||h.push(c)}else l.rangeIndex==1&&l.chunkIndexthis.chunkEnd(l.chunkIndex)||sl.to||s=s&&e<=s+o.length&&o.between(s,e-s,t-s,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return Wi.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Wi.from(e).goto(t)}static compare(e,t,i,n,s=-1){let o=e.filter(c=>c.maxPoint>0||!c.isEmpty&&c.maxPoint>=s),l=t.filter(c=>c.maxPoint>0||!c.isEmpty&&c.maxPoint>=s),a=wo(o,l,i),h=new gi(o,a,s),f=new gi(l,a,s);i.iterGaps((c,u,O)=>yo(h,c,f,u,O,n)),i.empty&&i.length==0&&yo(h,0,f,0,0,n)}static eq(e,t,i=0,n){n==null&&(n=999999999);let s=e.filter(f=>!f.isEmpty&&t.indexOf(f)<0),o=t.filter(f=>!f.isEmpty&&e.indexOf(f)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let l=wo(s,o),a=new gi(s,l,0).goto(i),h=new gi(o,l,0).goto(i);for(;;){if(a.to!=h.to||!Fr(a.active,h.active)||a.point&&(!h.point||!a.point.eq(h.point)))return!1;if(a.to>n)return!0;a.next(),h.next()}}static spans(e,t,i,n,s=-1){let o=new gi(e,null,s).goto(t),l=t,a=o.openStart;for(;;){let h=Math.min(o.to,i);if(o.point){let f=o.activeForPoint(o.to),c=o.pointFroml&&(n.span(l,h,o.active,a),a=o.openEnd(h));if(o.to>i)return a+(o.point&&o.to>i?1:0);l=o.to,o.next()}}static of(e,t=!1){let i=new _n;for(let n of e instanceof Nr?[e]:t?eu(e):e)i.add(n.from,n.to,n.value);return i.finish()}static join(e){if(!e.length)return J.empty;let t=e[e.length-1];for(let i=e.length-2;i>=0;i--)for(let n=e[i];n!=J.empty;n=n.nextLayer)t=new J(n.chunkPos,n.chunk,t,Math.max(n.maxPoint,t.maxPoint));return t}}J.empty=new J([],[],null,-1);function eu(r){if(r.length>1)for(let e=r[0],t=1;t0)return r.slice().sort(Gr);e=i}return r}J.empty.nextLayer=J.empty;class _n{finishChunk(e){this.chunks.push(new Ys(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,i){this.addInner(e,t,i)||(this.nextLayer||(this.nextLayer=new _n)).add(e,t,i)}addInner(e,t,i){let n=e-this.lastTo||i.startSide-this.last.endSide;if(n<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return n<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=i,this.lastFrom=e,this.lastTo=t,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let i=t.value.length-1;return this.last=t.value[i],this.lastFrom=t.from[i]+e,this.lastTo=t.to[i]+e,!0}finish(){return this.finishInner(J.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=J.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function wo(r,e,t){let i=new Map;for(let s of r)for(let o=0;o=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=i&&n.push(new Xa(o,t,i,s));return n.length==1?n[0]:new Wi(n)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let i of this.heap)i.goto(e,t);for(let i=this.heap.length>>1;i>=0;i--)ur(this.heap,i);return this.next(),this}forward(e,t){for(let i of this.heap)i.forward(e,t);for(let i=this.heap.length>>1;i>=0;i--)ur(this.heap,i);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),ur(this.heap,0)}}}function ur(r,e){for(let t=r[e];;){let i=(e<<1)+1;if(i>=r.length)break;let n=r[i];if(i+1=0&&(n=r[i+1],i++),t.compare(n)<0)break;r[i]=t,r[e]=n,e=i}}class gi{constructor(e,t,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=Wi.from(e,t,i)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){an(this.active,e),an(this.activeTo,e),an(this.activeRank,e),this.minActive=Po(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:n,rank:s}=this.cursor;for(;t0;)t++;hn(this.active,t,i),hn(this.activeTo,t,n),hn(this.activeRank,t,s),e&&hn(e,t,this.cursor.from),this.minActive=Po(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let n=this.minActive;if(n>-1&&(this.activeTo[n]-this.cursor.from||this.active[n].endSide-this.cursor.startSide)<0){if(this.activeTo[n]>e){this.to=this.activeTo[n],this.endSide=this.active[n].endSide;break}this.removeActive(n),i&&an(i,n)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(i),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from=0&&i[n]=0&&!(this.activeRank[i]e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&t.push(this.active[i]);return t.reverse()}openEnd(e){let t=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)t++;return t}}function yo(r,e,t,i,n,s){r.goto(e),t.goto(i);let o=i+n,l=i,a=i-e;for(;;){let h=r.to+a-t.to||r.endSide-t.endSide,f=h<0?r.to+a:t.to,c=Math.min(f,o);if(r.point||t.point?r.point&&t.point&&(r.point==t.point||r.point.eq(t.point))&&Fr(r.activeForPoint(r.to),t.activeForPoint(t.to))||s.comparePoint(l,c,r.point,t.point):c>l&&!Fr(r.active,t.active)&&s.compareRange(l,c,r.active,t.active),f>o)break;l=f,h<=0&&r.next(),h>=0&&t.next()}}function Fr(r,e){if(r.length!=e.length)return!1;for(let t=0;t=e;i--)r[i+1]=r[i];r[e]=t}function Po(r,e){let t=-1,i=1e9;for(let n=0;n=e)return n;if(n==r.length)break;s+=r.charCodeAt(n)==9?t-s%t:1,n=Ke(r,n)}return i===!0?-1:r.length}const Hr="ͼ",xo=typeof Symbol>"u"?"__"+Hr:Symbol.for(Hr),Kr=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),$o=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class vt{constructor(e,t){this.rules=[];let{finish:i}=t||{};function n(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,l,a,h){let f=[],c=/^@(\w+)\b/.exec(o[0]),u=c&&c[1]=="keyframes";if(c&&l==null)return a.push(o[0]+";");for(let O in l){let d=l[O];if(/&/.test(O))s(O.split(/,\s*/).map(g=>o.map(m=>g.replace(/&/,m))).reduce((g,m)=>g.concat(m)),d,a);else if(d&&typeof d=="object"){if(!c)throw new RangeError("The value of a property ("+O+") should be a primitive value.");s(n(O),d,f,u)}else d!=null&&f.push(O.replace(/_.*/,"").replace(/[A-Z]/g,g=>"-"+g.toLowerCase())+": "+d+";")}(f.length||u)&&a.push((i&&!c&&!h?o.map(i):o).join(", ")+" {"+f.join(" ")+"}")}for(let o in e)s(n(o),e[o],this.rules)}getRules(){return this.rules.join(` `)}static newName(){let e=$o[xo]||1;return $o[xo]=e+1,Hr+e.toString(36)}static mount(e,t,i){let n=e[Kr],s=i&&i.nonce;n?s&&n.setNonce(s):n=new iu(e,s),n.mount(Array.isArray(t)?t:[t],e)}}let vo=new Map;class iu{constructor(e,t){let i=e.ownerDocument||e,n=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&n.CSSStyleSheet){let s=vo.get(i);if(s)return e[Kr]=s;this.sheet=new n.CSSStyleSheet,vo.set(i,this)}else this.styleTag=i.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Kr]=this}mount(e,t){let i=this.sheet,n=0,s=0;for(let o=0;o-1&&(this.modules.splice(a,1),s--,a=-1),a==-1){if(this.modules.splice(s++,0,l),i)for(let h=0;h",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},nu=typeof navigator<"u"&&/Mac/.test(navigator.platform),ru=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var de=0;de<10;de++)Zt[48+de]=Zt[96+de]=String(de);for(var de=1;de<=24;de++)Zt[de+111]="F"+de;for(var de=65;de<=90;de++)Zt[de]=String.fromCharCode(de+32),Yi[de]=String.fromCharCode(de);for(var Or in Zt)Yi.hasOwnProperty(Or)||(Yi[Or]=Zt[Or]);function su(r){var e=nu&&r.metaKey&&r.shiftKey&&!r.ctrlKey&&!r.altKey||ru&&r.shiftKey&&r.key&&r.key.length==1||r.key=="Unidentified",t=!e&&r.key||(r.shiftKey?Yi:Zt)[r.keyCode]||r.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function Mi(r){let e;return r.nodeType==11?e=r.getSelection?r:r.ownerDocument:e=r,e.getSelection()}function Jr(r,e){return e?r==e||r.contains(e.nodeType!=1?e.parentNode:e):!1}function ou(r){let e=r.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Tn(r,e){if(!e.anchorNode)return!1;try{return Jr(r,e.anchorNode)}catch{return!1}}function ti(r){return r.nodeType==3?zt(r,0,r.nodeValue.length).getClientRects():r.nodeType==1?r.getClientRects():[]}function Ti(r,e,t,i){return t?Zo(r,e,t,i,-1)||Zo(r,e,t,i,1):!1}function _t(r){for(var e=0;;e++)if(r=r.previousSibling,!r)return e}function zn(r){return r.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(r.nodeName)}function Zo(r,e,t,i,n){for(;;){if(r==t&&e==i)return!0;if(e==(n<0?0:ut(r))){if(r.nodeName=="DIV")return!1;let s=r.parentNode;if(!s||s.nodeType!=1)return!1;e=_t(r)+(n<0?0:1),r=s}else if(r.nodeType==1){if(r=r.childNodes[e+(n<0?-1:0)],r.nodeType==1&&r.contentEditable=="false")return!1;e=n<0?ut(r):0}else return!1}}function ut(r){return r.nodeType==3?r.nodeValue.length:r.childNodes.length}function nr(r,e){let t=e?r.left:r.right;return{left:t,right:t,top:r.top,bottom:r.bottom}}function lu(r){let e=r.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:r.innerWidth,top:0,bottom:r.innerHeight}}function Ca(r,e){let t=e.width/r.offsetWidth,i=e.height/r.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-r.offsetWidth)<1)&&(t=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-r.offsetHeight)<1)&&(i=1),{scaleX:t,scaleY:i}}function au(r,e,t,i,n,s,o,l){let a=r.ownerDocument,h=a.defaultView||window;for(let f=r,c=!1;f&&!c;)if(f.nodeType==1){let u,O=f==a.body,d=1,g=1;if(O)u=lu(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(f).position)&&(c=!0),f.scrollHeight<=f.clientHeight&&f.scrollWidth<=f.clientWidth){f=f.assignedSlot||f.parentNode;continue}let Q=f.getBoundingClientRect();({scaleX:d,scaleY:g}=Ca(f,Q)),u={left:Q.left,right:Q.left+f.clientWidth*d,top:Q.top,bottom:Q.top+f.clientHeight*g}}let m=0,b=0;if(n=="nearest")e.top0&&e.bottom>u.bottom+b&&(b=e.bottom-u.bottom+b+o)):e.bottom>u.bottom&&(b=e.bottom-u.bottom+o,t<0&&e.top-b0&&e.right>u.right+m&&(m=e.right-u.right+m+s)):e.right>u.right&&(m=e.right-u.right+s,t<0&&e.leftt.clientHeight||t.scrollWidth>t.clientWidth)return t;t=t.assignedSlot||t.parentNode}else if(t.nodeType==11)t=t.host;else break;return null}class fu{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:i}=e;this.set(t,Math.min(e.anchorOffset,t?ut(t):0),i,Math.min(e.focusOffset,i?ut(i):0))}set(e,t,i,n){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=n}}let jt=null;function Aa(r){if(r.setActive)return r.setActive();if(jt)return r.focus(jt);let e=[];for(let t=r;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(r.focus(jt==null?{get preventScroll(){return jt={preventScroll:!0},!0}}:void 0),!jt){jt=!1;for(let t=0;tMath.max(1,r.scrollHeight-r.clientHeight-4)}function Ma(r,e){for(let t=r,i=e;;){if(t.nodeType==3&&i>0)return{node:t,offset:i};if(t.nodeType==1&&i>0){if(t.contentEditable=="false")return null;t=t.childNodes[i-1],i=ut(t)}else if(t.parentNode&&!zn(t))i=_t(t),t=t.parentNode;else return null}}function Ea(r,e){for(let t=r,i=e;;){if(t.nodeType==3&&it)return c.domBoundsAround(e,t,h);if(u>=e&&n==-1&&(n=a,s=h),h>t&&c.dom.parentNode==this.dom){o=a,l=f;break}f=u,h=u+c.breakAfter}return{from:s,to:l<0?i+this.length:l,startDOM:(n?this.children[n-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o=0?this.children[o].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),t.flags&1)return;t.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,i=Ms){this.markDirty();for(let n=e;nthis.pos||e==this.pos&&(t>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}function _a(r,e,t,i,n,s,o,l,a){let{children:h}=r,f=h.length?h[e]:null,c=s.length?s[s.length-1]:null,u=c?c.breakAfter:o;if(!(e==i&&f&&!o&&!u&&s.length<2&&f.merge(t,n,s.length?c:null,t==0,l,a))){if(i0&&(!o&&s.length&&f.merge(t,f.length,s[0],!1,l,0)?f.breakAfter=s.shift().breakAfter:(t2);var v={mac:Ao||/Mac/.test($e.platform),windows:/Win/.test($e.platform),linux:/Linux|X11/.test($e.platform),ie:rr,ie_version:Va?es.documentMode||6:is?+is[1]:ts?+ts[1]:0,gecko:Xo,gecko_version:Xo?+(/Firefox\/(\d+)/.exec($e.userAgent)||[0,0])[1]:0,chrome:!!dr,chrome_version:dr?+dr[1]:0,ios:Ao,android:/Android\b/.test($e.userAgent),webkit:Co,safari:Ua,webkit_version:Co?+(/\bAppleWebKit\/(\d+)/.exec($e.userAgent)||[0,0])[1]:0,tabSize:es.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const Ou=256;class De extends F{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,t,i){return this.flags&8||i&&(!(i instanceof De)||this.length-(t-e)+i.length>Ou||i.flags&8)?!1:(this.text=this.text.slice(0,e)+(i?i.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new De(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=this.flags&8,t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new Qe(this.dom,e)}domBoundsAround(e,t,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return du(this.dom,e,t)}}class Ot extends F{constructor(e,t=[],i=0){super(),this.mark=e,this.children=t,this.length=i;for(let n of t)n.setParent(this)}setAttrs(e){if(Wa(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,i,n,s,o){return i&&(!(i instanceof Ot&&i.mark.eq(this.mark))||e&&s<=0||te&&t.push(i=e&&(n=s),i=a,s++}let o=this.length-e;return this.length=e,n>-1&&(this.children.length=n,this.markDirty()),new Ot(this.mark,t,o)}domAtPos(e){return Da(this,e)}coordsAt(e,t){return ja(this,e,t)}}function du(r,e,t){let i=r.nodeValue.length;e>i&&(e=i);let n=e,s=e,o=0;e==0&&t<0||e==i&&t>=0?v.chrome||v.gecko||(e?(n--,o=1):s=0)?0:l.length-1];return v.safari&&!o&&a.width==0&&(a=Array.prototype.find.call(l,h=>h.width)||a),o?nr(a,o<0):a||null}class Mt extends F{static create(e,t,i){return new Mt(e,t,i)}constructor(e,t,i){super(),this.widget=e,this.length=t,this.side=i,this.prevWidget=null}split(e){let t=Mt.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,t,i,n,s,o){return i&&(!(i instanceof Mt)||!this.widget.compare(i.widget)||e>0&&s<=0||t0)?Qe.before(this.dom):Qe.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let i=this.widget.coordsAt(this.dom,e,t);if(i)return i;let n=this.dom.getClientRects(),s=null;if(!n.length)return null;let o=this.side?this.side<0:e>0;for(let l=o?n.length-1:0;s=n[l],!(e>0?l==0:l==n.length-1||s.top0?Qe.before(this.dom):Qe.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return I.empty}get isHidden(){return!0}}De.prototype.children=Mt.prototype.children=ii.prototype.children=Ms;function Da(r,e){let t=r.dom,{children:i}=r,n=0;for(let s=0;ns&&e0;s--){let o=i[s-1];if(o.dom.parentNode==t)return o.domAtPos(o.length)}for(let s=n;s0&&e instanceof Ot&&n.length&&(i=n[n.length-1])instanceof Ot&&i.mark.eq(e.mark)?Ia(i,e.children[0],t-1):(n.push(e),e.setParent(r)),r.length+=e.length}function ja(r,e,t){let i=null,n=-1,s=null,o=-1;function l(h,f){for(let c=0,u=0;c=f&&(O.children.length?l(O,f-u):(!s||s.isHidden&&t>0)&&(d>f||u==d&&O.getSide()>0)?(s=O,o=f-u):(u-1?1:0)!=n.length-(t&&n.indexOf(t)>-1?1:0))return!1;for(let s of i)if(s!=t&&(n.indexOf(s)==-1||r[s]!==e[s]))return!1;return!0}function rs(r,e,t){let i=!1;if(e)for(let n in e)t&&n in t||(i=!0,n=="style"?r.style.cssText="":r.removeAttribute(n));if(t)for(let n in t)e&&e[n]==t[n]||(i=!0,n=="style"?r.style.cssText=t[n]:r.setAttribute(n,t[n]));return i}function gu(r){let e=Object.create(null);for(let t=0;t0&&this.children[i-1].length==0;)this.children[--i].destroy();return this.children.length=i,this.markDirty(),this.length=e,t}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){Vn(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){Ia(this,e,t)}addLineDeco(e){let t=e.spec.attributes,i=e.spec.class;t&&(this.attrs=ns(t,this.attrs||{})),i&&(this.attrs=ns({class:i},this.attrs||{}))}domAtPos(e){return Da(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var i;this.dom?this.flags&4&&(Wa(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(rs(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let n=this.dom.lastChild;for(;n&&F.get(n)instanceof Ot;)n=n.lastChild;if(!n||!this.length||n.nodeName!="BR"&&((i=F.get(n))===null||i===void 0?void 0:i.isEditable)==!1&&(!v.ios||!this.children.some(s=>s instanceof De))){let s=document.createElement("BR");s.cmIgnore=!0,this.dom.appendChild(s)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,t;for(let i of this.children){if(!(i instanceof De)||/[^ -~]/.test(i.text))return null;let n=ti(i.dom);if(n.length!=1)return null;e+=n[0].width,t=n[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(e,t){let i=ja(this,e,t);if(!this.children.length&&i&&this.parent){let{heightOracle:n}=this.parent.view.viewState,s=i.bottom-i.top;if(Math.abs(s-n.lineHeight)<2&&n.textHeight=t){if(s instanceof le)return s;if(o>t)break}n=o+s.breakAfter}return null}}class ft extends F{constructor(e,t,i){super(),this.widget=e,this.length=t,this.deco=i,this.breakAfter=0,this.prevWidget=null}merge(e,t,i,n,s,o){return i&&(!(i instanceof ft)||!this.widget.compare(i.widget)||e>0&&s<=0||t0}}class Li{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var nt=function(r){return r[r.Text=0]="Text",r[r.WidgetBefore=1]="WidgetBefore",r[r.WidgetAfter=2]="WidgetAfter",r[r.WidgetRange=3]="WidgetRange",r}(nt||(nt={}));class te extends qt{constructor(e,t,i,n){super(),this.startSide=e,this.endSide=t,this.widget=i,this.spec=n}get heightRelevant(){return!1}static mark(e){return new Ni(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),i=!!e.block;return t+=i&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new Tt(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,n;if(e.isBlockGap)i=-5e8,n=4e8;else{let{start:s,end:o}=Ba(e,t);i=(s?t?-3e8:-1:5e8)-1,n=(o?t?2e8:1:-6e8)+1}return new Tt(e,i,n,t,e.widget||null,!0)}static line(e){return new Gi(e)}static set(e,t=!1){return J.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}te.none=J.empty;class Ni extends te{constructor(e){let{start:t,end:i}=Ba(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,i;return this==e||e instanceof Ni&&this.tagName==e.tagName&&(this.class||((t=this.attrs)===null||t===void 0?void 0:t.class))==(e.class||((i=e.attrs)===null||i===void 0?void 0:i.class))&&Vn(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}Ni.prototype.point=!1;class Gi extends te{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Gi&&this.spec.class==e.spec.class&&Vn(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}Gi.prototype.mapMode=we.TrackBefore;Gi.prototype.point=!0;class Tt extends te{constructor(e,t,i,n,s,o){super(t,i,s,e),this.block=n,this.isReplace=o,this.mapMode=n?t<=0?we.TrackBefore:we.TrackAfter:we.TrackDel}get type(){return this.startSide!=this.endSide?nt.WidgetRange:this.startSide<=0?nt.WidgetBefore:nt.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Tt&&mu(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}Tt.prototype.point=!0;function Ba(r,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=r;return t==null&&(t=r.inclusive),i==null&&(i=r.inclusive),{start:t??e,end:i??e}}function mu(r,e){return r==e||!!(r&&e&&r.compare(e))}function ss(r,e,t,i=0){let n=t.length-1;n>=0&&t[n]+i>=r?t[n]=Math.max(t[n],e):t.push(r,e)}class Ri{constructor(e,t,i,n){this.doc=e,this.pos=t,this.end=i,this.disallowBlockEffectsFor=n,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=t}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof ft&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new le),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(fn(new ii(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof ft)&&this.getLine()}buildText(e,t,i){for(;e>0;){if(this.textOff==this.text.length){let{value:s,lineBreak:o,done:l}=this.cursor.next(this.skip);if(this.skip=0,l)throw new Error("Ran out of text content when drawing inline views");if(o){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=s,this.textOff=0}let n=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-i)),this.getLine().append(fn(new De(this.text.slice(this.textOff,this.textOff+n)),t),i),this.atCursorPos=!0,this.textOff+=n,e-=n,i=0}}span(e,t,i,n){this.buildText(t-e,i,n),this.pos=t,this.openStart<0&&(this.openStart=n)}point(e,t,i,n,s,o){if(this.disallowBlockEffectsFor[o]&&i instanceof Tt){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let l=t-e;if(i instanceof Tt)if(i.block)i.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new ft(i.widget||ni.block,l,i));else{let a=Mt.create(i.widget||ni.inline,l,l?0:i.startSide),h=this.atCursorPos&&!a.isEditable&&s<=n.length&&(e0),f=!a.isEditable&&(en.length||i.startSide<=0),c=this.getLine();this.pendingBuffer==2&&!h&&!a.isEditable&&(this.pendingBuffer=0),this.flushBuffer(n),h&&(c.append(fn(new ii(1),n),s),s=n.length+Math.max(0,s-n.length)),c.append(fn(a,n),s),this.atCursorPos=f,this.pendingBuffer=f?en.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=n.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);l&&(this.textOff+l<=this.text.length?this.textOff+=l:(this.skip+=l-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=s)}static build(e,t,i,n,s){let o=new Ri(e,t,i,s);return o.openEnd=J.spans(n,t,i,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function fn(r,e){for(let t of e)r=new Ot(t,[r],r.length);return r}class ni extends Li{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}ni.inline=new ni("span");ni.block=new ni("div");var pe=function(r){return r[r.LTR=0]="LTR",r[r.RTL=1]="RTL",r}(pe||(pe={}));const Vt=pe.LTR,Es=pe.RTL;function La(r){let e=[];for(let t=0;t=t){if(l.level==i)return o;(s<0||(n!=0?n<0?l.fromt:e[s].level>l.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}}function Ga(r,e){if(r.length!=e.length)return!1;for(let t=0;t=0;g-=3)if(Be[g+1]==-O){let m=Be[g+2],b=m&2?n:m&4?m&1?s:n:0;b&&(G[c]=G[Be[g]]=b),l=g;break}}else{if(Be.length==189)break;Be[l++]=c,Be[l++]=u,Be[l++]=a}else if((d=G[c])==2||d==1){let g=d==n;a=g?0:1;for(let m=l-3;m>=0;m-=3){let b=Be[m+2];if(b&2)break;if(g)Be[m+2]|=2;else{if(b&4)break;Be[m+2]|=4}}}}}function yu(r,e,t,i){for(let n=0,s=i;n<=t.length;n++){let o=n?t[n-1].to:r,l=na;)d==m&&(d=t[--g].from,m=g?t[g-1].to:r),G[--d]=O;a=f}else s=h,a++}}}function ls(r,e,t,i,n,s,o){let l=i%2?2:1;if(i%2==n%2)for(let a=e,h=0;aa&&o.push(new xt(a,g.from,O));let m=g.direction==Vt!=!(O%2);as(r,m?i+1:i,n,g.inner,g.from,g.to,o),a=g.to}d=g.to}else{if(d==t||(f?G[d]!=l:G[d]==l))break;d++}u?ls(r,a,d,i+1,n,u,o):ae;){let f=!0,c=!1;if(!h||a>s[h-1].to){let g=G[a-1];g!=l&&(f=!1,c=g==16)}let u=!f&&l==1?[]:null,O=f?i:i+1,d=a;e:for(;;)if(h&&d==s[h-1].to){if(c)break e;let g=s[--h];if(!f)for(let m=g.from,b=h;;){if(m==e)break e;if(b&&s[b-1].to==m)m=s[--b].from;else{if(G[m-1]==l)break e;break}}if(u)u.push(g);else{g.toG.length;)G[G.length]=256;let i=[],n=e==Vt?0:1;return as(r,n,n,t,0,r.length,i),i}function Fa(r){return[new xt(0,r,0)]}let Ha="";function xu(r,e,t,i,n){var s;let o=i.head-r.from,l=xt.find(e,o,(s=i.bidiLevel)!==null&&s!==void 0?s:-1,i.assoc),a=e[l],h=a.side(n,t);if(o==h){let u=l+=n?1:-1;if(u<0||u>=e.length)return null;a=e[l=u],o=a.side(!n,t),h=a.side(n,t)}let f=Ke(r.text,o,a.forward(n,t));(fa.to)&&(f=h),Ha=r.text.slice(Math.min(o,f),Math.max(o,f));let c=l==(n?e.length-1:0)?null:e[l+(n?1:-1)];return c&&f==h&&c.level+(n?0:1)r.some(e=>e)}),vu=W.define({combine:r=>r.some(e=>e)}),sh=W.define();class Ft{constructor(e,t="nearest",i="nearest",n=5,s=5,o=!1){this.range=e,this.y=t,this.x=i,this.yMargin=n,this.xMargin=s,this.isSnapshot=o}map(e){return e.empty?this:new Ft(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Ft(P.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const cn=ie.define({map:(r,e)=>r.map(e)}),oh=ie.define();function Je(r,e,t){let i=r.facet(th);i.length?i[0](e):window.onerror?window.onerror(String(e),t,void 0,void 0,e):t?console.error(t+":",e):console.error(e)}const wt=W.define({combine:r=>r.length?r[0]:!0});let Zu=0;const wi=W.define();class Ut{constructor(e,t,i,n,s){this.id=e,this.create=t,this.domEventHandlers=i,this.domEventObservers=n,this.extension=s(this)}static define(e,t){const{eventHandlers:i,eventObservers:n,provide:s,decorations:o}=t||{};return new Ut(Zu++,e,i,n,l=>{let a=[wi.of(l)];return o&&a.push(Ei.of(h=>{let f=h.plugin(l);return f?o(f):te.none})),s&&a.push(s(l)),a})}static fromClass(e,t){return Ut.define(i=>new e(i),t)}}class pr{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(i){if(Je(t.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(t){Je(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(i){Je(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const lh=W.define(),qs=W.define(),Ei=W.define(),ah=W.define(),_s=W.define(),hh=W.define();function Yo(r,e){let t=r.state.facet(hh);if(!t.length)return t;let i=t.map(s=>s instanceof Function?s(r):s),n=[];return J.spans(i,e.from,e.to,{point(){},span(s,o,l,a){let h=s-e.from,f=o-e.from,c=n;for(let u=l.length-1;u>=0;u--,a--){let O=l[u].spec.bidiIsolate,d;if(O==null&&(O=$u(e.text,h,f)),a>0&&c.length&&(d=c[c.length-1]).to==h&&d.direction==O)d.to=f,c=d.inner;else{let g={from:h,to:f,direction:O,inner:[]};c.push(g),c=g.inner}}}}),n}const fh=W.define();function ch(r){let e=0,t=0,i=0,n=0;for(let s of r.state.facet(fh)){let o=s(r);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(i=Math.max(i,o.top)),o.bottom!=null&&(n=Math.max(n,o.bottom)))}return{left:e,right:t,top:i,bottom:n}}const yi=W.define();class qe{constructor(e,t,i,n){this.fromA=e,this.toA=t,this.fromB=i,this.toB=n}join(e){return new qe(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,i=this;for(;t>0;t--){let n=e[t-1];if(!(n.fromA>i.toA)){if(n.toAf)break;s+=2}if(!a)return i;new qe(a.fromA,a.toA,a.fromB,a.toB).addToSet(i),o=a.toA,l=a.toB}}}class Un{constructor(e,t,i){this.view=e,this.state=t,this.transactions=i,this.flags=0,this.startState=e.state,this.changes=he.empty(this.startState.doc.length);for(let s of i)this.changes=this.changes.compose(s.changes);let n=[];this.changes.iterChangedRanges((s,o,l,a)=>n.push(new qe(s,o,l,a))),this.changedRanges=n}static create(e,t,i){return new Un(e,t,i)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}class Mo extends F{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=te.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new le],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new qe(0,0,0,e.state.doc.length)],0,null)}update(e){var t;let i=e.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:h,toA:f})=>fthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let n=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?n=this.domChanged.newSel.head:!Yu(e.changes,this.hasComposition)&&!e.selectionSet&&(n=e.state.selection.main.head));let s=n>-1?Ru(this.view,e.changes,n):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:h,to:f}=this.hasComposition;i=new qe(h,f,e.changes.mapPos(h,-1),e.changes.mapPos(f,1)).addToSet(i.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(v.ie||v.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.updateDeco(),a=Au(o,l,e.changes);return i=qe.extendWithRanges(i,a),!(this.flags&7)&&i.length==0?!1:(this.updateInner(i,e.startState.doc.length,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,i){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,i);let{observer:n}=this.view;n.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let o=v.chrome||v.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,o),this.flags&=-8,o&&(o.written||n.selectionRange.focusNode!=o.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(o=>o.flags&=-9);let s=[];if(this.view.viewport.from||this.view.viewport.to=0?n[o]:null;if(!l)break;let{fromA:a,toA:h,fromB:f,toB:c}=l,u,O,d,g;if(i&&i.range.fromBf){let $=Ri.build(this.view.state.doc,f,i.range.fromB,this.decorations,this.dynamicDecorationMap),Z=Ri.build(this.view.state.doc,i.range.toB,c,this.decorations,this.dynamicDecorationMap);O=$.breakAtStart,d=$.openStart,g=Z.openEnd;let A=this.compositionView(i);Z.breakAtStart?A.breakAfter=1:Z.content.length&&A.merge(A.length,A.length,Z.content[0],!1,Z.openStart,0)&&(A.breakAfter=Z.content[0].breakAfter,Z.content.shift()),$.content.length&&A.merge(0,0,$.content[$.content.length-1],!0,0,$.openEnd)&&$.content.pop(),u=$.content.concat(A).concat(Z.content)}else({content:u,breakAtStart:O,openStart:d,openEnd:g}=Ri.build(this.view.state.doc,f,c,this.decorations,this.dynamicDecorationMap));let{i:m,off:b}=s.findPos(h,1),{i:Q,off:y}=s.findPos(a,-1);_a(this,Q,y,m,b,u,O,d,g)}i&&this.fixCompositionDOM(i)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let i of t.effects)i.is(oh)&&(this.editContextFormatting=i.value)}compositionView(e){let t=new De(e.text.nodeValue);t.flags|=8;for(let{deco:n}of e.marks)t=new Ot(n,[t],t.length);let i=new le;return i.append(t,0),i}fixCompositionDOM(e){let t=(s,o)=>{o.flags|=8|(o.children.some(a=>a.flags&7)?1:0),this.markedForComposition.add(o);let l=F.get(s);l&&l!=o&&(l.dom=null),o.setDOM(s)},i=this.childPos(e.range.fromB,1),n=this.children[i.i];t(e.line,n);for(let s=e.marks.length-1;s>=-1;s--)i=n.childPos(i.off,1),n=n.children[i.i],t(s>=0?e.marks[s].node:e.text,n)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let i=this.view.root.activeElement,n=i==this.dom,s=!n&&Tn(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(n||t||s))return;let o=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,a=this.moveToLine(this.domAtPos(l.anchor)),h=l.empty?a:this.moveToLine(this.domAtPos(l.head));if(v.gecko&&l.empty&&!this.hasComposition&&Tu(a)){let c=document.createTextNode("");this.view.observer.ignore(()=>a.node.insertBefore(c,a.node.childNodes[a.offset]||null)),a=h=new Qe(c,0),o=!0}let f=this.view.observer.selectionRange;(o||!f.focusNode||(!Ti(a.node,a.offset,f.anchorNode,f.anchorOffset)||!Ti(h.node,h.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,l))&&(this.view.observer.ignore(()=>{v.android&&v.chrome&&this.dom.contains(f.focusNode)&&Wu(f.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let c=Mi(this.view.root);if(c)if(l.empty){if(v.gecko){let u=Xu(a.node,a.offset);if(u&&u!=3){let O=(u==1?Ma:Ea)(a.node,a.offset);O&&(a=new Qe(O.node,O.offset))}}c.collapse(a.node,a.offset),l.bidiLevel!=null&&c.caretBidiLevel!==void 0&&(c.caretBidiLevel=l.bidiLevel)}else if(c.extend){c.collapse(a.node,a.offset);try{c.extend(h.node,h.offset)}catch{}}else{let u=document.createRange();l.anchor>l.head&&([a,h]=[h,a]),u.setEnd(h.node,h.offset),u.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(u)}s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(a,h)),this.impreciseAnchor=a.precise?null:new Qe(f.anchorNode,f.anchorOffset),this.impreciseHead=h.precise?null:new Qe(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Ti(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,i=Mi(e.root),{anchorNode:n,anchorOffset:s}=e.observer.selectionRange;if(!i||!t.empty||!t.assoc||!i.modify)return;let o=le.find(this,t.head);if(!o)return;let l=o.posAtStart;if(t.head==l||t.head==l+o.length)return;let a=this.coordsAt(t.head,-1),h=this.coordsAt(t.head,1);if(!a||!h||a.bottom>h.top)return;let f=this.domAtPos(t.head+t.assoc);i.collapse(f.node,f.offset),i.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let c=e.observer.selectionRange;e.docView.posFromDOM(c.anchorNode,c.anchorOffset)!=t.from&&i.collapse(n,s)}moveToLine(e){let t=this.dom,i;if(e.node!=t)return e;for(let n=e.offset;!i&&n=0;n--){let s=F.get(t.childNodes[n]);s instanceof le&&(i=s.domAtPos(s.length))}return i?new Qe(i.node,i.offset,!0):e}nearest(e){for(let t=e;t;){let i=F.get(t);if(i&&i.rootView==this)return i;t=t.parentNode}return null}posFromDOM(e,t){let i=this.nearest(e);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(e,t)+i.posAtStart}domAtPos(e){let{i:t,off:i}=this.childCursor().findPos(e,-1);for(;t=0;o--){let l=this.children[o],a=s-l.breakAfter,h=a-l.length;if(ae||l.covers(1))&&(!i||l instanceof le&&!(i instanceof le&&t>=0)))i=l,n=h;else if(i&&h==e&&a==e&&l instanceof ft&&Math.abs(t)<2){if(l.deco.startSide<0)break;o&&(i=null)}s=h}return i?i.coordsAt(e-n,t):null}coordsForChar(e){let{i:t,off:i}=this.childPos(e,1),n=this.children[t];if(!(n instanceof le))return null;for(;n.children.length;){let{i:l,off:a}=n.childPos(i,1);for(;;l++){if(l==n.children.length)return null;if((n=n.children[l]).length)break}i=a}if(!(n instanceof De))return null;let s=Ke(n.text,i);if(s==i)return null;let o=zt(n.dom,i,s).getClientRects();for(let l=0;lMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,a=this.view.textDirection==pe.LTR;for(let h=0,f=0;fn)break;if(h>=i){let O=c.dom.getBoundingClientRect();if(t.push(O.height),o){let d=c.dom.lastChild,g=d?ti(d):[];if(g.length){let m=g[g.length-1],b=a?m.right-O.left:O.right-m.left;b>l&&(l=b,this.minWidth=s,this.minWidthFrom=h,this.minWidthTo=u)}}}h=u+c.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?pe.RTL:pe.LTR}measureTextSize(){for(let s of this.children)if(s instanceof le){let o=s.measureTextSize();if(o)return o}let e=document.createElement("div"),t,i,n;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let s=ti(e.firstChild)[0];t=e.getBoundingClientRect().height,i=s?s.width/27:7,n=s?s.height:t,e.remove()}),{lineHeight:t,charWidth:i,textHeight:n}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new qa(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,n=0;;n++){let s=n==t.viewports.length?null:t.viewports[n],o=s?s.from-1:this.length;if(o>i){let l=(t.lineBlockAt(o).bottom-t.lineBlockAt(i).top)/this.view.scaleY;e.push(te.replace({widget:new Eo(l),block:!0,inclusive:!0,isBlockGap:!0}).range(i,o))}if(!s)break;i=s.to+1}return te.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Ei).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),i=!1,n=this.view.state.facet(ah).map((s,o)=>{let l=typeof s=="function";return l&&(i=!0),l?s(this.view):s});for(n.length&&(this.dynamicDecorationMap[e++]=i,t.push(J.join(n))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];et.anchor?-1:1),n;if(!i)return;!t.empty&&(n=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,n.left),top:Math.min(i.top,n.top),right:Math.max(i.right,n.right),bottom:Math.max(i.bottom,n.bottom)});let s=ch(this.view),o={left:i.left-s.left,top:i.top-s.top,right:i.right+s.right,bottom:i.bottom+s.bottom},{offsetWidth:l,offsetHeight:a}=this.view.scrollDOM;au(this.view.scrollDOM,o,t.head{ie.from&&(t=!0)}),t}function Mu(r,e,t=1){let i=r.charCategorizer(e),n=r.doc.lineAt(e),s=e-n.from;if(n.length==0)return P.cursor(e);s==0?t=1:s==n.length&&(t=-1);let o=s,l=s;t<0?o=Ke(n.text,s,!1):l=Ke(n.text,s);let a=i(n.text.slice(o,l));for(;o>0;){let h=Ke(n.text,o,!1);if(i(n.text.slice(h,o))!=a)break;o=h}for(;lr?e.left-r:Math.max(0,r-e.right)}function qu(r,e){return e.top>r?e.top-r:Math.max(0,r-e.bottom)}function gr(r,e){return r.tope.top+1}function qo(r,e){return er.bottom?{top:r.top,left:r.left,right:r.right,bottom:e}:r}function fs(r,e,t){let i,n,s,o,l=!1,a,h,f,c;for(let d=r.firstChild;d;d=d.nextSibling){let g=ti(d);for(let m=0;my||o==y&&s>Q){i=d,n=b,s=Q,o=y;let $=y?t0?m0)}Q==0?t>b.bottom&&(!f||f.bottomb.top)&&(h=d,c=b):f&&gr(f,b)?f=_o(f,b.bottom):c&&gr(c,b)&&(c=qo(c,b.top))}}if(f&&f.bottom>=t?(i=a,n=f):c&&c.top<=t&&(i=h,n=c),!i)return{node:r,offset:0};let u=Math.max(n.left,Math.min(n.right,e));if(i.nodeType==3)return zo(i,u,t);if(l&&i.contentEditable!="false")return fs(i,u,t);let O=Array.prototype.indexOf.call(r.childNodes,i)+(e>=(n.left+n.right)/2?1:0);return{node:r,offset:O}}function zo(r,e,t){let i=r.nodeValue.length,n=-1,s=1e9,o=0;for(let l=0;lt?f.top-t:t-f.bottom)-1;if(f.left-1<=e&&f.right+1>=e&&c=(f.left+f.right)/2,O=u;if((v.chrome||v.gecko)&&zt(r,l).getBoundingClientRect().left==f.right&&(O=!u),c<=0)return{node:r,offset:l+(O?1:0)};n=l+(O?1:0),s=c}}}return{node:r,offset:n>-1?n:o>0?r.nodeValue.length:0}}function Oh(r,e,t,i=-1){var n,s;let o=r.contentDOM.getBoundingClientRect(),l=o.top+r.viewState.paddingTop,a,{docHeight:h}=r.viewState,{x:f,y:c}=e,u=c-l;if(u<0)return 0;if(u>h)return r.state.doc.length;for(let $=r.viewState.heightOracle.textHeight/2,Z=!1;a=r.elementAtHeight(u),a.type!=nt.Text;)for(;u=i>0?a.bottom+$:a.top-$,!(u>=0&&u<=h);){if(Z)return t?null:0;Z=!0,i=-i}c=l+u;let O=a.from;if(Or.viewport.to)return r.viewport.to==r.state.doc.length?r.state.doc.length:t?null:Vo(r,o,a,f,c);let d=r.dom.ownerDocument,g=r.root.elementFromPoint?r.root:d,m=g.elementFromPoint(f,c);m&&!r.contentDOM.contains(m)&&(m=null),m||(f=Math.max(o.left+1,Math.min(o.right-1,f)),m=g.elementFromPoint(f,c),m&&!r.contentDOM.contains(m)&&(m=null));let b,Q=-1;if(m&&((n=r.docView.nearest(m))===null||n===void 0?void 0:n.isEditable)!=!1){if(d.caretPositionFromPoint){let $=d.caretPositionFromPoint(f,c);$&&({offsetNode:b,offset:Q}=$)}else if(d.caretRangeFromPoint){let $=d.caretRangeFromPoint(f,c);$&&({startContainer:b,startOffset:Q}=$,(!r.contentDOM.contains(b)||v.safari&&_u(b,Q,f)||v.chrome&&zu(b,Q,f))&&(b=void 0))}}if(!b||!r.docView.dom.contains(b)){let $=le.find(r.docView,O);if(!$)return u>a.top+a.height/2?a.to:a.from;({node:b,offset:Q}=fs($.dom,f,c))}let y=r.docView.nearest(b);if(!y)return null;if(y.isWidget&&((s=y.dom)===null||s===void 0?void 0:s.nodeType)==1){let $=y.dom.getBoundingClientRect();return e.y<$.top||e.y<=$.bottom&&e.x<=($.left+$.right)/2?y.posAtStart:y.posAtEnd}else return y.localPosFromDOM(b,Q)+y.posAtStart}function Vo(r,e,t,i,n){let s=Math.round((i-e.left)*r.defaultCharacterWidth);if(r.lineWrapping&&t.height>r.defaultLineHeight*1.5){let l=r.viewState.heightOracle.textHeight,a=Math.floor((n-t.top-(r.defaultLineHeight-l)*.5)/l);s+=a*r.viewState.heightOracle.lineLength}let o=r.state.sliceDoc(t.from,t.to);return t.from+tu(o,s,r.state.tabSize)}function _u(r,e,t){let i;if(r.nodeType!=3||e!=(i=r.nodeValue.length))return!1;for(let n=r.nextSibling;n;n=n.nextSibling)if(n.nodeType!=1||n.nodeName!="BR")return!1;return zt(r,i-1,i).getBoundingClientRect().left>t}function zu(r,e,t){if(e!=0)return!1;for(let n=r;;){let s=n.parentNode;if(!s||s.nodeType!=1||s.firstChild!=n)return!1;if(s.classList.contains("cm-line"))break;n=s}let i=r.nodeType==1?r.getBoundingClientRect():zt(r,0,Math.max(r.nodeValue.length,1)).getBoundingClientRect();return t-i.left>5}function Vu(r,e){let t=r.lineBlockAt(e);if(Array.isArray(t.type)){for(let i of t.type)if(i.to>e||i.to==e&&(i.to==t.to||i.type==nt.Text))return i}return t}function Uu(r,e,t,i){let n=Vu(r,e.head),s=!i||n.type!=nt.Text||!(r.lineWrapping||n.widgetLineBreaks)?null:r.coordsAtPos(e.assoc<0&&e.head>n.from?e.head-1:e.head);if(s){let o=r.dom.getBoundingClientRect(),l=r.textDirectionAt(n.from),a=r.posAtCoords({x:t==(l==pe.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(a!=null)return P.cursor(a,t?-1:1)}return P.cursor(t?n.to:n.from,t?-1:1)}function Uo(r,e,t,i){let n=r.state.doc.lineAt(e.head),s=r.bidiSpans(n),o=r.textDirectionAt(n.from);for(let l=e,a=null;;){let h=xu(n,s,o,l,t),f=Ha;if(!h){if(n.number==(t?r.state.doc.lines:1))return l;f=` `,n=r.state.doc.line(n.number+(t?1:-1)),s=r.bidiSpans(n),h=r.visualLineSide(n,!t)}if(a){if(!a(f))return l}else{if(!i)return h;a=i(f)}l=h}}function Du(r,e,t){let i=r.state.charCategorizer(e),n=i(t);return s=>{let o=i(s);return n==ht.Space&&(n=o),n==o}}function Iu(r,e,t,i){let n=e.head,s=t?1:-1;if(n==(t?r.state.doc.length:0))return P.cursor(n,e.assoc);let o=e.goalColumn,l,a=r.contentDOM.getBoundingClientRect(),h=r.coordsAtPos(n,e.assoc||-1),f=r.documentTop;if(h)o==null&&(o=h.left-a.left),l=s<0?h.top:h.bottom;else{let O=r.viewState.lineBlockAt(n);o==null&&(o=Math.min(a.right-a.left,r.defaultCharacterWidth*(n-O.from))),l=(s<0?O.top:O.bottom)+f}let c=a.left+o,u=i??r.viewState.heightOracle.textHeight>>1;for(let O=0;;O+=10){let d=l+(u+O)*s,g=Oh(r,{x:c,y:d},!1,s);if(da.bottom||(s<0?gn)){let m=r.docView.coordsForChar(g),b=!m||d{if(e>s&&en(r)),t.from,e.head>t.from?-1:1);return i==t.from?t:P.cursor(i,inull),v.gecko&&lO(e.contentDOM.ownerDocument)}handleEvent(e){!Ju(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||this.runHandlers(e.type,e)}runHandlers(e,t){let i=this.handlers[e];if(i){for(let n of i.observers)n(this.view,t);for(let n of i.handlers){if(t.defaultPrevented)break;if(n(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=Bu(e),i=this.handlers,n=this.view.contentDOM;for(let s in t)if(s!="scroll"){let o=!t[s].handlers.length,l=i[s];l&&o!=!l.handlers.length&&(n.removeEventListener(s,this.handleEvent),l=null),l||n.addEventListener(s,this.handleEvent,{passive:o})}for(let s in i)s!="scroll"&&!t[s]&&n.removeEventListener(s,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&ph.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),v.android&&v.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return v.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=dh.find(i=>i.keyCode==e.keyCode))&&!e.ctrlKey||Lu.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from0?!0:v.safari&&!v.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function Do(r,e){return(t,i)=>{try{return e.call(r,i,t)}catch(n){Je(t.state,n)}}}function Bu(r){let e=Object.create(null);function t(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of r){let n=i.spec;if(n&&n.domEventHandlers)for(let s in n.domEventHandlers){let o=n.domEventHandlers[s];o&&t(s).handlers.push(Do(i.value,o))}if(n&&n.domEventObservers)for(let s in n.domEventObservers){let o=n.domEventObservers[s];o&&t(s).observers.push(Do(i.value,o))}}for(let i in Ie)t(i).handlers.push(Ie[i]);for(let i in _e)t(i).observers.push(_e[i]);return e}const dh=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Lu="dthko",ph=[16,17,18,20,91,92,224,225],un=6;function On(r){return Math.max(0,r)*.7+8}function Nu(r,e){return Math.max(Math.abs(r.clientX-e.clientX),Math.abs(r.clientY-e.clientY))}class Gu{constructor(e,t,i,n){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=n,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParent=hu(e.contentDOM),this.atoms=e.state.facet(_s).map(o=>o(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(V.allowMultipleSelections)&&Fu(e,t),this.dragging=Ku(e,t)&&Sh(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){var t;if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&Nu(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let i=0,n=0,s=((t=this.scrollParent)===null||t===void 0?void 0:t.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},o=ch(this.view);e.clientX-o.left<=s.left+un?i=-On(s.left-e.clientX):e.clientX+o.right>=s.right-un&&(i=On(e.clientX-s.right)),e.clientY-o.top<=s.top+un?n=-On(s.top-e.clientY):e.clientY+o.bottom>=s.bottom-un&&(n=On(e.clientY-s.bottom)),this.setScrollSpeed(i,n)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(e){let t=null;for(let i=0;it.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function Fu(r,e){let t=r.state.facet(Ka);return t.length?t[0](e):v.mac?e.metaKey:e.ctrlKey}function Hu(r,e){let t=r.state.facet(Ja);return t.length?t[0](e):v.mac?!e.altKey:!e.ctrlKey}function Ku(r,e){let{main:t}=r.state.selection;if(t.empty)return!1;let i=Mi(r.root);if(!i||i.rangeCount==0)return!0;let n=i.getRangeAt(0).getClientRects();for(let s=0;s=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function Ju(r,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=r.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=F.get(t))&&i.ignoreEvent(e))return!1;return!0}const Ie=Object.create(null),_e=Object.create(null),gh=v.ie&&v.ie_version<15||v.ios&&v.webkit_version<604;function eO(r){let e=r.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{r.focus(),t.remove(),mh(r,t.value)},50)}function mh(r,e){let{state:t}=r,i,n=1,s=t.toText(e),o=s.lines==t.selection.ranges.length;if(cs!=null&&t.selection.ranges.every(a=>a.empty)&&cs==s.toString()){let a=-1;i=t.changeByRange(h=>{let f=t.doc.lineAt(h.from);if(f.from==a)return{range:h};a=f.from;let c=t.toText((o?s.line(n++).text:e)+t.lineBreak);return{changes:{from:f.from,insert:c},range:P.cursor(h.from+c.length)}})}else o?i=t.changeByRange(a=>{let h=s.line(n++);return{changes:{from:a.from,to:a.to,insert:h.text},range:P.cursor(a.from+h.length)}}):i=t.replaceSelection(s);r.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}_e.scroll=r=>{r.inputState.lastScrollTop=r.scrollDOM.scrollTop,r.inputState.lastScrollLeft=r.scrollDOM.scrollLeft};Ie.keydown=(r,e)=>(r.inputState.setSelectionOrigin("select"),e.keyCode==27&&r.inputState.tabFocusMode!=0&&(r.inputState.tabFocusMode=Date.now()+2e3),!1);_e.touchstart=(r,e)=>{r.inputState.lastTouchTime=Date.now(),r.inputState.setSelectionOrigin("select.pointer")};_e.touchmove=r=>{r.inputState.setSelectionOrigin("select.pointer")};Ie.mousedown=(r,e)=>{if(r.observer.flush(),r.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let i of r.state.facet(eh))if(t=i(r,e),t)break;if(!t&&e.button==0&&(t=nO(r,e)),t){let i=!r.hasFocus;r.inputState.startMouseSelection(new Gu(r,e,t,i)),i&&r.observer.ignore(()=>{Aa(r.contentDOM);let s=r.root.activeElement;s&&!s.contains(r.contentDOM)&&s.blur()});let n=r.inputState.mouseSelection;if(n)return n.start(e),n.dragging===!1}return!1};function Io(r,e,t,i){if(i==1)return P.cursor(e,t);if(i==2)return Mu(r.state,e,t);{let n=le.find(r.docView,e),s=r.state.doc.lineAt(n?n.posAtEnd:e),o=n?n.posAtStart:s.from,l=n?n.posAtEnd:s.to;return lr>=e.top&&r<=e.bottom,jo=(r,e,t)=>bh(e,t)&&r>=t.left&&r<=t.right;function tO(r,e,t,i){let n=le.find(r.docView,e);if(!n)return 1;let s=e-n.posAtStart;if(s==0)return 1;if(s==n.length)return-1;let o=n.coordsAt(s,-1);if(o&&jo(t,i,o))return-1;let l=n.coordsAt(s,1);return l&&jo(t,i,l)?1:o&&bh(i,o)?-1:1}function Bo(r,e){let t=r.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:tO(r,t,e.clientX,e.clientY)}}const iO=v.ie&&v.ie_version<=11;let Lo=null,No=0,Go=0;function Sh(r){if(!iO)return r.detail;let e=Lo,t=Go;return Lo=r,Go=Date.now(),No=!e||t>Date.now()-400&&Math.abs(e.clientX-r.clientX)<2&&Math.abs(e.clientY-r.clientY)<2?(No+1)%3:1}function nO(r,e){let t=Bo(r,e),i=Sh(e),n=r.state.selection;return{update(s){s.docChanged&&(t.pos=s.changes.mapPos(t.pos),n=n.map(s.changes))},get(s,o,l){let a=Bo(r,s),h,f=Io(r,a.pos,a.bias,i);if(t.pos!=a.pos&&!o){let c=Io(r,t.pos,t.bias,i),u=Math.min(c.from,f.from),O=Math.max(c.to,f.to);f=u1&&(h=rO(n,a.pos))?h:l?n.addRange(f):P.create([f])}}}function rO(r,e){for(let t=0;t=e)return P.create(r.ranges.slice(0,t).concat(r.ranges.slice(t+1)),r.mainIndex==t?0:r.mainIndex-(r.mainIndex>t?1:0))}return null}Ie.dragstart=(r,e)=>{let{selection:{main:t}}=r.state;if(e.target.draggable){let n=r.docView.nearest(e.target);if(n&&n.isWidget){let s=n.posAtStart,o=s+n.length;(s>=t.to||o<=t.from)&&(t=P.range(s,o))}}let{inputState:i}=r;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",r.state.sliceDoc(t.from,t.to)),e.dataTransfer.effectAllowed="copyMove"),!1};Ie.dragend=r=>(r.inputState.draggedContent=null,!1);function Fo(r,e,t,i){if(!t)return;let n=r.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=r.inputState,o=i&&s&&Hu(r,e)?{from:s.from,to:s.to}:null,l={from:n,insert:t},a=r.state.changes(o?[o,l]:l);r.focus(),r.dispatch({changes:a,selection:{anchor:a.mapPos(n,-1),head:a.mapPos(n,1)},userEvent:o?"move.drop":"input.drop"}),r.inputState.draggedContent=null}Ie.drop=(r,e)=>{if(!e.dataTransfer)return!1;if(r.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let i=Array(t.length),n=0,s=()=>{++n==t.length&&Fo(r,e,i.filter(o=>o!=null).join(r.state.lineBreak),!1)};for(let o=0;o{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(i[o]=l.result),s()},l.readAsText(t[o])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return Fo(r,e,i,!0),!0}return!1};Ie.paste=(r,e)=>{if(r.state.readOnly)return!0;r.observer.flush();let t=gh?null:e.clipboardData;return t?(mh(r,t.getData("text/plain")||t.getData("text/uri-list")),!0):(eO(r),!1)};function sO(r,e){let t=r.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),r.focus()},50)}function oO(r){let e=[],t=[],i=!1;for(let n of r.selection.ranges)n.empty||(e.push(r.sliceDoc(n.from,n.to)),t.push(n));if(!e.length){let n=-1;for(let{from:s}of r.selection.ranges){let o=r.doc.lineAt(s);o.number>n&&(e.push(o.text),t.push({from:o.from,to:Math.min(r.doc.length,o.to+1)})),n=o.number}i=!0}return{text:e.join(r.lineBreak),ranges:t,linewise:i}}let cs=null;Ie.copy=Ie.cut=(r,e)=>{let{text:t,ranges:i,linewise:n}=oO(r.state);if(!t&&!n)return!1;cs=n?t:null,e.type=="cut"&&!r.state.readOnly&&r.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let s=gh?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",t),!0):(sO(r,t),!1)};const Qh=pt.define();function kh(r,e){let t=[];for(let i of r.facet(nh)){let n=i(r,e);n&&t.push(n)}return t?r.update({effects:t,annotations:Qh.of(!0)}):null}function wh(r){setTimeout(()=>{let e=r.hasFocus;if(e!=r.inputState.notifiedFocused){let t=kh(r.state,e);t?r.dispatch(t):r.update([])}},10)}_e.focus=r=>{r.inputState.lastFocusTime=Date.now(),!r.scrollDOM.scrollTop&&(r.inputState.lastScrollTop||r.inputState.lastScrollLeft)&&(r.scrollDOM.scrollTop=r.inputState.lastScrollTop,r.scrollDOM.scrollLeft=r.inputState.lastScrollLeft),wh(r)};_e.blur=r=>{r.observer.clearSelectionRange(),wh(r)};_e.compositionstart=_e.compositionupdate=r=>{r.observer.editContext||(r.inputState.compositionFirstChange==null&&(r.inputState.compositionFirstChange=!0),r.inputState.composing<0&&(r.inputState.composing=0))};_e.compositionend=r=>{r.observer.editContext||(r.inputState.composing=-1,r.inputState.compositionEndedAt=Date.now(),r.inputState.compositionPendingKey=!0,r.inputState.compositionPendingChange=r.observer.pendingRecords().length>0,r.inputState.compositionFirstChange=null,v.chrome&&v.android?r.observer.flushSoon():r.inputState.compositionPendingChange?Promise.resolve().then(()=>r.observer.flush()):setTimeout(()=>{r.inputState.composing<0&&r.docView.hasComposition&&r.update([])},50))};_e.contextmenu=r=>{r.inputState.lastContextMenu=Date.now()};Ie.beforeinput=(r,e)=>{var t;let i;if(v.chrome&&v.android&&(i=dh.find(n=>n.inputType==e.inputType))&&(r.observer.delayAndroidKey(i.key,i.keyCode),i.key=="Backspace"||i.key=="Delete")){let n=((t=window.visualViewport)===null||t===void 0?void 0:t.height)||0;setTimeout(()=>{var s;(((s=window.visualViewport)===null||s===void 0?void 0:s.height)||0)>n+10&&r.hasFocus&&(r.contentDOM.blur(),r.focus())},100)}return v.ios&&e.inputType=="deleteContentForward"&&r.observer.flushSoon(),v.safari&&e.inputType=="insertText"&&r.inputState.composing>=0&&setTimeout(()=>_e.compositionend(r,e),20),!1};const Ho=new Set;function lO(r){Ho.has(r)||(Ho.add(r),r.addEventListener("copy",()=>{}),r.addEventListener("cut",()=>{}))}const Ko=["pre-wrap","normal","pre-line","break-spaces"];class aO{constructor(e){this.lineWrapping=e,this.doc=I.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Ko.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i-1,a=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=t,this.charWidth=i,this.textHeight=n,this.lineLength=s,a){this.heightSamples={};for(let h=0;h0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e,t){this.height!=t&&(Math.abs(this.height-t)>Xn&&(e.heightChanged=!0),this.height=t)}replace(e,t,i){return ye.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,n){let s=this,o=i.doc;for(let l=n.length-1;l>=0;l--){let{fromA:a,toA:h,fromB:f,toB:c}=n[l],u=s.lineAt(a,K.ByPosNoHeight,i.setDoc(t),0,0),O=u.to>=h?u:s.lineAt(h,K.ByPosNoHeight,i,0,0);for(c+=O.to-h,h=O.to;l>0&&u.from<=n[l-1].toA;)a=n[l-1].fromA,f=n[l-1].fromB,l--,as*2){let l=e[t-1];l.break?e.splice(--t,1,l.left,null,l.right):e.splice(--t,1,l.left,l.right),i+=1+l.break,n-=l.size}else if(s>n*2){let l=e[i];l.break?e.splice(i,1,l.left,null,l.right):e.splice(i,1,l.left,l.right),i+=2+l.break,s-=l.size}else break;else if(n=s&&o(this.blockAt(0,i,n,s))}updateHeight(e,t=0,i=!1,n){return n&&n.from<=t&&n.more&&this.setHeight(e,n.heights[n.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Re extends yh{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,i,n){return new He(n,this.length,i,this.height,this.breaks)}replace(e,t,i){let n=i[0];return i.length==1&&(n instanceof Re||n instanceof Oe&&n.flags&4)&&Math.abs(this.length-n.length)<10?(n instanceof Oe?n=new Re(n.length,this.height):n.height=this.height,this.outdated||(n.outdated=!1),n):ye.of(i)}updateHeight(e,t=0,i=!1,n){return n&&n.from<=t&&n.more?this.setHeight(e,n.heights[n.index++]):(i||this.outdated)&&this.setHeight(e,Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Oe extends ye{constructor(e){super(e,0)}heightMetrics(e,t){let i=e.doc.lineAt(t).number,n=e.doc.lineAt(t+this.length).number,s=n-i+1,o,l=0;if(e.lineWrapping){let a=Math.min(this.height,e.lineHeight*s);o=a/s,this.length>s+1&&(l=(this.height-a)/(this.length-s-1))}else o=this.height/s;return{firstLine:i,lastLine:n,perLine:o,perChar:l}}blockAt(e,t,i,n){let{firstLine:s,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(t,n);if(t.lineWrapping){let h=n+(e0){let s=i[i.length-1];s instanceof Oe?i[i.length-1]=new Oe(s.length+n):i.push(null,new Oe(n-1))}if(e>0){let s=i[0];s instanceof Oe?i[0]=new Oe(e+s.length):i.unshift(new Oe(e-1),null)}return ye.of(i)}decomposeLeft(e,t){t.push(new Oe(e-1),null)}decomposeRight(e,t){t.push(null,new Oe(this.length-e-1))}updateHeight(e,t=0,i=!1,n){let s=t+this.length;if(n&&n.from<=t+this.length&&n.more){let o=[],l=Math.max(t,n.from),a=-1;for(n.from>t&&o.push(new Oe(n.from-t-1).updateHeight(e,t));l<=s&&n.more;){let f=e.doc.lineAt(l).length;o.length&&o.push(null);let c=n.heights[n.index++];a==-1?a=c:Math.abs(c-a)>=Xn&&(a=-2);let u=new Re(f,c);u.outdated=!1,o.push(u),l+=f+1}l<=s&&o.push(null,new Oe(s-l).updateHeight(e,l));let h=ye.of(o);return(a<0||Math.abs(h.height-this.height)>=Xn||Math.abs(a-this.heightMetrics(e,t).perLine)>=Xn)&&(e.heightChanged=!0),h}else(i||this.outdated)&&(this.setHeight(e,e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class fO extends ye{constructor(e,t,i){super(e.length+t+i.length,e.height+i.height,t|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,n){let s=i+this.left.height;return el))return h;let f=t==K.ByPosNoHeight?K.ByPosNoHeight:K.ByPos;return a?h.join(this.right.lineAt(l,f,i,o,l)):this.left.lineAt(l,f,i,n,s).join(h)}forEachLine(e,t,i,n,s,o){let l=n+this.left.height,a=s+this.left.length+this.break;if(this.break)e=a&&this.right.forEachLine(e,t,i,l,a,o);else{let h=this.lineAt(a,K.ByPos,i,n,s);e=e&&h.from<=t&&o(h),t>h.to&&this.right.forEachLine(h.to+1,t,i,l,a,o)}}replace(e,t,i){let n=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-n,t-n,i));let s=[];e>0&&this.decomposeLeft(e,s);let o=s.length;for(let l of i)s.push(l);if(e>0&&Jo(s,o-1),t=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,n=i+this.break;if(e>=n)return this.right.decomposeRight(e-n,t);e2*t.size||t.size>2*e.size?ye.of(this.break?[e,null,t]:[e,t]):(this.left=e,this.right=t,this.height=e.height+t.height,this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,i=!1,n){let{left:s,right:o}=this,l=t+s.length+this.break,a=null;return n&&n.from<=t+s.length&&n.more?a=s=s.updateHeight(e,t,i,n):s.updateHeight(e,t,i),n&&n.from<=l+o.length&&n.more?a=o=o.updateHeight(e,l,i,n):o.updateHeight(e,l,i),a?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Jo(r,e){let t,i;r[e]==null&&(t=r[e-1])instanceof Oe&&(i=r[e+1])instanceof Oe&&r.splice(e-1,3,new Oe(t.length+1+i.length))}const cO=5;class zs{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let i=Math.min(t,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof Re?n.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Re(i-this.pos,-1)),this.writtenTo=i,t>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e=cO)&&this.addLineDeco(n,s,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenToe&&this.nodes.push(new Re(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let i=new Oe(t-e);return this.oracle.doc.lineAt(e).to==t&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Re)return e;let t=new Re(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,i){let n=this.ensureLine();n.length+=i,n.collapsed+=i,n.widgetHeight=Math.max(n.widgetHeight,e),n.breaks+=t,this.writtenTo=this.pos=this.pos+i}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Re)&&!this.isCovered?this.nodes.push(new Re(0,-1)):(this.writtenTof.clientHeight||f.scrollWidth>f.clientWidth)&&c.overflow!="visible"){let u=f.getBoundingClientRect();s=Math.max(s,u.left),o=Math.min(o,u.right),l=Math.max(l,u.top),a=h==r.parentNode?u.bottom:Math.min(a,u.bottom)}h=c.position=="absolute"||c.position=="fixed"?f.offsetParent:f.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:s-t.left,right:Math.max(s,o)-t.left,top:l-(t.top+e),bottom:Math.max(l,a)-(t.top+e)}}function pO(r,e){let t=r.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class br{constructor(e,t,i){this.from=e,this.to=t,this.size=i}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;itypeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new aO(t),this.stateDeco=e.facet(Ei).filter(i=>typeof i!="function"),this.heightMap=ye.empty().applyChanges(this.stateDeco,I.empty,this.heightOracle.setDoc(e.doc),[new qe(0,0,0,e.doc.length)]);for(let i=0;i<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());i++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=te.set(this.lineGaps.map(i=>i.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let n=i?t.head:t.anchor;if(!e.some(({from:s,to:o})=>n>=s&&n<=o)){let{from:s,to:o}=this.lineBlockAt(n);e.push(new dn(s,o))}}return this.viewports=e.sort((i,n)=>i.from-n.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?tl:new Vs(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Pi(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=this.state.facet(Ei).filter(f=>typeof f!="function");let n=e.changedRanges,s=qe.extendWithRanges(n,uO(i,this.stateDeco,e?e.changes:he.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),this.heightMap.height!=o&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let a=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.heada.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,t));let h=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,e.flags|=this.updateForViewport(),(h||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(vu)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,i=window.getComputedStyle(t),n=this.heightOracle,s=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?pe.RTL:pe.LTR;let o=this.heightOracle.mustRefreshForWrapping(s),l=t.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let h=0,f=0;if(l.width&&l.height){let{scaleX:$,scaleY:Z}=Ca(t,l);($>.005&&Math.abs(this.scaleX-$)>.005||Z>.005&&Math.abs(this.scaleY-Z)>.005)&&(this.scaleX=$,this.scaleY=Z,h|=8,o=a=!0)}let c=(parseInt(i.paddingTop)||0)*this.scaleY,u=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=c||this.paddingBottom!=u)&&(this.paddingTop=c,this.paddingBottom=u,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(n.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let O=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=O&&(this.scrollAnchorHeight=-1,this.scrollTop=O),this.scrolledToBottom=Ya(e.scrollDOM);let d=(this.printing?pO:dO)(t,this.paddingTop),g=d.top-this.pixelViewport.top,m=d.bottom-this.pixelViewport.bottom;this.pixelViewport=d;let b=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(b!=this.inView&&(this.inView=b,b&&(a=!0)),!this.inView&&!this.scrollTarget)return 0;let Q=l.width;if((this.contentDOMWidth!=Q||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,h|=8),a){let $=e.docView.measureVisibleLineHeights(this.viewport);if(n.mustRefreshForHeights($)&&(o=!0),o||n.lineWrapping&&Math.abs(Q-this.contentDOMWidth)>n.charWidth){let{lineHeight:Z,charWidth:A,textHeight:X}=e.docView.measureTextSize();o=Z>0&&n.refresh(s,Z,A,X,Q/A,$),o&&(e.docView.minWidth=0,h|=8)}g>0&&m>0?f=Math.max(g,m):g<0&&m<0&&(f=Math.min(g,m)),n.heightChanged=!1;for(let Z of this.viewports){let A=Z.from==this.viewport.from?$:e.docView.measureVisibleLineHeights(Z);this.heightMap=(o?ye.empty().applyChanges(this.stateDeco,I.empty,this.heightOracle,[new qe(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(n,0,o,new hO(Z.from,A))}n.heightChanged&&(h|=2)}let y=!this.viewportIsAppropriate(this.viewport,f)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return y&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(f,this.scrollTarget),h|=this.updateForViewport()),(h&2||y)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),n=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new dn(n.lineAt(o-i*1e3,K.ByHeight,s,0,0).from,n.lineAt(l+(1-i)*1e3,K.ByHeight,s,0,0).to);if(t){let{head:h}=t.range;if(ha.to){let f=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),c=n.lineAt(h,K.ByPos,s,0,0),u;t.y=="center"?u=(c.top+c.bottom)/2-f/2:t.y=="start"||t.y=="nearest"&&h=l+Math.max(10,Math.min(i,250)))&&n>o-2*1e3&&s>1,o=n<<1;if(this.defaultTextDirection!=pe.LTR&&!i)return[];let l=[],a=(f,c,u,O)=>{if(c-ff&&bb.from>=u.from&&b.to<=u.to&&Math.abs(b.from-f)b.fromQ));if(!m){if(cb.from<=c&&b.to>=c)){let b=t.moveToLineBoundary(P.cursor(c),!1,!0).head;b>f&&(c=b)}m=new br(f,c,this.gapSize(u,f,c,O))}l.push(m)},h=f=>{if(f.lengthf.from&&a(f.from,O,f,c),dt.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let t=[];J.spans(e,this.viewport.from,this.viewport.to,{span(n,s){t.push({from:n,to:s})},point(){}},20);let i=t.length!=this.visibleRanges.length||this.visibleRanges.some((n,s)=>n.from!=t[s].from||n.to!=t[s].to);return this.visibleRanges=t,i?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Pi(this.heightMap.lineAt(e,K.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||Pi(this.heightMap.lineAt(this.scaler.fromDOM(e),K.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Pi(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class dn{constructor(e,t){this.from=e,this.to=t}}function mO(r,e,t){let i=[],n=r,s=0;return J.spans(t,r,e,{span(){},point(o,l){o>n&&(i.push({from:n,to:o}),s+=o-n),n=l}},20),n=1)return e[e.length-1].to;let i=Math.floor(r*t);for(let n=0;;n++){let{from:s,to:o}=e[n],l=o-s;if(i<=l)return s+i;i-=l}}function gn(r,e){let t=0;for(let{from:i,to:n}of r.ranges){if(e<=n){t+=e-i;break}t+=n-i}return t/r.total}function bO(r,e){for(let t of r)if(e(t))return t}const tl={toDOM(r){return r},fromDOM(r){return r},scale:1,eq(r){return r==this}};class Vs{constructor(e,t,i){let n=0,s=0,o=0;this.viewports=i.map(({from:l,to:a})=>{let h=t.lineAt(l,K.ByPos,e,0,0).top,f=t.lineAt(a,K.ByPos,e,0,0).bottom;return n+=f-h,{from:l,to:a,top:h,bottom:f,domTop:0,domBottom:0}}),this.scale=(7e6-n)/(t.height-n);for(let l of this.viewports)l.domTop=o+(l.top-s)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),s=l.bottom}toDOM(e){for(let t=0,i=0,n=0;;t++){let s=tt.from==e.viewports[i].from&&t.to==e.viewports[i].to):!1}}function Pi(r,e){if(e.scale==1)return r;let t=e.toDOM(r.top),i=e.toDOM(r.bottom);return new He(r.from,r.length,t,i-t,Array.isArray(r._content)?r._content.map(n=>Pi(n,e)):r._content)}const mn=W.define({combine:r=>r.join(" ")}),us=W.define({combine:r=>r.indexOf(!0)>-1}),Os=vt.newName(),Ph=vt.newName(),xh=vt.newName(),$h={"&light":"."+Ph,"&dark":"."+xh};function ds(r,e,t){return new vt(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,n=>{if(n=="&")return r;if(!t||!t[n])throw new RangeError(`Unsupported selector: ${n}`);return t[n]}):r+" "+i}})}const SO=ds("."+Os,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},$h),xi="￿";class QO{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(V.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=xi}readRange(e,t){if(!e)return this;let i=e.parentNode;for(let n=e;;){this.findPointBefore(i,n);let s=this.text.length;this.readNode(n);let o=n.nextSibling;if(o==t)break;let l=F.get(n),a=F.get(o);(l&&a?l.breakAfter:(l?l.breakAfter:zn(n))||zn(o)&&(n.nodeName!="BR"||n.cmIgnore)&&this.text.length>s)&&this.lineBreak(),n=o}return this.findPointBefore(i,t),this}readTextNode(e){let t=e.nodeValue;for(let i of this.points)i.node==e&&(i.pos=this.text.length+Math.min(i.offset,t.length));for(let i=0,n=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,l;if(this.lineSeparator?(s=t.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(l=n.exec(t))&&(s=l.index,o=l[0].length),this.append(t.slice(i,s<0?t.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=o-1);i=s+o}}readNode(e){if(e.cmIgnore)return;let t=F.get(e),i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let n=i.iter();!n.next().done;)n.lineBreak?this.lineBreak():this.append(n.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let i of this.points)i.node==e&&e.childNodes[i.offset]==t&&(i.pos=this.text.length)}findPointInside(e,t){for(let i of this.points)(e.nodeType==3?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+(kO(e,i.node,i.offset)?t:0))}}function kO(r,e,t){for(;;){if(!e||t-1;let{impreciseHead:s,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,i,0))){let l=s||o?[]:xO(e),a=new QO(l,e.state);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=$O(l,this.bounds.from)}else{let l=e.observer.selectionRange,a=s&&s.node==l.focusNode&&s.offset==l.focusOffset||!Jr(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),h=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!Jr(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),f=e.viewport;if((v.ios||v.chrome)&&e.state.selection.main.empty&&a!=h&&(f.from>0||f.toDate.now()-100?r.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:l}=e.bounds,a=n.from,h=null;(s===8||v.android&&e.text.length=n.from&&t.to<=n.to&&(t.from!=n.from||t.to!=n.to)&&n.to-n.from-(t.to-t.from)<=4?t={from:n.from,to:n.to,insert:r.state.doc.slice(n.from,t.from).append(t.insert).append(r.state.doc.slice(t.to,n.to))}:(v.mac||v.android)&&t&&t.from==t.to&&t.from==n.head-1&&/^\. ?$/.test(t.insert.toString())&&r.contentDOM.getAttribute("autocorrect")=="off"?(i&&t.insert.length==2&&(i=P.single(i.main.anchor-1,i.main.head-1)),t={from:n.from,to:n.to,insert:I.of([" "])}):v.chrome&&t&&t.from==t.to&&t.from==n.head&&t.insert.toString()==` `&&r.lineWrapping&&(i&&(i=P.single(i.main.anchor-1,i.main.head-1)),t={from:n.from,to:n.to,insert:I.of([" "])}),t)return Zh(r,t,i,s);if(i&&!i.main.eq(n)){let o=!1,l="select";return r.inputState.lastSelectionTime>Date.now()-50&&(r.inputState.lastSelectionOrigin=="select"&&(o=!0),l=r.inputState.lastSelectionOrigin),r.dispatch({selection:i,scrollIntoView:o,userEvent:l}),!0}else return!1}function Zh(r,e,t,i=-1){if(v.ios&&r.inputState.flushIOSKey(e))return!0;let n=r.state.selection.main;if(v.android&&(e.to==n.to&&(e.from==n.from||e.from==n.from-1&&r.state.sliceDoc(e.from,n.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Gt(r.contentDOM,"Enter",13)||(e.from==n.from-1&&e.to==n.to&&e.insert.length==0||i==8&&e.insert.lengthn.head)&&Gt(r.contentDOM,"Backspace",8)||e.from==n.from&&e.to==n.to+1&&e.insert.length==0&&Gt(r.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();r.inputState.composing>=0&&r.inputState.composing++;let o,l=()=>o||(o=yO(r,e,t));return r.state.facet(ih).some(a=>a(r,e.from,e.to,s,l))||r.dispatch(l()),!0}function yO(r,e,t){let i,n=r.state,s=n.selection.main;if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&r.inputState.composing<0){let l=s.frome.to?n.sliceDoc(e.to,s.to):"";i=n.replaceSelection(r.state.toText(l+e.insert.sliceString(0,void 0,r.state.lineBreak)+a))}else{let l=n.changes(e),a=t&&t.main.to<=l.newLength?t.main:void 0;if(n.selection.ranges.length>1&&r.inputState.composing>=0&&e.to<=s.to&&e.to>=s.to-10){let h=r.state.sliceDoc(e.from,e.to),f,c=t&&uh(r,t.main.head);if(c){let d=e.insert.length-(e.to-e.from);f={from:c.from,to:c.to-d}}else f=r.state.doc.lineAt(s.head);let u=s.to-e.to,O=s.to-s.from;i=n.changeByRange(d=>{if(d.from==s.from&&d.to==s.to)return{changes:l,range:a||d.map(l)};let g=d.to-u,m=g-h.length;if(d.to-d.from!=O||r.state.sliceDoc(m,g)!=h||d.to>=f.from&&d.from<=f.to)return{range:d};let b=n.changes({from:m,to:g,insert:e.insert}),Q=d.to-s.to;return{changes:b,range:a?P.range(Math.max(0,a.anchor+Q),Math.max(0,a.head+Q)):d.map(b)}})}else i={changes:l,selection:a&&n.selection.replaceRange(a)}}let o="input.type";return(r.composing||r.inputState.compositionPendingChange&&r.inputState.compositionEndedAt>Date.now()-50)&&(r.inputState.compositionPendingChange=!1,o+=".compose",r.inputState.compositionFirstChange&&(o+=".start",r.inputState.compositionFirstChange=!1)),n.update(i,{userEvent:o,scrollIntoView:!0})}function PO(r,e,t,i){let n=Math.min(r.length,e.length),s=0;for(;s0&&l>0&&r.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(i=="end"){let a=Math.max(0,s-Math.min(o,l));t-=o+a-s}if(o=o?s-t:0;s-=a,l=s+(l-o),o=s}else if(l=l?s-t:0;s-=a,o=s+(o-l),l=s}return{from:s,toA:o,toB:l}}function xO(r){let e=[];if(r.root.activeElement!=r.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:n,focusOffset:s}=r.observer.selectionRange;return t&&(e.push(new il(t,i)),(n!=t||s!=i)&&e.push(new il(n,s))),e}function $O(r,e){if(r.length==0)return null;let t=r[0].pos,i=r.length==2?r[1].pos:t;return t>-1&&i>-1?P.single(t+e,i+e):null}const vO={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Sr=v.ie&&v.ie_version<=11;class ZO{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new fu,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let i of t)this.queue.push(i);(v.ie&&v.ie_version<=11||v.ios&&e.composing)&&t.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&e.constructor.EDIT_CONTEXT!==!1&&!(v.chrome&&v.chrome_version<126)&&(this.editContext=new RO(e),e.state.facet(wt)&&(e.contentDOM.editContext=this.editContext.editContext)),Sr&&(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),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?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")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){e.type=="change"&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,i)=>t!=e[i]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,n=this.selectionRange;if(i.state.facet(wt)?i.root.activeElement!=this.dom:!Tn(i.dom,n))return;let s=n.anchorNode&&i.docView.nearest(n.anchorNode);if(s&&s.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(v.ie&&v.ie_version<=11||v.android&&v.chrome)&&!i.state.selection.main.empty&&n.focusNode&&Ti(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Mi(e.root);if(!t)return!1;let i=v.safari&&e.root.nodeType==11&&ou(this.dom.ownerDocument)==this.dom&&TO(this.view,t)||t;if(!i||this.selectionRange.eq(i))return!1;let n=Tn(this.dom,i);return n&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&Gt(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(n)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,i=-1,n=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(n=!0),t==-1?{from:t,to:i}=o:(t=Math.min(o.from,t),i=Math.max(o.to,i)))}return{from:t,to:i,typeOver:n}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),n=this.selectionChanged&&Tn(this.dom,this.selectionRange);if(e<0&&!n)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new wO(this.view,e,t,i);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let i=this.view.state,n=vh(this.view,t);return this.view.state==i&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),n}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty(e.type=="attributes"),e.type=="attributes"&&(t.flags|=4),e.type=="childList"){let i=nl(t,e.previousSibling||e.target.previousSibling,-1),n=nl(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:n?t.posBefore(n):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener("change",this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener("change",this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(wt)!=e.state.facet(wt)&&(e.view.contentDOM.editContext=e.state.facet(wt)?this.editContext.editContext:null))}destroy(){var e,t,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect();for(let n of this.scrollTargets)n.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 nl(r,e,t){for(;e;){let i=F.get(e);if(i&&i.parent==r)return i;let n=e.parentNode;e=n!=r.dom?n:t>0?e.nextSibling:e.previousSibling}return null}function rl(r,e){let t=e.startContainer,i=e.startOffset,n=e.endContainer,s=e.endOffset,o=r.docView.domAtPos(r.state.selection.main.anchor);return Ti(o.node,o.offset,n,s)&&([t,i,n,s]=[n,s,t,i]),{anchorNode:t,anchorOffset:i,focusNode:n,focusOffset:s}}function TO(r,e){if(e.getComposedRanges){let n=e.getComposedRanges(r.root)[0];if(n)return rl(r,n)}let t=null;function i(n){n.preventDefault(),n.stopImmediatePropagation(),t=n.getTargetRanges()[0]}return r.contentDOM.addEventListener("beforeinput",i,!0),r.dom.ownerDocument.execCommand("indent"),r.contentDOM.removeEventListener("beforeinput",i,!0),t?rl(r,t):null}class RO{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});t.addEventListener("textupdate",i=>{let{anchor:n}=e.state.selection.main,s={from:this.toEditorPos(i.updateRangeStart),to:this.toEditorPos(i.updateRangeEnd),insert:I.of(i.text.split(` `))};s.from==this.from&&nthis.to&&(s.to=n),!(s.from==s.to&&!s.insert.length)&&(this.pendingContextChange=s,Zh(e,s,P.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd))),this.pendingContextChange&&this.revertPending(e.state))}),t.addEventListener("characterboundsupdate",i=>{let n=[],s=null;for(let o=this.toEditorPos(i.rangeStart),l=this.toEditorPos(i.rangeEnd);o{let n=[];for(let s of i.getTextFormats()){let o=s.underlineStyle,l=s.underlineThickness;if(o!="None"&&l!="None"){let a=`text-decoration: underline ${o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${l=="Thin"?1:2}px`;n.push(te.mark({attributes:{style:a}}).range(this.toEditorPos(s.rangeStart),this.toEditorPos(s.rangeEnd)))}}e.dispatch({effects:oh.of(te.set(n))})}),t.addEventListener("compositionstart",()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)}),t.addEventListener("compositionend",()=>{e.inputState.composing=-1,e.inputState.compositionFirstChange=null}),this.measureReq={read:i=>{this.editContext.updateControlBounds(i.contentDOM.getBoundingClientRect());let n=Mi(i.root);n&&n.rangeCount&&this.editContext.updateSelectionBounds(n.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,n=this.pendingContextChange;return e.changes.iterChanges((s,o,l,a,h)=>{if(i)return;let f=h.length-(o-s);if(n&&o>=n.to)if(n.from==s&&n.to==o&&n.insert.eq(h)){n=this.pendingContextChange=null,t+=f,this.to+=f;return}else n=null,this.revertPending(e.state);if(s+=t,o+=t,o<=this.from)this.from+=f,this.to+=f;else if(sthis.to||this.to-this.from+h.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),h.toString()),this.to+=f}t+=f}),n&&!i&&this.revertPending(e.state),!i}update(e){!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.resetRange(e.state),this.editContext.updateText(0,this.editContext.text.length,e.state.doc.sliceString(this.from,this.to)),this.setSelection(e.state)):(e.docChanged||e.selectionSet)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.to+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),n=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=n)&&this.editContext.updateSelection(i,n)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to1e4*3)}toEditorPos(e){return e+this.from}toContextPos(e){return e-this.from}}class q{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:t}=e;this.dispatchTransactions=e.dispatchTransactions||t&&(i=>i.forEach(n=>t(n,this)))||(i=>this.update(i)),this.dispatch=this.dispatch.bind(this),this._root=e.root||cu(e.parent)||document,this.viewState=new el(e.state||V.create(e)),e.scrollTo&&e.scrollTo.is(cn)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(wi).map(i=>new pr(i));for(let i of this.plugins)i.update(this);this.observer=new ZO(this),this.inputState=new ju(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Mo(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure()}dispatch(...e){let t=e.length==1&&e[0]instanceof ae?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,i=!1,n,s=this.state;for(let u of e){if(u.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=u.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,l=0,a=null;e.some(u=>u.annotation(Qh))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=kh(s,o),a||(l=1));let h=this.observer.delayedAndroidKey,f=null;if(h?(this.observer.clearDelayedAndroidKey(),f=this.observer.readChange(),(f&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(f=null)):this.observer.clear(),s.facet(V.phrases)!=this.state.facet(V.phrases))return this.setState(s);n=Un.create(this,s,e),n.flags|=l;let c=this.viewState.scrollTarget;try{this.updateState=2;for(let u of e){if(c&&(c=c.map(u.changes)),u.scrollIntoView){let{main:O}=u.state.selection;c=new Ft(O.empty?O:P.cursor(O.head,O.head>O.anchor?-1:1))}for(let O of u.effects)O.is(cn)&&(c=O.value.clip(this.state))}this.viewState.update(n,c),this.bidiCache=Dn.update(this.bidiCache,n.changes),n.empty||(this.updatePlugins(n),this.inputState.update(n)),t=this.docView.update(n),this.state.facet(yi)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(u=>u.isUserEvent("select.pointer")))}finally{this.updateState=0}if(n.startState.facet(mn)!=n.state.facet(mn)&&(this.viewState.mustMeasureContent=!0),(t||i||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!n.empty)for(let u of this.state.facet(hs))try{u(n)}catch(O){Je(this.state,O,"update listener")}(a||f)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),f&&!vh(this,f)&&h.force&&Gt(this.contentDOM,h.key,h.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new el(e),this.plugins=e.facet(wi).map(i=>new pr(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new Mo(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(wi),i=e.state.facet(wi);if(t!=i){let n=[];for(let s of i){let o=t.indexOf(s);if(o<0)n.push(new pr(s));else{let l=this.plugins[o];l.mustUpdate=e,n.push(l)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=n,this.pluginMap.clear()}else for(let n of this.plugins)n.mustUpdate=e;for(let n=0;n-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,i=this.scrollDOM,n=i.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(n-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(Ya(i))s=-1,o=this.viewState.heightMap.height;else{let O=this.viewState.scrollAnchorAt(n);s=O.from,o=O.top}this.updateState=1;let a=this.viewState.measure(this);if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];a&4||([this.measureRequests,h]=[h,this.measureRequests]);let f=h.map(O=>{try{return O.read(this)}catch(d){return Je(this.state,d),sl}}),c=Un.create(this,this.state,[]),u=!1;c.flags|=a,t?t.flags|=a:t=c,this.updateState=2,c.empty||(this.updatePlugins(c),this.inputState.update(c),this.updateAttrs(),u=this.docView.update(c),u&&this.docViewUpdate());for(let O=0;O1||d<-1){n=n+d,i.scrollTop=n/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let l of this.state.facet(hs))l(t)}get themeClasses(){return Os+" "+(this.state.facet(us)?xh:Ph)+" "+this.state.facet(mn)}updateAttrs(){let e=ol(this,lh,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(wt)?"true":"false",class:"cm-content",style:`${v.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),ol(this,qs,t);let i=this.observer.ignore(()=>{let n=rs(this.contentDOM,this.contentAttrs,t),s=rs(this.dom,this.editorAttrs,e);return n||s});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let n of i.effects)if(n.is(q.announce)){t&&(this.announceDOM.textContent=""),t=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=n.value}}mountStyles(){this.styleModules=this.state.facet(yi);let e=this.state.facet(q.cspNonce);vt.mount(this.root,this.styleModules.concat(SO).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;ti.spec==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,i){return mr(this,e,Uo(this,e,t,i))}moveByGroup(e,t){return mr(this,e,Uo(this,e,t,i=>Du(this,e.head,i)))}visualLineSide(e,t){let i=this.bidiSpans(e),n=this.textDirectionAt(e.from),s=i[t?i.length-1:0];return P.cursor(s.side(t,n)+e.from,s.forward(!t,n)?1:-1)}moveToLineBoundary(e,t,i=!0){return Uu(this,e,t,i)}moveVertically(e,t,i){return mr(this,e,Iu(this,e,t,i))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),Oh(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.docView.coordsAt(e,t);if(!i||i.left==i.right)return i;let n=this.state.doc.lineAt(e),s=this.bidiSpans(n),o=s[xt.find(s,e-n.from,-1,t)];return nr(i,o.dir==pe.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(rh)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>XO)return Fa(e.length);let t=this.textDirectionAt(e.from),i;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==t&&(s.fresh||Ga(s.isolates,i=Yo(this,e))))return s.order;i||(i=Yo(this,e));let n=Pu(e.text,t,i);return this.bidiCache.push(new Dn(e.from,e.to,t,i,!0,n)),n}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||v.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Aa(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return cn.of(new Ft(typeof e=="number"?P.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return cn.of(new Ft(P.cursor(i.from),"start","start",i.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return Ut.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Ut.define(()=>({}),{eventObservers:e})}static theme(e,t){let i=vt.newName(),n=[mn.of(i),yi.of(ds(`.${i}`,e))];return t&&t.dark&&n.push(us.of(!0)),n}static baseTheme(e){return ir.lowest(yi.of(ds("."+Os,e,$h)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),n=i&&F.get(i)||F.get(e);return((t=n==null?void 0:n.rootView)===null||t===void 0?void 0:t.view)||null}}q.styleModule=yi;q.inputHandler=ih;q.scrollHandler=sh;q.focusChangeEffect=nh;q.perLineTextDirection=rh;q.exceptionSink=th;q.updateListener=hs;q.editable=wt;q.mouseSelectionStyle=eh;q.dragMovesSelection=Ja;q.clickAddsSelectionRange=Ka;q.decorations=Ei;q.outerDecorations=ah;q.atomicRanges=_s;q.bidiIsolatedRanges=hh;q.scrollMargins=fh;q.darkTheme=us;q.cspNonce=W.define({combine:r=>r.length?r[0]:""});q.contentAttributes=qs;q.editorAttributes=lh;q.lineWrapping=q.contentAttributes.of({class:"cm-lineWrapping"});q.announce=ie.define();const XO=4096,sl={};class Dn{constructor(e,t,i,n,s,o){this.from=e,this.to=t,this.dir=i,this.isolates=n,this.fresh=s,this.order=o}static update(e,t){if(t.empty&&!e.some(s=>s.fresh))return e;let i=[],n=e.length?e[e.length-1].dir:pe.LTR;for(let s=Math.max(0,e.length-10);s=0;n--){let s=i[n],o=typeof s=="function"?s(r):s;o&&ns(o,t)}return t}const CO=v.mac?"mac":v.windows?"win":v.linux?"linux":"key";function AO(r,e){const t=r.split(/-(?!$)/);let i=t[t.length-1];i=="Space"&&(i=" ");let n,s,o,l;for(let a=0;ai.concat(n),[]))),t}let yt=null;const MO=4e3;function EO(r,e=CO){let t=Object.create(null),i=Object.create(null),n=(o,l)=>{let a=i[o];if(a==null)i[o]=l;else if(a!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},s=(o,l,a,h,f)=>{var c,u;let O=t[o]||(t[o]=Object.create(null)),d=l.split(/ (?!$)/).map(b=>AO(b,e));for(let b=1;b{let $=yt={view:y,prefix:Q,scope:o};return setTimeout(()=>{yt==$&&(yt=null)},MO),!0}]})}let g=d.join(" ");n(g,!1);let m=O[g]||(O[g]={preventDefault:!1,stopPropagation:!1,run:((u=(c=O._any)===null||c===void 0?void 0:c.run)===null||u===void 0?void 0:u.slice())||[]});a&&m.run.push(a),h&&(m.preventDefault=!0),f&&(m.stopPropagation=!0)};for(let o of r){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let h of l){let f=t[h]||(t[h]=Object.create(null));f._any||(f._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:c}=o;for(let u in f)f[u].run.push(O=>c(O,ps))}let a=o[e]||o.key;if(a)for(let h of l)s(h,a,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(h,"Shift-"+a,o.shift,o.preventDefault,o.stopPropagation)}return t}let ps=null;function qO(r,e,t,i){ps=e;let n=su(e),s=vn(n,0),o=_r(s)==n.length&&n!=" ",l="",a=!1,h=!1,f=!1;yt&&yt.view==t&&yt.scope==i&&(l=yt.prefix+" ",ph.indexOf(e.keyCode)<0&&(h=!0,yt=null));let c=new Set,u=m=>{if(m){for(let b of m.run)if(!c.has(b)&&(c.add(b),b(t)))return m.stopPropagation&&(f=!0),!0;m.preventDefault&&(m.stopPropagation&&(f=!0),h=!0)}return!1},O=r[i],d,g;return O&&(u(O[l+bn(n,e,!o)])?a=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(v.windows&&e.ctrlKey&&e.altKey)&&(d=Zt[e.keyCode])&&d!=n?(u(O[l+bn(d,e,!0)])||e.shiftKey&&(g=Yi[e.keyCode])!=n&&g!=d&&u(O[l+bn(g,e,!1)]))&&(a=!0):o&&e.shiftKey&&u(O[l+bn(n,e,!0)])&&(a=!0),!a&&u(O._any)&&(a=!0)),h&&(a=!0),a&&f&&e.stopPropagation(),ps=null,a}const _O=!v.ios,al={".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"}},".cm-content":{"& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}};_O&&(al[".cm-line"].caretColor=al[".cm-content"].caretColor="transparent !important");class zO extends Li{constructor(e){super(),this.content=e}toDOM(){let e=document.createElement("span");return e.className="cm-placeholder",e.style.pointerEvents="none",e.appendChild(typeof this.content=="string"?document.createTextNode(this.content):this.content),typeof this.content=="string"?e.setAttribute("aria-label","placeholder "+this.content):e.setAttribute("aria-hidden","true"),e}coordsAt(e){let t=e.firstChild?ti(e.firstChild):[];if(!t.length)return null;let i=window.getComputedStyle(e.parentNode),n=nr(t[0],i.direction!="rtl"),s=parseInt(i.lineHeight);return n.bottom-n.top>s*1.5?{left:n.left,right:n.right,top:n.top,bottom:n.top+s}:n}ignoreEvent(){return!1}}function VO(r){return Ut.fromClass(class{constructor(e){this.view=e,this.placeholder=r?te.set([te.widget({widget:new zO(r),side:1}).range(0)]):te.none}get decorations(){return this.view.state.doc.length?te.none:this.placeholder}},{decorations:e=>e.decorations})}class ri extends qt{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}ri.prototype.elementClass="";ri.prototype.toDOM=void 0;ri.prototype.mapMode=we.TrackBefore;ri.prototype.startSide=ri.prototype.endSide=-1;ri.prototype.point=!0;const Th=1024;let UO=0;class Ye{constructor(e,t){this.from=e,this.to=t}}class Y{constructor(e={}){this.id=UO++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=fe.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}Y.closedBy=new Y({deserialize:r=>r.split(" ")});Y.openedBy=new Y({deserialize:r=>r.split(" ")});Y.group=new Y({deserialize:r=>r.split(" ")});Y.isolate=new Y({deserialize:r=>{if(r&&r!="rtl"&&r!="ltr"&&r!="auto")throw new RangeError("Invalid value for isolate: "+r);return r||"auto"}});Y.contextHash=new Y({perNode:!0});Y.lookAhead=new Y({perNode:!0});Y.mounted=new Y({perNode:!0});class qi{constructor(e,t,i){this.tree=e,this.overlay=t,this.parser=i}static get(e){return e&&e.props&&e.props[Y.mounted.id]}}const DO=Object.create(null);class fe{constructor(e,t,i,n=0){this.name=e,this.props=t,this.id=i,this.flags=n}static define(e){let t=e.props&&e.props.length?Object.create(null):DO,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),n=new fe(e.name||"",t,e.id,i);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(n)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return n}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(Y.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let n of i.split(" "))t[n]=e[i];return i=>{for(let n=i.prop(Y.group),s=-1;s<(n?n.length:0);s++){let o=t[s<0?i.name:n[s]];if(o)return o}}}}fe.none=new fe("",Object.create(null),0,8);class Fi{constructor(e){this.types=e;for(let t=0;t0;for(let a=this.cursor(o|H.IncludeAnonymous);;){let h=!1;if(a.from<=s&&a.to>=n&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&i&&(l||!a.type.isAnonymous)&&i(a),!a.nextSibling();){if(!a.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:Is(fe.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,n)=>new j(this.type,t,i,n,this.propValues),e.makeTree||((t,i,n)=>new j(fe.none,t,i,n)))}static build(e){return LO(e)}}j.empty=new j(fe.none,[],[],0);class Us{constructor(e,t){this.buffer=e,this.index=t}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 Us(this.buffer,this.index)}}class Rt{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return fe.none}toString(){let e=[];for(let t=0;t0));a=o[a+3]);return l}slice(e,t,i){let n=this.buffer,s=new Uint16Array(t-e),o=0;for(let l=e,a=0;l=e&&te;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function _i(r,e,t,i){for(var n;r.from==r.to||(t<1?r.from>=e:r.from>e)||(t>-1?r.to<=e:r.to0?l.length:-1;e!=h;e+=t){let f=l[e],c=a[e]+o.from;if(Rh(n,i,c,c+f.length)){if(f instanceof Rt){if(s&H.ExcludeBuffers)continue;let u=f.findChild(0,f.buffer.length,t,i-c,n);if(u>-1)return new et(new IO(o,f,e,c),null,u)}else if(s&H.IncludeAnonymous||!f.type.isAnonymous||Ds(f)){let u;if(!(s&H.IgnoreMounts)&&(u=qi.get(f))&&!u.overlay)return new ke(u.tree,c,e,o);let O=new ke(f,c,e,o);return s&H.IncludeAnonymous||!O.type.isAnonymous?O:O.nextChild(t<0?f.children.length-1:0,t,i,n)}}}if(s&H.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,i=0){let n;if(!(i&H.IgnoreOverlays)&&(n=qi.get(this._tree))&&n.overlay){let s=e-this.from;for(let{from:o,to:l}of n.overlay)if((t>0?o<=s:o=s:l>s))return new ke(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function fl(r,e,t,i){let n=r.cursor(),s=[];if(!n.firstChild())return s;if(t!=null){for(let o=!1;!o;)if(o=n.type.is(t),!n.nextSibling())return s}for(;;){if(i!=null&&n.type.is(i))return s;if(n.type.is(e)&&s.push(n.node),!n.nextSibling())return i==null?s:[]}}function gs(r,e,t=e.length-1){for(let i=r.parent;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}class IO{constructor(e,t,i,n){this.parent=e,this.buffer=t,this.index=i,this.start=n}}class et extends Xh{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:n}=this.context,s=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.context.start,i);return s<0?null:new et(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,i=0){if(i&H.ExcludeBuffers)return null;let{buffer:n}=this.context,s=n.findChild(this.index+4,n.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new et(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new et(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new et(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,n=this.index+4,s=i.buffer[this.index+3];if(s>n){let o=i.buffer[this.index+1];e.push(i.slice(n,s,o)),t.push(0)}return new j(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Ch(r){if(!r.length)return null;let e=0,t=r[0];for(let s=1;st.from||o.to=e){let l=new ke(o.tree,o.overlay[0].from+s.from,-1,s);(n||(n=[i])).push(_i(l,e,t,!1))}}return n?Ch(n):i}class In{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof ke)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:i,buffer:n}=this.buffer;return this.type=t||n.set.types[n.buffer[e]],this.from=i+n.buffer[e+1],this.to=i+n.buffer[e+2],!0}yield(e){return e?e instanceof ke?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:n}=this.buffer,s=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.buffer.start,i);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?i&H.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&H.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&H.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let n=i<0?0:this.stack[i]+4;if(this.index!=n)return this.yieldBuf(t.findChild(n,this.index,-1,0,4))}else{let n=t.buffer[this.index+3];if(n<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(n)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:n}=this;if(n){if(e>0){if(this.index-1)for(let s=t+e,o=e<0?-1:i._tree.children.length;s!=o;s+=e){let l=i._tree.children[s];if(this.mode&H.IncludeAnonymous||l instanceof Rt||!l.type.isAnonymous||Ds(l))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let o=e;o;o=o._parent)if(o.index==n){if(n==this.index)return o;t=o,i=s+1;break e}n=this.stack[--s]}for(let n=i;n=0;s--){if(s<0)return gs(this.node,e,n);let o=i[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[n]&&e[n]!=o.name)return!1;n--}}return!0}}function Ds(r){return r.children.some(e=>e instanceof Rt||!e.type.isAnonymous||Ds(e))}function LO(r){var e;let{buffer:t,nodeSet:i,maxBufferLength:n=Th,reused:s=[],minRepeatType:o=i.types.length}=r,l=Array.isArray(t)?new Us(t,t.length):t,a=i.types,h=0,f=0;function c(Z,A,X,ee,B,U){let{id:M,start:E,end:L,size:N}=l,me=f;for(;N<0;)if(l.next(),N==-1){let re=s[M];X.push(re),ee.push(E-Z);return}else if(N==-3){h=M;return}else if(N==-4){f=M;return}else throw new RangeError(`Unrecognized record size: ${N}`);let st=a[M],mt,R,S=E-Z;if(L-E<=n&&(R=m(l.pos-A,B))){let re=new Uint16Array(R.size-R.skip),se=l.pos-R.size,C=re.length;for(;l.pos>se;)C=b(R.start,re,C);mt=new Rt(re,L-R.start,i),S=R.start-Z}else{let re=l.pos-N;l.next();let se=[],C=[],Ve=M>=o?M:-1,ne=0,ue=L;for(;l.pos>re;)Ve>=0&&l.id==Ve&&l.size>=0?(l.end<=ue-n&&(d(se,C,E,ne,l.end,ue,Ve,me),ne=se.length,ue=l.end),l.next()):U>2500?u(E,re,se,C):c(E,re,se,C,Ve,U+1);if(Ve>=0&&ne>0&&ne-1&&ne>0){let ot=O(st);mt=Is(st,se,C,0,se.length,0,L-E,ot,ot)}else mt=g(st,se,C,L-E,me-L)}X.push(mt),ee.push(S)}function u(Z,A,X,ee){let B=[],U=0,M=-1;for(;l.pos>A;){let{id:E,start:L,end:N,size:me}=l;if(me>4)l.next();else{if(M>-1&&L=0;N-=3)E[me++]=B[N],E[me++]=B[N+1]-L,E[me++]=B[N+2]-L,E[me++]=me;X.push(new Rt(E,B[2]-L,i)),ee.push(L-Z)}}function O(Z){return(A,X,ee)=>{let B=0,U=A.length-1,M,E;if(U>=0&&(M=A[U])instanceof j){if(!U&&M.type==Z&&M.length==ee)return M;(E=M.prop(Y.lookAhead))&&(B=X[U]+M.length+E)}return g(Z,A,X,ee,B)}}function d(Z,A,X,ee,B,U,M,E){let L=[],N=[];for(;Z.length>ee;)L.push(Z.pop()),N.push(A.pop()+X-B);Z.push(g(i.types[M],L,N,U-B,E-U)),A.push(B-X)}function g(Z,A,X,ee,B=0,U){if(h){let M=[Y.contextHash,h];U=U?[M].concat(U):[M]}if(B>25){let M=[Y.lookAhead,B];U=U?[M].concat(U):[M]}return new j(Z,A,X,ee,U)}function m(Z,A){let X=l.fork(),ee=0,B=0,U=0,M=X.end-n,E={size:0,start:0,skip:0};e:for(let L=X.pos-Z;X.pos>L;){let N=X.size;if(X.id==A&&N>=0){E.size=ee,E.start=B,E.skip=U,U+=4,ee+=4,X.next();continue}let me=X.pos-N;if(N<0||me=o?4:0,mt=X.start;for(X.next();X.pos>me;){if(X.size<0)if(X.size==-3)st+=4;else break e;else X.id>=o&&(st+=4);X.next()}B=mt,ee+=N,U+=st}return(A<0||ee==Z)&&(E.size=ee,E.start=B,E.skip=U),E.size>4?E:void 0}function b(Z,A,X){let{id:ee,start:B,end:U,size:M}=l;if(l.next(),M>=0&&ee4){let L=l.pos-(M-4);for(;l.pos>L;)X=b(Z,A,X)}A[--X]=E,A[--X]=U-Z,A[--X]=B-Z,A[--X]=ee}else M==-3?h=ee:M==-4&&(f=ee);return X}let Q=[],y=[];for(;l.pos>0;)c(r.start||0,r.bufferStart||0,Q,y,-1,0);let $=(e=r.length)!==null&&e!==void 0?e:Q.length?y[0]+Q[0].length:0;return new j(a[r.topID],Q.reverse(),y.reverse(),$)}const cl=new WeakMap;function Cn(r,e){if(!r.isAnonymous||e instanceof Rt||e.type!=r)return 1;let t=cl.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=r||!(i instanceof j)){t=1;break}t+=Cn(r,i)}cl.set(e,t)}return t}function Is(r,e,t,i,n,s,o,l,a){let h=0;for(let d=i;d=f)break;A+=X}if(y==$+1){if(A>f){let X=d[$];O(X.children,X.positions,0,X.children.length,g[$]+Q);continue}c.push(d[$])}else{let X=g[y-1]+d[y-1].length-Z;c.push(Is(r,d,g,$,y,Z,X,null,a))}u.push(Z+Q-s)}}return O(e,t,i,n,0),(l||a)(c,u,o)}class Ah{constructor(){this.map=new WeakMap}setBuffer(e,t,i){let n=this.map.get(e);n||this.map.set(e,n=new Map),n.set(t,i)}getBuffer(e,t){let i=this.map.get(e);return i&&i.get(t)}set(e,t){e instanceof et?this.setBuffer(e.context.buffer,e.index,t):e instanceof ke&&this.map.set(e.tree,t)}get(e){return e instanceof et?this.getBuffer(e.context.buffer,e.index):e instanceof ke?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class ct{constructor(e,t,i,n,s=!1,o=!1){this.from=e,this.to=t,this.tree=i,this.offset=n,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let n=[new ct(0,e.length,e,0,!1,i)];for(let s of t)s.to>e.length&&n.push(s);return n}static applyChanges(e,t,i=128){if(!t.length)return e;let n=[],s=1,o=e.length?e[0]:null;for(let l=0,a=0,h=0;;l++){let f=l=i)for(;o&&o.from=u.from||c<=u.to||h){let O=Math.max(u.from,a)-h,d=Math.min(u.to,c)-h;u=O>=d?null:new ct(O,d,u.tree,u.offset+h,l>0,!!f)}if(u&&n.push(u),o.to>c)break;o=snew Ye(n.from,n.to)):[new Ye(0,0)]:[new Ye(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let n=this.startParse(e,t,i);for(;;){let s=n.advance();if(s)return s}}}class NO{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}function Wh(r){return(e,t,i,n)=>new FO(e,r,t,i,n)}class ul{constructor(e,t,i,n,s){this.parser=e,this.parse=t,this.overlay=i,this.target=n,this.from=s}}function Ol(r){if(!r.length||r.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(r))}class GO{constructor(e,t,i,n,s,o,l){this.parser=e,this.predicate=t,this.mounts=i,this.index=n,this.start=s,this.target=o,this.prev=l,this.depth=0,this.ranges=[]}}const ms=new Y({perNode:!0});class FO{constructor(e,t,i,n,s){this.nest=t,this.input=i,this.fragments=n,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let i=this.baseParse.advance();if(!i)return null;if(this.baseParse=null,this.baseTree=i,this.startInner(),this.stoppedAt!=null)for(let n of this.inner)n.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let i=this.baseTree;return this.stoppedAt!=null&&(i=new j(i.type,i.children,i.positions,i.length,i.propValues.concat([[ms,this.stoppedAt]]))),i}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let i=Object.assign(Object.create(null),e.target.props);i[Y.mounted.id]=new qi(t,e.overlay,e.parser),e.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t=this.stoppedAt)l=!1;else if(e.hasNode(n)){if(t){let h=t.mounts.find(f=>f.frag.from<=n.from&&f.frag.to>=n.to&&f.mount.overlay);if(h)for(let f of h.mount.overlay){let c=f.from+h.pos,u=f.to+h.pos;c>=n.from&&u<=n.to&&!t.ranges.some(O=>O.fromc)&&t.ranges.push({from:c,to:u})}}l=!1}else if(i&&(o=HO(i.ranges,n.from,n.to)))l=o!=2;else if(!n.type.isAnonymous&&(s=this.nest(n,this.input))&&(n.fromnew Ye(c.from-n.from,c.to-n.from)):null,n.tree,f.length?f[0].from:n.from)),s.overlay?f.length&&(i={ranges:f,depth:0,prev:i}):l=!1}}else t&&(a=t.predicate(n))&&(a===!0&&(a=new Ye(n.from,n.to)),a.fromnew Ye(f.from-t.start,f.to-t.start)),t.target,h[0].from))),t=t.prev}i&&!--i.depth&&(i=i.prev)}}}}function HO(r,e,t){for(let i of r){if(i.from>=t)break;if(i.to>e)return i.from<=e&&i.to>=t?2:1}return 0}function dl(r,e,t,i,n,s){if(e=e&&t.enter(i,1,H.IgnoreOverlays|H.ExcludeBuffers)||t.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof j)t=t.children[0];else break}return!1}}let JO=class{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let i=this.curFrag=e[0];this.curTo=(t=i.tree.prop(ms))!==null&&t!==void 0?t:i.to,this.inner=new pl(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(ms))!==null&&e!==void 0?e:t.to,this.inner=new pl(t.tree,-t.offset)}}findMounts(e,t){var i;let n=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let s=this.inner.cursor.node;s;s=s.parent){let o=(i=s.tree)===null||i===void 0?void 0:i.prop(Y.mounted);if(o&&o.parser==t)for(let l=this.fragI;l=s.to)break;a.tree==this.curFrag.tree&&n.push({frag:a,pos:s.from-a.offset,mount:o})}}}return n}};function gl(r,e){let t=null,i=e;for(let n=1,s=0;n=l)break;a.to<=o||(t||(i=t=e.slice()),a.froml&&t.splice(s+1,0,new Ye(l,a.to))):a.to>l?t[s--]=new Ye(l,a.to):t.splice(s--,1))}}return i}function ed(r,e,t,i){let n=0,s=0,o=!1,l=!1,a=-1e9,h=[];for(;;){let f=n==r.length?1e9:o?r[n].to:r[n].from,c=s==e.length?1e9:l?e[s].to:e[s].from;if(o!=l){let u=Math.max(a,t),O=Math.min(f,c,i);unew Ye(u.from+i,u.to+i)),c=ed(e,f,a,h);for(let u=0,O=a;;u++){let d=u==c.length,g=d?h:c[u].from;if(g>O&&t.push(new ct(O,g,n.tree,-o,s.from>=O||s.openStart,s.to<=g||s.openEnd)),d)break;O=c[u].to}}else t.push(new ct(a,h,n.tree,-o,s.from>=o||s.openStart,s.to<=l||s.openEnd))}return t}let td=0;class Ue{constructor(e,t,i){this.set=e,this.base=t,this.modified=i,this.id=td++}static define(e){if(e!=null&&e.base)throw new Error("Can not derive from a modified tag");let t=new Ue([],null,[]);if(t.set.push(t),e)for(let i of e.set)t.set.push(i);return t}static defineModifier(){let e=new jn;return t=>t.modified.indexOf(e)>-1?t:jn.get(t.base||t,t.modified.concat(e).sort((i,n)=>i.id-n.id))}}let id=0;class jn{constructor(){this.instances=[],this.id=id++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(l=>l.base==e&&nd(t,l.modified));if(i)return i;let n=[],s=new Ue(n,e,t);for(let l of t)l.instances.push(s);let o=rd(t);for(let l of e.set)if(!l.modified.length)for(let a of o)n.push(jn.get(l,a));return s}}function nd(r,e){return r.length==e.length&&r.every((t,i)=>t==e[i])}function rd(r){let e=[[]];for(let t=0;ti.length-t.length)}function ui(r){let e=Object.create(null);for(let t in r){let i=r[t];Array.isArray(i)||(i=[i]);for(let n of t.split(" "))if(n){let s=[],o=2,l=n;for(let c=0;;){if(l=="..."&&c>0&&c+3==n.length){o=1;break}let u=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!u)throw new RangeError("Invalid path: "+n);if(s.push(u[0]=="*"?"":u[0][0]=='"'?JSON.parse(u[0]):u[0]),c+=u[0].length,c==n.length)break;let O=n[c++];if(c==n.length&&O=="!"){o=0;break}if(O!="/")throw new RangeError("Invalid path: "+n);l=n.slice(c)}let a=s.length-1,h=s[a];if(!h)throw new RangeError("Invalid path: "+n);let f=new bs(i,o,a>0?s.slice(0,a):null);e[h]=f.sort(e[h])}}return sd.add(e)}const sd=new Y;class bs{constructor(e,t,i,n){this.tags=e,this.mode=t,this.context=i,this.next=n}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let o=n;for(let l of s)for(let a of l.set){let h=t[a.id];if(h){o=o?o+" "+h:h;break}}return o},scope:i}}const w=Ue.define,Qn=w(),Qt=w(),bl=w(Qt),Sl=w(Qt),kt=w(),kn=w(kt),Qr=w(kt),Ge=w(),Ct=w(Ge),Le=w(),Ne=w(),Ss=w(),mi=w(Ss),wn=w(),p={comment:Qn,lineComment:w(Qn),blockComment:w(Qn),docComment:w(Qn),name:Qt,variableName:w(Qt),typeName:bl,tagName:w(bl),propertyName:Sl,attributeName:w(Sl),className:w(Qt),labelName:w(Qt),namespace:w(Qt),macroName:w(Qt),literal:kt,string:kn,docString:w(kn),character:w(kn),attributeValue:w(kn),number:Qr,integer:w(Qr),float:w(Qr),bool:w(kt),regexp:w(kt),escape:w(kt),color:w(kt),url:w(kt),keyword:Le,self:w(Le),null:w(Le),atom:w(Le),unit:w(Le),modifier:w(Le),operatorKeyword:w(Le),controlKeyword:w(Le),definitionKeyword:w(Le),moduleKeyword:w(Le),operator:Ne,derefOperator:w(Ne),arithmeticOperator:w(Ne),logicOperator:w(Ne),bitwiseOperator:w(Ne),compareOperator:w(Ne),updateOperator:w(Ne),definitionOperator:w(Ne),typeOperator:w(Ne),controlOperator:w(Ne),punctuation:Ss,separator:w(Ss),bracket:mi,angleBracket:w(mi),squareBracket:w(mi),paren:w(mi),brace:w(mi),content:Ge,heading:Ct,heading1:w(Ct),heading2:w(Ct),heading3:w(Ct),heading4:w(Ct),heading5:w(Ct),heading6:w(Ct),contentSeparator:w(Ge),list:w(Ge),quote:w(Ge),emphasis:w(Ge),strong:w(Ge),link:w(Ge),monospace:w(Ge),strikethrough:w(Ge),inserted:w(),deleted:w(),changed:w(),invalid:w(),meta:wn,documentMeta:w(wn),annotation:w(wn),processingInstruction:w(wn),definition:Ue.defineModifier(),constant:Ue.defineModifier(),function:Ue.defineModifier(),standard:Ue.defineModifier(),local:Ue.defineModifier(),special:Ue.defineModifier()};Yh([{tag:p.link,class:"tok-link"},{tag:p.heading,class:"tok-heading"},{tag:p.emphasis,class:"tok-emphasis"},{tag:p.strong,class:"tok-strong"},{tag:p.keyword,class:"tok-keyword"},{tag:p.atom,class:"tok-atom"},{tag:p.bool,class:"tok-bool"},{tag:p.url,class:"tok-url"},{tag:p.labelName,class:"tok-labelName"},{tag:p.inserted,class:"tok-inserted"},{tag:p.deleted,class:"tok-deleted"},{tag:p.literal,class:"tok-literal"},{tag:p.string,class:"tok-string"},{tag:p.number,class:"tok-number"},{tag:[p.regexp,p.escape,p.special(p.string)],class:"tok-string2"},{tag:p.variableName,class:"tok-variableName"},{tag:p.local(p.variableName),class:"tok-variableName tok-local"},{tag:p.definition(p.variableName),class:"tok-variableName tok-definition"},{tag:p.special(p.variableName),class:"tok-variableName2"},{tag:p.definition(p.propertyName),class:"tok-propertyName tok-definition"},{tag:p.typeName,class:"tok-typeName"},{tag:p.namespace,class:"tok-namespace"},{tag:p.className,class:"tok-className"},{tag:p.macroName,class:"tok-macroName"},{tag:p.propertyName,class:"tok-propertyName"},{tag:p.operator,class:"tok-operator"},{tag:p.comment,class:"tok-comment"},{tag:p.meta,class:"tok-meta"},{tag:p.invalid,class:"tok-invalid"},{tag:p.punctuation,class:"tok-punctuation"}]);var kr;const Et=new Y;function Bs(r){return W.define({combine:r?e=>e.concat(r):void 0})}const Ls=new Y;class Me{constructor(e,t,i=[],n=""){this.data=e,this.name=n,V.prototype.hasOwnProperty("tree")||Object.defineProperty(V.prototype,"tree",{get(){return ge(this)}}),this.parser=t,this.extension=[li.of(this),V.languageData.of((s,o,l)=>{let a=Ql(s,o,l),h=a.type.prop(Et);if(!h)return[];let f=s.facet(h),c=a.type.prop(Ls);if(c){let u=a.resolve(o-a.from,l);for(let O of c)if(O.test(u,s)){let d=s.facet(O.facet);return O.type=="replace"?d:d.concat(f)}}return f})].concat(i)}isActiveAt(e,t,i=-1){return Ql(e,t,i).type.prop(Et)==this.data}findRegions(e){let t=e.facet(li);if((t==null?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],n=(s,o)=>{if(s.prop(Et)==this.data){i.push({from:o,to:o+s.length});return}let l=s.prop(Y.mounted);if(l){if(l.tree.prop(Et)==this.data){if(l.overlay)for(let a of l.overlay)i.push({from:a.from+o,to:a.to+o});else i.push({from:o,to:o+s.length});return}else if(l.overlay){let a=i.length;if(n(l.tree,l.overlay[0].from+o),i.length>a)return}}for(let a=0;ai.isTop?t:void 0)]}),e.name)}configure(e,t){return new si(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function ge(r){let e=r.field(Me.state,!1);return e?e.tree:j.empty}class od{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let i=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}}let bi=null;class zi{constructor(e,t,i=[],n,s,o,l,a){this.parser=e,this.state=t,this.fragments=i,this.tree=n,this.treeLen=s,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new zi(e,t,[],j.empty,0,i,[],null)}startParse(){return this.parser.startParse(new od(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=j.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let n=Date.now()+e;e=()=>Date.now()>n}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(ct.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=bi;bi=this;try{return e()}finally{bi=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=kl(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:n,treeLen:s,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((h,f,c,u)=>a.push({fromA:h,toA:f,fromB:c,toB:u})),i=ct.applyChanges(i,a),n=j.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let h of this.skipped){let f=e.mapPos(h.from,1),c=e.mapPos(h.to,-1);fe.from&&(this.fragments=kl(this.fragments,n,s),this.skipped.splice(i--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends js{createParse(t,i,n){let s=n[0].from,o=n[n.length-1].to;return{parsedPos:s,advance(){let a=bi;if(a){for(let h of n)a.tempSkipped.push(h);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=o,new j(fe.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return bi}}function kl(r,e,t){return ct.applyChanges(r,[{fromA:e,toA:t,fromB:e,toB:t}])}class oi{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,i)||t.takeTree(),new oi(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=zi.create(e.facet(li).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new oi(i)}}Me.state=dt.define({create:oi.init,update(r,e){for(let t of e.effects)if(t.is(Me.setState))return t.value;return e.startState.facet(li)!=e.state.facet(li)?oi.init(e.state):r.apply(e)}});let Mh=r=>{let e=setTimeout(()=>r(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Mh=r=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(r,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const wr=typeof navigator<"u"&&(!((kr=navigator.scheduling)===null||kr===void 0)&&kr.isInputPending)?()=>navigator.scheduling.isInputPending():null,ld=Ut.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(Me.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(Me.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=Mh(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEndn+1e3,a=s.context.work(()=>wr&&wr()||Date.now()>o,n+(l?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Me.setState.of(new oi(s.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Je(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),li=W.define({combine(r){return r.length?r[0]:null},enables:r=>[Me.state,ld,q.contentAttributes.compute([r],e=>{let t=e.facet(r);return t&&t.name?{"data-language":t.name}:{}})]});class Vi{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}class Bn{constructor(e,t,i,n,s,o=void 0){this.name=e,this.alias=t,this.extensions=i,this.filename=n,this.loadFunc=s,this.support=o,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e}))}static of(e){let{load:t,support:i}=e;if(!t){if(!i)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");t=()=>Promise.resolve(i)}return new Bn(e.name,(e.alias||[]).concat(e.name).map(n=>n.toLowerCase()),e.extensions||[],e.filename,t,i)}static matchFilename(e,t){for(let n of e)if(n.filename&&n.filename.test(t))return n;let i=/\.([^.]+)$/.exec(t);if(i){for(let n of e)if(n.extensions.indexOf(i[1])>-1)return n}return null}static matchLanguageName(e,t,i=!0){t=t.toLowerCase();for(let n of e)if(n.alias.some(s=>s==t))return n;if(i)for(let n of e)for(let s of n.alias){let o=t.indexOf(s);if(o>-1&&(s.length>2||!/\w/.test(t[o-1])&&!/\w/.test(t[o+s.length])))return n}return null}}const ad=W.define(),Hi=W.define({combine:r=>{if(!r.length)return" ";let e=r[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(r[0]));return e}});function Eh(r){let e=r.facet(Hi);return e.charCodeAt(0)==9?r.tabSize*e.length:e.length}function Ln(r,e){let t="",i=r.tabSize,n=r.facet(Hi)[0];if(n==" "){for(;e>=i;)t+=" ",e-=i;n=" "}for(let s=0;s=e?hd(r,t,e):null}class Ns{constructor(e,t={}){this.state=e,this.options=t,this.unit=Eh(e)}lineAt(e,t=1){let i=this.state.doc.lineAt(e),{simulateBreak:n,simulateDoubleBreak:s}=this.options;return n!=null&&n>=i.from&&n<=i.to?s&&n==e?{text:"",from:e}:(t<0?n-1&&(s+=o-this.countColumn(i,i.search(/\S|$/))),s}countColumn(e,t=e.length){return $t(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:i,from:n}=this.lineAt(e,t),s=this.options.overrideIndentation;if(s){let o=s(n);if(o>-1)return o}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Ki=new Y;function hd(r,e,t){let i=e.resolveStack(t),n=i.node.enterUnfinishedNodesBefore(t);if(n!=i.node){let s=[];for(let o=n;o!=i.node;o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)i={node:s[o],next:i}}return _h(i,r,t)}function _h(r,e,t){for(let i=r;i;i=i.next){let n=cd(i.node);if(n)return n(Gs.create(e,t,i))}return 0}function fd(r){return r.pos==r.options.simulateBreak&&r.options.simulateDoubleBreak}function cd(r){let e=r.type.prop(Ki);if(e)return e;let t=r.firstChild,i;if(t&&(i=t.type.prop(Y.closedBy))){let n=r.lastChild,s=n&&i.indexOf(n.name)>-1;return o=>zh(o,!0,1,void 0,s&&!fd(o)?n.from:void 0)}return r.parent==null?ud:null}function ud(){return 0}class Gs extends Ns{constructor(e,t,i){super(e.state,e.options),this.base=e,this.pos=t,this.context=i}get node(){return this.context.node}static create(e,t,i){return new Gs(e,t,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let i=e.resolve(t.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(Od(i,e))break;t=this.state.doc.lineAt(i.from)}return this.lineIndent(t.from)}continue(){return _h(this.context.next,this.base,this.pos)}}function Od(r,e){for(let t=e;t;t=t.parent)if(r==t)return!0;return!1}function dd(r){let e=r.node,t=e.childAfter(e.from),i=e.lastChild;if(!t)return null;let n=r.options.simulateBreak,s=r.state.doc.lineAt(t.from),o=n==null||n<=s.from?s.to:Math.min(s.to,n);for(let l=t.to;;){let a=e.childAfter(l);if(!a||a==i)return null;if(!a.type.isSkipped)return a.fromzh(i,e,t,r)}function zh(r,e,t,i,n){let s=r.textAfter,o=s.match(/^\s*/)[0].length,l=i&&s.slice(o,o+i.length)==i||n==r.pos+o,a=e?dd(r):null;return a?l?r.column(a.from):r.column(a.to):r.baseIndent+(l?0:r.unit*t)}const gd=r=>r.baseIndent;function An({except:r,units:e=1}={}){return t=>{let i=r&&r.test(t.textAfter);return t.baseIndent+(i?0:e*t.unit)}}const md=W.define(),Ji=new Y;function Vh(r){let e=r.firstChild,t=r.lastChild;return e&&e.tol.prop(Et)==o.data:o?l=>l==o:void 0,this.style=Yh(e.map(l=>({tag:l.tag,class:l.class||n(Object.assign({},l,{tag:null}))})),{all:s}).style,this.module=i?new vt(i):null,this.themeType=t.themeType}static define(e,t){return new Fs(e,t||{})}}p.meta,p.link,p.heading,p.emphasis,p.strong,p.strikethrough,p.keyword,p.atom,p.bool,p.url,p.contentSeparator,p.labelName,p.literal,p.inserted,p.string,p.deleted,p.regexp,p.escape,p.string,p.variableName,p.variableName,p.typeName,p.namespace,p.className,p.variableName,p.macroName,p.propertyName,p.comment,p.invalid;const bd=new Y,Sd=Object.create(null),wl=[fe.none],yl=[],Pl=Object.create(null),Qd=Object.create(null);for(let[r,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])Qd[r]=kd(Sd,e);function yr(r,e){yl.indexOf(r)>-1||(yl.push(r),console.warn(e))}function kd(r,e){let t=[];for(let l of e.split(" ")){let a=[];for(let h of l.split(".")){let f=r[h]||p[h];f?typeof f=="function"?a.length?a=a.map(f):yr(h,`Modifier ${h} used at start of tag`):a.length?yr(h,`Tag ${h} used as modifier`):a=Array.isArray(f)?f:[f]:yr(h,`Unknown highlighting tag ${h}`)}for(let h of a)t.push(h)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),n=i+" "+t.map(l=>l.id),s=Pl[n];if(s)return s.id;let o=Pl[n]=fe.define({id:wl.length,name:i,props:[ui({[i]:t})]});return wl.push(o),o.id}pe.RTL,pe.LTR;const Qs=pt.define(),wd=pt.define(),yd=W.define(),Uh=W.define({combine(r){return Jc(r,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(i,n)=>e(i,n)||t(i,n)})}}),Dh=dt.define({create(){return tt.empty},update(r,e){let t=e.state.facet(Uh),i=e.annotation(Qs);if(i){let a=ve.fromTransaction(e,i.selection),h=i.side,f=h==0?r.undone:r.done;return a?f=Nn(f,f.length,t.minDepth,a):f=Bh(f,e.startState.selection),new tt(h==0?i.rest:f,h==0?f:i.rest)}let n=e.annotation(wd);if((n=="full"||n=="before")&&(r=r.isolate()),e.annotation(ae.addToHistory)===!1)return e.changes.empty?r:r.addMapping(e.changes.desc);let s=ve.fromTransaction(e),o=e.annotation(ae.time),l=e.annotation(ae.userEvent);return s?r=r.addChanges(s,o,l,t,e):e.selection&&(r=r.addSelection(e.startState.selection,o,l,t.newGroupDelay)),(n=="full"||n=="after")&&(r=r.isolate()),r},toJSON(r){return{done:r.done.map(e=>e.toJSON()),undone:r.undone.map(e=>e.toJSON())}},fromJSON(r){return new tt(r.done.map(ve.fromJSON),r.undone.map(ve.fromJSON))}});function Pd(r={}){return[Dh,Uh.of(r),q.domEventHandlers({beforeinput(e,t){let i=e.inputType=="historyUndo"?Ih:e.inputType=="historyRedo"?ks:null;return i?(e.preventDefault(),i(t)):!1}})]}function sr(r,e){return function({state:t,dispatch:i}){if(!e&&t.readOnly)return!1;let n=t.field(Dh,!1);if(!n)return!1;let s=n.pop(r,t,e);return s?(i(s),!0):!1}}const Ih=sr(0,!1),ks=sr(1,!1),xd=sr(0,!0),$d=sr(1,!0);class ve{constructor(e,t,i,n,s){this.changes=e,this.effects=t,this.mapped=i,this.startSelection=n,this.selectionsAfter=s}setSelAfter(e){return new ve(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,i;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(n=>n.toJSON())}}static fromJSON(e){return new ve(e.changes&&he.fromJSON(e.changes),[],e.mapped&&it.fromJSON(e.mapped),e.startSelection&&P.fromJSON(e.startSelection),e.selectionsAfter.map(P.fromJSON))}static fromTransaction(e,t){let i=Ee;for(let n of e.startState.facet(yd)){let s=n(e);s.length&&(i=i.concat(s))}return!i.length&&e.changes.empty?null:new ve(e.changes.invert(e.startState.doc),i,void 0,t||e.startState.selection,Ee)}static selection(e){return new ve(void 0,Ee,void 0,void 0,e)}}function Nn(r,e,t,i){let n=e+1>t+20?e-t-1:0,s=r.slice(n,e);return s.push(i),s}function vd(r,e){let t=[],i=!1;return r.iterChangedRanges((n,s)=>t.push(n,s)),e.iterChangedRanges((n,s,o,l)=>{for(let a=0;a=h&&o<=f&&(i=!0)}}),i}function Zd(r,e){return r.ranges.length==e.ranges.length&&r.ranges.filter((t,i)=>t.empty!=e.ranges[i].empty).length===0}function jh(r,e){return r.length?e.length?r.concat(e):r:e}const Ee=[],Td=200;function Bh(r,e){if(r.length){let t=r[r.length-1],i=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-Td));return i.length&&i[i.length-1].eq(e)?r:(i.push(e),Nn(r,r.length-1,1e9,t.setSelAfter(i)))}else return[ve.selection([e])]}function Rd(r){let e=r[r.length-1],t=r.slice();return t[r.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function Pr(r,e){if(!r.length)return r;let t=r.length,i=Ee;for(;t;){let n=Xd(r[t-1],e,i);if(n.changes&&!n.changes.empty||n.effects.length){let s=r.slice(0,t);return s[t-1]=n,s}else e=n.mapped,t--,i=n.selectionsAfter}return i.length?[ve.selection(i)]:Ee}function Xd(r,e,t){let i=jh(r.selectionsAfter.length?r.selectionsAfter.map(l=>l.map(e)):Ee,t);if(!r.changes)return ve.selection(i);let n=r.changes.map(e),s=e.mapDesc(r.changes,!0),o=r.mapped?r.mapped.composeDesc(s):s;return new ve(n,ie.mapEffects(r.effects,e),o,r.startSelection.map(s),i)}const Cd=/^(input\.type|delete)($|\.)/;class tt{constructor(e,t,i=0,n=void 0){this.done=e,this.undone=t,this.prevTime=i,this.prevUserEvent=n}isolate(){return this.prevTime?new tt(this.done,this.undone):this}addChanges(e,t,i,n,s){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!i||Cd.test(i))&&(!l.selectionsAfter.length&&t-this.prevTime0&&t-this.prevTime=e&&(s=i.type.prop(Y.closedBy))&&s.indexOf(n.name)>-1&&r.doc.lineAt(i.to).from==r.doc.lineAt(n.from).from&&!/\S/.test(r.sliceDoc(i.to,n.from))?{from:i.to,to:n.from}:null}const Yd=Md(!1);function Md(r){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=e.changeByRange(n=>{let{from:s,to:o}=n,l=e.doc.lineAt(s),a=!r&&s==o&&Wd(e,s);r&&(s=o=(o<=l.to?l:e.doc.lineAt(o)).to);let h=new Ns(e,{simulateBreak:s,simulateDoubleBreak:!!a}),f=qh(h,s);for(f==null&&(f=$t(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));ol.from&&s{let n=[];for(let o=i.from;o<=i.to;){let l=r.doc.lineAt(o);l.number>t&&(i.empty||i.to>l.from)&&(e(l,n,i),t=l.number),o=l.to+1}let s=r.changes(n);return{changes:n,range:P.range(s.mapPos(i.anchor,1),s.mapPos(i.head,1))}})}const Ed=({state:r,dispatch:e})=>r.readOnly?!1:(e(r.update(Lh(r,(t,i)=>{i.push({from:t.from,insert:r.facet(Hi)})}),{userEvent:"input.indent"})),!0),qd=({state:r,dispatch:e})=>r.readOnly?!1:(e(r.update(Lh(r,(t,i)=>{let n=/^\s*/.exec(t.text)[0];if(!n)return;let s=$t(n,r.tabSize),o=0,l=Ln(r,Math.max(0,s-Eh(r)));for(;otypeof n=="string"?{label:n}:n),[t,i]=e.every(n=>/^\w+$/.test(n.label))?[/\w*$/,/\w+$/]:Vd(e);return n=>{let s=n.matchBefore(i);return s||n.explicit?{from:s?s.from:n.pos,options:e,validFor:t}:null}}function Dd(r,e){return t=>{for(let i=ge(t.state).resolveInner(t.pos,-1);i;i=i.parent){if(r.indexOf(i.name)>-1)return null;if(i.type.isTop)break}return e(t)}}function Id(r,e){var t;let{source:i}=r,n=i[i.length-1]!="$";return n?new RegExp(`(?:${i})${n?"$":""}`,(t=r.flags)!==null&&t!==void 0?t:r.ignoreCase?"i":""):r}const jd=pt.define(),Bd=q.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class Ld{constructor(e,t,i,n){this.field=e,this.line=t,this.from=i,this.to=n}}class Hs{constructor(e,t,i){this.field=e,this.from=t,this.to=i}map(e){let t=e.mapPos(this.from,-1,we.TrackDel),i=e.mapPos(this.to,1,we.TrackDel);return t==null||i==null?null:new Hs(this.field,t,i)}}class Ks{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let i=[],n=[t],s=e.doc.lineAt(t),o=/^\s*/.exec(s.text)[0];for(let a of this.lines){if(i.length){let h=o,f=/^\t*/.exec(a)[0].length;for(let c=0;cnew Hs(a.field,n[a.line]+a.from,n[a.line]+a.to));return{text:i,ranges:l}}static parse(e){let t=[],i=[],n=[],s;for(let o of e.split(/\r\n?|\n/)){for(;s=/[#$]\{(?:(\d+)(?::([^}]*))?|((?:\\[{}]|[^}])*))\}/.exec(o);){let l=s[1]?+s[1]:null,a=s[2]||s[3]||"",h=-1,f=a.replace(/\\[{}]/g,c=>c[1]);for(let c=0;c=h&&u.field++}n.push(new Ld(h,i.length,s.index,s.index+f.length)),o=o.slice(0,s.index)+a+o.slice(s.index+s[0].length)}o=o.replace(/\\([{}])/g,(l,a,h)=>{for(let f of n)f.line==i.length&&f.from>h&&(f.from--,f.to--);return a}),i.push(o)}return new Ks(i,n)}}let Nd=te.widget({widget:new class extends Li{toDOM(){let r=document.createElement("span");return r.className="cm-snippetFieldPosition",r}ignoreEvent(){return!1}}}),Gd=te.mark({class:"cm-snippetField"});class Oi{constructor(e,t){this.ranges=e,this.active=t,this.deco=te.set(e.map(i=>(i.from==i.to?Nd:Gd).range(i.from,i.to)))}map(e){let t=[];for(let i of this.ranges){let n=i.map(e);if(!n)return null;t.push(n)}return new Oi(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(i=>i.field==this.active&&i.from<=t.from&&i.to>=t.to))}}const en=ie.define({map(r,e){return r&&r.map(e)}}),Fd=ie.define(),Ui=dt.define({create(){return null},update(r,e){for(let t of e.effects){if(t.is(en))return t.value;if(t.is(Fd)&&r)return new Oi(r.ranges,t.value)}return r&&e.docChanged&&(r=r.map(e.changes)),r&&e.selection&&!r.selectionInsideField(e.selection)&&(r=null),r},provide:r=>q.decorations.from(r,e=>e?e.deco:te.none)});function Js(r,e){return P.create(r.filter(t=>t.field==e).map(t=>P.range(t.from,t.to)))}function Hd(r){let e=Ks.parse(r);return(t,i,n,s)=>{let{text:o,ranges:l}=e.instantiate(t.state,n),a={changes:{from:n,to:s,insert:I.of(o)},scrollIntoView:!0,annotations:i?[jd.of(i),ae.userEvent.of("input.complete")]:void 0};if(l.length&&(a.selection=Js(l,0)),l.some(h=>h.field>0)){let h=new Oi(l,0),f=a.effects=[en.of(h)];t.state.field(Ui,!1)===void 0&&f.push(ie.appendConfig.of([Ui,ip,np,Bd]))}t.dispatch(t.state.update(a))}}function Nh(r){return({state:e,dispatch:t})=>{let i=e.field(Ui,!1);if(!i||r<0&&i.active==0)return!1;let n=i.active+r,s=r>0&&!i.ranges.some(o=>o.field==n+r);return t(e.update({selection:Js(i.ranges,n),effects:en.of(s?null:new Oi(i.ranges,n)),scrollIntoView:!0})),!0}}const Kd=({state:r,dispatch:e})=>r.field(Ui,!1)?(e(r.update({effects:en.of(null)})),!0):!1,Jd=Nh(1),ep=Nh(-1),tp=[{key:"Tab",run:Jd,shift:ep},{key:"Escape",run:Kd}],$l=W.define({combine(r){return r.length?r[0]:tp}}),ip=ir.highest(Ht.compute([$l],r=>r.facet($l)));function xe(r,e){return Object.assign(Object.assign({},e),{apply:Hd(r)})}const np=q.domEventHandlers({mousedown(r,e){let t=e.state.field(Ui,!1),i;if(!t||(i=e.posAtCoords({x:r.clientX,y:r.clientY}))==null)return!1;let n=t.ranges.find(s=>s.from<=i&&s.to>=i);return!n||n.field==t.active?!1:(e.dispatch({selection:Js(t.ranges,n.field),effects:en.of(t.ranges.some(s=>s.field>n.field)?new Oi(t.ranges,n.field):null),scrollIntoView:!0}),!0)}}),Gh=new class extends qt{};Gh.startSide=1;Gh.endSide=-1;class Gn{static create(e,t,i,n,s){let o=n+(n<<8)+e+(t<<4)|0;return new Gn(e,t,i,o,s,[],[])}constructor(e,t,i,n,s,o,l){this.type=e,this.value=t,this.from=i,this.hash=n,this.end=s,this.children=o,this.positions=l,this.hashProp=[[Y.contextHash,n]]}addChild(e,t){e.prop(Y.contextHash)!=this.hash&&(e=new j(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(t)}toTree(e,t=this.end){let i=this.children.length-1;return i>=0&&(t=Math.max(t,this.positions[i]+this.children[i].length+this.from)),new j(e.types[this.type],this.children,this.positions,t-this.from).balance({makeTree:(n,s,o)=>new j(fe.none,n,s,o,this.hashProp)})}}var k;(function(r){r[r.Document=1]="Document",r[r.CodeBlock=2]="CodeBlock",r[r.FencedCode=3]="FencedCode",r[r.Blockquote=4]="Blockquote",r[r.HorizontalRule=5]="HorizontalRule",r[r.BulletList=6]="BulletList",r[r.OrderedList=7]="OrderedList",r[r.ListItem=8]="ListItem",r[r.ATXHeading1=9]="ATXHeading1",r[r.ATXHeading2=10]="ATXHeading2",r[r.ATXHeading3=11]="ATXHeading3",r[r.ATXHeading4=12]="ATXHeading4",r[r.ATXHeading5=13]="ATXHeading5",r[r.ATXHeading6=14]="ATXHeading6",r[r.SetextHeading1=15]="SetextHeading1",r[r.SetextHeading2=16]="SetextHeading2",r[r.HTMLBlock=17]="HTMLBlock",r[r.LinkReference=18]="LinkReference",r[r.Paragraph=19]="Paragraph",r[r.CommentBlock=20]="CommentBlock",r[r.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",r[r.Escape=22]="Escape",r[r.Entity=23]="Entity",r[r.HardBreak=24]="HardBreak",r[r.Emphasis=25]="Emphasis",r[r.StrongEmphasis=26]="StrongEmphasis",r[r.Link=27]="Link",r[r.Image=28]="Image",r[r.InlineCode=29]="InlineCode",r[r.HTMLTag=30]="HTMLTag",r[r.Comment=31]="Comment",r[r.ProcessingInstruction=32]="ProcessingInstruction",r[r.Autolink=33]="Autolink",r[r.HeaderMark=34]="HeaderMark",r[r.QuoteMark=35]="QuoteMark",r[r.ListMark=36]="ListMark",r[r.LinkMark=37]="LinkMark",r[r.EmphasisMark=38]="EmphasisMark",r[r.CodeMark=39]="CodeMark",r[r.CodeText=40]="CodeText",r[r.CodeInfo=41]="CodeInfo",r[r.LinkTitle=42]="LinkTitle",r[r.LinkLabel=43]="LinkLabel",r[r.URL=44]="URL"})(k||(k={}));class rp{constructor(e,t){this.start=e,this.content=t,this.marks=[],this.parsers=[]}}class sp{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return Xi(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,t=0,i=0){for(let n=t;n=e.stack[t.depth+1].value+t.baseIndent)return!0;if(t.indent>=t.baseIndent+4)return!1;let i=(r.type==k.OrderedList?io:to)(t,e,!1);return i>0&&(r.type!=k.BulletList||eo(t,e,!1)<0)&&t.text.charCodeAt(t.pos+i-1)==r.value}const Fh={[k.Blockquote](r,e,t){return t.next!=62?!1:(t.markers.push(z(k.QuoteMark,e.lineStart+t.pos,e.lineStart+t.pos+1)),t.moveBase(t.pos+(ze(t.text.charCodeAt(t.pos+1))?2:1)),r.end=e.lineStart+t.text.length,!0)},[k.ListItem](r,e,t){return t.indent-1?!1:(t.moveBaseColumn(t.baseIndent+r.value),!0)},[k.OrderedList]:vl,[k.BulletList]:vl,[k.Document](){return!0}};function ze(r){return r==32||r==9||r==10||r==13}function Xi(r,e=0){for(;et&&ze(r.charCodeAt(e-1));)e--;return e}function Hh(r){if(r.next!=96&&r.next!=126)return-1;let e=r.pos+1;for(;e-1&&r.depth==e.stack.length||i<3?-1:1}function Jh(r,e){for(let t=r.stack.length-1;t>=0;t--)if(r.stack[t].type==e)return!0;return!1}function to(r,e,t){return(r.next==45||r.next==43||r.next==42)&&(r.pos==r.text.length-1||ze(r.text.charCodeAt(r.pos+1)))&&(!t||Jh(e,k.BulletList)||r.skipSpace(r.pos+2)=48&&n<=57;){i++;if(i==r.text.length)return-1;n=r.text.charCodeAt(i)}return i==r.pos||i>r.pos+9||n!=46&&n!=41||ir.pos+1||r.next!=49)?-1:i+1-r.pos}function ef(r){if(r.next!=35)return-1;let e=r.pos+1;for(;e6?-1:t}function tf(r){if(r.next!=45&&r.next!=61||r.indent>=r.baseIndent+4)return-1;let e=r.pos+1;for(;e/,rf=/\?>/,ys=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*/i.exec(i);if(s)return r.append(z(k.Comment,t,t+1+s[0].length));let o=/^\?[^]*?\?>/.exec(i);if(o)return r.append(z(k.ProcessingInstruction,t,t+1+o[0].length));let l=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(i);return l?r.append(z(k.HTMLTag,t,t+1+l[0].length)):-1},Emphasis(r,e,t){if(e!=95&&e!=42)return-1;let i=t+1;for(;r.char(i)==e;)i++;let n=r.slice(t-1,t),s=r.slice(i,i+1),o=Ii.test(n),l=Ii.test(s),a=/\s|^$/.test(n),h=/\s|^$/.test(s),f=!h&&(!l||a||o),c=!a&&(!o||h||l),u=f&&(e==42||!c||o),O=c&&(e==42||!f||l);return r.append(new We(e==95?ff:cf,t,i,(u?1:0)|(O?2:0)))},HardBreak(r,e,t){if(e==92&&r.char(t+1)==10)return r.append(z(k.HardBreak,t,t+2));if(e==32){let i=t+1;for(;r.char(i)==32;)i++;if(r.char(i)==10&&i>=t+2)return r.append(z(k.HardBreak,t,i+1))}return-1},Link(r,e,t){return e==91?r.append(new We(Bt,t,t+1,1)):-1},Image(r,e,t){return e==33&&r.char(t+1)==91?r.append(new We(xs,t,t+2,1)):-1},LinkEnd(r,e,t){if(e!=93)return-1;for(let i=r.parts.length-1;i>=0;i--){let n=r.parts[i];if(n instanceof We&&(n.type==Bt||n.type==xs)){if(!n.side||r.skipSpace(n.to)==t&&!/[(\[]/.test(r.slice(t+1,t+2)))return r.parts[i]=null,-1;let s=r.takeContent(i),o=r.parts[i]=up(r,s,n.type==Bt?k.Link:k.Image,n.from,t+1);if(n.type==Bt)for(let l=0;le?z(k.URL,e+t,s+t):s==r.length?null:!1}}function Of(r,e,t){let i=r.charCodeAt(e);if(i!=39&&i!=34&&i!=40)return!1;let n=i==40?41:i;for(let s=e+1,o=!1;s=this.end?-1:this.text.charCodeAt(e-this.offset)}get end(){return this.offset+this.text.length}slice(e,t){return this.text.slice(e-this.offset,t-this.offset)}append(e){return this.parts.push(e),e.to}addDelimiter(e,t,i,n,s){return this.append(new We(e,t,i,(n?1:0)|(s?2:0)))}get hasOpenLink(){for(let e=this.parts.length-1;e>=0;e--){let t=this.parts[e];if(t instanceof We&&(t.type==Bt||t.type==xs))return!0}return!1}addElement(e){return this.append(e)}resolveMarkers(e){for(let i=e;i=e;a--){let g=this.parts[a];if(g instanceof We&&g.side&1&&g.type==n.type&&!(s&&(n.side&1||g.side&2)&&(g.to-g.from+o)%3==0&&((g.to-g.from)%3||o%3))){l=g;break}}if(!l)continue;let h=n.type.resolve,f=[],c=l.from,u=n.to;if(s){let g=Math.min(2,l.to-l.from,o);c=l.to-g,u=n.from+g,h=g==1?"Emphasis":"StrongEmphasis"}l.type.mark&&f.push(this.elt(l.type.mark,c,l.to));for(let g=a+1;g=0;t--){let i=this.parts[t];if(i instanceof We&&i.type==e)return t}return null}takeContent(e){let t=this.resolveMarkers(e);return this.parts.length=e,t}skipSpace(e){return Xi(this.text,e-this.offset)+this.offset}elt(e,t,i,n){return typeof e=="string"?z(this.parser.getNodeType(e),t,i,n):new hf(e,t)}}function $s(r,e){if(!e.length)return r;if(!r.length)return e;let t=r.slice(),i=0;for(let n of e){for(;i(e?e-1:0))return!1;if(this.fragmentEnd<0){let s=this.fragment.to;for(;s>0&&this.input.read(s-1,s)!=` `;)s--;this.fragmentEnd=s?s-1:0}let i=this.cursor;i||(i=this.cursor=this.fragment.tree.cursor(),i.firstChild());let n=e+this.fragment.offset;for(;i.to<=n;)if(!i.parent())return!1;for(;;){if(i.from>=n)return this.fragment.from<=t;if(!i.childAfter(n))return!1}}matches(e){let t=this.cursor.tree;return t&&t.prop(Y.contextHash)==e}takeNodes(e){let t=this.cursor,i=this.fragment.offset,n=this.fragmentEnd-(this.fragment.openEnd?1:0),s=e.absoluteLineStart,o=s,l=e.block.children.length,a=o,h=l;for(;;){if(t.to-i>n){if(t.type.isAnonymous&&t.firstChild())continue;break}let f=pf(t.from-i,e.ranges);if(t.to-i<=e.ranges[e.rangeI].to)e.addNode(t.tree,f);else{let c=new j(e.parser.nodeSet.types[k.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(c,t.tree),e.addNode(c,f)}if(t.type.is("Block")&&(dp.indexOf(t.type.id)<0?(o=t.to-i,l=e.block.children.length):(o=a,l=h,a=t.to-i,h=e.block.children.length)),!t.nextSibling())break}for(;e.block.children.length>l;)e.block.children.pop(),e.block.positions.pop();return o-s}};function pf(r,e){let t=r;for(let i=1;iyn[r]),Object.keys(yn).map(r=>ap[r]),Object.keys(yn),hp,Fh,Object.keys($r).map(r=>$r[r]),Object.keys($r),[]);function bp(r,e,t){let i=[];for(let n=r.firstChild,s=e;;n=n.nextSibling){let o=n?n.from:t;if(o>s&&i.push({from:s,to:o}),!n)break;s=n.to}return i}function Sp(r){let{codeParser:e,htmlParser:t}=r;return{wrap:Wh((n,s)=>{let o=n.type.id;if(e&&(o==k.CodeBlock||o==k.FencedCode)){let l="";if(o==k.FencedCode){let h=n.node.getChild(k.CodeInfo);h&&(l=s.read(h.from,h.to))}let a=e(l);if(a)return{parser:a,overlay:h=>h.type.id==k.CodeText}}else if(t&&(o==k.HTMLBlock||o==k.HTMLTag))return{parser:t,overlay:bp(n.node,n.from,n.to)};return null})}}const Qp={resolve:"Strikethrough",mark:"StrikethroughMark"},kp={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":p.strikethrough}},{name:"StrikethroughMark",style:p.processingInstruction}],parseInline:[{name:"Strikethrough",parse(r,e,t){if(e!=126||r.char(t+1)!=126||r.char(t+2)==126)return-1;let i=r.slice(t-1,t),n=r.slice(t+2,t+3),s=/\s|^$/.test(i),o=/\s|^$/.test(n),l=Ii.test(i),a=Ii.test(n);return r.addDelimiter(Qp,t,t+2,!o&&(!a||s||l),!s&&(!l||o||a))},after:"Emphasis"}]};function Ci(r,e,t=0,i,n=0){let s=0,o=!0,l=-1,a=-1,h=!1,f=()=>{i.push(r.elt("TableCell",n+l,n+a,r.parser.parseInline(e.slice(l,a),n+l)))};for(let c=t;c-1)&&s++,o=!1,i&&(l>-1&&f(),i.push(r.elt("TableDelimiter",c+n,c+n+1))),l=a=-1):(h||u!=32&&u!=9)&&(l<0&&(l=c),a=c+1),h=!h&&u==92}return l>-1&&(s++,i&&f()),s}function Xl(r,e){for(let t=e;tn instanceof Cl)||!Xl(e.text,e.basePos))return!1;let i=r.scanLine(r.absoluteLineEnd+1).text;return gf.test(i)&&Ci(r,e.text,e.basePos)==Ci(r,i,e.basePos)},before:"SetextHeading"}]};class yp{nextLine(){return!1}finish(e,t){return e.addLeafElement(t,e.elt("Task",t.start,t.start+t.content.length,[e.elt("TaskMarker",t.start,t.start+3),...e.parser.parseInline(t.content.slice(3),t.start+3)])),!0}}const Pp={defineNodes:[{name:"Task",block:!0,style:p.list},{name:"TaskMarker",style:p.atom}],parseBlock:[{name:"TaskList",leaf(r,e){return/^\[[ xX]\][ \t]/.test(e.content)&&r.parentType().name=="ListItem"?new yp:null},after:"SetextHeading"}]},Al=/(www\.)|(https?:\/\/)|([\w.+-]+@)|(mailto:|xmpp:)/gy,Wl=/[\w-]+(\.[\w-]+)+(\/[^\s<]*)?/gy,xp=/[\w-]+\.[\w-]+($|\/)/,Yl=/[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy,Ml=/\/[a-zA-Z\d@.]+/gy;function El(r,e,t,i){let n=0;for(let s=e;s-1)return-1;let i=e+t[0].length;for(;;){let n=r[i-1],s;if(/[?!.,:*_~]/.test(n)||n==")"&&El(r,e,i,")")>El(r,e,i,"("))i--;else if(n==";"&&(s=/&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(r.slice(e,i))))i=e+s.index;else break}return i}function ql(r,e){Yl.lastIndex=e;let t=Yl.exec(r);if(!t)return-1;let i=t[0][t[0].length-1];return i=="_"||i=="-"?-1:e+t[0].length-(i=="."?1:0)}const vp={parseInline:[{name:"Autolink",parse(r,e,t){let i=t-r.offset;Al.lastIndex=i;let n=Al.exec(r.text),s=-1;if(!n)return-1;if(n[1]||n[2]){if(s=$p(r.text,i+n[0].length),s>-1&&r.hasOpenLink){let o=/([^\[\]]|\[[^\]]*\])*/.exec(r.text.slice(i,s));s=i+o[0].length}}else n[3]?s=ql(r.text,i):(s=ql(r.text,i+n[0].length),s>-1&&n[0]=="xmpp:"&&(Ml.lastIndex=s,n=Ml.exec(r.text),n&&(s=n.index+n[0].length)));return s<0?-1:(r.addElement(r.elt("URL",t,s+r.offset)),s+r.offset)}}]},Zp=[wp,Pp,kp,vp];function mf(r,e,t){return(i,n,s)=>{if(n!=r||i.char(s+1)==r)return-1;let o=[i.elt(t,s,s+1)];for(let l=s+1;lt%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,i=0){let n=e.parser.context;return new Fn(e,[],t,i,i,0,[],0,n?new zl(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let i=e>>19,n=e&65535,{parser:s}=this.p;this.reducePos=2e3&&!(!((t=this.p.parser.nodeSet.types[n])===null||t===void 0)&&t.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=h):this.p.lastBigReductionSizel;)this.stack.pop();this.reduceContext(n,a)}storeNode(e,t,i,n=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&o.buffer[l-4]==0&&o.buffer[l-1]>-1){if(t==i)return;if(o.buffer[l-2]>=t){o.buffer[l-2]=i;return}}}if(!s||this.pos==i)this.buffer.push(e,t,i,n);else{let o=this.buffer.length;if(o>0&&this.buffer[o-4]!=0)for(;o>0&&this.buffer[o-2]>i;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,n>4&&(n-=4);this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=i,this.buffer[o+3]=n}}shift(e,t,i,n){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=n,this.shiftContext(t,i),t<=this.p.parser.maxNode&&this.buffer.push(t,i,n,4);else{let s=e,{parser:o}=this.p;(n>this.pos||t<=o.maxNode)&&(this.pos=n,o.stateFlag(s,1)||(this.reducePos=n)),this.pushState(s,i),this.shiftContext(t,i),t<=o.maxNode&&this.buffer.push(t,i,n,4)}}apply(e,t,i,n){e&65536?this.reduce(e):this.shift(e,t,i,n)}useNode(e,t){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let n=this.pos;this.reducePos=this.pos=n+e.length,this.pushState(t,n),this.buffer.push(i,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let i=e.buffer.slice(t),n=e.bufferBase+t;for(;e&&n==e.bufferBase;)e=e.parent;return new Fn(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,n,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let i=e<=this.p.parser.maxNode;i&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,i?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new Cp(this);;){let i=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(i==0)return!1;if(!(i&65536))return!0;t.reduce(i)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let s=0,o;sa&1&&l==o)||n.push(t[s],o)}t=n}let i=[];for(let n=0;n>19,n=t&65535,s=this.stack.length-i*3;if(s<0||e.getGoto(this.stack[s],n,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],i=(n,s)=>{if(!t.includes(n))return t.push(n),e.allActions(n,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-s;if(l>1){let a=o&65535,h=this.stack.length-l*3;if(h>=0&&e.getGoto(this.stack[h],a,!1)>=0)return l<<19|65536|a}}else{let l=i(o,s+1);if(l!=null)return l}})};return i(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;tthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class zl{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class Cp{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,i=e>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let n=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=n}}class Hn{constructor(e,t,i){this.stack=e,this.pos=t,this.index=i,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new Hn(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new Hn(this.stack,this.pos,this.index)}}function $i(r,e=Uint16Array){if(typeof r!="string")return r;let t=null;for(let i=0,n=0;i=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),s+=a,l)break;s*=46}t?t[n++]=s:t=new e(s)}return t}class Wn{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Vl=new Wn;class Ap{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Vl,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let i=this.range,n=this.rangeIndex,s=this.pos+e;for(;si.to:s>=i.to;){if(n==this.ranges.length-1)return null;let o=this.ranges[++n];s+=o.from-i.to,i=o}return s}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,i,n;if(t>=0&&t=this.chunk2Pos&&il.to&&(this.chunk2=this.chunk2.slice(0,l.to-i)),n=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),n}acceptToken(e,t=0){let i=t?this.resolveOffset(t,-1):this.pos;if(i==null||i=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=Vl,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let i="";for(let n of this.ranges){if(n.from>=t)break;n.to>e&&(i+=this.input.read(Math.max(n.from,e),Math.min(n.to,t)))}return i}}class Kt{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:i}=t.p;bf(this.data,e,t,this.id,i.data,i.tokenPrecTable)}}Kt.prototype.contextual=Kt.prototype.fallback=Kt.prototype.extend=!1;class Kn{constructor(e,t,i){this.precTable=t,this.elseToken=i,this.data=typeof e=="string"?$i(e):e}token(e,t){let i=e.pos,n=0;for(;;){let s=e.next<0,o=e.resolveOffset(1,1);if(bf(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||n++,o==null)break;e.reset(o,e.token)}n&&(e.reset(i,e.token),e.acceptToken(this.elseToken,n))}}Kn.prototype.contextual=Kt.prototype.fallback=Kt.prototype.extend=!1;class je{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function bf(r,e,t,i,n,s){let o=0,l=1<0){let d=r[O];if(a.allows(d)&&(e.token.value==-1||e.token.value==d||Wp(d,e.token.value,n,s))){e.acceptToken(d);break}}let f=e.next,c=0,u=r[o+2];if(e.next<0&&u>c&&r[h+u*3-3]==65535){o=r[h+u*3-1];continue e}for(;c>1,d=h+O+(O<<1),g=r[d],m=r[d+1]||65536;if(f=m)c=O+1;else{o=r[d+2],e.advance();continue e}}break}}function Ul(r,e,t){for(let i=e,n;(n=r[i])!=65535;i++)if(n==t)return i-e;return-1}function Wp(r,e,t,i){let n=Ul(t,i,e);return n<0||Ul(t,i,r)e)&&!i.type.isError)return t<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(r.length,Math.max(i.from+1,e+25));if(t<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return t<0?0:r.length}}class Yp{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Dl(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Dl(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=o,null;if(s instanceof j){if(o==e){if(o=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+s.length}}}class Mp{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(i=>new Wn)}getActions(e){let t=0,i=null,{parser:n}=e.p,{tokenizers:s}=n,o=n.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,a=0;for(let h=0;hc.end+25&&(a=Math.max(c.lookAhead,a)),c.value!=0)){let u=t;if(c.extended>-1&&(t=this.addActions(e,c.extended,c.end,t)),t=this.addActions(e,c.value,c.end,t),!f.extend&&(i=c,t>u))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),!i&&e.pos==this.stream.end&&(i=new Wn,i.value=e.p.parser.eofTerm,i.start=i.end=e.pos,t=this.addActions(e,i.value,i.end,t)),this.mainToken=i,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Wn,{pos:i,p:n}=e;return t.start=i,t.end=Math.min(i+1,n.stream.end),t.value=i==n.stream.end?n.parser.eofTerm:0,t}updateCachedToken(e,t,i){let n=this.stream.clipPos(i.pos);if(t.token(this.stream.reset(n,e),i),e.value>-1){let{parser:s}=i.p;for(let o=0;o=0&&i.p.parser.dialect.allows(l>>1)){l&1?e.extended=l>>1:e.value=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(n+1)}putAction(e,t,i,n){for(let s=0;se.bufferLength*4?new Yp(i,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,i=this.stacks=[],n,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;ot)i.push(l);else{if(this.advanceStack(l,i,e))continue;{n||(n=[],s=[]),n.push(l);let a=this.tokens.getMainToken(l);s.push(a.value,a.end)}}break}}if(!i.length){let o=n&&_p(n);if(o)return Ze&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Ze&&n&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&n){let o=this.stoppedAt!=null&&n[0].pos>this.stoppedAt?n[0]:this.runRecovery(n,s,i);if(o)return Ze&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(i.length>o)for(i.sort((l,a)=>a.score-l.score);i.length>o;)i.pop();i.some(l=>l.reducePos>t)&&this.recovering--}else if(i.length>1){e:for(let o=0;o500&&h.buffer.length>500)if((l.score-h.score||l.buffer.length-h.buffer.length)>0)i.splice(a--,1);else{i.splice(o--,1);continue e}}}i.length>12&&i.splice(12,i.length-12)}this.minStackPos=i[0].pos;for(let o=1;o ":"";if(this.stoppedAt!=null&&n>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,f=h?e.curContext.hash:0;for(let c=this.fragments.nodeAt(n);c;){let u=this.parser.nodeSet.types[c.type.id]==c.type?s.getGoto(e.state,c.type.id):-1;if(u>-1&&c.length&&(!h||(c.prop(Y.contextHash)||0)==f))return e.useNode(c,u),Ze&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(c.type.id)})`),!0;if(!(c instanceof j)||c.children.length==0||c.positions[0]>0)break;let O=c.children[0];if(O instanceof j&&c.positions[0]==0)c=O;else break}}let l=s.stateSlot(e.state,4);if(l>0)return e.reduce(l),Ze&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let h=0;hn?t.push(d):i.push(d)}return!1}advanceFully(e,t){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>i)return Il(e,t),!0}}runRecovery(e,t,i){let n=null,s=!1;for(let o=0;o ":"";if(l.deadEnd&&(s||(s=!0,l.restart(),Ze&&console.log(f+this.stackID(l)+" (restarted)"),this.advanceFully(l,i))))continue;let c=l.split(),u=f;for(let O=0;c.forceReduce()&&O<10&&(Ze&&console.log(u+this.stackID(c)+" (via force-reduce)"),!this.advanceFully(c,i));O++)Ze&&(u=this.stackID(c)+" -> ");for(let O of l.recoverByInsert(a))Ze&&console.log(f+this.stackID(O)+" (via recover-insert)"),this.advanceFully(O,i);this.stream.end>l.pos?(h==l.pos&&(h++,a=0),l.recoverByDelete(a,h),Ze&&console.log(f+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),Il(l,i)):(!n||n.scorer;class Sf{constructor(e){this.start=e.start,this.shift=e.shift||Zr,this.reduce=e.reduce||Zr,this.reuse=e.reuse||Zr,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class hi extends js{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let l=0;le.topRules[l][1]),n=[];for(let l=0;l=0)s(f,a,l[h++]);else{let c=l[h+-f];for(let u=-f;u>0;u--)s(l[h++],a,c);h++}}}this.nodeSet=new Fi(t.map((l,a)=>fe.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:n[a],top:i.indexOf(a)>-1,error:a==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(a)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Th;let o=$i(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l=="number"?new Kt(o,l):l),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,i){let n=new Ep(this,e,t,i);for(let s of this.wrappers)n=s(n,e,t,i);return n}getGoto(e,t,i=!1){let n=this.goto;if(t>=n[0])return-1;for(let s=n[t+1];;){let o=n[s++],l=o&1,a=n[s++];if(l&&i)return a;for(let h=s+(o>>1);s0}validAction(e,t){return!!this.allActions(e,i=>i==t?!0:null)}allActions(e,t){let i=this.stateSlot(e,4),n=i?t(i):void 0;for(let s=this.stateSlot(e,1);n==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=at(this.data,s+2);else break;n=t(at(this.data,s+1))}return n}nextStates(e){let t=[];for(let i=this.stateSlot(e,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=at(this.data,i+2);else break;if(!(this.data[i+2]&1)){let n=this.data[i+1];t.some((s,o)=>o&1&&s==n)||t.push(this.data[i],n)}}return t}configure(e){let t=Object.assign(Object.create(hi.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let i=this.topRules[e.top];if(!i)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=i}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(i=>{let n=e.tokenizers.find(s=>s.from==i);return n?n.to:i})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((i,n)=>{let s=e.specializers.find(l=>l.from==i.external);if(!s)return i;let o=Object.assign(Object.assign({},i),{external:s.to});return t.specializers[n]=jl(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),i=t.map(()=>!1);if(e)for(let s of e.split(" ")){let o=t.indexOf(s);o>=0&&(i[o]=!0)}let n=null;for(let s=0;si)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.scorer.external(t,i)<<1|e}return r.get}const zp=54,Vp=1,Up=55,Dp=2,Ip=56,jp=3,Bl=4,Bp=5,Jn=6,Qf=7,kf=8,wf=9,yf=10,Lp=11,Np=12,Gp=13,Tr=57,Fp=14,Ll=58,Pf=20,Hp=22,xf=23,Kp=24,vs=26,$f=27,Jp=28,eg=31,tg=34,ig=36,ng=37,rg=0,sg=1,og={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},lg={dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},Nl={dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}};function ag(r){return r==45||r==46||r==58||r>=65&&r<=90||r==95||r>=97&&r<=122||r>=161}function vf(r){return r==9||r==10||r==13||r==32}let Gl=null,Fl=null,Hl=0;function Zs(r,e){let t=r.pos+e;if(Hl==t&&Fl==r)return Gl;let i=r.peek(e);for(;vf(i);)i=r.peek(++e);let n="";for(;ag(i);)n+=String.fromCharCode(i),i=r.peek(++e);return Fl=r,Hl=t,Gl=n?n.toLowerCase():i==hg||i==fg?void 0:null}const Zf=60,er=62,no=47,hg=63,fg=33,cg=45;function Kl(r,e){this.name=r,this.parent=e}const ug=[Jn,yf,Qf,kf,wf],Og=new Sf({start:null,shift(r,e,t,i){return ug.indexOf(e)>-1?new Kl(Zs(i,1)||"",r):r},reduce(r,e){return e==Pf&&r?r.parent:r},reuse(r,e,t,i){let n=e.type.id;return n==Jn||n==ig?new Kl(Zs(i,1)||"",r):r},strict:!1}),dg=new je((r,e)=>{if(r.next!=Zf){r.next<0&&e.context&&r.acceptToken(Tr);return}r.advance();let t=r.next==no;t&&r.advance();let i=Zs(r,0);if(i===void 0)return;if(!i)return r.acceptToken(t?Fp:Jn);let n=e.context?e.context.name:null;if(t){if(i==n)return r.acceptToken(Lp);if(n&&lg[n])return r.acceptToken(Tr,-2);if(e.dialectEnabled(rg))return r.acceptToken(Np);for(let s=e.context;s;s=s.parent)if(s.name==i)return;r.acceptToken(Gp)}else{if(i=="script")return r.acceptToken(Qf);if(i=="style")return r.acceptToken(kf);if(i=="textarea")return r.acceptToken(wf);if(og.hasOwnProperty(i))return r.acceptToken(yf);n&&Nl[n]&&Nl[n][i]?r.acceptToken(Tr,-1):r.acceptToken(Jn)}},{contextual:!0}),pg=new je(r=>{for(let e=0,t=0;;t++){if(r.next<0){t&&r.acceptToken(Ll);break}if(r.next==cg)e++;else if(r.next==er&&e>=2){t>=3&&r.acceptToken(Ll,-2);break}else e=0;r.advance()}});function gg(r){for(;r;r=r.parent)if(r.name=="svg"||r.name=="math")return!0;return!1}const mg=new je((r,e)=>{if(r.next==no&&r.peek(1)==er){let t=e.dialectEnabled(sg)||gg(e.context);r.acceptToken(t?Bp:Bl,2)}else r.next==er&&r.acceptToken(Bl,1)});function ro(r,e,t){let i=2+r.length;return new je(n=>{for(let s=0,o=0,l=0;;l++){if(n.next<0){l&&n.acceptToken(e);break}if(s==0&&n.next==Zf||s==1&&n.next==no||s>=2&&so?n.acceptToken(e,-o):n.acceptToken(t,-(o-2));break}else if((n.next==10||n.next==13)&&l){n.acceptToken(e,1);break}else s=o=0;n.advance()}})}const bg=ro("script",zp,Vp),Sg=ro("style",Up,Dp),Qg=ro("textarea",Ip,jp),kg=ui({"Text RawText":p.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":p.angleBracket,TagName:p.tagName,"MismatchedCloseTag/TagName":[p.tagName,p.invalid],AttributeName:p.attributeName,"AttributeValue UnquotedAttributeValue":p.attributeValue,Is:p.definitionOperator,"EntityReference CharacterReference":p.character,Comment:p.blockComment,ProcessingInst:p.processingInstruction,DoctypeDecl:p.documentMeta}),wg=hi.deserialize({version:14,states:",xOVO!rOOO!WQ#tO'#CqO!]Q#tO'#CzO!bQ#tO'#C}O!gQ#tO'#DQO!lQ#tO'#DSO!qOaO'#CpO!|ObO'#CpO#XOdO'#CpO$eO!rO'#CpOOO`'#Cp'#CpO$lO$fO'#DTO$tQ#tO'#DVO$yQ#tO'#DWOOO`'#Dk'#DkOOO`'#DY'#DYQVO!rOOO%OQ&rO,59]O%ZQ&rO,59fO%fQ&rO,59iO%qQ&rO,59lO%|Q&rO,59nOOOa'#D^'#D^O&XOaO'#CxO&dOaO,59[OOOb'#D_'#D_O&lObO'#C{O&wObO,59[OOOd'#D`'#D`O'POdO'#DOO'[OdO,59[OOO`'#Da'#DaO'dO!rO,59[O'kQ#tO'#DROOO`,59[,59[OOOp'#Db'#DbO'pO$fO,59oOOO`,59o,59oO'xQ#|O,59qO'}Q#|O,59rOOO`-E7W-E7WO(SQ&rO'#CsOOQW'#DZ'#DZO(bQ&rO1G.wOOOa1G.w1G.wOOO`1G/Y1G/YO(mQ&rO1G/QOOOb1G/Q1G/QO(xQ&rO1G/TOOOd1G/T1G/TO)TQ&rO1G/WOOO`1G/W1G/WO)`Q&rO1G/YOOOa-E7[-E7[O)kQ#tO'#CyOOO`1G.v1G.vOOOb-E7]-E7]O)pQ#tO'#C|OOOd-E7^-E7^O)uQ#tO'#DPOOO`-E7_-E7_O)zQ#|O,59mOOOp-E7`-E7`OOO`1G/Z1G/ZOOO`1G/]1G/]OOO`1G/^1G/^O*PQ,UO,59_OOQW-E7X-E7XOOOa7+$c7+$cOOO`7+$t7+$tOOOb7+$l7+$lOOOd7+$o7+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pQrXR!XpXYOX`pQ`ORx`Q{aQ!ObQ!QcQ!SdQ!UeZ!e{!O!Q!S!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:67,context:Og,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,21,30,33,36,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,29,32,35,37,"OpenTag"],["group",-9,14,17,18,19,20,39,40,41,42,"Entity",16,"Entity TextContent",-3,28,31,34,"TextContent Entity"],["isolate",-11,21,29,30,32,33,35,36,37,38,41,42,"ltr",-3,26,27,39,""]],propSources:[kg],skippedNodes:[0],repeatNodeCount:9,tokenData:"!]tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^/^!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!Z5zbkWOX5uXZ7SZ[5u[^7S^p5uqr5urs7Sst+Ptw5uwx7Sx!]5u!]!^7w!^!a7S!a#S5u#S#T7S#T;'S5u;'S;=`8n<%lO5u!R7VVOp7Sqs7St!]7S!]!^7l!^;'S7S;'S;=`7q<%lO7S!R7qOa!R!R7tP;=`<%l7S!Z8OYkWa!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!Z8qP;=`<%l5u!_8{ihSkWOX5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Or)esv)ew;'S)e;'S;=`)y<%lO)ea!:YP;=`<%l!8]!R!:dY!a`!cpOr!4trs!5ksv!4tvw!6Vwx!8]x!`!4t!`!a!;S!a;'S!4t;'S;=`!;r<%lO!4t!R!;]V!a`!cpxPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!;uP;=`<%l!4t!V!{let h=l.type.id;if(h==Jp)return Rr(l,a,t);if(h==eg)return Rr(l,a,i);if(h==tg)return Rr(l,a,n);if(h==Pf&&s.length){let f=l.node,c=f.firstChild,u=c&&Jl(c,a),O;if(u){for(let d of s)if(d.tag==u&&(!d.attrs||d.attrs(O||(O=Tf(c,a))))){let g=f.lastChild,m=g.type.id==ng?g.from:f.to;if(m>c.to)return{parser:d.parser,overlay:[{from:c.to,to:m}]}}}}if(o&&h==xf){let f=l.node,c;if(c=f.firstChild){let u=o[a.read(c.from,c.to)];if(u)for(let O of u){if(O.tagName&&O.tagName!=Jl(f.parent,a))continue;let d=f.lastChild;if(d.type.id==vs){let g=d.from+1,m=d.lastChild,b=d.to-(m&&m.isError?0:1);if(b>g)return{parser:O.parser,overlay:[{from:g,to:b}]}}else if(d.type.id==$f)return{parser:O.parser,overlay:[{from:d.from,to:d.to}]}}}}return null})}const yg=99,ea=1,Pg=100,xg=101,ta=2,Xf=[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],$g=58,vg=40,Cf=95,Zg=91,Yn=45,Tg=46,Rg=35,Xg=37,Cg=38,Ag=92,Wg=10;function ji(r){return r>=65&&r<=90||r>=97&&r<=122||r>=161}function Af(r){return r>=48&&r<=57}const Yg=new je((r,e)=>{for(let t=!1,i=0,n=0;;n++){let{next:s}=r;if(ji(s)||s==Yn||s==Cf||t&&Af(s))!t&&(s!=Yn||n>0)&&(t=!0),i===n&&s==Yn&&i++,r.advance();else if(s==Ag&&r.peek(1)!=Wg)r.advance(),r.next>-1&&r.advance(),t=!0;else{t&&r.acceptToken(s==vg?Pg:i==2&&e.canShift(ta)?ta:xg);break}}}),Mg=new je(r=>{if(Xf.includes(r.peek(-1))){let{next:e}=r;(ji(e)||e==Cf||e==Rg||e==Tg||e==Zg||e==$g&&ji(r.peek(1))||e==Yn||e==Cg)&&r.acceptToken(yg)}}),Eg=new je(r=>{if(!Xf.includes(r.peek(-1))){let{next:e}=r;if(e==Xg&&(r.advance(),r.acceptToken(ea)),ji(e)){do r.advance();while(ji(r.next)||Af(r.next));r.acceptToken(ea)}}}),qg=ui({"AtKeyword import charset namespace keyframes media supports":p.definitionKeyword,"from to selector":p.keyword,NamespaceName:p.namespace,KeyframeName:p.labelName,KeyframeRangeName:p.operatorKeyword,TagName:p.tagName,ClassName:p.className,PseudoClassName:p.constant(p.className),IdName:p.labelName,"FeatureName PropertyName":p.propertyName,AttributeName:p.attributeName,NumberLiteral:p.number,KeywordQuery:p.keyword,UnaryQueryOp:p.operatorKeyword,"CallTag ValueName":p.atom,VariableName:p.variableName,Callee:p.operatorKeyword,Unit:p.unit,"UniversalSelector NestingSelector":p.definitionOperator,MatchOp:p.compareOperator,"ChildOp SiblingOp, LogicOp":p.logicOperator,BinOp:p.arithmeticOperator,Important:p.modifier,Comment:p.blockComment,ColorLiteral:p.color,"ParenthesizedContent StringLiteral":p.string,":":p.punctuation,"PseudoOp #":p.derefOperator,"; ,":p.separator,"( )":p.paren,"[ ]":p.squareBracket,"{ }":p.brace}),_g={__proto__:null,lang:32,"nth-child":32,"nth-last-child":32,"nth-of-type":32,"nth-last-of-type":32,dir:32,"host-context":32,url:60,"url-prefix":60,domain:60,regexp:60,selector:138},zg={__proto__:null,"@import":118,"@media":142,"@charset":146,"@namespace":150,"@keyframes":156,"@supports":168},Vg={__proto__:null,not:132,only:132},Ug=hi.deserialize({version:14,states:":^QYQ[OOO#_Q[OOP#fOWOOOOQP'#Cd'#CdOOQP'#Cc'#CcO#kQ[O'#CfO$_QXO'#CaO$fQ[O'#ChO$qQ[O'#DTO$v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vg[r]||-1}],tokenPrec:1200});let Xr=null;function Cr(){if(!Xr&&typeof document=="object"&&document.body){let{style:r}=document.body,e=[],t=new Set;for(let i in r)i!="cssText"&&i!="cssFloat"&&typeof r[i]=="string"&&(/[A-Z]/.test(i)&&(i=i.replace(/[A-Z]/g,n=>"-"+n.toLowerCase())),t.has(i)||(e.push(i),t.add(i)));Xr=e.sort().map(i=>({type:"property",label:i}))}return Xr||[]}const ia=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map(r=>({type:"class",label:r})),na=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map(r=>({type:"keyword",label:r})).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map(r=>({type:"constant",label:r}))),Dg=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map(r=>({type:"type",label:r})),St=/^(\w[\w-]*|-\w[\w-]*|)$/,Ig=/^-(-[\w-]*)?$/;function jg(r,e){var t;if((r.name=="("||r.type.isError)&&(r=r.parent||r),r.name!="ArgList")return!1;let i=(t=r.parent)===null||t===void 0?void 0:t.firstChild;return(i==null?void 0:i.name)!="Callee"?!1:e.sliceString(i.from,i.to)=="var"}const ra=new Ah,Bg=["Declaration"];function Lg(r){for(let e=r;;){if(e.type.isTop)return e;if(!(e=e.parent))return r}}function Wf(r,e,t){if(e.to-e.from>4096){let i=ra.get(e);if(i)return i;let n=[],s=new Set,o=e.cursor(H.IncludeAnonymous);if(o.firstChild())do for(let l of Wf(r,o.node,t))s.has(l.label)||(s.add(l.label),n.push(l));while(o.nextSibling());return ra.set(e,n),n}else{let i=[],n=new Set;return e.cursor().iterate(s=>{var o;if(t(s)&&s.matchContext(Bg)&&((o=s.node.nextSibling)===null||o===void 0?void 0:o.name)==":"){let l=r.sliceString(s.from,s.to);n.has(l)||(n.add(l),i.push({label:l,type:"variable"}))}}),i}}const Ng=r=>e=>{let{state:t,pos:i}=e,n=ge(t).resolveInner(i,-1),s=n.type.isError&&n.from==n.to-1&&t.doc.sliceString(n.from,n.to)=="-";if(n.name=="PropertyName"||(s||n.name=="TagName")&&/^(Block|Styles)$/.test(n.resolve(n.to).name))return{from:n.from,options:Cr(),validFor:St};if(n.name=="ValueName")return{from:n.from,options:na,validFor:St};if(n.name=="PseudoClassName")return{from:n.from,options:ia,validFor:St};if(r(n)||(e.explicit||s)&&jg(n,t.doc))return{from:r(n)||s?n.from:i,options:Wf(t.doc,Lg(n),r),validFor:Ig};if(n.name=="TagName"){for(let{parent:a}=n;a;a=a.parent)if(a.name=="Block")return{from:n.from,options:Cr(),validFor:St};return{from:n.from,options:Dg,validFor:St}}if(!e.explicit)return null;let o=n.resolve(i),l=o.childBefore(i);return l&&l.name==":"&&o.name=="PseudoClassSelector"?{from:i,options:ia,validFor:St}:l&&l.name==":"&&o.name=="Declaration"||o.name=="ArgList"?{from:i,options:na,validFor:St}:o.name=="Block"||o.name=="Styles"?{from:i,options:Cr(),validFor:St}:null},Gg=Ng(r=>r.name=="VariableName"),tr=si.define({name:"css",parser:Ug.configure({props:[Ki.add({Declaration:An()}),Ji.add({"Block KeyframeList":Vh})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function Fg(){return new Vi(tr,tr.data.of({autocomplete:Gg}))}const Hg=312,sa=1,Kg=2,Jg=3,em=4,tm=313,im=315,nm=316,rm=5,sm=6,om=0,Ts=[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],Yf=125,lm=59,Rs=47,am=42,hm=43,fm=45,cm=60,um=44,Om=63,dm=46,pm=new Sf({start:!1,shift(r,e){return e==rm||e==sm||e==im?r:e==nm},strict:!1}),gm=new je((r,e)=>{let{next:t}=r;(t==Yf||t==-1||e.context)&&r.acceptToken(tm)},{contextual:!0,fallback:!0}),mm=new je((r,e)=>{let{next:t}=r,i;Ts.indexOf(t)>-1||t==Rs&&((i=r.peek(1))==Rs||i==am)||t!=Yf&&t!=lm&&t!=-1&&!e.context&&r.acceptToken(Hg)},{contextual:!0}),bm=new je((r,e)=>{let{next:t}=r;if(t==hm||t==fm){if(r.advance(),t==r.next){r.advance();let i=!e.context&&e.canShift(sa);r.acceptToken(i?sa:Kg)}}else t==Om&&r.peek(1)==dm&&(r.advance(),r.advance(),(r.next<48||r.next>57)&&r.acceptToken(Jg))},{contextual:!0});function Ar(r,e){return r>=65&&r<=90||r>=97&&r<=122||r==95||r>=192||!e&&r>=48&&r<=57}const Sm=new je((r,e)=>{if(r.next!=cm||!e.dialectEnabled(om)||(r.advance(),r.next==Rs))return;let t=0;for(;Ts.indexOf(r.next)>-1;)r.advance(),t++;if(Ar(r.next,!0)){for(r.advance(),t++;Ar(r.next,!1);)r.advance(),t++;for(;Ts.indexOf(r.next)>-1;)r.advance(),t++;if(r.next==um)return;for(let i=0;;i++){if(i==7){if(!Ar(r.next,!0))return;break}if(r.next!="extends".charCodeAt(i))break;r.advance(),t++}}r.acceptToken(em,-t)}),Qm=ui({"get set async static":p.modifier,"for while do if else switch try catch finally return throw break continue default case":p.controlKeyword,"in of await yield void typeof delete instanceof":p.operatorKeyword,"let var const using function class extends":p.definitionKeyword,"import export from":p.moduleKeyword,"with debugger as new":p.keyword,TemplateString:p.special(p.string),super:p.atom,BooleanLiteral:p.bool,this:p.self,null:p.null,Star:p.modifier,VariableName:p.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":p.function(p.variableName),VariableDefinition:p.definition(p.variableName),Label:p.labelName,PropertyName:p.propertyName,PrivatePropertyName:p.special(p.propertyName),"CallExpression/MemberExpression/PropertyName":p.function(p.propertyName),"FunctionDeclaration/VariableDefinition":p.function(p.definition(p.variableName)),"ClassDeclaration/VariableDefinition":p.definition(p.className),PropertyDefinition:p.definition(p.propertyName),PrivatePropertyDefinition:p.definition(p.special(p.propertyName)),UpdateOp:p.updateOperator,"LineComment Hashbang":p.lineComment,BlockComment:p.blockComment,Number:p.number,String:p.string,Escape:p.escape,ArithOp:p.arithmeticOperator,LogicOp:p.logicOperator,BitOp:p.bitwiseOperator,CompareOp:p.compareOperator,RegExp:p.regexp,Equals:p.definitionOperator,Arrow:p.function(p.punctuation),": Spread":p.punctuation,"( )":p.paren,"[ ]":p.squareBracket,"{ }":p.brace,"InterpolationStart InterpolationEnd":p.special(p.brace),".":p.derefOperator,", ;":p.separator,"@":p.meta,TypeName:p.typeName,TypeDefinition:p.definition(p.typeName),"type enum interface implements namespace module declare":p.definitionKeyword,"abstract global Privacy readonly override":p.modifier,"is keyof unique infer":p.operatorKeyword,JSXAttributeValue:p.attributeValue,JSXText:p.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":p.angleBracket,"JSXIdentifier JSXNameSpacedName":p.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":p.attributeName,"JSXBuiltin/JSXIdentifier":p.standard(p.tagName)}),km={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,extends:54,this:58,true:66,false:66,null:78,void:82,typeof:86,super:102,new:136,delete:148,yield:157,await:161,class:166,public:229,private:229,protected:229,readonly:231,instanceof:250,satisfies:253,in:254,const:256,import:290,keyof:345,unique:349,infer:355,is:391,abstract:411,implements:413,type:415,let:418,var:420,using:423,interface:429,enum:433,namespace:439,module:441,declare:445,global:449,for:468,of:477,while:480,with:484,do:488,if:492,else:494,switch:498,case:504,try:510,catch:514,finally:518,return:522,throw:526,break:530,continue:534,debugger:538},wm={__proto__:null,async:123,get:125,set:127,declare:189,public:191,private:191,protected:191,static:193,abstract:195,override:197,readonly:203,accessor:205,new:395},ym={__proto__:null,"<":187},Pm=hi.deserialize({version:14,states:"$@QO%TQ^OOO%[Q^OOO'_Q`OOP(lOWOOO*zQ?NdO'#CiO+RO!bO'#CjO+aO#tO'#CjO+oO!0LbO'#D^O.QQ^O'#DdO.bQ^O'#DoO%[Q^O'#DwO0fQ^O'#EPOOQ?Mr'#EX'#EXO1PQWO'#EUOOQO'#Em'#EmOOQO'#Ih'#IhO1XQWO'#GpO1dQWO'#ElO1iQWO'#ElO3hQ?NdO'#JmO6[Q?NdO'#JnO6uQ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$/U$0d$0i$1PPP$1U$1[$1`P$1c$1g$1k$2a$2x$3a$3e$3h$3k$3q$3t$3x$3|R!|RoqOXst!Z#d%k&o&q&r&t,k,p1|2PY!vQ']-]1a5eQ%rvQ%zyQ&R|Q&g!VS'T!e-TQ'c!iS'i!r!yU*e$|*V*jQ+i%{Q+v&TQ,[&aQ-Z'[Q-e'dQ-m'jQ0R*lQ1k,]R;v;T%QdOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%k%r&P&h&k&o&q&r&t&x'Q'_'o(P(R(X(`(t(v(z)y+R+V,h,k,p-a-i-w-}.l.s/f0a0g0v1d1t1u1w1y1|2P2R2r2x3^5b5m5}6O6R6f8R8X8h8rS#q];Q!r)Z$Z$n'U)o,|-P.}2b3u5`6]9h9y;P;S;T;W;X;Y;Z;[;];^;_;`;a;b;c;d;f;i;v;x;y;{ < TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:376,context:pm,nodeProps:[["isolate",-8,5,6,14,34,36,48,50,52,""],["group",-26,9,17,19,65,204,208,212,213,215,218,221,231,233,239,241,243,245,248,254,260,262,264,266,268,270,271,"Statement",-34,13,14,29,32,33,39,48,51,52,54,59,67,69,73,77,79,81,82,107,108,117,118,135,138,140,141,142,143,144,146,147,166,167,169,"Expression",-23,28,30,34,38,40,42,171,173,175,176,178,179,180,182,183,184,186,187,188,198,200,202,203,"Type",-3,85,100,106,"ClassItem"],["openedBy",23,"<",35,"InterpolationStart",53,"[",57,"{",70,"(",159,"JSXStartCloseTag"],["closedBy",24,">",37,"InterpolationEnd",47,"]",58,"}",71,")",164,"JSXEndTag"]],propSources:[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bp'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#Ge![!^%Z!^!_*g!_!c%Z!c!i#Ge!i#O%Z#O#P&c#P#R%Z#R#S#Ge#S#T%Z#T#Z#Ge#Z#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z*)x#Il_!d$b$h&j#})Lv(Rp(U!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z)[#Jv_al$h&j(Rp(U!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z04f#LS^h#)`#O-km[r]||-1},{term:338,get:r=>wm[r]||-1},{term:92,get:r=>ym[r]||-1}],tokenPrec:14749}),Mf=[xe("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),xe("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),xe("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),xe("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),xe("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),xe(`try { \${} } catch (\${error}) { \${} }`,{label:"try",detail:"/ catch block",type:"keyword"}),xe("if (${}) {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),xe(`if (\${}) { \${} } else { \${} }`,{label:"if",detail:"/ else block",type:"keyword"}),xe(`class \${name} { constructor(\${params}) { \${} } }`,{label:"class",detail:"definition",type:"keyword"}),xe('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),xe('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],xm=Mf.concat([xe("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),xe("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),xe("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),oa=new Ah,Ef=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Qi(r){return(e,t)=>{let i=e.node.getChild("VariableDefinition");return i&&t(i,r),!0}}const $m=["FunctionDeclaration"],vm={FunctionDeclaration:Qi("function"),ClassDeclaration:Qi("class"),ClassExpression:()=>!0,EnumDeclaration:Qi("constant"),TypeAliasDeclaration:Qi("type"),NamespaceDeclaration:Qi("namespace"),VariableDefinition(r,e){r.matchContext($m)||e(r,"variable")},TypeDefinition(r,e){e(r,"type")},__proto__:null};function qf(r,e){let t=oa.get(e);if(t)return t;let i=[],n=!0;function s(o,l){let a=r.sliceString(o.from,o.to);i.push({label:a,type:l})}return e.cursor(H.IncludeAnonymous).iterate(o=>{if(n)n=!1;else if(o.name){let l=vm[o.name];if(l&&l(o,s)||Ef.has(o.name))return!1}else if(o.to-o.from>8192){for(let l of qf(r,o.node))i.push(l);return!1}}),oa.set(e,i),i}const la=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,_f=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName",".","?."];function Zm(r){let e=ge(r.state).resolveInner(r.pos,-1);if(_f.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&la.test(r.state.sliceDoc(e.from,e.to));if(!t&&!r.explicit)return null;let i=[];for(let n=e;n;n=n.parent)Ef.has(n.name)&&(i=i.concat(qf(r.state.doc,n)));return{options:i,from:t?e.from:r.pos,validFor:la}}const rt=si.define({name:"javascript",parser:Pm.configure({props:[Ki.add({IfStatement:An({except:/^\s*({|else\b)/}),TryStatement:An({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:gd,SwitchBody:r=>{let e=r.textAfter,t=/^\s*\}/.test(e),i=/^\s*(case|default)\b/.test(e);return r.baseIndent+(t?0:i?1:2)*r.unit},Block:pd({closing:"}"}),ArrowFunction:r=>r.baseIndent+r.unit,"TemplateString BlockComment":()=>null,"Statement Property":An({except:/^{/}),JSXElement(r){let e=/^\s*<\//.test(r.textAfter);return r.lineIndent(r.node.from)+(e?0:r.unit)},JSXEscape(r){let e=/\s*\}/.test(r.textAfter);return r.lineIndent(r.node.from)+(e?0:r.unit)},"JSXOpenTag JSXSelfClosingTag"(r){return r.column(r.node.from)+r.unit}}),Ji.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Vh,BlockComment(r){return{from:r.from+2,to:r.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),zf={test:r=>/^JSX/.test(r.name),facet:Bs({commentTokens:{block:{open:"{/*",close:"*/}"}}})},Vf=rt.configure({dialect:"ts"},"typescript"),Uf=rt.configure({dialect:"jsx",props:[Ls.add(r=>r.isTop?[zf]:void 0)]}),Df=rt.configure({dialect:"jsx ts",props:[Ls.add(r=>r.isTop?[zf]:void 0)]},"typescript");let If=r=>({label:r,type:"keyword"});const jf="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(If),Tm=jf.concat(["declare","implements","private","protected","public"].map(If));function Rm(r={}){let e=r.jsx?r.typescript?Df:Uf:r.typescript?Vf:rt,t=r.typescript?xm.concat(Tm):Mf.concat(jf);return new Vi(e,[rt.data.of({autocomplete:Dd(_f,Ud(t))}),rt.data.of({autocomplete:Zm}),r.jsx?Am:[]])}function Xm(r){for(;;){if(r.name=="JSXOpenTag"||r.name=="JSXSelfClosingTag"||r.name=="JSXFragmentTag")return r;if(r.name=="JSXEscape"||!r.parent)return null;r=r.parent}}function aa(r,e,t=r.length){for(let i=e==null?void 0:e.firstChild;i;i=i.nextSibling)if(i.name=="JSXIdentifier"||i.name=="JSXBuiltin"||i.name=="JSXNamespacedName"||i.name=="JSXMemberExpression")return r.sliceString(i.from,Math.min(i.to,t));return""}const Cm=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Am=q.inputHandler.of((r,e,t,i,n)=>{if((Cm?r.composing:r.compositionStarted)||r.state.readOnly||e!=t||i!=">"&&i!="/"||!rt.isActiveAt(r.state,e,-1))return!1;let s=n(),{state:o}=s,l=o.changeByRange(a=>{var h;let{head:f}=a,c=ge(o).resolveInner(f-1,-1),u;if(c.name=="JSXStartTag"&&(c=c.parent),!(o.doc.sliceString(f-1,f)!=i||c.name=="JSXAttributeValue"&&c.to>f)){if(i==">"&&c.name=="JSXFragmentTag")return{range:a,changes:{from:f,insert:""}};if(i=="/"&&c.name=="JSXStartCloseTag"){let O=c.parent,d=O.parent;if(d&&O.from==f-2&&((u=aa(o.doc,d.firstChild,f))||((h=d.firstChild)===null||h===void 0?void 0:h.name)=="JSXFragmentTag")){let g=`${u}>`;return{range:P.cursor(f+g.length,-1),changes:{from:f,insert:g}}}}else if(i==">"){let O=Xm(c);if(O&&O.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(o.doc.sliceString(f,f+2))&&(u=aa(o.doc,O,f)))return{range:a,changes:{from:f,insert:``}}}}return{range:a}});return l.changes.empty?!1:(r.dispatch([s,o.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),ki=["_blank","_self","_top","_parent"],Wr=["ascii","utf-8","utf-16","latin1","latin1"],Yr=["get","post","put","delete"],Mr=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Te=["true","false"],T={},Wm={a:{attrs:{href:null,ping:null,type:null,media:null,target:ki,hreflang:null}},abbr:T,address:T,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:T,aside:T,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:T,base:{attrs:{href:null,target:ki}},bdi:T,bdo:T,blockquote:{attrs:{cite:null}},body:T,br:T,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:Mr,formmethod:Yr,formnovalidate:["novalidate"],formtarget:ki,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:T,center:T,cite:T,code:T,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:T,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:T,div:T,dl:T,dt:T,em:T,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:T,figure:T,footer:T,form:{attrs:{action:null,name:null,"accept-charset":Wr,autocomplete:["on","off"],enctype:Mr,method:Yr,novalidate:["novalidate"],target:ki}},h1:T,h2:T,h3:T,h4:T,h5:T,h6:T,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:T,hgroup:T,hr:T,html:{attrs:{manifest:null}},i:T,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:Mr,formmethod:Yr,formnovalidate:["novalidate"],formtarget:ki,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:T,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:T,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:T,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Wr,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:T,noscript:T,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:T,param:{attrs:{name:null,value:null}},pre:T,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:T,rt:T,ruby:T,samp:T,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Wr}},section:T,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:T,source:{attrs:{src:null,type:null,media:null}},span:T,strong:T,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:T,summary:T,sup:T,table:T,tbody:T,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:T,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:T,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:T,time:{attrs:{datetime:null}},title:T,tr:T,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:T,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:T},Bf={accesskey:null,class:null,contenteditable:Te,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Te,autocorrect:Te,autocapitalize:Te,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Te,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Te,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Te,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Te,"aria-hidden":Te,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Te,"aria-multiselectable":Te,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Te,"aria-relevant":null,"aria-required":Te,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},Lf="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(r=>"on"+r);for(let r of Lf)Bf[r]=null;class Bi{constructor(e,t){this.tags=Object.assign(Object.assign({},Wm),e),this.globalAttrs=Object.assign(Object.assign({},Bf),t),this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}Bi.default=new Bi;function fi(r,e,t=r.length){if(!e)return"";let i=e.firstChild,n=i&&i.getChild("TagName");return n?r.sliceString(n.from,Math.min(n.to,t)):""}function ci(r,e=!1){for(;r;r=r.parent)if(r.name=="Element")if(e)e=!1;else return r;return null}function Nf(r,e,t){let i=t.tags[fi(r,ci(e))];return(i==null?void 0:i.children)||t.allTags}function so(r,e){let t=[];for(let i=ci(e);i&&!i.type.isTop;i=ci(i.parent)){let n=fi(r,i);if(n&&i.lastChild.name=="CloseTag")break;n&&t.indexOf(n)<0&&(e.name=="EndTag"||e.from>=i.firstChild.to)&&t.push(n)}return t}const Gf=/^[:\-\.\w\u00b7-\uffff]*$/;function ha(r,e,t,i,n){let s=/\s*>/.test(r.sliceDoc(n,n+5))?"":">",o=ci(t,!0);return{from:i,to:n,options:Nf(r.doc,o,e).map(l=>({label:l,type:"type"})).concat(so(r.doc,t).map((l,a)=>({label:"/"+l,apply:"/"+l+s,type:"type",boost:99-a}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function fa(r,e,t,i){let n=/\s*>/.test(r.sliceDoc(i,i+5))?"":">";return{from:t,to:i,options:so(r.doc,e).map((s,o)=>({label:s,apply:s+n,type:"type",boost:99-o})),validFor:Gf}}function Ym(r,e,t,i){let n=[],s=0;for(let o of Nf(r.doc,t,e))n.push({label:"<"+o,type:"type"});for(let o of so(r.doc,t))n.push({label:"",type:"type",boost:99-s++});return{from:i,to:i,options:n,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function Mm(r,e,t,i,n){let s=ci(t),o=s?e.tags[fi(r.doc,s)]:null,l=o&&o.attrs?Object.keys(o.attrs):[],a=o&&o.globalAttrs===!1?l:l.length?l.concat(e.globalAttrNames):e.globalAttrNames;return{from:i,to:n,options:a.map(h=>({label:h,type:"property"})),validFor:Gf}}function Em(r,e,t,i,n){var s;let o=(s=t.parent)===null||s===void 0?void 0:s.getChild("AttributeName"),l=[],a;if(o){let h=r.sliceDoc(o.from,o.to),f=e.globalAttrs[h];if(!f){let c=ci(t),u=c?e.tags[fi(r.doc,c)]:null;f=(u==null?void 0:u.attrs)&&u.attrs[h]}if(f){let c=r.sliceDoc(i,n).toLowerCase(),u='"',O='"';/^['"]/.test(c)?(a=c[0]=='"'?/^[^"]*$/:/^[^']*$/,u="",O=r.sliceDoc(n,n+1)==c[0]?"":c[0],c=c.slice(1),i++):a=/^[^\s<>='"]*$/;for(let d of f)l.push({label:d,apply:u+d+O,type:"constant"})}}return{from:i,to:n,options:l,validFor:a}}function Ff(r,e){let{state:t,pos:i}=e,n=ge(t).resolveInner(i,-1),s=n.resolve(i);for(let o=i,l;s==n&&(l=n.childBefore(o));){let a=l.lastChild;if(!a||!a.type.isError||a.fromFf(i,n)}const zm=rt.parser.configure({top:"SingleExpression"}),Hf=[{tag:"script",attrs:r=>r.type=="text/typescript"||r.lang=="ts",parser:Vf.parser},{tag:"script",attrs:r=>r.type=="text/babel"||r.type=="text/jsx",parser:Uf.parser},{tag:"script",attrs:r=>r.type=="text/typescript-jsx",parser:Df.parser},{tag:"script",attrs(r){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(r.type)},parser:zm},{tag:"script",attrs(r){return!r.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(r.type)},parser:rt.parser},{tag:"style",attrs(r){return(!r.lang||r.lang=="css")&&(!r.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(r.type))},parser:tr.parser}],Kf=[{name:"style",parser:tr.parser.configure({top:"Styles"})}].concat(Lf.map(r=>({name:r,parser:rt.parser}))),Jf=si.define({name:"html",parser:wg.configure({props:[Ki.add({Element(r){let e=/^(\s*)(<\/)?/.exec(r.textAfter);return r.node.to<=r.pos+e[0].length?r.continue():r.lineIndent(r.node.from)+(e[2]?0:r.unit)},"OpenTag CloseTag SelfClosingTag"(r){return r.column(r.node.from)+r.unit},Document(r){if(r.pos+/\s*/.exec(r.textAfter)[0].lengthr.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:""}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-._"}}),Mn=Jf.configure({wrap:Rf(Hf,Kf)});function Vm(r={}){let e="",t;r.matchClosingTags===!1&&(e="noMatch"),r.selfClosingTags===!0&&(e=(e?e+" ":"")+"selfClosing"),(r.nestedLanguages&&r.nestedLanguages.length||r.nestedAttributes&&r.nestedAttributes.length)&&(t=Rf((r.nestedLanguages||[]).concat(Hf),(r.nestedAttributes||[]).concat(Kf)));let i=t?Jf.configure({wrap:t,dialect:e}):e?Mn.configure({dialect:e}):Mn;return new Vi(i,[Mn.data.of({autocomplete:_m(r)}),r.autoCloseTags!==!1?Um:[],Rm().support,Fg().support])}const ca=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),Um=q.inputHandler.of((r,e,t,i,n)=>{if(r.composing||r.state.readOnly||e!=t||i!=">"&&i!="/"||!Mn.isActiveAt(r.state,e,-1))return!1;let s=n(),{state:o}=s,l=o.changeByRange(a=>{var h,f,c;let u=o.doc.sliceString(a.from-1,a.to)==i,{head:O}=a,d=ge(o).resolveInner(O,-1),g;if(u&&i==">"&&d.name=="EndTag"){let m=d.parent;if(((f=(h=m.parent)===null||h===void 0?void 0:h.lastChild)===null||f===void 0?void 0:f.name)!="CloseTag"&&(g=fi(o.doc,m.parent,O))&&!ca.has(g)){let b=O+(o.doc.sliceString(O,O+1)===">"?1:0),Q=``;return{range:a,changes:{from:O,to:b,insert:Q}}}}else if(u&&i=="/"&&d.name=="IncompleteCloseTag"){let m=d.parent;if(d.from==O-2&&((c=m.lastChild)===null||c===void 0?void 0:c.name)!="CloseTag"&&(g=fi(o.doc,m,O))&&!ca.has(g)){let b=O+(o.doc.sliceString(O,O+1)===">"?1:0),Q=`${g}>`;return{range:P.cursor(O+Q.length,-1),changes:{from:O,to:b,insert:Q}}}}return{range:a}});return l.changes.empty?!1:(r.dispatch([s,o.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),ec=Bs({commentTokens:{block:{open:""}}}),tc=new Y,ic=mp.configure({props:[Ji.add(r=>!r.is("Block")||r.is("Document")||Xs(r)!=null||Dm(r)?void 0:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})),tc.add(Xs),Ki.add({Document:()=>null}),Et.add({Document:ec})]});function Xs(r){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(r.name);return e?+e[1]:void 0}function Dm(r){return r.name=="OrderedList"||r.name=="BulletList"}function Im(r,e){let t=r;for(;;){let i=t.nextSibling,n;if(!i||(n=Xs(i.type))!=null&&n<=e)break;t=i}return t.to}const jm=md.of((r,e,t)=>{for(let i=ge(r).resolveInner(t,-1);i&&!(i.fromt)return{from:t,to:s}}return null});function oo(r){return new Me(ec,r,[jm],"markdown")}const Bm=oo(ic),Lm=ic.configure([Zp,Rp,Tp,Xp,{props:[Ji.add({Table:(r,e)=>({from:e.doc.lineAt(r.from).to,to:r.to})})]}]),nc=oo(Lm);function Nm(r,e){return t=>{if(t&&r){let i=null;if(t=/\S*/.exec(t)[0],typeof r=="function"?i=r(t):i=Bn.matchLanguageName(r,t,!0),i instanceof Bn)return i.support?i.support.language.parser:zi.getSkippingParser(i.load());if(i)return i.parser}return e?e.parser:null}}class xn{constructor(e,t,i,n,s,o,l){this.node=e,this.from=t,this.to=i,this.spaceBefore=n,this.spaceAfter=s,this.type=o,this.item=l}blank(e,t=!0){let i=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(e!=null){for(;i.length0;n--)i+=" ";return i+(t?this.spaceAfter:"")}}marker(e,t){let i=this.node.name=="OrderedList"?String(+sc(this.item,e)[2]+t):"";return this.spaceBefore+i+this.type+this.spaceAfter}}function rc(r,e){let t=[];for(let n=r;n&&n.name!="Document";n=n.parent)(n.name=="ListItem"||n.name=="Blockquote"||n.name=="FencedCode")&&t.push(n);let i=[];for(let n=t.length-1;n>=0;n--){let s=t[n],o,l=e.lineAt(s.from),a=s.from-l.from;if(s.name=="FencedCode")i.push(new xn(s,a,a,"","","",null));else if(s.name=="Blockquote"&&(o=/^ *>( ?)/.exec(l.text.slice(a))))i.push(new xn(s,a,a+o[0].length,"",o[1],">",null));else if(s.name=="ListItem"&&s.parent.name=="OrderedList"&&(o=/^( *)\d+([.)])( *)/.exec(l.text.slice(a)))){let h=o[3],f=o[0].length;h.length>=4&&(h=h.slice(0,h.length-4),f-=4),i.push(new xn(s.parent,a,a+f,o[1],h,o[2],s))}else if(s.name=="ListItem"&&s.parent.name=="BulletList"&&(o=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(l.text.slice(a)))){let h=o[4],f=o[0].length;h.length>4&&(h=h.slice(0,h.length-4),f-=4);let c=o[2];o[3]&&(c+=o[3].replace(/[xX]/," ")),i.push(new xn(s.parent,a,a+f,o[1],h,c,s))}}return i}function sc(r,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(r.from,r.from+10))}function Er(r,e,t,i=0){for(let n=-1,s=r;;){if(s.name=="ListItem"){let l=sc(s,e),a=+l[2];if(n>=0){if(a!=n+1)return;t.push({from:s.from+l[1].length,to:s.from+l[0].length,insert:String(n+2+i)})}n=a}let o=s.nextSibling;if(!o)break;s=o}}function lo(r,e){let t=/^[ \t]*/.exec(r)[0].length;if(!t||e.facet(Hi)!=" ")return r;let i=$t(r,4,t),n="";for(let s=i;s>0;)s>=4?(n+=" ",s-=4):(n+=" ",s--);return n+r.slice(t)}const Gm=({state:r,dispatch:e})=>{let t=ge(r),{doc:i}=r,n=null,s=r.changeByRange(o=>{if(!o.empty||!nc.isActiveAt(r,o.from))return n={range:o};let l=o.from,a=i.lineAt(l),h=rc(t.resolveInner(l,-1),i);for(;h.length&&h[h.length-1].from>l-a.from;)h.pop();if(!h.length)return n={range:o};let f=h[h.length-1];if(f.to-f.spaceAfter.length>l-a.from)return n={range:o};let c=l>=f.to-f.spaceAfter.length&&!/\S/.test(a.text.slice(f.to));if(f.item&&c){let m=f.node.firstChild,b=f.node.getChild("ListItem","ListItem");if(m.to>=l||b&&b.to0&&!/[^\s>]/.test(i.lineAt(a.from-1).text)){let Q=h.length>1?h[h.length-2]:null,y,$="";Q&&Q.item?(y=a.from+Q.from,$=Q.marker(i,1)):y=a.from+(Q?Q.to:0);let Z=[{from:y,to:l,insert:$}];return f.node.name=="OrderedList"&&Er(f.item,i,Z,-2),Q&&Q.node.name=="OrderedList"&&Er(Q.item,i,Z),{range:P.cursor(y+$.length),changes:Z}}else{let Q=Oa(h,r,a);return{range:P.cursor(l+Q.length+1),changes:{from:a.from,insert:Q+r.lineBreak}}}}if(f.node.name=="Blockquote"&&c&&a.from){let m=i.lineAt(a.from-1),b=/>\s*$/.exec(m.text);if(b&&b.index==f.from){let Q=r.changes([{from:m.from+b.index,to:m.to},{from:a.from+f.from,to:a.to}]);return{range:o.map(Q),changes:Q}}}let u=[];f.node.name=="OrderedList"&&Er(f.item,i,u);let O=f.item&&f.item.from]*/.exec(a.text)[0].length>=f.to)for(let m=0,b=h.length-1;m<=b;m++)d+=m==b&&!O?h[m].marker(i,1):h[m].blank(ma.from&&/\s/.test(a.text.charAt(g-a.from-1));)g--;return d=lo(d,r),Fm(f.node,r.doc)&&(d=Oa(h,r,a)+r.lineBreak+d),u.push({from:g,to:l,insert:r.lineBreak+d}),{range:P.cursor(g+d.length+1),changes:u}});return n?!1:(e(r.update(s,{scrollIntoView:!0,userEvent:"input"})),!0)};function ua(r){return r.name=="QuoteMark"||r.name=="ListMark"}function Fm(r,e){if(r.name!="OrderedList"&&r.name!="BulletList")return!1;let t=r.firstChild,i=r.getChild("ListItem","ListItem");if(!i)return!1;let n=e.lineAt(t.to),s=e.lineAt(i.from),o=/^[\s>]*$/.test(n.text);return n.number+(o?0:1){let t=ge(r),i=null,n=r.changeByRange(s=>{let o=s.from,{doc:l}=r;if(s.empty&&nc.isActiveAt(r,s.from)){let a=l.lineAt(o),h=rc(Hm(t,o),l);if(h.length){let f=h[h.length-1],c=f.to-f.spaceAfter.length+(f.spaceAfter?1:0);if(o-a.from>c&&!/\S/.test(a.text.slice(c,o-a.from)))return{range:P.cursor(a.from+c),changes:{from:a.from+c,to:o}};if(o-a.from==c&&(!f.item||a.from<=f.item.from||!/\S/.test(a.text.slice(0,f.to)))){let u=a.from+f.from;if(f.item&&f.node.fromtn(r,e,"**","**"),ac=({state:r,dispatch:e})=>tn(r,e,"_","_"),hc=({state:r,dispatch:e})=>tn(r,e,"~~","~~"),fc=({state:r,dispatch:e})=>{const t=r.lineBreak,i=`${t}\`\`\`${t}`;return tn(r,e,i,i)},i0=({state:r,dispatch:e})=>{const t=[`
Spoiler `,`
`];return tn(r,e,t[0],t[1])},n0=({state:r,dispatch:e})=>gt(r,e,"# "),r0=({state:r,dispatch:e})=>gt(r,e,"## "),s0=({state:r,dispatch:e})=>gt(r,e,"### "),o0=({state:r,dispatch:e})=>gt(r,e,"#### "),l0=({state:r,dispatch:e})=>gt(r,e,"##### "),a0=({state:r,dispatch:e})=>gt(r,e,"###### "),cc=({state:r,dispatch:e})=>gt(r,e,"> "),h0=({state:r,dispatch:e})=>gt(r,e,"- "),f0=({state:r,dispatch:e})=>gt(r,e,"1. "),c0=({state:r})=>{const{from:e,to:t}=r.selection.main;return r.doc.sliceString(e,t)},u0=({state:r,dispatch:e},t)=>{const{from:i,to:n}=r.selection.main,s=r.update({changes:{from:i,to:n,insert:t},selection:{anchor:i+t.length,head:i+t.length}});return e(s),!0},O0=(r,e,t)=>{const{from:i,to:n}=r.selection.main,s=r.doc.sliceString(i,n);if(s.startsWith(e)&&s.endsWith(t))return"inclusive";const o=r.doc.sliceString(Math.max(0,i-e.length),i),l=r.doc.sliceString(n,n+t.length);return o===e&&l===t?"exclusive":"none"},tn=(r,e,t,i)=>{const{from:n,to:s}=r.selection.main,o=O0(r,t,i);if(o!=="none"){const a=o==="inclusive";let h;return a?h=r.update({changes:[{from:n,to:n+t.length,insert:""},{from:s-i.length,to:s,insert:""}]}):h=r.update({changes:[{from:n-t.length,to:n,insert:""},{from:s,to:s+i.length,insert:""}]}),e(h),!0}const l=r.update({changes:[{from:n,insert:t},{from:s,insert:i}],selection:{anchor:n+t.length,head:s+t.length}});return e(l),!0},gt=(r,e,t)=>{const i=r.doc.lineAt(r.selection.main.from),n=r.lineBreak,s={from:i.from,to:r.selection.main.to},o=r.doc.sliceString(s.from,s.to),l=o.startsWith(t);let a;if(l){const h=o.split(n+t).length,f=o.substring(t.length).replaceAll(n+t,n);a=r.update({changes:{from:s.from,to:s.to,insert:f},selection:{anchor:r.selection.main.from-t.length,head:r.selection.main.to-t.length*h}})}else{const h=t+o.replaceAll(n,n+t),f=h.length-o.length;a=r.update({changes:{from:s.from,to:s.to,insert:h},selection:{anchor:r.selection.main.from+t.length,head:r.selection.main.to+f}})}return a?(e(a),!0):!1},d0=["ListItem","Blockquote"],p0=["CodeBlock"],g0=(r,e)=>{const i=ge(r).resolve(e,-1),n=[];let s=i;for(;s;){if(d0.includes(s.name)&&n.push(s),p0.includes(s.name))return null;if(s.name==="Document")break;s=s.parent}return n},uc=r=>{const{state:e,dispatch:t}=r,{selection:{main:{head:i}}}=e,n=g0(e,i);if(!n||n.length===0)return Yd(r);const s=n[n.length-1],o=qh(e,i),l=o?Ln(e,o):"";let a;const h=e.doc.lineAt(i).text,f=["```","# ","> "],c=s.getChild("ListMark");if(c&&f.push(`${e.doc.sliceString(c.from,c.to)} `),f.includes(h))return a=m0(e),t(a),!0;switch(s.name){case"ListItem":if(!c)return!1;a=b0(e,l,c.from,c.to);break;case"Blockquote":a=S0(e,l);break}return a?(t(a),!0):!1},m0=r=>{const{lineBreak:e,selection:{main:{head:t}}}=r,i=r.doc.lineAt(t);return r.update({changes:{from:i.from,to:i.to,insert:e}})},b0=(r,e,t,i)=>{const{lineBreak:n,selection:{main:{head:s}}}=r,o=r.doc.sliceString(t,i),l=`${n}${e}${Q0(o)} `;return r.update({changes:{from:s,insert:l},selection:{anchor:s+l.length,head:s+l.length}})},S0=(r,e)=>{const{lineBreak:t,selection:{main:{head:i}}}=r,n=`${t}${e}> `;return r.update({changes:{from:i,insert:n},selection:{anchor:i+n.length,head:i+n.length}})},Q0=r=>{const t=/^(\d+)\.$/.exec(r);return t?`${(parseInt(t[1])+1).toString()}.`:r},k0={toggleBold:lc,toggleItalic:ac,toggleStrikethrough:hc,toggleCodeBlock:fc,toggleSpoiler:i0,toggleHeader:n0,toggleHeader2:r0,toggleHeader3:s0,toggleHeader4:o0,toggleHeader5:l0,toggleHeader6:a0,toggleQuote:cc,toggleBulletList:h0,toggleOrderedList:f0,insertNewlineContinueMark:uc,yankSelection:c0,replaceSelection:u0},ce=k0,w0=[{key:"Enter",run:uc},{key:"Backspace",run:oc},{key:"Mod-b",run:lc},{key:"Mod-i",run:ac},{key:"Mod-e",run:fc},{key:"Mod-s",run:hc},{key:"Mod-Shift-.",run:cc}],y0={class:"modal-insert"},P0={class:"iconified-input"},x0={class:"iconified-input"},$0={key:0,class:"label"},v0={class:"label__description"},Z0={class:"markdown-body-wrapper"},T0=["innerHTML"],R0={class:"input-group push-right"},X0={class:"modal-insert"},C0={class:"iconified-input"},A0={key:0,class:"image-strategy-chips"},W0={key:1,class:"btn-input-alternative"},Y0={key:2,class:"iconified-input"},M0={key:3,class:"label"},E0={class:"label__description"},q0={class:"markdown-body-wrapper"},_0=["innerHTML"],z0={class:"input-group push-right"},V0={class:"modal-insert"},U0={class:"iconified-input"},D0={key:0,class:"label"},I0={class:"label__description"},j0={class:"markdown-body-wrapper"},B0=["innerHTML"],L0={class:"input-group push-right"},N0={class:"resizable-textarea-wrapper"},G0={class:"editor-action-row"},F0={class:"editor-actions"},H0={class:"preview"},K0={key:0,class:"info-blurb"},J0={class:"info-blurb"},e1={key:1},t1={class:"markdown-body-wrapper"},i1=["innerHTML"],n1=dc({__name:"MarkdownEditor",props:{modelValue:{default:""},disabled:{type:Boolean,default:!1},headingButtons:{type:Boolean,default:!0},onImageUpload:{type:Function,default:void 0},placeholder:{default:"Write something..."},maxLength:{default:void 0},maxHeight:{default:void 0}},emits:["update:modelValue"],setup(r,{emit:e}){const t=r,i=lt();let n=null,s=null,o=null;const l=e;pc(()=>{const R=q.updateListener.of(ne=>{ne.docChanged&&u(ne.state.doc.toString())});o=new ei;const S=q.theme({".cm-content":{marginBlockEnd:"0.5rem",padding:"0.5rem",minHeight:"200px",caretColor:"var(--color-contrast)",width:"100%",overflowX:"scroll",maxHeight:t.maxHeight?`${t.maxHeight}px`:"unset",overflowY:"scroll"},".cm-scroller":{height:"100%",overflow:"visible"}});s=new ei;const re=V.readOnly.of(t.disabled),se=q.domEventHandlers({paste:(ne,ue)=>{var ao;const{clipboardData:ot}=ne;if(!ot)return;if(ot.files&&ot.files.length>0&&t.onImageUpload)return $(ot.files).then(function(Xt){const Oc=`![${ce.yankSelection(ue)||"Replace this with a description"}](${Xt})`;return ce.replaceSelection(ue,Oc)}).catch(Xt=>{Xt instanceof Error&&console.error("Problem with handling image.",Xt)}),!1;const lr=(ao=ne.clipboardData)==null?void 0:ao.getData("text/plain");if(lr){try{Q(lr)}catch(nn){if(nn instanceof Error)return}const Xt=ue.state.selection.main,ar=ue.state.doc.sliceString(Xt.from,Xt.to);if(ar){const nn=`[${ar}](${lr})`;return ce.replaceSelection(ue,nn)}}if(t.maxLength&&ue.state.doc.length>t.maxLength)return ne.preventDefault(),!1},blur:(ne,ue)=>{if(t.maxLength&&ue.state.doc.length>t.maxLength){const ot=ue.state.doc.length-t.maxLength;ue.dispatch({changes:{from:ue.state.doc.length-ot,to:ue.state.doc.length},selection:{anchor:t.maxLength,head:t.maxLength}})}}}),C=V.changeFilter.of(ne=>!(t.maxLength&&ne.newDoc.length>t.maxLength)),Ve=V.create({extensions:[se,R,Ht.of([_d]),Ht.of(w0),Pd(),Jm({addKeymap:!1}),Ht.of(Ad),VO(t.placeholder||""),C,s.of(re),o.of(S)]});n=new q({state:Ve,parent:i.value,doc:t.modelValue??""}),n==null||n.dispatch({changes:{from:0,to:n.state.doc.length,insert:t.modelValue}})}),gc(()=>{n==null||n.destroy()});function a(R,S){S&&(R(S),S.focus())}const h=(R,S,re)=>({label:R,icon:S,action:se=>a(re,se)}),f={headings:{display:t.headingButtons,hideOnMobile:!1,buttons:[h("Heading 1",yc,ce.toggleHeader),h("Heading 2",Pc,ce.toggleHeader2),h("Heading 3",xc,ce.toggleHeader3)]},stylizing:{display:!0,hideOnMobile:!1,buttons:[h("Bold",$c,ce.toggleBold),h("Italic",vc,ce.toggleItalic),h("Strikethrough",Zc,ce.toggleStrikethrough),h("Code",Tc,ce.toggleCodeBlock),h("Spoiler",Rc,ce.toggleSpoiler)]},lists:{display:!0,hideOnMobile:!1,buttons:[h("Bulleted list",Xc,ce.toggleBulletList),h("Ordered list",Cc,ce.toggleOrderedList),h("Quote",Ac,ce.toggleQuote)]},components:{display:!0,hideOnMobile:!1,buttons:[{label:"Link",icon:ho,action:()=>me()},{label:"Image",icon:fo,action:()=>st()},{label:"Video",icon:co,action:()=>mt()}]}};uo(()=>t.disabled,R=>{n&&(s&&n.dispatch({effects:[s.reconfigure(V.readOnly.of(R))]}),o&&n.dispatch({effects:[o.reconfigure(q.theme({".cm-content":{marginBlockEnd:"0.5rem",padding:"0.5rem",minHeight:"200px",caretColor:"var(--color-contrast)",width:"100%",overflowX:"scroll",maxHeight:t.maxHeight?`${t.maxHeight}px`:"unset",overflowY:"scroll",opacity:R?.6:1,pointerEvents:R?"none":"all",cursor:R?"not-allowed":"auto"},".cm-scroller":{height:"100%",overflow:"visible"}}))]}))},{immediate:!0});const c=mc(t,"modelValue");uo(c,R=>{n&&R!==n.state.doc.toString()&&n.dispatch({changes:{from:0,to:n.state.doc.length,insert:R}})},{immediate:!0});const u=R=>{l("update:modelValue",R)},O=lt(!1),d=lt(""),g=lt(""),m=lt();function b(){if(!g.value||g.value===""){m.value=void 0;return}try{m.value=void 0,Q(g.value)}catch(R){R instanceof Error&&(m.value=R.message)}}function Q(R){let S;try{S=new URL(R)}catch{throw new Error("Invalid URL. Make sure the URL is well-formed.")}if(S.protocol!=="http:"&&S.protocol!=="https:")throw new Error("Unsupported protocol. Use http or https.");if(S.protocol==="http:"&&(S.protocol="https:"),["forgecdn","cdn.discordapp","media.discordapp"].some(se=>S.hostname.includes(se)))throw new Error("Invalid URL. This domain is not allowed.");return S.toString()}const y=rn(()=>{if(!g.value)return"";try{const R=Q(g.value);return R?`[${d.value?d.value:R}](${R})`:""}catch(R){R instanceof Error&&console.error(R.message)}return""}),$=async R=>{const S=R[0];if(!t.onImageUpload)throw new Error("No image upload handler provided");if(S)try{return await t.onImageUpload(S)}catch(re){if(re instanceof Error)throw console.error("Unable to upload image using handler.",re.message),new Error(re.message)}throw new Error("No file provided")},Z=async R=>{if(t.onImageUpload)try{const S=await $(R);g.value=S,b()}catch(S){S instanceof Error&&(m.value=S.message),console.error(S)}},A=lt("upload"),X=rn(()=>y.value.length?`!${y.value}`:""),ee=rn(()=>{var R,S;return!m.value&&((R=g.value)==null?void 0:R.length)>0&&((S=d.value)==null?void 0:S.length)>0}),B=/^(?:https?:)?(?:\/\/)?(?:youtu\.be\/|(?:www\.|m\.)?youtube\.com\/(?:watch|v|embed)(?:\.php)?(?:\?.*v=|\/))(?[a-zA-Z0-9_-]{7,15})(?:[?&][a-zA-Z0-9_-]+=[a-zA-Z0-9_-]+)*$/,U=rn(()=>{const R=B.exec(g.value);return R?``:""}),M=lt(null),E=lt(null),L=lt(null);function N(){d.value="",g.value="",m.value=void 0}function me(){var R;n&&(d.value=ce.yankSelection(n)),N(),(R=M.value)==null||R.show()}function st(){var R;N(),(R=E.value)==null||R.show()}function mt(){var R;N(),(R=L.value)==null||R.show()}return(R,S)=>{var se;const re=bc("tooltip");return Pe(),Xe(ln,null,[_(cr,{ref_key:"linkModal",ref:M,header:"Insert link"},{default:be(()=>[x("div",y0,[S[15]||(S[15]=x("label",{class:"label",for:"insert-link-label"},[x("span",{class:"label__title"},"Label")],-1)),x("div",P0,[_(D(Oo)),Dt(x("input",{id:"insert-link-label","onUpdate:modelValue":S[0]||(S[0]=C=>d.value=C),type:"text",placeholder:"Enter label..."},null,512),[[di,d.value]]),_(Ae,{class:"r-btn",onClick:S[1]||(S[1]=()=>d.value="")},{default:be(()=>[_(D(bt))]),_:1})]),S[16]||(S[16]=x("label",{class:"label",for:"insert-link-url"},[x("span",{class:"label__title"},[Ce("URL"),x("span",{class:"required"},"*")])],-1)),x("div",x0,[_(D(ho)),Dt(x("input",{id:"insert-link-url","onUpdate:modelValue":S[2]||(S[2]=C=>g.value=C),type:"text",placeholder:"Enter the link's URL...",onInput:b},null,544),[[di,g.value]]),_(Ae,{class:"r-btn",onClick:S[3]||(S[3]=()=>g.value="")},{default:be(()=>[_(D(bt))]),_:1})]),m.value?(Pe(),Xe("span",$0,[S[12]||(S[12]=x("span",{class:"label__title"},"Error",-1)),x("span",v0,sn(m.value),1)])):It("",!0),S[17]||(S[17]=x("span",{class:"label"},[x("span",{class:"label__title"},"Preview"),x("span",{class:"label__description"})],-1)),x("div",Z0,[x("div",{style:{width:"100%"},class:"markdown-body",innerHTML:D(on)(y.value)},null,8,T0)]),x("div",R0,[_(Ae,{action:()=>{var C;return(C=M.value)==null?void 0:C.hide()}},{default:be(()=>[_(D(bt)),S[13]||(S[13]=Ce(" Cancel"))]),_:1},8,["action"]),_(Ae,{color:"primary",disabled:m.value||!g.value,action:()=>{var C;D(n)&&D(ce).replaceSelection(D(n),y.value),(C=M.value)==null||C.hide()}},{default:be(()=>[_(D(hr)),S[14]||(S[14]=Ce(" Insert"))]),_:1},8,["disabled","action"])])])]),_:1},512),_(cr,{ref_key:"imageModal",ref:E,header:"Insert image"},{default:be(()=>[x("div",X0,[S[21]||(S[21]=x("label",{class:"label",for:"insert-image-alt"},[x("span",{class:"label__title"},[Ce("Description (alt text)"),x("span",{class:"required"},"*")]),x("span",{class:"label__description"}," Describe the image completely as you would to someone who could not see the image. ")],-1)),x("div",C0,[_(D(Oo)),Dt(x("input",{id:"insert-image-alt","onUpdate:modelValue":S[4]||(S[4]=C=>d.value=C),type:"text",placeholder:"Describe the image..."},null,512),[[di,d.value]]),_(Ae,{class:"r-btn",onClick:S[5]||(S[5]=()=>d.value="")},{default:be(()=>[_(D(bt))]),_:1})]),S[22]||(S[22]=x("label",{class:"label",for:"insert-link-url"},[x("span",{class:"label__title"},[Ce("URL"),x("span",{class:"required"},"*")])],-1)),t.onImageUpload?(Pe(),Xe("div",A0,[_(Yc,{modelValue:A.value,"onUpdate:modelValue":S[6]||(S[6]=C=>A.value=C),items:["upload","link"]},null,8,["modelValue"])])):It("",!0),t.onImageUpload&&A.value==="upload"?(Pe(),Xe("div",W0,[_(Mc,{accept:"image/png,image/jpeg,image/gif,image/webp",prompt:"Drag and drop to upload or click to select file","long-style":"","should-always-reset":"",class:"file-input",onChange:Z},{default:be(()=>[_(D(Sc))]),_:1})])):It("",!0),!t.onImageUpload||A.value==="link"?(Pe(),Xe("div",Y0,[_(D(fo)),Dt(x("input",{id:"insert-link-url","onUpdate:modelValue":S[7]||(S[7]=C=>g.value=C),type:"text",placeholder:"Enter the image URL...",onInput:b},null,544),[[di,g.value]]),_(Ae,{class:"r-btn",onClick:S[8]||(S[8]=()=>g.value="")},{default:be(()=>[_(D(bt))]),_:1})])):It("",!0),m.value?(Pe(),Xe("span",M0,[S[18]||(S[18]=x("span",{class:"label__title"},"Error",-1)),x("span",E0,sn(m.value),1)])):It("",!0),S[23]||(S[23]=x("span",{class:"label"},[x("span",{class:"label__title"},"Preview"),x("span",{class:"label__description"})],-1)),x("div",q0,[x("div",{style:{width:"100%"},class:"markdown-body",innerHTML:D(on)(X.value)},null,8,_0)]),x("div",z0,[_(Ae,{action:()=>{var C;return(C=E.value)==null?void 0:C.hide()}},{default:be(()=>[_(D(bt)),S[19]||(S[19]=Ce(" Cancel"))]),_:1},8,["action"]),_(Ae,{color:"primary",disabled:!ee.value,action:()=>{var C;D(n)&&D(ce).replaceSelection(D(n),X.value),(C=E.value)==null||C.hide()}},{default:be(()=>[_(D(hr)),S[20]||(S[20]=Ce(" Insert "))]),_:1},8,["disabled","action"])])])]),_:1},512),_(cr,{ref_key:"videoModal",ref:L,header:"Insert YouTube video"},{default:be(()=>[x("div",V0,[S[27]||(S[27]=x("label",{class:"label",for:"insert-video-url"},[x("span",{class:"label__title"},[Ce("YouTube video URL"),x("span",{class:"required"},"*")]),x("span",{class:"label__description"}," Enter a valid link to a YouTube video. ")],-1)),x("div",U0,[_(D(co)),Dt(x("input",{id:"insert-video-url","onUpdate:modelValue":S[9]||(S[9]=C=>g.value=C),type:"text",placeholder:"Enter YouTube video URL",onInput:b},null,544),[[di,g.value]]),_(Ae,{class:"r-btn",onClick:S[10]||(S[10]=()=>g.value="")},{default:be(()=>[_(D(bt))]),_:1})]),m.value?(Pe(),Xe("span",D0,[S[24]||(S[24]=x("span",{class:"label__title"},"Error",-1)),x("span",I0,sn(m.value),1)])):It("",!0),S[28]||(S[28]=x("span",{class:"label"},[x("span",{class:"label__title"},"Preview"),x("span",{class:"label__description"})],-1)),x("div",j0,[x("div",{style:{width:"100%"},class:"markdown-body",innerHTML:D(on)(U.value)},null,8,B0)]),x("div",L0,[_(Ae,{action:()=>{var C;return(C=L.value)==null?void 0:C.hide()}},{default:be(()=>[_(D(bt)),S[25]||(S[25]=Ce(" Cancel"))]),_:1},8,["action"]),_(Ae,{color:"primary",disabled:m.value||!g.value,action:()=>{var C;D(n)&&D(ce).replaceSelection(D(n),U.value),(C=L.value)==null||C.hide()}},{default:be(()=>[_(D(hr)),S[26]||(S[26]=Ce(" Insert "))]),_:1},8,["disabled","action"])])])]),_:1},512),x("div",N0,[x("div",G0,[x("div",F0,[(Pe(!0),Xe(ln,null,po(Object.values(f).filter(C=>C.display),(C,Ve)=>(Pe(),Xe(ln,{key:Ve},[S[29]||(S[29]=x("div",{class:"divider"},null,-1)),(Pe(!0),Xe(ln,null,po(C.buttons,ne=>Dt((Pe(),go(Ae,{key:ne.label,"icon-only":"","aria-label":ne.label,class:fr({"mobile-hidden-group":!!C.hideOnMobile}),action:()=>ne.action(D(n)),disabled:O.value||R.disabled},{default:be(()=>[(Pe(),go(Qc(ne.icon)))]),_:2},1032,["aria-label","class","action","disabled"])),[[re,ne.label]])),128))],64))),128))]),x("div",H0,[_(Ec,{id:"preview",modelValue:O.value,"onUpdate:modelValue":S[11]||(S[11]=C=>O.value=C)},null,8,["modelValue"]),S[30]||(S[30]=x("label",{class:"label",for:"preview"}," Preview ",-1))])]),x("div",{ref_key:"editorRef",ref:i,class:fr({hide:O.value})},null,2),O.value?(Pe(),Xe("div",e1,[x("div",t1,[x("div",{style:wc([{width:"100%"},{maxHeight:t.maxHeight?`${t.maxHeight}px`:"unset",overflowY:"auto"}]),class:"markdown-body",innerHTML:D(on)(c.value??"")},null,12,i1)])])):(Pe(),Xe("div",K0,[x("div",J0,[_(D(kc)),S[31]||(S[31]=x("span",null,[Ce("This editor supports "),x("a",{class:"markdown-resource-link",href:"https://support.modrinth.com/en/articles/8801962-advanced-markdown-formatting",target:"_blank"},"Markdown formatting"),Ce(".")],-1))]),x("div",{class:fr([{hide:!t.maxLength},"max-length-label"])},[S[32]||(S[32]=x("span",null,"Max length: ",-1)),x("span",null,sn(t.maxLength?`${((se=c.value)==null?void 0:se.length)||0}/${t.maxLength}`:"Unlimited"),1)],2)]))])],64)}}}),g1=Wc(n1,[["__scopeId","data-v-6a6215de"]]);export{g1 as M};