varq=classi{lineAt(e){if(e<0||e>this.length)thrownewRangeError(`Invalid position ${e} in document of length ${this.length}`);returnthis.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)thrownewRangeError(`Invalid line number ${e} in ${this.lines}-line document`);returnthis.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=ci(this,e,t);letr=[];returnthis.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),oi.from(r,this.length-(t-e)+n.length)}append(e){returnthis.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=ci(this,e,t);letn=[];returnthis.decompose(e,t,n,0),oi.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;lett=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=newGt(this),s=newGt(e);for(leto=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){returnnewGt(this,e)}iterRange(e,t=this.length){returnnewRn(this,e,t)}iterLines(e,t){letn;if(e==null)n=this.iter();else{t==null&&(t=this.lines+1);letr=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))}returnnewZn(n)}toString(){returnthis.sliceString(0)}toJSON(){lete=[];returnthis.flatten(e),e}constructor(){}staticof(e){if(e.length==0)thrownewRangeError("A document must have at least one line");returne.length==1&&!e[0]?i.empty:e.length<=32?newze(e):oi.from(ze.split(e,[]))}},ze=classiextendsq{constructor(e,t=Qd(e)){super(),this.text=e,this.length=t}getlines(){returnthis.text.length}getchildren(){returnnull}lineInner(e,t,n,r){for(lets=0;;s++){leto=this.text[s],O=r+o.length;if((t?n:O)>=e)returnnewts(r,O,n,o);r=O+1,n++}}decompose(e,t,n,r){lets=e<=0&&t>=this.length?this:newi(cl(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(r&1){leto=n.pop(),O=Wn(s.text,o.text.slice(),0,s.length);if(O.length<=32)n.push(newi(O,o.length+s.length));else{letl=O.length>>1;n.push(newi(O.slice(0,l)),newi(O.slice(l)))}}elsen.push(s)}replace(e,t,n){if(!(ninstanceofi))returnsuper.replace(e,t,n);[e,t]=ci(this,e,t);letr=Wn(this.text,Wn(n.text,cl(this.text,0,e)),t),s=this.length+n.length-(t-e);returnr.length<=32?newi(r,s):oi.from(i.split(r,[]),s)}sliceString(e,t=this.length,n=`
`){[e,t]=ci(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}},oi=class i extends q{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]=ci(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>>5-1&&l.lines>a>>5+1){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]=ci(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 ze(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 ze&&l&&(p=h[h.length-1])instanceof ze&&d.lines+p.lines<=32?(l+=d.lines,a+=d.length+1,h[h.length-1]=new ze(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)}};q.empty=new ze([""],0);function Qd(i){let e=-1;for(let t of i)e+=t.length+1;return e}function Wn(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 cl(i,e,t){return Wn(i,[""],e,t)}var Gt=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 ze?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 ze?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=`
}`,{label:"class",detail:"definition",type:"keyword"}),Pe('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Pe('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],kS=wf.concat([Pe("interface ${name} {\n${}\n}",{label:"interface",detail:"definition",type:"keyword"}),Pe("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),Pe("enum ${name} {\n${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),bf=new Si,kf=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Sn(i){return(e,t)=>{let n=e.node.getChild("VariableDefinition");return n&&t(n,i),!0}}var vS=["FunctionDeclaration"],TS={FunctionDeclaration:Sn("function"),ClassDeclaration:Sn("class"),ClassExpression:()=>!0,EnumDeclaration:Sn("constant"),TypeAliasDeclaration:Sn("type"),NamespaceDeclaration:Sn("namespace"),VariableDefinition(i,e){i.matchContext(vS)||e(i,"variable")},TypeDefinition(i,e){e(i,"type")},__proto__:null};function vf(i,e){let t=bf.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(_.IncludeAnonymous).iterate(o=>{if(r)r=!1;else if(o.name){let O=TS[o.name];if(O&&O(o,s)||kf.has(o.name))return!1}else if(o.to-o.from>8192){for(let O of vf(i,o.node))n.push(O);return!1}}),bf.set(e,n),n}var Pf=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Tf=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName",".","?."];function zS(i){let e=A(i.state).resolveInner(i.pos,-1);if(Tf.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&Pf.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(vf(i.state.doc,r)));return{options:n,from:t?e.from:i.pos,validFor:Pf}}var Ke=de.define({name:"javascript",parser:pf.configure({props:[ye.add({IfStatement:Ze({except:/^\s*({|else\b)/}),TryStatement:Ze({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Ah,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:zr({closing:"}"}),ArrowFunction:i=>i.baseIndent+i.unit,"TemplateString BlockComment":()=>null,"Statement Property":Ze({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}}),be.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Zt,BlockComment(i){return{from:i.from+2,to:i.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),zf={test:i=>/^JSX/.test(i.name),facet:Pi({commentTokens:{block:{open:"{/*",close:"*/}"}}})},$O=Ke.configure({dialect:"ts"},"typescript"),SO=Ke.configure({dialect:"jsx",props:[Tr.add(i=>i.isTop?[zf]:void 0)]}),QO=Ke.configure({dialect:"jsx ts",props:[Tr.add(i=>i.isTop?[zf]:void 0)]},"typescript"),Xf=i=>({label:i,type:"keyword"}),Wf="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(Xf),XS=Wf.concat(["declare","implements","private","protected","public"].map(Xf));function ei(i={}){let e=i.jsx?i.typescript?QO:SO:i.typescript?$O:Ke,t=i.typescript?kS.concat(XS):wf.concat(Wf);return new re(e,[Ke.data.of({autocomplete:Sf(Tf,$f(t))}),Ke.data.of({autocomplete:zS}),i.jsx?ZS:[]])}function WS(i){for(;;){if(i.name=="JSXOpenTag"||i.name=="JSXSelfClosingTag"||i.name=="JSXFragmentTag")return i;if(i.name=="JSXEscape"||!i.parent)return null;i=i.parent}}function xf(i,e,t=i.length){for(let n=e?.firstChild;n;n=n.nextSiblin
`+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)&&Pn(t.content,this.pos)==t.content.length?this.complete(e,t,t.content.length):!1}complete(e,t,n){return e.addLeafElement(t,U(y.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(Cu(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(U(y.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(Yu(e,Pn(e,this.pos),this.start)))return-1}else if(this.stage==2){let t=Pn(e,this.pos),n=0;if(t>this.pos){let r=Vu(e,t,this.start);if(r){let s=RO(e,r.to-this.start);s>0&&(this.nextStage(r),n=s)}}return n||(n=RO(e,this.pos)),n>0&&n<e.length?n:-1}else return RO(e,this.pos)}}};function RO(i,e){for(;e<i.length;e++){let t=i.charCodeAt(e);if(t==10)break;if(!Me(t))return-1}return e}var _O=class{nextLine(e,t,n){let r=t.depth<e.stack.length?-1:ku(t),s=t.next;if(r<0)return!1;let o=U(y.HeaderMark,e.lineStart+t.pos,e.lineStart+r);return e.nextLine(),e.addLeafElement(n,U(s==61?y.SetextHeading1:y.SetextHeading2,n.start,e.prevLineEnd(),[...e.parser.parseInline(n.content,n.start),o])),!0}finish(){return!1}},PQ={LinkReference(i,e){return e.content.charCodeAt(0)==91?new UO(e):null},SetextHeading(){return new _O}},xQ=[(i,e)=>wu(e)>=0,(i,e)=>bu(e)>=0,(i,e)=>Pu(e)>=0,(i,e)=>BO(e,i,!0)>=0,(i,e)=>DO(e,i,!0)>=0,(i,e)=>LO(e,i,!0)>=0,(i,e)=>zu(e,i,!0)>=0],wQ={text:"",end:0},AO=class{constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.line=new VO,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=Dr.create(y.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=n.length?new MO(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(;e.depth<this.stack.length;)this.finishContext();for(let n of e.markers)this.addNode(n.type,n.from,n.to);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 YO(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=qu(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)}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=wQ;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 "+y[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==`
`);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=Dr.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 Y(this.parser.nodeSet.types[e],Xi,Xi,(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(GO(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?Xu(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=GO(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(t,-e.start).finish(y.Paragraph,e.content.length),e.start)}elt(e,t,n,r){return typeof e=="string"?U(this.parser.getNodeType(e),t,n,r):new Fr(e,t)}get buffer(){return new Nr(this.parser.nodeSet)}};function Xu(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=Xu(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 Y(t.type,o,O,t.to+n-l,t.tree?t.tree.propValues:void 0)}var wn=class i extends gt{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 AO(this,e,t,n);for(let s of this.wrappers)r=s(r,e,t,n);return r}configure(e){let t=jO(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(yn(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(x=>x.name==m))continue;$&&(r[f.length]=(x,w,Z)=>$(w,Z,x.value));let k=f.length,b=$?["Block","BlockContext"]:g?k>=y.ATXHeading1&&k<=y.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;f.push(F.define({id:k,name:m,props:b&&[[R.group,b]]})),Q&&(d||(d={}),Array.isArray(Q)||Q instanceof je?d[m]=Q:Object.assign(d,Q))}n=new pt(f),d&&(n=n.extend(ne(d)))}if(yn(t.props)&&(n=n.extend(...t.props)),yn(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(yn(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?Br(O,f.before):f.after?Br(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(yn(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?Br(a,f.before):f.after?Br(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(`Unknownnodetype'${e}'`);return t}parseInline(e,t){let n=new EO(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.resolv
`);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=e.getAttribute("dir")||i.getAttribute("dir")||"";s&&r.setAttribute("dir",s);let o=Ri("content-code-block",{parent:r,doc:t,extensions:tO(r)});new _t(o).setMode(n,t),i.remove(),Ub(o)}function xP(i){let e=i.querySelectorAll("pre");for(let t of e)Sd(t)}function wP(){let i=document.querySelectorAll(".page-content pre, .comment-box .content pre");for(let e of i)Sd(e)}function kP(i,e,t,n){let r=Ri("content-code-block",{parent:i,doc:t,extensions:tO(i),root:e}),s=new _t(r);return s.setMode(n,t),s}function vP(i,e){let t=i.textContent,n={parent:i.parentElement,doc:t,extensions:[...qr(i.parentElement)]},r=new _t(Ri("code-editor",n));return r.setMode(e,t),i.style.display="none",r}function TP(i,e){let t=i.value,n={parent:i.parentElement,doc:t,extensions:[...qr(i.parentElement),v.updateListener.of(o=>{o.docChanged&&(i.value=o.state.doc.toString())})]},r=Ri("code-input",n),s=new _t(r);return s.setMode(e,t),i.style.display="none",s}function zP(i,e,t,n){let r=i.textContent,s={parent:i.parentElement,doc:r,extensions:[ot.of(n),...qr(i.parentElement),v.updateListener.of(O=>{e(O)}),v.domEventHandlers(t)]};window.$events.emitPublic(i,"editor-markdown-cm6::pre-init",{editorViewConfig:s});let o=Ri("markdown-editor",s);return new _t(o).setMode("markdown",""),i.style.display="none",o}export{wP as highlight,xP as highlightWithin,TP as inlineEditor,zP as markdownEditor,vP as popupEditor,kP as wysiwygView};