0
0
Fork 0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-03-18 05:52:56 +00:00
BookStackApp_BookStack/public/dist/code.js

33 lines
629 KiB
JavaScript
Raw Permalink Normal View History

// See the "/licenses" URI for full package license details
var as=[],Wl=[];(()=>{let i="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(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<i.length;e++)(e%2?Wl:as).push(t=t+i[e])})();function Id(i){if(i<768)return!1;for(let e=0,t=as.length;;){let n=e+t>>1;if(i<as[n])t=n;else if(i>=Wl[n])e=n+1;else return!0;if(e==t)return!1}}function Xl(i){return i>=127462&&i<=127487}var Rl=8205;function ql(i,e,t=!0,n=!0){return(t?Vl:Nd)(i,e,n)}function Vl(i,e,t){if(e==i.length)return e;e&&Cl(i.charCodeAt(e))&&Ul(i.charCodeAt(e-1))&&e--;let n=ls(i,e);for(e+=Zl(n);e<i.length;){let r=ls(i,e);if(n==Rl||r==Rl||t&&Id(r))e+=Zl(r),n=r;else if(Xl(r)){let s=0,o=e-2;for(;o>=0&&Xl(ls(i,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function Nd(i,e,t){for(;e>0;){let n=Vl(i,e-2,t);if(n<e)return n;e--}return 0}function ls(i,e){let t=i.charCodeAt(e);if(!Ul(t)||e+1==i.length)return t;let n=i.charCodeAt(e+1);return Cl(n)?(t-55296<<10)+(n-56320)+65536:t}function Cl(i){return i>=56320&&i<57344}function Ul(i){return i>=55296&&i<56320}function Zl(i){return i<65536?1:2}var U=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,n){[e,t]=gi(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),di.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=gi(this,e,t);let n=[];return this.decompose(e,t,n,0),di.from(n,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),n=this.length-this.scanIdentical(e,-1),r=new Nt(this),s=new Nt(e);for(let o=t,O=t;;){if(r.next(o),s.next(o),o=0,r.lineBreak!=s.lineBreak||r.done!=s.done||r.value!=s.value)return!1;if(O+=r.value.length,r.done||O>=n)return!0}}iter(e=1){return new Nt(this,e)}iterRange(e,t=this.length){return new _n(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t==null&&(t=this.lines+1);let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new jn(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?i.empty:e.length<=32?new Re(e):di.from(Re.split(e,[]))}},Re=class i extends U{constructor(e,t=Hd(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let s=0;;s++){let o=this.text[s],O=r+o.length;if((t?n:O)>=e)return new c
`){[e,t]=gi(this,e,t);let r="";for(let s=0,o=0;s<=t&&o<this.text.length;o++){let O=this.text[o],l=s+O.length;s>e&&o&&(r+=n),e<l&&t>s&&(r+=O.slice(Math.max(0,e-s),t-s)),s=l+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],r=-1;for(let s of e)n.push(s),r+=s.length+1,n.length==32&&(t.push(new i(n,r)),n=[],r=-1);return r>-1&&t.push(new i(n,r)),t}},di=class i extends U{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,t,n,r){for(let s=0;;s++){let o=this.children[s],O=r+o.length,l=n+o.lines-1;if((t?l:O)>=e)return o.lineInner(e,t,n,r);r=O+1,n=l+1}}decompose(e,t,n,r){for(let s=0,o=0;o<=t&&s<this.children.length;s++){let O=this.children[s],l=o+O.length;if(e<=l&&t>=o){let a=r&((o<=e?1:0)|(l>=t?2:0));o>=e&&l<=t&&!a?n.push(O):O.decompose(e-o,t-o,n,a)}o=l+1}}replace(e,t,n){if([e,t]=gi(this,e,t),n.lines<this.lines)for(let r=0,s=0;r<this.children.length;r++){let o=this.children[r],O=s+o.length;if(e>=s&&t<=O){let l=o.replace(e-s,t-s,n),a=this.lines-o.lines+l.lines;if(l.lines<a>>4&&l.lines>a>>6){let h=this.children.slice();return h[r]=l,new i(h,this.length-(t-e)+n.length)}return super.replace(s,O,l)}s=O+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n=`
`){[e,t]=gi(this,e,t);let r="";for(let s=0,o=0;s<this.children.length&&o<=t;s++){let O=this.children[s],l=o+O.length;o>e&&s&&(r+=n),e<l&&t>o&&(r+=O.sliceString(e-o,t-o,n)),o=l+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof i))return 0;let n=0,[r,s,o,O]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,s+=t){if(r==o||s==O)return n;let l=this.children[r],a=e.children[s];if(l!=a)return n+l.scanIdentical(a,t);n+=l.length+1}}static from(e,t=e.reduce((n,r)=>n+r.length+1,-1)){let n=0;for(let d of e)n+=d.lines;if(n<32){let d=[];for(let p of e)p.flatten(d);return new Re(d,t)}let r=Math.max(32,n>>5),s=r<<1,o=r>>1,O=[],l=0,a=-1,h=[];function c(d){let p;if(d.lines>s&&d instanceof i)for(let m of d.children)c(m);else d.lines>o&&(l>o||!l)?(f(),O.push(d)):d instanceof Re&&l&&(p=h[h.length-1])instanceof Re&&d.lines+p.lines<=32?(l+=d.lines,a+=d.length+1,h[h.length-1]=new Re(p.text.concat(d.text),p.length+1+d.length)):(l+d.lines>r&&f(),l+=d.lines,a+=d.length+1,h.push(d))}function f(){l!=0&&(O.push(h.length==1?h[0]:i.from(h,a)),a=-1,l=h.length=0)}for(let d of e)c(d);return f(),O.length==1?O[0]:new i(O,t)}};U.empty=new Re([""],0);function Hd(i){let e=-1;for(let t of i)e+=t.length+1;return e}function Yn(i,e,t=0,n=1e9){for(let r=0,s=0,o=!0;s<i.length&&r<=n;s++){let O=i[s],l=r+O.length;l>=t&&(l>n&&(O=O.slice(0,n-r)),r<t&&(O=O.slice(t-r)),o?(e[e.length-1]+=O,o=!1):e.push(O)),r=l+1}return e}function Al(i,e,t){return Yn(i,[""],e,t)}var Nt=class{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof Re?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],s=this.offsets[n],o=s>>1,O=r instanceof Re?r.text.length:r.children.length;if(o==(t>0?O:0)){if(n==0)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=`
`,this;e--}else if(r instanceof Re){let l=r.text[o+(t<0?-1:0)];if(this.offsets[n]+=t,l.length>Math.max(0,e))return this.value=e==0?l:t>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=r.children[o+(t<0?-1:0)];e>l.length?(e-=l.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(l),this.offsets.push(t>0?1:(l instanceof Re?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},_n=class{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new Nt(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}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 n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}},jn=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<"u"&&(U.prototype[Symbol.iterator]=function(){return this.iter()},Nt.prototype[Symbol.iterator]=_n.prototype[Symbol.iterator]=jn.prototype[Symbol.iterator]=function(){return this});var cs=class{constructor(e,t,n,r){this.from=e,this.to=t,this.number=n,this.text=r}get length(){return this.to-this.from}};function gi(i,e,t){return e=Math.max(0,Math.min(i.length,e)),[e,Math.max(e,Math.min(i.length,t))]}function ae(i,e,t=!0,n=!0){return ql(i,e,t,n)}function Fd(i){return i>=56320&&i<57344}function Kd(i){return i>=55296&&i<56320}function xs(i,e){let t=i.charCodeAt(e);if(!Kd(t)||e+1==i.length)return t;let n=i.charCodeAt(e+1);return Fd(n)?(t-55296<<10)+(n-56320)+65536:t}function ks(i){return i<65536?1:2}var fs=/\r\n?|\n/,le=function(i){return i[i.Simple=0]="Simple",i[i.TrackDel=1]="TrackDel",i[i.TrackBefore=2]="TrackBefore",i[i.TrackAfter=3]="TrackAfter",i}(le||(le={})),mt=class i{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,r=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(n,r,s),r+=s):r+=o,n+=s}}iterChangedRanges(e,t=!1){us(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let n=this.sections[t++],r=this.sections[t++];r<0?e.push(n,r):e.push(r,n)}return new i(e)}composeDesc(e){return this.empty?e:e.empty?this:El(this,e)}mapDesc(e,t=!1){return e.empty?this:ds(this,e,t)}mapPos(e,t=-1,n=le.Simple){let r=0,s=0;for(let o=0;o<this.sections.length;){let O=this.sections[o++],l=this.sections[o++],a=r+O;if(l<0){if(a>e)return s+(e-r);s+=O}else{if(n!=le.Simple&&a>=e&&(n==le.TrackDel&&r<e&&a>e||n==le.TrackBefore&&r<e||n==le.TrackAfter&&a>e))return null;if(a>e||a==e&&t<0&&!O)return e==r||t<0?s:s+l;s+=l}r=a}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return s}touchesRange(e,t=e){for(let n=0,r=0;n<this.sections.length&&r<=t;){let s=this.sections[n++],o=this.sections[n++],O=r+s;if(o>=0&&r<=t&&O>=e)return r<e&&O>t?"cover":!0;r=O}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let n=this.sections[t++],r=this.sections[t++];e+=(e?" ":"")+n+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof
`}get readOnly(){return this.facet(Hl)}phrase(e,...t){for(let n of this.facet(i.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(n,r)=>{if(r=="$")return"$";let s=+(r||1);return!s||s>t.length?n:t[s-1]})),e}languageDataAt(e,t,n=-1){let r=[];for(let s of this.facet(Gl))for(let o of s(this,t,n))Object.prototype.hasOwnProperty.call(o,e)&&r.push(o[e]);return r}charCategorizer(e){return Op(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:n,length:r}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-n,O=e-n;for(;o>0;){let l=ae(t,o,!1);if(s(t.slice(l,o))!=Ye.Word)break;o=l}for(;O<r;){let l=ae(t,O);if(s(t.slice(O,l))!=Ye.Word)break;O=l}return o==O?null:S.range(o+n,O+n)}};D.allowMultipleSelections=ms;D.tabSize=X.define({combine:i=>i.length?i[0]:4});D.lineSeparator=Bl;D.readOnly=Hl;D.phrases=X.define({compare(i,e){let t=Object.keys(i),n=Object.keys(e);return t.length==n.length&&t.every(r=>i[r]==e[r])}});D.languageData=Gl;D.changeFilter=Dl;D.transactionFilter=Il;D.transactionExtender=Nl;gt.reconfigure=B.define();function Tt(i,e,t={}){let n={};for(let r of i)for(let s of Object.keys(r)){let o=r[s],O=n[s];if(O===void 0)n[s]=o;else if(!(O===o||o===void 0))if(Object.hasOwnProperty.call(t,s))n[s]=t[s](O,o);else throw new Error("Config merge conflict for field "+s)}for(let r in e)n[r]===void 0&&(n[r]=e[r]);return n}var Ie=class{eq(e){return this==e}range(e,t=e){return Mi.create(e,t,this)}};Ie.prototype.startSide=Ie.prototype.endSide=0;Ie.prototype.point=!1;Ie.prototype.mapMode=le.TrackDel;var Mi=class i{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new i(e,t,n)}};function ys(i,e){return i.from-e.from||i.value.startSide-e.value.startSide}var Ps=class i{constructor(e,t,n,r){this.from=e,this.to=t,this.value=n,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,r=0){let s=n?this.to:this.from;for(let o=r,O=s.length;;){if(o==O)return o;let l=o+O>>1,a=s[l]-e||(n?this.value[l].endSide:this.value[l].startSide)-t;if(l==o)return a>=0?o:O;a>=0?O=l:o=l+1}}between(e,t,n,r){for(let s=this.findIndex(t,-1e9,!0),o=this.findIndex(n,1e9,!1,s);s<o;s++)if(r(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t){let n=[],r=[],s=[],o=-1,O=-1;for(let l=0;l<this.value.length;l++){let a=this.value[l],h=this.from[l]+e,c=this.to[l]+e,f,d;if(h==c){let p=t.mapPos(h,a.startSide,a.mapMode);if(p==null||(f=d=p,a.startSide!=a.endSide&&(d=t.mapPos(h,a.endSide),d<f)))continue}else if(f=t.mapPos(h,a.startSide),d=t.mapPos(c,a.endSide),f>d||f==d&&a.startSide>0&&a.endSide<=0)continue;(d-f||a.endSide-a.startSide)<0||(o<0&&(o=f),a.point&&(O=Math.max(O,d-f)),n.push(a),r.push(f-o),s.push(d-o))}return{mapped:n.length?new i(r,s,n,O):null,pos:o}}},F=class i{constructor(e,t,n,r){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=r}static create(e,t,n,r){return new i(e,t,n,r)}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:n=!1,filterFrom:r=0,filterTo:s=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(n&&(t=t.slice().sort(ys)),this.isEmpty)return t.length?i.of(t):this;let O=new Gn(this,null,-1).goto(0),l=0,a=[],h=new Ft;for(;O.value||l<t.length;)if(l<t.length&&(O.from-t[l].from||O.startSide-t[l].value.startSide)>=0){let c=t[l++];h.addInner(c.from,c.to,c.value)||a.push(c)}else O.rangeIndex==1&&O.chunkIndex<this.chunk.length&&(l==t.length||this.chunkEnd(O.chunkIndex)<t[l].from)&&(!o||r>this.chunkEnd(O.chunkIndex)||s<this.chunkPos[O.chunkIndex])&&h.addChunk(this.chunkPos[O.chunkIndex],this.chunk[O.chunkIndex])?O.nextChunk():((!o||r>O.to||s<O.from||o(O.from,O.to,O.value))&&(h.addInner(O.from,O.to,O.value)||a.push(Mi.create(O.from,O.to,O.value))),O.next());return h.finishInner(this.nextLayer.isEmpty&&!a.length?i.empty:this.nextLayer.update({add:a,filter:o,filterFrom:r,filt
`)}static newName(){let e=ea[Jl]||1;return ea[Jl]=e+1,Ts+e.toString(36)}static mount(e,t,n){let r=e[zs],s=n&&n.nonce;r?s&&r.setNonce(s):r=new Xs(e,s),r.mount(Array.isArray(t)?t:[t],e)}},ta=new Map,Xs=class{constructor(e,t){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let s=ta.get(n);if(s)return e[zs]=s;this.sheet=new r.CSSStyleSheet,ta.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[zs]=this}mount(e,t){let n=this.sheet,r=0,s=0;for(let o=0;o<e.length;o++){let O=e[o],l=this.modules.indexOf(O);if(l<s&&l>-1&&(this.modules.splice(l,1),s--,l=-1),l==-1){if(this.modules.splice(s++,0,O),n)for(let a=0;a<O.rules.length;a++)n.insertRule(O.rules[a],r++)}else{for(;s<l;)r+=this.modules[s++].rules.length;r+=O.rules.length,s++}}if(n)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let o="";for(let l=0;l<this.modules.length;l++)o+=this.modules[l].getRules()+`
`;this.styleTag.textContent=o;let O=t.head||t;this.styleTag.parentNode!=O&&O.insertBefore(this.styleTag,O.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}};var $t={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},$i={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},ap=typeof navigator<"u"&&/Mac/.test(navigator.platform),hp=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(re=0;re<10;re++)$t[48+re]=$t[96+re]=String(re);var re;for(re=1;re<=24;re++)$t[re+111]="F"+re;var re;for(re=65;re<=90;re++)$t[re]=String.fromCharCode(re+32),$i[re]=String.fromCharCode(re);var re;for(Dn in $t)$i.hasOwnProperty(Dn)||($i[Dn]=$t[Dn]);var Dn;function ia(i){var e=ap&&i.metaKey&&i.shiftKey&&!i.ctrlKey&&!i.altKey||hp&&i.shiftKey&&i.key&&i.key.length==1||i.key=="Unidentified",t=!e&&i.key||(i.shiftKey?$i:$t)[i.keyCode]||i.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 tn(i){let e;return i.nodeType==11?e=i.getSelection?i:i.ownerDocument:e=i,e.getSelection()}function Cs(i,e){return e?i==e||i.contains(e.nodeType!=1?e.parentNode:e):!1}function ir(i,e){if(!e.anchorNode)return!1;try{return Cs(i,e.anchorNode)}catch{return!1}}function nn(i){return i.nodeType==3?ei(i,0,i.nodeValue.length).getClientRects():i.nodeType==1?i.getClientRects():[]}function Ni(i,e,t,n){return t?na(i,e,t,n,-1)||na(i,e,t,n,1):!1}function Jt(i){for(var e=0;;e++)if(i=i.previousSibling,!i)return e}function ar(i){return i.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(i.nodeName)}function na(i,e,t,n,r){for(;;){if(i==t&&e==n)return!0;if(e==(r<0?0:lt(i))){if(i.nodeName=="DIV")return!1;let s=i.parentNode;if(!s||s.nodeType!=1)return!1;e=Jt(i)+(r<0?0:1),i=s}else if(i.nodeType==1){if(i=i.childNodes[e+(r<0?-1:0)],i.nodeType==1&&i.contentEditable=="false")return!1;e=r<0?lt(i):0}else return!1}}function lt(i){return i.nodeType==3?i.nodeValue.length:i.childNodes.length}function Pr(i,e){let t=e?i.left:i.right;return{left:t,right:t,top:i.top,bottom:i.bottom}}function cp(i){let e=i.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:i.innerWidth,top:0,bottom:i.innerHeight}}function Ya(i,e){let t=e.width/i.offsetWidth,n=e.height/i.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-i.offsetWidth)<1)&&(t=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.height-i.offsetHeight)<1)&&(n=1),{scaleX:t,scaleY:n}}function fp(i,e,t,n,r,s,o,O){let l=i.ownerDocument,a=l.defaultView||window;for(let h=i,c=!1;h&&!c;)if(h.nodeType==1){let f,d=h==l.body,p=1,m=1;if(d)f=cp(a);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(c=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let Q=h.getBoundingClientRect();({scaleX:p,scaleY:m}=Ya(h,Q)),f={left:Q.left,right:Q.left+h.clientWidth*p,top:Q.top,bottom:Q.top+h.clientHeight*m}}let g=0,$=0;if(r=="nearest")e.top<f.top?($=-(f.top-e.top+o),t>0&&e.bottom>f.bottom+$&&($=e.bottom-f.bottom+$+o)):e.bottom>f.bottom&&($=e.bottom-f.bottom+o,t<0&&e.top-$<f.top&&($=-(f.top+$-e.top+o)));else{let Q=e.bottom-e.top,b=f.bottom-f.top;$=(r=="center"&&Q<=b?e.top+Q/2-b/2:r=="start"||r=="center"&&t<0?e.top-o:e.bottom-b+o)-f.top}if(n=="nearest"?e.left<f.left?(g=-(f.left-e.left+s),t>0&&
`,r=i.state.doc.line(r.number+(t?1:-1)),s=i.bidiSpans(r),a=i.visualLineSide(r,!t)}if(l){if(!l(h))return O}else{if(!n)return a;l=n(h)}O=a}}function Lp(i,e,t){let n=i.state.charCategorizer(e),r=n(t);return s=>{let o=n(s);return r==Ye.Space&&(r=o),r==o}}function Gp(i,e,t,n){let r=e.head,s=t?1:-1;if(r==(t?i.state.doc.length:0))return S.cursor(r,e.assoc);let o=e.goalColumn,O,l=i.contentDOM.getBoundingClientRect(),a=i.coordsAtPos(r,e.assoc||-1),h=i.documentTop;if(a)o==null&&(o=a.left-l.left),O=s<0?a.top:a.bottom;else{let d=i.viewState.lineBlockAt(r);o==null&&(o=Math.min(l.right-l.left,i.defaultCharacterWidth*(r-d.from))),O=(s<0?d.top:d.bottom)+h}let c=l.left+o,f=n??i.viewState.heightOracle.textHeight>>1;for(let d=0;;d+=10){let p=O+(f+d)*s,m=Sh(i,{x:c,y:p},!1,s);if(p<l.top||p>l.bottom||(s<0?m<r:m>r)){let g=i.docView.coordsForChar(m),$=!g||p<g.top?-1:1;return S.cursor(m,$,void 0,o)}}}function rr(i,e,t){for(;;){let n=0;for(let r of i)r.between(e-1,e+1,(s,o,O)=>{if(e>s&&e<o){let l=n||t||(e-s<o-e?-1:1);e=l<0?s:o,n=l}});if(!n)return e}}function Ws(i,e,t){let n=rr(i.state.facet(ko).map(r=>r(i)),t.from,e.head>t.from?-1:1);return n==t.from?t:S.cursor(n,n<t.from?1:-1)}var Bi="\uFFFF",Ns=class{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(D.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Bi}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let r=e;;){this.findPointBefore(n,r);let s=this.text.length;this.readNode(r);let o=r.nextSibling;if(o==t)break;let O=K.get(r),l=K.get(o);(O&&l?O.breakAfter:(O?O.breakAfter:ar(r))||ar(o)&&(r.nodeName!="BR"||r.cmIgnore)&&this.text.length>s)&&this.lineBreak(),r=o}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,O;if(this.lineSeparator?(s=t.indexOf(this.lineSeparator,n),o=this.lineSeparator.length):(O=r.exec(t))&&(s=O.index,o=O[0].length),this.append(t.slice(n,s<0?t.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let l of this.points)l.node==e&&l.pos>this.text.length&&(l.pos-=o-1);n=s+o}}readNode(e){if(e.cmIgnore)return;let t=K.get(e),n=t&&t.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let r=n.iter();!r.next().done;)r.lineBreak?this.lineBreak():this.append(r.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 n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(e.nodeType==3?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(Bp(e,n.node,n.offset)?t:0))}};function Bp(i,e,t){for(;;){if(!e||t<lt(e))return!1;if(e==i)return!0;t=Jt(e)+1,e=e.parentNode}}var pr=class{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}},Hs=class{constructor(e,t,n,r){this.typeOver=r,this.bounds=null,this.text="",this.domChanged=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,n,0))){let O=s||o?[]:Np(e),l=new Ns(O,e.state);l.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=l.text,this.newSel=Hp(O,this.bounds.from)}else{let O=e.observer.selectionRange,l=s&&s.node==O.focusNode&&s.offset==O.focusOffset||!Cs(e.contentDOM,O.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(O.focusNode,O.focusOffset),a=o&&o.node==O.anchorNode&&o.offset==O.anchorOffset||!Cs(e.contentDOM,O.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(O.anchorNode,O.anchorOffset),h=e.viewport;if((z.ios||z.chrome)&&e.state.selection.main.empty&&l!=a&&(h.from>0||h.to<e.state.doc.length)){let c=Math.min(l,a),f=Math.max(l,a),d=h.from-c,p=h.to-f;(d==0||d==1||c==0)&&(p==0||p==-1||f==e.state.doc.length)&&(l=0,a=e.state.doc.length)}this.newSel=S.single(a,l)}}};function yh(i,e){let t,{newSel:n}=e,r=i.state.selection.main,s=i.inputState.lastKeyTime>Date.now()-100?i.inputState.lastKeyCode:-1;if(e.bounds){l
`&&i.lineWrapping&&(n&&(n=S.single(n.main.anchor-1,n.main.head-1)),t={from:r.from,to:r.to,insert:U.of([" "])}),t)return wo(i,t,n,s);if(n&&!n.main.eq(r)){let o=!1,O="select";return i.inputState.lastSelectionTime>Date.now()-50&&(i.inputState.lastSelectionOrigin=="select"&&(o=!0),O=i.inputState.lastSelectionOrigin),i.dispatch({selection:n,scrollIntoView:o,userEvent:O}),!0}else return!1}function wo(i,e,t,n=-1){if(z.ios&&i.inputState.flushIOSKey(e))return!0;let r=i.state.selection.main;if(z.android&&(e.to==r.to&&(e.from==r.from||e.from==r.from-1&&i.state.sliceDoc(e.from,r.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Pi(i.contentDOM,"Enter",13)||(e.from==r.from-1&&e.to==r.to&&e.insert.length==0||n==8&&e.insert.length<e.to-e.from&&e.to>r.head)&&Pi(i.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&e.insert.length==0&&Pi(i.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();i.inputState.composing>=0&&i.inputState.composing++;let o,O=()=>o||(o=Dp(i,e,t));return i.state.facet(lh).some(l=>l(i,e.from,e.to,s,O))||i.dispatch(O()),!0}function Dp(i,e,t){let n,r=i.state,s=r.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)&&i.inputState.composing<0){let O=s.from<e.from?r.sliceDoc(s.from,e.from):"",l=s.to>e.to?r.sliceDoc(e.to,s.to):"";n=r.replaceSelection(i.state.toText(O+e.insert.sliceString(0,void 0,i.state.lineBreak)+l))}else{let O=r.changes(e),l=t&&t.main.to<=O.newLength?t.main:void 0;if(r.selection.ranges.length>1&&i.inputState.composing>=0&&e.to<=s.to&&e.to>=s.to-10){let a=i.state.sliceDoc(e.from,e.to),h,c=t&&Qh(i,t.main.head);if(c){let p=e.insert.length-(e.to-e.from);h={from:c.from,to:c.to-p}}else h=i.state.doc.lineAt(s.head);let f=s.to-e.to,d=s.to-s.from;n=r.changeByRange(p=>{if(p.from==s.from&&p.to==s.to)return{changes:O,range:l||p.map(O)};let m=p.to-f,g=m-a.length;if(p.to-p.from!=d||i.state.sliceDoc(g,m)!=a||p.to>=h.from&&p.from<=h.to)return{range:p};let $=r.changes({from:g,to:m,insert:e.insert}),Q=p.to-s.to;return{changes:$,range:l?S.range(Math.max(0,l.anchor+Q),Math.max(0,l.head+Q)):p.map($)}})}else n={changes:O,selection:l&&r.selection.replaceRange(l)}}let o="input.type";return(i.composing||i.inputState.compositionPendingChange&&i.inputState.compositionEndedAt>Date.now()-50)&&(i.inputState.compositionPendingChange=!1,o+=".compose",i.inputState.compositionFirstChange&&(o+=".start",i.inputState.compositionFirstChange=!1)),r.update(n,{userEvent:o,scrollIntoView:!0})}function Ip(i,e,t,n){let r=Math.min(i.length,e.length),s=0;for(;s<r&&i.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==r&&i.length==e.length)return null;let o=i.length,O=e.length;for(;o>0&&O>0&&i.charCodeAt(o-1)==e.charCodeAt(O-1);)o--,O--;if(n=="end"){let l=Math.max(0,s-Math.min(o,O));t-=o+l-s}if(o<s&&i.length<e.length){let l=t<=s&&t>=o?s-t:0;s-=l,O=s+(O-o),o=s}else if(O<s){let l=t<=s&&t>=O?s-t:0;s-=l,o=s+(o-O),O=s}return{from:s,toA:o,toB:O}}function Np(i){let e=[];if(i.root.activeElement!=i.contentDOM)return e;let{anchorNode:t,anchorOffset:n,focusNode:r,focusOffset:s}=i.observer.selectionRange;return t&&(e.push(new pr(t,n)),(r!=t||s!=n)&&e.push(new pr(r,s))),e}function Hp(i,e){if(i.length==0)return null;let t=i[0].pos,n=i.length==2?i[1].pos:t;return t>-1&&n>-1?S.single(t+e,n+e):null}var Fs=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,z.safari&&e.contentDOM.addEventListener("input",()=>null),z.gecko&&cm(e.contentDOM.ownerDocument)}handl
`))};if(a.from==this.from&&s<this.from?a.from=s:a.to==this.to&&s>this.to&&(a.to=s),a.from==a.to&&!a.insert.length){let h=S.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));h.main.eq(r)||e.dispatch({selection:h,userEvent:"select"});return}if((z.mac||z.android)&&a.from==o-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(a={from:O,to:l,insert:U.of([n.text.replace("."," ")])}),this.pendingContextChange=a,!e.state.readOnly){let h=this.to-this.from+(a.to-a.from+a.insert.length);wo(e,a,S.single(this.toEditorPos(n.selectionStart,h),this.toEditorPos(n.selectionEnd,h)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state))},this.handlers.characterboundsupdate=n=>{let r=[],s=null;for(let o=this.toEditorPos(n.rangeStart),O=this.toEditorPos(n.rangeEnd);o<O;o++){let l=e.coordsForChar(o);s=l&&new DOMRect(l.left,l.top,l.right-l.left,l.bottom-l.top)||s||new DOMRect,r.push(s)}t.updateCharacterBounds(n.rangeStart,r)},this.handlers.textformatupdate=n=>{let r=[];for(let s of n.getTextFormats()){let o=s.underlineStyle,O=s.underlineThickness;if(o!="None"&&O!="None"){let l=this.toEditorPos(s.rangeStart),a=this.toEditorPos(s.rangeEnd);if(l<a){let h=`text-decoration: underline ${o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${O=="Thin"?1:2}px`;r.push(_.mark({attributes:{style:h}}).range(l,a))}}}e.dispatch({effects:uh.of(_.set(r))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:n}=this.composing;this.composing=null,n&&this.reset(e.state)}};for(let n in this.handlers)t.addEventListener(n,this.handlers[n]);this.measureReq={read:n=>{this.editContext.updateControlBounds(n.contentDOM.getBoundingClientRect());let r=tn(n.root);r&&r.rangeCount&&this.editContext.updateSelectionBounds(r.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,r=this.pendingContextChange;return e.changes.iterChanges((s,o,O,l,a)=>{if(n)return;let h=a.length-(o-s);if(r&&o>=r.to)if(r.from==s&&r.to==o&&r.insert.eq(a)){r=this.pendingContextChange=null,t+=h,this.to+=h;return}else r=null,this.revertPending(e.state);if(s+=t,o+=t,o<=this.from)this.from+=h,this.to+=h;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+a.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),a.toString()),this.to+=h}t+=h}),r&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(r=>!r.isUserEvent("input.type")&&r.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&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)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),r=this.toContextPos(t.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(n,r)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this
`&&(t="");else{let n=t.indexOf(`
`);n>-1&&(t=t.slice(0,n))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),n=e+t.length;for(let r=this.rangeIndex;;){let s=this.ranges[r].to;if(s>=n||(t=t.slice(0,s-(n-t.length)),r++,r==this.ranges.length))break;let o=this.ranges[r].from,O=this.lineAfter(o);t+=O,n=o+O.length}return{line:t,end:n}}skipGapsTo(e,t,n){for(;;){let r=this.ranges[this.rangeIndex].to,s=e+t;if(n>0?r>s:r>=s)break;let o=this.ranges[++this.rangeIndex].from;t+=o-r}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,t,n,r){let s=4;if(this.ranges.length>1){r=this.skipGapsTo(t,r,1),t+=r;let O=this.chunk.length;r=this.skipGapsTo(n,r,-1),n+=r,s+=this.chunk.length-O}let o=this.chunk.length-4;return s==4&&o>=0&&this.chunk[o]==e&&this.chunk[o+2]==t?this.chunk[o+2]=n:this.chunk.push(e,t,n,s),r}parseLine(e){let{line:t,end:n}=this.nextLine(),r=0,{streamParser:s}=this.lang,o=new qr(t,e?e.state.tabSize:4,e?At(e.state):2);if(o.eol())s.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let O=Qc(s.token,o,this.state);if(O&&(r=this.emitToken(this.lang.tokenTable.resolve(O),this.parsedPos+o.start,this.parsedPos+o.pos,r)),o.start>1e4)break}this.parsedPos=n,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=V.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:zg,topID:0,maxBufferLength:2048,reused:this.chunkReused});e=new V(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new V(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}};function Qc(i,e,t){e.start=e.pos;for(let n=0;n<10;n++){let r=i(e,t);if(e.pos>e.start)return r}throw new Error("Stream parser failed to advance stream.")}var rO=Object.create(null),mn=[ie.none],zg=new St(mn),oc=[],Oc=Object.create(null),Sc=Object.create(null);for(let[i,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"]])Sc[i]=yc(rO,e);var Cr=class{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),Sc)}resolve(e){return e?this.table[e]||(this.table[e]=yc(this.extra,e)):0}},Xg=new Cr(rO);function Do(i,e){oc.indexOf(i)>-1||(oc.push(i),console.warn(e))}function yc(i,e){let t=[];for(let O of e.split(" ")){let l=[];for(let a of O.split(".")){let h=i[a]||u[a];h?typeof h=="function"?l.length?l=l.map(h):Do(a,`Modifier ${a} used at start of tag`):l.length?Do(a,`Tag ${a} used as modifier`):l=Array.isArray(h)?h:[h]:Do(a,`Unknown highlighting tag ${a}`)}for(let a of l)t.push(a)}if(!t.length)return 0;let n=e.replace(/ /g,"_"),r=n+" "+t.map(O=>O.id),s=Oc[r];if(s)return s.id;let o=Oc[r]=ie.define({id:mn.length,name:n,props:[se({[n]:t})]});return mn.push(o),o.id}function Rg(i,e){let t=ie.define({id:mn.length,name:"Document",props:[bt.add(()=>i),de.add(()=>n=>e.getIndent(n))],top:!0});return mn.push(t),t}var hb={rtl:_.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"rtl"},bidiIsolate:ee.RTL}),ltr:_.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"ltr"},bidiIsolate:ee.LTR}),auto:_.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"auto"},bidiIsolate:null})};var Zg=i=>{let{state:e}=i,t=e.doc.lineAt(e.selection.main.from),n=cO(i.state,t.from);return n.line?Wg(i):n.block?Vg(i):!1};function hO(i,e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=i(e,t);return r?(n(t.update(r)),!0):!1}}var Wg=hO(Ag,0);var qg=hO(Xc,0);var Vg=hO((i,e)=>Xc(i,e,Ug(e)),0);function cO(i,e){let t=i.languageDataAt("commentTokens",e);return t.length?t[0]:{}}var Qn=50;function Cg(i,{open:e,close:t},n,r){let s=i.sliceDoc(n-Qn,n),o=i.sliceDoc
\${}
} catch (\${error}) {
\${}
}`,{label:"try",detail:"/ catch block",type:"keyword"}),be("if (${}) {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),be(`if (\${}) {
\${}
} else {
\${}
}`,{label:"if",detail:"/ else block",type:"keyword"}),be(`class \${name} {
constructor(\${params}) {
\${}
}
}`,{label:"class",detail:"definition",type:"keyword"}),be('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),be('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],$S=Ff.concat([be("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),be("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),be("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),If=new ki,Kf=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function wn(i){return(e,t)=>{let n=e.node.getChild("VariableDefinition");return n&&t(n,i),!0}}var QS=["FunctionDeclaration"],SS={FunctionDeclaration:wn("function"),ClassDeclaration:wn("class"),ClassExpression:()=>!0,EnumDeclaration:wn("constant"),TypeAliasDeclaration:wn("type"),NamespaceDeclaration:wn("namespace"),VariableDefinition(i,e){i.matchContext(QS)||e(i,"variable")},TypeDefinition(i,e){e(i,"type")},__proto__:null};function Jf(i,e){let t=If.get(e);if(t)return t;let n=[],r=!0;function s(o,O){let l=i.sliceString(o.from,o.to);n.push({label:l,type:O})}return e.cursor(E.IncludeAnonymous).iterate(o=>{if(r)r=!1;else if(o.name){let O=SS[o.name];if(O&&O(o,s)||Kf.has(o.name))return!1}else if(o.to-o.from>8192){for(let O of Jf(i,o.node))n.push(O);return!1}}),If.set(e,n),n}var Nf=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,eu=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function yS(i){let e=L(i.state).resolveInner(i.pos,-1);if(eu.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&Nf.test(i.state.sliceDoc(e.from,e.to));if(!t&&!i.explicit)return null;let n=[];for(let r=e;r;r=r.parent)Kf.has(r.name)&&(n=n.concat(Jf(i.state.doc,r)));return{options:n,from:t?e.from:i.pos,validFor:Nf}}var et=ue.define({name:"javascript",parser:jf.configure({props:[de.add({IfStatement:qe({except:/^\s*({|else\b)/}),TryStatement:qe({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:cc,SwitchBody:i=>{let e=i.textAfter,t=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return i.baseIndent+(t?0:n?1:2)*i.unit},Block:Ar({closing:"}"}),ArrowFunction:i=>i.baseIndent+i.unit,"TemplateString BlockComment":()=>null,"Statement Property":qe({except:/^{/}),JSXElement(i){let e=/^\s*<\//.test(i.textAfter);return i.lineIndent(i.node.from)+(e?0:i.unit)},JSXEscape(i){let e=/\s*\}/.test(i.textAfter);return i.lineIndent(i.node.from)+(e?0:i.unit)},"JSXOpenTag JSXSelfClosingTag"(i){return i.column(i.node.from)+i.unit}}),Pe.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":_t,BlockComment(i){return{from:i.from+2,to:i.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),tu={test:i=>/^JSX/.test(i.name),facet:zi({commentTokens:{block:{open:"{/*",close:"*/}"}}})},CO=et.configure({dialect:"ts"},"typescript"),UO=et.configure({dialect:"jsx",props:[Ur.add(i=>i.isTop?[tu]:void 0)]}),AO=et.configure({dialect:"jsx ts",props:[Ur.add(i=>i.isTop?[tu]:void 0)]},"typescript"),iu=i=>({label:i,type:"keyword"}),nu="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(iu),PS=nu.concat(["declare","implements","private","protected","public"].map(iu));function li(i={}){let e=i.jsx?i.typescript?AO:UO:i.typescript?CO:et,t=i.typescript?$S.concat(PS):Ff.concat(nu);return new oe(e,[et.data.of({autocomplete:Gf(eu,Lf(t))}),et.data.of({autocomplete:yS}),i.jsx?kS:[]])}function bS(i){for(;;){if(i.name=="JSXOpenTag"||i.name=="JSXSelfClosingTag"||i.name=="JSXFragmentTag")return i;if(i.name=="JSXEscape"||!i.parent)return null;i=i
`+t.scrub(),s=this.advance(r);return s>-1&&s<r.length?this.complete(e,n,s):!1}finish(e,t){return(this.stage==2||this.stage==3)&&zn(t.content,this.pos)==t.content.length?this.complete(e,t,t.content.length):!1}complete(e,t,n){return e.addLeafElement(t,Y(P.LinkReference,this.start,this.start+n,this.elts)),!0}nextStage(e){return e?(this.pos=e.to-this.start,this.elts.push(e),this.stage++,!0):(e===!1&&(this.stage=-1),!1)}advance(e){for(;;){if(this.stage==-1)return-1;if(this.stage==0){if(!this.nextStage(ld(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(Y(P.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(od(e,zn(e,this.pos),this.start)))return-1}else if(this.stage==2){let t=zn(e,this.pos),n=0;if(t>this.pos){let r=Od(e,t,this.start);if(r){let s=HO(e,r.to-this.start);s>0&&(this.nextStage(r),n=s)}}return n||(n=HO(e,this.pos)),n>0&&n<e.length?n:-1}else return HO(e,this.pos)}}};function HO(i,e){for(;e<i.length;e++){let t=i.charCodeAt(e);if(t==10)break;if(!De(t))return-1}return e}var nl=class{nextLine(e,t,n){let r=t.depth<e.stack.length?-1:Fu(t),s=t.next;if(r<0)return!1;let o=Y(P.HeaderMark,e.lineStart+t.pos,e.lineStart+r);return e.nextLine(),e.addLeafElement(n,Y(s==61?P.SetextHeading1:P.SetextHeading2,n.start,e.prevLineEnd(),[...e.parser.parseInline(n.content,n.start),o])),!0}finish(){return!1}},td={LinkReference(i,e){return e.content.charCodeAt(0)==91?new il(e):null},SetextHeading(){return new nl}},py=[(i,e)=>Hu(e)>=0,(i,e)=>Du(e)>=0,(i,e)=>Iu(e)>=0,(i,e)=>fl(e,i,!0)>=0,(i,e)=>ul(e,i,!0)>=0,(i,e)=>cl(e,i,!0)>=0,(i,e)=>ed(e,i,!0)>=0],my={text:"",end:0},rl=class{constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.line=new JO,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=r[r.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=r[0].from,this.block=is.create(P.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=n.length?new al(n,t):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:e}=this;for(;;){for(let n=0;;){let r=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;n<e.markers.length&&(!r||e.markers[n].from<r.end);){let s=e.markers[n++];this.addNode(s.type,s.from,s.to)}if(!r)break;this.finishContext()}if(e.pos<e.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(e.basePos))return null;e:for(;;){for(let n of this.parser.blockParsers)if(n){let r=n(this,e);if(r!=!1){if(r==!0)return null;e.forward();continue e}}break}let t=new KO(this.lineStart+e.pos,e.text.slice(e.pos));for(let n of this.parser.leafBlockParsers)if(n){let r=n(this,t);r&&t.parsers.push(r)}e:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let n of this.parser.endLeafBlock)if(n(this,e,t))break e}for(let n of t.parsers)if(n.nextLine(this,e,t))return null;t.content+=`
`+e.scrub();for(let n of e.markers)t.marks.push(n)}return this.finishLeaf(t),null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}reuseFragment(e){if(!this.fragments.moveTo(this.absoluteLineStart+e,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let t=this.fragments.takeNodes(this);return t?(this.absoluteLineStart+=t,this.lineStart=ad(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(e=this.depth-1){return this.parser.nodeSet.types[this.stack[e].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}peekLine(){return this.scanLine(this.absoluteLineEnd+1).text}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(e){let t=my;if(t.end=e,e>=this.to)t.text="";else if(t.text=this.lineChunkAt(e),t.end+=t.text.length,this.ranges.length>1){let n=this.absoluteLineStart,r=this.rangeI;for(;this.ranges[r].to<t.end;){r++;let s=this.ranges[r].from,o=this.lineChunkAt(s);t.end=s+o.length,t.text=t.text.slice(0,this.ranges[r-1].to-n)+o,n=t.end-t.text.length}}return t}readLine(){let{line:e}=this,{text:t,end:n}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=n,e.reset(t);e.depth<this.stack.length;e.depth++){let r=this.stack[e.depth],s=this.parser.skipContextMarkup[r.type];if(!s)throw new Error("Unhandled block context "+P[r.type]);if(!s(r,this,e))break;e.forward()}}lineChunkAt(e){let t=this.input.chunk(e),n;if(this.input.lineChunks)n=t==`
`?"":t;else{let r=t.indexOf(`
`);n=r<0?t:t.slice(0,r)}return e+n.length>this.to?n.slice(0,this.to-e):n}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,t,n=0){this.block=is.create(e,n,this.lineStart+t,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,t,n=0){this.startContext(this.parser.getNodeType(e),t,n)}addNode(e,t,n){typeof e=="number"&&(e=new V(this.parser.nodeSet.types[e],Ui,Ui,(n??this.prevLineEnd())-t)),this.block.addChild(e,t-this.block.from)}addElement(e){this.block.addChild(e.toTree(this.parser.nodeSet),e.from-this.block.from)}addLeafElement(e,t){this.addNode(this.buffer.writeElements(ll(t.children,e.marks),-t.from).finish(t.type,t.to-t.from),t.from)}finishContext(){let e=this.stack.pop(),t=this.stack[this.stack.length-1];t.addChild(e.toTree(this.parser.nodeSet),e.from-t.from),this.block=t}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(e){return this.ranges.length>1?id(this.ranges,0,e.topNode,this.ranges[0].from,this.reusePlaceholders):e}finishLeaf(e){for(let n of e.parsers)if(n.finish(this,e))return;let t=ll(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(t,-e.start).finish(P.Paragraph,e.content.length),e.start)}elt(e,t,n,r){return typeof e=="string"?Y(this.parser.getNodeType(e),t,n,r):new rs(e,t)}get buffer(){return new ns(this.parser.nodeSet)}};function id(i,e,t,n,r){let s=i[e].to,o=[],O=[],l=t.from+n;function a(h,c){for(;c?h>=s:h>s;){let f=i[e+1].from-s;n+=f,h+=f,e++,s=i[e].to}}for(let h=t.firstChild;h;h=h.nextSibling){a(h.from+n,!0);let c=h.from+n,f,d=r.get(h.tree);d?f=d:h.to+n>s?(f=id(i,e,h,n,r),a(h.to+n,!1)):f=h.toTree(),o.push(f),O.push(c-l)}return a(t.to+n,!1),new V(t.type,o,O,t.to+n-l,t.tree?t.tree.propValues:void 0)}var Rn=class i extends Pt{constructor(e,t,n,r,s,o,O,l,a){super(),this.nodeSet=e,this.blockParsers=t,this.leafBlockParsers=n,this.blockNames=r,this.endLeafBlock=s,this.skipContextMarkup=o,this.inlineParsers=O,this.inlineNames=l,this.wrappers=a,this.nodeTypes=Object.create(null);for(let h of e.types)this.nodeTypes[h.name]=h.id}createParse(e,t,n){let r=new rl(this,e,t,n);for(let s of this.wrappers)r=s(r,e,t,n);return r}configure(e){let t=sl(e);if(!t)return this;let{nodeSet:n,skipContextMarkup:r}=this,s=this.blockParsers.slice(),o=this.leafBlockParsers.slice(),O=this.blockNames.slice(),l=this.inlineParsers.slice(),a=this.inlineNames.slice(),h=this.endLeafBlock.slice(),c=this.wrappers;if(Tn(t.defineNodes)){r=Object.assign({},r);let f=n.types.slice(),d;for(let p of t.defineNodes){let{name:m,block:g,composite:$,style:Q}=typeof p=="string"?{name:p}:p;if(f.some(y=>y.name==m))continue;$&&(r[f.length]=(y,T,w)=>$(T,w,y.value));let b=f.length,k=$?["Block","BlockContext"]:g?b>=P.ATXHeading1&&b<=P.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;f.push(ie.define({id:b,name:m,props:k&&[[W.group,k]]})),Q&&(d||(d={}),Array.isArray(Q)||Q instanceof We?d[m]=Q:Object.assign(d,Q))}n=new St(f),d&&(n=n.extend(se(d)))}if(Tn(t.props)&&(n=n.extend(...t.props)),Tn(t.remove))for(let f of t.remove){let d=this.blockNames.indexOf(f),p=this.inlineNames.indexOf(f);d>-1&&(s[d]=o[d]=void 0),p>-1&&(l[p]=void 0)}if(Tn(t.parseBlock))for(let f of t.parseBlock){let d=O.indexOf(f.name);if(d>-1)s[d]=f.parse,o[d]=f.leaf;else{let p=f.before?ts(O,f.before):f.after?ts(O,f.after)+1:O.length-1;s.splice(p,0,f.parse),o.splice(p,0,f.leaf),O.splice(p,0,f.name)}f.endLeaf&&h.push(f.endLeaf)}if(Tn(t.parseInline))for(let f of t.parseInline){let d=a.indexOf(f.name);if(d>-1)l[d]=f.parse;else{let p=f.before?ts(a,f.before):f.after?ts(a,f.after)+1:a.length-1;l.splice(p,0,f.parse),a.splice(p,0,f.name)}}return t.wrap&&(c=c.concat(t.wrap)),new i(n,s,o,O,h,r,l,a,c)}getNodeType(e){let t=this.nodeTypes[e];if(t==null)throw new RangeError(`Unknown node type '${e}'`);return t}parseInline(e,t){let n=new Ol(this,e,t);e:for(let r=t;r<n.end;){let s=n.char(r);for(let o of this.inlineParsers)if(o){let O=o(n,s,r);if(O>=0){r=O;continue e}}r++}return n.resol
`;)s--;this.fragmentEnd=s?s-1:0}let n=this.cursor;n||(n=this.cursor=this.fragment.tree.cursor(),n.firstChild());let r=e+this.fragment.offset;for(;n.to<=r;)if(!n.parent())return!1;for(;;){if(n.from>=r)return this.fragment.from<=t;if(!n.childAfter(r))return!1}}matches(e){let t=this.cursor.tree;return t&&t.prop(W.contextHash)==e}takeNodes(e){let t=this.cursor,n=this.fragment.offset,r=this.fragmentEnd-(this.fragment.openEnd?1:0),s=e.absoluteLineStart,o=s,O=e.block.children.length,l=o,a=O;for(;;){if(t.to-n>r){if(t.type.isAnonymous&&t.firstChild())continue;break}let h=ad(t.from-n,e.ranges);if(t.to-n<=e.ranges[e.rangeI].to)e.addNode(t.tree,h);else{let c=new V(e.parser.nodeSet.types[P.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(c,t.tree),e.addNode(c,h)}if(t.type.is("Block")&&($y.indexOf(t.type.id)<0?(o=t.to-n,O=e.block.children.length):(o=l,O=a,l=t.to-n,a=e.block.children.length)),!t.nextSibling())break}for(;e.block.children.length>O;)e.block.children.pop(),e.block.positions.pop();return o-s}};function ad(i,e){let t=i;for(let n=1;n<e.length;n++){let r=e[n-1].to,s=e[n].from;r<i&&(t-=s-r)}return t}var Qy=se({"Blockquote/...":u.quote,HorizontalRule:u.contentSeparator,"ATXHeading1/... SetextHeading1/...":u.heading1,"ATXHeading2/... SetextHeading2/...":u.heading2,"ATXHeading3/...":u.heading3,"ATXHeading4/...":u.heading4,"ATXHeading5/...":u.heading5,"ATXHeading6/...":u.heading6,"Comment CommentBlock":u.comment,Escape:u.escape,Entity:u.character,"Emphasis/...":u.emphasis,"StrongEmphasis/...":u.strong,"Link/... Image/...":u.link,"OrderedList/... BulletList/...":u.list,"BlockQuote/...":u.quote,"InlineCode CodeText":u.monospace,"URL Autolink":u.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":u.processingInstruction,"CodeInfo LinkLabel":u.labelName,LinkTitle:u.string,Paragraph:u.content}),hd=new Rn(new St(nd).extend(Qy),Object.keys(es).map(i=>es[i]),Object.keys(es).map(i=>td[i]),Object.keys(es),py,Bu,Object.keys(FO).map(i=>FO[i]),Object.keys(FO),[]);function Sy(i,e,t){let n=[];for(let r=i.firstChild,s=e;;r=r.nextSibling){let o=r?r.from:t;if(o>s&&n.push({from:s,to:o}),!r)break;s=r.to}return n}function cd(i){let{codeParser:e,htmlParser:t}=i;return{wrap:wi((r,s)=>{let o=r.type.id;if(e&&(o==P.CodeBlock||o==P.FencedCode)){let O="";if(o==P.FencedCode){let a=r.node.getChild(P.CodeInfo);a&&(O=s.read(a.from,a.to))}let l=e(O);if(l)return{parser:l,overlay:a=>a.type.id==P.CodeText}}else if(t&&(o==P.HTMLBlock||o==P.HTMLTag))return{parser:t,overlay:Sy(r.node,r.from,r.to)};return null})}}var yy={resolve:"Strikethrough",mark:"StrikethroughMark"},Py={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":u.strikethrough}},{name:"StrikethroughMark",style:u.processingInstruction}],parseInline:[{name:"Strikethrough",parse(i,e,t){if(e!=126||i.char(t+1)!=126||i.char(t+2)==126)return-1;let n=i.slice(t-1,t),r=i.slice(t+2,t+3),s=/\s|^$/.test(n),o=/\s|^$/.test(r),O=Zn.test(n),l=Zn.test(r);return i.addDelimiter(yy,t,t+2,!o&&(!l||s||O),!s&&(!O||o||l))},after:"Emphasis"}]};function Xn(i,e,t=0,n,r=0){let s=0,o=!0,O=-1,l=-1,a=!1,h=()=>{n.push(i.elt("TableCell",r+O,r+l,i.parser.parseInline(e.slice(O,l),r+O)))};for(let c=t;c<e.length;c++){let f=e.charCodeAt(c);f==124&&!a?((!o||O>-1)&&s++,o=!1,n&&(O>-1&&h(),n.push(i.elt("TableDelimiter",c+r,c+r+1))),O=l=-1):(a||f!=32&&f!=9)&&(O<0&&(O=c),l=c+1),a=!a&&f==92}return O>-1&&(s++,n&&h()),s}function Yu(i,e){for(let t=e;t<i.length;t++){let n=i.charCodeAt(t);if(n==124)return!0;n==92&&t++}return!1}var fd=/^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/,ss=class{constructor(){this.rows=null}nextLine(e,t,n){if(this.rows==null){this.rows=!1;let r;if((t.next==45||t.next==58||t.next==124)&&fd.test(r=t.text.slice(t.pos))){let s=[];Xn(e,n.content,0,s,n.start)==Xn(e,r,t.pos)&&(this.rows=[e.elt("TableHeader",n.start,n.start+n.content.length,s),e.elt("TableDelimiter",e.lineStart+t.pos,e.lineStart+t.text.length)])}}else if(this.rows){let r=[];Xn(e,t.text,t.pos,r,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+t.pos,e.lineStart+t.text.length,r))}return!1}finish(e,t){return this.rows?(e.addLea
`);let t=i.textContent.trimEnd(),n="";e!==null&&(n=e.className.replace("language-",""));let r=document.createElement("div");i.parentNode.insertBefore(r,i);let s=qP(i);s&&r.setAttribute("dir",s);let o=Ai("content-code-block",{parent:r,doc:t,extensions:mO(r)});new Gt(o).setMode(n,t),i.remove(),WP(o)}function wx(i){let e=i.querySelectorAll("pre");for(let t of e)Dd(t)}function vx(){let i=document.querySelectorAll(".page-content pre, .comment-box .content pre");for(let e of i)Dd(e)}function Tx(i,e,t,n){let r=Ai("content-code-block",{parent:i,doc:t,extensions:mO(i),root:e}),s=new Gt(r);return s.setMode(n,t),s}function zx(i,e){let t=i.textContent,n={parent:i.parentElement,doc:t,extensions:[...Br(i.parentElement)]},r=new Gt(Ai("code-editor",n));return r.setMode(e,t),i.style.display="none",r}function Xx(i,e){let t=i.value,n={parent:i.parentElement,doc:t,extensions:[...Br(i.parentElement),v.updateListener.of(o=>{o.docChanged&&(i.value=o.state.doc.toString())})]},r=Ai("code-input",n),s=new Gt(r);return s.setMode(e,t),i.style.display="none",s}function Rx(i,e,t,n){let r=i.textContent,s={parent:i.parentElement,doc:r,extensions:[ht.of(n),...Br(i.parentElement),v.updateListener.of(O=>{e(O)}),v.domEventHandlers(t)]};window.$events.emitPublic(i,"editor-markdown-cm6::pre-init",{editorViewConfig:s});let o=Ai("markdown-editor",s);return new Gt(o).setMode("markdown",""),i.style.display="none",o}export{vx as highlight,wx as highlightWithin,Xx as inlineEditor,Rx as markdownEditor,zx as popupEditor,Tx as wysiwygView};
//# sourceMappingURL=code.js.map